text
stringlengths
232
16.3k
domain
stringclasses
1 value
difficulty
stringclasses
3 values
meta
dict
<|fim_suffix|> """ Sets the version of this Problem. :param version: The version of this Problem. :type version: int """ self._version = version @property def body(self) -> Body: """ Gets the body of this Problem. :return: The body of th...
code_fim
hard
{ "lang": "python", "repo": "ldev-r3-t4/storage_server", "path": "/web/swagger_server/models/problem.py", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|>migrate = Migrate(app, db) manager.add_command("shell", Shell(make_context=make_shell_context)) manager.add_command("db", MigrateCommand) @manager.command def test(coverage=False): """Run the unit tests.""" if coverage and not os.environ.get('FLASK_COVERAGE'): import sys os.envir...
code_fim
hard
{ "lang": "python", "repo": "zxxlxx/qk_spider", "path": "/spider.py", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|># repo: zxxlxx/qk_spider path: /spider.py #!/usr/bin/env python import os from flask_jwt import JWT from app.api_1_0.models import InnerResult from app.datasource.models import OriginData COV = None if os.environ.get("FLASK_COVERAGE"): import coverage # TODO:here is not understand COV = c...
code_fim
medium
{ "lang": "python", "repo": "zxxlxx/qk_spider", "path": "/spider.py", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|> fin.wintype = int(wtype.get()) fout.wintype = int(wtype.get()) def overlapsfunc(): olaps = int(overlaps.get()) size = int(fftsize.get()) wintype = int(wtype.get()) fin = FFT(snd, size=size, overlaps=olaps, wintype=wintype) fout = IFFT(real, imag, size=size, overlaps=ol...
code_fim
hard
{ "lang": "python", "repo": "guibarrette/PyoPlug", "path": "/ScriptsPresets/NeedWork/CeciliaProblematic/30-SpectralFilter.py", "mode": "spm", "license": "LicenseRef-scancode-warranty-disclaimer", "source": "the-stack-v2" }
<|fim_suffix|>np.save("Mandelbrot_test_data.npy", mesh)<|fim_prefix|># repo: MateiSarivan/MandelbrotSet path: /tests/generate_test_data.py import numpy as np from manset.mandelbrot import divergence_check_naive x_range = np.linspace(-2.3, 0.7, 20) y_range = np.linspace(-1.5, 1.5, 20) <|fim_middle|>mesh = divergence_...
code_fim
medium
{ "lang": "python", "repo": "MateiSarivan/MandelbrotSet", "path": "/tests/generate_test_data.py", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|># repo: MateiSarivan/MandelbrotSet path: /tests/generate_test_data.py import numpy as np from manset.mandelbrot import divergence_check_naive x_range = np.linspace(-2.3, 0.7, 20) y_range = np.linspace(-1.5, 1.5, 20) <|fim_suffix|>np.save("Mandelbrot_test_data.npy", mesh)<|fim_middle|>mesh = divergence_...
code_fim
medium
{ "lang": "python", "repo": "MateiSarivan/MandelbrotSet", "path": "/tests/generate_test_data.py", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|># repo: xuefenga616/mygit path: /spark/pyspark(by Leaderman git)/1.2.0/examples/sql/spark_sql_cache.py # coding=utf-8 from pyspark import SparkConf, SparkContext from pyspark.sql import HiveContext, Row conf = SparkConf().setAppName("spark_sql_cache") sc = SparkContext(conf=conf) hc = HiveContext(sc)...
code_fim
medium
{ "lang": "python", "repo": "xuefenga616/mygit", "path": "/spark/pyspark(by Leaderman git)/1.2.0/examples/sql/spark_sql_cache.py", "mode": "psm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|> def printRows(rows): for row in rows: print row datas = hc.sql("select * from temp_mytable").collect() printRows(datas) datas = hc.sql("select col1 from temp_mytable").collect() printRows(datas) # hc.uncacheTable("temp_mytable") sc.stop()<|fim_prefix|># repo: xuefenga616/mygit path: /s...
code_fim
medium
{ "lang": "python", "repo": "xuefenga616/mygit", "path": "/spark/pyspark(by Leaderman git)/1.2.0/examples/sql/spark_sql_cache.py", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|> for movie in movieList: yield { 'title': movie.xpath('//div[contains(@class, "info")]/div[contains(@class, "hd")]/a/span[@class="title"][1]/text()').extract_first(), 'img': movie.xpath('//div[@class="pic"]/a/img/@src').extract_first() } ...
code_fim
medium
{ "lang": "python", "repo": "iamMarkchu/spider", "path": "/spider/spiders/movie.py", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|># repo: iamMarkchu/spider path: /spider/spiders/movie.py # -*- coding: utf-8 -*- import scrapy class MovieSpider(scrapy.Spider): name = 'movie' allowed_domains = ['movie.douban.com'] start_urls = ['http://movie.douban.com/top250'] <|fim_suffix|> # 下一页逻辑 nextPage = response.x...
code_fim
hard
{ "lang": "python", "repo": "iamMarkchu/spider", "path": "/spider/spiders/movie.py", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|> track = track_info.tracks[trackname] TL.load_tracks([trackname]) this_looper = TL.tracks[trackname] thtr=this_looper.tr main_core_list = nar(this_looper.core_list) main_core_list.sort() mini_scrubbers={} for core_id in main_core_list: print('buddy_centroid',core_id)...
code_fim
medium
{ "lang": "python", "repo": "dcollins4096/p19_newscripts", "path": "/analysis_pipe/buddy_centroid.py", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|># repo: dcollins4096/p19_newscripts path: /analysis_pipe/buddy_centroid.py from starter2 import * import buddy_hair reload(buddy_hair) import find_other_cores reload(find_other_cores) import track_loader as TL <|fim_suffix|> track = track_info.tracks[trackname] TL.load_tracks([trackname]) ...
code_fim
medium
{ "lang": "python", "repo": "dcollins4096/p19_newscripts", "path": "/analysis_pipe/buddy_centroid.py", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|># repo: Utsavjain4561/Image-Captioning path: /evaluate.py from numpy import argmax from pickle import load from keras.preprocessing.text import Tokenizer from keras.preprocessing.sequence import pad_sequences from keras.models import load_model from nltk.translate.bleu_score import corpus_bleu def load_d...
code_fim
hard
{ "lang": "python", "repo": "Utsavjain4561/Image-Captioning", "path": "/evaluate.py", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|>train_features = load_photo_features('/home/uj/Desktop/Resources/features.pkl',train_data) print('Photos: %d'%len(train_features)) tokenizer = create_tokenizer(train_descriptions) vocab_length = len(tokenizer.word_index)+1 print('Vocabulary Size: %d'%vocab_length) max_length = max_length(train_descripti...
code_fim
hard
{ "lang": "python", "repo": "Utsavjain4561/Image-Captioning", "path": "/evaluate.py", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|>train_descriptions = load_descriptions('/home/uj/Desktop/Resources/descriptions.txt', train_data) print('Descriptions: %d'%len(train_descriptions)) train_features = load_photo_features('/home/uj/Desktop/Resources/features.pkl',train_data) print('Photos: %d'%len(train_features)) tokenizer = create_token...
code_fim
hard
{ "lang": "python", "repo": "Utsavjain4561/Image-Captioning", "path": "/evaluate.py", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|>#n-2 because we using sample data s_sqr = sse/(len(x)-2) print('sigma sqr = '+str(s_sqr)) #calculating Variances s = s_sqr**0.5 sb1 = s/(dem**0.5) varb1 = sb1**2 print('Var(b1) = '+str(varb1)) varb0 = (s_sqr*ssx)/(len(x)*dem) print('Var(b0) = '+str(varb0)) #calculating correlation r_sqr = ssr/sst prin...
code_fim
hard
{ "lang": "python", "repo": "ChaosTheLegend/Statistics-HW", "path": "/HW7/prob3.py", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|>varb0 = (s_sqr*ssx)/(len(x)*dem) print('Var(b0) = '+str(varb0)) #calculating correlation r_sqr = ssr/sst print('r^2 = '+str(r_sqr)) plt.plot([min(x),max(x)],[min(y_pred),max(y_pred)]) plt.scatter(x,y) plt.show()<|fim_prefix|># repo: ChaosTheLegend/Statistics-HW path: /HW7/prob3.py import openpyxl from...
code_fim
hard
{ "lang": "python", "repo": "ChaosTheLegend/Statistics-HW", "path": "/HW7/prob3.py", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|># repo: ChaosTheLegend/Statistics-HW path: /HW7/prob3.py import openpyxl from pathlib import Path import os import numpy as np import matplotlib.pyplot as plt from scipy.stats import t filename = 'datap3.txt' pt = Path(__file__) parent = pt.parent filepath = Path.joinpath(parent,filename) data = [] f...
code_fim
hard
{ "lang": "python", "repo": "ChaosTheLegend/Statistics-HW", "path": "/HW7/prob3.py", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|> """[summary] Verifica si se ha intentado hacer 3 compras en menos de 2 minutos Args: lista ([List], optional): [Recibe la lista de violaciones y agrega una nueva violacion si se cumple la condicion inicial]. Defaults to list_violations. Returns: [List]: [Retorna la...
code_fim
hard
{ "lang": "python", "repo": "kemirandad/Authorizer", "path": "/Operations/violations_list.py", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|>def violation_frequency(lista = list_violations): """[summary] Verifica si se ha intentado hacer 3 compras en menos de 2 minutos Args: lista ([List], optional): [Recibe la lista de violaciones y agrega una nueva violacion si se cumple la condicion inicial]. Defaults to list_vio...
code_fim
hard
{ "lang": "python", "repo": "kemirandad/Authorizer", "path": "/Operations/violations_list.py", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|># repo: kemirandad/Authorizer path: /Operations/violations_list.py from Validations.val_account import is_already_initialized from Validations.val_transaction import status_card, set_disponible, double_transaction, entry_point, time_validation_double, time_validation_frequency from Entities.violations im...
code_fim
hard
{ "lang": "python", "repo": "kemirandad/Authorizer", "path": "/Operations/violations_list.py", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|> operations = [ migrations.AlterField( model_name='pageobjects', name='content', field=models.JSONField(max_length=100, verbose_name='Содержание'), ), ]<|fim_prefix|># repo: ShancoVils/web_calc_repos path: /backend/django_web_calculator/web_calcu...
code_fim
medium
{ "lang": "python", "repo": "ShancoVils/web_calc_repos", "path": "/backend/django_web_calculator/web_calculator/migrations/0024_alter_pageobjects_content.py", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|># repo: ShancoVils/web_calc_repos path: /backend/django_web_calculator/web_calculator/migrations/0024_alter_pageobjects_content.py # Generated by Django 3.2.5 on 2021-09-02 13:39 <|fim_suffix|> operations = [ migrations.AlterField( model_name='pageobjects', name='conte...
code_fim
medium
{ "lang": "python", "repo": "ShancoVils/web_calc_repos", "path": "/backend/django_web_calculator/web_calculator/migrations/0024_alter_pageobjects_content.py", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|># repo: alenzhao/bio_tools path: /utils_plot.py import pylab, time, os import numarray, Gnuplot, random def plotPtLs(pt_ls, titles, g): r = random.randint(1, 100) plot_command = "plot 'tmp" rm_command = 'rm tmp' for index in xrange(len(pt_ls)): tmp_suffix = str(r + index) ...
code_fim
hard
{ "lang": "python", "repo": "alenzhao/bio_tools", "path": "/utils_plot.py", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|> (n, bins_res1, patches1) = pylab.hist(data1, bins=b) (n, bins_res2, patches2) = pylab.hist(data2, bins=b) (n, bins_res3, patches3) = pylab.hist(data3, bins=b) (n, bins_res4, patches4) = pylab.hist(data4, bins=b) pylab.setp(patches1, 'facecolor', 'g', 'alpha', .75) pylab.setp(patche...
code_fim
hard
{ "lang": "python", "repo": "alenzhao/bio_tools", "path": "/utils_plot.py", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|> def test_home_url_resolves_home_view(self): view = resolve('/') # self.assertEqual(view.func, home) self.assertEqual(view.func.view_class, BoardListView) def test_home_view_contains_link_to_topics_page(self): board_topics_url = reverse('board_topics', kwargs={'pk':...
code_fim
medium
{ "lang": "python", "repo": "MingruiWang2017/DjangoProject", "path": "/boards/tests/test_view_home.py", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|># repo: MingruiWang2017/DjangoProject path: /boards/tests/test_view_home.py # encoding: utf-8 """ @ author: wangmingrui @ time: 2019/9/30 14:42 @ desc: """ from django.test import TestCase from django.core.urlresolvers import reverse from django.urls import resolve <|fim_suffix|>class HomeTests(TestCa...
code_fim
medium
{ "lang": "python", "repo": "MingruiWang2017/DjangoProject", "path": "/boards/tests/test_view_home.py", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|>for i in range(0,len(deviceslist)): print 'current devices:' print deviceslist[i] devices.append(mr.waitForConnection(1.0,deviceslist[i])) thread.start_new_thread(thread_monkey, (devices[i], ) ) time.sleep(15)<|fim_prefix|># repo: icsnju/apt-dm path: /DeviceManagerWeb/apkbat/work_thread.py im...
code_fim
hard
{ "lang": "python", "repo": "icsnju/apt-dm", "path": "/DeviceManagerWeb/apkbat/work_thread.py", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|># repo: icsnju/apt-dm path: /DeviceManagerWeb/apkbat/work_thread.py import sys,time,datetime,thread,os from com.android.monkeyrunner import MonkeyRunner as mr from com.android.monkeyrunner import MonkeyDevice as md from com.android.monkeyrunner import MonkeyImage as mi BASE_DIR = os.path.abspath(o...
code_fim
hard
{ "lang": "python", "repo": "icsnju/apt-dm", "path": "/DeviceManagerWeb/apkbat/work_thread.py", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|># repo: conyml/Proyecto-Estrellas-Variables path: /Desktop/FINAL-PROYECTO-ESTRELLAS-VARIABLES-master/DASCH Lightcurve info/order_lightcurves_dasch.py #!/usr/bin/env python2 # -*- coding: utf-8 -*- """ Created on Mon Jun 10 11:59:55 2019 @author: Alvaro """ import os import pandas as pd from astropy.coo...
code_fim
hard
{ "lang": "python", "repo": "conyml/Proyecto-Estrellas-Variables", "path": "/Desktop/FINAL-PROYECTO-ESTRELLAS-VARIABLES-master/DASCH Lightcurve info/order_lightcurves_dasch.py", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|>j = 0 DASCH_OGLE_match['DASCH ID'] = '' for i in idx: DASCH_OGLE_match['DASCH ID'][i] = IDS_DASCH[j] j+=1 DASCH_OGLE_match.to_csv('DASCH-OGLE-crossmatch.csv', index = False)<|fim_prefix|># repo: conyml/Proyecto-Estrellas-Variables path: /Desktop/FINAL-PROYECTO-ESTRELLAS-VARIABLES-master/DASC...
code_fim
hard
{ "lang": "python", "repo": "conyml/Proyecto-Estrellas-Variables", "path": "/Desktop/FINAL-PROYECTO-ESTRELLAS-VARIABLES-master/DASCH Lightcurve info/order_lightcurves_dasch.py", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|>#CROSSMATCH de astropy entre IDs de OGLE y DASCH por las coordenadas de cada catalogo. DASCH_coords = SkyCoord(ras_DASCH,decs_DASCH, unit = [u.hourangle,u.deg]) OGLE_coords = SkyCoord(DASCH_OGLE_match['ra'],DASCH_OGLE_match['dec'],unit=[u.hourangle,u.deg]) idx, d2d, d3d = DASCH_coords.match_to_catalog_sky...
code_fim
hard
{ "lang": "python", "repo": "conyml/Proyecto-Estrellas-Variables", "path": "/Desktop/FINAL-PROYECTO-ESTRELLAS-VARIABLES-master/DASCH Lightcurve info/order_lightcurves_dasch.py", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|># repo: Quildra/tourney path: /tourney/lib/models/role.py # -*- coding: utf-8 -*- from sqlalchemy import Column from sqlalchemy.types import Unicode, Integer from sqlalchemy.orm import relationship, backref from lib.models import Base __all__ = ['Role'] class Role(Base): <|fim_suffix|> users = rela...
code_fim
medium
{ "lang": "python", "repo": "Quildra/tourney", "path": "/tourney/lib/models/role.py", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|> @staticmethod def all(session): return session.query(Role)<|fim_prefix|># repo: Quildra/tourney path: /tourney/lib/models/role.py # -*- coding: utf-8 -*- from sqlalchemy import Column from sqlalchemy.types import Unicode, Integer from sqlalchemy.orm import relationship, backref from lib....
code_fim
medium
{ "lang": "python", "repo": "Quildra/tourney", "path": "/tourney/lib/models/role.py", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|> users = relationship("User", order_by="User.id", backref="user") @staticmethod def get_by_id(session, id): return session.query(Role).filter(Role.id == id).one() @staticmethod def all(session): return session.query(Role)<|fim_prefix|># repo: Quildra/tourney p...
code_fim
medium
{ "lang": "python", "repo": "Quildra/tourney", "path": "/tourney/lib/models/role.py", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|># repo: codacy-badger/pythonApps path: /colors/primaryColors.py def diff(a, b): return a -b def simpleColor(r,g,b): r = int(r) g = int(g) b = int(b) bg = ir = 0 try: if r > g and r > b: rg = diff(r,g) rb = diff(r,b) if g <...
code_fim
hard
{ "lang": "python", "repo": "codacy-badger/pythonApps", "path": "/colors/primaryColors.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> if r < 65 and g < 65 and bg > 60: return "BLUE" rg = diff(r,g) if g > r: if bg > rg: if bg <= 20: return "TURQOISE" else: return "LIGHT B...
code_fim
hard
{ "lang": "python", "repo": "codacy-badger/pythonApps", "path": "/colors/primaryColors.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> rg = diff(r,g) if g > r: if bg > rg: if bg <= 20: return "TURQOISE" else: return "LIGHT BLUE" else: if rg <= 20: if r ...
code_fim
hard
{ "lang": "python", "repo": "codacy-badger/pythonApps", "path": "/colors/primaryColors.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: johannalbino/course_python_geek_university path: /S13 - Leitura e Escrita em Arquivos/S13E89 - Seek e Cursors.py """ Seek e Cursors seek() -> É utilizado para movimentar o cursor pelo arquivo. arquivo = open('texto.txt') print(arquivo.read()) <|fim_suffix|>print(arquivo.read()) # readline() ...
code_fim
hard
{ "lang": "python", "repo": "johannalbino/course_python_geek_university", "path": "/S13 - Leitura e Escrita em Arquivos/S13E89 - Seek e Cursors.py", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|>arquivo = open('texto.txt') print(arquivo.read()) print(arquivo.closed) #Verifica se o arquivo está aberto ou fechado - True: Arquivo fechado / False: Arquivo aberto arquivo.close() print(arquivo.closed)<|fim_prefix|># repo: johannalbino/course_python_geek_university path: /S13 - Leitura e Escrita em...
code_fim
hard
{ "lang": "python", "repo": "johannalbino/course_python_geek_university", "path": "/S13 - Leitura e Escrita em Arquivos/S13E89 - Seek e Cursors.py", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|>a from app.models.user import User # noqa from app.models.chinook import Artist, Employee, Genre, MediaType, Playlist, Album, Customer, Invoice, Track, InvoiceLine<|fim_prefix|># repo: JayGitH/SQLacodegen-FastAPI path: /backend/app/app/db/base.py # Import all the models, so that Base has them before bei...
code_fim
medium
{ "lang": "python", "repo": "JayGitH/SQLacodegen-FastAPI", "path": "/backend/app/app/db/base.py", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|># repo: JayGitH/SQLacodegen-FastAPI path: /backend/app/app/db/base.py # Import all the models, so that Base has them before being # imported by Alembic <|fim_suffix|>Employee, Genre, MediaType, Playlist, Album, Customer, Invoice, Track, InvoiceLine<|fim_middle|>from app.db.base_class import Base # noqa ...
code_fim
medium
{ "lang": "python", "repo": "JayGitH/SQLacodegen-FastAPI", "path": "/backend/app/app/db/base.py", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|> plt.rc('text', usetex=True) plt.rc('font', family='serif') fig, ax = plt.subplots() im, cbar = heatmap(df, c_L, m_L, ax=ax, cmap="YlGn", cbarlabel=val_label) texts = annotate_heatmap(im, valfmt='{x:'+n_digits+'}', fsize=16)#6) fig.tight_layout() #plt.show() outName = 'punzi_2Dmap_bdt_vs_'+'_trn_'+...
code_fim
hard
{ "lang": "python", "repo": "hotdrinkbrian/pyplot_template", "path": "/readPlot/heat_map/punzi_map_stack.py", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|># repo: hotdrinkbrian/pyplot_template path: /readPlot/heat_map/punzi_map_stack.py from sklearn.externals import joblib import pandas as pd from hm import * from matplotlib import pyplot as plt pth = '/home/hezhiyua/desktop/DeepTop/LLP/Limits/'+'MA/'+'bdt/' #pth_out = '/beegfs/desy/user/hezhiyua/...
code_fim
hard
{ "lang": "python", "repo": "hotdrinkbrian/pyplot_template", "path": "/readPlot/heat_map/punzi_map_stack.py", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|># repo: aerocat/CSC394-Project path: /capstone/coursesDB/dataManipulationAndPopulatingDatabase/efficientCourseAlgorithm.py from coursesDB.dataManipulationAndPopulatingDatabase.databaseRetrieval import * intro_courses = ["CSC400", "CSC401", "CSC402", "CSC403", "CSC406", "CSC407"] foundation_courses = ["C...
code_fim
hard
{ "lang": "python", "repo": "aerocat/CSC394-Project", "path": "/capstone/coursesDB/dataManipulationAndPopulatingDatabase/efficientCourseAlgorithm.py", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|> quarters = ["Fall", "Winter", "Spring", "Summer"] if quarter == "Summer": return "Fall" else: return quarters[quarters.index(quarter) + 1] elective_preference = [] def have_prereqs_for_electives(number, introCourses, current_quarter, classes_per_quarter): global elective_p...
code_fim
hard
{ "lang": "python", "repo": "aerocat/CSC394-Project", "path": "/capstone/coursesDB/dataManipulationAndPopulatingDatabase/efficientCourseAlgorithm.py", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|># repo: sergeyyun/utils path: /results_notify.py import boto3 import os import json from configparser import ConfigParser parser = ConfigParser() parser.read('config.ini') def send_email_ses(recipients=None, sender=None, subject=None, body=None): ses = boto3.client('ses', region_name=parser.get('c...
code_fim
hard
{ "lang": "python", "repo": "sergeyyun/utils", "path": "/results_notify.py", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|> #send the email send_email_ses (recipients=user_email, sender=parser.get('configuration_variables', 'MAIL_DEFAULT_SENDER'), subject=subject, body=body) print("Email notification sent") #delete the message message.delete() ...
code_fim
hard
{ "lang": "python", "repo": "sergeyyun/utils", "path": "/results_notify.py", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|># main loop try: while True: forward(50) time.sleep(2) reverse(50) time.sleep(2) turn(rspeed= 20, lspeed =50) time.sleep(2) turn(rspeed = 50, lspeed = 20) time.sleep(2) stopall() time.sleep(10) except KeyboardInterrupt: GPIO.cleanup()<|fim_prefix|># repo: ucs...
code_fim
medium
{ "lang": "python", "repo": "ucsd-cse-spis-2016/robotics-pizazz", "path": "/test_motor.py", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|># repo: ucsd-cse-spis-2016/robotics-pizazz path: /test_motor.py # Pizazz Motor Test # Moves: Forward, Reverse, turn Right, turn Left, Stop - then repeat # Press Ctrl-C to stop # # To check wiring is correct ensure the order of movement as above is correct # Run using: sudo python motorTest.py import RP...
code_fim
medium
{ "lang": "python", "repo": "ucsd-cse-spis-2016/robotics-pizazz", "path": "/test_motor.py", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|> # Use pika connection params to set connection details credentials = pika.PlainCredentials('amqp', 'amqp') connParams = pika.ConnectionParameters( host='localhost', port=5672, virtual_host='/', credentials=credentials) # Create a PikaBusSetup instance with a listener queue, and add the m...
code_fim
hard
{ "lang": "python", "repo": "hansehe/PikaBus", "path": "/Examples/consumer_example.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|>class Errors(db.Model): id = db.Column(UUID, primary_key=True, default=uuid4) name = db.Column(db.String(50)) description = db.Column(db.String(200)) calculation_id = db.Column(UUID, db.ForeignKey('calculation.id'))<|fim_prefix|># repo: dpPython/dpPython_165 path: /calculation_service/ser...
code_fim
medium
{ "lang": "python", "repo": "dpPython/dpPython_165", "path": "/calculation_service/services/models.py", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|># repo: dpPython/dpPython_165 path: /calculation_service/services/models.py from uuid import uuid4 from sqlalchemy.dialects.postgresql import UUID from .config import db <|fim_suffix|>class Errors(db.Model): id = db.Column(UUID, primary_key=True, default=uuid4) name = db.Column(db.String(50)) ...
code_fim
hard
{ "lang": "python", "repo": "dpPython/dpPython_165", "path": "/calculation_service/services/models.py", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|> id = db.Column(UUID, primary_key=True, default=uuid4) project_id = db.Column(unique=True) # result = db.Column(db.Decimal, default=0) error_relation = db.relation('Errors') class Errors(db.Model): id = db.Column(UUID, primary_key=True, default=uuid4) name = db.Column(db.String(50)...
code_fim
medium
{ "lang": "python", "repo": "dpPython/dpPython_165", "path": "/calculation_service/services/models.py", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|># repo: chiachin-yen/Crowd_simulation_py3 path: /entities/obstacles.py # obstacles for the scene import pygame from utils import SIM_COLORS, SCALE from utils import euclidean_distance, vec2d class Obstacle(object): """ Scene obstacles """ def __init__(self, screen, oid, otype, params): ...
code_fim
hard
{ "lang": "python", "repo": "chiachin-yen/Crowd_simulation_py3", "path": "/entities/obstacles.py", "mode": "psm", "license": "BSD-3-Clause", "source": "the-stack-v2" }
<|fim_suffix|> def convert_to_cells(self, grid): pass @property def id(self): return self._id @property def type(self): return self._type @property def params(self): return (self._params[0] / SCALE, self._params[1] / SCALE, self._params[2] / SCALE, self._pa...
code_fim
hard
{ "lang": "python", "repo": "chiachin-yen/Crowd_simulation_py3", "path": "/entities/obstacles.py", "mode": "spm", "license": "BSD-3-Clause", "source": "the-stack-v2" }
<|fim_suffix|> def _line_intersection(self, line, point): """ Fine the point of intersetion of a line and a point Line is given as (x1,y1, x2,y2), point (x,y) based on http://paulbourke.net/geometry/pointlineplane/ """ den = euclidean_distance((line[0],line[1]), (li...
code_fim
hard
{ "lang": "python", "repo": "chiachin-yen/Crowd_simulation_py3", "path": "/entities/obstacles.py", "mode": "spm", "license": "BSD-3-Clause", "source": "the-stack-v2" }
<|fim_suffix|>== orange: print("Orange, no way me too!!") else: print("I don't really relate to people with {colour} as colour choice!") if hobby == code: print("HelloWorld") else: print("GoodbyeWorld") ''' main()<|fim_prefix|># repo: nei1d0r/python path: /helloworld.py def main(): print("Nam...
code_fim
hard
{ "lang": "python", "repo": "nei1d0r/python", "path": "/helloworld.py", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|># repo: nei1d0r/python path: /helloworld.py def main(): print("Name: {name}\nAge: int{age}\nFavourite Colour: {colour}\nPet name(s): {pet}\nHobbies: {hobby}".format(name = input("What is your name? "),age = int(input("How old are you? ")),colour = input("What is your favourite colour? "),pet = input(...
code_fim
hard
{ "lang": "python", "repo": "nei1d0r/python", "path": "/helloworld.py", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|> def build(self): c1 = load(self, os.path.join(self.source_folder, "source.txt")) c2 = load(self, os.path.join(self.source_folder, "..", "exported.txt")) save(self, "build.txt", c1 + c2) def package(self): copy(self, "...
code_fim
hard
{ "lang": "python", "repo": "conan-io/conan", "path": "/conans/test/functional/layout/test_build_system_layout_helpers.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> if (j=="C") or (j=="M") or (j=="Y"): print("#Color") game=False sys.exit() if game==True: print("#Black&White")<|fim_prefix|># repo: Social-CodePlat/Comptt-Coding-Solutions path: /Codeforces Problems/Brain's Photos/Brain's Photos.py import sys r,c=[int(x) for x i...
code_fim
medium
{ "lang": "python", "repo": "Social-CodePlat/Comptt-Coding-Solutions", "path": "/Codeforces Problems/Brain's Photos/Brain's Photos.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: Social-CodePlat/Comptt-Coding-Solutions path: /Codeforces Problems/Brain's Photos/Brain's Photos.py import sys r,c=[int(x) for x in input().split()] game=True arr=[] for i in range(r): arr.append(input().split()) for i in arr: for j in i: <|fim_suffix|> game=False sys....
code_fim
medium
{ "lang": "python", "repo": "Social-CodePlat/Comptt-Coding-Solutions", "path": "/Codeforces Problems/Brain's Photos/Brain's Photos.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> game=False sys.exit() if game==True: print("#Black&White")<|fim_prefix|># repo: Social-CodePlat/Comptt-Coding-Solutions path: /Codeforces Problems/Brain's Photos/Brain's Photos.py import sys r,c=[int(x) for x in input().split()] game=True arr=[] for i in r<|fim_middle|>ange(r): arr...
code_fim
medium
{ "lang": "python", "repo": "Social-CodePlat/Comptt-Coding-Solutions", "path": "/Codeforces Problems/Brain's Photos/Brain's Photos.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|>lse: print ("I=%.1f J=%.1f"%(fi/10.0,j+(fi/10.0)))<|fim_prefix|># repo: FelipeNunes04/URI path: /1098.py for i in range(0,22,2): fi = float(i) for j in range(1,4): if((fi/10)==2.0 or (fi/10)==1.0 or (fi/10)=<|fim_middle|>=0.0): print ("I=%d J=%d"%(i/10,j+int(fi/10))) e
code_fim
easy
{ "lang": "python", "repo": "FelipeNunes04/URI", "path": "/1098.py", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|>=0.0): print ("I=%d J=%d"%(i/10,j+int(fi/10))) else: print ("I=%.1f J=%.1f"%(fi/10.0,j+(fi/10.0)))<|fim_prefix|># repo: FelipeNunes04/URI path: /1098.py for i in range(0,22,2): fi = float(i) for j in rang<|fim_middle|>e(1,4): if((fi/10)==2.0 or (fi/10)==1.0 or (fi/10)=
code_fim
easy
{ "lang": "python", "repo": "FelipeNunes04/URI", "path": "/1098.py", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|># repo: FelipeNunes04/URI path: /1098.py for i in range(0,22,2): fi = float(i) for j in range(1,4): if((fi/10)==2.0 or (fi/10)==1.0 or (fi/10)=<|fim_suffix|>lse: print ("I=%.1f J=%.1f"%(fi/10.0,j+(fi/10.0)))<|fim_middle|>=0.0): print ("I=%d J=%d"%(i/10,j+int(fi/10))) e
code_fim
easy
{ "lang": "python", "repo": "FelipeNunes04/URI", "path": "/1098.py", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|> class Reports(models.Model): report_name = models.CharField(max_length=255) report_detail = models.TextField() due_date = models.DateTimeField() created_at = models.DateTimeField(auto_now_add=True) updated_at = models.DateTimeField(auto_now_add=True) class Report_submitting(models.M...
code_fim
hard
{ "lang": "python", "repo": "Abdulla-Ydyrys/sdu_beta_web", "path": "/sdu_beta_web_app/models.py", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|># repo: Abdulla-Ydyrys/sdu_beta_web path: /sdu_beta_web_app/models.py from django.db import models from django.contrib.auth.models import AbstractUser from django.db.models.signals import post_save from django.dispatch import receiver from django.core.validators import MaxValueValidator, MinValueValidato...
code_fim
hard
{ "lang": "python", "repo": "Abdulla-Ydyrys/sdu_beta_web", "path": "/sdu_beta_web_app/models.py", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|> class Report_submitting(models.Model): SUB_STATUS = ( (0, 'Not Submitted'), (1, 'Submitted'), (2, 'Graded'), ) student_id = models.ForeignKey(Students, on_delete=models.CASCADE) report_id = models.ForeignKey(Reports, on_delete=models.CASCADE) references = model...
code_fim
hard
{ "lang": "python", "repo": "Abdulla-Ydyrys/sdu_beta_web", "path": "/sdu_beta_web_app/models.py", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|># repo: acpn/analytcs-challenge path: /challenge/challengeApp/migrations/0001_initial.py # Generated by Django 3.0.5 on 2020-05-04 05:11 from django.db import migrations, models import django.db.models.deletion import jsonfield.fields class Migration(migrations.Migration): initial = True dep...
code_fim
hard
{ "lang": "python", "repo": "acpn/analytcs-challenge", "path": "/challenge/challengeApp/migrations/0001_initial.py", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|>, serialize=False, verbose_name='ID')), ('userid', models.IntegerField()), ('logdescription', models.CharField(max_length=500)), ('created', models.DateTimeField(auto_now_add=True)), ('timeresponse', models.CharField(max_length=20, null=True)...
code_fim
hard
{ "lang": "python", "repo": "acpn/analytcs-challenge", "path": "/challenge/challengeApp/migrations/0001_initial.py", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|>ields.JSONField(null=True)), ], ), migrations.CreateModel( name='AnalyticsViews', fields=[ ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')), ('viewid', models.IntegerField()...
code_fim
hard
{ "lang": "python", "repo": "acpn/analytcs-challenge", "path": "/challenge/challengeApp/migrations/0001_initial.py", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|># repo: manasishrotri/DS595CS525-RL-Projects path: /Project1/mdp_dp.py # -*- coding: utf-8 -*- """ Created on Thu Sep 17 20:26:48 2020 RL Project 1: Frozen Lake MDP @author: Manasi Shrotri """ ### MDP Value Iteration and Policy Iteration ### Reference: https://web.stanford.edu/class/cs234/assignment1/ind...
code_fim
hard
{ "lang": "python", "repo": "manasishrotri/DS595CS525-RL-Projects", "path": "/Project1/mdp_dp.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> """ Learn value function and policy by using value iteration method for a given gamma and environment. Parameters: ---------- P, nS, nA, gamma: defined at beginning of file V: value to be updated tol: float Terminate value iteration when max |val...
code_fim
hard
{ "lang": "python", "repo": "manasishrotri/DS595CS525-RL-Projects", "path": "/Project1/mdp_dp.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> print("CUT OF CALCULATOR") print("Cutt off calculator @nikku ") x = int(input("Enter your maths mark:")) y = int(input("enter your physics mark:")) z = int(input("enter your chemistry mark:")) average = (y+z)/2+x print("your cut off is :" ) print(average)<|fim_prefix|># repo: nishanthrg/cutoff...
code_fim
easy
{ "lang": "python", "repo": "nishanthrg/cutoffcalc", "path": "/main.py", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|># repo: nishanthrg/cutoffcalc path: /main.py from flask import Flask app = Flask(__name__) <|fim_suffix|>print("Cutt off calculator @nikku ") x = int(input("Enter your maths mark:")) y = int(input("enter your physics mark:")) z = int(input("enter your chemistry mark:")) average = (y+z)/2+x p...
code_fim
medium
{ "lang": "python", "repo": "nishanthrg/cutoffcalc", "path": "/main.py", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|>print("Cutt off calculator @nikku ") x = int(input("Enter your maths mark:")) y = int(input("enter your physics mark:")) z = int(input("enter your chemistry mark:")) average = (y+z)/2+x print("your cut off is :" ) print(average)<|fim_prefix|># repo: nishanthrg/cutoffcalc path: /main.py from flask i...
code_fim
easy
{ "lang": "python", "repo": "nishanthrg/cutoffcalc", "path": "/main.py", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|> async def disconnect(self): if self.heartbeat_sender: self.heartbeat_sender.cancel() if self.__ws: await self.__ws.close() if self.__session: await self.__session.close() # Should we close event loop? async def identify(self): ...
code_fim
hard
{ "lang": "python", "repo": "Lapis0875/volt.py", "path": "/volt/gateway.py", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|># repo: Lapis0875/volt.py path: /volt/gateway.py import asyncio import json from enum import IntEnum, IntFlag, Enum from random import random from typing import Final, List import aiohttp from volt.events import EventManager from volt.utils.log import get_logger, DEBUG from volt.utils.loop_task import ...
code_fim
hard
{ "lang": "python", "repo": "Lapis0875/volt.py", "path": "/volt/gateway.py", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|> return len(dict(self)) def __contains__(self, item): if item == self.key_name: return True return item in self._data def iteritems(self): yield self.key_name, self.key for k, v in self._data.items(): yield k, v def items(self):...
code_fim
hard
{ "lang": "python", "repo": "ArminGruner/redpipe", "path": "/redpipe/structs.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: ArminGruner/redpipe path: /redpipe/structs.py # -*- coding: utf-8 -*- """ The Struct is a convenient way to access data in a hash. Makes it possible to load data from redis as an object and access the fields. Then store changes back into redis. """ from six import add_metaclass from json.encoder ...
code_fim
hard
{ "lang": "python", "repo": "ArminGruner/redpipe", "path": "/redpipe/structs.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: Bluefog-Lib/EastCoastTutorial2021 path: /test/test_notebook.py import atexit import functools import glob import os import subprocess import time import papermill as pm import pytest SKIP_NOTEBOOKS = [] TEST_CWD = os.getcwd() def _list_all_notebooks(): output = subprocess.check_output(["gi...
code_fim
hard
{ "lang": "python", "repo": "Bluefog-Lib/EastCoastTutorial2021", "path": "/test/test_notebook.py", "mode": "psm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|> @pytest.mark.parametrize("notebook_path", _list_all_notebooks()) def test_notebooks_against_bluefog(notebook_path): os.environ["TEST_ENV"] = "1" try: notebook_file = os.path.basename(notebook_path) notebook_rel_dir = os.path.dirname(os.path.relpath(notebook_path, ".")) os....
code_fim
medium
{ "lang": "python", "repo": "Bluefog-Lib/EastCoastTutorial2021", "path": "/test/test_notebook.py", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|>X_train, X_test, y_train, y_test = cross_validation.train_test_split(features, labels, test_size=0.3, random_state=42) clf = tree.DecisionTreeClassifier() clf.fit(X_train, y_train) pred = clf.predict(X_test) print "score",clf.score(X_test, y_test) print "poi predicted in test set", sum([i for i in pred]) ...
code_fim
medium
{ "lang": "python", "repo": "poindextrose/ud120-projects", "path": "/evaluation/evaluate_poi_identifier.py", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|>data_dict = pickle.load(open("../final_project/final_project_dataset.pkl", "r") ) ### add more features to features_list! features_list = ["poi", "salary"] data = featureFormat(data_dict, features_list) labels, features = targetFeatureSplit(data) ### your code goes here from sklearn import cross_vali...
code_fim
hard
{ "lang": "python", "repo": "poindextrose/ud120-projects", "path": "/evaluation/evaluate_poi_identifier.py", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|># repo: poindextrose/ud120-projects path: /evaluation/evaluate_poi_identifier.py #!/usr/bin/python """ Starter code for the evaluation mini-project. Start by copying your trained/tested POI identifier from that which you built in the validation mini-project. This is the second step tow...
code_fim
medium
{ "lang": "python", "repo": "poindextrose/ud120-projects", "path": "/evaluation/evaluate_poi_identifier.py", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|>torch_dataset = Data.TensorDataset(x,y) loader = DataLoader(dataset=torch_dataset,batch_size=5, num_workers=2) for epoch in range(3): for step, (batch_x, batch_y) in enumerate(loader): prediction = net(batch_x) loss = loss_func(prediction, batch_y) optimizer.z...
code_fim
medium
{ "lang": "python", "repo": "alptkn/Deep-Learning", "path": "/Basics/batch_train.py", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|># repo: alptkn/Deep-Learning path: /Basics/batch_train.py import torch import torch.nn as nn import torch.nn.functional as F import torch.utils.data as Data from torch.utils.data import DataLoader net = nn.Sequential( nn.Linear(5,1), nn.ReLU(), nn.Linear(1, 1)) <|fim_suffix|>for...
code_fim
hard
{ "lang": "python", "repo": "alptkn/Deep-Learning", "path": "/Basics/batch_train.py", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|>optimizer = torch.optim.SGD(net.parameters(), lr=0.001) loss_func = nn.MSELoss() x = torch.linspace(1,10,10) y = torch.linspace(10,1,10) torch_dataset = Data.TensorDataset(x,y) loader = DataLoader(dataset=torch_dataset,batch_size=5, num_workers=2) for epoch in range(3): for step, (batch_x, ...
code_fim
medium
{ "lang": "python", "repo": "alptkn/Deep-Learning", "path": "/Basics/batch_train.py", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|> print('Your body mass index is ' + bmi(mass,height)) analysis(mass,height) if __name__ == "__main__": run()<|fim_prefix|># repo: JDavid550/python_challenges path: /BMI.py import math def bmi(mass,height): bmi=mass/height bmi=round(bmi,2) bmi=str(bmi) return bmi ...
code_fim
hard
{ "lang": "python", "repo": "JDavid550/python_challenges", "path": "/BMI.py", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|># repo: JDavid550/python_challenges path: /BMI.py import math def bmi(mass,height): bmi=mass/height bmi=round(bmi,2) bmi=str(bmi) return bmi def analysis(mass,height): <|fim_suffix|>def run(): while True: mass=input('Submit your mass in Kg: ') try:...
code_fim
hard
{ "lang": "python", "repo": "JDavid550/python_challenges", "path": "/BMI.py", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|># repo: ch9fod/Markets path: /marketsWithCons.py # coding: utf-8 # In[1]: from pyomo.environ import * m = ConcreteModel() infinity = float('inf') # In[2]: # sets m.B = RangeSet(3, doc='Buses') m.G = RangeSet(3, doc='Generators') m.L = RangeSet(2, doc='Loads') m.dBlocks = RangeSet(4, doc='block bids...
code_fim
hard
{ "lang": "python", "repo": "ch9fod/Markets", "path": "/marketsWithCons.py", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|> return (summation(m.pd) == summation(m.pg)) m.meet = Constraint(rule=meet_rule, doc='Blocks demand = Blocks gen') # ------------------------------------------------------------------------------- def gens_min_rule(model,i): return (m.u[i]*m.gMin[i] <= sum(m.pg[i,j] for ...
code_fim
hard
{ "lang": "python", "repo": "ch9fod/Markets", "path": "/marketsWithCons.py", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|># repo: alokekumardas/MC_QCDTF path: /QCDTF_direct_Mu_lukas_backup.py from ROOT import TH1F, TFile, TChain, TCanvas, gROOT import ROOT import sys import math import os gROOT.SetBatch(True) from optparse import OptionParser parser = OptionParser() parser.add_option("-y", "--year", dest="Year", defaul...
code_fim
hard
{ "lang": "python", "repo": "alokekumardas/MC_QCDTF", "path": "/QCDTF_direct_Mu_lukas_backup.py", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|> h41=TH1F("h41","h41",1,0,2) h41.Sumw2() tree.Draw("1 >> h41","(passPresel_Mu && nJet>=4 && nBJet>=1 && nPho==0 && nLoosePho==0)*evtWeight*PUweight*muEffWeight*btagWeight_1a*prefireSF") #tree.Draw("1 >> h41","(passPresel_Mu && nJet>=4 && nBJet>=1 && nPho==0 && nLoosePho==0)*evtWeight*PUweight*muEffWeig...
code_fim
hard
{ "lang": "python", "repo": "alokekumardas/MC_QCDTF", "path": "/QCDTF_direct_Mu_lukas_backup.py", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|># repo: JaeSeo/basic path: /7.list/3.list_functions_e.py len 함수 len 함수는, 리스트 안의 원소 개수를 세주는 역할을 합니다. alphabet = ["a", "b", "c", "d", "e", "f"] print("리스트의 길이는: %d" % len(alphabet)) 리스트의 길이는: 6 원소 추가하기 insert와 append를 사용하여 리스트에 원소를 추가할 수 있습니다. numbers = [] # 마지막 위치에 5 추가 numbers.append(5) print(numbers...
code_fim
medium
{ "lang": "python", "repo": "JaeSeo/basic", "path": "/7.list/3.list_functions_e.py", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|># 인덱스 3에 있는 값 삭제 del numbers[3] print(numbers) # 인덱스 4부터 마지막 값까지 삭제 del numbers[4:] print(numbers) [1, 2, 3, 5, 6, 7, 8] [1, 2, 3, 5] sorted 함수 sorted 함수는 리스트의 원소들을 오름차순으로 정렬한 새로운 리스트를 리턴해줍니다. sorted 함수를 이용하여 [8, 6, 2, 4, 5, 7, 1, 3]이라는 리스트를 정렬한 후 출력하면, [1, 2, 3, 4, 5, 6, 7, 8]이 나옵니다. numbers = [8, 6, ...
code_fim
hard
{ "lang": "python", "repo": "JaeSeo/basic", "path": "/7.list/3.list_functions_e.py", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|># 인덱스 0 자리에 0 추가 numbers.insert(0, 0) print(numbers) # 인덱스 3 자리에 12 추가 numbers.insert(3, 12) print(numbers) [5] [5, 8] [5, 8, 10] [0, 5, 8, 10] [0, 5, 8, 12, 10] 원소 빼기 del 함수를 사용함으로써 원하는 리스트의 원소를 삭제할 수 있습니다. numbers = [1, 2, 3, 4, 5, 6, 7, 8] # 인덱스 3에 있는 값 삭제 del numbers[3] print(numbers) # 인덱스 4부터 마지...
code_fim
medium
{ "lang": "python", "repo": "JaeSeo/basic", "path": "/7.list/3.list_functions_e.py", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|># repo: l0he1g/tf-exp path: /rnn/r2rt.py # -*- coding: utf-8 -*- import tensorflow as tf def build_graph(vocab_size, state_size=64, batch_size=256, num_classes=6): # Placeholders x = tf.placeholder(tf.int32, [batch_size, None]) # [batch_size, num_steps] seqlen = tf.placeholder(tf.int32, [batch_...
code_fim
hard
{ "lang": "python", "repo": "l0he1g/tf-exp", "path": "/rnn/r2rt.py", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|> loss = tf.reduce_mean(tf.nn.sparse_softmax_cross_entropy_with_logits(logits, y)) train_step = tf.train.AdamOptimizer(1e-4).minimize(loss) return { 'x': x, 'seqlen': seqlen, 'y': y, 'dropout': keep_prob, 'loss': loss, 'ts': train_step, 'preds': preds, 'accuracy': accu...
code_fim
hard
{ "lang": "python", "repo": "l0he1g/tf-exp", "path": "/rnn/r2rt.py", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }