text
stringlengths
232
16.3k
domain
stringclasses
1 value
difficulty
stringclasses
3 values
meta
dict
<|fim_suffix|> self.network_svc.register_new_device(self.device_data_dict) self.assertIn(self.device_id, self.network_svc.devices.keys()) def test_deregisterDevice(self): self.network_svc.devices[self.device_id] = "" self.network_svc.deregister_device(self.device_id) self.ass...
code_fim
hard
{ "lang": "python", "repo": "mLe110/network-simulator", "path": "/network_simulator/test/service/test_networkSimulatorService.py", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|> with self.assertRaises(UnknownDeviceException): self.network_svc.deregister_device(self.device_id) # helper def create_device(self, device_id): device = Device(self.device_data_dict) device.device_id = device_id device.xpos = 4.0 device.ypos = 3...
code_fim
medium
{ "lang": "python", "repo": "mLe110/network-simulator", "path": "/network_simulator/test/service/test_networkSimulatorService.py", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|> global result print result if (result == "tomato"): os.chdir("/home/ec2-user/sdpd/tomato") os.system("python -m scripts.label_image --graph=tf_files/retrained_graph.pb --image=/home/ec2-user/sdpd/image.jpg > a.txt") elif (result == "potato"): os.chdir("/home/ec2-use...
code_fim
medium
{ "lang": "python", "repo": "KushalP1/SnapCrop-flaskserver", "path": "/flaskserver.py", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|> # Default for now is the builtin. This will probably be changed in the future. formatter = self._config.get_setting( OPTION_ROBOT_CODE_FORMATTER, str, OPTION_ROBOT_CODE_FORMATTER_BUILTIN_TIDY ) if formatter not in ( OPTION_ROBOT_CODE_FORMATTER_ROBOTI...
code_fim
hard
{ "lang": "python", "repo": "martinRenou/robotframework-lsp", "path": "/robotframework-ls/src/robotframework_ls/server_api/server.py", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|> pal_to_check = str(input("Enter the string to check whether palindrome or not :")) pal_list = [str(i) for i in pal_to_check] print(pal_list) pal_check_con = llist.pal_check(pal_list) print("Is palindrome :",pal_check_con) def pal_check(self, pal_lis): ...
code_fim
hard
{ "lang": "python", "repo": "antonyalexcm/Bridgelabz_updated", "path": "/Data_structures/Palindrome_checker.py", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|>On the other hand, if any of the neighbors are 1's, then you won't have the full cube. Implying that at each spot, if it's a 1, you take the min of the three neighbors + 1. The second hard thing is just dealing with the fact the input is characters not ints...annoying imo. The second solution up there ...
code_fim
hard
{ "lang": "python", "repo": "JackMGrundy/coding-challenges", "path": "/common-problems-leetcode/medium/maximal-square.py", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|> if(self.plotter): self.plotter.close() self.plotter = None def __del__(self): self.stop_thread() self.stop() def start_processing(self): self.command_queue.put_nowait('M110 N2') self.command_queue.put_nowait('G90') self.comm...
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|> def __del__(self): self.stop_thread() self.stop() def start_processing(self): self.command_queue.put_nowait('M110 N2') self.command_queue.put_nowait('G90') self.command_queue.put_nowait('G28') self.plotter = serial.Serial(PORT, 115200, timeout=1) ...
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|> return data_df #train = load_data_from(train_data_path) data = load_data_from_csv(validate_data_path) out.write(data['content'][0].encode('utf-8')) inp.close() out.close()<|fim_prefix|># repo: JeffWang3/Fine-grained_SA path: /CNN/fastText/test.py #-*- coding: utf-8 -*- import re import sys import ...
code_fim
medium
{ "lang": "python", "repo": "JeffWang3/Fine-grained_SA", "path": "/CNN/fastText/test.py", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|> if len(letterIndexes) == 0: tries += 1 # Checa si perdio el jugador if tries == len(IMAGES) - 2: displayBoard(hiddenWord, tries) print('\nLo sentimos, perdiste. La palabra correcta era {}'.format(word)) break ...
code_fim
hard
{ "lang": "python", "repo": "JavierSLX/Python-Platzi", "path": "/18-ahorcado.py", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|> while True: displayBoard(hiddenWord, tries) currentLetter = str(raw_input('Escoge una letra: ')) letterIndexes = [] for i in range(len(word)): if word[i] == currentLetter: letterIndexes.append(i) if len(letterIndexes) == 0: ...
code_fim
hard
{ "lang": "python", "repo": "JavierSLX/Python-Platzi", "path": "/18-ahorcado.py", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|>compiler.generate_proto(PROTO, '.') compiler.generate_proto( PROTO, '.', with_plugin='python_rpcz', suffix='_rpcz.py')<|fim_prefix|># repo: ktp-forked-repos/wis-core path: /python/gen.py #!/usr/bin/env python2 from rpcz import compiler <|fim_middle|>PROTO = '../index_server.proto'
code_fim
easy
{ "lang": "python", "repo": "ktp-forked-repos/wis-core", "path": "/python/gen.py", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|># repo: ktp-forked-repos/wis-core path: /python/gen.py #!/usr/bin/env python2 <|fim_suffix|>PROTO = '../index_server.proto' compiler.generate_proto(PROTO, '.') compiler.generate_proto( PROTO, '.', with_plugin='python_rpcz', suffix='_rpcz.py')<|fim_middle|>from rpcz import compiler
code_fim
easy
{ "lang": "python", "repo": "ktp-forked-repos/wis-core", "path": "/python/gen.py", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|>mbda _: MULT(n)( myself(myself)(SUB1(n)) ) ) ) ) )( lambda myself: ( lambda n: ( IF( IS_ZERO(n) )( lambda _: ONE )( lambda _: MULT(n)( mys...
code_fim
hard
{ "lang": "python", "repo": "chasingSublimity/destroy-all-software", "path": "/Computation/lambda.py", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|> while True: m_idx = int((l_idx+h_idx)/2) if l_idx >= h_idx: return l_idx elif target > nums[m_idx]: l_idx = m_idx + 1 else: h_idx = m_idx sol = Solution() print sol.searchInsert([1,3,5,6], 5) print sol.searchInsert([1,3,5,6], 2) print sol.searchInsert([...
code_fim
medium
{ "lang": "python", "repo": "jfriend08/LeetCode", "path": "/SearchInsertPosition.py", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|> def regen_resource(self): pass # hook method def full_resource(self): pass<|fim_prefix|># repo: david3355/PyGame path: /classes/rouge.py __author__ = 'Jager' from char import Character class Rouge (Character): def special_attack1(self, opponent, hitdamage_callback, spec...
code_fim
easy
{ "lang": "python", "repo": "david3355/PyGame", "path": "/classes/rouge.py", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|># Get return code returnCodeLine = mockprogramInoutArray[1] if returnCodeLine.find("MOCK_PROGRAM_RETURN:") != 0: print("Error, second line = '" + returnCodeLine + "', does not match " "^MOCK_PROGRAM_RETURN:") sys.exit(5) returnCode = returnCodeLine.replace("MOCK_PROGRAM_RETURN:", "").strip() ...
code_fim
hard
{ "lang": "python", "repo": "TriBITSPub/TriBITS", "path": "/tribits/python_utils/mockprogram.py", "mode": "spm", "license": "BSD-2-Clause", "source": "the-stack-v2" }
<|fim_suffix|> fhandle = open(filemanifest,'w') for i in half: if half.index(i)==2: for j in prmns: fhandle.write(j+"\n") else: fhandle.write(i) for i in prmns: print '\t',i.split('android:name="')[1].split('"')[0] print pyc.Succ("%d Permissions added."%(len(prmns))) def rebuild(mainapk): print py...
code_fim
hard
{ "lang": "python", "repo": "Ba-hub/3mbed0r", "path": "/apkd.py", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|># repo: Ba-hub/3mbed0r path: /apkd.py #!/usr/bin/env python import os import re import pycolor import sys pyc = pycolor.pyColor() def decompile(mainapk): print pyc.Info("Decompiling apks...") os.system("bash apktool.sh d -f %s"%mainapk) os.system("bash apktool.sh d -f temp.apk") def inject(mainapk...
code_fim
hard
{ "lang": "python", "repo": "Ba-hub/3mbed0r", "path": "/apkd.py", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|> print pyc.Info("Adding permissions...") filemanifest = "temp/AndroidManifest.xml" fhandle = open(filemanifest,'r') fread = fhandle.readlines() prmns = [] for line in fread: if('<uses-permission' in line): prmns.append(line.replace('\n','')) fhandle.close() filemanifest = "%s/AndroidManifest....
code_fim
hard
{ "lang": "python", "repo": "Ba-hub/3mbed0r", "path": "/apkd.py", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|> if hasattr(self.base, 'build_chain'): base_template, base_lookup = _build_chain(self.base, lookup) lookup.put_template(new_base_name, base_template) else: lookup.put_string(new_base_name, self.base.body_html()) ...
code_fim
hard
{ "lang": "python", "repo": "npoed/ifmo-xblock-framework", "path": "/xblock_ifmo/fragment.py", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|># repo: npoed/ifmo-xblock-framework path: /xblock_ifmo/fragment.py # -*- coding=utf-8 -*- from mako.template import Template from xblock.fragment import Fragment from .lookup import TemplateLookup # xblock_ifmo.lookup from .utils import deep_update class FragmentMakoChain(Fragment): """ Клас...
code_fim
hard
{ "lang": "python", "repo": "npoed/ifmo-xblock-framework", "path": "/xblock_ifmo/fragment.py", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|> old_base_name = "ifmo_xblock_base" new_base_name = None if self.base is not None: import uuid new_base_name = "{name}_{rnd}".format(name=old_base_name, rnd=str(uuid.uuid4())) if hasattr(self.base, 'build_chain'): ...
code_fim
hard
{ "lang": "python", "repo": "npoed/ifmo-xblock-framework", "path": "/xblock_ifmo/fragment.py", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|># Read B3 image_bgr = cv2.imread(B3) # convert B3 from bgr to rgb image = cv2.cvtColor(image_bgr, cv2.COLOR_BGR2RGB) # Apply segmentation to B3 with green and blue masks segmented_image = segmentation_function(image,'B3', blue_mask=True, white_mask=False, yellow_mask=False) cv2.imwrite("the3_B3_output.png...
code_fim
hard
{ "lang": "python", "repo": "BengisuA14/METU-ImageProcessing", "path": "/THE3/the3_part2.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: CameronA2018/Homework-Spring-2018 path: /Hw4/p3.py import random x = int(raw_input('Ple<|fim_suffix|>')) z = random.randint(x,y) print (z)<|fim_middle|>ase supply a number: ')) y = int(raw_input('Please supply a second number:
code_fim
medium
{ "lang": "python", "repo": "CameronA2018/Homework-Spring-2018", "path": "/Hw4/p3.py", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|>')) z = random.randint(x,y) print (z)<|fim_prefix|># repo: CameronA2018/Homework-Spring-2018 path: /Hw4/p3.py import random x = int(raw_input('Please supply a number: ')) y = int(raw_i<|fim_middle|>nput('Please supply a second number:
code_fim
easy
{ "lang": "python", "repo": "CameronA2018/Homework-Spring-2018", "path": "/Hw4/p3.py", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|># repo: sirarpikasabyan/SQL path: /mycoin.py #------------------------------------------------------------------------------- # Name: module1 # Purpose: # # Author: Nirvana # # Created: 07/06/2014 # Copyright: (c) Nirvana 2014 # Licence: <your licence> #-----------------------------...
code_fim
medium
{ "lang": "python", "repo": "sirarpikasabyan/SQL", "path": "/mycoin.py", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|> def toss(self): if random.randint(0,1)==0: self.sideup = "Heads" else: self.sideup = "Tails" def get_sideup(self): return self.sideup mycoin=Coin() print (mycoin.sideup) print (mycoin.get_sideup()) mycoin.toss() print (mycoin.get_sideup())<|fim_pre...
code_fim
medium
{ "lang": "python", "repo": "sirarpikasabyan/SQL", "path": "/mycoin.py", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|> for row in range(len(col)): for column in range(1): label=Label(tab5,width=22,height=1,text=col[row],bg="black",fg="white",padx=1,pady=1) label.grid(row=row,column=0,sticky="nsew",padx=1,pady=1) tab1.grid_columnconfigure(column,weight=1) for row in rang...
code_fim
hard
{ "lang": "python", "repo": "rickylin114/JA-material", "path": "/JA_pureColors_Auto.py", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|># repo: rickylin114/JA-material path: /JA_pureColors_Auto.py ext(root, width=20,height=1) text2.insert("insert","PureColorBig.csv") text2.configure(font=("微軟正黑體", 10)) text2.grid(row=2,column=2) img_confirm=PhotoImage(file="buttons/confirm.png") img_start=PhotoImage(file="buttons/start.png") btnRead=tk....
code_fim
hard
{ "lang": "python", "repo": "rickylin114/JA-material", "path": "/JA_pureColors_Auto.py", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|> for row in range(len(col)): for column in range(1): label=Label(tab3,width=22,height=1,text=col[row],bg="black",fg="white",padx=1,pady=1) label.grid(row=row,column=0,sticky="nsew",padx=1,pady=1) tab1.grid_columnconfigure(column,weight=1) for row in rang...
code_fim
hard
{ "lang": "python", "repo": "rickylin114/JA-material", "path": "/JA_pureColors_Auto.py", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|># Records time in format Sun 10:00:00 current_time = time.strftime('%a %H:%M:%S') # Append output to file. 'a' is append mode. with open(filename, 'a') as handle: # Write (Append) output to a line handle.write(str(current_time)) # Newline to separate different lines of output handle.write('\...
code_fim
easy
{ "lang": "python", "repo": "arbuz001/blog-code-snippets", "path": "/record_time.py", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|> """ The following sequences MUST NOT appear in str types documented in the schema: Leading control or space separators - ” This is an example” Trailing control or space separators - “This is an example ” Multiple (internal) control or space sepa...
code_fim
hard
{ "lang": "python", "repo": "kishorikonwar/single-cell-curation", "path": "/cellxgene_schema_cli/tests/test_schema_compliance.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: kishorikonwar/single-cell-curation path: /cellxgene_schema_cli/tests/test_schema_compliance.py "All values for these features must be 0." ], ) def test_columns_not_in_raw_var(self): """ Curators MUST annotate the following column only in the var...
code_fim
hard
{ "lang": "python", "repo": "kishorikonwar/single-cell-curation", "path": "/cellxgene_schema_cli/tests/test_schema_compliance.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: kishorikonwar/single-cell-curation path: /cellxgene_schema_cli/tests/test_schema_compliance.py mponent_name in ["var", "raw.var"]: with self.subTest(component_name=component_name): # Resetting validator self.validator.adata = examples.adata.copy() ...
code_fim
hard
{ "lang": "python", "repo": "kishorikonwar/single-cell-curation", "path": "/cellxgene_schema_cli/tests/test_schema_compliance.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> 'profile': forms.Select( attrs={ 'id': 'profile', 'required': '', 'class': 'browser-default custom-select' } ), 'sphere': forms.Select( attrs={ ...
code_fim
hard
{ "lang": "python", "repo": "Eldar1988/a_white_birds", "path": "/HelloDjango/apps/hhbase/forms.py", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|># repo: Eldar1988/a_white_birds path: /HelloDjango/apps/hhbase/forms.py from django import forms from .models import HhRequest class WorkRequestForm(forms.ModelForm): """Форма заявки на премию""" class Meta: <|fim_suffix|> 'profile': forms.Select( attrs={ ...
code_fim
hard
{ "lang": "python", "repo": "Eldar1988/a_white_birds", "path": "/HelloDjango/apps/hhbase/forms.py", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|> try: EmbySession=EmbyHttp(config) devices = EmbySession.get_emby_devices() index=0 dev_temp = [] for device in devices["Items"]: try: if device["Id"]!='Xnoppo': device["Name"]=device["Name"] + " / " + d...
code_fim
hard
{ "lang": "python", "repo": "siberian-git/Xnoppo", "path": "/xnoppo_web.py", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|># repo: siberian-git/Xnoppo path: /xnoppo_web.py self.send_response(200) self.send_header("Content-type", "text/html") self.end_headers() i = leer_file(html_path + 'help.html') self.wfile.write(bytes(i,"utf-8")) return(0) if ...
code_fim
hard
{ "lang": "python", "repo": "siberian-git/Xnoppo", "path": "/xnoppo_web.py", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|> print(self.path) if self.path == '/save_config': content_length = int(self.headers['Content-Length']) # <--- Gets the size of data post_data = self.rfile.read(content_length) # <--- Gets the data itself config = json.loads(post_data.decode('u...
code_fim
hard
{ "lang": "python", "repo": "siberian-git/Xnoppo", "path": "/xnoppo_web.py", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|> def valid(num): if len(num) > 1 and num[0] == '0': return False if 0 <= int(num) <= 255: return True else: return False ans = [] sb = '' helper(sb, s, 0) return ans solution = Solu...
code_fim
hard
{ "lang": "python", "repo": "mc422/leetcode", "path": "/Restore_IP_Addresses.py", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|># repo: mc422/leetcode path: /Restore_IP_Addresses.py class Solution(object): def restoreIpAddresses(self, s): """ :type s: str :rtype: List[str] """ def helper(sb, string, level): <|fim_suffix|> def valid(num): if len(num) > 1 and num[0] ==...
code_fim
hard
{ "lang": "python", "repo": "mc422/leetcode", "path": "/Restore_IP_Addresses.py", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|># repo: praveenpy273/pcap_netcad path: /collatz_hypothesis.py # take any non-negative and non-zero integer number and name it c0;if it's even, evaluate a new c0 as c0 ÷ 2; # otherwise, if it's odd, evaluate a new c0 as 3 × c0 + 1; # if c0 ≠ 1, skip to point 2. # The hypothesis says that regardless of the...
code_fim
medium
{ "lang": "python", "repo": "praveenpy273/pcap_netcad", "path": "/collatz_hypothesis.py", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|>while True: if c0 % 2 == 0: c0 //= 2 if c0 != 1: step += 1 print(' New value is ', c0, ':', 'step', step) continue elif c0 == 1: step += 1 print(' New value is ', c0, ':', 'step', step) break elif c0 % ...
code_fim
medium
{ "lang": "python", "repo": "praveenpy273/pcap_netcad", "path": "/collatz_hypothesis.py", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|> # y = [DtoA_ideal(AtoD(v)) for v in x] # plt.plot(x,y) # plt.xlim(-0.01,0) # plt.ylim(-0.01,0) # plt.show() # def Vout(index): # V = 0.0 # for i in range(6): # V = V + Wi_MSB[i] * int(format(index,'b').zfill(11)[i])*1 # for i in range(5): # V = V + Wi_LSB[i] * int(format(inde...
code_fim
hard
{ "lang": "python", "repo": "MaryKBoss/GUI-lpGBT", "path": "/UART_py3/ADC_INL.py", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|>left = x[0] for i in range(2*n): if y[i+1]!=y[i]: bin_size[y[i]] = x[i+1] - left left = x[i+1] # print(bin_size) DNL = [data*2047 -1 for data in bin_size] plt.plot(bin_num[1:4094],DNL[1:4094]) # plt.xlim(1000,1005) plt.show() # y = [DtoA_ideal(AtoD(v)) for v in x] # plt.plot(x,y)...
code_fim
hard
{ "lang": "python", "repo": "MaryKBoss/GUI-lpGBT", "path": "/UART_py3/ADC_INL.py", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|># repo: MaryKBoss/GUI-lpGBT path: /UART_py3/ADC_INL.py import matplotlib.pyplot as plt Ci_MSB = [32,16,8,4,2,1] Ci_LSB = [16,8,4,2,1] CB = 1 CP_B = 0 CP_LSB = (32-1)*(CB+CP_B-1)+10 print(CP_LSB) CP_MSB = 0 Csum_LSB = sum(Ci_LSB)+CP_LSB Csum_MSB = sum(Ci_MSB)+CP_MSB Cx = Csum_LSB*Csum_MSB+(CB+CP_B)*Csum_...
code_fim
hard
{ "lang": "python", "repo": "MaryKBoss/GUI-lpGBT", "path": "/UART_py3/ADC_INL.py", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|># repo: RileyPaddock/assignment_problems path: /coin_flipping_tests/plot_distribution.py import matplotlib.pyplot as plt import sys sys.path.append('coin_flipping_src') from monte_carlo import monte_carlo from probability import probability plt.style.use('bmh') x_coords = range(10) probablility_<|fim_suf...
code_fim
hard
{ "lang": "python", "repo": "RileyPaddock/assignment_problems", "path": "/coin_flipping_tests/plot_distribution.py", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|>ue','MC 1','MC 2','MC 3','MC 4','MC 5']) plt.xlabel('Number of Heads') plt.ylabel('Probability') plt.title('True Distribution vs Monte Carlo Simulations for 10 Coin Flips') plt.savefig('plot.png') plt.show()<|fim_prefix|># repo: RileyPaddock/assignment_problems path: /coin_flipping_tests/plot_distributio...
code_fim
hard
{ "lang": "python", "repo": "RileyPaddock/assignment_problems", "path": "/coin_flipping_tests/plot_distribution.py", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|>print ("Ha contestado bien", contador_bien, "preguntas") print ("Ha contestado mal", contador_mal, "preguntas") nota = (contador_bien / cantidad) * 10 print ("Le corresponde una nota de %.2f"%nota)<|fim_prefix|># repo: josemariamontero/Lenguaje-de-Marcas path: /Entrega1:AlternativasyRepetitivas/ejercicio...
code_fim
hard
{ "lang": "python", "repo": "josemariamontero/Lenguaje-de-Marcas", "path": "/Entrega1:AlternativasyRepetitivas/ejercicio6.py", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|># repo: josemariamontero/Lenguaje-de-Marcas path: /Entrega1:AlternativasyRepetitivas/ejercicio6.py from random import randint cantidad = int(input("Numero de preguntas: ")) contador_bien = 0 contador_mal = 0 while cantidad <= 0: print ("El numero de preguntas debe ser al menos 1") cantidad = int(input...
code_fim
medium
{ "lang": "python", "repo": "josemariamontero/Lenguaje-de-Marcas", "path": "/Entrega1:AlternativasyRepetitivas/ejercicio6.py", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|> try: arguments = parse_command_line(sys.argv) # Assign args to variables server = arguments.name os = arguments.os legacy = arguments.legacy dry = arguments.dry_run if kvm.path.exists(): kvm_disk = kvm_path + server command = ...
code_fim
hard
{ "lang": "python", "repo": "reizer-fs/scripts", "path": "/python/create_kvm", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|># repo: reizer-fs/scripts path: /python/create_kvm #!/usr/bin/python3 # encoding: utf-8 import sys import argparse import logging from pathlib import Path module = sys.modules['__main__'].__file__ __author__ = 'FFX' __version__ = '1.0' log = logging.getLogger(module) def parse_command_line(argv): ...
code_fim
hard
{ "lang": "python", "repo": "reizer-fs/scripts", "path": "/python/create_kvm", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|># repo: teimurjan/digits-recognizer path: /backend/views.py from flask import render_template, request, Response from flask.views import MethodView, View from flask.views import View <|fim_suffix|> def post(self): repo = ClassifierRepo(CLASSIFIER_STORAGE) service = PredictDigitServic...
code_fim
hard
{ "lang": "python", "repo": "teimurjan/digits-recognizer", "path": "/backend/views.py", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|> def post(self): repo = ClassifierRepo(CLASSIFIER_STORAGE) service = PredictDigitService(repo) image_data_uri = request.json['image'] prediction = service.handle(image_data_uri) return Response(str(prediction).encode(), status=200)<|fim_prefix|># repo: teimurjan/...
code_fim
medium
{ "lang": "python", "repo": "teimurjan/digits-recognizer", "path": "/backend/views.py", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|># repo: MelvinCC10/Python_Carsh_Course path: /Ch9 - Classes/Run_9_8.py import TryItYourSelf_9_8 as userObj <|fim_suffix|>admin1.set_user_name('Reven10') print('\n') admin1.describe_user() admin1.privileges.show_privileges()<|fim_middle|>print('\n\n\n\n') admin1 = userObj.Admin('john','deer',30) admin1.d...
code_fim
medium
{ "lang": "python", "repo": "MelvinCC10/Python_Carsh_Course", "path": "/Ch9 - Classes/Run_9_8.py", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|>admin1.set_user_name('Reven10') print('\n') admin1.describe_user() admin1.privileges.show_privileges()<|fim_prefix|># repo: MelvinCC10/Python_Carsh_Course path: /Ch9 - Classes/Run_9_8.py import TryItYourSelf_9_8 as userObj <|fim_middle|>print('\n\n\n\n') admin1 = userObj.Admin('john','deer',30) admin1.d...
code_fim
medium
{ "lang": "python", "repo": "MelvinCC10/Python_Carsh_Course", "path": "/Ch9 - Classes/Run_9_8.py", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|># repo: juwilliams/pymy path: /lib/commands/map.py """ commands/map.py description: Generates a blank configuration file in the current directory <|fim_suffix|> migration = Migration.load(self.options['MIGRATION_FILE']) mapping = Mapping(self.options) migration.mappings.append(mapping) migr...
code_fim
medium
{ "lang": "python", "repo": "juwilliams/pymy", "path": "/lib/commands/map.py", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|> migration = Migration.load(self.options['MIGRATION_FILE']) mapping = Mapping(self.options) migration.mappings.append(mapping) migration.write()<|fim_prefix|># repo: juwilliams/pymy path: /lib/commands/map.py """ commands/map.py description: Generates a blank configuration file in the curren...
code_fim
medium
{ "lang": "python", "repo": "juwilliams/pymy", "path": "/lib/commands/map.py", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|># repo: stepanov1997/Diplomski-primjeri path: /DiplomskiDemo/hello_world/util.py import datetime def year_choices(): <|fim_suffix|> return datetime.date.today().year<|fim_middle|> return [(r,r) for r in range(1984, datetime.date.today().year + 1)] def current_year():
code_fim
medium
{ "lang": "python", "repo": "stepanov1997/Diplomski-primjeri", "path": "/DiplomskiDemo/hello_world/util.py", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|>def current_year(): return datetime.date.today().year<|fim_prefix|># repo: stepanov1997/Diplomski-primjeri path: /DiplomskiDemo/hello_world/util.py import datetime def year_choices(): <|fim_middle|> return [(r,r) for r in range(1984, datetime.date.today().year + 1)]
code_fim
medium
{ "lang": "python", "repo": "stepanov1997/Diplomski-primjeri", "path": "/DiplomskiDemo/hello_world/util.py", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|> return [(r,r) for r in range(1984, datetime.date.today().year + 1)] def current_year(): return datetime.date.today().year<|fim_prefix|># repo: stepanov1997/Diplomski-primjeri path: /DiplomskiDemo/hello_world/util.py import datetime <|fim_middle|>def year_choices():
code_fim
easy
{ "lang": "python", "repo": "stepanov1997/Diplomski-primjeri", "path": "/DiplomskiDemo/hello_world/util.py", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|># repo: FatemeZamanian/MachineLearning-W3schools path: /Decision Tree.py import cv2 import pandas from sklearn import tree import pydotplus from sklearn.tree import DecisionTreeClassifier import matplotlib.pyplot as plt import matplotlib.image as pltimg <|fim_suffix|>###### features = ['Age', 'Experienc...
code_fim
medium
{ "lang": "python", "repo": "FatemeZamanian/MachineLearning-W3schools", "path": "/Decision Tree.py", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|>img=pltimg.imread('mydecisiontree.png') imgplot = plt.imshow(img) plt.show() print(X) print(y)<|fim_prefix|># repo: FatemeZamanian/MachineLearning-W3schools path: /Decision Tree.py import cv2 import pandas from sklearn import tree import pydotplus from sklearn.tree import DecisionTreeClassifier import ma...
code_fim
hard
{ "lang": "python", "repo": "FatemeZamanian/MachineLearning-W3schools", "path": "/Decision Tree.py", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|>###### features = ['Age', 'Experience', 'Rank', 'Nationality'] X = df[features] y = df['Go'] ##### dtree = DecisionTreeClassifier() dtree = dtree.fit(X, y) data = tree.export_graphviz(dtree, out_file=None, feature_names=features) graph = pydotplus.graph_from_dot_data(data) graph.write_png('mydecisiontree....
code_fim
medium
{ "lang": "python", "repo": "FatemeZamanian/MachineLearning-W3schools", "path": "/Decision Tree.py", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|># repo: ApoapsisAlpha/Competitive-Programming path: /Back to School/bts18p3.py n, x = input().split() n = int(n) x = int(x) m = [int(i) for i in input().split()] m.sort(reverse=True) i = 0 res = 0 <|fim_suffix|> if m[i % n] < m[(i+1) % n]: i = (i+1) % n print(res)<|fim_middle|>while x > 0: ...
code_fim
medium
{ "lang": "python", "repo": "ApoapsisAlpha/Competitive-Programming", "path": "/Back to School/bts18p3.py", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|> if m[i % n] < m[(i+1) % n]: i = (i+1) % n print(res)<|fim_prefix|># repo: ApoapsisAlpha/Competitive-Programming path: /Back to School/bts18p3.py n, x = input().split() n = int(n) x = int(x) m = [int(i) for i in input().split()] m.sort(reverse=True) i = 0 res = 0 <|fim_middle|>while x > 0: ...
code_fim
medium
{ "lang": "python", "repo": "ApoapsisAlpha/Competitive-Programming", "path": "/Back to School/bts18p3.py", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|>cations, image_path, interface_style, natural_sort<|fim_prefix|># repo: cbrnr/mnelab path: /mnelab/utils/__init__.py # © MNELAB developers # # License: BSD (3-clause)<|fim_middle|> from .dependencies import have from .syntax import PythonHighlighter from .utils import count_lo
code_fim
medium
{ "lang": "python", "repo": "cbrnr/mnelab", "path": "/mnelab/utils/__init__.py", "mode": "spm", "license": "BSD-3-Clause", "source": "the-stack-v2" }
<|fim_prefix|># repo: cbrnr/mnelab path: /mnelab/utils/__init__.py # © MNELAB developers # # License: BSD (3-clause)<|fim_suffix|>ort PythonHighlighter from .utils import count_locations, image_path, interface_style, natural_sort<|fim_middle|> from .dependencies import have from .syntax imp
code_fim
easy
{ "lang": "python", "repo": "cbrnr/mnelab", "path": "/mnelab/utils/__init__.py", "mode": "psm", "license": "BSD-3-Clause", "source": "the-stack-v2" }
<|fim_suffix|>quarter_way_arr[0] = True quarter_way_arr[1] = True quarter_way_arr[2] = True mat = np.eye(3) print(np.linalg.norm(mat))<|fim_prefix|># repo: saimukund303/python_robot_arm path: /test.py # -*- coding: utf-8 -*- import random import gym import numpy as np from collections import deque from keras.models i...
code_fim
medium
{ "lang": "python", "repo": "saimukund303/python_robot_arm", "path": "/test.py", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|># repo: pantsbuild/pants path: /src/python/pants/backend/scala/goals/tailor_test.py # Copyright 2021 Pants project contributors (see CONTRIBUTORS.md). # Licensed under the Apache License, Version 2.0 (see LICENSE). <|fim_suffix|>def test_classify_source_files() -> None: scalatest_files = { ...
code_fim
hard
{ "lang": "python", "repo": "pantsbuild/pants", "path": "/src/python/pants/backend/scala/goals/tailor_test.py", "mode": "psm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|> assert { ScalatestTestsGeneratorTarget: scalatest_files, ScalaJunitTestsGeneratorTarget: junit_files, ScalaSourcesGeneratorTarget: lib_files, } == classify_source_files(junit_files | lib_files | scalatest_files)<|fim_prefix|># repo: pantsbuild/pants path: /src/python/pants...
code_fim
medium
{ "lang": "python", "repo": "pantsbuild/pants", "path": "/src/python/pants/backend/scala/goals/tailor_test.py", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|>def main(): """" This is the main function """ while True: primary_message() # <=== Display menu and take input x = choice(9) z = tempConv if x == 1: # This is the From Celsius options t = value_check("C", tempConv.cel_ran) ...
code_fim
hard
{ "lang": "python", "repo": "jason8777/tradesHelper", "path": "/tempPrompt.py", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|> while True: if y == 1: t2 = z.rea_cel(t) result_message(t, t2, "R\u00e9", "C") break elif y == 2: t2 = z.rea_fah(t) result_message(t, t2, "R\u00e9", "F") ...
code_fim
hard
{ "lang": "python", "repo": "jason8777/tradesHelper", "path": "/tempPrompt.py", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|># repo: jason8777/tradesHelper path: /tempPrompt.py from colorama import init, Fore, Style import tempConv #============================================================================# # TEMP CONVERSION PROGRAM: # #=====================================...
code_fim
hard
{ "lang": "python", "repo": "jason8777/tradesHelper", "path": "/tempPrompt.py", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|> def start_sync(self): data_ldap = self.get_data_from_ldap() if data_ldap is None: return data_db = self.get_data_from_db() if data_db is None: return self.sync_data(data_db, data_ldap) def get_data_from_db(self): return Non...
code_fim
hard
{ "lang": "python", "repo": "panSdu2/pro-set", "path": "/python/seafevents/ldap_syncer/ldap_sync.py", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|># repo: panSdu2/pro-set path: /python/seafevents/ldap_syncer/ldap_sync.py #coding: utf-8 import logging from threading import Thread from ldap import SCOPE_BASE from seafevents.ldap_syncer.ldap_conn import LdapConn from seafevents.ldap_syncer.utils import bytes2str, add_group_uuid_pair from seaserv im...
code_fim
hard
{ "lang": "python", "repo": "panSdu2/pro-set", "path": "/python/seafevents/ldap_syncer/ldap_sync.py", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|> class LdapSync(Thread): def __init__(self, settings): Thread.__init__(self) self.settings = settings def run(self): if self.settings.enable_group_sync: migrate_dn_pairs(settings=self.settings) self.start_sync() self.show_sync_result() def ...
code_fim
hard
{ "lang": "python", "repo": "panSdu2/pro-set", "path": "/python/seafevents/ldap_syncer/ldap_sync.py", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|> for ct in range(10): line = file_test.readline() if line == '': break line = line.split(',') x[ct*4] = float(line[6]) x[ct*4+1] = float(line[7])/10000 x[ct*4+2] = float(line[8]) x[ct*4+3] = float(line[9])/10000 prediction = net(...
code_fim
hard
{ "lang": "python", "repo": "det-tu/HFTP", "path": "/test_multi.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|>if DASK_VERSION < packaging.version.parse("1.1.0"): blockwise = da.atop else: blockwise = da.blockwise<|fim_prefix|># repo: akoury/dask-ml path: /dask_ml/_compat.py import contextlib import dask import dask.array as da import packaging.version import pandas import six import sklearn SK_VERSION ...
code_fim
medium
{ "lang": "python", "repo": "akoury/dask-ml", "path": "/dask_ml/_compat.py", "mode": "spm", "license": "BSD-3-Clause", "source": "the-stack-v2" }
<|fim_suffix|>o create a repository for another user. Until we have added this # capability, allow users to create repos. ELEMENTARY_ALLOW_REPO_CREATION = True<|fim_prefix|># repo: SuveshBaskar/elementary path: /django/elementary/settings/prod.py from base import * try: from .prod_local import * except: pass ...
code_fim
medium
{ "lang": "python", "repo": "SuveshBaskar/elementary", "path": "/django/elementary/settings/prod.py", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|># repo: SuveshBaskar/elementary path: /django/elementary/settings/prod.py from base import * try: from .prod_local import * except: pass <|fim_suffix|>o create a repository for another user. Until we have added this # capability, allow users to create repos. ELEMENTARY_ALLOW_REPO_CREATION = True...
code_fim
medium
{ "lang": "python", "repo": "SuveshBaskar/elementary", "path": "/django/elementary/settings/prod.py", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|> keys = [] for window in X: d = {} for fn in self.feature_extractors: fts = fn(window, mid_ix, self.feature_val) d.update(fts) keys.extend(d.keys()) all_feats.append(d) if self.min_feat_frequency <= 1: ...
code_fim
hard
{ "lang": "python", "repo": "simonhughes22/PythonNlpResearch", "path": "/FeatureExtraction/Text/WindowFeatureExtractor.py", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|># repo: simonhughes22/PythonNlpResearch path: /FeatureExtraction/Text/WindowFeatureExtractor.py __author__ = 'simon.hughes' from sklearn.feature_extraction import DictVectorizer from WindowFeatures import compute_middle_index from collections import Counter class WindowFeatureExtractor(object): """...
code_fim
hard
{ "lang": "python", "repo": "simonhughes22/PythonNlpResearch", "path": "/FeatureExtraction/Text/WindowFeatureExtractor.py", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|># repo: bobylbohdan/GANs path: /vanilla_gan_mnist/gan/utils.py from typing import Dict, Optional from collections import OrderedDict import torch import torch.nn as nn import torch.optim as optim import yaml <|fim_suffix|>def load_yaml_config(config_path: str) -> Dict: with open(config_path, "r") a...
code_fim
medium
{ "lang": "python", "repo": "bobylbohdan/GANs", "path": "/vanilla_gan_mnist/gan/utils.py", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|> def load_state_dict(path: str) -> OrderedDict: return torch.load(path) def load_checkpoint(model: nn.Module, checkpoint_path: Optional[str]): if checkpoint_path: model.load_state_dict(load_state_dict(checkpoint_path))<|fim_prefix|># repo: bobylbohdan/GANs path: /vanilla_gan_mnist/gan/u...
code_fim
hard
{ "lang": "python", "repo": "bobylbohdan/GANs", "path": "/vanilla_gan_mnist/gan/utils.py", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|># repo: niklasberglund/freesprints path: /source/freesprints/plugins.py import helpers import os import os.path import json import imp import source.freesprints from pygame.locals import * class PluginLoader: available_plugins = None def __init__(self): self.checkAvailablePlugins() ...
code_fim
hard
{ "lang": "python", "repo": "niklasberglund/freesprints", "path": "/source/freesprints/plugins.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> def init_module(self): #module = imp.find_module("pluginModule", [self.path]) self.module = imp.load_source("pluginModule", os.path.join(self.path, "__init__.py")) print "FIND MODULE:" print self.module self.plugin_object = self.module.VisualisationPlu...
code_fim
hard
{ "lang": "python", "repo": "niklasberglund/freesprints", "path": "/source/freesprints/plugins.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: usma-eecs/mobile-app-privacy-score path: /factorsDictionariesFunction.py import os import factorStatFileCreator dirName = 'NoPerms/' dirName2 = 'AllPerms/' freqAgentDic = dict() lenAgentDic = dict() contAgentDic = dict() def freqModAvgFunc(dirName): fullList = factorStatFileCreator.directo...
code_fim
hard
{ "lang": "python", "repo": "usma-eecs/mobile-app-privacy-score", "path": "/factorsDictionariesFunction.py", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|> finalFreqFunc(dirName) finalFreqFunc(dirName2) #print (freqAgentDic) for keys, vals in freqAgentDic.items(): if len(vals) > 1 and vals[1] > 0: score = vals[0] / vals[1] print ("{:<15}: {:.2f}".format(keys,score)) else: score = "N/A" ...
code_fim
hard
{ "lang": "python", "repo": "usma-eecs/mobile-app-privacy-score", "path": "/factorsDictionariesFunction.py", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|># repo: W-zhennan/methplotlib path: /methplotlib/import_methylation.py import pandas as pd import pyranges as pr import numpy as np import sys import logging from methplotlib.utils import file_sniffer import pysam class Methylation(object): def __init__(self, table, data_type, name, called_sites): ...
code_fim
hard
{ "lang": "python", "repo": "W-zhennan/methplotlib", "path": "/methplotlib/import_methylation.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> def parse_nanocompore(filename, name, window): def nanocompore_columns_of_interest(column): if column in ['pos', 'ref_id']: return True elif column.endswith('pvalue_context_2') or column.endswith('pvalue'): return True else: return False ...
code_fim
hard
{ "lang": "python", "repo": "W-zhennan/methplotlib", "path": "/methplotlib/import_methylation.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: icoxfog417/transformer-sandbox path: /transfer_classifier/augmentor/augmentor.py from typing import Any, Dict, List, Optional, Tuple, Union import numpy as np import torch from datasets import concatenate_datasets from datasets.arrow_dataset import Dataset from transfer_classifier.dataset_prepro...
code_fim
hard
{ "lang": "python", "repo": "icoxfog417/transformer-sandbox", "path": "/transfer_classifier/augmentor/augmentor.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> return augmented_samples def generate(self, dataset: Dataset, preprocessor: ClassificationDatasetPreprocessor) -> BatchEncoding: raise NotImplementedError("Augmentor subclass should implement augment_sample.") def discriminate( self, model: PreTrainedModel, ...
code_fim
hard
{ "lang": "python", "repo": "icoxfog417/transformer-sandbox", "path": "/transfer_classifier/augmentor/augmentor.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|>#add each element to the first tree for root in rootsToAdd: for elem in root: root1.append(elem) #write the tree to a new file rutas0k_10k.write('rutas/rutas0k-110k.xml')<|fim_prefix|># repo: storress/MasterScripts path: /join_routes.py import xml.etree.ElementTree as ET #tree = ET.parse('r...
code_fim
hard
{ "lang": "python", "repo": "storress/MasterScripts", "path": "/join_routes.py", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|># repo: storress/MasterScripts path: /join_routes.py import xml.etree.ElementTree as ET #tree = ET.parse('rutas/rutas_prueba.xml') #treeToAdd = ET.parse('rutas/rutas_prueba_agregar.xml') #root = tree.getroot() #git rootToAdd = treeToAdd.getroot() <|fim_suffix|>#for elem in root.iter(): # print(el...
code_fim
medium
{ "lang": "python", "repo": "storress/MasterScripts", "path": "/join_routes.py", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|> output_numbers = mnist_parser.one_hots_to_ints(output) correct=np.sum(out_gt_numbers_test == output_numbers) print("Correct:",correct,"/",output_numbers.size,"(",correct/output_numbers.size ,"%)") print(conf_mat) save=int(input("Save?(1/0)")) if(save == 1): name=input("Sa...
code_fim
hard
{ "lang": "python", "repo": "grgurkovac/ANN-Framework", "path": "/mnist.py", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|># repo: grgurkovac/ANN-Framework path: /mnist.py import Net import mnist_parser import numpy as np #To use this model it is required to download the MNIST database #The donwloaded base is then needet parse to numpy using mnist_parser.parse_to_npy method #The files genetared using mnist_parser.parse_to_np...
code_fim
hard
{ "lang": "python", "repo": "grgurkovac/ANN-Framework", "path": "/mnist.py", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|># repo: itsolutionscorp/AutoStyle-Clustering path: /all_data/exercism_data/python/anagram/8c59015fed6440e49749ec3876ed3e45.py class Anagram(object): def __init__(self, word): <|fim_suffix|> return word != self.word and self._canonicalize(word) == self.canonical def match(self, words): ...
code_fim
medium
{ "lang": "python", "repo": "itsolutionscorp/AutoStyle-Clustering", "path": "/all_data/exercism_data/python/anagram/8c59015fed6440e49749ec3876ed3e45.py", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|> return filter(self._is_anagram, words)<|fim_prefix|># repo: itsolutionscorp/AutoStyle-Clustering path: /all_data/exercism_data/python/anagram/8c59015fed6440e49749ec3876ed3e45.py class Anagram(object): def __init__(self, word): self.word = word self.canonical = self._canonicali...
code_fim
hard
{ "lang": "python", "repo": "itsolutionscorp/AutoStyle-Clustering", "path": "/all_data/exercism_data/python/anagram/8c59015fed6440e49749ec3876ed3e45.py", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }