text
stringlengths
232
16.3k
domain
stringclasses
1 value
difficulty
stringclasses
3 values
meta
dict
<|fim_suffix|> def collect_statistics(self, stats_lambda, summary_lambda): return summary_lambda([stats_lambda(item) for item in self]) train_augmentation = torchvision.transforms.Compose( [ torchvision.transforms.AutoAugment(), torchvision.transforms.RandomApply( [ ...
code_fim
hard
{ "lang": "python", "repo": "ChenchaoZhao/GroceryStoreDataset", "path": "/model_scripts/dataloader.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: ChenchaoZhao/GroceryStoreDataset path: /model_scripts/dataloader.py import os import groot import numpy as np import PIL import torch import torchvision class GroceryDataset(torch.utils.data.Dataset): def __init__( self, root, split="train", string_labels=Tr...
code_fim
hard
{ "lang": "python", "repo": "ChenchaoZhao/GroceryStoreDataset", "path": "/model_scripts/dataloader.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> def __ne__(self, other): ... def __lt__(self, other): ... def __le__(self, other): ... def __gt__(self, other): ... def __ge__(self, other): ... @overload def __init__( self,*, skill_id: Optional[str] = ..., from_field: Optional[RuleConditionKey] =...
code_fim
hard
{ "lang": "python", "repo": "IvanStelmakh/toloka-kit", "path": "/src/client/actions.pyi", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_prefix|># repo: IvanStelmakh/toloka-kit path: /src/client/actions.pyi from enum import Enum from typing import Any, Dict, Optional, overload from .conditions import RuleConditionKey from .user_restriction import DurationUnit, UserRestriction from .util._codegen import BaseParameters class RuleType(Enum): ...
code_fim
hard
{ "lang": "python", "repo": "IvanStelmakh/toloka-kit", "path": "/src/client/actions.pyi", "mode": "psm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|> def __ge__(self, other): ... def __init__( self,*, delta: Optional[int] = ..., open_pool: Optional[bool] = ... ) -> None: ... _unexpected: Optional[Dict[str, Any]] delta: Optional[int] open_pool: Optional[bool] def ...
code_fim
hard
{ "lang": "python", "repo": "IvanStelmakh/toloka-kit", "path": "/src/client/actions.pyi", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_prefix|># repo: gkarthik/crawl-covid19-cases path: /covid19/items.py # -*- coding: utf-8 -*- # Define here the models for your scraped items # # See documentation in: # https://doc.scrapy.org/en/latest/topics/items.html import scrapy from functools import reduce from datetime import datetime as dt class Cases...
code_fim
medium
{ "lang": "python", "repo": "gkarthik/crawl-covid19-cases", "path": "/covid19/items.py", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|> # Get case categories for which data exists categories = sorted([i for i in self.keys() if i!= "date"]) # Get all non null keys from lib import funs CasesCategory case_categories = [list(self[i].keys()) for i in categories] case_categories = reduce(lambda x,y: x+y,c...
code_fim
hard
{ "lang": "python", "repo": "gkarthik/crawl-covid19-cases", "path": "/covid19/items.py", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|> def getCategoryTotal(self, key): case_categories = [i for i in self[key].keys() if i not in ["name", "Hospitalized", "Deaths", "Intensive Care"]] return sum([int(self[key][i]) for i in case_categories if self[key][i] != "NA"]) def toAsciiTable(self): # Get case categories ...
code_fim
medium
{ "lang": "python", "repo": "gkarthik/crawl-covid19-cases", "path": "/covid19/items.py", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|> print("It's higher!") elif guess == random_number: print("Congrats!! You guessed the right number") print("You took {} tries to guess the right number.".format(attempts)) ask = input("Would you like to play again? (Yes/No) ") ...
code_fim
hard
{ "lang": "python", "repo": "coderchris591/Number-guessing-game", "path": "/guess.py", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|># repo: coderchris591/Number-guessing-game path: /guess.py from random import randint def start_game(): print('Welcome to the number guessing game!') attempts = 0 random_number = randint(1,10) while True: attempts += 1 try: guess = int(input("Guess a number ...
code_fim
hard
{ "lang": "python", "repo": "coderchris591/Number-guessing-game", "path": "/guess.py", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|> raw_cards = c.fetchall() cards = [] for card in raw_cards: cards.append( Flashcard( id=card[0], title=card[1], description=card[2], source=card[3], image_...
code_fim
hard
{ "lang": "python", "repo": "djbeadle/flashcard-backend", "path": "/app/db_operations.py", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|> r = c.fetchone() if not r: return None return Flashcard( id=r[0], title=r[1], description=r[2], source=r[3], image_url=r[4], tags=json.loads(r[5]) )<|fim_prefix|># repo: djbeadle/fl...
code_fim
hard
{ "lang": "python", "repo": "djbeadle/flashcard-backend", "path": "/app/db_operations.py", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_prefix|># repo: djbeadle/flashcard-backend path: /app/db_operations.py import sqlite3 from app.api.classes import Flashcard from flask import current_app import json def create_flashcard(title: str, description='', source='', image_url='', tags=[]): with sqlite3.connect(current_app.config['DB']) as db: ...
code_fim
hard
{ "lang": "python", "repo": "djbeadle/flashcard-backend", "path": "/app/db_operations.py", "mode": "psm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|> return self.len def state_dict(self) -> Dict[str, Any]: return {"pos": self.pos} def load_state_dict(self, state: Dict[str, Any]): self.pos = state["pos"] class BucketedSampler(torch.utils.data.Sampler): def __init__(self, data_source: torch.utils.data.Dataset, batc...
code_fim
hard
{ "lang": "python", "repo": "RobertCsordas/ndr", "path": "/framework/loader/sampler.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> def state_dict(self) -> Dict[str, Any]: return {"pos": self.pos} def load_state_dict(self, state: Dict[str, Any]): self.pos = state["pos"] class BucketedSampler(torch.utils.data.Sampler): def __init__(self, data_source: torch.utils.data.Dataset, batch_size: int, length_key_n...
code_fim
hard
{ "lang": "python", "repo": "RobertCsordas/ndr", "path": "/framework/loader/sampler.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: eddowh/Project-Euler path: /011_to_020/020_Factorial_Digit_Sum.py # -*- coding: utf-8 -*- # Conventions are according to NumPy Docstring. """ n! means n * (n − 1) * ... * 3 * 2 * 1 <|fim_suffix|>import time import math if __name__ == '__main__': # input factorial number inputNum = 100 ...
code_fim
medium
{ "lang": "python", "repo": "eddowh/Project-Euler", "path": "/011_to_020/020_Factorial_Digit_Sum.py", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|>import time import math if __name__ == '__main__': # input factorial number inputNum = 100 # initialize running time start = time.time() numFactorial = math.factorial(inputNum) numFactorialString = str(numFactorial) # sum of the digits initialized sumDigits = 0 for cha...
code_fim
medium
{ "lang": "python", "repo": "eddowh/Project-Euler", "path": "/011_to_020/020_Factorial_Digit_Sum.py", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|># repo: bkimmig/silver-pancake path: /python/src/twins/v1.py import pandas as pd import numpy as np import tensorflow as tf from typing import List import twins # TODO - remove dep on the service in this repo; create a package that gets # imported into both things (parent). But for sake of time just u...
code_fim
hard
{ "lang": "python", "repo": "bkimmig/silver-pancake", "path": "/python/src/twins/v1.py", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|> df["sentence"] = df.apply(_join, axis=1) return df # -------------------------- def train(): steps = [_transform, _combine] train_data = twins.pipeline.build(_load(), steps) print("training model v1") # TODO - persist this model then create a "predict" step that loads it in ...
code_fim
medium
{ "lang": "python", "repo": "bkimmig/silver-pancake", "path": "/python/src/twins/v1.py", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|> def _transform(data: List[dict]) -> List[dict]: fcn = lambda x: " ".join(np.unique(x)) for i in range(len(data)): data[i]["transformed"] = twins.utils.create_sentence( data[i]["df"], group_col="user_handle", apply_col=data[i]["apply_col"], transform=fcn ) return da...
code_fim
hard
{ "lang": "python", "repo": "bkimmig/silver-pancake", "path": "/python/src/twins/v1.py", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|> def draw_kcf_trackers(self, tracks): self.viewer.thickness = 2 for track in tracks: if not track.is_confirmed() or track.time_since_update > 1: continue # if track.label == 'truck': # self.viewer.thickness = 6 self.vie...
code_fim
hard
{ "lang": "python", "repo": "818ajian/DTTM-Vehicle-Counting", "path": "/deep_sort/application_util/frame_visualization.py", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|># repo: 818ajian/DTTM-Vehicle-Counting path: /deep_sort/application_util/frame_visualization.py # vim: expandtab:ts=4:sw=4 import numpy as np import colorsys from .image_viewer import ImageViewer import cv2 import time def create_unique_color_float(tag, hue_step=0.41): """Create a unique RGB color c...
code_fim
hard
{ "lang": "python", "repo": "818ajian/DTTM-Vehicle-Counting", "path": "/deep_sort/application_util/frame_visualization.py", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|> wallpaper = path + "/" + file logger.info("Updating wallpaper.") command = 'feh --bg-max "' + wallpaper + '"' os.system(command) def ResetI3(): logger.info("Resetting i3") os.system('xrdb -merge ~/.Xresources-regolith && i3 reload')<|fim_prefix|># repo: Fave42/Wallpaper-Sorter p...
code_fim
medium
{ "lang": "python", "repo": "Fave42/Wallpaper-Sorter", "path": "/Changer.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: Fave42/Wallpaper-Sorter path: /Changer.py #!/usr/bin/python3 # -*- coding: utf-8 -*- """ @Author: Fabian Fey """ import os from logzero import logger COLORPATH = '/etc/regolith/styles/costum-theme/color' def ChangeColors(colorsList): colors = [ "#define color_base03 " + colorsL...
code_fim
medium
{ "lang": "python", "repo": "Fave42/Wallpaper-Sorter", "path": "/Changer.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: SaiTeja69/Hackathon_2020_MSME path: /Server/Budget_based_crop_suggestion.py import csv predict={} with open('data/cost-of-cultivation.csv') as csvfile: reader = csv.reader(csvfile) for x in reader: predict[x[0]]=int(x[1]) def bestcrop(budget): rem=[] cos=[int(i<|fim_suffix|>(i) op...
code_fim
medium
{ "lang": "python", "repo": "SaiTeja69/Hackathon_2020_MSME", "path": "/Server/Budget_based_crop_suggestion.py", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|>(i) op={x:y for y,x in predict.items()} for i in rem: if(i!=-1): print(op[i]) bestcrop(10000)<|fim_prefix|># repo: SaiTeja69/Hackathon_2020_MSME path: /Server/Budget_based_crop_suggestion.py import csv predict={} with open('data/cost-of-cultivation.csv') as csvfile: reader = csv.reader(csvfil...
code_fim
medium
{ "lang": "python", "repo": "SaiTeja69/Hackathon_2020_MSME", "path": "/Server/Budget_based_crop_suggestion.py", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|> @classmethod def get_argument(cls, input_console, argument_number): return input_console.split(" ")[argument_number] @classmethod def print_incorrect_input(cls, input_console): print("Error in input: " + input()) def join(self): self._thread.join()<|fim_prefix...
code_fim
hard
{ "lang": "python", "repo": "evowilliamson/py-pnd-crypto-tradebot", "path": "/command_center.py", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|># repo: evowilliamson/py-pnd-crypto-tradebot path: /command_center.py import threading from trade_engine import TradeEngine class CommandCenter: def __init__(self, trade_engine): self._trade_engine = trade_engine self._thread = threading.Thread(target=self.run) self._thread...
code_fim
hard
{ "lang": "python", "repo": "evowilliamson/py-pnd-crypto-tradebot", "path": "/command_center.py", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|> @classmethod def get_command(cls, input_console): return input_console.split(" ")[0] @classmethod def get_argument(cls, input_console, argument_number): return input_console.split(" ")[argument_number] @classmethod def print_incorrect_input(cls, input_console): ...
code_fim
hard
{ "lang": "python", "repo": "evowilliamson/py-pnd-crypto-tradebot", "path": "/command_center.py", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|> # main laFitness = LAFitness(monthlyFee, initFee) LDai= Member("Dai Lian", datetime(2016,12,15)) LDai.pay(150) LDai.pay(150) KHuang = Member("Huang Kun", datetime(2017,5,13)) KHuang.pay(75) JWang = Member("Wang Jinghao", datetime(2017,7,13)) JWang.pay(150) laFi...
code_fim
medium
{ "lang": "python", "repo": "oldteb/LAFtinessCalculator", "path": "/LAFitnessMain.py", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|> # load from config file... # parameters monthlyFee = 25 initFee = 25 # main laFitness = LAFitness(monthlyFee, initFee) LDai= Member("Dai Lian", datetime(2016,12,15)) LDai.pay(150) LDai.pay(150) KHuang = Member("Huang Kun", datetime(2017,5,13)) KHuang.pay(75...
code_fim
medium
{ "lang": "python", "repo": "oldteb/LAFtinessCalculator", "path": "/LAFitnessMain.py", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|># repo: oldteb/LAFtinessCalculator path: /LAFitnessMain.py from LAFitness import LAFitness from Member import Member from datetime import datetime if __name__ == "__main__": # load from config file... # parameters monthlyFee = 25 initFee = 25 # main laFitness = LAFitness(mont...
code_fim
medium
{ "lang": "python", "repo": "oldteb/LAFtinessCalculator", "path": "/LAFitnessMain.py", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|># repo: adityatanwar800/FSDP2019 path: /Day23/tshirts.py # -*- coding: utf-8 -*- """ Created on Thu Jul 4 11:30:49 2019 @author: Aditya Tanwar """ # Importing the libraries import numpy as np import matplotlib.pyplot as plt import pandas as pd #import dataset dataset = pd.read_csv('tshirts.csv') fea...
code_fim
medium
{ "lang": "python", "repo": "adityatanwar800/FSDP2019", "path": "/Day23/tshirts.py", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|>from sklearn.cluster import KMeans kmeans =KMeans(n_clusters = 3, init = 'k-means++', random_state = 0) pred_cluster1 = kmeans.fit_predict(features) plt.scatter(features[pred_cluster1 == 0, 0], features[pred_cluster1 == 0, 1], c = 'blue', label = 'small') plt.scatter(features[pred_cluster1 == 1, 0], fea...
code_fim
medium
{ "lang": "python", "repo": "adityatanwar800/FSDP2019", "path": "/Day23/tshirts.py", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|> def test_delete_image_by_wrong_tag(self, test_image): """ Only images with the matching tag are deleted if one is specified """ tag = f"{TEST_IMAGE_NAME}:wrong_tag" assert image_exists(TEST_IMAGE_NAME) assert not delete_image(tag, force=True) ass...
code_fim
hard
{ "lang": "python", "repo": "kreneskyp/ixian-docker", "path": "/ixian_docker/tests/modules/docker/utils/test_images.py", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|>class TestPull: """ Tests for pulling image from registry """ def test_pull(self, mock_docker_environment, snapshot, capsys): """ Test a successful push """ mock_client = mock_docker_environment pull_image(TEST_IMAGE_NAME) mock_client.api.pu...
code_fim
hard
{ "lang": "python", "repo": "kreneskyp/ixian-docker", "path": "/ixian_docker/tests/modules/docker/utils/test_images.py", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_prefix|># repo: kreneskyp/ixian-docker path: /ixian_docker/tests/modules/docker/utils/test_images.py # Copyright [2018-2020] Peter Krenesky # # Licensed 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...
code_fim
hard
{ "lang": "python", "repo": "kreneskyp/ixian-docker", "path": "/ixian_docker/tests/modules/docker/utils/test_images.py", "mode": "psm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_prefix|># repo: MarsStirner/sobiralka path: /int_service/lib/clients/abstract.py # -*- coding: utf-8 -*- from abc import ABCMeta, abstractmethod, abstractproperty class AbstractClient(object): <|fim_suffix|> pass @abstractmethod def enqueue(self): pass<|fim_middle|> __metaclass__ = A...
code_fim
hard
{ "lang": "python", "repo": "MarsStirner/sobiralka", "path": "/int_service/lib/clients/abstract.py", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|> @abstractmethod def getPatientQueue(self): pass @abstractmethod def getPatientInfo(self): pass @abstractmethod def getWorkTimeAndStatus(self): pass @abstractmethod def getWorkTimeAndStatus(self): pass @abstractmethod def enqueue(s...
code_fim
medium
{ "lang": "python", "repo": "MarsStirner/sobiralka", "path": "/int_service/lib/clients/abstract.py", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|> pass @abstractmethod def enqueue(self): pass<|fim_prefix|># repo: MarsStirner/sobiralka path: /int_service/lib/clients/abstract.py # -*- coding: utf-8 -*- from abc import ABCMeta, abstractmethod, abstractproperty class AbstractClient(object): __metaclass__ = ABCMeta @a...
code_fim
medium
{ "lang": "python", "repo": "MarsStirner/sobiralka", "path": "/int_service/lib/clients/abstract.py", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|># repo: tmu-nlp/100knock2017 path: /kurosawa/chapter02/knock11.py f = open('hightemp.txt','r') f1 = open('<|fim_suffix|>close() # cat hightemp.txt | tr '\t' ' '<|fim_middle|>hightemp1.txt','w') for line in f: f1.write(line.expandtabs(1)) f.close() f1.
code_fim
medium
{ "lang": "python", "repo": "tmu-nlp/100knock2017", "path": "/kurosawa/chapter02/knock11.py", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|>.write(line.expandtabs(1)) f.close() f1.close() # cat hightemp.txt | tr '\t' ' '<|fim_prefix|># repo: tmu-nlp/100knock2017 path: /kurosawa/chapter02/knock11.py f = open('hightemp.txt','r') f1 = open('<|fim_middle|>hightemp1.txt','w') for line in f: f1
code_fim
easy
{ "lang": "python", "repo": "tmu-nlp/100knock2017", "path": "/kurosawa/chapter02/knock11.py", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|># repo: sailor008/util_tool_excel path: /common_module/common_main.py # -*- coding: utf-8 -*- # from utils import FileUtil <|fim_suffix|> import sys import os current_folder_path = os.path.dirname(os.path.abspath(__file__)) sys.path.append(current_folder_path+'/utils')<|fim_middle|> # fileNameLis...
code_fim
hard
{ "lang": "python", "repo": "sailor008/util_tool_excel", "path": "/common_module/common_main.py", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|> import sys import os current_folder_path = os.path.dirname(os.path.abspath(__file__)) sys.path.append(current_folder_path+'/utils')<|fim_prefix|># repo: sailor008/util_tool_excel path: /common_module/common_main.py # -*- coding: utf-8 -*- # from utils import FileUtil <|fim_middle|># fileNameLi...
code_fim
hard
{ "lang": "python", "repo": "sailor008/util_tool_excel", "path": "/common_module/common_main.py", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|># repo: batxes/exocyst_scripts path: /output_exocyst/optimized_23424_notags.py import _surface import chimera try: import chimera.runCommand except: pass from VolumePath import markerset as ms try: from VolumePath import Marker_Set, Link new_marker_set=Marker_Set except: from VolumePath import ...
code_fim
hard
{ "lang": "python", "repo": "batxes/exocyst_scripts", "path": "/output_exocyst/optimized_23424_notags.py", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|> marker_sets: s=new_marker_set('Sec15_3') marker_sets["Sec15_3"]=s s= marker_sets["Sec15_3"] mark=s.place_marker((355.443, 475.787, 389.417), (0.97, 0.51, 0.75), 2) if "Sec15_4" not in marker_sets: s=new_marker_set('Sec15_4') marker_sets["Sec15_4"]=s s= marker_sets["Sec15_4"] mark=s.place_marker((...
code_fim
hard
{ "lang": "python", "repo": "batxes/exocyst_scripts", "path": "/output_exocyst/optimized_23424_notags.py", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|># repo: amiravni/Bowling-Project path: /hardware/cameras/usb_camera.py import time import io import cv2 from threading import Thread, Lock from thread import start_new_thread camera = None current_photo = None current_photo_lock = Lock() def init(res,shutter_speed): global camera exposure_tim...
code_fim
hard
{ "lang": "python", "repo": "amiravni/Bowling-Project", "path": "/hardware/cameras/usb_camera.py", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|>def capture_image_sequence_time(time_sec): global camera if camera is None: return frames = int(20*time_sec) for i in range(0,frames): capture_image( 'images%03d.jpg' % i)<|fim_prefix|># repo: amiravni/Bowling-Project path: /hardware/cameras/usb_camera.py import tim...
code_fim
hard
{ "lang": "python", "repo": "amiravni/Bowling-Project", "path": "/hardware/cameras/usb_camera.py", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|># repo: AhmedNusayer/Problem-Solving-Python- path: /Candies and Two Sisters.py # -*- coding: utf-8 -*- """ Created on Wed Apr 15 02:49:31 2020 @author: User """ #Candies and two sisters ''' import math t = int(input()) ans = [] for i in range(t):<|fim_suffix|> mid = math.ceil(n/2) ...
code_fim
medium
{ "lang": "python", "repo": "AhmedNusayer/Problem-Solving-Python-", "path": "/Candies and Two Sisters.py", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|> mid = math.ceil(n/2) ans.append(n-mid) for j in range(t): print(ans[j])<|fim_prefix|># repo: AhmedNusayer/Problem-Solving-Python- path: /Candies and Two Sisters.py # -*- coding: utf-8 -*- """ Created on Wed Apr 15 02:49:31 2020 @author: User """ #Candies and two sisters ''' im...
code_fim
medium
{ "lang": "python", "repo": "AhmedNusayer/Problem-Solving-Python-", "path": "/Candies and Two Sisters.py", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|> def get_address(self, instance): if instance.address: return AddressReadSerializer(instance.address).data return None def get_logo(self, instance): if instance.logo: return { "id62": base62_encode(instance.logo_id), ...
code_fim
hard
{ "lang": "python", "repo": "edgrmaulana/FinX", "path": "/api/company/serializers/company.py", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|># repo: edgrmaulana/FinX path: /api/company/serializers/company.py from rest_framework import serializers from core.structures.company.models import Company from enterprise.libs.base62 import base62_decode, base62_encode from enterprise.libs.rest_module.exception import ErrorValidationException from ent...
code_fim
medium
{ "lang": "python", "repo": "edgrmaulana/FinX", "path": "/api/company/serializers/company.py", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|> class Meta: model = Company fields = ( "display_name", "business_type", "address", "description", "website", "logo", )<|fim_prefix|># repo: edgrmaulana/FinX path: /api/company/serializers/company.py from r...
code_fim
hard
{ "lang": "python", "repo": "edgrmaulana/FinX", "path": "/api/company/serializers/company.py", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|> snapshot = load_snapshot_to_dict(sc._archive_dest.with_suffix('.zip')) e1_key = ('events', 'executions', 'e1') e2_key = ('events', 'executions', 'e2') e1_events = snapshot['tenants']['tenant1'][e1_key] e2_events = snapshot['tenants']['tenant1'][e2_key] asse...
code_fim
hard
{ "lang": "python", "repo": "cloudify-cosmo/cloudify-manager", "path": "/mgmtworker/cloudify_system_workflows/tests/snapshots/test_create.py", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_prefix|># repo: itsolutionscorp/AutoStyle-Clustering path: /all_data/exercism_data/python/difference-of-squares/b7a332ccdd9a40878b32dc868f48a396.py """from difference_of_squares import difference, square_of_sum, sum_of_squares <|fim_suffix|>def square_of_sum(i): """ square the sum """ return sum([j for ...
code_fim
hard
{ "lang": "python", "repo": "itsolutionscorp/AutoStyle-Clustering", "path": "/all_data/exercism_data/python/difference-of-squares/b7a332ccdd9a40878b32dc868f48a396.py", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|> """ calculate the difference """ return square_of_sum(i) - sum_of_squares(i) def sum_of_squares(i): """ sum of squares """ return sum([j**2 for j in range(1, i+1)]) def square_of_sum(i): """ square the sum """ return sum([j for j in range(1, i+1)])**2<|fim_prefix|># repo: itsol...
code_fim
easy
{ "lang": "python", "repo": "itsolutionscorp/AutoStyle-Clustering", "path": "/all_data/exercism_data/python/difference-of-squares/b7a332ccdd9a40878b32dc868f48a396.py", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|>dom.choice(PATTERNS) row = np.random.choice(np.arange(size)) col = np.random.choice(np.arange(size)) pattern.add_to(board, row, col) gol = GOL(board) gol.add_random_cells(coverage=0.3) run(gol)<|fim_prefix|># repo: amansinclair/gol path: /example.py if __name__ == "__m...
code_fim
medium
{ "lang": "python", "repo": "amansinclair/gol", "path": "/example.py", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|># repo: amansinclair/gol path: /example.py if __name__ == "__main__": from gol import run, GOL, PATTERNS import numpy as np size = 100 n_patterns = 20 board = np.zeros((size, size), dtype="int") for i in range(n_patterns): pattern = np.ran<|fim_suffix|>)) pattern....
code_fim
medium
{ "lang": "python", "repo": "amansinclair/gol", "path": "/example.py", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|> result_output = 'Case #%d: %s\n' % (case, result) print(result_output) f_out.write(result_output)<|fim_prefix|># repo: andy1li/codejam path: /2017/Qualification/A. Oversized Pancake Flipper/2017-q-a.py # 2017 Qualification Round - A. Oversized Pancake Flipper # https://code.google...
code_fim
hard
{ "lang": "python", "repo": "andy1li/codejam", "path": "/2017/Qualification/A. Oversized Pancake Flipper/2017-q-a.py", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|># repo: andy1li/codejam path: /2017/Qualification/A. Oversized Pancake Flipper/2017-q-a.py # 2017 Qualification Round - A. Oversized Pancake Flipper # https://code.google.com/codejam/contest/3264486/dashboard#s=p0 <|fim_suffix|>file = 'sample' with open(file+'.in') as f_in, open(file+'.out', 'w') as f_o...
code_fim
hard
{ "lang": "python", "repo": "andy1li/codejam", "path": "/2017/Qualification/A. Oversized Pancake Flipper/2017-q-a.py", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|> else: dif = val-mtValue newVal = mtValue+(dif*mult) self.microTransformValues["%s_%s"%(nodeName, attrName)] = newVal #xyz inverse val = cmds.getAttr("%s.%s"%(nodeN...
code_fim
hard
{ "lang": "python", "repo": "italic-r/maya-prefs", "path": "/scripts/aTools/animTools/animBar/subUIs/specialTools_subUIs/microTransform.py", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|> #print "microTransform is ON." else: cmds.manipRotateContext('Rotate', edit=True, mode=self.rotationOrientMode) self.removeMicroTransform() #print "microTransform is OFF." def changedMicroTransform(self...
code_fim
hard
{ "lang": "python", "repo": "italic-r/maya-prefs", "path": "/scripts/aTools/animTools/animBar/subUIs/specialTools_subUIs/microTransform.py", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|># repo: italic-r/maya-prefs path: /scripts/aTools/animTools/animBar/subUIs/specialTools_subUIs/microTransform.py ''' ======================================================================================================================== Author: Alan Camilo www.alancamilo.com Requirements: aTools Packag...
code_fim
hard
{ "lang": "python", "repo": "italic-r/maya-prefs", "path": "/scripts/aTools/animTools/animBar/subUIs/specialTools_subUIs/microTransform.py", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|># repo: maehler/Synergy path: /src/python/export_network.py import sys import argparse import networkx as nx import json import urllib2 from matplotlib import pyplot as plt from matplotlib.colors import ColorConverter from collections import defaultdict def as_network(d): G = nx.Graph() for n in d['no...
code_fim
hard
{ "lang": "python", "repo": "maehler/Synergy", "path": "/src/python/export_network.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|>def main(): args = parse_args() network = json.loads(urllib2.unquote(args.json.encode('utf8'))) G = as_network(network) if args.type == 'gml': nx.write_gml(G, sys.stdout) elif args.type == 'png' or args.type == 'pdf': ax = plt.axes(frameon=False) ax.get_yaxis().set_visible(False) ax.get_xa...
code_fim
hard
{ "lang": "python", "repo": "maehler/Synergy", "path": "/src/python/export_network.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|>def get_edge_widths(G): w = [] for e in G.edges(data=True): w.append(e[2]['graphics']['width']) wmax = max(w) wmin = min(w) return [x * (2 - 0.1) / (wmax - wmin) for x in w] def get_node_types(G): color = '#AAAAAA' basket_color = '#219D1A' types = defaultdict(list) for n in G.nodes(data=True):...
code_fim
hard
{ "lang": "python", "repo": "maehler/Synergy", "path": "/src/python/export_network.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> result = 0 for element in valueList: result = Addition.sum(result, element) return result<|fim_prefix|># repo: HGNJIT/statsCalculator path: /MathOperations/addition.py class Addition: @staticmethod def sum(augend,addend=None): if isinstance(augend,list...
code_fim
easy
{ "lang": "python", "repo": "HGNJIT/statsCalculator", "path": "/MathOperations/addition.py", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|># repo: HGNJIT/statsCalculator path: /MathOperations/addition.py class Addition: @staticmethod def sum(augend,addend=None): <|fim_suffix|> @staticmethod def sumList (valueList): result = 0 for element in valueList: result = Addition.sum(result, element) ...
code_fim
medium
{ "lang": "python", "repo": "HGNJIT/statsCalculator", "path": "/MathOperations/addition.py", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|> S = (s-Fluid['swc'])/(1.0-Fluid['swc']-Fluid['sor']) Mw = S/Fluid['vw'] Mo = 1.0-S/Fluid['vo'] dMw = 1.0/(Fluid['vw']*(1.0-Fluid['swc']-Fluid['sor'])) dMo = -1.0/(Fluid['vo']*(1.0-Fluid['swc']-Fluid['sor'])) return Mw, Mo, dMw, dMo<|fim_prefix|># repo: chanshing/python_msfv path:...
code_fim
hard
{ "lang": "python", "repo": "chanshing/python_msfv", "path": "/relperm_tracer.py", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|># repo: chanshing/python_msfv path: /relperm_tracer.py from __future__ import division import numpy as np def relperm(s, Fluid): # Return Mw, Mo, dMw, dMo <|fim_suffix|> S = (s-Fluid['swc'])/(1.0-Fluid['swc']-Fluid['sor']) Mw = S/Fluid['vw'] Mo = 1.0-S/Fluid['vo'] dMw = 1.0/(Fluid['vw'...
code_fim
hard
{ "lang": "python", "repo": "chanshing/python_msfv", "path": "/relperm_tracer.py", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|># repo: MrHamdulay/csc3-capstone path: /examples/data/Assignment_6/glbnik001/question1.py def namelist(): #This first set of instructions formulates the list to be aligned y = [] x = input ("Enter strings (end with DONE):\n") if x == str("DONE"): s=2 else: y.ap...
code_fim
hard
{ "lang": "python", "repo": "MrHamdulay/csc3-capstone", "path": "/examples/data/Assignment_6/glbnik001/question1.py", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|> # This prints the list right-aligned space = 0 print ("") print ("Right-aligned list:") for word in y: space = start - len(word) print (" "*space, word,sep="") namelist()<|fim_prefix|># repo: MrHamdulay/csc3-capstone path: /examples/data/Assignment_6/g...
code_fim
hard
{ "lang": "python", "repo": "MrHamdulay/csc3-capstone", "path": "/examples/data/Assignment_6/glbnik001/question1.py", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|> def __sub__(self, rhs): assert isinstance(rhs, PoissonHist) assert self.nbins == rhs.nbins result = PoissonHist() result.data = self.data - rhs.data result.bins = self.bins result.errors = np.sqrt(self.errors**2 + rhs.errors**2) return result ...
code_fim
hard
{ "lang": "python", "repo": "VitalyVorobyev/jpsipipi-lineshape", "path": "/py/phist.py", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|> def __add__(self, rhs): assert isinstance(rhs, PoissonHist) assert self.nbins == rhs.nbins result = PoissonHist() result.data = self.data + rhs.data result.bins = self.bins result.errors = np.sqrt(self.errors**2 + rhs.errors**2) return result ...
code_fim
hard
{ "lang": "python", "repo": "VitalyVorobyev/jpsipipi-lineshape", "path": "/py/phist.py", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|># repo: VitalyVorobyev/jpsipipi-lineshape path: /py/phist.py import numpy as np import typing class PoissonHist: """ Binned data with symmetric Poisson error bars """ def __init__(self, data:typing.Iterable=None, lo=None, hi=None, nbins=100, dens=False, wght=None): if data is not None: ...
code_fim
hard
{ "lang": "python", "repo": "VitalyVorobyev/jpsipipi-lineshape", "path": "/py/phist.py", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|> Peso da caixa: ' )) soma += p print ' O peso total da carga �:',soma<|fim_prefix|># repo: Buorn/FDC path: /Lista 3/L3_EX_5.py # -*- coding: cp1252 -*- #UNIVERSIDADE DO ESTADO DO RIO DE JANEIRO - UERJ <|fim_middle|> #BRUNO BANDEIRA BRAND�O #LISTA 3: FUNDAMENTOS DA COMPURA��O 2018/2 #EXERC�CIO 5 ...
code_fim
medium
{ "lang": "python", "repo": "Buorn/FDC", "path": "/Lista 3/L3_EX_5.py", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|># repo: Buorn/FDC path: /Lista 3/L3_EX_5.py # -*- coding: cp1252 -*- #UNIVERSIDADE DO ESTADO DO RIO DE JANEIRO - UERJ <|fim_suffix|>C�CIO 5 soma = 0 for i in range (1, 26): p = float (input ('Digite o Peso da caixa: ' )) soma += p print ' O peso total da carga �:',soma<|fim_middle|> #BRUNO ...
code_fim
medium
{ "lang": "python", "repo": "Buorn/FDC", "path": "/Lista 3/L3_EX_5.py", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|># repo: Znerual/FastLogin path: /configuration.py import xml.etree.ElementTree as ET class Configuration: def __init__(self): self.tree = ET.parse('config.xml') self.root = self.tree.getroot() <|fim_suffix|> courseList = self.root.findall('course') for entry in course...
code_fim
hard
{ "lang": "python", "repo": "Znerual/FastLogin", "path": "/configuration.py", "mode": "psm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|> courseList = self.root.findall('course') for entry in courseList: if (entry.find('startDate') == date): return int(entry.find('id').text), (entry.find('startDate').text), entry.find('gotPlace').text == 1<|fim_prefix|># repo: Znerual/FastLogin path: /configurati...
code_fim
hard
{ "lang": "python", "repo": "Znerual/FastLogin", "path": "/configuration.py", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|> visited[i+1] = 1 elif x[i] == "S": s += 1 elif x[i] == "T" and s: ans += 2 s -= 1 print(len(x)-ans)<|fim_prefix|># repo: Aasthaengg/IBMdataset path: /Python_codes/p03986/s166996388.py x = input() visited = [0]*(len(x)) ans = 0 s = 0 t = 0 for i i...
code_fim
medium
{ "lang": "python", "repo": "Aasthaengg/IBMdataset", "path": "/Python_codes/p03986/s166996388.py", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|># repo: Aasthaengg/IBMdataset path: /Python_codes/p03986/s166996388.py x = input() visited = [0]*(len(x)) ans = 0 s = 0 t = 0 for i in range(len(x)):<|fim_suffix|> visited[i+1] = 1 elif x[i] == "S": s += 1 elif x[i] == "T" and s: ans += 2 s -= 1 p...
code_fim
medium
{ "lang": "python", "repo": "Aasthaengg/IBMdataset", "path": "/Python_codes/p03986/s166996388.py", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|>me']) print(familiar_person['age']) print(familiar_person['city'])<|fim_prefix|># repo: wy471x/learningNote path: /python/excise/basic/chapter6/6-1.py #!/usr/bin/env python # coding=utf-8 familiar_person = {'first_name':'Kobe','last_name':'Bryant','age':31,'city':'Los Angeles'} pr<|fim_middle|>int(famili...
code_fim
medium
{ "lang": "python", "repo": "wy471x/learningNote", "path": "/python/excise/basic/chapter6/6-1.py", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|># repo: wy471x/learningNote path: /python/excise/basic/chapter6/6-1.py #!/usr/bin/env python # coding=utf-8 familiar_person = {'first_na<|fim_suffix|>me']) print(familiar_person['age']) print(familiar_person['city'])<|fim_middle|>me':'Kobe','last_name':'Bryant','age':31,'city':'Los Angeles'} print(famili...
code_fim
medium
{ "lang": "python", "repo": "wy471x/learningNote", "path": "/python/excise/basic/chapter6/6-1.py", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|>int(familiar_person['first_name']) print(familiar_person['last_name']) print(familiar_person['age']) print(familiar_person['city'])<|fim_prefix|># repo: wy471x/learningNote path: /python/excise/basic/chapter6/6-1.py #!/usr/bin/env python # coding=utf-8 familiar_person = {'first_na<|fim_middle|>me':'Kobe'...
code_fim
medium
{ "lang": "python", "repo": "wy471x/learningNote", "path": "/python/excise/basic/chapter6/6-1.py", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|># repo: Lin0l53/py4e path: /EX9/ex9.5.py #partner was Logan Zipp fname = "mbox-short.txt" handle = open(fname) counter = dict() for line in handle : if line.startswith("From:") : line = line.rstrip() print (line) words = line.split() sender = words[1] pos = sender.find("@") emai...
code_fim
easy
{ "lang": "python", "repo": "Lin0l53/py4e", "path": "/EX9/ex9.5.py", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|>#print(word,max) #print (words) #print (sender) #print (counter)<|fim_prefix|># repo: Lin0l53/py4e path: /EX9/ex9.5.py #partner was Logan Zipp fname = "mbox-short.txt" handle = open(fname) counter = dict() for line in handle : if line.startswith("From:") : line = line.rstrip() print (lin...
code_fim
easy
{ "lang": "python", "repo": "Lin0l53/py4e", "path": "/EX9/ex9.5.py", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|># repo: eric220/Wave_Height path: /image_work.py import numpy as np import glob from keras.preprocessing import image #input string img_path, returns tensors list of 6 slices of image def get_tensors(file_name): #tensor_stack = [] img = image.load_img(file_name<|fim_suffix|>list_of_tensors.appen...
code_fim
hard
{ "lang": "python", "repo": "eric220/Wave_Height", "path": "/image_work.py", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|>list_of_tensors.append(np.expand_dims(img_slice, axis=0).astype('float32')/255) #tensor_stack.append(np.vstack(list_of_tensors)) #tensor_stack = np.array(tensor_stack).reshape(1,6,224,224,3) return tensor_stack<|fim_prefix|># repo: eric220/Wave_Height path: /image_work.py import numpy as np i...
code_fim
hard
{ "lang": "python", "repo": "eric220/Wave_Height", "path": "/image_work.py", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|># repo: lichguard/APR path: /documents/topdoc.py from collections import defaultdict import operator from documents.scoretype import ScoreType <|fim_suffix|> self.scores[score_type] = score def calculate_score(self): self.score = 0 self.score += self.scores[ScoreType.tf_idf] ...
code_fim
hard
{ "lang": "python", "repo": "lichguard/APR", "path": "/documents/topdoc.py", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|> def __repr__(self): return "\n" + str(self) def display(self): return sorted(self.scores.items(), key=operator.itemgetter(1), reverse=True)<|fim_prefix|># repo: lichguard/APR path: /documents/topdoc.py from collections import defaultdict import operator from documents.scoretype i...
code_fim
hard
{ "lang": "python", "repo": "lichguard/APR", "path": "/documents/topdoc.py", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|># repo: gabriellaec/desoft-analise-exercicios path: /backup/user_088/ch20_2020_09_11_21_07_12_160901.py distancia=float(input('digite a distancia')) if (d<|fim_suffix|>ia)*0,45 print('o preco é R${0:.2f}'.format(preco))<|fim_middle|>istancia<200): preco=0,5*(distancia) print ('o preco é R${0:.2f}'.format...
code_fim
medium
{ "lang": "python", "repo": "gabriellaec/desoft-analise-exercicios", "path": "/backup/user_088/ch20_2020_09_11_21_07_12_160901.py", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|>ia)*0,45 print('o preco é R${0:.2f}'.format(preco))<|fim_prefix|># repo: gabriellaec/desoft-analise-exercicios path: /backup/user_088/ch20_2020_09_11_21_07_12_160901.py distancia=float(input('digite a distancia')) if (d<|fim_middle|>istancia<200): preco=0,5*(distancia) print ('o preco é R${0:.2f}'.format...
code_fim
medium
{ "lang": "python", "repo": "gabriellaec/desoft-analise-exercicios", "path": "/backup/user_088/ch20_2020_09_11_21_07_12_160901.py", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|>#------------------------------------------------------------- # cache initialisation #------------------------------------------------------------- domoWebDataCache.domoWebDataCacheInit(config, logger, debugFlags) #------------------------------------------------------------- # Task management init #---...
code_fim
hard
{ "lang": "python", "repo": "Manu-31/domoweb", "path": "/domoweb.py", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|># repo: Manu-31/domoweb path: /domoweb.py #!/usr/bin/python # -*- coding: utf-8 -*- #============================================================= #============================================================= # Some imports #============================================================= import os import...
code_fim
hard
{ "lang": "python", "repo": "Manu-31/domoweb", "path": "/domoweb.py", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|> slow -= 0.4*slow fast -= 0.3*fast print year, slow, fast if(fast>=slow): print year<|fim_prefix|># repo: sharanyaa/coursera_python path: /6/slow_fast_population.py slow = 1000 fast = 1 year = 1 while fast < slow: <|fim_middle|> slow += slow fast += fast year += 1
code_fim
easy
{ "lang": "python", "repo": "sharanyaa/coursera_python", "path": "/6/slow_fast_population.py", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|># repo: sharanyaa/coursera_python path: /6/slow_fast_population.py slow = 1000 fast = 1 year = 1 while fast < slow: <|fim_suffix|>t year, slow, fast if(fast>=slow): print year<|fim_middle|> slow += slow fast += fast year += 1 slow -= 0.4*slow fast -= 0.3*fast prin
code_fim
medium
{ "lang": "python", "repo": "sharanyaa/coursera_python", "path": "/6/slow_fast_population.py", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|> """rank 1""" _, pred = torch.max(output, 1) total += label.size(0) acc_top1 += (pred == label).sum().item() """rank 5""" _, rank5 = output.topk(5, 1, True, True) rank5 = rank5.t() ...
code_fim
hard
{ "lang": "python", "repo": "nicotina04/kmu-autonomous2021-20171717", "path": "/hw2/compare_pretrained.py", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|> model_label = [ 'alexNet Top-1', 'alexNet Top-5', 'VGG16 Top-1', 'VGG16 Top-5', 'googLeNet Top-1', 'googLeNet Top-5', 'resnet18 Top-1', 'resnet18 Top-5' ] fig, ax = plt.subplots() ax.barh(model_label, eval_output, height=0.6,...
code_fim
hard
{ "lang": "python", "repo": "nicotina04/kmu-autonomous2021-20171717", "path": "/hw2/compare_pretrained.py", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|># repo: nicotina04/kmu-autonomous2021-20171717 path: /hw2/compare_pretrained.py """ Homework target model AlexNet GoogLeNet vgg16 resnet18 Must need ILSVRC2012 Validation set for evaluation """ import torch import torchvision from torchvision import transforms from torch.utils.data import DataLoader imp...
code_fim
hard
{ "lang": "python", "repo": "nicotina04/kmu-autonomous2021-20171717", "path": "/hw2/compare_pretrained.py", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|> R2 = cross_val_score(model, X_train, y_train).mean() MSE = abs(cross_val_score(model, X_train, y_train, scoring = 'neg_mean_squared_error').mean()) return R2, MSE<|fim_prefix|># repo: tibrado/case-study-driver-churn-rate path: /src/models.py import pandas as pd import numpy as np from sklear...
code_fim
hard
{ "lang": "python", "repo": "tibrado/case-study-driver-churn-rate", "path": "/src/models.py", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }