text
stringlengths
232
16.3k
domain
stringclasses
1 value
difficulty
stringclasses
3 values
meta
dict
<|fim_suffix|> """ Manipulations with pokemon types. """ @api.parameters(PaginationParameters()) @api.response(schemas.PokemonTypeSchema(many=True)) def get(self, args): """ List of pokemon types. Returns a list of pokemon types starting from ``offset`` limited by ``limi...
code_fim
hard
{ "lang": "python", "repo": "DurandA/pokemon-battle-api", "path": "/app/modules/pokemon_types/resources.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> @api.route('/') class PokemonTypes(Resource): """ Manipulations with pokemon types. """ @api.parameters(PaginationParameters()) @api.response(schemas.PokemonTypeSchema(many=True)) def get(self, args): """ List of pokemon types. Returns a list of pokemon ...
code_fim
hard
{ "lang": "python", "repo": "DurandA/pokemon-battle-api", "path": "/app/modules/pokemon_types/resources.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: DurandA/pokemon-battle-api path: /app/modules/pokemon_types/resources.py # encoding: utf-8 # pylint: disable=too-few-public-methods,invalid-name """ RESTful API Sport resources -------------------------- """ import logging import sqlalchemy from flask_login import current_user from flask_restpl...
code_fim
hard
{ "lang": "python", "repo": "DurandA/pokemon-battle-api", "path": "/app/modules/pokemon_types/resources.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> trial_num = 50 policy = LinEpsilonGreedy(n_actions=2, dim=2, epsilon=0.0) # policy type assert policy.policy_type == PolicyType.CONTEXTUAL context = np.array([1.0, 1.0]).reshape(1, -1) policy.update_params(action=0, reward=1.0, context=context) policy.update_params(action=0, ...
code_fim
hard
{ "lang": "python", "repo": "han20192019/newRL", "path": "/tests/policy/test_linear.py", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|> def test_lin_ucb_initialize(): # note that the meaning of epsilon is different from that of LinEpsilonGreedy with pytest.raises(ValueError): LinUCB(n_actions=2, dim=2, epsilon=-0.2) n_actions = 3 dim = 2 policy = LinUCB(n_actions=n_actions, dim=dim, epsilon=2.0) assert po...
code_fim
hard
{ "lang": "python", "repo": "han20192019/newRL", "path": "/tests/policy/test_linear.py", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_prefix|># repo: han20192019/newRL path: /tests/policy/test_linear.py import numpy as np import pytest from obp.policy.linear import LinEpsilonGreedy from obp.policy.linear import LinTS from obp.policy.linear import LinUCB from obp.policy.policy_type import PolicyType def test_linear_base_exception(): # in...
code_fim
hard
{ "lang": "python", "repo": "han20192019/newRL", "path": "/tests/policy/test_linear.py", "mode": "psm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|> class Test_find_import_info(TestCase): def find_import_info(self, package, name, string): node = parse(string) return fixer_utils.find_import_info(package, name, node) def test(self): package, name, binding, string = ('mod2', 'AnotherClass', 'bar', ...
code_fim
hard
{ "lang": "python", "repo": "ezragoss/typewriter", "path": "/typeright/fixes/tests/test_util.py", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|> class Test_create_type_checking_import(TestCase): def create_type_checking_import(self, package, name, string): node = parse(string) fixer_utils.create_type_checking_import(package, name, node) return node def test(self): string = """ import a impo...
code_fim
hard
{ "lang": "python", "repo": "ezragoss/typewriter", "path": "/typeright/fixes/tests/test_util.py", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_prefix|># repo: ezragoss/typewriter path: /typeright/fixes/tests/test_util.py """ Test suite for the code in fixer_utils """ # Local imports from lib2to3.fixer_util import Attr, Call, Comma, Name, is_import, syms from lib2to3.pgen2 import token from lib2to3.pytree import Leaf, Node from lib2to3.tests.support im...
code_fim
hard
{ "lang": "python", "repo": "ezragoss/typewriter", "path": "/typeright/fixes/tests/test_util.py", "mode": "psm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|> Variables: pattern {str} -- str of a regExp pattern flags {list} -- A list of regExp flags text {[str]} -- A text to match the regExp pattern against methods {[dict]} -- dictionary of regExp methods where the keys are str of regExp methods and the values are the...
code_fim
hard
{ "lang": "python", "repo": "samshultz/regex-matcher", "path": "/regTest/utils.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: samshultz/regex-matcher path: /regTest/utils.py import re def regex_methods(): return { 're.search': re.search, 're.match': re.match, 're.fullmatch': re.fullmatch, 're.findall': re.findall, 're.finditer': re.finditer, } def process_regex_form_data(pattern, flags, tex...
code_fim
hard
{ "lang": "python", "repo": "samshultz/regex-matcher", "path": "/regTest/utils.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: lewtun/huggingface_hub path: /api-inference-community/docker_images/generic/app/batch.py #!/usr/bin/env python import io import os import datasets import tqdm from app.main import get_pipeline from huggingface_hub import HfApi DATASET_NAME = os.getenv("DATASET_NAME") DATASET_CONFIG = os.getenv...
code_fim
hard
{ "lang": "python", "repo": "lewtun/huggingface_hub", "path": "/api-inference-community/docker_images/generic/app/batch.py", "mode": "psm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|>def iterate_slow(pipe, dataset, f): for i, item in enumerate(tqdm.tqdm(dataset)): try: result = pipe(item) except Exception as e: result = {"error": str(e)} f.write(str(result).encode("utf-8")) f.write(b"\n") def main(): dset = datasets.lo...
code_fim
medium
{ "lang": "python", "repo": "lewtun/huggingface_hub", "path": "/api-inference-community/docker_images/generic/app/batch.py", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|> f.seek(0) api = HfApi() repo_id = REPO_ID try: api.upload_file(TOKEN, f, filename, repo_id, repo_type="dataset") except Exception: pass if __name__ == "__main__": main()<|fim_prefix|># repo: lewtun/huggingface_hub path: /api-inference-community/docker_images/gen...
code_fim
hard
{ "lang": "python", "repo": "lewtun/huggingface_hub", "path": "/api-inference-community/docker_images/generic/app/batch.py", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_prefix|># repo: bismog/leetcode path: /python/app.py #!/usr/bin/env python from __future__ import print_function from oslo.config import cfg # here name 'simple' should match with section name in *.conf opt_group = cfg.OptGroup(name='simple', title='A Simple Example') # format: name + title simple_opts = [cfg...
code_fim
medium
{ "lang": "python", "repo": "bismog/leetcode", "path": "/python/app.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|>if __name__ == "__main__": CONF(default_config_files=['app.conf']) #print(CONF.simple.enable) #cmladd: here will print True #print(CONF.simple.xxx) print(CONF.default.topic) print(CONF.default.say)<|fim_prefix|># repo: bismog/leetcode path: /python/app.py #!/usr/bin/env python fr...
code_fim
medium
{ "lang": "python", "repo": "bismog/leetcode", "path": "/python/app.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> summary_writer = SummaryWriter(data_dir) training_envs = safelife_env_factory( logdir=data_dir, summary_writer=summary_writer, num_envs=16, impact_penalty=linear_schedule(t_penalty, [0, penalty]), min_performance=linear_schedule(t_performanc...
code_fim
hard
{ "lang": "python", "repo": "neale/avoiding-side-effects", "path": "/train", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_prefix|># repo: neale/avoiding-side-effects path: /train #!/usr/bin/env python3 """ Main entry point for starting a training job. """ import os import sys import argparse import subprocess import shutil import logging import logging.config import numpy as np env_types = [ 'test', 'append-still', ...
code_fim
hard
{ "lang": "python", "repo": "neale/avoiding-side-effects", "path": "/train", "mode": "psm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|> dependencies = [ ("process", "0016_auto_20210217_1233"), ] operations = [ migrations.RemoveConstraint( model_name="processingstep", name="unique_collection_file_item_name", ), ]<|fim_prefix|># repo: open-contracting/kingfisher-process path:...
code_fim
easy
{ "lang": "python", "repo": "open-contracting/kingfisher-process", "path": "/process/migrations/0017_auto_20210217_1340.py", "mode": "spm", "license": "BSD-3-Clause", "source": "the-stack-v2" }
<|fim_prefix|># repo: open-contracting/kingfisher-process path: /process/migrations/0017_auto_20210217_1340.py # Generated by Django 3.0.4 on 2021-02-17 13:40 <|fim_suffix|>class Migration(migrations.Migration): dependencies = [ ("process", "0016_auto_20210217_1233"), ] operations = [ mig...
code_fim
easy
{ "lang": "python", "repo": "open-contracting/kingfisher-process", "path": "/process/migrations/0017_auto_20210217_1340.py", "mode": "psm", "license": "BSD-3-Clause", "source": "the-stack-v2" }
<|fim_suffix|>token = None __all__ = [ '__version__', 'API', 'AccernClient', 'HistoricalClient', 'Schema', 'StreamClient', 'StreamListener', 'set_config_file', 'get_config_file', ]<|fim_prefix|># repo: Accern/accern-python path: /accern/__init__.py """Accern: python library for Acc...
code_fim
hard
{ "lang": "python", "repo": "Accern/accern-python", "path": "/accern/__init__.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: Accern/accern-python path: /accern/__init__.py """Accern: python library for Accern API. Accern is a python library to query, download, filter and save Accern Data. """ <|fim_suffix|>token = None __all__ = [ '__version__', 'API', 'AccernClient', 'HistoricalClient', 'Schema'...
code_fim
hard
{ "lang": "python", "repo": "Accern/accern-python", "path": "/accern/__init__.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|>__all__ = [ '__version__', 'API', 'AccernClient', 'HistoricalClient', 'Schema', 'StreamClient', 'StreamListener', 'set_config_file', 'get_config_file', ]<|fim_prefix|># repo: Accern/accern-python path: /accern/__init__.py """Accern: python library for Accern API. Acce...
code_fim
hard
{ "lang": "python", "repo": "Accern/accern-python", "path": "/accern/__init__.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> def forward(self, variational_dist_f, target, **kwargs): r""" Computes the Variational ELBO given :math:`q(\mathbf f)` and :math:`\mathbf y`. Calling this function will call the likelihood's :meth:`~gpytorch.likelihoods.Likelihood.expected_log_prob` function. :...
code_fim
medium
{ "lang": "python", "repo": "cornellius-gp/gpytorch", "path": "/gpytorch/mlls/variational_elbo.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> r""" Computes the Variational ELBO given :math:`q(\mathbf f)` and :math:`\mathbf y`. Calling this function will call the likelihood's :meth:`~gpytorch.likelihoods.Likelihood.expected_log_prob` function. :param ~gpytorch.distributions.MultivariateNormal variational_...
code_fim
hard
{ "lang": "python", "repo": "cornellius-gp/gpytorch", "path": "/gpytorch/mlls/variational_elbo.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: cornellius-gp/gpytorch path: /gpytorch/mlls/variational_elbo.py #!/usr/bin/env python3 from ._approximate_mll import _ApproximateMarginalLogLikelihood class VariationalELBO(_ApproximateMarginalLogLikelihood): r""" The variational evidence lower bound (ELBO). This is used to optimize ...
code_fim
medium
{ "lang": "python", "repo": "cornellius-gp/gpytorch", "path": "/gpytorch/mlls/variational_elbo.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> :param snapshot_name: Snapshot name from which to clone the source file or LUN. If not specified, the contents of in the active filesystem will be used. This field is available in Data ONTAP 8.1 or later :param change_log: If this option is "true", ...
code_fim
hard
{ "lang": "python", "repo": "radekg/netapp-ontap-lib-gen", "path": "/generated-libraries/python/netapp/clone/__init__.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: radekg/netapp-ontap-lib-gen path: /generated-libraries/python/netapp/clone/__init__.py ion): def clone_list_status(self, clone_id=None): """ Gets the information of a clone operations identified by clone-id. If clone-id is not specified, then it will get the ...
code_fim
hard
{ "lang": "python", "repo": "radekg/netapp-ontap-lib-gen", "path": "/generated-libraries/python/netapp/clone/__init__.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> :param bypass_license_check: If set to 'true', allows clone create without FlexClone license. Default value is false. THIS INPUT IS CURRENTLY SUPPORTED FOR USE ONLY BY SNAPDRIVE TEAM, ANY OTHER USE IS NOT SUPPORTED. :param qos_policy...
code_fim
hard
{ "lang": "python", "repo": "radekg/netapp-ontap-lib-gen", "path": "/generated-libraries/python/netapp/clone/__init__.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: mesalock-linux/mesapy path: /pypy/module/test_lib_pypy/cffi_tests/embedding/add1.py # Generated by pypy/tool/import_cffi.py import cffi ffi = cffi.FFI() ffi.embedding_api(""" int add1(int, int); """) ffi.embedding_init_code(r""" import sys, time sys.stdout.write("preparing") fo...
code_fim
hard
{ "lang": "python", "repo": "mesalock-linux/mesapy", "path": "/pypy/module/test_lib_pypy/cffi_tests/embedding/add1.py", "mode": "psm", "license": "BSD-3-Clause", "source": "the-stack-v2" }
<|fim_suffix|>ffi.embedding_init_code(r""" import sys, time sys.stdout.write("preparing") for i in range(3): sys.stdout.flush() time.sleep(0.02) sys.stdout.write(".") sys.stdout.write("\n") from _add1_cffi import ffi int(ord("A")) # check that built-ins are there ...
code_fim
medium
{ "lang": "python", "repo": "mesalock-linux/mesapy", "path": "/pypy/module/test_lib_pypy/cffi_tests/embedding/add1.py", "mode": "spm", "license": "BSD-3-Clause", "source": "the-stack-v2" }
<|fim_suffix|> js_result = f"""document.getElementById("{i}_{j}").classList.remove("row_block_divider");\n""" js_result += f"""document.getElementById("{i}_{j}").classList.remove("col_block_divider");\n""" js_result += f"""document.getElementById("{i}_{j}").classList.add("no_border");\n""" ...
code_fim
hard
{ "lang": "python", "repo": "easyuxd/seedsigner", "path": "/docs/seed_qr/printable_templates/template_generator.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: easyuxd/seedsigner path: /docs/seed_qr/printable_templates/template_generator.py import math def generate_qr_template(qr_size, num_words=24, block_size=5, show_timing_marks=False): if num_words == 24: word_cols = 2 else: word_cols = 1 html = """ <html> <l...
code_fim
hard
{ "lang": "python", "repo": "easyuxd/seedsigner", "path": "/docs/seed_qr/printable_templates/template_generator.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: asyre/bachelor_degree path: /executor/meta/env.py from typing import Any, Optional from executor.meta.env_var import must_extract_env_var_if_present from executor.meta.meta import set_meta_information, has_meta_information, get_meta_information __env_key = "env" def has_env(obj: Any) -> bool:...
code_fim
medium
{ "lang": "python", "repo": "asyre/bachelor_degree", "path": "/executor/meta/env.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> def __decorator(func): set_meta_information(func, __env_key, must_extract_env_var_if_present(path)) return func return __decorator<|fim_prefix|># repo: asyre/bachelor_degree path: /executor/meta/env.py from typing import Any, Optional from executor.meta.env_var import must_extra...
code_fim
medium
{ "lang": "python", "repo": "asyre/bachelor_degree", "path": "/executor/meta/env.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> set_meta_information(func, __env_key, must_extract_env_var_if_present(path)) return func return __decorator<|fim_prefix|># repo: asyre/bachelor_degree path: /executor/meta/env.py from typing import Any, Optional from executor.meta.env_var import must_extract_env_var_if_present from ...
code_fim
hard
{ "lang": "python", "repo": "asyre/bachelor_degree", "path": "/executor/meta/env.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: cash2one/xai path: /xai/brain/wordbase/verbs/_founding.py from xai.brain.wordbase.verbs._found import _FOUND <|fim_suffix|> def __init__(self,): _FOUND.__init__(self) self.name = "FOUNDING" self.specie = 'verbs' self.basic = "found" self.jsondata = {}<|fim_middle|>#calss header clas...
code_fim
easy
{ "lang": "python", "repo": "cash2one/xai", "path": "/xai/brain/wordbase/verbs/_founding.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> _FOUND.__init__(self) self.name = "FOUNDING" self.specie = 'verbs' self.basic = "found" self.jsondata = {}<|fim_prefix|># repo: cash2one/xai path: /xai/brain/wordbase/verbs/_founding.py from xai.brain.wordbase.verbs._found import _FOUND #calss header class _FOUNDING(_FOUND, ): <|fim_middle|>...
code_fim
easy
{ "lang": "python", "repo": "cash2one/xai", "path": "/xai/brain/wordbase/verbs/_founding.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: Ved005/project-euler-solutions path: /code/hexagonal_orchards/sol_351.py # -*- coding: utf-8 -*- ''' File name: code\hexagonal_orchards\sol_351.py Author: Vaidic Joshi Date created: Oct 20, 2018 Python Version: 3.x ''' # Solution to Project Euler Problem #351 :: Hexagonal orchar...
code_fim
medium
{ "lang": "python", "repo": "Ved005/project-euler-solutions", "path": "/code/hexagonal_orchards/sol_351.py", "mode": "psm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|> Let H(n) be the number of points hidden from the center in a hexagonal orchard of order n. H(5) = 30. H(10) = 138. H(1 000) = 1177848. Find H(100 000 000). ''' # Solution # Solution Approach ''' '''<|fim_prefix|># repo: Ved005/project-euler-solutions path: /code/hexagonal_orchards/sol_351.py ...
code_fim
medium
{ "lang": "python", "repo": "Ved005/project-euler-solutions", "path": "/code/hexagonal_orchards/sol_351.py", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|> Highlighted in green are the points which are hidden from the center by a point closer to it. It can be seen that for a hexagonal orchard of order 5, 30 points are hidden from the center. Let H(n) be the number of points hidden from the center in a hexagonal orchard of order n. H(5) = 30. H(10) =...
code_fim
hard
{ "lang": "python", "repo": "Ved005/project-euler-solutions", "path": "/code/hexagonal_orchards/sol_351.py", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_prefix|># repo: castorini/d-bert path: /dbert/generate/build_bpe.py import argparse import random import sys from tqdm import tqdm import torch def main(): parser = argparse.ArgumentParser() parser.add_argument('--sample-break', default=0, type=float) parser.add_argument('--seed', default=0, type=...
code_fim
medium
{ "lang": "python", "repo": "castorini/d-bert", "path": "/dbert/generate/build_bpe.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> random.seed(args.seed) for line in tqdm(training_ds.sentences, desc='Writing'): print(line) for _ in range(args.n_iter): roll = random.random() if roll < args.sample_break: roll /= args.sample_break a = int(roll * (len(line) -...
code_fim
medium
{ "lang": "python", "repo": "castorini/d-bert", "path": "/dbert/generate/build_bpe.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: lucaslk122/Programas-python path: /g´rafico mundial.py # -*- coding: utf-8 -*- """ Spyder Editor Este é u<|fim_suffix|>ib.pyplot as plt plt.figure() plt.subplot(111, projection="aitoff") plt.title("Aitoff") plt.grid(True)<|fim_middle|>m arquivo de script temporário. """ import matplotl
code_fim
easy
{ "lang": "python", "repo": "lucaslk122/Programas-python", "path": "/g´rafico mundial.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|>ection="aitoff") plt.title("Aitoff") plt.grid(True)<|fim_prefix|># repo: lucaslk122/Programas-python path: /g´rafico mundial.py # -*- coding: utf-8 -*- """ Spyder Editor Este é um arquivo de script temporário. """ import matplotl<|fim_middle|>ib.pyplot as plt plt.figure() plt.subplot(111, proj
code_fim
easy
{ "lang": "python", "repo": "lucaslk122/Programas-python", "path": "/g´rafico mundial.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> urlopen_mock.start() self.collector.collect() urlopen_mock.stop() metrics = self.getPickledResults("real_stat.pkl") self.assertPublishedMany(publish_mock, metrics)<|fim_prefix|># repo: python-diamond/Diamond path: /src/collectors/httpjson/test/testhttpjson.py #!/...
code_fim
hard
{ "lang": "python", "repo": "python-diamond/Diamond", "path": "/src/collectors/httpjson/test/testhttpjson.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: python-diamond/Diamond path: /src/collectors/httpjson/test/testhttpjson.py #!/usr/bin/python # coding=utf-8 ########################################################################## from test import CollectorTestCase from test import get_collector_config from mock import Mock from mock import pa...
code_fim
medium
{ "lang": "python", "repo": "python-diamond/Diamond", "path": "/src/collectors/httpjson/test/testhttpjson.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> urlopen_mock = patch('urllib2.urlopen', Mock(return_value=self.getFixture('stats.json'))) urlopen_mock.start() self.collector.collect() urlopen_mock.stop() metrics = self.getPickledResults("real_stat.pkl") self.assertPublished...
code_fim
medium
{ "lang": "python", "repo": "python-diamond/Diamond", "path": "/src/collectors/httpjson/test/testhttpjson.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> def _get_next_coref_id(self): ''' yield incrementing coreference ids. ''' try: self.next_coref_id += 1 except AttributeError: self.next_coref_id = 1 return self.next_coref_id - 1 def _link_references(self): ''' Create a link from each mention's tokens back to the mention, and ...
code_fim
hard
{ "lang": "python", "repo": "networkdynamics/attribution-extraction", "path": "/source/intermediaries/nlpReaders/annotated_text.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> def fix_word(self, word): if word == '-LRB-': return '(' if word == '-RRB-': return ')' return word.encode('utf8')#.decode('unicode-escape') def __str__(self): sentence_strings = [] for i, s in enumerate(self.sentences): tokens = ' '.join([t['word'] for t in s['tokens']]) senten...
code_fim
hard
{ "lang": "python", "repo": "networkdynamics/attribution-extraction", "path": "/source/intermediaries/nlpReaders/annotated_text.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: networkdynamics/attribution-extraction path: /source/intermediaries/nlpReaders/annotated_text.py tive': new_mention } new_mention['reference'] = ref self.references.append(ref) # Add the mention to the sentence try: sentence['mentions'].append(new_mention) except KeyError: sent...
code_fim
hard
{ "lang": "python", "repo": "networkdynamics/attribution-extraction", "path": "/source/intermediaries/nlpReaders/annotated_text.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: MddeLip/MODIS_AOD_PM25 path: /扩展库和扩展程序/程序/包含文件名测试.py # -*- coding: utf-8 -*- # 日期: 2019/3/6 21:23 # 作者: xcl # 工具:PyCharm <|fim_suffix|># 批量读取 file_name = os.listdir(input_file_path) # 文件名 for name in file_name: if location in name: print(name)<|fim_middle|>import pandas as pd import...
code_fim
medium
{ "lang": "python", "repo": "MddeLip/MODIS_AOD_PM25", "path": "/扩展库和扩展程序/程序/包含文件名测试.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|># 批量读取 file_name = os.listdir(input_file_path) # 文件名 for name in file_name: if location in name: print(name)<|fim_prefix|># repo: MddeLip/MODIS_AOD_PM25 path: /扩展库和扩展程序/程序/包含文件名测试.py # -*- coding: utf-8 -*- # 日期: 2019/3/6 21:23 # 作者: xcl # 工具:PyCharm <|fim_middle|>import pandas as pd import...
code_fim
medium
{ "lang": "python", "repo": "MddeLip/MODIS_AOD_PM25", "path": "/扩展库和扩展程序/程序/包含文件名测试.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: mst-solar-car/kicad-bom-generator path: /Formatter/json_formatter.py import json import Formatter import Config import Arguments import Logger args = Arguments.Parse() cfg = Config.Get() @Formatter.Register("json") def json_formatter(components): <|fim_suffix|> for component in components: ...
code_fim
medium
{ "lang": "python", "repo": "mst-solar-car/kicad-bom-generator", "path": "/Formatter/json_formatter.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> # Save the json file save_path = args.output_file try: with open(save_path, "w") as file: file.write(result) Logger.Debug("Output saved to", save_path) return save_path except: Logger.Error("Could not save output to", save_path)<|fim_prefix|># repo: mst-solar-car/kicad-bo...
code_fim
medium
{ "lang": "python", "repo": "mst-solar-car/kicad-bom-generator", "path": "/Formatter/json_formatter.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> #### TEST if integral is same as scattering asf = mc._get_angular_scatt_func() natural = asf.natural.values theta = asf.index.values natural = natural[theta < np.pi] # to ensure integration from 0 to pi theta = theta[theta < np.pi] isf = integrate.s...
code_fim
hard
{ "lang": "python", "repo": "hagne/mie-py", "path": "/mie_py/tests/tests.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: hagne/mie-py path: /mie_py/tests/tests.py from unittest import TestCase import mie_py import numpy as np from scipy import integrate class TestBohrenHuffman(TestCase): def test_compare2online_calculator(self, test_threshold = 1e-4, verbose=False, raiseError=True): """Test against the...
code_fim
hard
{ "lang": "python", "repo": "hagne/mie-py", "path": "/mie_py/tests/tests.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> return test_passed def test_angular_scattering_func_integral(self, test_threshold = 1e-4, verbose=False, raiseError=True): """This test makes sure the integral over the the entire angular scattering function is equal (deviates less than 1e-4) to the overall scattering crossec...
code_fim
hard
{ "lang": "python", "repo": "hagne/mie-py", "path": "/mie_py/tests/tests.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> path('change-port', views.ChangePort.as_view()), path('start-ga', views.StartGA.as_view()), path('stop-ga', views.StopGA.as_view()), path('check-ga', views.CheckGA.as_view()), path('get-arch-details', views.GetArchDetails.as_view()), path('get-subobjective-details', views.GetSubo...
code_fim
medium
{ "lang": "python", "repo": "gapaza/daphne_brain", "path": "/VASSAR_API/urls.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> path('get-arch-details', views.GetArchDetails.as_view()), path('get-subobjective-details', views.GetSubobjectiveDetails.as_view()) ]<|fim_prefix|># repo: gapaza/daphne_brain path: /VASSAR_API/urls.py from django.urls import path from . import views urlpatterns = [ path('get-orbit-list', vie...
code_fim
medium
{ "lang": "python", "repo": "gapaza/daphne_brain", "path": "/VASSAR_API/urls.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: gapaza/daphne_brain path: /VASSAR_API/urls.py from django.urls import path from . import views urlpatterns = [ path('get-orbit-list', views.GetOrbitList.as_view()), path('get-instrument-list', views.GetInstrumentList.as_view()), path('evaluate-architecture', views.EvaluateArchi...
code_fim
medium
{ "lang": "python", "repo": "gapaza/daphne_brain", "path": "/VASSAR_API/urls.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: annamatveev/Cremeschnitte path: /Filters/CommentFilter.py from Rules.CommentToIndicativeWordsInTitleRule import CommentToIndicativeWordsInTitleRule from Rules.AskingForHelpTitlePostRule import AskingForHelpTitlePostRule from Rules.HighlyRatedCommentRule import HighlyRatedCommentRule from Rules.Lo...
code_fim
hard
{ "lang": "python", "repo": "annamatveev/Cremeschnitte", "path": "/Filters/CommentFilter.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> @staticmethod def filter_comment_leads_in_posts(subreddit): leads = [] post_leads_with_indicative_words = Pipe.run(subreddit.new(limit=PrawConfig.POST_LIMIT), [AskingForHelpTitlePostRule]) if post_leads_with_indicative_wor...
code_fim
hard
{ "lang": "python", "repo": "annamatveev/Cremeschnitte", "path": "/Filters/CommentFilter.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: leon0707/docker-nginx-uWSGI-flask path: /email_service_consumer/email_plugin.py import smtplib from os import environ from email.mime.multipart import MIMEMultipart from email.mime.text import MIMEText if environ.get('SMTP_SERVER') is None: raise ValueError('SMTP_SERVER is not configured') ...
code_fim
medium
{ "lang": "python", "repo": "leon0707/docker-nginx-uWSGI-flask", "path": "/email_service_consumer/email_plugin.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> server = smtplib.SMTP(host=environ['SMTP_SERVER'], port=environ['SMTP_PORT']) server.starttls() server.login(environ['SENDER_EMAIL'], environ['SENDER_PASSWORD']) msg = MIMEMultipart() msg['From']=environ['SENDER_EMAIL'] msg['To']=email_json['To'] msg['Subject']=email_json['Su...
code_fim
hard
{ "lang": "python", "repo": "leon0707/docker-nginx-uWSGI-flask", "path": "/email_service_consumer/email_plugin.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|>if environ.get('SENDER_PASSWORD') is None: raise ValueError('SMTP_PASSWORD is not configured') def send_email(email_json): server = smtplib.SMTP(host=environ['SMTP_SERVER'], port=environ['SMTP_PORT']) server.starttls() server.login(environ['SENDER_EMAIL'], environ['SENDER_PASSWORD']) ...
code_fim
medium
{ "lang": "python", "repo": "leon0707/docker-nginx-uWSGI-flask", "path": "/email_service_consumer/email_plugin.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: GuardSkill/onnx-pytorch path: /onnx_pytorch/op_code_generators/Conv.py import logging import onnx import onnx.numpy_helper import torch from onnx_pytorch.op_code_generators import OpCodeGenerator class ConvOpCodeGenerator(OpCodeGenerator): def __init__(self, onnx_ver=onn...
code_fim
hard
{ "lang": "python", "repo": "GuardSkill/onnx-pytorch", "path": "/onnx_pytorch/op_code_generators/Conv.py", "mode": "psm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|> return '''def compatible_auto_pad(self, input, kernel_spatial_shape, nn_mod, auto_pad=None, **kwargs): input_spatial_shape = input.shape[2:] d = len(input_spatial_shape) strides = nn_mod.stride dilations = nn_mod.dilation output_spatial_shape = [math.ceil(float(l) / float(r)) f...
code_fim
hard
{ "lang": "python", "repo": "GuardSkill/onnx-pytorch", "path": "/onnx_pytorch/op_code_generators/Conv.py", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|> forward_str.append(f"{outputs_str[0]} = F.conv2d({inputs_str[0]},{inputs_str[1]},**{{{params_str}}})") return {"init": init_str, "forward": forward_str} @staticmethod def gen_method(): return '''def compatible_auto_pad(self, input, kernel_spatial_shape, nn_mod, auto...
code_fim
hard
{ "lang": "python", "repo": "GuardSkill/onnx-pytorch", "path": "/onnx_pytorch/op_code_generators/Conv.py", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_prefix|># repo: pnsn/squacapi path: /app/invite/urls.py from django.urls import path from invite import views app<|fim_suffix|>InviteView.as_view(), name='user-invite'), path('register/', views.RegisterView.as_view(), name='user-register') ]<|fim_middle|>_name = 'invite' urlpatterns = [ path('invite/', ...
code_fim
easy
{ "lang": "python", "repo": "pnsn/squacapi", "path": "/app/invite/urls.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|>InviteView.as_view(), name='user-invite'), path('register/', views.RegisterView.as_view(), name='user-register') ]<|fim_prefix|># repo: pnsn/squacapi path: /app/invite/urls.py from django.urls import path from invite import views app<|fim_middle|>_name = 'invite' urlpatterns = [ path('invite/', ...
code_fim
easy
{ "lang": "python", "repo": "pnsn/squacapi", "path": "/app/invite/urls.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|>def test_post_data(test_case, page, data): """ Test whether a post request can successfully be made to the page. :param test_case: test class, must be an instance of unittest.TestCase :param page: str with the page of the flask_monitoringdashboard :param data: the data that should be p...
code_fim
hard
{ "lang": "python", "repo": "phamngocquy/Flask-MonitoringDashboard", "path": "/flask_monitoringdashboard/test/utils.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> def get_test_app(schedule=False): """ :return: Flask Test Application with the right settings """ import flask_monitoringdashboard from flask import redirect, url_for user_app = Flask(__name__) @user_app.route('/') def main(): return redirect(url_for('dashboard.i...
code_fim
hard
{ "lang": "python", "repo": "phamngocquy/Flask-MonitoringDashboard", "path": "/flask_monitoringdashboard/test/utils.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: phamngocquy/Flask-MonitoringDashboard path: /flask_monitoringdashboard/test/utils.py """ Some useful functions for setting up the testing environment, adding data, etc.. """ import datetime from flask import Flask, json from flask_monitoringdashboard.core.cache import EndpointInfo NAME = '...
code_fim
hard
{ "lang": "python", "repo": "phamngocquy/Flask-MonitoringDashboard", "path": "/flask_monitoringdashboard/test/utils.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> if not os.path.isdir(camdir + "/tmp"): os.mkdir(camdir + "/tmp")<|fim_prefix|># repo: Liveshort/astroplant-camera-module path: /astroplant_camera_module/setup.py import os def check_directories(root_directory): """ Sets up the necessary directories for the camera to work. Everything ...
code_fim
hard
{ "lang": "python", "repo": "Liveshort/astroplant-camera-module", "path": "/astroplant_camera_module/setup.py", "mode": "spm", "license": "BSD-2-Clause", "source": "the-stack-v2" }
<|fim_suffix|> if not os.path.isdir(camdir + "/cfg"): os.mkdir(camdir + "/cfg") if not os.path.isdir(camdir + "/img"): os.mkdir(camdir + "/img") if not os.path.isdir(camdir + "/res"): os.mkdir(camdir + "/res") if not os.path.isdir(camdir + "/tmp"): os.mkdir(camdir + "/t...
code_fim
medium
{ "lang": "python", "repo": "Liveshort/astroplant-camera-module", "path": "/astroplant_camera_module/setup.py", "mode": "spm", "license": "BSD-2-Clause", "source": "the-stack-v2" }
<|fim_prefix|># repo: Liveshort/astroplant-camera-module path: /astroplant_camera_module/setup.py import os def check_directories(root_directory): """ Sets up the necessary directories for the camera to work. Everything is created relative to the root directory supplied by the user. """ camdir = root...
code_fim
medium
{ "lang": "python", "repo": "Liveshort/astroplant-camera-module", "path": "/astroplant_camera_module/setup.py", "mode": "psm", "license": "BSD-2-Clause", "source": "the-stack-v2" }
<|fim_prefix|># repo: kuanfandevops/tfrs path: /backend/api/permissions/DocumentComment.py """ REST API Documentation for the NRS TFRS Credit Trading Application The Transportation Fuels Reporting System is being designed to streamline compliance reporting for transportation fuel suppliers in accordance w...
code_fim
hard
{ "lang": "python", "repo": "kuanfandevops/tfrs", "path": "/backend/api/permissions/DocumentComment.py", "mode": "psm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|> # Need this information to make a decision if 'privileged_access' not in request.data and \ 'document' in request.data: return False document = request.data['document'] privileged_access = request.data['privileged_access'] found = Docum...
code_fim
hard
{ "lang": "python", "repo": "kuanfandevops/tfrs", "path": "/backend/api/permissions/DocumentComment.py", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_prefix|># repo: lidaan/issm_python path: /simulations/nioghalvfjerdsbrae/issm/gen_nio_contour.py import cslvr as cs import numpy as np #=============================================================================== # data preparation : out_dir = '../dump/meshes/issm/' mesh_name = 'nioghalvfjerdsbrae' # get ...
code_fim
hard
{ "lang": "python", "repo": "lidaan/issm_python", "path": "/simulations/nioghalvfjerdsbrae/issm/gen_nio_contour.py", "mode": "psm", "license": "BSD-3-Clause", "source": "the-stack-v2" }
<|fim_suffix|>#=============================================================================== # process the file and extrude : m.eliminate_intersections(dist=200) # eliminate interscting lines m.check_dist() # remove points too close m.write_argus_contour() ...
code_fim
hard
{ "lang": "python", "repo": "lidaan/issm_python", "path": "/simulations/nioghalvfjerdsbrae/issm/gen_nio_contour.py", "mode": "spm", "license": "BSD-3-Clause", "source": "the-stack-v2" }
<|fim_suffix|> """Parse one element of ``--output-spaces``. >>> output_space('MNI152NLin2009cAsym') ('MNI152NLin2009cAsym', {}) >>> output_space('MNI152NLin2009cAsym:native') ('MNI152NLin2009cAsym', {'native': True}) >>> output_space('MNI152NLin2009cAsym:res-2') ('MNI152NLin2009cAsym', {'r...
code_fim
medium
{ "lang": "python", "repo": "bpinsard/smriprep", "path": "/smriprep/cli/utils.py", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_prefix|># repo: bpinsard/smriprep path: /smriprep/cli/utils.py # emacs: -*- mode: python; py-indent-offset: 4; indent-tabs-mode: nil -*- # vi: set ft=python sts=4 ts=4 sw=4 et: """ CLI Utilities """ from argparse import Action class ParseTemplates(Action): """Manipulate a string of templates with modifiers...
code_fim
hard
{ "lang": "python", "repo": "bpinsard/smriprep", "path": "/smriprep/cli/utils.py", "mode": "psm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|>def _template(inlist): """ Return an OrderedDict with templates >>> list(_template(['MNI152NLin2009c']).keys()) ['MNI152NLin2009c'] >>> _template(['MNI152NLin2009c', 'MNI152NLin2009c:res-2']) OrderedDict([('MNI152NLin2009c', {})]) >>> _template(['MNI152NLin2009c', 'MNI152NL...
code_fim
medium
{ "lang": "python", "repo": "bpinsard/smriprep", "path": "/smriprep/cli/utils.py", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_prefix|># repo: davidwchung/GatorTrader path: /application/server/__init__.py # -*- coding: utf-8 -*- # @Author: aadityac15 # @Date: 2019-10-15 22:03:53<|fim_suffix|>Last Modified time: 2019-11-18 15:53:06<|fim_middle|> # @Last Modified by: aadityac15 # @
code_fim
easy
{ "lang": "python", "repo": "davidwchung/GatorTrader", "path": "/application/server/__init__.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> # @Last Modified by: aadityac15 # @Last Modified time: 2019-11-18 15:53:06<|fim_prefix|># repo: davidwchung/GatorTrader path: /application/server/__init__.py # -*- coding: utf-8 -*- # @Author: aad<|fim_middle|>ityac15 # @Date: 2019-10-15 22:03:53
code_fim
easy
{ "lang": "python", "repo": "davidwchung/GatorTrader", "path": "/application/server/__init__.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|>Last Modified time: 2019-11-18 15:53:06<|fim_prefix|># repo: davidwchung/GatorTrader path: /application/server/__init__.py # -*- coding: utf-8 -*- # @Author: aadityac15 # @Date: 2019-10-15 22:03:53<|fim_middle|> # @Last Modified by: aadityac15 # @
code_fim
easy
{ "lang": "python", "repo": "davidwchung/GatorTrader", "path": "/application/server/__init__.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: huster-wgm/SRCGAN path: /src/visCas.py import os import cv2 import sys import torch import random import torchvision import torch.nn as nn import argparse import metrics import time import numpy as np import pandas as pd from dataset import load_dataset from torch.utils.data import DataLoader fro...
code_fim
hard
{ "lang": "python", "repo": "huster-wgm/SRCGAN", "path": "/src/visCas.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> def add_barrier(img, spaces=[5, 10]): """ args: img: (ndarray) in [img_rows, img_cols, channels], dtype as unit8 spaces: (int) pixels of spaces return: img: (ndarray) processed img """ img = add_color_bar(img, spaces[0], 0) img = add_color_bar(img, spaces[1...
code_fim
hard
{ "lang": "python", "repo": "huster-wgm/SRCGAN", "path": "/src/visCas.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> def add_color_bar(img, space, cv): """ args: img: (ndarray) in [img_rows, img_cols, channels], dtype as unit8 space: (int) pixels of space cv: (int) color value in [0, 255] return: tmp_img: (ndarray) processed img """ assert len(img.shape) == 3, "img sh...
code_fim
hard
{ "lang": "python", "repo": "huster-wgm/SRCGAN", "path": "/src/visCas.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> self.name = name @classmethod def show(cls): print(cls.__instance) a = A('hello') print(dir(a)) a.show() b = A('world') b.show()<|fim_prefix|># repo: HarryChen0506/learn-python path: /course/p_152/index.py # for i in range(4): # if i == 3: # print('有3') # break # els...
code_fim
hard
{ "lang": "python", "repo": "HarryChen0506/learn-python", "path": "/course/p_152/index.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: HarryChen0506/learn-python path: /course/p_152/index.py # for i in range(4): # if i == 3: # print('有3') # break # else: # print('111') # class Person: # def __init__(self, name, age): # self.name = name # self.age = age # def say(self): # print('我是{},...
code_fim
hard
{ "lang": "python", "repo": "HarryChen0506/learn-python", "path": "/course/p_152/index.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: G-Morgen/GAID path: /preparing_data.py import os import re import random import shutil import scipy.misc import numpy as np import pandas as pd import matplotlib.cm as cm from skimage.draw import circle import matplotlib.pyplot as plt # Function for reading PGM files def read...
code_fim
hard
{ "lang": "python", "repo": "G-Morgen/GAID", "path": "/preparing_data.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> image_patches, _ = extract_patches(source_image, patch_size, overlap_allowed=overlap_allowed, cropvalue=cropvalue, crop_fraction_allowed=crop_fraction_allowed) if row['abnormality_class'] == 'NORM': label = np.zeros((np.shape(image_p...
code_fim
hard
{ "lang": "python", "repo": "G-Morgen/GAID", "path": "/preparing_data.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> num_abnormal_patches = np.shape(abnormal_patches)[0] num_normal_patches = np.shape(normal_patches)[0] num_background = max(50, int(num_normal_patches / 40)) random.shuffle(normal_patches) random.shuffle(background_patches) counter = 0 for idx in range(num_abnormal_patches...
code_fim
hard
{ "lang": "python", "repo": "G-Morgen/GAID", "path": "/preparing_data.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: gussiciliano/python101 path: /2.0-funciones/ejercicios_alumnos/Zardain, Javier/Ejercicios/Ej1.py ''' Created on 20/10/2016 @author: javier_zardain Dado una lista de numeros enteros definir una nueva lista que indica la tupla numero-paridad(true/false) ''' <|fim_suffix|>listaNumerosBoolean=[(x,...
code_fim
easy
{ "lang": "python", "repo": "gussiciliano/python101", "path": "/2.0-funciones/ejercicios_alumnos/Zardain, Javier/Ejercicios/Ej1.py", "mode": "psm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|>listaNumerosBoolean=[(x,x%2==0) for x in listaNumeros] print(listaNumerosBoolean)<|fim_prefix|># repo: gussiciliano/python101 path: /2.0-funciones/ejercicios_alumnos/Zardain, Javier/Ejercicios/Ej1.py ''' Created on 20/10/2016 @author: javier_zardain Dado una lista de numeros enteros definir una nueva ...
code_fim
easy
{ "lang": "python", "repo": "gussiciliano/python101", "path": "/2.0-funciones/ejercicios_alumnos/Zardain, Javier/Ejercicios/Ej1.py", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|>listaNumeros = [1,2,3,4,5,6,7,8,9] listaNumerosBoolean=[(x,x%2==0) for x in listaNumeros] print(listaNumerosBoolean)<|fim_prefix|># repo: gussiciliano/python101 path: /2.0-funciones/ejercicios_alumnos/Zardain, Javier/Ejercicios/Ej1.py ''' Created on 20/10/2016 @author: javier_zardain <|fim_middle|>Da...
code_fim
medium
{ "lang": "python", "repo": "gussiciliano/python101", "path": "/2.0-funciones/ejercicios_alumnos/Zardain, Javier/Ejercicios/Ej1.py", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|> words = [w for w in words_raw if len(w) > 8] return words<|fim_prefix|># repo: ourresearch/openalex-elastic-api path: /loadtest/utils.py import requests def get_words(): word_site = "https://w<|fim_middle|>ww.mit.edu/~ecprice/wordlist.10000" response = requests.get(word_site) words_raw...
code_fim
medium
{ "lang": "python", "repo": "ourresearch/openalex-elastic-api", "path": "/loadtest/utils.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|>t(word_site) words_raw = response.content.splitlines() words = [w for w in words_raw if len(w) > 8] return words<|fim_prefix|># repo: ourresearch/openalex-elastic-api path: /loadtest/utils.py import requests def get_words(): word_site = "https://w<|fim_middle|>ww.mit.edu/~ecprice/wordli...
code_fim
medium
{ "lang": "python", "repo": "ourresearch/openalex-elastic-api", "path": "/loadtest/utils.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }