text
stringlengths
232
16.3k
domain
stringclasses
1 value
difficulty
stringclasses
3 values
meta
dict
<|fim_suffix|> # last observable time is setting or end of period, # whichever comes first time_end = min(time_set, time_stop_utc) # calculate duration in seconds (subtracting two ephem Date # objects seems to give a fraction in days) duration = (time_end - time_rise) * 86...
code_fim
hard
{ "lang": "python", "repo": "naojsoft/qplan", "path": "/qplan/util/calcpos.py", "mode": "spm", "license": "BSD-3-Clause", "source": "the-stack-v2" }
<|fim_prefix|># repo: luizhenriquemaia/system_sgq path: /sgqcmm/main/funcoes.py """ Implementa as funcoes personalizadas """ # Retira parenteses, tracos e espacos de um numeo de telefone def numpurotelefone(textodigitado): numpuro = textodigitado.replace('+', '') numpuro = numpuro.replace('(', '') numpur...
code_fim
hard
{ "lang": "python", "repo": "luizhenriquemaia/system_sgq", "path": "/sgqcmm/main/funcoes.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> # Retorna lista com codigos superiores ao fornecido def listacodigossup(codatual): nivatual = codatual.count('.') result = [] if nivatual > 1: numeros = codatual.split('.') for cont in range(nivatual-1): if cont > 0: result.append(result[cont - 1] +...
code_fim
hard
{ "lang": "python", "repo": "luizhenriquemaia/system_sgq", "path": "/sgqcmm/main/funcoes.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: Eshikamahajan/NamedEntityRecognition path: /NER.py #!/usr/bin/env python # coding: utf-8 # # <h2 align=center> Named Entity Recognition (NER) using LSTMs with Keras<br><h3><center><I>By - Eshika Mahajan</I></h3> # </h2> # # ### Task 1: Project Overview and Import Modules # In[1]: #impor...
code_fim
hard
{ "lang": "python", "repo": "Eshikamahajan/NamedEntityRecognition", "path": "/NER.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|># In[4]: #fetching all the unique words in variable ""words"" and adding "ENDPAD" at the end of the list words = list(set(data["Word"].values)) words.append("ENDPAD") num_words = len(words) #calculating the length of the list # In[5]: #REPEATING THE ABOVE PROCEDURE FOR TAG ALSO tags = list(set(data[...
code_fim
hard
{ "lang": "python", "repo": "Eshikamahajan/NamedEntityRecognition", "path": "/NER.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> # In[16]: model.compile(optimizer="adam", loss="sparse_categorical_crossentropy", metrics=["accuracy"]) # ### Task 7: Train the Model # In[18]: #importing necessary modules from the keras API from tensorflow.keras.callbacks import ModelCheckpoint, EarlyStopping from liv...
code_fim
hard
{ "lang": "python", "repo": "Eshikamahajan/NamedEntityRecognition", "path": "/NER.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: nicolasessisbreton/fython path: /fython/test/instruction/allocruc_deallocruc_test.py s = """ .a.fy real dimension(:) allocatable: x y z integer: a=1 b=1 c=1 n=1 m=1 alloc x(n) dealloc x <|fim_suffix|>writer(s) w = load('.a', force=1, release=1, verbose=0) # print(open(w.modu...
code_fim
hard
{ "lang": "python", "repo": "nicolasessisbreton/fython", "path": "/fython/test/instruction/allocruc_deallocruc_test.py", "mode": "psm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|>w = load('.a', force=1, release=1, verbose=0) # print(open(w.module.url.fortran_path, 'r').read())<|fim_prefix|># repo: nicolasessisbreton/fython path: /fython/test/instruction/allocruc_deallocruc_test.py s = """ .a.fy real dimension(:) allocatable: x y z integer: a=1 b=1 c=1 n=1 m=1 a...
code_fim
easy
{ "lang": "python", "repo": "nicolasessisbreton/fython", "path": "/fython/test/instruction/allocruc_deallocruc_test.py", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_prefix|># repo: RhysGrabany/maze-generator path: /mainmenu_proto/messages_protoype.py #!/usr/bin/python3 def messages(option): if option == "info": return(''' This is the maze generator which creates small mazes for hobby use Please select an option below on what you would like to d...
code_fim
hard
{ "lang": "python", "repo": "RhysGrabany/maze-generator", "path": "/mainmenu_proto/messages_protoype.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|>o view: ''') elif option == "save_maze": return(''' Select a maze to save: ''') elif option == "save_maze_options": return(''' 1. Save 1x image 2. Save an enhanced image (2x - 10x) 3. Save text version e. Go back ''')<...
code_fim
hard
{ "lang": "python", "repo": "RhysGrabany/maze-generator", "path": "/mainmenu_proto/messages_protoype.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> >>> from pyculib import rand >>> rand.lognormal(mean=0, sigma=1, size=10) array([...]) .. seealso:: :py:meth:`pyculib.rand.PRNG.lognormal` ''' ary = np.empty(size, dtype=dtype) devary = cuda.to_device(ary, copy=False) prng = _get_prng() prng.lognormal(devary, mean, si...
code_fim
hard
{ "lang": "python", "repo": "kenhester/pyculib", "path": "/pyculib/rand/api.py", "mode": "spm", "license": "BSD-2-Clause", "source": "the-stack-v2" }
<|fim_suffix|> .. seealso:: :py:meth:`pyculib.rand.PRNG.lognormal` ''' ary = np.empty(size, dtype=dtype) devary = cuda.to_device(ary, copy=False) prng = _get_prng() prng.lognormal(devary, mean, sigma, size) if device: return devary else: devary.copy_to_host(ary) r...
code_fim
hard
{ "lang": "python", "repo": "kenhester/pyculib", "path": "/pyculib/rand/api.py", "mode": "spm", "license": "BSD-2-Clause", "source": "the-stack-v2" }
<|fim_prefix|># repo: kenhester/pyculib path: /pyculib/rand/api.py import numpy as np import time from . import binding from numba import cuda class RNG(object): "cuRAND pseudo random number generator" def __init__(self, gen): self._gen = gen self.__stream = 0 @property def offset(sel...
code_fim
hard
{ "lang": "python", "repo": "kenhester/pyculib", "path": "/pyculib/rand/api.py", "mode": "psm", "license": "BSD-2-Clause", "source": "the-stack-v2" }
<|fim_prefix|># repo: transpresupuestaria/os-data-importers path: /eu-structural-funds/tests/test_bootstrap.py """Unit-tests for the bootstrap module.""" import json import os from shutil import rmtree from common.bootstrap import Source from unittest import TestCase from common.config import DATA_DIR, PIPELINE_FIL...
code_fim
hard
{ "lang": "python", "repo": "transpresupuestaria/os-data-importers", "path": "/eu-structural-funds/tests/test_bootstrap.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> def test_source_is_loaded_and_pipeline_up(self): self.assertEquals(self.source.validation_status, 'valid') self.assertEquals(self.source.pipeline_status, 'up') self.assertEquals(self.source.traceback, None) self.assertEquals(self.source.validation_errors, []) class Te...
code_fim
hard
{ "lang": "python", "repo": "transpresupuestaria/os-data-importers", "path": "/eu-structural-funds/tests/test_bootstrap.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> import argparse parser = argparse.ArgumentParser() parser.add_argument('imagePath', nargs='+') parser.add_argument('--verbose', '-v', action='count', default=0) parser.add_argument('--birthtime', '-b', action='store_true') args = parser.parse_args() args.verbose += 1 setTime = setFromBirthTime if...
code_fim
medium
{ "lang": "python", "repo": "nightjuggler/pig", "path": "/setTimeExif.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|>def setFromBirthTime(fileName, verbose=0): try: fileInfo = os.stat(fileName) except Exception as e: print(fileName, e.__class__.__name__, str(e)) return False oldTime = fileInfo.st_mtime newTime = fileInfo.st_birthtime if oldTime in (newTime, newTime + 1): if verbose > 2: print(fileName,...
code_fim
medium
{ "lang": "python", "repo": "nightjuggler/pig", "path": "/setTimeExif.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: nightjuggler/pig path: /setTimeExif.py import os import time from pimly import Image def formatTime(timestamp): ymdhms = time.localtime(timestamp)[0:6] return "{}-{:02}-{:02} {:02}:{:02}:{:02}".format(*ymdhms) def setFromExifTime(fileName, verbose=0): <|fim_suffix|>def setFromBirthTime(fileNa...
code_fim
hard
{ "lang": "python", "repo": "nightjuggler/pig", "path": "/setTimeExif.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> for root, dirs, files in os.walk(abs_path): local_path = root.replace(abs_path, job_incoming_dir, 1) os.makedirs(local_path, exist_ok=True) for filename in files: fs_file_path = os.path.join(root, filename) ...
code_fim
hard
{ "lang": "python", "repo": "FNNDSC/pfcon", "path": "/pfcon/filesystem_storage.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: FNNDSC/pfcon path: /pfcon/filesystem_storage.py """ Handle filesystem-based (eg. mount directory) storage. This is used when pfcon is in-network and configured to directly copy the data from a filesystem. """ import logging import datetime import os import json import io import shutil from .ba...
code_fim
hard
{ "lang": "python", "repo": "FNNDSC/pfcon", "path": "/pfcon/filesystem_storage.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> for filename in files: local_file_path = os.path.join(root, filename) if not os.path.islink(local_file_path): try: shutil.copy(local_file_path, fs_path) except Exception as e: ...
code_fim
hard
{ "lang": "python", "repo": "FNNDSC/pfcon", "path": "/pfcon/filesystem_storage.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|>os.system("condor_submit_dag -config dagman.config " + fname + ".dag")<|fim_prefix|># repo: briedel/sandbox_icecube path: /sni3Sim/SNPS/SNPS/branches/intermixing/resources/cluster/condor/submitjobsCLSimonly.py #!/usr/bin/env python import sys import os from os.path import expandvars from makesubmitfile...
code_fim
hard
{ "lang": "python", "repo": "briedel/sandbox_icecube", "path": "/sni3Sim/SNPS/SNPS/branches/intermixing/resources/cluster/condor/submitjobsCLSimonly.py", "mode": "spm", "license": "BSD-2-Clause", "source": "the-stack-v2" }
<|fim_prefix|># repo: briedel/sandbox_icecube path: /sni3Sim/SNPS/SNPS/branches/intermixing/resources/cluster/condor/submitjobsCLSimonly.py #!/usr/bin/env python import sys import os from os.path import expandvars <|fim_suffix|>os.system("condor_submit_dag -config dagman.config " + fname + ".dag")<|fim_middle|>from ...
code_fim
hard
{ "lang": "python", "repo": "briedel/sandbox_icecube", "path": "/sni3Sim/SNPS/SNPS/branches/intermixing/resources/cluster/condor/submitjobsCLSimonly.py", "mode": "psm", "license": "BSD-2-Clause", "source": "the-stack-v2" }
<|fim_prefix|># repo: Edu-Glez/introduction-quiz path: /send_answers.py #Import the necessary libraries to POST the answers in the specified host import requests import json <|fim_suffix|>#Get the url r = requests.get(url) #Open the json with open('introduction_quiz.json') as df: ans = json.load(df) ...
code_fim
medium
{ "lang": "python", "repo": "Edu-Glez/introduction-quiz", "path": "/send_answers.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|>#Get the values just entered in order to check if it was done correctly but you have to put the full URL #a = requests.get(url) #answers = a.text #Print the answers in the console #print(answers) #Print the result of the POST print(r.text)<|fim_prefix|># repo: Edu-Glez/introduction-quiz path: /send_answ...
code_fim
hard
{ "lang": "python", "repo": "Edu-Glez/introduction-quiz", "path": "/send_answers.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: pirxthepilot/bsides_workshop path: /autofix_securitygroups.py import boto3 import json import logging logger = logging.getLogger() logger.setLevel(logging.INFO) PORT_WHITELIST = ["8000", "554", "22", "8089", "997", "443"] # Function to inspect each security group def inspect_security_group(ec...
code_fim
hard
{ "lang": "python", "repo": "pirxthepilot/bsides_workshop", "path": "/autofix_securitygroups.py", "mode": "psm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|> def sg_cleaner(): status = "" client = boto3.client("ec2") regions = [region["RegionName"] for region in client.describe_regions()["Regions"]] for x in regions: ec2 = boto3.resource("ec2", region_name=x) instances = ec2.instances.filter( Filters=[{"Name": "inst...
code_fim
hard
{ "lang": "python", "repo": "pirxthepilot/bsides_workshop", "path": "/autofix_securitygroups.py", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|> status = "" client = boto3.client("ec2") regions = [region["RegionName"] for region in client.describe_regions()["Regions"]] for x in regions: ec2 = boto3.resource("ec2", region_name=x) instances = ec2.instances.filter( Filters=[{"Name": "instance-state-name", "...
code_fim
hard
{ "lang": "python", "repo": "pirxthepilot/bsides_workshop", "path": "/autofix_securitygroups.py", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|> """ :param node_feature: features on n nodes, organized as b x c x n x 1 :param argv: graph and edge features. """ extra_res = [] for m in self.module_list: if isinstance(m, base_mp_nn): node_feature = m(node_feature, *argv) ...
code_fim
hard
{ "lang": "python", "repo": "richardodliu/Factor-Graph-Neural-Network", "path": "/lib/mpnn/sequential.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: richardodliu/Factor-Graph-Neural-Network path: /lib/mpnn/sequential.py import torch from .mp_nn import mp_conv_v2 from .mp_nn_residual import mp_conv_residual from .pooling import global_pooling from .base_model import base_mp_nn <|fim_suffix|> """ :param node_feature: features o...
code_fim
hard
{ "lang": "python", "repo": "richardodliu/Factor-Graph-Neural-Network", "path": "/lib/mpnn/sequential.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> def forward(self, node_feature, *argv): """ :param node_feature: features on n nodes, organized as b x c x n x 1 :param argv: graph and edge features. """ extra_res = [] for m in self.module_list: if isinstance(m, base_mp_nn): ...
code_fim
hard
{ "lang": "python", "repo": "richardodliu/Factor-Graph-Neural-Network", "path": "/lib/mpnn/sequential.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: indico/indico path: /indico/modules/events/contributions/models/contributions.py n from indico.modules.events.sessions.util import session_coordinator_priv_enabled from indico.util.iterables import materialize_iterable from indico.util.locators import locator_property from indico.util.string impo...
code_fim
hard
{ "lang": "python", "repo": "indico/indico", "path": "/indico/modules/events/contributions/models/contributions.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: indico/indico path: /indico/modules/events/contributions/models/contributions.py t DDL from sqlalchemy.dialects.postgresql import ARRAY from sqlalchemy.event import listens_for from sqlalchemy.ext.declarative import declared_attr from sqlalchemy.orm import column_property, mapper from sqlalchemy....
code_fim
hard
{ "lang": "python", "repo": "indico/indico", "path": "/indico/modules/events/contributions/models/contributions.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> @property def start_dt_poster(self): if self.session and self.session.is_poster and self.timetable_entry and self.timetable_entry.parent: return self.timetable_entry.parent.start_dt @property def end_dt_poster(self): if self.session and self.session.is_poster a...
code_fim
hard
{ "lang": "python", "repo": "indico/indico", "path": "/indico/modules/events/contributions/models/contributions.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: funkygao/tfshow path: /raw/draw_mnist.py #!/usr/bin/env python # -*- coding: utf-8 -*- import mnist_loader import numpy as np import matplotlib.pyplot as plt import time import os #=============== # Configurations #=============== enable_matplot = False if enable_matplot: plt.ion() fig...
code_fim
medium
{ "lang": "python", "repo": "funkygao/tfshow", "path": "/raw/draw_mnist.py", "mode": "psm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|> # draw on matplot if enable_matplot: ax1.matshow(img, cmap=plt.get_cmap('gray')) figure.canvas.draw() continue os.system('clear') for y in range(dim): for x in range(dim): if img[y][x] > .1: print 'X', else: ...
code_fim
hard
{ "lang": "python", "repo": "funkygao/tfshow", "path": "/raw/draw_mnist.py", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_prefix|># repo: dawnranger/OpenAttack path: /OpenAttack/utils/__init__.py from .word_vector import WordVector from .functions import check_parameters from .zip_downloader import make_zip_downloader from .visualizer import visualizer, result_visualizer from .bert_model import BertClassi<|fim_suffix|>el import Rob...
code_fim
medium
{ "lang": "python", "repo": "dawnranger/OpenAttack", "path": "/OpenAttack/utils/__init__.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|>fier from .albert_model import AlbertClassifier from .xlnet_model import XlnetClassifier from .roberta_model import RobertaClassifier from .dataset import Dataset, DataInstance from .nli_wrapper import NLIWrapper<|fim_prefix|># repo: dawnranger/OpenAttack path: /OpenAttack/utils/__init__.py from .word_ve...
code_fim
medium
{ "lang": "python", "repo": "dawnranger/OpenAttack", "path": "/OpenAttack/utils/__init__.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: AtilioA/algoritmos-teoria-dos-grafos path: /Python/insert.py # Implementação básica de insertion sort, porém para lista de arestas (ver aresta.py) def insert_sort(collection, vertices): tamanho = len(collection) if tamanho < 2: # Já está ordenado, retorne return collectio...
code_fim
hard
{ "lang": "python", "repo": "AtilioA/algoritmos-teoria-dos-grafos", "path": "/Python/insert.py", "mode": "psm", "license": "Unlicense", "source": "the-stack-v2" }
<|fim_suffix|> vertices[elementoFrente.first] = 0 vertices[elementoFrente.second] = 0 return collection, vertices<|fim_prefix|># repo: AtilioA/algoritmos-teoria-dos-grafos path: /Python/insert.py # Implementação básica de insertion sort, porém para lista de arestas (ver aresta.py) def insert_sort(c...
code_fim
medium
{ "lang": "python", "repo": "AtilioA/algoritmos-teoria-dos-grafos", "path": "/Python/insert.py", "mode": "spm", "license": "Unlicense", "source": "the-stack-v2" }
<|fim_suffix|>@pytest.mark.parametrize( "files, file, result", [ ([], "", None), (["FiLe.ExT"], "file", "FiLe.ExT"), (["filee", "FiLe.ExT", "filee"], "file", "FiLe.ExT"), (["filename", "FILE"], "file", "FILE"), ], ) def test_get_file_by_name(files: List[str], file: str, resul...
code_fim
medium
{ "lang": "python", "repo": "newAM/RocketChatBot", "path": "/test_util.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: newAM/RocketChatBot path: /test_util.py import util import pytest from typing import Optional from typing import List @pytest.mark.parametrize( "filename, result", [("/a/a.b", "a"), ("A", "a"), ("A.B.C", "a.b"), ("", "")], ) def test_normalize_filename(filename: str, result: str): <|fim_suf...
code_fim
medium
{ "lang": "python", "repo": "newAM/RocketChatBot", "path": "/test_util.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> @pytest.mark.parametrize( "files, file, result", [ ([], "", None), (["FiLe.ExT"], "file", "FiLe.ExT"), (["filee", "FiLe.ExT", "filee"], "file", "FiLe.ExT"), (["filename", "FILE"], "file", "FILE"), ], ) def test_get_file_by_name(files: List[str], file: str, resu...
code_fim
hard
{ "lang": "python", "repo": "newAM/RocketChatBot", "path": "/test_util.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> stride_counters_valid = stride_counters_valid & ( stride_counter.O < stride_counter_valid_values.O ) # only increment stride if trying to emit data this clock cycle wire((valid_counter.O == valid_c...
code_fim
hard
{ "lang": "python", "repo": "David-Durst/aetherling", "path": "/aetherling/modules/native_linebuffer/any_dimensional_native_linebuffer.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: David-Durst/aetherling path: /aetherling/modules/native_linebuffer/any_dimensional_native_linebuffer.py # used coordinates tracks all the ND coordinates used for window outputs used_coordinates = set() # output indicies and what outputs of shift registers to wir...
code_fim
hard
{ "lang": "python", "repo": "David-Durst/aetherling", "path": "/aetherling/modules/native_linebuffer/any_dimensional_native_linebuffer.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|>caleFactor=1.1, minNeighbors=5, minSize=(30, 30)) for (x,y,W,H) in rects : cv2.rectangle(frame,(x,y),(x+W,y+H),(0,255,0),2) cv2.imshow("Frame",frame) roi = frame[y:y + H, x:x + W] key=cv2.waitKey(1)&0xFF if key==ord("k"): t=time.time()+3 ...
code_fim
hard
{ "lang": "python", "repo": "KienPhung-AI-future/hh", "path": "/loaddata.py", "mode": "spm", "license": "Unlicense", "source": "the-stack-v2" }
<|fim_prefix|># repo: KienPhung-AI-future/hh path: /loaddata.py import argparse import imutils from imutils.video import VideoStream import cv2 import os import time import copy import numpy as np import timeit ap=argparse.ArgumentParser() ap.add_argument("-c","--cascade",required=True, he...
code_fim
hard
{ "lang": "python", "repo": "KienPhung-AI-future/hh", "path": "/loaddata.py", "mode": "psm", "license": "Unlicense", "source": "the-stack-v2" }
<|fim_suffix|>total).zfill(5))]) cv2.imwrite(p, roi) total +=1 elif key==ord("p"): p = os.path.sep.join([args["output"], "{}.png".format(str(total).zfill(5))]) cv2.imwrite(p, frame) total += 1 elif key==ord("q"): break ...
code_fim
hard
{ "lang": "python", "repo": "KienPhung-AI-future/hh", "path": "/loaddata.py", "mode": "spm", "license": "Unlicense", "source": "the-stack-v2" }
<|fim_suffix|>otp = input('Enter your OTP: ') if otp == OTP: print('Verification successful!') else: print("Invalid OTP. Please enter valid OTP.")<|fim_prefix|># repo: siddhantmahajani/Simple_OTP_Verification path: /EmailOTP_Verification.py import os import math import random import smtplib from email.mime.tex...
code_fim
hard
{ "lang": "python", "repo": "siddhantmahajani/Simple_OTP_Verification", "path": "/EmailOTP_Verification.py", "mode": "spm", "license": "Unlicense", "source": "the-stack-v2" }
<|fim_suffix|>OTP = "" for i in range(6): OTP += digits[math.floor(random.random() * 10)] fromEmail = '{fromEmail}' mailServer = smtplib.SMTP('{host}', '{port}') mailServer.starttls() mailServer.login('{authenticationId}', '{authenticationPassword}') toEmail = input('Please enter your email: ') otpMimeMessage = M...
code_fim
medium
{ "lang": "python", "repo": "siddhantmahajani/Simple_OTP_Verification", "path": "/EmailOTP_Verification.py", "mode": "spm", "license": "Unlicense", "source": "the-stack-v2" }
<|fim_prefix|># repo: siddhantmahajani/Simple_OTP_Verification path: /EmailOTP_Verification.py import os import math import random import smtplib from email.mime.text import MIMEText digits = "0123456789" OTP = "" for i in range(6): OTP += digits[math.floor(random.random() * 10)] <|fim_suffix|>otp = input('Ente...
code_fim
hard
{ "lang": "python", "repo": "siddhantmahajani/Simple_OTP_Verification", "path": "/EmailOTP_Verification.py", "mode": "psm", "license": "Unlicense", "source": "the-stack-v2" }
<|fim_prefix|># repo: FitAdam/Mr.-Threat path: /web_app/models.py from django.db import models from django.contrib.auth.models import User class IP(models.Model): """The IP checked by the user.""" the_ip = models.GenericIPAddressField(default='192.168.0.1') owner = models.ForeignKey(User, on_delete=models...
code_fim
medium
{ "lang": "python", "repo": "FitAdam/Mr.-Threat", "path": "/web_app/models.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> member = models.ForeignKey(User, on_delete=models.CASCADE) plan = models.CharField(default='Basic', max_length=100) number_of_requests = models.IntegerField(default=5) def __str__(self): """Return a string representation of the model.""" return self.plan<|fim_prefix|>#...
code_fim
medium
{ "lang": "python", "repo": "FitAdam/Mr.-Threat", "path": "/web_app/models.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> class Plan(models.Model): member = models.ForeignKey(User, on_delete=models.CASCADE) plan = models.CharField(default='Basic', max_length=100) number_of_requests = models.IntegerField(default=5) def __str__(self): """Return a string representation of the model.""" retu...
code_fim
medium
{ "lang": "python", "repo": "FitAdam/Mr.-Threat", "path": "/web_app/models.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: SheffieldML/PyDeepGP path: /deepgp/inference/vardtc.py # Copyright (c) 2015-2016, the authors (see AUTHORS.txt). # Licensed under the BSD 3-clause license (see LICENSE.txt) from GPy.util.linalg import jitchol, backsub_both_sides, tdot, dtrtrs, dtrtri,pdinv from GPy.util import diag from GPy.c...
code_fim
hard
{ "lang": "python", "repo": "SheffieldML/PyDeepGP", "path": "/deepgp/inference/vardtc.py", "mode": "psm", "license": "BSD-3-Clause", "source": "the-stack-v2" }
<|fim_suffix|> def inference(self, kern, X, Z, likelihood, Y, Y_metadata=None, Lm=None, dL_dKmm=None, Kuu_sigma=None): """ The first phase of inference: Compute: log-likelihood, dL_dKmm Cached intermediate results: Kmm, KmmInv, """ num_data, output_dim = Y.shape ...
code_fim
hard
{ "lang": "python", "repo": "SheffieldML/PyDeepGP", "path": "/deepgp/inference/vardtc.py", "mode": "spm", "license": "BSD-3-Clause", "source": "the-stack-v2" }
<|fim_prefix|># repo: jaakkolantero/kvaak-backend path: /kvaak/api/management/commands/populate_db.py from django.core.management.base import BaseCommand from ...models import Sighting from ...models import Species import random class Command(BaseCommand): help = 'Populate database with dummy data. \ ...
code_fim
hard
{ "lang": "python", "repo": "jaakkolantero/kvaak-backend", "path": "/kvaak/api/management/commands/populate_db.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> def _create_sightings(self, count): # TODO: Create random data self._add_species(self.species) for i in range(count): sighting = Sighting(date_time='1990-12-23T23:33:00Z', description='wow such bird', s...
code_fim
hard
{ "lang": "python", "repo": "jaakkolantero/kvaak-backend", "path": "/kvaak/api/management/commands/populate_db.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> # just in case the index isn't already datetime type series_A.index = pd.to_datetime(series_A.index) series_B.index = pd.to_datetime(series_B.index) # place to store results correlations_mw = [] mag_max_cors_mw = [] index = [] # for each step along the moving window f...
code_fim
hard
{ "lang": "python", "repo": "aashish24/monitoring-ecosystem-resilience", "path": "/pyveg/src/data_analysis_utils.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: aashish24/monitoring-ecosystem-resilience path: /pyveg/src/data_analysis_utils.py age Parameters ---------- series : pandas Series Time series observations. length : int Length of the moving window in number of observations. Returns ------- pandas Ser...
code_fim
hard
{ "lang": "python", "repo": "aashish24/monitoring-ecosystem-resilience", "path": "/pyveg/src/data_analysis_utils.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: aashish24/monitoring-ecosystem-resilience path: /pyveg/src/data_analysis_utils.py str Name of the column to calculate the CI of. ci_level : float, optional Size of the confidence interval to calculate Returns ---------- DataFrame Time series data for multi...
code_fim
hard
{ "lang": "python", "repo": "aashish24/monitoring-ecosystem-resilience", "path": "/pyveg/src/data_analysis_utils.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: abbbe/autoenc2 path: /src/envs/gymenv.py import numpy as np import os os.environ['SDL_VIDEODRIVER']='dummy' import pygame pygame.display.set_mode((600,600)) import gym import skimage.transform class ArmRobotEnv: def __init__(self, D=64): self.D = D self.env = gym.make('gy...
code_fim
hard
{ "lang": "python", "repo": "abbbe/autoenc2", "path": "/src/envs/gymenv.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> # apply threhold to averaged image, to highlight the joint circles grey_plane = np.average(img_array, axis=2) thresh1 = 0.1 grey_plane[grey_plane < thresh1] = 0. grey_plane[grey_plane >= thresh1] = 1. # combine the two img_array = grey_plane + blue_...
code_fim
hard
{ "lang": "python", "repo": "abbbe/autoenc2", "path": "/src/envs/gymenv.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> # scale to 0..1 (will rescale later again, but need it here for thresholding to work) img_array = np.array(img_array, dtype=np.float32) / 255. # crop img_array = img_array[70:-70,70:-70] # condition the blue plane, highlight the endpoint circle and the links ...
code_fim
hard
{ "lang": "python", "repo": "abbbe/autoenc2", "path": "/src/envs/gymenv.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> if event == 'next': if screen == 2: if values["_path1_"] and values["_path2_"] != "": my_params.append(values["_path1_"]) my_params.append(values["_path2_"]) with open('app.json', 'w') as fp: ...
code_fim
hard
{ "lang": "python", "repo": "addUsername/tableArt", "path": "/src/tableArtGUI.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> my_params.append(values["_path1_"]) my_params.append(values["_path2_"]) with open('app.json', 'w') as fp: json.dump(values['_multi_'], fp) my_params.append(values['_precision_']) window['_col2_'].updat...
code_fim
hard
{ "lang": "python", "repo": "addUsername/tableArt", "path": "/src/tableArtGUI.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: addUsername/tableArt path: /src/tableArtGUI.py import PySimpleGUI as sg import json my_dict = {"rgb(0,0,0)":" onclick='is1();'", "rgb(200,200,200)": " onclick='is2();'", "rgb(200,100,50)": " onclick='is3();'", "rgb(100,120,140)": " onclick='is4();'"} #St...
code_fim
hard
{ "lang": "python", "repo": "addUsername/tableArt", "path": "/src/tableArtGUI.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: XJTU-Haolin/3D_Harmonic_Loss_for_Object_Detection path: /configs/second/hv_second_secfpn_6x8_80e_kitti-3d-3class_harmonic_loss.py _base_ = [ '../_base_/models/hv_second_secfpn_kitti_harmonic_loss.py', '../_ba<|fim_suffix|>default_runtime.py' ] # load_from = './work_dirs/point_rcnn_2x8_ki...
code_fim
medium
{ "lang": "python", "repo": "XJTU-Haolin/3D_Harmonic_Loss_for_Object_Detection", "path": "/configs/second/hv_second_secfpn_6x8_80e_kitti-3d-3class_harmonic_loss.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|>ch_14.pth' # resume_from = './work_dirs/point_rcnn_2x8_kitti-3d-3classes/epoch_14.pth'<|fim_prefix|># repo: XJTU-Haolin/3D_Harmonic_Loss_for_Object_Detection path: /configs/second/hv_second_secfpn_6x8_80e_kitti-3d-3class_harmonic_loss.py _base_ = [ '../_base_/models/hv_second_secfpn_kitti_harmonic_lo...
code_fim
medium
{ "lang": "python", "repo": "XJTU-Haolin/3D_Harmonic_Loss_for_Object_Detection", "path": "/configs/second/hv_second_secfpn_6x8_80e_kitti-3d-3class_harmonic_loss.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: Sichengthebest/CodePracticeBot path: /cmdproc/penaltiescmd.py #!/usr/bin/env python3 import random from telegram.ext import CommandHandler, Dispatcher, updater from telegram import BotCommand <|fim_suffix|> penalties = [ "Great! You do not have to lose XP! 爽!您不必丢失XP!", "Uh-o...
code_fim
medium
{ "lang": "python", "repo": "Sichengthebest/CodePracticeBot", "path": "/cmdproc/penaltiescmd.py", "mode": "psm", "license": "BSD-2-Clause", "source": "the-stack-v2" }
<|fim_suffix|> start_Handler = CommandHandler('penalties', penalties) dp.add_handler(start_Handler) return get_command() def get_command(): return [BotCommand('penalties','Penalty Carousel // 处罚大转盘')]<|fim_prefix|># repo: Sichengthebest/CodePracticeBot path: /cmdproc/penaltiescmd.py #!/usr/bin/env pyth...
code_fim
hard
{ "lang": "python", "repo": "Sichengthebest/CodePracticeBot", "path": "/cmdproc/penaltiescmd.py", "mode": "spm", "license": "BSD-2-Clause", "source": "the-stack-v2" }
<|fim_prefix|># repo: YKato521/ironpython-stubs path: /release/stubs.min/Autodesk/Revit/DB/__init___parts/TableData.py class TableData(object, IDisposable): """ The TableData class is implemented to hold most of the data that describe the style of the rows,columns,and cells in a table. """ def D...
code_fim
hard
{ "lang": "python", "repo": "YKato521/ironpython-stubs", "path": "/release/stubs.min/Autodesk/Revit/DB/__init___parts/TableData.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> """ __enter__(self: IDisposable) -> object """ pass def __exit__(self, *args): """ __exit__(self: IDisposable,exc_type: object,exc_value: object,exc_back: object) """ pass def __init__(self, *args): """ x.__init__(...) initializes x; see x.__class_...
code_fim
hard
{ "lang": "python", "repo": "YKato521/ironpython-stubs", "path": "/release/stubs.min/Autodesk/Revit/DB/__init___parts/TableData.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> """ __repr__(self: object) -> str """ pass FreezeColumnsAndRows = property( lambda self: object(), lambda self, v: None, lambda self: None ) """set to true if the columns and rows should be unmovable by the slider grips Get: FreezeColumnsAndRows(self: Tabl...
code_fim
hard
{ "lang": "python", "repo": "YKato521/ironpython-stubs", "path": "/release/stubs.min/Autodesk/Revit/DB/__init___parts/TableData.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> (['math'], None), (['there'], None), ]) def test_match(argv, match): cmd = Command(argv=argv, commands=TEST_COMMANDS) assert cmd.match == match<|fim_prefix|># repo: dephell/dephell_argparse path: /tests/test_command.py # external import pytest # project from dephell_argparse._command imp...
code_fim
hard
{ "lang": "python", "repo": "dephell/dephell_argparse", "path": "/tests/test_command.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> # partial match (['prod'], 'math prod'), (['prod', 'junk'], 'math prod'), (['do'], 'do something'), (['something'], 'do something'), (['something', 'else'], 'do something'), (['do', 'else'], 'do something'), (['hello'], 'hello'), (['hello', 'there'], 'hello there'), ...
code_fim
medium
{ "lang": "python", "repo": "dephell/dephell_argparse", "path": "/tests/test_command.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: dephell/dephell_argparse path: /tests/test_command.py # external import pytest # project from dephell_argparse._command import Command def test_groups(): commands = ('math sum', 'math prod', 'http get', 'hello') groups = ('math', 'http') assert Command(argv=[], commands=commands).g...
code_fim
hard
{ "lang": "python", "repo": "dephell/dephell_argparse", "path": "/tests/test_command.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> root = Node("Checker") resultnodes = dict() worklist = list() clazz = clazzes['Checker'] setattr(root,"clazz", clazz) worklist.append(root) while len(worklist) > 0: parent = worklist.pop() subclasses = [sub for sub in parent.c...
code_fim
hard
{ "lang": "python", "repo": "xl-sec/securityheaders", "path": "/securityheaders/checkers/checkerfactory.py", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|> result = set() for checker in checkers: result = result.union(self.getleafcheckers(checker)) return list(result) def getnames_as_tree(self): return self.tree def __getnames_as_tree__(self, clazzes): root = Node("Checker") resultnodes = ...
code_fim
hard
{ "lang": "python", "repo": "xl-sec/securityheaders", "path": "/securityheaders/checkers/checkerfactory.py", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_prefix|># repo: xl-sec/securityheaders path: /securityheaders/checkers/checkerfactory.py import securityheaders from securityheaders import Util from securityheaders.checkers import * from securityheaders.singleton import Singleton from anytree import Node, RenderTree, AsciiStyle import anytree import warnings ...
code_fim
hard
{ "lang": "python", "repo": "xl-sec/securityheaders", "path": "/securityheaders/checkers/checkerfactory.py", "mode": "psm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|> def disconnect(self): """ Disconnect from the database. If this fails, for instance if the connection instance doesn't exist, ignore the exception. """ try: self.cursor.close() self.db.close() except cx_Oracle.DatabaseError: ...
code_fim
hard
{ "lang": "python", "repo": "juan-lajarin/super-duper-robot", "path": "/exportOracletoCSV/cxo.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: juan-lajarin/super-duper-robot path: /exportOracletoCSV/cxo.py import cx_Oracle class Oracle(object): def connect(self, username, password, hostname, port, servicename): """ Connect to the database. """ try: self.db = cx_Oracle.connect(username, password ...
code_fim
hard
{ "lang": "python", "repo": "juan-lajarin/super-duper-robot", "path": "/exportOracletoCSV/cxo.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> try: self.cursor.close() self.db.close() except cx_Oracle.DatabaseError: pass def execute(self, sql, bindvars=None, commit=False): """ Execute whatever SQL statements are passed to the method; commit if specified. Do not spec...
code_fim
hard
{ "lang": "python", "repo": "juan-lajarin/super-duper-robot", "path": "/exportOracletoCSV/cxo.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> # Compute confusion matrix cnf_matrix = confusion_matrix(y_test, pred) np.set_printoptions(precision=2) classes = ['Benign', 'Malignant'] # Plot non-normalized confusion matrix plt.figure() Dataset.plot_confusion_matrix(cnf_matrix, classes=classes, ...
code_fim
hard
{ "lang": "python", "repo": "michaeljlove/Cancer_classifier", "path": "/models/Cancer_clf.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: michaeljlove/Cancer_classifier path: /models/Cancer_clf.py import pandas as pd import numpy as np import matplotlib.pyplot as plt from sklearn.model_selection import train_test_split from sklearn.linear_model import LogisticRegression from sklearn.metrics import confusion_matrix from helper.Data ...
code_fim
hard
{ "lang": "python", "repo": "michaeljlove/Cancer_classifier", "path": "/models/Cancer_clf.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: sapcc/networking-cisco path: /networking_cisco/plugins/cisco/cfg_agent/service_helpers/routing_svc_helper_aci.py # Copyright 2016 Cisco Systems, Inc. All rights reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); you may # not use this file except in compliance wi...
code_fim
hard
{ "lang": "python", "repo": "sapcc/networking-cisco", "path": "/networking_cisco/plugins/cisco/cfg_agent/service_helpers/routing_svc_helper_aci.py", "mode": "psm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|> def _internal_network_added(self, ri, port, ex_gw_port): super(RoutingServiceHelperAci, self)._internal_network_added( ri, port, ex_gw_port) driver = self.driver_manager.get_driver(ri.id) vrf_name = driver._get_vrf_name(ri) net_name = ex_gw_port['hosting_inf...
code_fim
hard
{ "lang": "python", "repo": "sapcc/networking-cisco", "path": "/networking_cisco/plugins/cisco/cfg_agent/service_helpers/routing_svc_helper_aci.py", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|> """Get file content function from read_sql_files_to_db.py""" print(full_path) bytes = min(32, os.path.getsize(full_path)) raw = open(full_path, 'rb').read(bytes) if '\\xff\\xfe' in str(raw): print("utf-16") the_file = open(full_path, encoding="utf-16", ...
code_fim
medium
{ "lang": "python", "repo": "jared-ong/data-projects", "path": "/python/parse_ddl/tests/test_read_file.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: jared-ong/data-projects path: /python/parse_ddl/tests/test_read_file.py """Test encoding when reading a file.""" import os import logging logging.basicConfig(level=logging.INFO) logger = logging.getLogger(__name__) logger.info('Start reading database') # read database here records = {'john': 55,...
code_fim
hard
{ "lang": "python", "repo": "jared-ong/data-projects", "path": "/python/parse_ddl/tests/test_read_file.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> def test_extension_use_the_application_bound_to_the_current_context(app, mail): mailer = Mailer() mailer.init_app(app) with app.test_request_context(): mailer.send(mail) assert mailer.outbox == [mail,] def test_extension_send_mail(dummy, mail): dummy.send(mail) asse...
code_fim
hard
{ "lang": "python", "repo": "vitalk/flask-mailer", "path": "/tests/test_extension.py", "mode": "spm", "license": "BSD-3-Clause", "source": "the-stack-v2" }
<|fim_prefix|># repo: vitalk/flask-mailer path: /tests/test_extension.py #!/usr/bin/python # -*- coding: utf-8 -*- import pytest from flask_mailer import Mailer from flask_mailer import send_email from flask_mailer.util import key from .test_mail import mail @pytest.fixture def dummy(app): return Mailer(app) ...
code_fim
hard
{ "lang": "python", "repo": "vitalk/flask-mailer", "path": "/tests/test_extension.py", "mode": "psm", "license": "BSD-3-Clause", "source": "the-stack-v2" }
<|fim_suffix|> def test_send_email_shortcut(app, dummy, mail): with app.test_request_context(): send_email(mail.subject, mail.text, mail.to) assert len(dummy.outbox) == 1 sent = dummy.outbox[0] assert sent.subject == mail.subject assert sent.text == mail.text assert sent.to == mail.to<|...
code_fim
hard
{ "lang": "python", "repo": "vitalk/flask-mailer", "path": "/tests/test_extension.py", "mode": "spm", "license": "BSD-3-Clause", "source": "the-stack-v2" }
<|fim_prefix|># repo: enthought/blusky path: /blusky/wavelets/tests/test_morlet2d.py from os import path import unittest import numpy as np class TestAlgorithms(unittest.TestCase): def test_vanilla_factory(self): """ Test data generated from the Kymatio libray: https://github.com/kymatio/...
code_fim
hard
{ "lang": "python", "repo": "enthought/blusky", "path": "/blusky/wavelets/tests/test_morlet2d.py", "mode": "psm", "license": "BSD-3-Clause", "source": "the-stack-v2" }
<|fim_suffix|> relative_error1 = ( 0.5 * np.max(np.abs(wavj1 - test_wav1)) / np.max(np.abs(wavj1 + test_wav1)) ) self.assertTrue(relative_error1 < 1e-5) relative_error2 = ( 0.5 * np.max(np.abs(wavj2 - test_wav2)) / n...
code_fim
hard
{ "lang": "python", "repo": "enthought/blusky", "path": "/blusky/wavelets/tests/test_morlet2d.py", "mode": "spm", "license": "BSD-3-Clause", "source": "the-stack-v2" }
<|fim_suffix|> list_workers = options['list_workers'] json_output = options['json_output'] requested_worker_name = options.get('worker', None) if not list_workers and not requested_worker_name: logger.error("'runworker' missing argument: --list-workers or a worker name") ...
code_fim
hard
{ "lang": "python", "repo": "ChefAustin/zentral", "path": "/server/base/management/commands/runworker.py", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_prefix|># repo: ChefAustin/zentral path: /server/base/management/commands/runworker.py import json import logging import sys from django.core.management.base import BaseCommand from zentral.core.queues.workers import get_workers logger = logging.getLogger("zentral.server.base.management.commands.runworker") <...
code_fim
hard
{ "lang": "python", "repo": "ChefAustin/zentral", "path": "/server/base/management/commands/runworker.py", "mode": "psm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_prefix|># repo: druth314/IDC-API path: /tests/test_cohort_query.py # # Copyright 2020, Institute for Systems Biology # # 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 at # # http://www.a...
code_fim
hard
{ "lang": "python", "repo": "druth314/IDC-API", "path": "/tests/test_cohort_query.py", "mode": "psm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|> response = client.post(f'v1/cohorts/{id}/query', query_string = query_string, data = json.dumps(queryPreviewBody), headers=headers) assert response.content_type == 'application/json' assert response.status_cod...
code_fim
hard
{ "lang": "python", "repo": "druth314/IDC-API", "path": "/tests/test_cohort_query.py", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|> (id, filterSet) = create_cohort_for_test_get_cohort_xxx(client) queryPreviewBody = {"fields": ['StudyInstanceUID', 'SeriesInstanceUID', 'SOPInstanceUID', 'Modality']} mimetype = ' application/json' headers = { 'Content-Type': mimetype, 'Accept': mimetype } query_...
code_fim
hard
{ "lang": "python", "repo": "druth314/IDC-API", "path": "/tests/test_cohort_query.py", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_prefix|># repo: menis/abtools path: /abtools/_phylogeny.py #!/usr/bin/python # filename: _phylogeny.py # # Copyright (c) 2015 Bryan Briney # License: The MIT license (http://opensource.org/licenses/MIT) # # Permission is hereby granted, free of charge, to any person obtaining a copy of this software # and asso...
code_fim
hard
{ "lang": "python", "repo": "menis/abtools", "path": "/abtools/_phylogeny.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }