text
stringlengths
232
16.3k
domain
stringclasses
1 value
difficulty
stringclasses
3 values
meta
dict
<|fim_prefix|># repo: sernst/Cadence path: /src/cadence/analysis/direction/TrackwayDirectionStage.py # TrackwayDirectionStage.py # (C)2014-2015 # Scott Ernst from __future__ import print_function, absolute_import, unicode_literals, division from collections import namedtuple import math from pyaid.number.NumericUti...
code_fim
hard
{ "lang": "python", "repo": "sernst/Cadence", "path": "/src/cadence/analysis/direction/TrackwayDirectionStage.py", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|>#_______________________________________________________________________________ def _extendSamplesToTrackwayStart(self, firstEntry, samples): """_extendSamplesToTrackwayStart doc...""" if len(samples) < 2 or samples[0].track == firstEntry.track: # If there aren't enough s...
code_fim
hard
{ "lang": "python", "repo": "sernst/Cadence", "path": "/src/cadence/analysis/direction/TrackwayDirectionStage.py", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|> self._paths.append(plot.save(self.getTempFilePath(extension='pdf'))) #_______________________________________________________________________________ def _sampleTrackway(self, trackway, windowSize): """ Samples the trackway and returns result @type trackway: * ...
code_fim
hard
{ "lang": "python", "repo": "sernst/Cadence", "path": "/src/cadence/analysis/direction/TrackwayDirectionStage.py", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|> raise error @ban.error async def ban_error(self, ctx, error): if isinstance(error, commands.MissingRequiredArgument): await ctx.send("You need to tell me who to ban.") if isinstance(error, commands.BadArgument): await ctx.send("Is that a p...
code_fim
hard
{ "lang": "python", "repo": "foxgamerpt16/Guren", "path": "/cogs/Moderation.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: Prolgu/PyExamples path: /Calcu.py #!/usr/bin/env python # -*- coding: utf-8 -*- # # Calcu.py # import os, sys def menuCalc(): os.system('clear') print("Esto parece un menu:") print("\t1 - Suma") print("\t2 - Resta") print("\t3 - Multiplicacion") print("\t4 - Division...
code_fim
medium
{ "lang": "python", "repo": "Prolgu/PyExamples", "path": "/Calcu.py", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|> if calcu == "1": os.system('clear') s1=int(input("Ingrese un numero\n")) s2=int(input("Ingrese otro\n")) os.system('clear') print(f"{s1} + {s2} = {s1+s2}") input("\nPresione una tecla para continuar.") elif calcu == "2": os.system('clear') s1=int(input("Ingrese un numero\n")) s2=int(in...
code_fim
medium
{ "lang": "python", "repo": "Prolgu/PyExamples", "path": "/Calcu.py", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|> operations = [ migrations.AlterField( model_name='information', name='comment', field=models.CharField(blank=True, max_length=200, null=True), ), migrations.AlterField( model_name='information', name='picture', ...
code_fim
hard
{ "lang": "python", "repo": "chihirokubo/timetable", "path": "/index/migrations/0004_auto_20200330_0451.py", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|># repo: chihirokubo/timetable path: /index/migrations/0004_auto_20200330_0451.py # Generated by Django 3.0.4 on 2020-03-29 19:51 from django.db import migrations, models class Migration(migrations.Migration): <|fim_suffix|> operations = [ migrations.AlterField( model_name='infor...
code_fim
hard
{ "lang": "python", "repo": "chihirokubo/timetable", "path": "/index/migrations/0004_auto_20200330_0451.py", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|>902066, 'element': "[[],[[jet]]] ('MET', 'MET')"}, {'sqrts (TeV)': 13.0, 'weight (fb)': 18.943846, 'element': "[[],[]] ('MET', 'MET')"}, {'sqrts (TeV)': 13.0, 'weight (fb)': 11.23256793951906, 'element': "[[[jet],[Z]],[[jet],[jet],[Z]]] ('MET', 'MET')"}], 'Long Cascades': [{'sqrts (TeV)': 13.0, 'weight (f...
code_fim
hard
{ "lang": "python", "repo": "andlessa/RDM", "path": "/smodels/docs/manual/source/recipes/inputFiles/scanExample/smodels-output/100968509.slha.py", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|># repo: andlessa/RDM path: /smodels/docs/manual/source/recipes/inputFiles/scanExample/smodels-output/100968509.slha.py smodelsOutput = {'OutputStatus': {'sigmacut': 0.01, 'minmassgap': 5.0, 'maxcond': 0.2, 'ncpus': 1, 'file status': 1, 'decomposition status': 1, 'warnings': 'Input file ok', 'input file':...
code_fim
hard
{ "lang": "python", "repo": "andlessa/RDM", "path": "/smodels/docs/manual/source/recipes/inputFiles/scanExample/smodels-output/100968509.slha.py", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|> upper limit (fb)': None, 'TxNames': ['TChiWW'], 'Mass (GeV)': [[163.6, 57.4], [163.6, 57.4]], 'AnalysisID': 'ATLAS-SUSY-2013-11', 'DataSetID': None, 'AnalysisSqrts (TeV)': 8.0, 'lumi (fb-1)': 20.3, 'dataType': 'upperLimit', 'r': 0.10702534338254717, 'r_expected': None}, {'maxcond': 0.0, 'theory predictio...
code_fim
hard
{ "lang": "python", "repo": "andlessa/RDM", "path": "/smodels/docs/manual/source/recipes/inputFiles/scanExample/smodels-output/100968509.slha.py", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|># repo: nekanek/frontik-without-testing path: /tests/projects/test_app/pages/xsl/simple.py # coding=utf-8 from lxml import etree import frontik.handler class Page(frontik.handler.PageHandler): def get_page(self): <|fim_suffix|> if self.get_argument('raise', 'false') == 'true': ...
code_fim
medium
{ "lang": "python", "repo": "nekanek/frontik-without-testing", "path": "/tests/projects/test_app/pages/xsl/simple.py", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|> self.set_xsl(self.get_argument('template', 'simple.xsl')) self.doc.put(etree.Element('ok')) if self.get_argument('raise', 'false') == 'true': raise frontik.handler.HTTPError(400, xml=etree.Element('not-ok'))<|fim_prefix|># repo: nekanek/frontik-without-testing path: /...
code_fim
medium
{ "lang": "python", "repo": "nekanek/frontik-without-testing", "path": "/tests/projects/test_app/pages/xsl/simple.py", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|> public TreeNode mergeTrees(TreeNode t1, TreeNode t2) { if (t1 == null) return t2; Stack < TreeNode[] > stack = new Stack < > (); stack.push(new TreeNode[] {t1, t2}); while (!stack.isEmpty()) { TreeNode[] t = stack.pop(); if (t[0] == n...
code_fim
hard
{ "lang": "python", "repo": "JulyKikuAkita/PythonPrac", "path": "/cs15211/MergeTwoBinaryTrees.py", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_prefix|># repo: JulyKikuAkita/PythonPrac path: /cs15211/MergeTwoBinaryTrees.py __source__ = 'https://leetcode.com/problems/merge-two-binary-trees/' # Time: O(n) # Space: O(n) # # Description: Leetcode # 617. Merge Two Binary Trees # # Given two binary trees and imagine that when you put one of them to cover the...
code_fim
hard
{ "lang": "python", "repo": "JulyKikuAkita/PythonPrac", "path": "/cs15211/MergeTwoBinaryTrees.py", "mode": "psm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|>gs={'check_same_thread':False}) Session = sessionmaker(bind=engine) session = Session() Base = declarative_base()<|fim_prefix|># repo: ssenoris/Data_Scientist_Portfolio path: /12. FaysWeb/app/db.py from sqlalchemy import create_engine, Column, Integer, Float, \ String, Text, DateTime, Boolean, Foreig...
code_fim
hard
{ "lang": "python", "repo": "ssenoris/Data_Scientist_Portfolio", "path": "/12. FaysWeb/app/db.py", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|># repo: ssenoris/Data_Scientist_Portfolio path: /12. FaysWeb/app/db.py from sqlalchemy import create_engine, Column, Integer, Float, \ String, Text, DateTime, Boolean, ForeignKey f<|fim_suffix|> flask_sqlalchemy import SQLAlchemy engine = create_engine('sqlite:///app/databases/fays-web-dev.db', conn...
code_fim
medium
{ "lang": "python", "repo": "ssenoris/Data_Scientist_Portfolio", "path": "/12. FaysWeb/app/db.py", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|># repo: petercorke/robotics-toolbox-python path: /roboticstoolbox/examples/readme.py # this is the example code from the t0p-level README..d from spatialmath import SE3 import roboticstoolbox as rtb import swift robot = rtb.models.DH.Panda() print(robot) T = robot.fkine(robot.qz) print(T) # IK <|fim_s...
code_fim
hard
{ "lang": "python", "repo": "petercorke/robotics-toolbox-python", "path": "/roboticstoolbox/examples/readme.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|># IK T = SE3(0.7, 0.2, 0.1) * SE3.OA([0, 1, 0], [0, 0, -1]) sol = robot.ikine_LMS(T) # solve IK, ignore additional outputs print(sol.q) # display joint angles # FK shows that desired end-effector pose was achieved print(robot.fkine(sol.q)) qtraj = rtb.jtraj(robot.qz, sol.q, 50) robot.plot(qtraj.q, mo...
code_fim
medium
{ "lang": "python", "repo": "petercorke/robotics-toolbox-python", "path": "/roboticstoolbox/examples/readme.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: Akulinabu/DS_2 path: /9.exception.py # *** Обработка исключений (исключительные события, искл. ситуации)*** # генерация исключения a=100 b=0 # "деление на ноль" - пример ошибки (не рабочий) # c=a/b # решение - обработка исключений (отлов исключения) # конструкция "try-except" # try: # c =...
code_fim
hard
{ "lang": "python", "repo": "Akulinabu/DS_2", "path": "/9.exception.py", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|># конструкция "try-except-finally" # try: # var=int(input("Введите число: ")) # c = 100/var # print("Полет нормальный!") # except ZeroDivisionError: # c=0 # print("Попытка деления на ноль") # finally: # # finally срабатывает в любом случае, даже если программа завершится аварийно ...
code_fim
hard
{ "lang": "python", "repo": "Akulinabu/DS_2", "path": "/9.exception.py", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|> while True: c_hour = int(datetime.now().strftime("%H")) c_min = int(datetime.now().strftime("%M")) c_sec = int(datetime.now().strftime("%S")) print ('%02d:%02d:%02d - Variable: %d ' % (c_hour,c_min,c_sec,variable.value)) time.sleep(2) if __name__ == "__main_...
code_fim
medium
{ "lang": "python", "repo": "KadenLi/MoDeng", "path": "/Experiment/GlobalVariableInSchedule/demo1.py", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|> time.sleep(2) if __name__ == "__main__": m = multiprocessing.Manager() variable = m.Value('i', 60) schedfortest = BlockingScheduler() trigger_test = OrTrigger([ CronTrigger(minute='*/1') ]) schedfortest.add_job(callbacktotal, trigger_...
code_fim
hard
{ "lang": "python", "repo": "KadenLi/MoDeng", "path": "/Experiment/GlobalVariableInSchedule/demo1.py", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|># repo: KadenLi/MoDeng path: /Experiment/GlobalVariableInSchedule/demo1.py import asyncio import multiprocessing from concurrent.futures import ProcessPoolExecutor from apscheduler.schedulers.asyncio import AsyncIOScheduler from datetime import datetime import time from apscheduler.schedulers.blocking i...
code_fim
medium
{ "lang": "python", "repo": "KadenLi/MoDeng", "path": "/Experiment/GlobalVariableInSchedule/demo1.py", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|> for profile in profiles: users[profile['id']] = profile for comment in comments: id = comment['id'] if id > self.last_comment_id: self.last_comment_id = id text = comment['text'] ...
code_fim
hard
{ "lang": "python", "repo": "meanmail/vts", "path": "/vts.py", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|># repo: meanmail/vts path: /vts.py from slacker import Slacker import vk_api import time import logging from settings import SLACK_TOKEN, VK_LOGIN, VK_PASSWORD, GROUP_ID, TOPIC_ID, ICON_URL slack = Slacker(SLACK_TOKEN) class Vts: def __init__(self): self.last_comment_id = 0 sel...
code_fim
hard
{ "lang": "python", "repo": "meanmail/vts", "path": "/vts.py", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|> for comment in comments: id = comment['id'] if id > self.last_comment_id: self.last_comment_id = id text = comment['text'] title = topic['title'] user_id = abs(comment['from_id']) ...
code_fim
hard
{ "lang": "python", "repo": "meanmail/vts", "path": "/vts.py", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|># repo: saikksub/python-hotkey-listener path: /index.py import platform import keyboard import threading import atexit from threading import Timer triggerCount = 0 triggerTimer = -1 result = None def cleanup (): <|fim_suffix|> global triggerTimer global triggerCount try: triggerTime...
code_fim
medium
{ "lang": "python", "repo": "saikksub/python-hotkey-listener", "path": "/index.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> if triggerCount == 2: print('HOTKEY-COPY') triggerCount = 0 clearTimer() else: startTimer() def registerCopyHotkey (): if (platform.system() == 'Darwin'): keyboard.add_hotkey('cmd+c', onPresskey) else: keyboard.add_hotkey('ctrl+c', ...
code_fim
hard
{ "lang": "python", "repo": "saikksub/python-hotkey-listener", "path": "/index.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: MaxSchu/NotTheDroidsYouWereLookingFor path: /Assignment14/wii_gesture_classifier.py import numpy as np from scipy import fft import math from sklearn import svm from activity_recognition import WiiGesture class WiiGestureClassifier(): """ This class uses the FFT on the average of all th...
code_fim
hard
{ "lang": "python", "repo": "MaxSchu/NotTheDroidsYouWereLookingFor", "path": "/Assignment14/wii_gesture_classifier.py", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|> for gesture in self.parsedGestureList: gesture.trainingsData = [l[:self.minlen] for l in gesture.trainingsData] def getFrequencies(self): for gesture in self.parsedGestureList: gesture.frequencies = [ np.abs(fft(l) / len(l))[1:len(l) / 2] for l ...
code_fim
hard
{ "lang": "python", "repo": "MaxSchu/NotTheDroidsYouWereLookingFor", "path": "/Assignment14/wii_gesture_classifier.py", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|> parsedData = [] parsedGesture = WiiGesture(gesture.name) parsedData = [self.parseDataset(dataSet) for dataSet in gesture.trainingsData] parsedGesture.trainingsData = parsedData if len(parsedGesture.trainingsData[0]) < self.minlen: missingValues = self.mi...
code_fim
hard
{ "lang": "python", "repo": "MaxSchu/NotTheDroidsYouWereLookingFor", "path": "/Assignment14/wii_gesture_classifier.py", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|> # 뽑힌 인형은 board에서 사라짐 board[i][nth - 1] = 0 break # print(resultList) print(count)<|fim_prefix|># repo: QQyukim/for-Algorithm-Zonzal path: /PS 스터디 (with @mindflip)/프로그래머스-크레인 인형뽑기 게임.py # 예시 입력값 board = [[0,0,0,0,0],[0,0,1,0,3],[0,2,5,0,1],[4,2,4,4,2],[3,5,1,3,1]] move...
code_fim
hard
{ "lang": "python", "repo": "QQyukim/for-Algorithm-Zonzal", "path": "/PS 스터디 (with @mindflip)/프로그래머스-크레인 인형뽑기 게임.py", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|>for nth in moves: for i in range(len(board)): selected = board[i][nth - 1] if selected == 0: continue else: # 인형을 resultList에 넣고 resultList.append(selected) # resultList를 탐색하여 같은 인형이 있는지 보기 lenR = len(resultList) ...
code_fim
medium
{ "lang": "python", "repo": "QQyukim/for-Algorithm-Zonzal", "path": "/PS 스터디 (with @mindflip)/프로그래머스-크레인 인형뽑기 게임.py", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|># repo: QQyukim/for-Algorithm-Zonzal path: /PS 스터디 (with @mindflip)/프로그래머스-크레인 인형뽑기 게임.py # 예시 입력값 board = [[0,0,0,0,0],[0,0,1,0,3],[0,2,5,0,1],[4,2,4,4,2],[3,5,1,3,1]] moves = [1,5,3,5,1,2,1,4] # 로직 resultList = [] count = 0 <|fim_suffix|> # 뽑힌 인형은 board에서 사라짐 board[i][nth - 1] ...
code_fim
hard
{ "lang": "python", "repo": "QQyukim/for-Algorithm-Zonzal", "path": "/PS 스터디 (with @mindflip)/프로그래머스-크레인 인형뽑기 게임.py", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|> print('ID\tAT\tBT\tCT\tTAT\tWT') for process in process_list: process.print() print('----------------------') if __name__ == '__main__': # n = int(input("Enter the number of processes: ")) # print("Enter the process and their details in the format ID AT BT") ...
code_fim
medium
{ "lang": "python", "repo": "Jyothis-P/OS_Lab", "path": "/fcfs.py", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|># repo: Jyothis-P/OS_Lab path: /fcfs.py class Process: def __init__(self, id, at, bt): self.id = id self.at = at self.bt = bt self.wt = 0 self.ct = 0 self.st = 0 self.tat = 0 <|fim_suffix|> def print(self): st = '\t'.join(map(str, [s...
code_fim
hard
{ "lang": "python", "repo": "Jyothis-P/OS_Lab", "path": "/fcfs.py", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|> pygame.draw.circle(naytto, (255, 255, 0), (350, 150), 40) kuva = pygame.image.load("mycat.png").convert() naytto.blit(kuva, (x, y)) pygame.display.flip() main()<|fim_prefix|># repo: Balde641/Python path: /osa2.py import pygame naytto = pygame.display.set_mode(...
code_fim
medium
{ "lang": "python", "repo": "Balde641/Python", "path": "/osa2.py", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|> kuva = pygame.image.load("mycat.png").convert() naytto.blit(kuva, (x, y)) pygame.display.flip() main()<|fim_prefix|># repo: Balde641/Python path: /osa2.py import pygame naytto = pygame.display.set_mode((740, 500)) pygame.display.set_caption("Piirtäminen") x = 100 y = ...
code_fim
medium
{ "lang": "python", "repo": "Balde641/Python", "path": "/osa2.py", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|># repo: Balde641/Python path: /osa2.py import pygame naytto = pygame.display.set_mode((740, 500)) pygame.display.set_caption("Piirtäminen") x = 100 y = 300 def main(): <|fim_suffix|> pygame.draw.line(naytto, (0, 255, 0), (640, 0), (0, 400)) pygame.draw.rect(naytto, (255, 0, 0),...
code_fim
hard
{ "lang": "python", "repo": "Balde641/Python", "path": "/osa2.py", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|># repo: chungd/NLP path: /BerkeleyAligner.py import nltk import A from collections import defaultdict from nltk.align import Alignment, AlignedSent class BerkeleyAligner(): def __init__(self, align_sents, num_iter): self.t, self.q = self.train(align_sents, num_iter) # TODO: Computes the alig...
code_fim
hard
{ "lang": "python", "repo": "chungd/NLP", "path": "/BerkeleyAligner.py", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|> e = e_sentence[i] #English --> German eg_count = (t[(g_sentence[j],e_sentence[i])] * q_eg[(i,j,len_e,len_g)]) eg_normalized = eg_count / eg_total[g] #German --> English ge_count = (t[(e_sentence[i], g_sentence[j])] * q_ge[(j,i,len_g,len_e)]) ge_normalized = ge_count /...
code_fim
hard
{ "lang": "python", "repo": "chungd/NLP", "path": "/BerkeleyAligner.py", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|> #M step q = defaultdict(float) for sentence in aligned_sents: for e in sentence.mots: for g in sentence.words: #eng --> germ t[(g,e)]= count_g_given_e[(g,e)] / count_any_g_given_e[e] #germ --> eng t[(e,g)]= count_e_given_g[(e,g)] / count_any_e_given_g[g] len_e=len(sent...
code_fim
hard
{ "lang": "python", "repo": "chungd/NLP", "path": "/BerkeleyAligner.py", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|> # get default group, but not for anonymous try: default_group = Group.objects.get(name = "default_users") instance.groups.add(default_group) except: pass post_save.connect(create_user_profile, sender=User) # generate api key for the use...
code_fim
hard
{ "lang": "python", "repo": "mhaligowski/ook", "path": "/profiles/models.py", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|># repo: mhaligowski/ook path: /profiles/models.py from django.db import models from django.contrib.auth.models import User, Group from userena.models import UserenaBaseProfile from django.db.models.signals import post_save from tastypie.models import create_api_key class UserProfile(UserenaBaseProfile):...
code_fim
medium
{ "lang": "python", "repo": "mhaligowski/ook", "path": "/profiles/models.py", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|># repo: liusulin/Ax path: /ax/storage/json_store/tests/test_json_store.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 os import tempfile from...
code_fim
hard
{ "lang": "python", "repo": "liusulin/Ax", "path": "/ax/storage/json_store/tests/test_json_store.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> def testEncodeDecode(self): for class_, fake_func in TEST_CASES: # Can't load trials from JSON, because a batch needs an experiment # in order to be initialized if class_ == "BatchTrial" or class_ == "Trial": continue # Can't loa...
code_fim
hard
{ "lang": "python", "repo": "liusulin/Ax", "path": "/ax/storage/json_store/tests/test_json_store.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: sunkanggao/Algorithm path: /course/01_LinkedlistQueueStack/reversePolishNotation.py # -*- coding:utf-8 -*- """ 逆波兰表达式,中缀表达式可以对应一棵二叉树,逆波兰表达式即该二叉树后续遍历的结果。 """ def isOperator(c): return c == '+' or c == '-' or c == '*' or c == '/' <|fim_suffix|> stack = list() for cur in p: if...
code_fim
medium
{ "lang": "python", "repo": "sunkanggao/Algorithm", "path": "/course/01_LinkedlistQueueStack/reversePolishNotation.py", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|> if __name__ == '__main__': p = ['2', '1', '+', '3', '*'] print reversePolishNotation(p)<|fim_prefix|># repo: sunkanggao/Algorithm path: /course/01_LinkedlistQueueStack/reversePolishNotation.py # -*- coding:utf-8 -*- """ 逆波兰表达式,中缀表达式可以对应一棵二叉树,逆波兰表达式即该二叉树后续遍历的结果。 """ def isOperator(c): retur...
code_fim
hard
{ "lang": "python", "repo": "sunkanggao/Algorithm", "path": "/course/01_LinkedlistQueueStack/reversePolishNotation.py", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|># repo: Computer-engineering-FICT/Computer-engineering-FICT path: /I семестр/Програмування (Python)/Лабораторні/Братун 6305/Приклади/31/Ex19.py from tkinter import * from tkinter import messagebox <|fim_suffix|>B1 = Button(root, text = "Say Hello", command = hello, font='arial 20') B1.pack() main...
code_fim
medium
{ "lang": "python", "repo": "Computer-engineering-FICT/Computer-engineering-FICT", "path": "/I семестр/Програмування (Python)/Лабораторні/Братун 6305/Приклади/31/Ex19.py", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|>B1 = Button(root, text = "Say Hello", command = hello, font='arial 20') B1.pack() mainloop()<|fim_prefix|># repo: Computer-engineering-FICT/Computer-engineering-FICT path: /I семестр/Програмування (Python)/Лабораторні/Братун 6305/Приклади/31/Ex19.py from tkinter import * from tkinter import messageb...
code_fim
medium
{ "lang": "python", "repo": "Computer-engineering-FICT/Computer-engineering-FICT", "path": "/I семестр/Програмування (Python)/Лабораторні/Братун 6305/Приклади/31/Ex19.py", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|> headers = { "Authorization": f"Bearer {SENDGRID_API_KEY}", "Content-Type": "application/json" } email_body = build_request_body(email) response = requests.post(sendgrid_url, headers=headers, data=email_body) print(response.text) return response<|fim_prefix|># repo: ...
code_fim
hard
{ "lang": "python", "repo": "Putnam14/putnam-mail", "path": "/sendgrid.py", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|>def build_request_body(email): from_email = email['email'] name = email['name'] subject = email['subject'] body = email['body'] if not from_email: from_email = FROM_EMAIL if not name: name = "Anonymous" if not subject: subject = "Portfolio contact form m...
code_fim
medium
{ "lang": "python", "repo": "Putnam14/putnam-mail", "path": "/sendgrid.py", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|># repo: Putnam14/putnam-mail path: /sendgrid.py #!flask/bin/python import os, json import requests SENDGRID_API_KEY = os.environ.get('SENDGRID_API_KEY', default=None) FROM_EMAIL = os.environ.get('FROM_EMAIL', default=None) TO_EMAIL = os.environ.get('TO_EMAIL', default=None) if not SENDGRID_API_KEY: ...
code_fim
medium
{ "lang": "python", "repo": "Putnam14/putnam-mail", "path": "/sendgrid.py", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|>for j in range(n-1, -1, -1): # x[i][j] = max (y[j][j+1] , y[j][j+2] , ……, y[j][n] ) xs_temp = max(ys[j][j+1:n+1]) ys_temp = min(xs[j][j+1:n+1]) for i in range(0, j): xs[i][j] = xs_temp ys[i][j] = ys_temp # print(xs) # print(ys) print(max(ys[0][1:]))<|fim_prefix|># repo: Linus-MK/AtCoder path: /...
code_fim
hard
{ "lang": "python", "repo": "Linus-MK/AtCoder", "path": "/ARC/arc085d.py", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|># repo: Linus-MK/AtCoder path: /ARC/arc085d.py n, x0, y0 = list(map(int, input().split())) cards = [y0] + list(map(int, input().split())) # yの手持ちはゲームに関与するため、リストに加えてしまう xs = [[-1] * (n+1) for i in range(n+1)] ys = [[-1] * (n+1) for i in range(n+1)] #xs[i][j] = xの手番で、xがcards[i]を持ちyがcards[j]を持っているとき(i<j)...
code_fim
medium
{ "lang": "python", "repo": "Linus-MK/AtCoder", "path": "/ARC/arc085d.py", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|>for i in range(n+1): xs[i][-1] = abs(cards[-1] - cards[i]) ys[i][-1] = abs(cards[-1] - cards[i]) for j in range(n-1, -1, -1): # x[i][j] = max (y[j][j+1] , y[j][j+2] , ……, y[j][n] ) xs_temp = max(ys[j][j+1:n+1]) ys_temp = min(xs[j][j+1:n+1]) for i in range(0, j): xs[i][j] = xs_temp ys[i][j] = y...
code_fim
hard
{ "lang": "python", "repo": "Linus-MK/AtCoder", "path": "/ARC/arc085d.py", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|> """ Returns a random number to guess between a defined min and max range. Min and Max range can be custom. Default values are 1 - 10 """ return random.randrange(min_guess_range, max_guess_range), min_guess_range, max_guess_range def main(): run_game = True while run_game == True: guess_value, m...
code_fim
hard
{ "lang": "python", "repo": "jrggementiza/Guess-The-Number", "path": "/GuessTheNumber.py", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|># repo: jrggementiza/Guess-The-Number path: /GuessTheNumber.py """ Guess the number! """ import random, generic def check_answer(player_guess, guess_value): """ Compares a player's guess and the number to guess Returns True if the player guessed correctly Returns False by default """ end_game =...
code_fim
hard
{ "lang": "python", "repo": "jrggementiza/Guess-The-Number", "path": "/GuessTheNumber.py", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|> end_game = False while end_game == False: print(f'You have {guess_limit - guess_count + 1} remaining. ') player_guess = guess_number(min_guess_range, max_guess_range) player_won = check_answer(player_guess, guess_value) guess_count = guess_count + 1 if player_won == True: print(...
code_fim
hard
{ "lang": "python", "repo": "jrggementiza/Guess-The-Number", "path": "/GuessTheNumber.py", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|># repo: daVincere/blog-api path: /post/views.py from django.shortcuts import render from django.http import HttpResponseRedirect from .forms import PostForm from django.contrib.auth.decorators import login_required from django.shortcuts import get_object_or_404 from .models import Post from django.contri...
code_fim
hard
{ "lang": "python", "repo": "daVincere/blog-api", "path": "/post/views.py", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|> instance = get_object_or_404(Post, slug=slug) context = { 'instance' : instance } return render(request, 'post/view.html', context)<|fim_prefix|># repo: daVincere/blog-api path: /post/views.py from django.shortcuts import render from django.http import HttpResponseRedirect from .forms import Post...
code_fim
medium
{ "lang": "python", "repo": "daVincere/blog-api", "path": "/post/views.py", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|>in_dir = os.path.expanduser(args.directory) # add rec each file in the list list_input = batch.get_list(args.infile, args.suffix, in_dir) if args.elist_suffix: list_elist = batch.get_list(args.infile, args.elist_suffix, in_dir) for fin, felist in zip(list_input, list_elist): command = [e...
code_fim
medium
{ "lang": "python", "repo": "KoalaGroup/KoalaSoft", "path": "/macro/koala/daq_tasks/export_ems.py", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|># repo: KoalaGroup/KoalaSoft path: /macro/koala/daq_tasks/export_ems.py #!/usr/bin/python import argparse import os import subprocess import batch vmc_dir = os.environ['VMCWORKDIR'] macro = os.path.join(vmc_dir, 'macro/koala/daq_tasks/export_ems.C') exec_bin = os.path.join(vmc_dir,'build/bin/koa_execut...
code_fim
medium
{ "lang": "python", "repo": "KoalaGroup/KoalaSoft", "path": "/macro/koala/daq_tasks/export_ems.py", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|># 5.Consuming values from an iterator dataset = tf.data.Dataset.range(5) iterator = dataset.make_initializable_iterator() next_element = iterator.get_next() # Typically `result` will be the output of a model, or an optimizer's # training operation. result = tf.add(next_element, next_element) sess.run(iter...
code_fim
hard
{ "lang": "python", "repo": "zyqgmzyq/tensorflow_learn", "path": "/dataset/learn_dataset/iterator.py", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|># repo: zyqgmzyq/tensorflow_learn path: /dataset/learn_dataset/iterator.py import tensorflow as tf import os os.environ['TF_CPP_MIN_LOG_LEVEL'] = '2' sess = tf.Session() # 1.one-shot iterator dataset = tf.data.Dataset.range(100) iterator = dataset.make_one_shot_iterator() next_element = iterator.get_nex...
code_fim
hard
{ "lang": "python", "repo": "zyqgmzyq/tensorflow_learn", "path": "/dataset/learn_dataset/iterator.py", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|># repo: btstatz/CS122 path: /rosalind/12_ba3d.py with open('rosalind_ba3d.txt','r') as f: kmer_length = int(f.readline().strip()) seq = f.readline().strip() <|fim_suffix|>for key in sorted(dict): print(key + " -> " + ','.join(sorted(dict[key])))<|fim_middle|>dict = {} for offset in range(len(se...
code_fim
hard
{ "lang": "python", "repo": "btstatz/CS122", "path": "/rosalind/12_ba3d.py", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|>for key in sorted(dict): print(key + " -> " + ','.join(sorted(dict[key])))<|fim_prefix|># repo: btstatz/CS122 path: /rosalind/12_ba3d.py with open('rosalind_ba3d.txt','r') as f: kmer_length = int(f.readline().strip()) seq = f.readline().strip() <|fim_middle|>dict = {} for offset in range(len(se...
code_fim
hard
{ "lang": "python", "repo": "btstatz/CS122", "path": "/rosalind/12_ba3d.py", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|># repo: ozbudak/STARMethods_2022 path: /combine_embryos.py """ Create all figures and Excel files that combine data from all embryos in a given genetic background Copyright (C) 2017 Ahmet Ay, Dong Mai, Soo Bin Kwon, Ha Vu This program is free software: you can redistribute it and/or modify it under the ...
code_fim
hard
{ "lang": "python", "repo": "ozbudak/STARMethods_2022", "path": "/combine_embryos.py", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|> command = ["python","create_raw_noise_excel.py",str(num_embryos)] + slice_files + [directory] print("Creating Excel files for noise...") if 1==call(command): exit(1) def usage(): print("combine_embryos.py: Invalid command-line arguments.") print("Format: combine_embryos.py -ne <number of embryos> ...
code_fim
hard
{ "lang": "python", "repo": "ozbudak/STARMethods_2022", "path": "/combine_embryos.py", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|>if __name__ == '__main__': sys.exit(main())<|fim_prefix|># repo: miranetworks/kobusv_play path: /src/number_play.py #!/usr/bin/env python import sys <|fim_middle|>def add_them(a, b): return a + b def main(): print add_them(10, 21)
code_fim
medium
{ "lang": "python", "repo": "miranetworks/kobusv_play", "path": "/src/number_play.py", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|># repo: miranetworks/kobusv_play path: /src/number_play.py #!/usr/bin/env python import sys <|fim_suffix|>def main(): print add_them(10, 21) if __name__ == '__main__': sys.exit(main())<|fim_middle|>def add_them(a, b): return a + b
code_fim
easy
{ "lang": "python", "repo": "miranetworks/kobusv_play", "path": "/src/number_play.py", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|># repo: ElisonSherton/python4everybody path: /ch3ex3.py # Exercise 3: Write a program to prompt for a score between 0.0 and 1.0. If the score is out of range, print an error message. # If the score is between 0.0 and 1.0, print a grade using the following table: # Score Grade # >= 0.9 A # >= 0.8 ...
code_fim
hard
{ "lang": "python", "repo": "ElisonSherton/python4everybody", "path": "/ch3ex3.py", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|> elif (i < 0.9): print("Grade: B") elif (i <= 1.0): print("Grade: A") except Exception as e: print(str(e))<|fim_prefix|># repo: ElisonSherton/python4everybody path: /ch3ex3.py # Exercise 3: Write a program to prompt for a score between 0.0 and 1.0. If the scor...
code_fim
hard
{ "lang": "python", "repo": "ElisonSherton/python4everybody", "path": "/ch3ex3.py", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|> elif (i < 0.8): print("Grade: C") elif (i < 0.9): print("Grade: B") elif (i <= 1.0): print("Grade: A") except Exception as e: print(str(e))<|fim_prefix|># repo: ElisonSherton/python4everybody path: /ch3ex3.py # Exercise 3: Write a program...
code_fim
medium
{ "lang": "python", "repo": "ElisonSherton/python4everybody", "path": "/ch3ex3.py", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|> def main(): np.set_printoptions(threshold=5) parser = argparse.ArgumentParser(description=None) parser.add_argument('-v', '--verbose', action='count', default=0, help='Set verbosity level.') parser.add_argument('--lmdb-input-path', required=True, help='Path to inp...
code_fim
hard
{ "lang": "python", "repo": "syedsaifhasan/rl_reconstruct", "path": "/python/reward_learning/split_data_lmdb.py", "mode": "spm", "license": "BSD-3-Clause", "source": "the-stack-v2" }
<|fim_suffix|> logger.info("Splitting {} samples into {} train and {} test samples".format(num_samples, num_samples1, num_samples2)) if num_samples > num_samples1 + num_samples2: logger.warn("Dropping {} samples from input dataset".format(num_samples - num_samples1 - num_samples2)) fixed_size_df = t...
code_fim
hard
{ "lang": "python", "repo": "syedsaifhasan/rl_reconstruct", "path": "/python/reward_learning/split_data_lmdb.py", "mode": "spm", "license": "BSD-3-Clause", "source": "the-stack-v2" }
<|fim_prefix|># repo: syedsaifhasan/rl_reconstruct path: /python/reward_learning/split_data_lmdb.py #!/usr/bin/env python from __future__ import print_function from __future__ import division from __future__ import absolute_import # Workaround for segmentation fault for some versions when ndimage is imported after t...
code_fim
hard
{ "lang": "python", "repo": "syedsaifhasan/rl_reconstruct", "path": "/python/reward_learning/split_data_lmdb.py", "mode": "psm", "license": "BSD-3-Clause", "source": "the-stack-v2" }
<|fim_prefix|># repo: petermlm/ProbPy path: /tests/par_factor_tests.py from nose.tools import with_setup, nottest from tests.par_test_base import ParTestBase from ProbPy import RandVar, Factor, ParFactor class TestFactorMult(ParTestBase): def __init__(self): super().__init__() def par_test_0(self):...
code_fim
hard
{ "lang": "python", "repo": "petermlm/ProbPy", "path": "/tests/par_factor_tests.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> for i in range(4): self.XY_par_factor.setMaxDepth(i) self.XZ_par_factor.setMaxDepth(i) res = self.XY_factor.mult(self.XZ_factor) par_res = self.XY_par_factor.mult(self.XZ_par_factor) assert res.rand_vars == par_res.rand_vars and res.valu...
code_fim
hard
{ "lang": "python", "repo": "petermlm/ProbPy", "path": "/tests/par_factor_tests.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: Simouche/zetraiteur-backend path: /mainapp/migrations/0001_initial.py # Generated by Django 3.2.1 on 2021-05-17 18:02 import django.contrib.auth.models from django.db import migrations, models import django.db.models.deletion class Migration(migrations.Migration): initial = True depe...
code_fim
hard
{ "lang": "python", "repo": "Simouche/zetraiteur-backend", "path": "/mainapp/migrations/0001_initial.py", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|>rue, max_length=1000)), ('image', models.ImageField(blank=True, null=True, upload_to='images', verbose_name='Image')), ('section', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='mainapp.section', verbose_name='Section')), ], optio...
code_fim
hard
{ "lang": "python", "repo": "Simouche/zetraiteur-backend", "path": "/mainapp/migrations/0001_initial.py", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|> class Meta: model = Comment fields = '__all__' class MessageSerializer(serializers.ModelSerializer): class Meta: model = Message fields = ('sender', 'receiver', 'content', 'creation_date')<|fim_prefix|># repo: MagdaZawora/twitter path: /Twitter/serializers.py fro...
code_fim
medium
{ "lang": "python", "repo": "MagdaZawora/twitter", "path": "/Twitter/serializers.py", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|># repo: MagdaZawora/twitter path: /Twitter/serializers.py from rest_framework import serializers from .models import Twit, Comment, Message from django.contrib.auth.models import User <|fim_suffix|>class MessageSerializer(serializers.ModelSerializer): class Meta: model = Message fiel...
code_fim
hard
{ "lang": "python", "repo": "MagdaZawora/twitter", "path": "/Twitter/serializers.py", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|># repo: matt-schoessling/cse30332-programming-paradigms path: /HW8/rest_server/parking_api/views.py from .models import Owner, Vehicle from rest_framework import viewsets, permissions from .serializers import OwnerSerializer, VehicleSerializer <|fim_suffix|>class VehicleViewSet(viewsets.ModelViewSet): ...
code_fim
medium
{ "lang": "python", "repo": "matt-schoessling/cse30332-programming-paradigms", "path": "/HW8/rest_server/parking_api/views.py", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|> queryset = Vehicle.objects.all().order_by('id') serializer_class = VehicleSerializer permission_classes = [permissions.IsAuthenticated]<|fim_prefix|># repo: matt-schoessling/cse30332-programming-paradigms path: /HW8/rest_server/parking_api/views.py from .models import Owner, Vehicle from rest...
code_fim
medium
{ "lang": "python", "repo": "matt-schoessling/cse30332-programming-paradigms", "path": "/HW8/rest_server/parking_api/views.py", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|>print(sum(a)) # the sequence has disappeared<|fim_prefix|># repo: suryansh2020/chapter_codes path: /codes_ch3/chap3_code_19.py from sys import getsizeof # using parenthesis indicates that we are creating a generator a = (b for b in range(10)) print(getsizeof(a)) <|fim_middle|>c = [b for b in range(10)...
code_fim
medium
{ "lang": "python", "repo": "suryansh2020/chapter_codes", "path": "/codes_ch3/chap3_code_19.py", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|># repo: suryansh2020/chapter_codes path: /codes_ch3/chap3_code_19.py from sys import getsizeof # using parenthesis indicates that we are creating a generator a = (b for b in range(10)) <|fim_suffix|># c uses more memory than a print(getsizeof(c)) for b in a: print(b) print(sum(a)) # the sequence ...
code_fim
easy
{ "lang": "python", "repo": "suryansh2020/chapter_codes", "path": "/codes_ch3/chap3_code_19.py", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|>c = [b for b in range(10)] # c uses more memory than a print(getsizeof(c)) for b in a: print(b) print(sum(a)) # the sequence has disappeared<|fim_prefix|># repo: suryansh2020/chapter_codes path: /codes_ch3/chap3_code_19.py from sys import getsizeof # using parenthesis indicates that we are creati...
code_fim
easy
{ "lang": "python", "repo": "suryansh2020/chapter_codes", "path": "/codes_ch3/chap3_code_19.py", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|>for k, v in sorted(villagers.items(), key=lambda x: x[0]): if imp - len(susList) >= (n- len(susList)) // 2: print(0) elif k in susList: print(0) elif len(v) >= imp - len(susList): print(1) else: print(0)<|fim_prefix|># repo: jerrylee17/Algorithms path: /Kat...
code_fim
hard
{ "lang": "python", "repo": "jerrylee17/Algorithms", "path": "/KattisPractice/DivisionChampionships/investigatingimposters.py", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|># Discredit all imposter votes for s in susList: for p in peoples[s-1]: try: villagers[p].remove(s) except: pass for k, v in sorted(villagers.items(), key=lambda x: x[0]): if imp - len(susList) >= (n- len(susList)) // 2: print(0) elif k in sus...
code_fim
hard
{ "lang": "python", "repo": "jerrylee17/Algorithms", "path": "/KattisPractice/DivisionChampionships/investigatingimposters.py", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|># repo: jerrylee17/Algorithms path: /KattisPractice/DivisionChampionships/investigatingimposters.py n, imp = list(map(int, input().split())) villagers = {} peoples = [] susList = set() for i in range(n): peeps = set(list(map(int, input().split()))[1:]) # Initialize the set villagers[i+1] = vi...
code_fim
hard
{ "lang": "python", "repo": "jerrylee17/Algorithms", "path": "/KattisPractice/DivisionChampionships/investigatingimposters.py", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|># repo: distributed-objects/Pydo path: /pydo/pydo.py import Pyro4 from Pyro4 import Daemon, Proxy from threading import Thread import thread import pickle import socket Pyro4.config.REQUIRE_EXPOSE = False def register(obj): ''' Register an object with daemon ''' daemon = Pyro4.Daemon(host="loca...
code_fim
medium
{ "lang": "python", "repo": "distributed-objects/Pydo", "path": "/pydo/pydo.py", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|> class SharedObject(object): ''' Shared object that is distribtued across nodes ''' def __init__(self): ''' Register the child object to the daeomn and replace object with the proxy object ''' self.name = register(self) print proxy(self.name) def __getattr...
code_fim
hard
{ "lang": "python", "repo": "distributed-objects/Pydo", "path": "/pydo/pydo.py", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|> if mydoc.count() == 0: posts_j = {} posts_j[str(post_id)] = timestamp mydict = {"user_id": user_id, "posts": json.dumps(posts_j)} mycol.insert_one(mydict) else: posts_j = json.loads(mydoc.next()["posts"]) posts_j[str(post_id)] = timestamp pos...
code_fim
medium
{ "lang": "python", "repo": "tjulym/gray", "path": "/benchmarks/DeathstarBench/upload-user-timeline-sdc/handler.py", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|># repo: tjulym/gray path: /benchmarks/DeathstarBench/upload-user-timeline-sdc/handler.py import pymongo import redis import json from time import time user_timeline_mongodb = "mongodb://user-timeline-mongodb.sdc-socialnetwork-db.svc.cluster.local:27017/" user_timeline_redis = "user-timeline-redis.sdc-so...
code_fim
medium
{ "lang": "python", "repo": "tjulym/gray", "path": "/benchmarks/DeathstarBench/upload-user-timeline-sdc/handler.py", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|># repo: Shiv-Dangi/lafoodla path: /testproject/registration/migrations/0001_initial.py # -*- coding: utf-8 -*- # Generated by Django 1.9.4 on 2016-06-10 12:20 from __future__ import unicode_literals from django.db import migrations, models class Migration(migrations.Migration): initial = True ...
code_fim
hard
{ "lang": "python", "repo": "Shiv-Dangi/lafoodla", "path": "/testproject/registration/migrations/0001_initial.py", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|>ct', models.CharField(max_length=300)), ('issue_date', models.DateField(max_length=20)), ('number_of_bades', models.IntegerField()), ('about_us', models.TextField()), ('logo', models.ImageField(upload_to='Images/logo/')), ('ho...
code_fim
hard
{ "lang": "python", "repo": "Shiv-Dangi/lafoodla", "path": "/testproject/registration/migrations/0001_initial.py", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|># repo: walkccc/LeetCode path: /solutions/2427. Number of Common Factors/2427.py class Solution: def commonFactors(self, a<|fim_suffix|>0 for i in range(1, gcd + 1))<|fim_middle|>: int, b: int) -> int: gcd = math.gcd(a, b) return sum(a % i == 0 and b % i ==
code_fim
medium
{ "lang": "python", "repo": "walkccc/LeetCode", "path": "/solutions/2427. Number of Common Factors/2427.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> b) return sum(a % i == 0 and b % i == 0 for i in range(1, gcd + 1))<|fim_prefix|># repo: walkccc/LeetCode path: /solutions/2427. Number of Common Factors/2427.py class Solution: def commonFactors(self, a<|fim_middle|>: int, b: int) -> int: gcd = math.gcd(a,
code_fim
easy
{ "lang": "python", "repo": "walkccc/LeetCode", "path": "/solutions/2427. Number of Common Factors/2427.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }