text
stringlengths
232
16.3k
domain
stringclasses
1 value
difficulty
stringclasses
3 values
meta
dict
<|fim_suffix|> def main(): try: arguments = docopt.docopt(__doc__) obs_dir = arguments['--obs_dir'] out_dir = arguments['--out_dir'] jobs = [] for jsonl_path in glob(join(obs_dir, '*', '*', '*', '*.phs.jsonl.gz')): p = fact.path.parse(jsonl_path) phs_...
code_fim
hard
{ "lang": "python", "repo": "fact-project/photon_stream_production", "path": "/photon_stream_production/ethz/scoop_jsonl2binary.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: TeaganBriggs/cryptobeet path: /standard/config.py import datetime TRAIN_MODELS = True db_ds = 'data/bitfinex_data.h5' db_path = 'data/bout.h5' # Training Parameters feature_size = 2 start_date_train = datetime.datetime(2018, 10, 28) end_date_train = datetime.datetime(2018, 11, 8) train_test_r...
code_fim
hard
{ "lang": "python", "repo": "TeaganBriggs/cryptobeet", "path": "/standard/config.py", "mode": "psm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|> # Exchange Simulation Parameters fee = 0.002 start_date_test = datetime.datetime(2018, 11, 8) end_date_test = datetime.datetime.now() # datetime.datetime(2018, 4, 16) max_size_of_trade_set = 288 # np.inf<|fim_prefix|># repo: TeaganBriggs/cryptobeet path: /standard/config.py import datetime TRAIN_MOD...
code_fim
hard
{ "lang": "python", "repo": "TeaganBriggs/cryptobeet", "path": "/standard/config.py", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_prefix|># repo: hoelsner/product-database path: /app/productdb/migrations/0012_auto_20160725_2252.py # -*- coding: utf-8 -*- # Generated by Django 1.9.6 on 2016-07-25 20:52 from __future__ import unicode_literals <|fim_suffix|> class Migration(migrations.Migration): dependencies = [ ('productdb', '...
code_fim
medium
{ "lang": "python", "repo": "hoelsner/product-database", "path": "/app/productdb/migrations/0012_auto_20160725_2252.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|>class Migration(migrations.Migration): dependencies = [ ('productdb', '0011_userprofile_regex_search'), ] operations = [ migrations.AlterField( model_name='userprofile', name='regex_search', field=models.BooleanField(default=False, help_tex...
code_fim
medium
{ "lang": "python", "repo": "hoelsner/product-database", "path": "/app/productdb/migrations/0012_auto_20160725_2252.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: sameerAhmad101/Registrationshop path: /ui/widgets/SliceCompareViewerWidget.py """ SliceCompareViewerWidget :Authors: Berend Klein Haneveld """ from vtk import vtkRenderer from vtk import vtkInteractorStyleUser from vtk import vtkCellPicker from vtk import vtkImageMapToColors from vtk import vt...
code_fim
hard
{ "lang": "python", "repo": "sameerAhmad101/Registrationshop", "path": "/ui/widgets/SliceCompareViewerWidget.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> def charTyped(self, arg1, arg2): # print arg1.GetKeyCode() pass def setLocatorPosition(self, position): for actor in self.locator: actor.SetPosition(position[0], position[1], position[2]) def setFixedImageData(self, fixed): self.fixedImagedata = fixed def setSlicerWidget(self, fixed, mov...
code_fim
hard
{ "lang": "python", "repo": "sameerAhmad101/Registrationshop", "path": "/ui/widgets/SliceCompareViewerWidget.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: y000k/sudoku path: /strategy/singleton.py # # Singleton strategy module # from logger import * from playbook import * from sudoku import * class Singleton(Strategy): __metaclass__ = StrategyMeta """ SINGLETON is the most rudimentary strategy in Sudoku that updates the possible...
code_fim
medium
{ "lang": "python", "repo": "y000k/sudoku", "path": "/strategy/singleton.py", "mode": "psm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|> return self.refresh_node(plan, node) """ Refresh all nodes. """ def run(self, plan): return any([self.singleton(plan, plan.get_sudoku().get_node(i, j)) for i in range(9) for j in range(9)])<|fim_prefix|># repo: y000k/sudoku path: /strategy/singleton.py...
code_fim
hard
{ "lang": "python", "repo": "y000k/sudoku", "path": "/strategy/singleton.py", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|>parser = argparse.ArgumentParser(description='Translates CSV into XML') parser.add_argument('inp_file', help='CSV input file') args = parser.parse_args() inp_fn = args.inp_file files = glob.glob(os.path.join(inp_fn, "*.txt")) files = natsort.natsorted(files) for f in files: classnames, imnames, max...
code_fim
hard
{ "lang": "python", "repo": "mseals1/pytorch-faster-rcnn", "path": "/voc_only_logs/parse.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: mseals1/pytorch-faster-rcnn path: /voc_only_logs/parse.py # parses the txt files and writes csv files from the given dir of text files import argparse import pandas as pd import os import matplotlib.pyplot as plt import csv import glob import natsort import shutil def parse(inputfn): clsns...
code_fim
hard
{ "lang": "python", "repo": "mseals1/pytorch-faster-rcnn", "path": "/voc_only_logs/parse.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> The resulting prefix is essentially arbitrary - it would be nice for it to be uniform at random, but previous attempts to do that have proven too expensive. """ assert not self.is_exhausted novel_prefix = bytearray() def append_int(n_bits, value): ...
code_fim
hard
{ "lang": "python", "repo": "catboost/catboost", "path": "/contrib/python/hypothesis/py3/hypothesis/internal/conjecture/datatree.py", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|> check_counter = 0 while True: k = random.getrandbits(n_bits) try: child = branch.children[k] except KeyError: append_int(n_bits, k) return byt...
code_fim
hard
{ "lang": "python", "repo": "catboost/catboost", "path": "/contrib/python/hypothesis/py3/hypothesis/internal/conjecture/datatree.py", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_prefix|># repo: catboost/catboost path: /contrib/python/hypothesis/py3/hypothesis/internal/conjecture/datatree.py import attr from hypothesis.errors import Flaky, HypothesisException, StopTest from hypothesis.internal.compat import int_to_bytes from hypothesis.internal.conjecture.data import ( ConjectureDa...
code_fim
hard
{ "lang": "python", "repo": "catboost/catboost", "path": "/contrib/python/hypothesis/py3/hypothesis/internal/conjecture/datatree.py", "mode": "psm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_prefix|># repo: dealertrack/django-subui-tests path: /tests/__init__.py from __future__ import print_function, unicode_literals <|fim_suffix|>settings.configure( LOGGING_CONFIG={}, ) django.setup()<|fim_middle|>import django from django.conf import settings
code_fim
easy
{ "lang": "python", "repo": "dealertrack/django-subui-tests", "path": "/tests/__init__.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> settings.configure( LOGGING_CONFIG={}, ) django.setup()<|fim_prefix|># repo: dealertrack/django-subui-tests path: /tests/__init__.py from __future__ import print_function, unicode_literals <|fim_middle|>import django from django.conf import settings
code_fim
easy
{ "lang": "python", "repo": "dealertrack/django-subui-tests", "path": "/tests/__init__.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: DataDog/integrations-core path: /istio/datadog_checks/istio/metrics.py istio_agent_pilot_no_ip': 'agent.pilot.no_ip', 'istio_agent_num_outgoing_requests': 'agent.num_outgoing_requests', 'istio_agent_go_memstats_other_sys_bytes': 'agent.go.memstats.other_sys_bytes', 'istio_agent_pilot_...
code_fim
hard
{ "lang": "python", "repo": "DataDog/integrations-core", "path": "/istio/datadog_checks/istio/metrics.py", "mode": "psm", "license": "BSD-3-Clause", "source": "the-stack-v2" }
<|fim_suffix|>ISTIOD_METRICS = { # Maintain namespace compatibility from legacy components # Generic metrics 'go_gc_duration_seconds': 'go.gc_duration_seconds', 'go_goroutines': 'go.goroutines', 'go_info': 'go.info', 'go_memstats_alloc_bytes': 'go.memstats.alloc_bytes', 'go_memstats_alloc_by...
code_fim
hard
{ "lang": "python", "repo": "DataDog/integrations-core", "path": "/istio/datadog_checks/istio/metrics.py", "mode": "spm", "license": "BSD-3-Clause", "source": "the-stack-v2" }
<|fim_suffix|> ISTIOD_METRICS = { # Maintain namespace compatibility from legacy components # Generic metrics 'go_gc_duration_seconds': 'go.gc_duration_seconds', 'go_goroutines': 'go.goroutines', 'go_info': 'go.info', 'go_memstats_alloc_bytes': 'go.memstats.alloc_bytes', 'go_memstats_alloc_b...
code_fim
hard
{ "lang": "python", "repo": "DataDog/integrations-core", "path": "/istio/datadog_checks/istio/metrics.py", "mode": "spm", "license": "BSD-3-Clause", "source": "the-stack-v2" }
<|fim_prefix|># repo: lsd-maddrive/zaWRka-project path: /wr8_software/scripts/_old/maze_solver.py #!/usr/bin/env python import numpy as np import time import random from graph_path.maze import * from graph_path.car_state import * # import graph_path.gui import rospy import actionlib from actionlib_msgs.msg import ...
code_fim
hard
{ "lang": "python", "repo": "lsd-maddrive/zaWRka-project", "path": "/wr8_software/scripts/_old/maze_solver.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> if solver.is_goal_completed: # Signs test if solver.is_sign_required(): seleceted_sign = int(random.random() * 6) # seleceted_sign = SIGNS_LEFT solver.set_vision_sign(seleceted_sign) ...
code_fim
hard
{ "lang": "python", "repo": "lsd-maddrive/zaWRka-project", "path": "/wr8_software/scripts/_old/maze_solver.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|>: dados.lista() elif opcao == 2: dados.novo() elif opcao == 3: titulos.titulo('Sair do sistema... Até logo!') break else: print(f'{c[1]}ERRO! Digite uma opção válida!')<|fim_prefix|># repo: agnaka/CEV-Python-Exercicios pa...
code_fim
hard
{ "lang": "python", "repo": "agnaka/CEV-Python-Exercicios", "path": "/Pacote-download/Exercicios/ex115/sistema-1.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: agnaka/CEV-Python-Exercicios path: /Pacote-download/Exercicios/ex115/sistema-1.py from Exercicios.ex115.util115 import titulos from Exercicios.ex115.util115 import dados c = ('\033[m', # 0 - sem cores '\033[0;31m', # 1 - vermelho '\033[0;32m', # 2 - verde '\033[...
code_fim
hard
{ "lang": "python", "repo": "agnaka/CEV-Python-Exercicios", "path": "/Pacote-download/Exercicios/ex115/sistema-1.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: madokast/cctpy path: /codes/cctpy/cosy.py """ 读取 COSY 任意阶矩阵 """ from typing import List from cctpy.baseutils import Stream from cctpy.particle import PhaseSpaceParticle class CosyMap: ITEM_LENGTH = len("-0.0000000E+00") def __init__(self, map: str): self.map = map self...
code_fim
hard
{ "lang": "python", "repo": "madokast/cctpy", "path": "/codes/cctpy/cosy.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> by_x: int = int(contributionDescribing[0]) by *= x ** by_x by_xp = int(contributionDescribing[1]) by *= xp ** by_xp by_y = int(contributionDescribing[2]) by *= y ** by_y by_yp = int(contributionDescribing[3]) by *= yp ** by_yp by_...
code_fim
hard
{ "lang": "python", "repo": "madokast/cctpy", "path": "/codes/cctpy/cosy.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: Huawei-Ascend/modelzoo path: /built-in/TensorFlow/Research/cv/image_classification/Darts_for_TensorFlow/automl/vega/search_space/networks/pytorch/utils/fpn_utils/weight_init.py # -*- coding:utf-8 -*- # Copyright (C) 2020. Huawei Technologies Co., Ltd. All rights reserved. # This program is free ...
code_fim
hard
{ "lang": "python", "repo": "Huawei-Ascend/modelzoo", "path": "/built-in/TensorFlow/Research/cv/image_classification/Darts_for_TensorFlow/automl/vega/search_space/networks/pytorch/utils/fpn_utils/weight_init.py", "mode": "psm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|> def xavier_init(module, gain=1, bias=0, distribution='normal'): """Init weight by Xavier method. :param module: target module :type: nn.module :param gain: gain :type: float :param bias: bias of method :type:float :distribute: weight distribute :type: str """ ...
code_fim
hard
{ "lang": "python", "repo": "Huawei-Ascend/modelzoo", "path": "/built-in/TensorFlow/Research/cv/image_classification/Darts_for_TensorFlow/automl/vega/search_space/networks/pytorch/utils/fpn_utils/weight_init.py", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|> :param module: target module :type: nn.module :param a: a :type: float :param b: b :type: float :param bias: bias :type: float """ nn.init.uniform_(module.weight, a, b) if hasattr(module, 'bias') and module.bias is not None: nn.init.constant_(module.bias...
code_fim
hard
{ "lang": "python", "repo": "Huawei-Ascend/modelzoo", "path": "/built-in/TensorFlow/Research/cv/image_classification/Darts_for_TensorFlow/automl/vega/search_space/networks/pytorch/utils/fpn_utils/weight_init.py", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_prefix|># repo: byteshiva/es6-tuts path: /python/algorithms/fibonacci.py def fib(n, computed = {0: 0, 1: 1}): <|fim_suffix|>mputed[n] = fib(n-1, computed) + fib(n-2, computed) return computed[n]<|fim_middle|> if n not in computed: co
code_fim
easy
{ "lang": "python", "repo": "byteshiva/es6-tuts", "path": "/python/algorithms/fibonacci.py", "mode": "psm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|>n-2, computed) return computed[n]<|fim_prefix|># repo: byteshiva/es6-tuts path: /python/algorithms/fibonacci.py def fib(n, computed = {0: 0, 1: 1}): <|fim_middle|> if n not in computed: computed[n] = fib(n-1, computed) + fib(
code_fim
medium
{ "lang": "python", "repo": "byteshiva/es6-tuts", "path": "/python/algorithms/fibonacci.py", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|> 'MoniteringSpikeTuplesList': [ () ], 'PopulatingInitDict': { 'v':-60. } }, **{'CollectingCollectionStr':'Populatome'} ).__setitem__( 'Dis_<Populatome>', [ { 'PopulatingUnitsInt':3200, 'ConnectingGraspClueVariablesList': [ SYS.GraspDictClass( { ...
code_fim
hard
{ "lang": "python", "repo": "Ledoux/ShareYourSystem", "path": "/Pythonlogy/ShareYourSystem/Standards/Recorders/Brianer/draft/01_ExampleCell copy.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|>#Definition the AttestedStr SYS._attest( [ 'MyBrianer is '+SYS._str( MyBrianer, **{ 'RepresentingBaseKeyStrsList':False, 'RepresentingAlineaIsBool':False } ), ] ) #SYS._print(MyBrianer.BrianedMonitorsList[0].__dict__) #SYS._print( # MyBrianer.BrianedNeuronGroupsList[0].__dict__ #) #i...
code_fim
hard
{ "lang": "python", "repo": "Ledoux/ShareYourSystem", "path": "/Pythonlogy/ShareYourSystem/Standards/Recorders/Brianer/draft/01_ExampleCell copy.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: Ledoux/ShareYourSystem path: /Pythonlogy/ShareYourSystem/Standards/Recorders/Brianer/draft/01_ExampleCell copy.py #ImportModules import ShareYourSystem as SYS from ShareYourSystem.Specials.Simulaters import Populater,Brianer #Definition MyBrianer=Brianer.BrianerClass( ).update( { 'Stimula...
code_fim
hard
{ "lang": "python", "repo": "Ledoux/ShareYourSystem", "path": "/Pythonlogy/ShareYourSystem/Standards/Recorders/Brianer/draft/01_ExampleCell copy.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> assert self.request.json is not None payload = self.request.json # message = rendered_template("new_user.html", context=payload) color = "red" self.say("@all Reported content!", color=color) self.say("Raw dump:", color=color) self.say("/code %s" % pa...
code_fim
hard
{ "lang": "python", "repo": "buddyup/our-will", "path": "/plugins/biz/product.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> return "OK" @route("/api/event-added", method="POST") def event_added(self): assert self.request.json and "event_name" in self.request.json payload = self.request.json message = rendered_template("event_added.html", context=payload) color = "green" ...
code_fim
hard
{ "lang": "python", "repo": "buddyup/our-will", "path": "/plugins/biz/product.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: buddyup/our-will path: /plugins/biz/product.py from will.plugin import WillPlugin from will.decorators import respond_to, periodic, hear, randomly, route, rendered_template, require_settings class ProductNotificationPlugin(WillPlugin): @route("/api/signup", method="POST") def new_signu...
code_fim
hard
{ "lang": "python", "repo": "buddyup/our-will", "path": "/plugins/biz/product.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: devak23/python path: /other_progs/wc.py class ContentAnalysis: def __init__(self): self.line_count = 0 # count the total number of lines in the file self.char_count = 0 # count the number of characters in the file self.total_word_count = 0 # count the total word coun...
code_fim
hard
{ "lang": "python", "repo": "devak23/python", "path": "/other_progs/wc.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> ca = ContentAnalysis() unique_words = [] with open(file_path, 'r') as fp: for line in iter(fp.readline, ''): ca.content.append(line) ca.line_count += 1 line = line[:-1] line = line.replace('.', ' ') ...
code_fim
hard
{ "lang": "python", "repo": "devak23/python", "path": "/other_progs/wc.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|>AUTHOR, VERSION = parse_init() setup( name=PKG_NAME, python_requires=">=3.7", version=VERSION, license="MIT", description="Access context in Starlette", long_description=get_long_description(), long_description_content_type="text/markdown", packages=setuptools.find_packag...
code_fim
medium
{ "lang": "python", "repo": "yxlwfds/starlette-context", "path": "/setup.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: yxlwfds/starlette-context path: /setup.py from distutils.core import setup import setuptools import os import re PKG_NAME = "starlette_context" HERE = os.path.abspath(os.path.dirname(__file__)) PATTERN = r'^{target}\s*=\s*([\'"])(.+)\1$' AUTHOR_RE = re.compile(PATTERN.format(target="__auth...
code_fim
medium
{ "lang": "python", "repo": "yxlwfds/starlette-context", "path": "/setup.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: powerapi-ng/powerapi path: /powerapi/database/csvdb.py # Copyright (c) 2021, INRIA # Copyright (c) 2021, University of Lille # All rights reserved. # # Redistribution and use in source and binary forms, with or without # modification, are permitted provided that the following conditions are met: ...
code_fim
hard
{ "lang": "python", "repo": "powerapi-ng/powerapi", "path": "/powerapi/database/csvdb.py", "mode": "psm", "license": "BSD-3-Clause", "source": "the-stack-v2" }
<|fim_suffix|> """ Get next row, None otherwise :param str filename: file name we want to read """ try: return self.tmp_read[filename]['reader'].__next__() except StopIteration: return None def _close_file(self): for filename in self.f...
code_fim
hard
{ "lang": "python", "repo": "powerapi-ng/powerapi", "path": "/powerapi/database/csvdb.py", "mode": "spm", "license": "BSD-3-Clause", "source": "the-stack-v2" }
<|fim_suffix|> def iter(self, stream_mode: bool) -> CsvIterDB: """ Create the iterator for get the data """ return CsvIterDB(self, self.filenames, self.report_type, stream_mode) def connect(self): """ Override from BaseDB. Nothing to do with CSV, because ...
code_fim
hard
{ "lang": "python", "repo": "powerapi-ng/powerapi", "path": "/powerapi/database/csvdb.py", "mode": "spm", "license": "BSD-3-Clause", "source": "the-stack-v2" }
<|fim_prefix|># repo: CGNAM/CGNAM path: /predictor/test.py from __future__ import absolute_import from __future__ import print_function from __future__ import division import _init_paths import time import torch import torch.nn.functional as F import numpy as np from dataset.data_feeder import DataFeeder from utils.c...
code_fim
hard
{ "lang": "python", "repo": "CGNAM/CGNAM", "path": "/predictor/test.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> output = F.softmax(output,dim=-1) output = output[:,1].cpu().numpy() batch_pred.append(output) # print(output) batch_pred = np.stack(batch_pred,axis = 1) all_pred.append(batch_pred) test_loss = ...
code_fim
hard
{ "lang": "python", "repo": "CGNAM/CGNAM", "path": "/predictor/test.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> model = GAT(**model_cfg) model = model.cuda() load_checkpoint(model, checkpoint_path) # print(model) # model = model.cuda() model.eval() try: # set redution='none' to cal pos and neg loss loss_fn = torch.nn.CrossEntropyLoss(reduction='none') except TypeError...
code_fim
hard
{ "lang": "python", "repo": "CGNAM/CGNAM", "path": "/predictor/test.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: jsoler/mimeo path: /extras/run_refresh.py #!/usr/bin/env python ########## # # Script to manage running mimeo table replication with a period set in their configuration. # By default, refreshes are run sequentially in ascending order of their last_run value. # Parallel refreshes are supported wi...
code_fim
hard
{ "lang": "python", "repo": "jsoler/mimeo", "path": "/extras/run_refresh.py", "mode": "psm", "license": "PostgreSQL", "source": "the-stack-v2" }
<|fim_suffix|>def single_process(result): conn = psycopg2.connect(arg_connection) cur = conn.cursor() for i in result: if arg_verbose == 1: print "Running " + i[1] + " replication for table: " + i[0] sql = "SELECT " + arg_schema + ".refresh_" + i[1] + "(%s)" cur.execute(s...
code_fim
hard
{ "lang": "python", "repo": "jsoler/mimeo", "path": "/extras/run_refresh.py", "mode": "spm", "license": "PostgreSQL", "source": "the-stack-v2" }
<|fim_prefix|># repo: google/sling path: /python/flags.py # Copyright 2017 Google Inc. # # 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.apache.org/licenses/LICENSE-2.0 # # U...
code_fim
hard
{ "lang": "python", "repo": "google/sling", "path": "/python/flags.py", "mode": "psm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|># Standard command-line flags. define("--data", help="data directory", default="local/data", metavar="DIR") define("--corpora", help="corpus directory", metavar="DIR") define("--workdir", help="working directory", metavar="DIR") define("--repository", ...
code_fim
hard
{ "lang": "python", "repo": "google/sling", "path": "/python/flags.py", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|> # Call all the post-processing hooks. for callback in hooks: callback(arg) # Standard command-line flags. define("--data", help="data directory", default="local/data", metavar="DIR") define("--corpora", help="corpus directory", metavar="DIR") define("--workdir", ...
code_fim
hard
{ "lang": "python", "repo": "google/sling", "path": "/python/flags.py", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_prefix|># repo: damononliu/sanity-price-monitor path: /pricemonitor/storing/web3_interface.py import json import logging import time import requests import rlp from ethereum import utils, transactions from ethereum.abi import ContractTranslator from pycoin.serialize import b2h, h2b ADDITIONAL_START_GAS_TO_BE_O...
code_fim
hard
{ "lang": "python", "repo": "damononliu/sanity-price-monitor", "path": "/pricemonitor/storing/web3_interface.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> return self._json_call("eth_estimateGas", [params]) def _make_transaction(self, src_priv_key, dst_address, value, data, use_increased_gas_price): src_address = b2h(utils.privtoaddr(src_priv_key)) nonce_rs = self._get_num_transactions(src_address) nonce = int(nonce_rs, ...
code_fim
hard
{ "lang": "python", "repo": "damononliu/sanity-price-monitor", "path": "/pricemonitor/storing/web3_interface.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> def ball_reset(self): self.goto(0, 0) self.ball_speed = 0.1 self.x_val *= -1<|fim_prefix|># repo: Akshaya-LR/100DaysOfCodeChallenge path: /Pong/ball.py from turtle import Turtle class Ball(Turtle): def __init__(self): super().__init__() self.shap...
code_fim
medium
{ "lang": "python", "repo": "Akshaya-LR/100DaysOfCodeChallenge", "path": "/Pong/ball.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> self.goto(0, 0) self.ball_speed = 0.1 self.x_val *= -1<|fim_prefix|># repo: Akshaya-LR/100DaysOfCodeChallenge path: /Pong/ball.py from turtle import Turtle class Ball(Turtle): def __init__(self): <|fim_middle|> super().__init__() self.shape("circle") ...
code_fim
hard
{ "lang": "python", "repo": "Akshaya-LR/100DaysOfCodeChallenge", "path": "/Pong/ball.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: Akshaya-LR/100DaysOfCodeChallenge path: /Pong/ball.py from turtle import Turtle class Ball(Turtle): def __init__(self): super().__init__() self.shape("circle") self.penup() self.shapesize(stretch_wid=1, stretch_len=1) self.color("white") ...
code_fim
medium
{ "lang": "python", "repo": "Akshaya-LR/100DaysOfCodeChallenge", "path": "/Pong/ball.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> B, N, _ = proposals.shape proposals = proposals.view(B, N, self.cfg.NUM_CLASSES, -1) boxes, scores = proposals.split([self.cfg.BOX_DOF, 1], dim=-1) return boxes, scores.squeeze(-1) def forward(self, points, features): features = features.permute(0, 2, 1) ...
code_fim
hard
{ "lang": "python", "repo": "jtpils/PV-RCNN", "path": "/pvrcnn/detector/proposal.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> boxes, scores = self(points, features) _, indices = torch.topk(scores, k=self.cfg.PROPOSAL.TOPK, dim=1) scores = scores.gather(1, indices) boxes = boxes.gather(1, indices.expand(-1, -1, boxes.shape[-1])) return boxes, scores def reorganize_proposals(self, propo...
code_fim
hard
{ "lang": "python", "repo": "jtpils/PV-RCNN", "path": "/pvrcnn/detector/proposal.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: jtpils/PV-RCNN path: /pvrcnn/detector/proposal.py import torch from torch import nn import torch.nn.functional as F from .mlp import MLP class ProposalLoss(nn.Module): def __init__(self, cfg): super(ProposalLoss, self).__init__() self.cfg = cfg self.anchors = self....
code_fim
hard
{ "lang": "python", "repo": "jtpils/PV-RCNN", "path": "/pvrcnn/detector/proposal.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> key = get_ref_id(key) path = _get_cache_path(self.path, key) path.parent.mkdir(parents=True, exist_ok=True) mode = 'wt' if text else 'wb' encoding = 'utf-8' if text else None with path.open(mode, encoding=encoding) as f: yield f def fetch(conte...
code_fim
hard
{ "lang": "python", "repo": "atviriduomenys/spinta", "path": "/spinta/fetcher.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: atviriduomenys/spinta path: /spinta/fetcher.py from contextlib import contextmanager from pathlib import Path from spinta.utils.refs import get_ref_id from spinta.components import Context def _get_cache_path(base: Path, key: str) -> Path: return base / key[:2] / key[2:4] / key[4:] <|fim...
code_fim
hard
{ "lang": "python", "repo": "atviriduomenys/spinta", "path": "/spinta/fetcher.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> def test_inequality(self): assert CondaRequirement("x") != CondaRequirement("x=1.2") class TestCurrentEnvironmentCondaRequirements: @pytest.mark.service("environment") @pytest.mark.parametrize( "options", [{}, {"include_builds": True}, {"explicit_only": False}] ) @pyt...
code_fim
hard
{ "lang": "python", "repo": "PrefectHQ/prefect", "path": "/tests/software/test_conda.py", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_prefix|># repo: PrefectHQ/prefect path: /tests/software/test_conda.py import os import subprocess from contextlib import nullcontext from textwrap import dedent from unittest.mock import MagicMock import pytest from prefect.software.conda import ( CONDA_REQUIREMENT, CondaEnvironment, CondaError, ...
code_fim
hard
{ "lang": "python", "repo": "PrefectHQ/prefect", "path": "/tests/software/test_conda.py", "mode": "psm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|> def test_from_file_unsupported_subtype(self, tmp_path): reqs_file = tmp_path / "requirements.txt" reqs_file.write_text( dedent( """ name: test channels: - defaults dependencies: ...
code_fim
hard
{ "lang": "python", "repo": "PrefectHQ/prefect", "path": "/tests/software/test_conda.py", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|>@task def shuffler(token_tuples): # Sort tokens sorted_tokens = sorted(token_tuples, key=lambda x: x[0]) # Partition tokens partitions = [ (key, [value for _, value in group]) for key, group in itertools.groupby(sorted_tokens, lambda x: x[0]) ] return partitions @...
code_fim
hard
{ "lang": "python", "repo": "swerbo/prefect-with-k8", "path": "/src/prefect_kube_demo/tasks.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: swerbo/prefect-with-k8 path: /src/prefect_kube_demo/tasks.py import itertools import requests from prefect import task @task def download_message(url): <|fim_suffix|> @task def mapper(line): # Strip leading and trailing whitespace, # make lowercase, and split into tokens tokens = l...
code_fim
medium
{ "lang": "python", "repo": "swerbo/prefect-with-k8", "path": "/src/prefect_kube_demo/tasks.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> # Sort tokens sorted_tokens = sorted(token_tuples, key=lambda x: x[0]) # Partition tokens partitions = [ (key, [value for _, value in group]) for key, group in itertools.groupby(sorted_tokens, lambda x: x[0]) ] return partitions @task def reducer(partition): k...
code_fim
hard
{ "lang": "python", "repo": "swerbo/prefect-with-k8", "path": "/src/prefect_kube_demo/tasks.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|>ent': mensagem}) return result.status_code == 200<|fim_prefix|># repo: drmcarvalho/PyQueryMonitor path: /integration.py import requests def sendDiscord(mensagem, channelId, token): result = requests.post(f'https://disco<|fim_middle|>rd.com/api/webhooks/{channelId}/{token}', data={'cont
code_fim
easy
{ "lang": "python", "repo": "drmcarvalho/PyQueryMonitor", "path": "/integration.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: drmcarvalho/PyQueryMonitor path: /integration.py import requests def sendDiscord(mensagem, channelId, token): result = requests.post(f'https://disco<|fim_suffix|>ent': mensagem}) return result.status_code == 200<|fim_middle|>rd.com/api/webhooks/{channelId}/{token}', data={'cont
code_fim
easy
{ "lang": "python", "repo": "drmcarvalho/PyQueryMonitor", "path": "/integration.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: Xiaoyu-Xing/algorithms path: /Lintcode/30 Insert Interval.py """ Definition of Interval. class Interval(object): def __init__(self, start, end): self.start = start self.end = end """ <|fim_suffix|> if not newInterval: return intervals if not interv...
code_fim
medium
{ "lang": "python", "repo": "Xiaoyu-Xing/algorithms", "path": "/Lintcode/30 Insert Interval.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> def insert(self, intervals, newInterval): if not newInterval: return intervals if not intervals: return [newInterval] new_result = [] insert_pos = 0 for interval in intervals: if interval.end < newInterval.start: ...
code_fim
medium
{ "lang": "python", "repo": "Xiaoyu-Xing/algorithms", "path": "/Lintcode/30 Insert Interval.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> _FAKIR.__init__(self) self.name = "FAKIRS" self.specie = 'nouns' self.basic = "fakir" self.jsondata = {}<|fim_prefix|># repo: cash2one/xai path: /xai/brain/wordbase/nouns/_fakirs.py from xai.brain.wordbase.nouns._fakir import _FAKIR <|fim_middle|>#calss header class _FAKIRS(_FAKIR, ): def _...
code_fim
medium
{ "lang": "python", "repo": "cash2one/xai", "path": "/xai/brain/wordbase/nouns/_fakirs.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: cash2one/xai path: /xai/brain/wordbase/nouns/_fakirs.py from xai.brain.wordbase.nouns._fakir import _FAKIR <|fim_suffix|> def __init__(self,): _FAKIR.__init__(self) self.name = "FAKIRS" self.specie = 'nouns' self.basic = "fakir" self.jsondata = {}<|fim_middle|>#calss header class _F...
code_fim
easy
{ "lang": "python", "repo": "cash2one/xai", "path": "/xai/brain/wordbase/nouns/_fakirs.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: ESJiang/OpenSimFullBodyWithPython path: /Python/validation_RRA_CMC_trackingErrors_run.py from readSto import readStoFile from simFunctions import matRMS import numpy as np # Track max translational and rotational positional errors # from IK -> RRA kinematics, and RRA -> CMC kinematics # subsets...
code_fim
hard
{ "lang": "python", "repo": "ESJiang/OpenSimFullBodyWithPython", "path": "/Python/validation_RRA_CMC_trackingErrors_run.py", "mode": "psm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|>print 'max pelvis error' print ' ', 100*np.amax(np.abs(cmc_run_pErr_pelvisTrans)), ' (trans, cm)' print ' ', 180/np.pi*np.amax(np.abs(cmc_run_pErr_pelvisRot)), ' (rot, deg)' print 'max lumbar error' print ' ', 180/np.pi*np.amax(np.abs(cmc_run_pErr_lumbarRot)), ' (rot, deg)' print 'max LE error' prin...
code_fim
hard
{ "lang": "python", "repo": "ESJiang/OpenSimFullBodyWithPython", "path": "/Python/validation_RRA_CMC_trackingErrors_run.py", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|># print to console print 'runing rra/cmc errors' print 'max rms pelvis error' print ' ', 100*np.amax(matRMS(cmc_run_pErr_pelvisTrans)), ' (trans, cm)' print ' ', 100*np.amax(matRMS(cmc_run_pErr_pelvisRot)), ' (rot, deg)' print 'max rms lumbar error' print ' ', 100*np.amax(matRMS(cmc_run_pErr_lumbarR...
code_fim
hard
{ "lang": "python", "repo": "ESJiang/OpenSimFullBodyWithPython", "path": "/Python/validation_RRA_CMC_trackingErrors_run.py", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|> # Column Address Set self._write_cmd(CASET) self._write_words(((x0>>8) & 0xFF, x0 & 0xFF, (y0>>8) & 0xFF, y0 & 0xFF)) # Page Address Set self._write_cmd(PASET) self._write_words(((x1>>8) & 0xFF, x1 & 0xFF, (y1>>8) & 0xFF, y1 & 0xFF)) # Memory Write ...
code_fim
hard
{ "lang": "python", "repo": "HadrienLG/micropython-ili9341", "path": "/ili9341/lcd.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: HadrienLG/micropython-ili9341 path: /ili9341/lcd.py notice and this permission notice shall be included in # all copies or substantial portions of the Software. # # THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS # OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES O...
code_fim
hard
{ "lang": "python", "repo": "HadrienLG/micropython-ili9341", "path": "/ili9341/lcd.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: HadrienLG/micropython-ili9341 path: /ili9341/lcd.py ts for R and B colors # * just 6 largest bits for G color # next 2 lines sorting useful data # getting 4 last bytes data = unpack('<BI', data)[1] # reversing them data = pack('>I', data)...
code_fim
hard
{ "lang": "python", "repo": "HadrienLG/micropython-ili9341", "path": "/ili9341/lcd.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: raclab/RACLAB path: /Goruntu Isleme/ornek12.py #-*-coding: cp1254-*- ###Sekil Algılama2### import numpy as np import cv2 def detect(c): peri=cv2.arcLength(c,True) approx=cv2.approxPolyDP(c,0.04*peri,True) if len(approx)==3: shape="Ucgen" elif len(approx)==4: x,y,w,h=cv2.boundingRect(ap...
code_fim
medium
{ "lang": "python", "repo": "raclab/RACLAB", "path": "/Goruntu Isleme/ornek12.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> gray=cv2.cvtColor(img,cv2.COLOR_BGR2GRAY) blur=cv2.GaussianBlur(gray,(5,5),0) thresh=cv2.threshold(blur,60,255,cv2.THRESH_BINARY_INV)[1] _,cntr,_=cv2.findContours(thresh.copy(),cv2.RETR_EXTERNAL,cv2.CHAIN_APPROX_SIMPLE) for c in cntr: M = cv2.moments(c) cX = int((M["m10"] / M["m00"])) cY = int((M["m0...
code_fim
hard
{ "lang": "python", "repo": "raclab/RACLAB", "path": "/Goruntu Isleme/ornek12.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|>img=cv2.imread('resimler/sekiller.png') gray=cv2.cvtColor(img,cv2.COLOR_BGR2GRAY) blur=cv2.GaussianBlur(gray,(5,5),0) thresh=cv2.threshold(blur,60,255,cv2.THRESH_BINARY_INV)[1] _,cntr,_=cv2.findContours(thresh.copy(),cv2.RETR_EXTERNAL,cv2.CHAIN_APPROX_SIMPLE) for c in cntr: M = cv2.moments(c) cX = in...
code_fim
medium
{ "lang": "python", "repo": "raclab/RACLAB", "path": "/Goruntu Isleme/ornek12.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> """ Args: low : the lower range (inclusive) high : the higher range (exclusive) """ super().__init__(torch.distributions.Uniform(low=low, high=high))<|fim_prefix|># repo: PhoenixDL/rising path: /rising/random/continuous.py from typing import Union ...
code_fim
hard
{ "lang": "python", "repo": "PhoenixDL/rising", "path": "/rising/random/continuous.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> def __init__(self, low: Union[float, torch.Tensor], high: Union[float, torch.Tensor]): """ Args: low : the lower range (inclusive) high : the higher range (exclusive) """ super().__init__(torch.distributions.Uniform(low=low, high=high))<|fim_pref...
code_fim
hard
{ "lang": "python", "repo": "PhoenixDL/rising", "path": "/rising/random/continuous.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: PhoenixDL/rising path: /rising/random/continuous.py from typing import Union import torch from torch.distributions import Distribution as TorchDistribution from rising.random.abstract import AbstractParameter __all__ = ["ContinuousParameter", "NormalParameter", "UniformParameter"] class Cont...
code_fim
medium
{ "lang": "python", "repo": "PhoenixDL/rising", "path": "/rising/random/continuous.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: HIPS/Kayak path: /kayak/__init__.py # Authors: Harvard Intelligent Probabilistic Systems (HIPS) Group # http://hips.seas.harvard.edu # Ryan Adams, David Duvenaud, Scott Linderman, # Dougal Maclaurin, Jasper Snoek, and others # Copyright 2014, The President and Fellows o...
code_fim
medium
{ "lang": "python", "repo": "HIPS/Kayak", "path": "/kayak/__init__.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|>from differentiable import Differentiable from root_nodes import Constant, Parameter, DataNode, Inputs, Targets from batcher import Batcher from matrix_ops import MatAdd, MatMult, MatElemMult, MatSum, MatMean, Transpose, Reshape, Concatenate, Identity, TensorMult, ListToArray, MatDet from e...
code_fim
medium
{ "lang": "python", "repo": "HIPS/Kayak", "path": "/kayak/__init__.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: OrnIngvar/guitarparty path: /api.py from flask_peewee.rest import RestAPI, UserAuthentication from app import app from auth import auth from models import Song user_auth = UserAuthentication(auth) <|fim_suffix|># sort by created date desc : /api/song/?genre__eq=Rock&ordering=created # sort by ...
code_fim
hard
{ "lang": "python", "repo": "OrnIngvar/guitarparty", "path": "/api.py", "mode": "psm", "license": "ISC", "source": "the-stack-v2" }
<|fim_suffix|># filter by artist name : /api/song/?artist=Mugison # filter by song title : /api/song/?title=Stingum af # or # /api/song/?title__eq=Stingum+af # filter by album name : /api/song/?album=Mugiboogie # filter by artist starts with : /api/song/?artist__istartswith=Mugi # filter by artist name contains : /ap...
code_fim
medium
{ "lang": "python", "repo": "OrnIngvar/guitarparty", "path": "/api.py", "mode": "spm", "license": "ISC", "source": "the-stack-v2" }
<|fim_suffix|># filter by album name : /api/song/?album=Mugiboogie # filter by artist starts with : /api/song/?artist__istartswith=Mugi # filter by artist name contains : /api/song/?artist__icontains=Mug # sort by created date desc : /api/song/?genre__eq=Rock&ordering=created # sort by created date desc : /api/song/?...
code_fim
hard
{ "lang": "python", "repo": "OrnIngvar/guitarparty", "path": "/api.py", "mode": "spm", "license": "ISC", "source": "the-stack-v2" }
<|fim_prefix|># repo: simonzabrocki/GraphModels path: /models/Sarah/model_EW.py __author__ = 'Sarah' __status__ = 'Pending Validation' """ TO DO. """ from graphmodels.graphmodel import GraphModel, concatenate_graph_specs import numpy as np # Conversions height_rice = 0.2 # meter height of rice ha_to_m2 = 1e4 # * 1...
code_fim
hard
{ "lang": "python", "repo": "simonzabrocki/GraphModels", "path": "/models/Sarah/model_EW.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|>EW2_nodes = { 'IRWR': {'type': 'input', 'name': 'Internal Renewable Water Resources', 'unit': 'm3/year'}, 'ERWR': {'type': 'input', 'unit': 'm3/year', 'name': 'External Renewable Water Resources'}, 'TRF': {'type': 'variable', ...
code_fim
hard
{ "lang": "python", "repo": "simonzabrocki/GraphModels", "path": "/models/Sarah/model_EW.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> EW1_nodes = {'IWU': {'type': 'parameter', 'name': 'Industrial Water Withdrawal', 'unit': 'm3/year'}, 'AIR': {'type': 'parameter', 'unit': '1000 ha', 'name': 'Area Actually Irrigated'}, 'MWU': {'t...
code_fim
hard
{ "lang": "python", "repo": "simonzabrocki/GraphModels", "path": "/models/Sarah/model_EW.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: eventbrite/zendesk path: /zendesk/endpoints.py """ API MAPPING """ mapping_table = { # Rest API: Organizations 'list_organizations': { 'path': '/organizations.json', 'method': 'GET', 'status': 200, }, 'show_organization': { 'path': '/organizations...
code_fim
hard
{ "lang": "python", "repo": "eventbrite/zendesk", "path": "/zendesk/endpoints.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> '/users.json', 'valid_params': ('page', ), 'method': 'GET', 'status': 200, }, 'search_users': { 'path': '/users.json', 'valid_params': ('query', 'role', 'page'), 'method': 'GET', 'status': 200, }, 'show_user': { 'path': '/use...
code_fim
hard
{ "lang": "python", "repo": "eventbrite/zendesk", "path": "/zendesk/endpoints.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> oids = list() for name in names: if name in self.ct2oid: oids.append(self.ct2oid[name]) elif name.lower() in self.ct2oid: oids.append(self.ct2oid[name.lower()]) else: oids.append(self.NO_ENTITY_ID) ...
code_fim
hard
{ "lang": "python", "repo": "dmis-lab/BERN2", "path": "/normalizers/celltype_normalizer.py", "mode": "spm", "license": "BSD-2-Clause", "source": "the-stack-v2" }
<|fim_prefix|># repo: dmis-lab/BERN2 path: /normalizers/celltype_normalizer.py class CellTypeNormalizer(object): def __init__(self, dict_path): self.NO_ENTITY_ID = 'CUI-less' <|fim_suffix|> oids = list() for name in names: if name in self.ct2oid: oids.append(self...
code_fim
hard
{ "lang": "python", "repo": "dmis-lab/BERN2", "path": "/normalizers/celltype_normalizer.py", "mode": "psm", "license": "BSD-2-Clause", "source": "the-stack-v2" }
<|fim_suffix|>def get_filenames(data_dir: str, filename_regexp: str, show_result=True): filenames = glob.glob(os.path.join(data_dir, filename_regexp)) if show_result: hvd_info_rank0('find {} files in {}, such as {}'.format(len(filenames), data_dir, filenames[0:5])) return filenames def _idx_a_minu...
code_fim
medium
{ "lang": "python", "repo": "omrialmog/Model-References", "path": "/TensorFlow/computer_vision/efficientdet/horovod_estimator/__init__.py", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_prefix|># repo: omrialmog/Model-References path: /TensorFlow/computer_vision/efficientdet/horovod_estimator/__init__.py from TensorFlow.common.horovod_helpers import hvd, horovod_enabled import glob import os from multiprocessing import Pool, cpu_count import numpy as np import tensorflow.compat.v1 as tf from...
code_fim
hard
{ "lang": "python", "repo": "omrialmog/Model-References", "path": "/TensorFlow/computer_vision/efficientdet/horovod_estimator/__init__.py", "mode": "psm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|> def get_record_num(filenames): pool = Pool(cpu_count()) c_list = pool.map(_count_per_file, filenames) total_count = np.sum(np.array(c_list)) return total_count def get_filenames(data_dir: str, filename_regexp: str, show_result=True): filenames = glob.glob(os.path.join(data_dir, file...
code_fim
hard
{ "lang": "python", "repo": "omrialmog/Model-References", "path": "/TensorFlow/computer_vision/efficientdet/horovod_estimator/__init__.py", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }