text
stringlengths
232
16.3k
domain
stringclasses
1 value
difficulty
stringclasses
3 values
meta
dict
<|fim_prefix|># repo: ChrisChV/Binance-Manager path: /src/Utils/sad.py from decimal import * _DF_ = "/" _BINANCE_MODULE_DIR_NAME_ = "Binance" _KEYS_FILE_NAME_ = ".keys" _KEYS_FILE_PATH_ = _BINANCE_MODULE_DIR_NAME_ + _DF_ + _KEYS_FILE_NAME_ _CONFIG_FILE_NAME_ = "bm.conf" _ENTRY_TYPE_ = 0 _LOSE_TYPE_ = 1 _PROFIT_TYP...
code_fim
hard
{ "lang": "python", "repo": "ChrisChV/Binance-Manager", "path": "/src/Utils/sad.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: dangthill/timemory path: /timemory/gperf/cpu_profiler.py #!@PYTHON_EXECUTABLE@ # MIT License # # Copyright (c) 2020, The Regents of the University of California, # through Lawrence Berkeley National Laboratory (subject to receipt of any # required approvals from the U.S. Dept. of Energy). All ri...
code_fim
hard
{ "lang": "python", "repo": "dangthill/timemory", "path": "/timemory/gperf/cpu_profiler.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> os.environ["CPUPROFILE_FREQUENCY"] = "{}".format(freq) os.environ["MALLOCSTATS"] = "{}".format(malloc_stats) os.environ["CPUPROFILE_REALTIME"] = "{}".format(realtime) if preload: _libpath = general.find_library_path("libprofiler") if _libpath is not None: raise...
code_fim
medium
{ "lang": "python", "repo": "dangthill/timemory", "path": "/timemory/gperf/cpu_profiler.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> _libs = general.get_linked_libraries(exe) _liblist = [] if _libs is not None: for _lib in _libs: _liblist += ["--add_lib={}".format(_lib)] general.execute(["google-pprof", "--text"] + _liblist + args + [exe, fname], "{}.txt".format(fname)) gener...
code_fim
hard
{ "lang": "python", "repo": "dangthill/timemory", "path": "/timemory/gperf/cpu_profiler.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> with open(log, 'w') as logptr: with open(configs, "r") as fptr: for config in fptr: if len(config) == 0 or config[0] == '#': continue config = config.strip() full_config = os.path.join((CONFIG_BASE % (stage)), con...
code_fim
hard
{ "lang": "python", "repo": "elitap/NiftyNet", "path": "/NiftyNet/infer_trained_configs.py", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_prefix|># repo: elitap/NiftyNet path: /NiftyNet/infer_trained_configs.py import subprocess import argparse import os import sys import time COARSE_STAGE = "coarse_stage" FINE_STAGE = "fine_stage" DATASET_SPLIT_FILE = "./data/HaN_MICCAI2015_Dataset/test_data_split.csv" MODEL_BASE = "./%s/%s/models/model.ckpt-%d...
code_fim
hard
{ "lang": "python", "repo": "elitap/NiftyNet", "path": "/NiftyNet/infer_trained_configs.py", "mode": "psm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|> if os.path.exists(checkpoint_path): cmd = INFERENCE_CMD % (full_config, os.path.join(SAVE_DIR_BASE, str(checkpoint)+seg_postfix), checkpoint, gpu, os.path.abspath(dataset_splitfile)) logptr.write("execute " + cmd + " \n") ...
code_fim
hard
{ "lang": "python", "repo": "elitap/NiftyNet", "path": "/NiftyNet/infer_trained_configs.py", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_prefix|># repo: soros1321/trinity path: /src/proxy/api.py from flask import Flask, request from flask_jsonrpc import JSONRPC from proxy.state import State from channel_manager.state import ChannelAddress from exception import ChannelDBAddFail from channel_manager import manager from flask_cors import CORS ...
code_fim
medium
{ "lang": "python", "repo": "soros1321/trinity", "path": "/src/proxy/api.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> @jsonrpc.method("closechannel") def close_channel(sender_addr, receiver_addr,channel_name): if manager.close_channel(sender_addr, receiver_addr,channel_name): return "SUCCESS" else: return "Close Channel Fail" @jsonrpc.method("getbalanceonchain") def get_balance_onchain(...
code_fim
hard
{ "lang": "python", "repo": "soros1321/trinity", "path": "/src/proxy/api.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> return manager.get_balance_onchain(local_address, asset_type) @jsonrpc.method("updatedeposit") def update_deposit(local_address, channel_name, asset_type, value): return manager.update_deposit(local_address, channel_name, asset_type, value) if __name__ == '__main__': app.run(hos...
code_fim
hard
{ "lang": "python", "repo": "soros1321/trinity", "path": "/src/proxy/api.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|>def get_week_info(week_id): week_info = OrderedDict() cur_year = current_date.strftime("%Y") url = ("https://fbschedules.com/wp-admin/admin-ajax.php?action=load_fbschedules_ajax&type=NCAA&" \ "display=current&team=&current_season=%s&view=weekly&conference=&conference-division=&"...
code_fim
hard
{ "lang": "python", "repo": "avenstewart/pyNCAA", "path": "/NextGame.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: avenstewart/pyNCAA path: /NextGame.py import contextlib import urllib.request import bs4 as bs import json import pytz from datetime import datetime from collections import OrderedDict from time import sleep bsoup = bs.BeautifulSoup current_date = datetime.now() timezone_str = "US/Central" our_...
code_fim
hard
{ "lang": "python", "repo": "avenstewart/pyNCAA", "path": "/NextGame.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: ecmwf/pyeccodes path: /pyeccodes/defs/param_limits_def.py import pyeccodes.accessors as _ def load(h): h.add(_.DoubleConstant('default_min_val', -1e+09)) h.add(_.DoubleConstant('default_max_val', 1e+09)) def param_value_min_inline_concept(h): def wrapped(h): p...
code_fim
hard
{ "lang": "python", "repo": "ecmwf/pyeccodes", "path": "/pyeccodes/defs/param_limits_def.py", "mode": "psm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|> if paramId == 174098: return 15 if paramId == 140229: return 100 if paramId == 235: return 380 if paramId == 228032: return 100 if paramId == 33: return 1000 ...
code_fim
hard
{ "lang": "python", "repo": "ecmwf/pyeccodes", "path": "/pyeccodes/defs/param_limits_def.py", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|> if paramId == 260057: return '-3' if paramId == 136: return '-50' if paramId == 131: return '-250' if paramId == 132: return '-250' if paramId == 135: return '-30...
code_fim
hard
{ "lang": "python", "repo": "ecmwf/pyeccodes", "path": "/pyeccodes/defs/param_limits_def.py", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|> from . import hpi import my.hypothesis as hyp for h in hyp.get_highlights(): if isinstance(h, Exception): yield h continue hl = h.highlight ann = h.annotation tags = h.tags cparts = [] if hl is not None: cparts...
code_fim
hard
{ "lang": "python", "repo": "hirajanwin/promnesia", "path": "/src/promnesia/sources/hypothesis.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: hirajanwin/promnesia path: /src/promnesia/sources/hypothesis.py ''' Uses HPI [[https://github.com/karlicoss/HPI/blob/master/doc/MODULES.org#myhypothesis][hypothesis]] module ''' from ..common import Visit, Results, logger, Loc <|fim_suffix|> from . import hpi import my.hypothesis as hyp ...
code_fim
hard
{ "lang": "python", "repo": "hirajanwin/promnesia", "path": "/src/promnesia/sources/hypothesis.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: unsky/apollo path: /modules/tools/prediction/mlp_train/generate_labels.py #!/usr/bin/env python ############################################################################### # Copyright 2018 The Apollo Authors. All Rights Reserved. # # Licensed under the Apache License, Version 2.0 (the "Licen...
code_fim
hard
{ "lang": "python", "repo": "unsky/apollo", "path": "/modules/tools/prediction/mlp_train/generate_labels.py", "mode": "psm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|> parser = argparse.ArgumentParser(description = 'Generate labels') parser.add_argument('-d', '--dir', help = 'directory containing features') parser.add_argument('-f', '--file', help = 'feature file') args = parser.parse_args() directory = args.dir file = args.file if director...
code_fim
hard
{ "lang": "python", "repo": "unsky/apollo", "path": "/modules/tools/prediction/mlp_train/generate_labels.py", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|> if reactor.glucose_to_HP_rxn.X+ reactor.glucose_to_microbe_rxn.X +\ reactor.glucose_to_acetic_acid_rxn.X> 0.999: remainder = 0.999 - reactor.glucose_to_HP_rxn.X reactor.glucose_to_microbe_rxn.X = .3 * remainder reactor.glucose_to_acetic_...
code_fim
hard
{ "lang": "python", "repo": "dhkblaszyk/Bioindustrial-Park", "path": "/BioSTEAM 2.x.x/biorefineries/HP/_process_specification.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: dhkblaszyk/Bioindustrial-Park path: /BioSTEAM 2.x.x/biorefineries/HP/_process_specification.py p from biosteam.exceptions import InfeasibleRegion from biorefineries.HP.units import compute_HP_titer, compute_HP_mass # from biosteam.process_tools.reactor_specification import evaluate_across_TRY _kg...
code_fim
hard
{ "lang": "python", "repo": "dhkblaszyk/Bioindustrial-Park", "path": "/BioSTEAM 2.x.x/biorefineries/HP/_process_specification.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: dhkblaszyk/Bioindustrial-Park path: /BioSTEAM 2.x.x/biorefineries/HP/_process_specification.py m biosteam.exceptions import InfeasibleRegion from biorefineries.HP.units import compute_HP_titer, compute_HP_mass # from biosteam.process_tools.reactor_specification import evaluate_across_TRY _kg_per_...
code_fim
hard
{ "lang": "python", "repo": "dhkblaszyk/Bioindustrial-Park", "path": "/BioSTEAM 2.x.x/biorefineries/HP/_process_specification.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: cctbx/cctbx_project path: /mmtbx/regression/pdb_interpretation/tst_edits.py from __future__ import absolute_import, division, print_function from mmtbx import monomer_library import mmtbx.monomer_library.server import mmtbx.monomer_library.pdb_interpretation import mmtbx.model from cctbx import g...
code_fim
hard
{ "lang": "python", "repo": "cctbx/cctbx_project", "path": "/mmtbx/regression/pdb_interpretation/tst_edits.py", "mode": "psm", "license": "BSD-3-Clause-LBNL", "source": "the-stack-v2" }
<|fim_suffix|> wp_extract = working_phil.extract() # print wp_extract.bond[0].atom_selection_1 # STOP() # edits = None geometry, xrs = make_initial_grm(mon_lib_srv, ener_lib, raw_records1, wp_extract) # Check the .geo file geo_fname = "pdb_interpretation_tst_edits_exercise_user_edits.geo" geometry.write_...
code_fim
hard
{ "lang": "python", "repo": "cctbx/cctbx_project", "path": "/mmtbx/regression/pdb_interpretation/tst_edits.py", "mode": "spm", "license": "BSD-3-Clause-LBNL", "source": "the-stack-v2" }
<|fim_suffix|> Returns: Tuple[float, List[Any]]: An execution time and sorted result """ if epoch < 1: epoch = 1 # TODO - runtime(lambda array, start, end: sort(array, start, end), "random", 5000) # In case when we pass a function like # lambda arr...
code_fim
hard
{ "lang": "python", "repo": "IchiruTake/python-bigO-calculator", "path": "/bigO/BigO.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> bestCase = self._complexity2int("O(n^3)") worstCase = self._complexity2int("O(1)") print(f"Running {function.__name__}(tests)") for test in result: cplx = self.test(function, test, prtResult=False) result[test] = cplx cplxInt = self._com...
code_fim
hard
{ "lang": "python", "repo": "IchiruTake/python-bigO-calculator", "path": "/bigO/BigO.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: IchiruTake/python-bigO-calculator path: /bigO/BigO.py _ in range(size)] @staticmethod def genRandomArray(size: int = 10): return [randint(-size, size) for _ in range(size)] @staticmethod def genRandomBigArray(size: int = 10): array = [] append = array.ap...
code_fim
hard
{ "lang": "python", "repo": "IchiruTake/python-bigO-calculator", "path": "/bigO/BigO.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> Returns ------- tensorfree model object """ return pretrain.factory.create(model_name)<|fim_prefix|># repo: andrew-alm/tensorfree path: /src/tensorfree/Tensorfree.py from tensorfree.model import pretrain def build(model_name): <|fim_middle|> """ This function is used to const...
code_fim
hard
{ "lang": "python", "repo": "andrew-alm/tensorfree", "path": "/src/tensorfree/Tensorfree.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: andrew-alm/tensorfree path: /src/tensorfree/Tensorfree.py from tensorfree.model import pretrain def build(model_name): """ This function is used to construct a new model. Example use case: `from tensorfree import Tensorfree model = Tensorfree.build('NASNetLarge...
code_fim
medium
{ "lang": "python", "repo": "andrew-alm/tensorfree", "path": "/src/tensorfree/Tensorfree.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|>complex_signal = hilbert(signal) # Plot spectrums for signal and complex signal plot_spectrum(signal, Fs=Fsamp_rate, NFFT=8192, title="Signal's Spectrum") plot_spectrum(complex_signal, Fs=Fsamp_rate, NFFT=8192, title="Signal's Spectrum after Hilbert Transform") plt.show()<|fim_prefix|># repo: KorotkiyE...
code_fim
medium
{ "lang": "python", "repo": "KorotkiyEugene/dsp_sdr_basic", "path": "/15/hilbert_harmonic.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|>dummy, t, signal = create_harmonic(Fc=Fsig, Fs=Fsamp_rate, Amp=1, N=1e3) complex_signal = hilbert(signal) # Plot spectrums for signal and complex signal plot_spectrum(signal, Fs=Fsamp_rate, NFFT=8192, title="Signal's Spectrum") plot_spectrum(complex_signal, Fs=Fsamp_rate, NFFT=8192, title="Signal's ...
code_fim
medium
{ "lang": "python", "repo": "KorotkiyEugene/dsp_sdr_basic", "path": "/15/hilbert_harmonic.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: KorotkiyEugene/dsp_sdr_basic path: /15/hilbert_harmonic.py import numpy as np from common import create_harmonic, plot_spectrum import matplotlib.pyplot as plt from scipy.signal import hilbert Fsamp_rate = 100e3 Fsig = 10e3 # Frequency of signal <|fim_suffix|>plot_spectrum(signa...
code_fim
medium
{ "lang": "python", "repo": "KorotkiyEugene/dsp_sdr_basic", "path": "/15/hilbert_harmonic.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: spacebigjam/OMNI_CFG_LOADER path: /omni_cfg_loader.py import os import json import logging VALID_EXTENSIONS = [".JSON"] class CfgFile(object): # > Constructor def __init__(self, cfg_file_name): self.cfg_file_name = cfg_file_name self.file_extension = os.path.splitext(cfg_fil...
code_fim
hard
{ "lang": "python", "repo": "spacebigjam/OMNI_CFG_LOADER", "path": "/omni_cfg_loader.py", "mode": "psm", "license": "Unlicense", "source": "the-stack-v2" }
<|fim_suffix|> #def update_configuration(self): # > PRIVATE ----------------------------------------------------- # > Group of cfg file basic validatons def __validate(self, file_name): validation_list = [ self.__file_exists(file_name), self.__valid_extension() ] if False in validation_li...
code_fim
hard
{ "lang": "python", "repo": "spacebigjam/OMNI_CFG_LOADER", "path": "/omni_cfg_loader.py", "mode": "spm", "license": "Unlicense", "source": "the-stack-v2" }
<|fim_prefix|># repo: pulumi/pulumi-alicloud path: /sdk/python/pulumi_alicloud/rds/db_instance_endpoint.py self) -> pulumi.Input[str]: """ The vSwitch ID of the internal endpoint. """ return pulumi.get(self, "vswitch_id") @vswitch_id.setter def vswitch_id(self, value: pulumi.In...
code_fim
hard
{ "lang": "python", "repo": "pulumi/pulumi-alicloud", "path": "/sdk/python/pulumi_alicloud/rds/db_instance_endpoint.py", "mode": "psm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|> resource_name: str, args: DbInstanceEndpointArgs, opts: Optional[pulumi.ResourceOptions] = None): """ Provide RDS cluster instance endpoint connection resources, see [What is RDS DB Instance Endpoint](https://www.alibabacloud.com/help/en/a...
code_fim
hard
{ "lang": "python", "repo": "pulumi/pulumi-alicloud", "path": "/sdk/python/pulumi_alicloud/rds/db_instance_endpoint.py", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|> resource_args, opts = _utilities.get_resource_args_opts(DbInstanceEndpointArgs, pulumi.ResourceOptions, *args, **kwargs) if resource_args is not None: __self__._internal_init(resource_name, opts, **resource_args.__dict__) else: __self__._internal_init(resour...
code_fim
hard
{ "lang": "python", "repo": "pulumi/pulumi-alicloud", "path": "/sdk/python/pulumi_alicloud/rds/db_instance_endpoint.py", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_prefix|># repo: ForestCSharp/armory path: /blender/arm/logicnode/animation_on_action_marker.py import bpy from bpy.props import * from bpy.types import Node, NodeSocket from arm.logicnode.arm_nodes import * class OnActionMarkerNode(Node, ArmLogicTreeNode): '''On action marker node''' bl_idname = 'LNOnAc...
code_fim
medium
{ "lang": "python", "repo": "ForestCSharp/armory", "path": "/blender/arm/logicnode/animation_on_action_marker.py", "mode": "psm", "license": "Zlib", "source": "the-stack-v2" }
<|fim_suffix|> def init(self, context): self.inputs.new('ArmNodeSocketObject', 'Object') self.inputs.new('NodeSocketString', 'Marker') self.outputs.new('ArmNodeSocketAction', 'Out') add_node(OnActionMarkerNode, category='Animation')<|fim_prefix|># repo: ForestCSharp/armory path: /blender/ar...
code_fim
medium
{ "lang": "python", "repo": "ForestCSharp/armory", "path": "/blender/arm/logicnode/animation_on_action_marker.py", "mode": "spm", "license": "Zlib", "source": "the-stack-v2" }
<|fim_suffix|> name = re.sub(r'%(.+?)%', substitute, format) name = os.path.splitext(os.path.split(path)[1])[0] if not name else name name = self.validate_name(name) name += '.' + meta['format'] folder = self.savePath if self.savePath else os.path.dirname(path) save = os.p...
code_fim
hard
{ "lang": "python", "repo": "francis95-han/ncmdump", "path": "/ui/mainUi.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: francis95-han/ncmdump path: /ui/mainUi.py # -*- coding: utf-8 -*- # Form implementation generated from reading ui file '网易云音乐.ui' # # Created by: PyQt5 UI code generator 5.9.2 # # WARNING! All changes made in this file will be lost! import os import re import sys from PyQt5 import QtCore, QtWid...
code_fim
hard
{ "lang": "python", "repo": "francis95-han/ncmdump", "path": "/ui/mainUi.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> #For the rest of the segments, keep them as translation memory project_cursor.execute(""" UPDATE source_segments SET source_file = 'tm:' || source_file WHERE segment_id IN ( SELECT source_segments.segment_id FROM source_segments LEFT JOIN variants ON v...
code_fim
hard
{ "lang": "python", "repo": "Babelruins/BlackCAT", "path": "/core/db_op.py", "mode": "spm", "license": "BSD-3-Clause", "source": "the-stack-v2" }
<|fim_prefix|># repo: Babelruins/BlackCAT path: /core/db_op.py ce_segments.segment_id, source_segments.segment, source_segments.language, source_segments.source_file FROM variants JOIN source_segments ON variants.source_segment = source_segments.segment_id LIMIT 1;""") except OperationalError:...
code_fim
hard
{ "lang": "python", "repo": "Babelruins/BlackCAT", "path": "/core/db_op.py", "mode": "psm", "license": "BSD-3-Clause", "source": "the-stack-v2" }
<|fim_suffix|> self.options = options self.finished.connect(finished_callback) #print("init -> ", self.options) def run(self): print("run -> ", self.options) project_db = sqlite3.connect(self.options['project_path']) project_cursor = project_db.cursor() project_cursor.execute("INSERT OR REPLACE INTO va...
code_fim
hard
{ "lang": "python", "repo": "Babelruins/BlackCAT", "path": "/core/db_op.py", "mode": "spm", "license": "BSD-3-Clause", "source": "the-stack-v2" }
<|fim_suffix|>=a1<n and 0<=b1<m and row[a1][b1]<row[a][b] else 0 route_memo[(a,b)] = tmp return tmp print(route(0,0))<|fim_prefix|># repo: ch96an/BaekJoonSolution path: /Python_Codes_for_BJ/stage16 동적 계획법 기초/내리막 길.py n, m = map(int, input().split()) row = [list(map(int, input().split())) for i in range(n)] route_mem...
code_fim
hard
{ "lang": "python", "repo": "ch96an/BaekJoonSolution", "path": "/Python_Codes_for_BJ/stage16 동적 계획법 기초/내리막 길.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: ch96an/BaekJoonSolution path: /Python_Codes_for_BJ/stage16 동적 계획법 기초/내리막 길.py n, m = map(int, input().split()) row = [list(map(int, input().split())) for i in range(n)] route_memo = {<|fim_suffix|>n route_memo[(a,b)] tmp = 0 for v in vector: a1, b1 = a + v[0], b + v[1] tmp += route(a1, b1) ...
code_fim
medium
{ "lang": "python", "repo": "ch96an/BaekJoonSolution", "path": "/Python_Codes_for_BJ/stage16 동적 계획법 기초/내리막 길.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: gengmoqi/trinity path: /trinity/extensibility/asyncio.py from abc import abstractmethod from typing import ( Any, Callable, ) from asyncio_run_in_process import run_in_process from asyncio_run_in_process.typing import SubprocessKwargs from async_service import background_asyncio_service ...
code_fim
hard
{ "lang": "python", "repo": "gengmoqi/trinity", "path": "/trinity/extensibility/asyncio.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> async def _do_run(self) -> None: with child_process_logging(self._boot_info): endpoint_name = self.get_endpoint_name() event_bus_service = AsyncioEventBusService( self._boot_info.trinity_config, endpoint_name, ) as...
code_fim
hard
{ "lang": "python", "repo": "gengmoqi/trinity", "path": "/trinity/extensibility/asyncio.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: RSLancs/identifying_unknown_entities path: /bio_tag_corpus.py ## python 37 from pprint import pprint import pandas as pd import nltk import csv import time import datetime import json def clean_plant_list(plant_list_in): """ Removes abbreviation plant names and duplicate plant nam...
code_fim
hard
{ "lang": "python", "repo": "RSLancs/identifying_unknown_entities", "path": "/bio_tag_corpus.py", "mode": "psm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|> for item in out_data: thefile.write("%s\n" % item) ##..................................................... ## open full tokenised corpus with open('./data/full_spacy_split_MLcorpus_2020-02-28.txt', 'r', encoding='utf-8', errors='ignore') as f: text = f.read().split('\n') # read in train c...
code_fim
hard
{ "lang": "python", "repo": "RSLancs/identifying_unknown_entities", "path": "/bio_tag_corpus.py", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|> model = Account fields = ( 'username', 'first_name', 'last_name', 'patronymic', 'email', 'passport_series', 'passport_number', 'password1', 'password2', )<|fim_prefix|># repo...
code_fim
hard
{ "lang": "python", "repo": "daniluuuuuuuk/BookFlights", "path": "/src/apps/user/forms/forms.py", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_prefix|># repo: daniluuuuuuuk/BookFlights path: /src/apps/user/forms/forms.py from django import forms from django.contrib.auth.forms import UserCreationForm from django.contrib.auth.models import User from apps.user.models import Account, MyAccountManager <|fim_suffix|> first_name = forms.CharField(max_leng...
code_fim
medium
{ "lang": "python", "repo": "daniluuuuuuuk/BookFlights", "path": "/src/apps/user/forms/forms.py", "mode": "psm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_prefix|># repo: tingyao7798/crpyto-portfolio path: /utils/common.py """ module where the commonly used methods are """ # core modules import os import logging.config import yaml # third party modules <|fim_suffix|> default_level=logging.INFO): """Setup logging configuration """ pa...
code_fim
medium
{ "lang": "python", "repo": "tingyao7798/crpyto-portfolio", "path": "/utils/common.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> default_level=logging.INFO): """Setup logging configuration """ path = default_path if os.path.exists(path): with open(path, 'rt') as file: config = yaml.safe_load(file.read()) logging.config.dictConfig(config) else: logging.basicCo...
code_fim
medium
{ "lang": "python", "repo": "tingyao7798/crpyto-portfolio", "path": "/utils/common.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: Armcollector/lockdown-workout path: /config.py import os import urllib.parse basedir = os.path.abspath(os.path.dirname(__file__)) <|fim_suffix|> SECRET_KEY = os.environ.get("SECRET_KEY") or "iR33OXoRSUj5" SQLALCHEMY_DATABASE_URI = "mssql+pyodbc:///?odbc_connect={}".format(params) SQ...
code_fim
medium
{ "lang": "python", "repo": "Armcollector/lockdown-workout", "path": "/config.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> SECRET_KEY = os.environ.get("SECRET_KEY") or "iR33OXoRSUj5" SQLALCHEMY_DATABASE_URI = "mssql+pyodbc:///?odbc_connect={}".format(params) SQLALCHEMY_TRACK_MODIFICATIONS = False SQLALCHEMY_COMMIT_ON_TEARDOWN = True VERSION = "2.1.0" WTF_CSR_ENABLED = True CACHE_TYPE = "simple" ...
code_fim
medium
{ "lang": "python", "repo": "Armcollector/lockdown-workout", "path": "/config.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> parent_act = association_proxy('parent_legislation_act', 'act') regulation_act = association_proxy('regulation_legislation_act', 'act') section = association_proxy('regulation_legislation_act_section', 'section') compliance_article_comments = association_proxy('compliance_article', 'commen...
code_fim
hard
{ "lang": "python", "repo": "bcgov/mds", "path": "/services/nris-api/backend/app/nris/models/noncompliance_legislation.py", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|> __tablename__ = "noncompliance_legislation" __table_args__ = { 'comment': 'Contains the additional details about the contravention(s) relating to an issued order; i.e. estimated incident date, noncompliance description, regulations/act contravened.' } noncompliance_legislat...
code_fim
hard
{ "lang": "python", "repo": "bcgov/mds", "path": "/services/nris-api/backend/app/nris/models/noncompliance_legislation.py", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_prefix|># repo: bcgov/mds path: /services/nris-api/backend/app/nris/models/noncompliance_legislation.py from datetime import datetime from app.extensions import db, api from flask_restplus import fields from sqlalchemy.orm import validates from sqlalchemy.ext.associationproxy import association_proxy from app.nr...
code_fim
hard
{ "lang": "python", "repo": "bcgov/mds", "path": "/services/nris-api/backend/app/nris/models/noncompliance_legislation.py", "mode": "psm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_prefix|># repo: thomasuhc/Learn_Python_Full_Course_for_Beginners path: /Exercise 033.py n1 = int(input('Enter number 1: ')) n2 = int(input('Enter number 2: ')) n3 = int(input('Enter number 3: ')) <|fim_suffix|>print("Menor e {}".format(menor)) print("Maior e {}".format(maior))<|fim_middle|>menor = n1 if n2 < n1...
code_fim
medium
{ "lang": "python", "repo": "thomasuhc/Learn_Python_Full_Course_for_Beginners", "path": "/Exercise 033.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|>print("Menor e {}".format(menor)) print("Maior e {}".format(maior))<|fim_prefix|># repo: thomasuhc/Learn_Python_Full_Course_for_Beginners path: /Exercise 033.py n1 = int(input('Enter number 1: ')) n2 = int(input('Enter number 2: ')) n3 = int(input('Enter number 3: ')) menor = n1 if n2 < n1 and n2 < n3: ...
code_fim
medium
{ "lang": "python", "repo": "thomasuhc/Learn_Python_Full_Course_for_Beginners", "path": "/Exercise 033.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> components, data = image_data(self.image) texture = self.ctx.texture( self.image.size, components, data, ) texture.extra = {'meta': self.meta} if self.meta.mipmap_levels is not None: self.meta.mipmap = True...
code_fim
hard
{ "lang": "python", "repo": "yoyonel/moderngl-window", "path": "/moderngl_window/loaders/texture/t2d.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> texture = self.ctx.texture( self.image.size, components, data, ) texture.extra = {'meta': self.meta} if self.meta.mipmap_levels is not None: self.meta.mipmap = True if self.meta.mipmap: if isin...
code_fim
hard
{ "lang": "python", "repo": "yoyonel/moderngl-window", "path": "/moderngl_window/loaders/texture/t2d.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: yoyonel/moderngl-window path: /moderngl_window/loaders/texture/t2d.py import logging from moderngl_window.loaders.texture.pillow import PillowLoader, image_data logger = logging.getLogger(__name__) <|fim_suffix|> """Load a 2d texture as configured in the supplied ``TextureDescri...
code_fim
hard
{ "lang": "python", "repo": "yoyonel/moderngl-window", "path": "/moderngl_window/loaders/texture/t2d.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> ptr1 = head ptr2 = meetPoint while ptr2 != ptr1: ptr1 = ptr1.next ptr2 = ptr2.next return ptr1 def detectLoop(head): if head == None or head.next == None: return False slow = fast = head while fast and fast.next: slow = slow.next fast...
code_fim
hard
{ "lang": "python", "repo": "SupriyoDam/DS-450-python", "path": "/LinkedList/143 find the starting point of the loop.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: SupriyoDam/DS-450-python path: /LinkedList/143 find the starting point of the loop.py class Node: def __init__(self, data=None, next=None): self.data = data self.next = next class LList: def __init__(self): self.head = None self.tail = None self.c...
code_fim
hard
{ "lang": "python", "repo": "SupriyoDam/DS-450-python", "path": "/LinkedList/143 find the starting point of the loop.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> def check_alert(authz, alert): entity = get_entity(alert.entity_id) if alert.entity_id else None query = {'q': alert.query_text} state = SearchQueryParser(query, authz) query = AlertDocumentsQuery(state, entity=entity, since=...
code_fim
hard
{ "lang": "python", "repo": "jigsawsecurity/aleph", "path": "/aleph/logic/alerts.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: jigsawsecurity/aleph path: /aleph/logic/alerts.py import logging from pprint import pprint # noqa from aleph.authz import Authz from aleph.core import db, celery from aleph.model import Role, Alert, Events from aleph.index.entities import get_entity from aleph.index.util import unpack_result fr...
code_fim
hard
{ "lang": "python", "repo": "jigsawsecurity/aleph", "path": "/aleph/logic/alerts.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> importlib.import_module("%s.%s" % (EXAMPLES_MOD, mod), PACKAGE_NAME)<|fim_prefix|># repo: spring-epfl/zksk path: /tests/test_examples.py import os import sys import importlib import pytest PACKAGE_NAME = "zksk" EXAMPLES_MOD = "examples" BASE_PATH = dir_path = os.path.dirname(os.path.realpath(__file...
code_fim
medium
{ "lang": "python", "repo": "spring-epfl/zksk", "path": "/tests/test_examples.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: spring-epfl/zksk path: /tests/test_examples.py import os import sys import importlib import pytest <|fim_suffix|>@pytest.mark.parametrize("mod", EXAMPLE_MODULE_NAMES) def test_examples(mod): importlib.import_module("%s.%s" % (EXAMPLES_MOD, mod), PACKAGE_NAME)<|fim_middle|>PACKAGE_NAME = "zk...
code_fim
hard
{ "lang": "python", "repo": "spring-epfl/zksk", "path": "/tests/test_examples.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: abhinavshirur/WatchDocs path: /categories_db.py import pickle import sys from pymongo import MongoClient import sys <|fim_suffix|>client = MongoClient('localhost', 27017) db = client['watchdocs'] collection = db['categories'] categories=list() allcategories=set() with open("totalconc...
code_fim
medium
{ "lang": "python", "repo": "abhinavshirur/WatchDocs", "path": "/categories_db.py", "mode": "psm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|>for category in allcategories: post = {"category":category} post_id = collection.insert_one(post).inserted_id<|fim_prefix|># repo: abhinavshirur/WatchDocs path: /categories_db.py import pickle import sys from pymongo import MongoClient import sys reload(sys) sys.setdefaultencoding('utf8') c...
code_fim
hard
{ "lang": "python", "repo": "abhinavshirur/WatchDocs", "path": "/categories_db.py", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|>for category in categories: for category_one in category: allcategories.add(category_one) allcategories=sorted(allcategories) print(allcategories) print(len(allcategories)) for category in allcategories: post = {"category":category} post_id = collection.insert_one(post).inserted_id<|fim...
code_fim
medium
{ "lang": "python", "repo": "abhinavshirur/WatchDocs", "path": "/categories_db.py", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_prefix|># repo: BrandonBian/OSDR-GNN-Customized path: /GNN/train.py loss1 = nn.CrossEntropyLoss(weight=weights_l1)(logits_l1[is_labeled], batch.y1[is_labeled]) is_labeled = batch.y2 > 0 loss2 = nn.CrossEntropyLoss(weight=weights_l2)(logits_l2[is_labeled], batch.y2[is_labeled]) ...
code_fim
hard
{ "lang": "python", "repo": "BrandonBian/OSDR-GNN-Customized", "path": "/GNN/train.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> # TODO: store the test results of the material predictions - done for measure in ['micro', 'macro', 'weighted']: # store the data result[f'material test results']['f1'][measure]['data'].append( f1_score(material_p, material_t, average=measure, zero_division=0))...
code_fim
hard
{ "lang": "python", "repo": "BrandonBian/OSDR-GNN-Customized", "path": "/GNN/train.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: BrandonBian/OSDR-GNN-Customized path: /GNN/train.py self.num_class_l2, self.num_class_l3).to(self.device) elif args.network == 'linear': self.model = Linear(self.node_dim, self.hid_dim, self.num_class_l1, self.num_class_l2, self.num_class_l3)....
code_fim
hard
{ "lang": "python", "repo": "BrandonBian/OSDR-GNN-Customized", "path": "/GNN/train.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|>print('-' * 45) print('Panificadora Pão de Ontem - Tabela de preços') print('-' * 45) for cont in range (1, 51): print(f'{cont} - R$ {cont*preco_pao:.2f}') #":.2f" formatação de 2 casas depois do ponto. print('-' * 45)<|fim_prefix|># repo: Lorranysousc/ExerciciosDeRepeticao path: /ex30.py '''O Sr. Ma...
code_fim
medium
{ "lang": "python", "repo": "Lorranysousc/ExerciciosDeRepeticao", "path": "/ex30.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: Lorranysousc/ExerciciosDeRepeticao path: /ex30.py '''O Sr. Manoel Joaquim acaba de adquirir uma panificadora e pretende implantar a metodologia da tabelinha, que já é um sucesso na sua loja de 1,99. Você foi contratado para desenvolver o programa que monta a tabela de preços de pães, de 1 até 50 ...
code_fim
medium
{ "lang": "python", "repo": "Lorranysousc/ExerciciosDeRepeticao", "path": "/ex30.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> self.assertEqual(NSHashTableWeakMemory, NSPointerFunctionsWeakMemory) @expectedFailure def testFunctions(self): self.fail("NSHasTable functions") def testMethods(self): self.assertResultIsBOOL(NSHashTable.containsObject_) self.assertResultIsBOOL(NSHashTable.i...
code_fim
medium
{ "lang": "python", "repo": "GreatFruitOmsk/pyobjc-mirror", "path": "/pyobjc-framework-Cocoa/PyObjCTest/test_nshashtable.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> @min_os_level('10.8') def testConstants(self): self.assertEqual(NSHashTableWeakMemory, NSPointerFunctionsWeakMemory) @expectedFailure def testFunctions(self): self.fail("NSHasTable functions") def testMethods(self): self.assertResultIsBOOL(NSHashTable.contain...
code_fim
hard
{ "lang": "python", "repo": "GreatFruitOmsk/pyobjc-mirror", "path": "/pyobjc-framework-Cocoa/PyObjCTest/test_nshashtable.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: GreatFruitOmsk/pyobjc-mirror path: /pyobjc-framework-Cocoa/PyObjCTest/test_nshashtable.py from PyObjCTools.TestSupport import * from Foundation import * class TestNSHashTable (TestCase): def testConvenience(self): v = NSHashTable.hashTableWithOptions_(NSPointerFunctionsObjectPerson...
code_fim
hard
{ "lang": "python", "repo": "GreatFruitOmsk/pyobjc-mirror", "path": "/pyobjc-framework-Cocoa/PyObjCTest/test_nshashtable.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|>import voucher_api import views<|fim_prefix|># repo: jmcevoy1984/Phorest-Voucher-Maker path: /app.py from flask import Flask from flask_bootstrap import Bootstrap from navbar import nav <|fim_middle|>app = Flask(__name__) app.debug = True Bootstrap(app) nav.init_app(app)
code_fim
medium
{ "lang": "python", "repo": "jmcevoy1984/Phorest-Voucher-Maker", "path": "/app.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: jmcevoy1984/Phorest-Voucher-Maker path: /app.py from flask import Flask from flask_bootstrap import Bootstrap from navbar import nav <|fim_suffix|>import voucher_api import views<|fim_middle|>app = Flask(__name__) app.debug = True Bootstrap(app) nav.init_app(app)
code_fim
medium
{ "lang": "python", "repo": "jmcevoy1984/Phorest-Voucher-Maker", "path": "/app.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> pass def __setitem__(self, key, value): key = str(key) if key in self.__dict__.keys(): raise self.ConstError, "Can't rebind const (%s)" % key self.__dict__[key] = value def __getitem__(self, item): return self.__dict__[str(item)] def get(s...
code_fim
hard
{ "lang": "python", "repo": "BongOST/FindOST", "path": "/findost/foundation/parseConfig.py", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|> load_authority_config() load_conf('all') def load_authority_config(): """ 解析authority.conf文件 """ BASE_DIR = os.path.dirname(__file__) # 解析authority.conf authorityConfig = _AuthorityConfig() config_path_authority = os.path.abspath(os.path.join(BASE_DIR, os.pardir, 'con...
code_fim
hard
{ "lang": "python", "repo": "BongOST/FindOST", "path": "/findost/foundation/parseConfig.py", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_prefix|># repo: BongOST/FindOST path: /findost/foundation/parseConfig.py #!/usr/bin/env python # -*- coding:utf-8 -*- __author__ = 'LexusLee' import os import ConfigParser from foundation import const Loaded_Section_Or_File = [] class EnvironmentError(Exception): def __init__(self, conf_file, message): ...
code_fim
hard
{ "lang": "python", "repo": "BongOST/FindOST", "path": "/findost/foundation/parseConfig.py", "mode": "psm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_prefix|># repo: cuihaoleo/exercises path: /Schoolworks/NetworkProtocol_IP6Chat/chat_worker.py import select import logging import ipaddress import threading import struct import re import hashlib import socket import sys import queue import time import base64 import os import itertools from socket import AF_INE...
code_fim
hard
{ "lang": "python", "repo": "cuihaoleo/exercises", "path": "/Schoolworks/NetworkProtocol_IP6Chat/chat_worker.py", "mode": "psm", "license": "WTFPL", "source": "the-stack-v2" }
<|fim_suffix|> def send_who(self, host): self.__send("WHO", host) def send_msg(self, nick, message): if nick in self.nick2host: host = self.nick2host[nick] self.__send("MSG %s" % message, host) return True else: self.bcast_where(nick) ...
code_fim
hard
{ "lang": "python", "repo": "cuihaoleo/exercises", "path": "/Schoolworks/NetworkProtocol_IP6Chat/chat_worker.py", "mode": "spm", "license": "WTFPL", "source": "the-stack-v2" }
<|fim_prefix|># repo: beringresearch/ivis path: /tests/integration/test_neighbour_matrix.py from sklearn import datasets import numpy as np from ivis import Ivis def test_custom_ndarray_neighbour_matrix(): iris = datasets.load_iris() x = iris.data y = iris.target <|fim_suffix|> ivis_iris = Ivis(epoch...
code_fim
medium
{ "lang": "python", "repo": "beringresearch/ivis", "path": "/tests/integration/test_neighbour_matrix.py", "mode": "psm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|> ivis_iris = Ivis(epochs=5, neighbour_matrix=neighbour_matrix) ivis_iris.k = 15 ivis_iris.batch_size = 16 y_pred_iris = ivis_iris.fit_transform(x)<|fim_prefix|># repo: beringresearch/ivis path: /tests/integration/test_neighbour_matrix.py from sklearn import datasets import numpy as np fro...
code_fim
hard
{ "lang": "python", "repo": "beringresearch/ivis", "path": "/tests/integration/test_neighbour_matrix.py", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|> class_indicies = {label: np.argwhere(y == label).ravel() for label in np.unique(y)} neighbour_matrix = np.array([class_indicies[label] for label in y]) ivis_iris = Ivis(epochs=5, neighbour_matrix=neighbour_matrix) ivis_iris.k = 15 ivis_iris.batch_size = 16 y_pred_iris = ivis_iris...
code_fim
medium
{ "lang": "python", "repo": "beringresearch/ivis", "path": "/tests/integration/test_neighbour_matrix.py", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|> class Meta: ordering = ('-created_on',) def __init__(self, *args, **kwargs): # kwargs['created_by'] = 'admin' # kwargs['amended_by'] = 'admin' # import pdb # pdb.set_trace() super(Task, self).__init__(*args, **kwargs) def __unicode__(self): ...
code_fim
hard
{ "lang": "python", "repo": "webbyfox/tasklist", "path": "/tasklist/tasks/models.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: webbyfox/tasklist path: /tasklist/tasks/models.py from __future__ import unicode_literals from django.db import models from django.contrib.auth.models import User def get_user(): # current_user = auth.username return User.get_username() status_list = ( ('N', 'UNDONE'), ('Y', '...
code_fim
hard
{ "lang": "python", "repo": "webbyfox/tasklist", "path": "/tasklist/tasks/models.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: willnx/vlab_esrs path: /tests/test_esrs_view.py # -*- coding: UTF-8 -*- """ A suite of tests for the ESRSView object """ import unittest from unittest.mock import patch, MagicMock import ujson from flask import Flask from vlab_api_common import flask_common from vlab_api_common.http_auth import ...
code_fim
hard
{ "lang": "python", "repo": "willnx/vlab_esrs", "path": "/tests/test_esrs_view.py", "mode": "psm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|> task_id = resp.headers['Link'] expected = '<https://localhost/api/2/inf/esrs/task/asdf-asdf-asdf>; rel=status' self.assertEqual(task_id, expected) def test_get_image_task(self): """ESRSView - GET on /api/2/inf/esrs/image returns a task-id""" resp = self.app.ge...
code_fim
hard
{ "lang": "python", "repo": "willnx/vlab_esrs", "path": "/tests/test_esrs_view.py", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|> result = [] tree = build_trie(patterns) for s in range(len(text)): currentnode = tree[0] symbol = text[s] counter = s while True: if "$" in currentnode: result.append(s) break elif symbol in currentnode and counter != len(text): currentnode = tree[currentnode[symbol]] if c...
code_fim
medium
{ "lang": "python", "repo": "roctubre/data-structures-algorithms", "path": "/algorithms_on_strings/1.3_trie_matching_extended.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: roctubre/data-structures-algorithms path: /algorithms_on_strings/1.3_trie_matching_extended.py # python3 import sys def build_trie(patterns): tree = dict() tree[0] = dict() nodecount = 1 for p in patterns: p = p + "$" currentNode = tree[0] for i in range(l...
code_fim
hard
{ "lang": "python", "repo": "roctubre/data-structures-algorithms", "path": "/algorithms_on_strings/1.3_trie_matching_extended.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> def __call__(self, query): values = self.params values[self.query] = query data = urllib.urlencode(values) url = '{}?{}'.format(self.action, data) return addScore(parse(fetch(url)), query)<|fim_prefix|># repo: ktnyt/autosearch path: /autosearch/form.py import u...
code_fim
hard
{ "lang": "python", "repo": "ktnyt/autosearch", "path": "/autosearch/form.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: ktnyt/autosearch path: /autosearch/form.py import urllib import urllib2 from autosearch.utils import * class Form(object): def __init__(self, form): self.query = '' self.action = form['action'] self.params = {} for input in form.find_all('input'): ...
code_fim
hard
{ "lang": "python", "repo": "ktnyt/autosearch", "path": "/autosearch/form.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: CryptoGodfatherVA4/arbot path: /httputil.py import requests import decimal import json import logging <|fim_suffix|> r = requests.get(opts['url'], headers=opts['headers'], params=opts['params'], timeout=30) if r.status_code != 200: logging.warning(opts['url'] + " returned status " + str(...
code_fim
medium
{ "lang": "python", "repo": "CryptoGodfatherVA4/arbot", "path": "/httputil.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }