text
stringlengths
232
16.3k
domain
stringclasses
1 value
difficulty
stringclasses
3 values
meta
dict
<|fim_suffix|> self.fit_result = minimize(self.residuals_wrapper, self.parameters, args = (x, data, weights), kws = kwargs) logging.info('Fit Result') logging.info('==========') return self.fit_result def get_opt_parameters(self): if self.fit_result is None: rais...
code_fim
hard
{ "lang": "python", "repo": "jamesbate/phd_code", "path": "/code/lib/FitTemplate.py", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|># repo: lucascantos/weather-alerts-crud path: /src/schemas/schemas.py user_schema = { 'id': { 'type': 'string', 'required': True, 'coerce': (str, lambda x: x.lower()) }, 'latitude':{ 'type': 'float', 'required': True, 'min': -60.0, 'm...
code_fim
hard
{ "lang": "python", "repo": "lucascantos/weather-alerts-crud", "path": "/src/schemas/schemas.py", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|># Schema of AWS event event_schema = { 'pathParameters':{ 'type': 'dict', 'default': {}, 'schema':{ 'uid':{ 'type': 'string', 'required': True, }, } } }<|fim_prefix|># repo: lucascantos/weather-alerts-crud pat...
code_fim
hard
{ "lang": "python", "repo": "lucascantos/weather-alerts-crud", "path": "/src/schemas/schemas.py", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|> updater = training.StandardUpdater(self.train_iter, opt, device=gpu) self.trainer = training.Trainer(updater, (n_epoch, 'epoch'), out=out_dir) self.trainer.extend(extensions.Evaluator(self.test_iter, self.model, device=gpu)) self.trainer.extend(extensions.dump_graph('main/l...
code_fim
hard
{ "lang": "python", "repo": "trtd56/NlpUtil", "path": "/old/trainer.py", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|># repo: trtd56/NlpUtil path: /old/trainer.py # -*- coding: utf-8 -*- import chainer.links as L import chainer.functions as F from chainer import optimizer, optimizers, training, iterators from chainer.training import extensions from chainer.datasets import tuple_dataset class SoftMaxTrainer(): def...
code_fim
hard
{ "lang": "python", "repo": "trtd56/NlpUtil", "path": "/old/trainer.py", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|>err_u = df['cModelMagErr_u'].values err_g = df['cModelMagErr_g'].values err_r = df['cModelMagErr_r'].values err_i = df['cModelMagErr_i'].values err_z = df['cModelMagErr_z'].values dered_u = mod_u - ext_u dered_g = mod_g - ext_g dered_r = mod_r - ext_r dered_i = mod_i - ext_i dered_z = mod_z - ext_z b =...
code_fim
hard
{ "lang": "python", "repo": "patogallardo/iskay", "path": "/misc/kcorrection/lups2maggies.py", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|># repo: patogallardo/iskay path: /misc/kcorrection/lups2maggies.py ''' Converts luptitudes to maggies and stores in folder output Written by P. Gallardo ''' import numpy as np import pandas as pd import sys assert len(sys.argv) == 2 # usage: lups2maggies.py /path/to/cat.csv fname = sys.argv[1] <|f...
code_fim
hard
{ "lang": "python", "repo": "patogallardo/iskay", "path": "/misc/kcorrection/lups2maggies.py", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|># repo: fleapx/python-learning path: /base/get-starting/call_func.py # -*- coding: utf-8 -*- # author : rovo98 # date: 2018.3.19 <|fim_suffix|>print(hex(n1)) print(hex(n2)) print(abs(-119999))<|fim_middle|> # this is a demo for test calling functions. n1 = 255 n2 = 1000
code_fim
medium
{ "lang": "python", "repo": "fleapx/python-learning", "path": "/base/get-starting/call_func.py", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|>print(hex(n1)) print(hex(n2)) print(abs(-119999))<|fim_prefix|># repo: fleapx/python-learning path: /base/get-starting/call_func.py # -*- coding: utf-8 -*- # author : rovo98 # date: 2018.3.19 <|fim_middle|> # this is a demo for test calling functions. n1 = 255 n2 = 1000
code_fim
medium
{ "lang": "python", "repo": "fleapx/python-learning", "path": "/base/get-starting/call_func.py", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|> def compute_f2(output, target): true_and_pred = target * output ttp_sum = torch.sum(true_and_pred, 1) tpred_sum = torch.sum(output, 1) ttrue_sum = torch.sum(target, 1) tprecision = ttp_sum / tpred_sum trecall = ttp_sum / ttrue_sum f2 = ((1 + 4) * tprecision * trecall) / (4 *...
code_fim
hard
{ "lang": "python", "repo": "chinmay5/deepLearningProject", "path": "/planet/boilerplate.py", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|>def train(train_loader, model, criterion, optimizer, epoch, is_multi_fc=False): batch_time = AverageMeter() data_time = AverageMeter() losses = AverageMeter() predictions = AverageMeter() # switch to train mode model.train() end = time.time() for i, (input, target) in enu...
code_fim
hard
{ "lang": "python", "repo": "chinmay5/deepLearningProject", "path": "/planet/boilerplate.py", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|># repo: chinmay5/deepLearningProject path: /planet/boilerplate.py #-*- coding: utf8 -*- #credits to https://github.com/pytorch/examples/blob/master/imagenet/main.py import shutil, time, logging import torch import torch.optim import numpy as np import visdom, copy from datetime import datetime from colle...
code_fim
hard
{ "lang": "python", "repo": "chinmay5/deepLearningProject", "path": "/planet/boilerplate.py", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|># repo: ita93/qca-hex-analyzer path: /qca_hex_analyzer/__main__.py age parsing. " \ "This subcommand is used to extract WMI control messages from the input. " wmi_ctrl_description = \ "Extracts WMI control message hexdata from an input (--input-file). " \ "The extracted messages will be prin...
code_fim
hard
{ "lang": "python", "repo": "ita93/qca-hex-analyzer", "path": "/qca_hex_analyzer/__main__.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> global parsed_args load_options() try: if parsed_args.input_file: infp = open(parsed_args.input_file, "r") else: infp = sys.stdin if parsed_args.output_file: outfp = open(parsed_args.output_file, "w") else: outfp ...
code_fim
hard
{ "lang": "python", "repo": "ita93/qca-hex-analyzer", "path": "/qca_hex_analyzer/__main__.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: ita93/qca-hex-analyzer path: /qca_hex_analyzer/__main__.py r HTC control message parsing. " \ "This subcommand is used to extract HTC control messages from the input. " htc_ctrl_description = \ "Extracts HTC control message hexdata from an input (--input-file). " \ "The extracted mes...
code_fim
hard
{ "lang": "python", "repo": "ita93/qca-hex-analyzer", "path": "/qca_hex_analyzer/__main__.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: B-Step62/pytorch-motiongan-open path: /core/datasets/matlab_to_bvh.py ### Script to convert matlab structure file (/motiongan/data/style-dataset/style_motion_database.mat') import os import sys sys.path.append(os.path.join(os.path.dirname(__file__), '..')) import argparse import math import numpy...
code_fim
hard
{ "lang": "python", "repo": "B-Step62/pytorch-motiongan-open", "path": "/core/datasets/matlab_to_bvh.py", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|> # Convert data to list of string frames = [] for i in range(joint_quarternions.shape[0]): # Root pos root_pos_i = root_pos[i] frame = '{0:.05f} {1:.05f} {2:.05f} '.format(*root_pos_i.tolist()) for j in range(joint_quarternions.shape...
code_fim
hard
{ "lang": "python", "repo": "B-Step62/pytorch-motiongan-open", "path": "/core/datasets/matlab_to_bvh.py", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|>def cleaning(sentences): words = [] for s in sentences: clean = re.sub(r'[^ a-z A-Z 0-9]', " ", s) w = nltk.word_tokenize(clean) # lemmatizing words.append([lemmatizer.lemmatize(i.lower()) for i in w]) return words def create_tokenizer(words, ...
code_fim
medium
{ "lang": "python", "repo": "utk61198/Amar-Ujala-Analytics-", "path": "/svoExtraction.py", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|> tuple_to_lists=list(tuple_data) return tuple_to_lists def displaySubjectVerbObject(tuples_to_lists): for item in tuples_to_lists: print(item) tuple_data=findTriplets(str) list=creatingLists(tuple_data) displaySubjectVerbObject(list)<|fim_prefix|># repo: utk61198/Amar-Ujala-Analytic...
code_fim
hard
{ "lang": "python", "repo": "utk61198/Amar-Ujala-Analytics-", "path": "/svoExtraction.py", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|># repo: utk61198/Amar-Ujala-Analytics- path: /svoExtraction.py import nltk import spacy import textacy from keras.layers import Embedding, Bidirectional, Dense, Dropout, BatchNormalization from keras_preprocessing.sequence import pad_sequences from keras_preprocessing.text import Tokenizer from nltk impo...
code_fim
medium
{ "lang": "python", "repo": "utk61198/Amar-Ujala-Analytics-", "path": "/svoExtraction.py", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|># repo: zhushaoquan/recommend-sys path: /deep_learning/utils/__init__.py #!/usr/bin/env python # -*- coding: utf-8 -*- # @Time : 2019/8/15 <|fim_suffix|>* from .logger import * from .metric import * from .input_fn import *<|fim_middle|>下午5:04 # @Author : Zessay from .ffm import * from .fm import * ...
code_fim
medium
{ "lang": "python", "repo": "zhushaoquan/recommend-sys", "path": "/deep_learning/utils/__init__.py", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|> .utils import * from .base_model import * from .base_trainer import * from .logger import * from .metric import * from .input_fn import *<|fim_prefix|># repo: zhushaoquan/recommend-sys path: /deep_learning/utils/__init__.py #!/usr/bin/env python # -*- coding: utf-8 -*- # @Time : 2019/8/15 <|fim_midd...
code_fim
medium
{ "lang": "python", "repo": "zhushaoquan/recommend-sys", "path": "/deep_learning/utils/__init__.py", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|>* from .logger import * from .metric import * from .input_fn import *<|fim_prefix|># repo: zhushaoquan/recommend-sys path: /deep_learning/utils/__init__.py #!/usr/bin/env python # -*- coding: utf-8 -*- # @Time : 2019/8/15 下午5:04 # @Author : Zessay from .ffm import * from .fm import * from<|fim_midd...
code_fim
medium
{ "lang": "python", "repo": "zhushaoquan/recommend-sys", "path": "/deep_learning/utils/__init__.py", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|> COLLECT = "x-stats-collect" # Param Dict Prefix class ParamDictPrefix: PostKey = "x-" # Used in http POST params from HTML forms<|fim_prefix|># repo: RxJellyBot/Jelly-Bot path: /JellyBot/keys.py # Cookies Keys class Cookies: USER_TOKEN = "utoken" <|fim_middle|> # Session Keys class Se...
code_fim
hard
{ "lang": "python", "repo": "RxJellyBot/Jelly-Bot", "path": "/JellyBot/keys.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: RxJellyBot/Jelly-Bot path: /JellyBot/keys.py # Cookies Keys class Cookies: USER_TOKEN = "utoken" <|fim_suffix|> USER_ROOT_ID = "x-root-id" class APIStatisticsCollection: API_ACTION = "x-stats-api-action" DICT_PARAMS = "x-stats-param-dict" DICT_RESPONSE = "x-s...
code_fim
easy
{ "lang": "python", "repo": "RxJellyBot/Jelly-Bot", "path": "/JellyBot/keys.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: loganriggs/zero_shot_learning path: /plot3d.py import matplotlib.pyplot as plt from mpl_toolkits.mplot3d import Axes3D import numpy as np <|fim_suffix|> fig = plt.figure(figure) ax = plt.axes(projection='3d') colors = ["r", "b", "y", "c", "m"] for i in range(numberOfClasses+1): ...
code_fim
medium
{ "lang": "python", "repo": "loganriggs/zero_shot_learning", "path": "/plot3d.py", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|> fig = plt.figure(figure) ax = plt.axes(projection='3d') colors = ["r", "b", "y", "c", "m"] for i in range(numberOfClasses+1): classLocation = np.argwhere(labels == i+minClass) ax.scatter3D(xValues[classLocation, 0], xValues[classLocation, 1], xValues[classLocation, 2]) #3D<...
code_fim
medium
{ "lang": "python", "repo": "loganriggs/zero_shot_learning", "path": "/plot3d.py", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|> print('Number of pairs: {}'.format(len(self._pairs))) if __name__ == '__main__': pairs = lfwdata()<|fim_prefix|># repo: Tushn/triplet path: /triplet/lfwdata.py import os import config as cfg import numpy as np class lfwdata(): def __init__(self): self._pairs = [] <|fim_middl...
code_fim
hard
{ "lang": "python", "repo": "Tushn/triplet", "path": "/triplet/lfwdata.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: Tushn/triplet path: /triplet/lfwdata.py import os import config as cfg import numpy as np class lfwdata(): def __init__(self): self._pairs = [] <|fim_suffix|> print('Number of pairs: {}'.format(len(self._pairs))) if __name__ == '__main__': pairs = lfwdata()<|fim_middl...
code_fim
hard
{ "lang": "python", "repo": "Tushn/triplet", "path": "/triplet/lfwdata.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: nicomateucci/tpSimulacion path: /colaSimpleMM1LIFO.py # Simulador de sistema M/M/1. # # Variables de respuesta: # - Demora promedio por cliente # - Número promedio de clientes en cola # - Utilización promedio de cliente # # Funciones: # arribo() # partida() # nuevoEvento() ...
code_fim
hard
{ "lang": "python", "repo": "nicomateucci/tpSimulacion", "path": "/colaSimpleMM1LIFO.py", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|> global reloj global proximoEvento global listaEventos if listaEventos[0] <= listaEventos[1]: reloj = listaEventos[0] proximoEvento = "ARRIBO" else: reloj = listaEventos[1] proximoEvento = "PARTIDA" #Inicio del programa principal #Tiempo de ...
code_fim
hard
{ "lang": "python", "repo": "nicomateucci/tpSimulacion", "path": "/colaSimpleMM1LIFO.py", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|>model = Sequential() model.add(Dense(5, input_dim=(len(X[0])))) model.add(Dense(32, activation="relu")) model.add(Dense(len(onehot_Y[0]), activation="softmax")) model.compile(loss="categorical_crossentropy", optimizer="adam", metrics=["accuracy"]) model.fit(X, onehot_Y, validation_split=0.33, epochs=1000)...
code_fim
hard
{ "lang": "python", "repo": "bjotho/Gynecological-cancer-multi-class-classification", "path": "/task_3/task3_Keras.py", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|># encode class values as integers encoder = LabelEncoder() encoder.fit(Y) encoded_Y = encoder.transform(Y) # convert integers to dummy variables (i.e. one-hot encoded) onehot_Y = np_utils.to_categorical(encoded_Y) model = Sequential() model.add(Dense(5, input_dim=(len(X[0])))) model.add(Dense(32, activat...
code_fim
medium
{ "lang": "python", "repo": "bjotho/Gynecological-cancer-multi-class-classification", "path": "/task_3/task3_Keras.py", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|># repo: bjotho/Gynecological-cancer-multi-class-classification path: /task_3/task3_Keras.py import pyreadstat import matplotlib.pyplot as plt import numpy as np from keras.models import Sequential from keras.layers import Dense from keras.utils import np_utils from sklearn.preprocessing import LabelEncod...
code_fim
medium
{ "lang": "python", "repo": "bjotho/Gynecological-cancer-multi-class-classification", "path": "/task_3/task3_Keras.py", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|># repo: k1nk33/NukeBox2000 path: /tests/test_nukeboxDB.py #!/usr/bin/env python # -*- coding: utf-8 -*- """ test_nukeboxQueue ---------------------------------- Tests for `nukebox2000` module. """ import sys import unittest from nukebox2000.MongoBox import NukeBoxDB class TestNukeBoxDB(unittest.Tes...
code_fim
hard
{ "lang": "python", "repo": "k1nk33/NukeBox2000", "path": "/tests/test_nukeboxDB.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> ''' B{Test 02} Tests User entry creation in the DB - createUser first checks if an matching entry already exists, updating the existing entry if it does - either way it returns the entries object id ''' nbdb = NukeBoxDB() us...
code_fim
hard
{ "lang": "python", "repo": "k1nk33/NukeBox2000", "path": "/tests/test_nukeboxDB.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: neoformit/primerdesign path: /design/forms.py """Primer3 input form. For details on input params see: https://primer3.org/manual.html#globalTags """ from django import forms from django.core.exceptions import ValidationError from .fasta import Fasta <|fim_suffix|>def validate_fasta(data): ...
code_fim
hard
{ "lang": "python", "repo": "neoformit/primerdesign", "path": "/design/forms.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> """Validate and return user input.""" data = self.cleaned_data data['fasta'] = Fasta.from_string(data['fasta']) validate_fasta(data) return data def validate_fasta(data): """Validate input sequence lengths.""" for sequence in data['fasta'].values(): ...
code_fim
medium
{ "lang": "python", "repo": "neoformit/primerdesign", "path": "/design/forms.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|>def validate_fasta(data): """Validate input sequence lengths.""" for sequence in data['fasta'].values(): print(f'Sequence length {len(sequence)} nt') if len(sequence) < data['amplicon_min']: raise ValidationError({'fasta': f'Input sequence must be longer...
code_fim
medium
{ "lang": "python", "repo": "neoformit/primerdesign", "path": "/design/forms.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: mtatum7/Robomath_Project path: /pca/create_final.py #! /usr/bin/env python # -*- coding: utf-8 -*- from __future__ import division import os from solid import * from solid.utils import * from shapes import * import sys # Assumes SolidPython is in site-packages or elsewhwere in sys.path from sol...
code_fim
hard
{ "lang": "python", "repo": "mtatum7/Robomath_Project", "path": "/pca/create_final.py", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|> f.closed print("Success") if __name__ == '__main__': out_dir = sys.argv[1] if len(sys.argv) > 1 else os.curdir file_out = os.path.join(out_dir, 'basic_geometry.scad') shape_list = basic_geometry() for i, shape in enumerate(shape_list): export(shape, "output" + str(i)) ...
code_fim
hard
{ "lang": "python", "repo": "mtatum7/Robomath_Project", "path": "/pca/create_final.py", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|>@coroutine def grep_python_coroutine(): g = grep('python') yield from g g = grep('python') #next(g) #g.send(None) g.send("php is better") g.send("python is simplier") g.close()<|fim_prefix|># repo: YevhenKhomenko/dive_into_python_coursera path: /week5/practice/coroutine.py def coroutine(func): def s...
code_fim
medium
{ "lang": "python", "repo": "YevhenKhomenko/dive_into_python_coursera", "path": "/week5/practice/coroutine.py", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|># repo: YevhenKhomenko/dive_into_python_coursera path: /week5/practice/coroutine.py def coroutine(func): def start_coroutine(*args, **kwargs): <|fim_suffix|>@coroutine def grep_python_coroutine(): g = grep('python') yield from g g = grep('python') #next(g) #g.send(None) g.send("php is better") g.sen...
code_fim
hard
{ "lang": "python", "repo": "YevhenKhomenko/dive_into_python_coursera", "path": "/week5/practice/coroutine.py", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|> g = grep('python') yield from g g = grep('python') #next(g) #g.send(None) g.send("php is better") g.send("python is simplier") g.close()<|fim_prefix|># repo: YevhenKhomenko/dive_into_python_coursera path: /week5/practice/coroutine.py def coroutine(func): def start_coroutine(*args, **kwargs): <|fim_m...
code_fim
hard
{ "lang": "python", "repo": "YevhenKhomenko/dive_into_python_coursera", "path": "/week5/practice/coroutine.py", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|># repo: katreashish120/ml-pipeline path: /temperature/databricks/train_temperature.py #!/usr/bin/env python # coding: utf-8 # In[ ]: import numpy as np import pickle from sklearn.model_selection import train_test_split from sklearn.metrics import mean_absolute_error from pyspark.sql.functions import s...
code_fim
hard
{ "lang": "python", "repo": "katreashish120/ml-pipeline", "path": "/temperature/databricks/train_temperature.py", "mode": "psm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|> # In[ ]: input_df = input_df.withColumn('Year_Month', concat(col('Year'), col('Month'))) cols = ['Year_Month','Day','Mean_Temperature'] input_df = input_df[cols] if test: display(input_df) # In[ ]: input_pivot_df = input_df.groupBy("Year_Month").pivot("Day").sum("Mean_Temperature") # In[ ]: ...
code_fim
hard
{ "lang": "python", "repo": "katreashish120/ml-pipeline", "path": "/temperature/databricks/train_temperature.py", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|>if test: print(dbutils.widgets.get("input_path")) print(dbutils.widgets.get("model_path")) if input_path == 'Not found': input_path = '/mnt/<mount-name>/<path>/temperature/data/*.csv' if model_path == 'Not found': model_path = '/dbfs/mnt/<mount-name>/<path>/temperature/model/temperature...
code_fim
hard
{ "lang": "python", "repo": "katreashish120/ml-pipeline", "path": "/temperature/databricks/train_temperature.py", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|>sha256", b"hallo", b"salt", 2) print(b) print(c)<|fim_prefix|># repo: rupali-adhikari/pythonprojecthashlib path: /saltingandit.py import hashlib a = hashlib.pbkdf2_hmac("sha256", b"hallo", b"salt", 1) b = hashlib.pbkdf2_hmac("s<|fim_middle|>ha256", a, b"salt", 1) c = hashlib.pbkdf2_hmac("
code_fim
easy
{ "lang": "python", "repo": "rupali-adhikari/pythonprojecthashlib", "path": "/saltingandit.py", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|># repo: rupali-adhikari/pythonprojecthashlib path: /saltingandit.py import hashlib a = hashlib.pbkdf2_hmac("sha256",<|fim_suffix|>ha256", a, b"salt", 1) c = hashlib.pbkdf2_hmac("sha256", b"hallo", b"salt", 2) print(b) print(c)<|fim_middle|> b"hallo", b"salt", 1) b = hashlib.pbkdf2_hmac("s
code_fim
easy
{ "lang": "python", "repo": "rupali-adhikari/pythonprojecthashlib", "path": "/saltingandit.py", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|> if reinterpreted_batch_ndims is None: reinterpreted_batch_ndims = len(self.batch_shape) base_dist = self.base_dist sample_shape = self.sample_shape reinterpreted_batch_ndims = self.reinterpreted_batch_ndims + reinterpreted_batch_ndims return ReshapedDist...
code_fim
hard
{ "lang": "python", "repo": "neerajprad/pyro", "path": "/pyro/distributions/torch_distribution.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: neerajprad/pyro path: /pyro/distributions/torch_distribution.py from __future__ import absolute_import, division, print_function import numbers import torch from torch.distributions import constraints from pyro.distributions.distribution import Distribution from pyro.distributions.score_parts ...
code_fim
hard
{ "lang": "python", "repo": "neerajprad/pyro", "path": "/pyro/distributions/torch_distribution.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> TorchDistributions provide a method ``.shape()`` for the tensor shape of samples:: x = d.sample(sample_shape) assert x.shape == d.shape(sample_shape) Pyro follows the same distribution shape semantics as PyTorch. It distinguishes between three different roles for tensor shapes of...
code_fim
hard
{ "lang": "python", "repo": "neerajprad/pyro", "path": "/pyro/distributions/torch_distribution.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: Wong-James/Python path: /week 1/day 3/Ninja.py from pet import Pet class Ninja: def __init__(self, first_name, last_name, treats, pet_food, pet): self.first_name = first_name self.last_name = last_name self.treats = treats self.pet_food = pet_food sel...
code_fim
medium
{ "lang": "python", "repo": "Wong-James/Python", "path": "/week 1/day 3/Ninja.py", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|>Fox = Pet("Ninetailed Fox", "Fox", "Fire-Breathing") Naruto = Ninja("Naruto", "Izumaki", "Rice Balls", "Ground Beef", Fox) Naruto.feed() print(Naruto.pet.energy) print(Naruto.pet.health) Naruto.bathe() Naruto.walk() print(Naruto.pet.energy) print(Naruto.pet.health)<|fim_prefix|># repo: Wong-James/Python...
code_fim
medium
{ "lang": "python", "repo": "Wong-James/Python", "path": "/week 1/day 3/Ninja.py", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|> def bathe(self): self.pet.noise() Fox = Pet("Ninetailed Fox", "Fox", "Fire-Breathing") Naruto = Ninja("Naruto", "Izumaki", "Rice Balls", "Ground Beef", Fox) Naruto.feed() print(Naruto.pet.energy) print(Naruto.pet.health) Naruto.bathe() Naruto.walk() print(Naruto.pet.energy) print(Naruto.p...
code_fim
medium
{ "lang": "python", "repo": "Wong-James/Python", "path": "/week 1/day 3/Ninja.py", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|># repo: rkBiswal/Python_Basics path: /More Review + More Linked Lists.py ## More Review + More Linked Lists ## ##Given a pointer to the head node of a linked list whose data elements are in non-decreasing order, you must delete any duplicate nodes and print the updated list. ##Code handling I/O is pro...
code_fim
hard
{ "lang": "python", "repo": "rkBiswal/Python_Basics", "path": "/More Review + More Linked Lists.py", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|> if head==None or head.next ==None: return head tmp = head; while tmp.next!=None: if tmp.data==tmp.next.data: tmp.next=tmp.next.next; else: tmp=tmp.next; return head mylist= Solution() T=int(input()) head=None for i in range(T): data=int(input())...
code_fim
hard
{ "lang": "python", "repo": "rkBiswal/Python_Basics", "path": "/More Review + More Linked Lists.py", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|> print ('d : ', d) r = 256 mod = 2 ** r d0 = d % mod d0e = d0 * e print (bin(d0e)[-10:]) if d0e & (1 << 2): x = RSA.construct((p*q, e, d, p, q)) output = x.exportKey("PEM") with open('pri.pem', 'w') as f: ...
code_fim
hard
{ "lang": "python", "repo": "b04902036/balsnctf-2019", "path": "/shellcode_writer/share/solution/gen_key_and_solve_parital_key.py", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|># repo: b04902036/balsnctf-2019 path: /shellcode_writer/share/solution/gen_key_and_solve_parital_key.py #!/usr/bin/env python2 from Crypto.PublicKey import RSA from Crypto.Util.number import * from timeit import default_timer as timer import os import gmpy2 import itertools as it def extract2(inp): ...
code_fim
hard
{ "lang": "python", "repo": "b04902036/balsnctf-2019", "path": "/shellcode_writer/share/solution/gen_key_and_solve_parital_key.py", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|>def printTOADChildren(): wordFinder = WordFinder() print wordFinder.spellingDictionary.dictionary.children('t') print wordFinder.spellingDictionary.dictionary.children('to') print wordFinder.spellingDictionary.dictionary.children('toa') print wordFinder.spellingDictionary.dict...
code_fim
hard
{ "lang": "python", "repo": "BuffaloBuffalo/Wordly", "path": "/base/WordFinder.py", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|># repo: BuffaloBuffalo/Wordly path: /base/WordFinder.py from base.SpellingDictionary import SpellingDictionary from datastructure.trie import NeedMore class WordFinder: def __init__(self): self.spellingDictionary = SpellingDictionary() #self.dictionary.add(["toad", "to", "do", "d...
code_fim
hard
{ "lang": "python", "repo": "BuffaloBuffalo/Wordly", "path": "/base/WordFinder.py", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|># repo: ratchet3789/Handy-Blender-Plugins path: /object_center_zero.py import bpy bl_info = { "name": "Ratchets Center All Objects", "author": "Ratchet3789", "version": (0, 1, 0), "description": "Centers all selected objects. Built for Game Development.", "category": "Object", } cla...
code_fim
hard
{ "lang": "python", "repo": "ratchet3789/Handy-Blender-Plugins", "path": "/object_center_zero.py", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|> bpy.utils.unregister_class(CenterOriginToZero) bpy.utils.unregister_class(SnapMeshToOrigin) bpy.utils.unregister_class(AbsoluteCenterObjects) # This allows you to run the script directly from blenders text editor # to test the addon without having to install it. if __name__ == "__main__": ...
code_fim
hard
{ "lang": "python", "repo": "ratchet3789/Handy-Blender-Plugins", "path": "/object_center_zero.py", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|> self.campoDeTreinamento = CampoDeTreinamentoPage(self.driver) self.campoDeTreinamento.fill_name("Everton") self.campoDeTreinamento.fill_sobrenome("Araujo") self.campoDeTreinamento.select_sexo_masculino() self.campoDeTreinamento.cadastra() time.sleep(3)<|fim_...
code_fim
medium
{ "lang": "python", "repo": "jairoalm/PythonProject001", "path": "/tests/test_campo_de_treinamento.py", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|># repo: jairoalm/PythonProject001 path: /tests/test_campo_de_treinamento.py import time from tests.test_base import BaseTest from pages.campo_de_treinamento_page import CampoDeTreinamentoPage <|fim_suffix|> self.campoDeTreinamento = CampoDeTreinamentoPage(self.driver) self.campoDeTreiname...
code_fim
medium
{ "lang": "python", "repo": "jairoalm/PythonProject001", "path": "/tests/test_campo_de_treinamento.py", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|> x = sym.Symbol('x') t = sym.Symbol('t') dlfl_integral = sym.integrate(del_flu_sym(x, t), (x)) print(dlfl_integral(2)) sym.pprint(dlfl_integral)<|fim_prefix|># repo: CucumentoJolaz/scattering_model path: /optical_integr.py #Интегрирование точного решения кинетик затухания люминесценции символьным методом...
code_fim
medium
{ "lang": "python", "repo": "CucumentoJolaz/scattering_model", "path": "/optical_integr.py", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|>x = sym.Symbol('x') t = sym.Symbol('t') dlfl_integral = sym.integrate(del_flu_sym(x, t), (x)) print(dlfl_integral(2)) sym.pprint(dlfl_integral)<|fim_prefix|># repo: CucumentoJolaz/scattering_model path: /optical_integr.py #Интегрирование точного решения кинетик затухания люминесценции символьным методом ...
code_fim
medium
{ "lang": "python", "repo": "CucumentoJolaz/scattering_model", "path": "/optical_integr.py", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|># repo: CucumentoJolaz/scattering_model path: /optical_integr.py #Интегрирование точного решения кинетик затухания люминесценции символьным методом #Из за сложности получаемых уравнений. Последующий подбор коэффициентов методом МНК # и печать результата # <|fim_suffix|>x = sym.Symbol('x') t = sym.Symbol...
code_fim
medium
{ "lang": "python", "repo": "CucumentoJolaz/scattering_model", "path": "/optical_integr.py", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|> def update_overall_average_value(self): value_sum = 0 for event in self.events: value_sum += event.value value_count = len(self.events) if value_count > 0: self.overall_average_value = value_sum / value_count<|fim_prefix|># repo: HalAltran/EventP...
code_fim
hard
{ "lang": "python", "repo": "HalAltran/EventProcessing", "path": "/event_processing/location.py", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|># repo: HalAltran/EventProcessing path: /event_processing/location.py from datetime import datetime class Location: def __init__(self, location_dict): self.x = location_dict['x'] self.y = location_dict['y'] self.id = location_dict['id'] self.events = [] <|fim_suff...
code_fim
hard
{ "lang": "python", "repo": "HalAltran/EventProcessing", "path": "/event_processing/location.py", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|>ik Informatika 2018 A") print ("Kampus : Universitas Nahdlatul Ulama Sidoarjo") print ("===================================================")<|fim_prefix|># repo: AGUNGDHARMA1/Hello path: /Hello.py print ("hello") print ("=================================================<|fim_middle|>==") print ("N...
code_fim
medium
{ "lang": "python", "repo": "AGUNGDHARMA1/Hello", "path": "/Hello.py", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|># repo: AGUNGDHARMA1/Hello path: /Hello.py print ("hello") print ("===================================================") print ("Nama Lengkap : Agung Dharmawan") print ("Kelas : Tekn<|fim_suffix|>a Sidoarjo") print ("===================================================")<|fim_middle|>ik Informatika...
code_fim
medium
{ "lang": "python", "repo": "AGUNGDHARMA1/Hello", "path": "/Hello.py", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|>a Sidoarjo") print ("===================================================")<|fim_prefix|># repo: AGUNGDHARMA1/Hello path: /Hello.py print ("hello") print ("=================================================<|fim_middle|>==") print ("Nama Lengkap : Agung Dharmawan") print ("Kelas : Teknik Informatika...
code_fim
medium
{ "lang": "python", "repo": "AGUNGDHARMA1/Hello", "path": "/Hello.py", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|># repo: YuboLuo/budgetrnn_backup path: /data_preparation/emg/tokenize_dataset.py import os import numpy as np from argparse import ArgumentParser from collections import Counter from typing import Iterable, Dict, Any, Tuple from utils.constants import TRAIN, VALID, TEST, SAMPLE_ID, INPUTS, OUTPUT from u...
code_fim
hard
{ "lang": "python", "repo": "YuboLuo/budgetrnn_backup", "path": "/data_preparation/emg/tokenize_dataset.py", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|> partition_counters = { TRAIN: Counter(), VALID: Counter(), TEST: Counter() } for i, (sample, partition) in enumerate(data_generator(input_folder)): data_writers[partition].add(sample) partition_counters[partition][sample[OUTPUT]] += 1 if (i + 1...
code_fim
hard
{ "lang": "python", "repo": "YuboLuo/budgetrnn_backup", "path": "/data_preparation/emg/tokenize_dataset.py", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|>def tokenize_dataset(input_folder: str, output_folder: str, chunk_size: int): make_dir(output_folder) data_writers = { TRAIN: DataWriter(os.path.join(output_folder, TRAIN), file_prefix='data', file_suffix='jsonl.gz', chunk_size=chunk_size), VALID: DataWriter(os.path.join(output_fol...
code_fim
hard
{ "lang": "python", "repo": "YuboLuo/budgetrnn_backup", "path": "/data_preparation/emg/tokenize_dataset.py", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|> if leftPointer > rightPointer: return -1 else: midPointer = (leftPointer + rightPointer) // 2 if target == array[midPointer]: return midPointer elif target < array[midPointer]: return binarySearchR(array, target, leftPointer, midPointer - 1) ...
code_fim
medium
{ "lang": "python", "repo": "Chunkygoo/Algorithms", "path": "/Searching/binarySearch.py", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|># repo: Chunkygoo/Algorithms path: /Searching/binarySearch.py # O(logn) T O(1) S def binarySearch(array, target): if len(array) == 0: return -1 else: return binarySearchR(array, target, 0, len(array) - 1) <|fim_suffix|> if leftPointer > rightPointer: return -1 else...
code_fim
medium
{ "lang": "python", "repo": "Chunkygoo/Algorithms", "path": "/Searching/binarySearch.py", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|> # 添加下面一句,在记录日志之后移除句柄 # self.logger.info('记录数据') # self.logger.removeHandler(fh) # 关闭打开的文件 fh.close() return self.logger def log(name): def wraaper(func): def inner(*args, **kwargs): # 如果想返回result必须再包裹一层 log = IC...
code_fim
hard
{ "lang": "python", "repo": "coffeeTeaOne/spiderpy", "path": "/1.1.0/SpidersLog/icrwler_log.py", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|># Start cache_path = "%s/fvwm/menu" % xdg_cache_home icon_theme = gtk.icon_theme_get_default() if not os.path.exists(cache_path): os.makedirs(cache_path) # Parse commandline parser = OptionParser() parser.add_option("-d", "--dynamic", dest="fvwm_menu", default=None, help="Use in DynamicPopupAction...
code_fim
hard
{ "lang": "python", "repo": "jcmenguito/config", "path": "/.fvwm/EN/scripts/xdgmenu-updated.py", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|># repo: jcmenguito/config path: /.fvwm/EN/scripts/xdgmenu-updated.py #!/usr/bin/python2 # # Author: Victor Ananjevsky, 2007 - 2010 # based on xdg-menu.py, written by Piotr Zielinski (http://www.cl.cam.ac.uk/~pz215/) # License: GPL # # This script takes names of menu files conforming to the XDG Desktop # ...
code_fim
hard
{ "lang": "python", "repo": "jcmenguito/config", "path": "/.fvwm/EN/scripts/xdgmenu-updated.py", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|>for arg in args: filename = "" if os.path.exists(arg) or arg == "recent": filename = arg else: tmpfile = "%s/menus/%s.menu" % (xdg_config_home, arg) if os.path.exists(tmpfile): filename = tmpfile else: for dir in xdg_config_dirs: ...
code_fim
hard
{ "lang": "python", "repo": "jcmenguito/config", "path": "/.fvwm/EN/scripts/xdgmenu-updated.py", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|># repo: Replicant74/Pythonsec path: /portscanner_v1.5.py # Original code from http://www.pythonforbeginners.com/code-snippets-source-code/port-scanner-in-python #!/usr/bin/env python # modules import threading import socket import subprocess import sys import time import scapy from threading import Thr...
code_fim
hard
{ "lang": "python", "repo": "Replicant74/Pythonsec", "path": "/portscanner_v1.5.py", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|># Setting some values ports = range(int(startPort), int(endPort)+1) t1 = datetime.now() SYNACK = 0x12 RSTACK = 0x14 # Banner displaying which host is being scanned print ("-" * 60) print ("Please wait, scanning remote host...", targetIP) localtime = time.asctime(time.localtime()) print ("Scan started at:...
code_fim
hard
{ "lang": "python", "repo": "Replicant74/Pythonsec", "path": "/portscanner_v1.5.py", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|># repo: 1tianjing/scrapy path: /爬虫/周末作业/zhilian.py from selenium import webdriver from selenium.webdriver.common.keys import Keys import requests import time driver = webdriver.Chrome(executable_path='/home/bc/桌面/chromedriver') <|fim_suffix|>kw2').send_keys('技术') driver.find_element_by_class_name('doSea...
code_fim
medium
{ "lang": "python", "repo": "1tianjing/scrapy", "path": "/爬虫/周末作业/zhilian.py", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|> driver.get('https://www.zhaopin.com/') time.sleep(5) driver.find_element_by_id('KeyWord_kw2').send_keys('技术') driver.find_element_by_class_name('doSearch').click() time.sleep(5)<|fim_prefix|># repo: 1tianjing/scrapy path: /爬虫/周末作业/zhilian.py from selenium import webdriver from selenium.webdriver.common....
code_fim
medium
{ "lang": "python", "repo": "1tianjing/scrapy", "path": "/爬虫/周末作业/zhilian.py", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|># repo: globocom/redis-pyinterval path: /tests/test_iadd.py from redis_interval.client import RedisInterval class TestRedisIntervalIADD(object): <|fim_suffix|> """ Add simple text inside an interval """ value = self.redis.iadd("test", 0, 10, "simple text") assert value == 'OK'<|f...
code_fim
medium
{ "lang": "python", "repo": "globocom/redis-pyinterval", "path": "/tests/test_iadd.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> @classmethod def setup_class(cls): cls.redis = RedisInterval(host="localhost") def test_add_simple_text(self): """ Add simple text inside an interval """ value = self.redis.iadd("test", 0, 10, "simple text") assert value == 'OK'<|fim_prefix|># repo: globocom/re...
code_fim
medium
{ "lang": "python", "repo": "globocom/redis-pyinterval", "path": "/tests/test_iadd.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> def test_add_simple_text(self): """ Add simple text inside an interval """ value = self.redis.iadd("test", 0, 10, "simple text") assert value == 'OK'<|fim_prefix|># repo: globocom/redis-pyinterval path: /tests/test_iadd.py from redis_interval.client import RedisInterval clas...
code_fim
medium
{ "lang": "python", "repo": "globocom/redis-pyinterval", "path": "/tests/test_iadd.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: acattle/HumourTools path: /HumourDetection/src/fwaDifference.py ''' Created on Sep 23, 2016 @author: Andrew ''' from pymongo import MongoClient import re client = MongoClient() atMentions = re.compile(ur"@\w+", flags=re.I|re.U) atMidnight = re.compile(u"@midnight", flags=re.I|re.U) ...
code_fim
hard
{ "lang": "python", "repo": "acattle/HumourTools", "path": "/HumourDetection/src/fwaDifference.py", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|>len(hashtag.findall(tweet["text"])) > 1: #if there's more than 1 hashtag continue if (tweet[featureF] > 0) and (tweet[featureB] > 0): tweet[featureD] = tweet[featureF] - tweet[featureB] sign = 0 #assume forward and back are equa...
code_fim
hard
{ "lang": "python", "repo": "acattle/HumourTools", "path": "/HumourDetection/src/fwaDifference.py", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|># Get Secret puzzle_input = sys.argv[1] input_num = 0 # Calcuate for i in range(sys.maxsize): digest = hashlib.md5(puzzle_input.encode('utf-8')+str(i).encode('utf-8')).hexdigest() if (digest.startswith('000000')): # must start with 6 zeros input_num = i break; # Print Results print(f'puzzle_inp...
code_fim
medium
{ "lang": "python", "repo": "babint/AoC-2015", "path": "/04/part2.py", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|># repo: babint/AoC-2015 path: /04/part2.py #!/usr/bin/env python3 import sys import hashlib <|fim_suffix|># Print Results print(f'puzzle_input: {puzzle_input} solved with {input_num}') print("\ndone.");<|fim_middle|># Usage if len(sys.argv) != 2: print("usage: part2.py puzzle_input") exit(1) # Ge...
code_fim
hard
{ "lang": "python", "repo": "babint/AoC-2015", "path": "/04/part2.py", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|># repo: babint/AoC-2015 path: /04/part2.py #!/usr/bin/env python3 import sys import hashlib # Usage if len(sys.argv) != 2: print("usage: part2.py puzzle_input") exit(1) <|fim_suffix|># Calcuate for i in range(sys.maxsize): digest = hashlib.md5(puzzle_input.encode('utf-8')+str(i).encode('utf-8')).h...
code_fim
medium
{ "lang": "python", "repo": "babint/AoC-2015", "path": "/04/part2.py", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|># repo: John-Titor/py68k path: /targets/cb030.py from emulator import Emulator from device import Device from devices.compactflash import CompactFlash from devices.mc68681 import MC68681 from musashi import m68k def add_arguments(parser): parser.add_argument('--rom', type=st...
code_fim
hard
{ "lang": "python", "repo": "John-Titor/py68k", "path": "/targets/cb030.py", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|> if self._tick_fired: self._tick_fired = False return M68K_IRQ_AUTOVECTOR return M68K_IRQ_SPURIOUS def configure(args): """create and configure an emulator""" emu = Emulator(args, cpu='68030', frequency=24 * 1000 * 100...
code_fim
hard
{ "lang": "python", "repo": "John-Titor/py68k", "path": "/targets/cb030.py", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|> def get_datetime_from_utc_timestamp(utc_timestamp): return datetime.datetime.utcfromtimestamp(utc_timestamp).replace(tzinfo=datetime.timezone.utc) def get_local_datetime(date_time): return date_time.astimezone(datetime.datetime.utcnow().astimezone().tzinfo) def get_string_from_datetime(date_t...
code_fim
medium
{ "lang": "python", "repo": "corneliusroemer/diagnosis-keys", "path": "/lib/conversions.py", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|> def get_string_from_datetime(date_time): return date_time.strftime('%Y-%m-%d %H:%M:%S %Z')<|fim_prefix|># repo: corneliusroemer/diagnosis-keys path: /lib/conversions.py import datetime interval_length_minutes = 10 # 10 minutes per interval tek_rolling_period = 144 # 24*60//10 - 24 hours per day, ...
code_fim
medium
{ "lang": "python", "repo": "corneliusroemer/diagnosis-keys", "path": "/lib/conversions.py", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|># repo: corneliusroemer/diagnosis-keys path: /lib/conversions.py import datetime interval_length_minutes = 10 # 10 minutes per interval tek_rolling_period = 144 # 24*60//10 - 24 hours per day, 60 minutes per hour, 10 minutes per interval <|fim_suffix|> return datetime.datetime.utcfromtimestamp(ut...
code_fim
medium
{ "lang": "python", "repo": "corneliusroemer/diagnosis-keys", "path": "/lib/conversions.py", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|>boy = None Start_menu = None menu_time =None def enter(): global Start_menu Start_menu = Menu() menu_world.add_object(Start_menu, 0) def exit(): menu_world.clear() def pause(): pass def resume(): pass def handle_events(): global Start_menu,menu_time events = get_event...
code_fim
medium
{ "lang": "python", "repo": "gic91/2DGP_project", "path": "/2D_GAME/game_source/menu_state.py", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }