text
stringlengths
232
16.3k
domain
stringclasses
1 value
difficulty
stringclasses
3 values
meta
dict
<|fim_prefix|># repo: dr-dos-ok/Code_Jam_Webscraper path: /solutions_python/Problem_62/241.py def filtra_acima(wires, origem): return [wire for wire in wires if wire[0] > origem ] def filtra_abaixo(wires, destino): return [wire for wire in wires if wire[1] < destino ] def calculate(wires): count = 0 ...
code_fim
hard
{ "lang": "python", "repo": "dr-dos-ok/Code_Jam_Webscraper", "path": "/solutions_python/Problem_62/241.py", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|> wires = [] for i in xrange(n): o, d = map(int, raw_input().split()) wires.append( (o,d) ) return wires for case_number in xrange(int(raw_input())): n, = map(int, raw_input().split()) wires = read_input(n) result = calculate(wires) print 'Case #%d: %s' % (...
code_fim
hard
{ "lang": "python", "repo": "dr-dos-ok/Code_Jam_Webscraper", "path": "/solutions_python/Problem_62/241.py", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|># repo: Gaodo/NativeLeakProf path: /nlp_stack_parser.py #!/usr/bin/python # coding=UTF-8 import sys import subprocess import os def printReportTail(reportHtmlFile): reportHtmlFile.write(""" </body> </html> """) def printReportHead(reportHtmlFile): reportHtmlFile.write("""<!DOCTYPE html> <html ...
code_fim
hard
{ "lang": "python", "repo": "Gaodo/NativeLeakProf", "path": "/nlp_stack_parser.py", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|> leakMsg = "leak size: " + leakSize + "\n" printText(reportHtmlFile, leakMsg) print leakMsg elif line.startswith("stack:"): stack = line.replace("stack:", "").replace('\n', '').replace('\r', '') # print "stack: " for stackEle...
code_fim
hard
{ "lang": "python", "repo": "Gaodo/NativeLeakProf", "path": "/nlp_stack_parser.py", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|> def delcacheCountSizeList(self): self.cacheCountSizeList = {} print "EMC delete cacheCountSizeList", self.cacheCountSizeList def delcacheCountSizeListEntriesOnFileOp(self,path): #print "EMC delcacheCountSizeListEntriesOnFileOp",path rescanPaths = [] if path: for k in self.cacheCountSizeLis...
code_fim
hard
{ "lang": "python", "repo": "betonme/e2openplugin-EnhancedMovieCenter", "path": "/src/EMCFileCache.py", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|># repo: betonme/e2openplugin-EnhancedMovieCenter path: /src/EMCFileCache.py #!/usr/bin/python # encoding: utf-8 # # In case of reuse of this source code please do not remove this copyright. # # This program is free software: you can redistribute it and/or modify # it under the terms of the GNU General P...
code_fim
hard
{ "lang": "python", "repo": "betonme/e2openplugin-EnhancedMovieCenter", "path": "/src/EMCFileCache.py", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|> if config.EMC.files_cache.value and self.cacheDirectoryList.has_key(path) and self.cacheFileList.has_key(path): return True else: return False def IsPathWithDirsInCache(self, path): if config.EMC.files_cache.value and self.cacheDirectoryList.has_key(path): return True else: return Fa...
code_fim
hard
{ "lang": "python", "repo": "betonme/e2openplugin-EnhancedMovieCenter", "path": "/src/EMCFileCache.py", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|># repo: ahenze/python-fuer-einsteiger path: /groessere_programme/beispiele/try_except_example.py # print all cards with even numbers. <|fim_suffix|>for card in cards: try: number = int(card) if number % 2 == 0: # modulo operator print(card, "is an even card.") except...
code_fim
medium
{ "lang": "python", "repo": "ahenze/python-fuer-einsteiger", "path": "/groessere_programme/beispiele/try_except_example.py", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|>for card in cards: try: number = int(card) if number % 2 == 0: # modulo operator print(card, "is an even card.") except ValueError: print (card, "can not be divided")<|fim_prefix|># repo: ahenze/python-fuer-einsteiger path: /groessere_programme/beispiele/try_ex...
code_fim
medium
{ "lang": "python", "repo": "ahenze/python-fuer-einsteiger", "path": "/groessere_programme/beispiele/try_except_example.py", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|>def get_obj_spec(client_factory, obj, select_set=None): """Builds the Object Spec object.""" obj_spec = client_factory.create('ns0:ObjectSpec') obj_spec.obj = obj obj_spec.skip = False if select_set is not None: obj_spec.selectSet = select_set return obj_spec def get_prop...
code_fim
hard
{ "lang": "python", "repo": "Mirantis/vmware-dvs", "path": "/networking_vsphere/utils/vim_util.py", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_prefix|># repo: WONDER-project/GSAS-II-WONDER-WIN path: /GSAS-II-WONDER/GSASIIfpaGUI.py g_slit_width'): NISTparms["receiver_slit"] = {'slit_width':1e-3*InpParms['receiving_slit_width']} elif "receiver_slit" in NISTparms: del NISTparms["receiver_slit"] if InpParms.get('tube-tails_width', ...
code_fim
hard
{ "lang": "python", "repo": "WONDER-project/GSAS-II-WONDER-WIN", "path": "/GSAS-II-WONDER/GSASIIfpaGUI.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: WONDER-project/GSAS-II-WONDER-WIN path: /GSAS-II-WONDER/GSASIIfpaGUI.py ines=True) if FPdlg.GetSizer(): FPdlg.GetSizer().Clear(True) numWave = parmDict['numWave'] if mode == 'BBpoint': itemList = BraggBrentanoParms+BBPointDetector elif mode == 'BBPSD': itemList = ...
code_fim
hard
{ "lang": "python", "repo": "WONDER-project/GSAS-II-WONDER-WIN", "path": "/GSAS-II-WONDER/GSASIIfpaGUI.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|>"Primes:", end = " ") for num in sorted(s): print(num, end = " ")<|fim_prefix|># repo: jasminecronin/code-step-by-step path: /Python/Sieve.py N = int(input("Max value N? ")) s = set() for i in range(2, N + 1): s.add(i) for num in sorted(s): k = num + num while k <= N<|fim_middle|>: ...
code_fim
medium
{ "lang": "python", "repo": "jasminecronin/code-step-by-step", "path": "/Python/Sieve.py", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|># repo: jasminecronin/code-step-by-step path: /Python/Sieve.py N = int(input("Max value N? ")) s = set() for i in range(2, N + 1): <|fim_suffix|>: if k in s: s.remove(k) k += num print("Primes:", end = " ") for num in sorted(s): print(num, end = " ")<|fim_middle|> s.add...
code_fim
medium
{ "lang": "python", "repo": "jasminecronin/code-step-by-step", "path": "/Python/Sieve.py", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|>http1.upload('http://'+ip+'/music_download/api/song/upload','speed=0&styleId=c0a4bd86-a09b-43ac-8169-14bb69630ac0&file=G:\\music_data\\1.mp3') # http1.upload('http://10.68.170.184:8080/music/api/song/upload','filename=1.mp3&speed=0&styleId=c0a4bd86-a09b-43ac-8169-14bb69630ac0&file1=G:/music_data/1.mp3')<...
code_fim
hard
{ "lang": "python", "repo": "kirina001/musicPytest", "path": "/test/testMusic.py", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|># repo: kirina001/musicPytest path: /test/testMusic.py # -*- coding: UTF-8 -*- from keywords.httpkeys1 import HTTP http1 = HTTP() # ip = '10.68.170.184:8080' ip = '10.68.170.184:8080' http1.post('http://'+ip+'/music_download/api/login','username=admin&password=123456') # http1.savejson('result','id') ...
code_fim
hard
{ "lang": "python", "repo": "kirina001/musicPytest", "path": "/test/testMusic.py", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|>def draw_room_obj(room, obj_category): obj_num, obj_center, obj_size, obj_point= DNA_Object.get_obj_info_from_room(room, obj_category) if obj_num > 0: plt.plot(obj_point['x'], obj_point['y'], linewidth='0.5') #print(bed_center) plt.plot(obj_center[0], obj_center[1], 'o') ...
code_fim
hard
{ "lang": "python", "repo": "yinzanxia/dna_info_process", "path": "/DrawShape.py", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|> if 'roomList' in dna: cur_dict = dna elif 'request' in dna and 'feedback' not in dna: cur_dict = json.loads(dna['request']) elif 'feedback' in dna: cur_dict = json.loads(dna['feedback']) if 'doors' in cur_dict: door_num, doo...
code_fim
hard
{ "lang": "python", "repo": "yinzanxia/dna_info_process", "path": "/DrawShape.py", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|># repo: yinzanxia/dna_info_process path: /DrawShape.py # -*- coding: utf-8 -*- """ Created on Fri Jul 13 14:52:03 2018 @author: mayn """ import matplotlib.pyplot as plt import DNA_Object import json def draw_area(dna, room): area_center, area = DNA_Object.get_room_area(room) plt.plot(area['x'...
code_fim
hard
{ "lang": "python", "repo": "yinzanxia/dna_info_process", "path": "/DrawShape.py", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|> operations = [ migrations.AlterModelOptions( name='type', options={'verbose_name': '\u0442\u0438\u043f \u0437\u0430\u0434\u0430\u043d\u0438\u044f', 'verbose_name_plural': '\u0422\u0438\u043f\u044b \u0437\u0430\u0434\u0430\u043d\u0438\u044f'}, ), migratio...
code_fim
medium
{ "lang": "python", "repo": "whitemaster/adhack_2017", "path": "/exchange/migrations/0005_auto_20170826_2131.py", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|># repo: whitemaster/adhack_2017 path: /exchange/migrations/0005_auto_20170826_2131.py # -*- coding: utf-8 -*- # Generated by Django 1.10.5 on 2017-08-26 21:31 from __future__ import unicode_literals from django.db import migrations, models class Migration(migrations.Migration): <|fim_suffix|> opera...
code_fim
medium
{ "lang": "python", "repo": "whitemaster/adhack_2017", "path": "/exchange/migrations/0005_auto_20170826_2131.py", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|># repo: lnnx2006/DJI_robomaster path: /open_fire/scripts/callback.py #!/usr/bin/python """ Created on Aug 1 2014 <|fim_suffix|>if __name__ == '__main__': rospy.init_node('timer') rospy.Timer(rospy.Duration(2), my_callback) rospy.spin()<|fim_middle|>""" import rospy def my_callback(event):...
code_fim
medium
{ "lang": "python", "repo": "lnnx2006/DJI_robomaster", "path": "/open_fire/scripts/callback.py", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|> print 'Timer called at ' + str(event.current_real) if __name__ == '__main__': rospy.init_node('timer') rospy.Timer(rospy.Duration(2), my_callback) rospy.spin()<|fim_prefix|># repo: lnnx2006/DJI_robomaster path: /open_fire/scripts/callback.py #!/usr/bin/python """ Created on Aug 1 2014 ...
code_fim
easy
{ "lang": "python", "repo": "lnnx2006/DJI_robomaster", "path": "/open_fire/scripts/callback.py", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|># repo: fwxiong/net-sniffer path: /runMe.py #!/usr/bin/python3 import os import netifaces <|fim_suffix|>for i in NICList: os.system("sudo ifconfig " + i + " promisc") os.system("sudo python ./src/top.py")<|fim_middle|># nicList = netifaces.interfaces() NICList = [i for i in netifaces.interfaces() if...
code_fim
medium
{ "lang": "python", "repo": "fwxiong/net-sniffer", "path": "/runMe.py", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|>for i in NICList: os.system("sudo ifconfig " + i + " promisc") os.system("sudo python ./src/top.py")<|fim_prefix|># repo: fwxiong/net-sniffer path: /runMe.py #!/usr/bin/python3 import os import netifaces <|fim_middle|># nicList = netifaces.interfaces() NICList = [i for i in netifaces.interfaces() if...
code_fim
medium
{ "lang": "python", "repo": "fwxiong/net-sniffer", "path": "/runMe.py", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|># repo: leandog/whiteboard-plotter path: /gcodepainter/gcodepainter/services/gcode_sender.py from pydispatch import dispatcher import time import serial import threading from queue import Queue PORT='/dev/ttys005' #PORT='/dev/tty.usbmodem1461' SPEED=4800.0 class GcodeSender(object): PEN_LIFT_PULSE...
code_fim
hard
{ "lang": "python", "repo": "leandog/whiteboard-plotter", "path": "/gcodepainter/gcodepainter/services/gcode_sender.py", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|> def on_pen_lift(self): #print("pen lift") self.command_queue.put_nowait("M400") self.command_queue.put_nowait("M340 P0 S{}".format(self.PEN_LIFT_PULSE)) self.command_queue.put_nowait("G4 P500") def start(self): self._stop.clear() self.parsing_thread...
code_fim
hard
{ "lang": "python", "repo": "leandog/whiteboard-plotter", "path": "/gcodepainter/gcodepainter/services/gcode_sender.py", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|>ax.plot(data["Date"],data["Hushen300 Index"]/3.20393,label="Hushen300 Index") plt.xlabel("Time/year") plt.ylabel("Index Point") plt.title("Comparison of HCHFI,HS300 and SSE Composite Index") plt.legend(loc='upper right') plt.ylim(0,7000) plt.show()<|fim_prefix|># repo: tangshuran/trivial_works path: /zhu...
code_fim
medium
{ "lang": "python", "repo": "tangshuran/trivial_works", "path": "/zhuzhu/zz_plot.py", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|>t") plt.title("Comparison of HCHFI,HS300 and SSE Composite Index") plt.legend(loc='upper right') plt.ylim(0,7000) plt.show()<|fim_prefix|># repo: tangshuran/trivial_works path: /zhuzhu/zz_plot.py import matplotlib.pyplot as plt import pandas as pd import numpy as np data=pd.read_excel("data_SHA.xls") fig...
code_fim
medium
{ "lang": "python", "repo": "tangshuran/trivial_works", "path": "/zhuzhu/zz_plot.py", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|># repo: tangshuran/trivial_works path: /zhuzhu/zz_plot.py import matplotlib.pyplot as plt import pandas as pd import numpy as np data=pd.read_excel("data_SHA.xls") fig,ax=plt.subplot<|fim_suffix|>ax.plot(data["Date"],data["Hushen300 Index"]/3.20393,label="Hushen300 Index") plt.xlabel("Time/year") plt.yla...
code_fim
medium
{ "lang": "python", "repo": "tangshuran/trivial_works", "path": "/zhuzhu/zz_plot.py", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|># ----- Running scripts for PSFEx ----- # if (glob.glob("PSFEx/") == []): os.system("mkdir PSFEx") else: os.system("rm -rfv PSFEx/*") os.system("sh psfex_all.sh") os.system("mv -v psf_*.cat psf_*.xml psf_*.psf PSFEx/") os.system("mv -v prepsfex_*-*.cat PSFEx/") os.system("rm -rfv ./*.fits prepsfex_*.c...
code_fim
hard
{ "lang": "python", "repo": "joungh93/HSC_sephot", "path": "/mkscr_psfex.py", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|># repo: joungh93/HSC_sephot path: /mkscr_psfex.py #!/usr/bin/env python3 # -*- coding: utf-8 -*- """ Created on Thu May 21 11:40:26 2020 @author: jlee """ import time start_time = time.time() import numpy as np import glob, os from astropy.io import fits import init_cfg as ic # ----- Making script...
code_fim
hard
{ "lang": "python", "repo": "joungh93/HSC_sephot", "path": "/mkscr_psfex.py", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|> # ----- Running scripts for PSFEx ----- # if (glob.glob("PSFEx/") == []): os.system("mkdir PSFEx") else: os.system("rm -rfv PSFEx/*") os.system("sh psfex_all.sh") os.system("mv -v psf_*.cat psf_*.xml psf_*.psf PSFEx/") os.system("mv -v prepsfex_*-*.cat PSFEx/") os.system("rm -rfv ./*.fits prepsfex_*....
code_fim
hard
{ "lang": "python", "repo": "joungh93/HSC_sephot", "path": "/mkscr_psfex.py", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|> def __init__(self, canClimbMountains, speed, year): Vehicle.__init__(self, speed, year) self.canClimbMountains = canClimbMountains def drive(self): print("Car is in drive mode") # Here, Vehicle is a parent inherited from ABC class. It has an abstraction method drive. # C...
code_fim
hard
{ "lang": "python", "repo": "pavanpandya/Python", "path": "/Advance Python - Object Oriented Programming/05_Encapsulation.py", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|>class House2: def setWall(self, dynamicWall): self.wall = dynamicWall def getWall(self): print(self.wall) # Abstraction: # Abstraction in OOP is a process of hiding the real implementation of the method by only showing a method signature. # In Python, we can achieve abstractio...
code_fim
hard
{ "lang": "python", "repo": "pavanpandya/Python", "path": "/Advance Python - Object Oriented Programming/05_Encapsulation.py", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|># repo: pavanpandya/Python path: /Advance Python - Object Oriented Programming/05_Encapsulation.py # 4 Pillars of OOP: # 1. Encapsulation: Encapsulation in Python is the process of wrapping up variables and methods into a single entity.In programming, a class is an example that wraps all the variables an...
code_fim
hard
{ "lang": "python", "repo": "pavanpandya/Python", "path": "/Advance Python - Object Oriented Programming/05_Encapsulation.py", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|># repo: bm5w/sea-f2-python-sept14 path: /Students/JakeAnderson/session02/ack.py # coding: utf-8 #ack program with the ackermann_function """ ackermann_function """ def ack(m,n): <|fim_suffix|>if __name__ == "__main__": expected = [[1,2,3,4,5], [2,3,4,5,6], [3,5,7,9,11], [5,13,29,61,125]] o...
code_fim
hard
{ "lang": "python", "repo": "bm5w/sea-f2-python-sept14", "path": "/Students/JakeAnderson/session02/ack.py", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|>if __name__ == "__main__": expected = [[1,2,3,4,5], [2,3,4,5,6], [3,5,7,9,11], [5,13,29,61,125]] ok = True for m in range(4): for n in range(5): actual = ack(m,n) if not actual == expected[m][n]: print "error" ok = False if ok: print "All tests pass"<|fim_prefix|># repo: ...
code_fim
hard
{ "lang": "python", "repo": "bm5w/sea-f2-python-sept14", "path": "/Students/JakeAnderson/session02/ack.py", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|># repo: wsarvesh/ProjectsGit path: /Projects/hospital_management/DHOPD/migrations/0016_patient_c_receipt_c.py # Generated by Django 2.2.6 on 2020-05-21 09:44 import datetime from django.db import migrations, models class Migration(migrations.Migration): dependencies = [ ('DHOPD', '0015_au...
code_fim
hard
{ "lang": "python", "repo": "wsarvesh/ProjectsGit", "path": "/Projects/hospital_management/DHOPD/migrations/0016_patient_c_receipt_c.py", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|>ervices', models.CharField(max_length=500)), ('patient_status', models.CharField(max_length=2)), ('patient_cost', models.CharField(max_length=100)), ('patient_date', models.DateField(default=datetime.date.today)), ('patient_time', models.Time...
code_fim
hard
{ "lang": "python", "repo": "wsarvesh/ProjectsGit", "path": "/Projects/hospital_management/DHOPD/migrations/0016_patient_c_receipt_c.py", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|>def calcLogLikelihood(X,clusters,k): loglikelihood = 0 #Your code here return loglikelihood #E-step def updateEStep(X,clusters,k): EMatrix = [] #Your code here return EMatrix #M-step def updateMStep(X,clusters,EMatrix): #Your code here return clusters def visualizeCluste...
code_fim
hard
{ "lang": "python", "repo": "CabbageUVa/Machine-Learning-course-project", "path": "/Neural Network & Image classification & Audio Clustering/clustering.py", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|> purities = [] #Your code for i in range(2): count = 0 for idx in range(len(clusters[i])): if(int(clusters[i][idx][2]) == 1): count += 1 purity = count*1.0 / len(clusters[i]) if purity > 0.5: purities.append(purity) ...
code_fim
hard
{ "lang": "python", "repo": "CabbageUVa/Machine-Learning-course-project", "path": "/Neural Network & Image classification & Audio Clustering/clustering.py", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|># repo: CabbageUVa/Machine-Learning-course-project path: /Neural Network & Image classification & Audio Clustering/clustering.py #!/usr/bin/python import sys import numpy as np import random import matplotlib.pyplot as plt #Your code here def loadData(fileDj): data = [] fid = open(fileDj) f...
code_fim
hard
{ "lang": "python", "repo": "CabbageUVa/Machine-Learning-course-project", "path": "/Neural Network & Image classification & Audio Clustering/clustering.py", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|># repo: SizeLee/Graduation path: /UIPack/MainFrame.py dWidget(label) labelbox.addWidget(self.presentModelNameT) trainingModuleT.addStretch(1) trainingModuleT.addLayout(labelbox) trainingModuleT.addStretch(1) trainingModuleT.addWidget(self.setModelParametersButtonT...
code_fim
hard
{ "lang": "python", "repo": "SizeLee/Graduation", "path": "/UIPack/MainFrame.py", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|> if self.sender() is self.saveModelButton: if self.mcbcnn is None: reply = QMessageBox.information(self, '模型错误', '模型不存在', QMessageBox.Yes, QMessageBox.Yes) return else: fname, ok ...
code_fim
hard
{ "lang": "python", "repo": "SizeLee/Graduation", "path": "/UIPack/MainFrame.py", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|> def setLossParameter(self): if self.sender() is self.dataLossSimulateSettingButton: self.setLPDialog = setLossParameterDialog.setLossParameterDialog('combine-CNN设置缺失参数', self, 'New') elif self.sender() is self.dataLossSimulateSettingButtonT: self.setLPDialog = ...
code_fim
hard
{ "lang": "python", "repo": "SizeLee/Graduation", "path": "/UIPack/MainFrame.py", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|> # Plot 2 lines subplot.plot(range(len(values)), values) subplot.plot(range(len(new_values)), new_values, linewidth=2) # Print left plot title pyplot.title( "Press X to exit\nPress S to save", loc="left", fontsize=14, ...
code_fim
hard
{ "lang": "python", "repo": "thanhph111/prosthetic-foot-design", "path": "/src/sub/plot.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: dinesh-joshi/RNAseqWebServer path: /dataUpload/migrations/0001_initial.py # Generated by Django 3.2.4 on 2021-09-13 17:41 import dataUpload.models from django.db import migrations, models import uuid class Migration(migrations.Migration): initial = True <|fim_suffix|> operations = [ ...
code_fim
medium
{ "lang": "python", "repo": "dinesh-joshi/RNAseqWebServer", "path": "/dataUpload/migrations/0001_initial.py", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|> dependencies = [ ] operations = [ migrations.CreateModel( name='Task', fields=[ ('file_id', models.AutoField(primary_key=True, serialize=False)), ('task_id', models.UUIDField(default=uuid.uuid4, editable=False)), ...
code_fim
medium
{ "lang": "python", "repo": "dinesh-joshi/RNAseqWebServer", "path": "/dataUpload/migrations/0001_initial.py", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|> def build(self): return LayoutWindow() if __name__== "__main__": display = floatlayoutApp() display.run()<|fim_prefix|># repo: SUTD-IEEE/workshop-resources path: /SUTD_IEEE_Kivy_Workshop/Kivy_workshop_1/floatlayout.py from kivy.app import App from kivy.uix.floatlayout import FloatLa...
code_fim
easy
{ "lang": "python", "repo": "SUTD-IEEE/workshop-resources", "path": "/SUTD_IEEE_Kivy_Workshop/Kivy_workshop_1/floatlayout.py", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|># repo: SUTD-IEEE/workshop-resources path: /SUTD_IEEE_Kivy_Workshop/Kivy_workshop_1/floatlayout.py from kivy.app import App from kivy.uix.floatlayout import FloatLayout class LayoutWindow(FloatLayout): pass <|fim_suffix|> return LayoutWindow() if __name__== "__main__": display = float...
code_fim
easy
{ "lang": "python", "repo": "SUTD-IEEE/workshop-resources", "path": "/SUTD_IEEE_Kivy_Workshop/Kivy_workshop_1/floatlayout.py", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|> county = [] while iter_.hasNext(): county += [iter_.__next__()] if is_element(iter_.peek(), 'strong'): yield ElemIterator(county) county = [] yield ElemIterator(county) county = [] def parse_emails_url(iter_): emails = [] url = None try: while True: iter_.p...
code_fim
hard
{ "lang": "python", "repo": "kevanloy/elections-officials", "path": "/states/nevada/main.py", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|> def parse_lines(iter_): iter_.peek_till('strong') county = [] while iter_.hasNext(): county += [iter_.__next__()] if is_element(iter_.peek(), 'strong'): yield ElemIterator(county) county = [] yield ElemIterator(county) county = [] def parse_emails_url(iter_): emails =...
code_fim
hard
{ "lang": "python", "repo": "kevanloy/elections-officials", "path": "/states/nevada/main.py", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|>000000', '00000000000000000000000000000000000000000000000000000000000000000000000000000011111111111000000000000000000000000000000000000000', '00000000000000000000000000000000000000000000000000000000000000000000000000000011111111111000000000000000000000000000000000000000', '00000000000000000000000000000000...
code_fim
hard
{ "lang": "python", "repo": "GamerNoTitle/Beepers-and-OLED", "path": "/bamap/ba0563.pngMap.py", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|># repo: GamerNoTitle/Beepers-and-OLED path: /bamap/ba0563.pngMap.py ba0563.pngMap = [ '00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000', '00000000000000000000000000000000000000000000000000000000000000000000000000000000000000...
code_fim
hard
{ "lang": "python", "repo": "GamerNoTitle/Beepers-and-OLED", "path": "/bamap/ba0563.pngMap.py", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|> r3 = requests.post(TCApplyNeedleUrl,ANparams) print(r3.text) rep = json.loads(r3.text) if rep["status"] == 0: data = rep["data"] TCdata2 = AESCipher.decode_data(data, tokenId.replace('-', '')) print("TCdata2解密后", TCdata2) ...
code_fim
hard
{ "lang": "python", "repo": "Ojmin/fengkong", "path": "/disanfang/third_party/app.py", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|># repo: Ojmin/fengkong path: /disanfang/third_party/app.py import json import requests as requests from flask import Flask from flask import request from tools import AESCipher, tokenId, TokenKey, appId from tools import TCApplyNeedleUrl, TCCreditNeedleUrl, TCWJNeedleUrl app = Flask(__name__)...
code_fim
hard
{ "lang": "python", "repo": "Ojmin/fengkong", "path": "/disanfang/third_party/app.py", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|> if model.device != "cpu" and torch.cuda.device_count() > 1: model = torch.nn.DataParallel(model) model = model.to(model.device) train_loader = model.get_train_loader() test_loader = model.get_test_loader() for epoch in range(cfg.num_epoch): time_print(f"\nEpoch {epoc...
code_fim
hard
{ "lang": "python", "repo": "davzha/DESP", "path": "/run.py", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|> train_loader = model.get_train_loader() test_loader = model.get_test_loader() for epoch in range(cfg.num_epoch): time_print(f"\nEpoch {epoch} Training") train(cfg, epoch, train_loader, model) filename = "checkpoint.pth.tar" if not getattr(cfg.log, ...
code_fim
hard
{ "lang": "python", "repo": "davzha/DESP", "path": "/run.py", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|># repo: davzha/DESP path: /run.py import argparse import datetime import importlib import pprint import time import random import numpy as np import torch from torch.utils.tensorboard import SummaryWriter from utils import get_git_state, time_print, AverageMeter, ProgressMeter, save_checkpoint def tr...
code_fim
hard
{ "lang": "python", "repo": "davzha/DESP", "path": "/run.py", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|> def component_callbacks(self, app): """ Automatically does the callbacks of the interactive parts of the table component. :param app: Dash app that uses the code. :return: Output of the callback functions. """ @app.callback( Output('main_tabl...
code_fim
hard
{ "lang": "python", "repo": "shossains/Interactive-Data-Visualization", "path": "/src/main/python/oop/Components/Table.py", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|> def __init__(self, plot_factory, df, title="Table"): """ Displays table at the bottom of the page. :param plot_factory: Factory with all plot functions :param df: Dataframe with all data :param title: Title of the page """ super().__init__(title=...
code_fim
medium
{ "lang": "python", "repo": "shossains/Interactive-Data-Visualization", "path": "/src/main/python/oop/Components/Table.py", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|># repo: shossains/Interactive-Data-Visualization path: /src/main/python/oop/Components/Table.py import dash_table import pandas as pd import dash_html_components as html import dash_core_components as dcc from dash.dependencies import Input, Output from dash_oop_components import DashComponent import das...
code_fim
hard
{ "lang": "python", "repo": "shossains/Interactive-Data-Visualization", "path": "/src/main/python/oop/Components/Table.py", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|> def __init__(self, rounds=3, breaths=30, hold=15): self.rounds = rounds self.breaths = breaths self.hold = hold self.round_times = [] self.lock = threading.Lock() # взаимоблокировка отдельных голосовых потоков def __str__(self): return '\n♻{} 🗣{} ...
code_fim
hard
{ "lang": "python", "repo": "rudotcom/WHM", "path": "/breathe.py", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|> """ согласование существительных с числительными, стоящими перед ними """ phrase = phrase.replace(' ', ' ').replace(',', ' ,') numeral = '' new_phrase = [] for word in phrase.split(' '): if 'NUMB' in morph.parse(word)[0].tag: numeral = word if numeral: ...
code_fim
hard
{ "lang": "python", "repo": "rudotcom/WHM", "path": "/breathe.py", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|># repo: rudotcom/WHM path: /breathe.py import sys import time import pymorphy2 import pyglet import pyttsx3 import threading import warnings import pytils warnings.filterwarnings("ignore") """ Количество раундов, вдохов в раунде, задержка дыхания на вдохе""" rounds, breaths, hold = 4, 30, 13 def play...
code_fim
hard
{ "lang": "python", "repo": "rudotcom/WHM", "path": "/breathe.py", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|># repo: my-xh/KnapsackProblem path: /3-多重背包问题/划分.py """ 问题描述 玛莎(Marsha)和比尔(Bill)拥有一系列大理石。他们希望将藏品分开,以使两者获得相等的份额。如果所有的大理石都具有相同的价值,这将很容易,因为那样他们就可以将收藏品分成两半。 但不幸的是,有些大理石比其他大理石更大或更漂亮。因此,玛莎(Marsha)和比尔(Bill)首先为每个大理石分配一个值,即一个介于1到6之间的自然数。 现在,他们希望对大理石进行分割,以使每个大理石都获得相同的总价值。不幸的是,他们意识到以这种方式分割大理石可能是不可能的(即使所有大理石的总价值是均匀的...
code_fim
medium
{ "lang": "python", "repo": "my-xh/KnapsackProblem", "path": "/3-多重背包问题/划分.py", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|> 样本输出 集合1: 不能被分割 集合2: 可以被分割 """ S = [] print('输入:') while True: s = input() if s == '0 0 0 0 0 0': break S.append(s) print('\n输出:') w = [1, 2, 3, 4, 5, 6] for k in range(len(S)): p = [int(i) for i in S[k].split()] _sum = sum(i * j for i, j in zip(w, p)) if _sum % 2 != 0...
code_fim
hard
{ "lang": "python", "repo": "my-xh/KnapsackProblem", "path": "/3-多重背包问题/划分.py", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|> return { "properties": { "params": { "description": "", "type": "object", "default": {"vm": {"instance_id1": {"status": "activ...
code_fim
hard
{ "lang": "python", "repo": "nec-openstack/watcher-zone-migration-plugin", "path": "/zone_migration/strategy.py", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_prefix|># repo: kkthecompguy/admin-umojabiz path: /jobs/urls.py from django.urls import path from .views import job_upload_view, job_view, job_applicants_view, posted_job_view, bussiness_list_view app_name = 'jobs' urlpatterns = [ path('', job_view, name='job-index'), path('applic<|fim_suffix|>ath('business...
code_fim
medium
{ "lang": "python", "repo": "kkthecompguy/admin-umojabiz", "path": "/jobs/urls.py", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|>ath('business/', bussiness_list_view, name='business'), path('upload/', job_upload_view, name='job-upload'), ]<|fim_prefix|># repo: kkthecompguy/admin-umojabiz path: /jobs/urls.py from django.urls import path from .views import job_upload_view, job_view, job_applicants_view, posted_job_view, bussiness_...
code_fim
medium
{ "lang": "python", "repo": "kkthecompguy/admin-umojabiz", "path": "/jobs/urls.py", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|>ants/', job_applicants_view, name='job-applicants'), path('posted/', posted_job_view, name='job-posted'), path('business/', bussiness_list_view, name='business'), path('upload/', job_upload_view, name='job-upload'), ]<|fim_prefix|># repo: kkthecompguy/admin-umojabiz path: /jobs/urls.py from django....
code_fim
medium
{ "lang": "python", "repo": "kkthecompguy/admin-umojabiz", "path": "/jobs/urls.py", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|> for i in range(12): mp = monthlyPaymentRate * rb rb=rb-mp rb=rb+rb*monthlyir print('remaining balance: ',round(rb,2))<|fim_prefix|># repo: ziweiwu/MIT-introduction-in-computer-science path: /week2/problem-1.py balance=42 annualInterestRate=0.20 <|fim_middle|>monthlyPaymentRate=0.04 mont...
code_fim
medium
{ "lang": "python", "repo": "ziweiwu/MIT-introduction-in-computer-science", "path": "/week2/problem-1.py", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|>print('remaining balance: ',round(rb,2))<|fim_prefix|># repo: ziweiwu/MIT-introduction-in-computer-science path: /week2/problem-1.py balance=42 annualInterestRate=0.20 monthlyPaymentRate=0.04 monthlyir = annualInterestRate/12 <|fim_middle|>rb=balance for i in range(12): mp = monthlyPaymentRate...
code_fim
medium
{ "lang": "python", "repo": "ziweiwu/MIT-introduction-in-computer-science", "path": "/week2/problem-1.py", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|># repo: ziweiwu/MIT-introduction-in-computer-science path: /week2/problem-1.py balance=42 annualInterestRate=0.20 <|fim_suffix|>print('remaining balance: ',round(rb,2))<|fim_middle|>monthlyPaymentRate=0.04 monthlyir = annualInterestRate/12 rb=balance for i in range(12): mp = monthlyPaymentRate...
code_fim
medium
{ "lang": "python", "repo": "ziweiwu/MIT-introduction-in-computer-science", "path": "/week2/problem-1.py", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|># repo: annahung31/LeetCode_practice path: /Merge_Sorted_Array.py class Solution: def merge(self, nums1, m, nums2, n): """ Do not return anything, modify nums1 in-place instead. """ if n == 0: nums1 = nums1 if nums1[m-1] <= nums2[0]: ...
code_fim
hard
{ "lang": "python", "repo": "annahung31/LeetCode_practice", "path": "/Merge_Sorted_Array.py", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|> while i < m and j < n: if nums1[i] <= nums2[j]: print("take 1: ", nums1[i]) ans[k] = nums1[i] i += 1 else: print("take 2: ", nums2[j]) ans[k] = nums2[j] ...
code_fim
hard
{ "lang": "python", "repo": "annahung31/LeetCode_practice", "path": "/Merge_Sorted_Array.py", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|> nums1 = ans if __name__ == "__main__": solve = Solution() nums1 = [1,2,3,0,0,0] m = 3 nums2 = [2,5,6] n = 3 solve.merge(nums1, m, nums2, n) print(nums1)<|fim_prefix|># repo: annahung31/LeetCode_practice path: /Merge_Sorted_Array.py class Solution: def merge(self, ...
code_fim
hard
{ "lang": "python", "repo": "annahung31/LeetCode_practice", "path": "/Merge_Sorted_Array.py", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|># repo: ZhangWen0629/NLP_tensorflow_project path: /Entity_Posing/001-rnn+lstm+crf.py """ @file : 001-rnn+lstm+crf.py @author: xiaolu @time : 2019-09-06 """ import re import numpy as np import tensorflow as tf from sklearn.metrics import classification_report class Model: def __init__(self, di...
code_fim
hard
{ "lang": "python", "repo": "ZhangWen0629/NLP_tensorflow_project", "path": "/Entity_Posing/001-rnn+lstm+crf.py", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|>def process_string(string): ''' :param string: :return: ''' string= re.sub('[^A-Za-z0-9\-\/ ]+', ' ', string).split() return ' '.join([to_title(y.strip()) for y in string]) def to_title(string): if string.isupper(): string = string.title() return string def pars...
code_fim
hard
{ "lang": "python", "repo": "ZhangWen0629/NLP_tensorflow_project", "path": "/Entity_Posing/001-rnn+lstm+crf.py", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|># repo: akaija/pseudo-mat path: /HTSOHM/bin/mat17.py from random import choice, random, randrange from math import fsum import os import numpy as np def mat17(N, ATOM_TYPES, ndenmax=0.04302, ndenmin=0.0000013905, xmax=51.2, xmin=25.6, ymax=51.2, ymin=25.6, zmax=51.2, zmin=25.6, epmax=513.264, epmin=1.25...
code_fim
hard
{ "lang": "python", "repo": "akaija/pseudo-mat", "path": "/HTSOHM/bin/mat17.py", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|># for i in range(100): # atoms[i,3] = round(atoms[i,3], 4) # for i in range(n_): # n_atoms[i,3] = round(n_atoms[i,3], 4) # net_charge = sum(n_atoms[:,3]) # if net_charge != 0: # atomID = choice(range(100)) # weight = list(IDs).cou...
code_fim
hard
{ "lang": "python", "repo": "akaija/pseudo-mat", "path": "/HTSOHM/bin/mat17.py", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|> mat_charge = str(sum(n_atoms[:,3])) cif_file.write('#NET CHARGE: ' + mat_charge + '\n') mat_X_stats = (mat_name + ' ' + str(nden_) + ' ' + str(xdim_) + ' ' + str(ydim_) + ' ' + str(zdim_) + ' ' + str(n_) + ' ' + mat_charge + '\n') mat_stats.write(mat_X_stats) ...
code_fim
hard
{ "lang": "python", "repo": "akaija/pseudo-mat", "path": "/HTSOHM/bin/mat17.py", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|># repo: int-brain-lab/ibllib path: /ibllib/tests/extractors/test_extractors.py : # TRAINING SESSIONS data = raw.load_data(self.training_lt5['path']) gct = np.array([tr['behavior_data']['States timestamps'] ['closed_loop'][0][0] for tr in data]) self...
code_fim
hard
{ "lang": "python", "repo": "int-brain-lab/ibllib", "path": "/ibllib/tests/extractors/test_extractors.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> # TRAINING SESSIONS data = raw.load_data(self.training_lt5['path']) gct = np.array([tr['behavior_data']['States timestamps'] ['closed_loop'][0][0] for tr in data]) self.assertTrue(isinstance(gct, np.ndarray)) # -- version >= 5.0.0 gct...
code_fim
hard
{ "lang": "python", "repo": "int-brain-lab/ibllib", "path": "/ibllib/tests/extractors/test_extractors.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: int-brain-lab/ibllib path: /ibllib/tests/extractors/test_extractors.py = training_trials.Choice( session_path=self.training_lt5['path']).extract(save=False)[0] self.assertTrue(isinstance(choice, np.ndarray)) data = raw.load_data(self.training_lt5['path']) tria...
code_fim
hard
{ "lang": "python", "repo": "int-brain-lab/ibllib", "path": "/ibllib/tests/extractors/test_extractors.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: junaidikhlaq/django-api-details path: /apis/views.py from rest_framework import filters from rest_framework.generics import ListAPIView from rest_framework.permissions import IsAuthenticated from rest_framework.viewsets import ModelViewSet from apis.models import Contact, Address, InvoicePositio...
code_fim
hard
{ "lang": "python", "repo": "junaidikhlaq/django-api-details", "path": "/apis/views.py", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|> queryset = Country.objects.all() serializer_class = CountrySerializer filter_backends = [filters.SearchFilter] search_fields = ['value'] permission_classes = (IsAuthenticated,) class InvoiceViewSet(ModelViewSet): queryset = Invoice.objects.all() serializer_class = InvoiceSeri...
code_fim
hard
{ "lang": "python", "repo": "junaidikhlaq/django-api-details", "path": "/apis/views.py", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|># repo: vpurush/speech-reco-partial-dataset path: /audio_loader/load_single.py from scipy.io import wavfile import numpy from matplotlib import pyplot as plt import librosa import noisereduce def loadWavFile(fileName, filePath, savePlot, maxAudioLength, reduceNoise = True): # Read file # rate, d...
code_fim
hard
{ "lang": "python", "repo": "vpurush/speech-reco-partial-dataset", "path": "/audio_loader/load_single.py", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|> # data is stereo sound. take left speaker only leftSpeakerSound = data # data[:,0] # print("leftSpeakerSound.shape", leftSpeakerSound.shape) audioWithPadding = numpy.concatenate((leftSpeakerSound, padding)) # print("audioWithPadding.shape", audioWithPadding.shape) if savePlot: ...
code_fim
hard
{ "lang": "python", "repo": "vpurush/speech-reco-partial-dataset", "path": "/audio_loader/load_single.py", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|>finally: print("程序执行完毕,不知道是否发生了异常")<|fim_prefix|># repo: bwz3891923/LearningLog path: /Python 第八周作业/20171029 4.4.3.3.py try: alp="ABCDEFGHIJKLMNOPQRSTUVWXYZ" idx=eval(input("请输入一个整数")) print(alp[idx]) except NameError: print("输入错误,请输入一个整数") <|fim_middle|>except: print(...
code_fim
medium
{ "lang": "python", "repo": "bwz3891923/LearningLog", "path": "/Python 第八周作业/20171029 4.4.3.3.py", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|># repo: bwz3891923/LearningLog path: /Python 第八周作业/20171029 4.4.3.3.py try: alp="ABCDEFGHIJKLMNOPQRSTUVWXYZ" idx=eval(input("请输入一个整数")) print(alp[idx]) <|fim_suffix|>except: print("其他错误") else: print("没有发生错误") finally: print("程序执行完毕,不知道是否发生了异常")<|fim_middle|>except ...
code_fim
easy
{ "lang": "python", "repo": "bwz3891923/LearningLog", "path": "/Python 第八周作业/20171029 4.4.3.3.py", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|> validated = True for i, cell in enumerate(tsq_row): if tsq_types[i] == 'number': try: float(cell) except Exception as e: print('At least one cell value is invalid.') validated = False ...
code_fim
hard
{ "lang": "python", "repo": "umich-dbgroup/duoquest", "path": "/cli.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> config = configparser.ConfigParser() config.read('config.ini') db_path = config['db']['path'] conn = sqlite3.connect(db_path) db_name = input_db_name(conn) nlq = input_nlq() num_cols = input_num_cols() tsq = TableSketchQuery(num_cols) tsq.types = input_tsq_types(num...
code_fim
hard
{ "lang": "python", "repo": "umich-dbgroup/duoquest", "path": "/cli.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|>admin.site.register(Autor, AutorAdmin) admin.site.register(Category, CategoryAdmin) admin.site.register(Announcement, AnnouncementAdmin) admin.site.register(Banner, BannerAdmin) admin.site.register(Caricatura, CaricaturaAdmin) admin.site.register(Video, VideoAdmin) admin.site.register(TypePost, TypePostAd...
code_fim
hard
{ "lang": "python", "repo": "Jhyrus/score", "path": "/finish/wall/admin.py", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|> class VideoAdmin(admin.ModelAdmin): pass class TypePostAdmin(admin.ModelAdmin): pass class PostAdmin(admin.ModelAdmin): class Media: js = ('admin/js/tiny_mce/tiny_mce.js', 'admin/js/tiny_mce/basic_config.js',) class PhraseAdmin(admin.ModelAdmin): pass class T...
code_fim
medium
{ "lang": "python", "repo": "Jhyrus/score", "path": "/finish/wall/admin.py", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|># repo: Jhyrus/score path: /finish/wall/admin.py # -*- encoding: utf-8 -*- from django.contrib import admin from finish.wall.models import (Autor, Category, Announcement, Banner, Caricatura, Video, TypePost, Post, Phrase, TypeGalery, ImageGa...
code_fim
medium
{ "lang": "python", "repo": "Jhyrus/score", "path": "/finish/wall/admin.py", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|># repo: HoneyTheYellowBear123/Civilization-VI-Modding-Knowledge-Base path: /.data-generation/Events.py import csv import os events = {} eventTypes = set() eventIndices = {} i = 0 with open('Civ VI Modding Companion - Events.csv', newline='') as csvfile: reader = csv.reader(csvfile, delimiter=',', quo...
code_fim
hard
{ "lang": "python", "repo": "HoneyTheYellowBear123/Civilization-VI-Modding-Knowledge-Base", "path": "/.data-generation/Events.py", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|> f.write('> `' + fullName + '(' + argumentsText + ')`\n\n') f.write('Regular event: you can subscribe to it through `' + fullName + '.Add(<function handler>)`\n') f.write('\n') f.write('### Parameters\n') argumentsList = "\n- ".join(arguments) if len(argumentsList) > 0: argumentsList = '- ' + argu...
code_fim
hard
{ "lang": "python", "repo": "HoneyTheYellowBear123/Civilization-VI-Modding-Knowledge-Base", "path": "/.data-generation/Events.py", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|># repo: 4teamwork/opengever.core path: /opengever/api/listing_custom_fields.py from opengever.propertysheets.assignment import get_document_assignment_slots from opengever.propertysheets.assignment import get_dossier_assignment_slots from opengever.propertysheets.storage import PropertySheetSchemaStorage...
code_fim
hard
{ "lang": "python", "repo": "4teamwork/opengever.core", "path": "/opengever/api/listing_custom_fields.py", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }