text
stringlengths
232
16.3k
domain
stringclasses
1 value
difficulty
stringclasses
3 values
meta
dict
<|fim_prefix|># repo: googleapis/gapic-generator-python path: /tests/unit/configurable_snippetgen/test_libcst_utils.py # -*- coding: utf-8 -*- # Copyright 2022 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obt...
code_fim
hard
{ "lang": "python", "repo": "googleapis/gapic-generator-python", "path": "/tests/unit/configurable_snippetgen/test_libcst_utils.py", "mode": "psm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_prefix|># repo: EntilZha/kuro path: /setup.py from setuptools import setup, find_packages setup( name='kuro', description='Package for managing machine learning experiments', url='https://github.com/EntilZha/kuro', auth<|fim_suffix|>eapi-cli', 'py-cpuinfo', 'psutil', 'gpustat', '...
code_fim
medium
{ "lang": "python", "repo": "EntilZha/kuro", "path": "/setup.py", "mode": "psm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|>onents==0.18.0', 'plotly', 'psycopg2', 'gunicorn', 'pygments', 'pyfunctional' ], packages=find_packages(exclude=['contrib', 'docs', 'test*']) )<|fim_prefix|># repo: EntilZha/kuro path: /setup.py from setuptools import setup, find_packages setup( name='...
code_fim
medium
{ "lang": "python", "repo": "EntilZha/kuro", "path": "/setup.py", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|>(S[i]) * m n %= P result += t[n] m *= 10 m %= P print(result)<|fim_prefix|># repo: c-yan/atcoder path: /abc/abc158/abc158e.py N, P = map(int, input().split()) S = input() S = S[::-1] result = 0 if P == 2 or P == 5: <|fim_middle|> for i in range(N): if int(S[i])...
code_fim
medium
{ "lang": "python", "repo": "c-yan/atcoder", "path": "/abc/abc158/abc158e.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: c-yan/atcoder path: /abc/abc158/abc158e.py N, P = map(int, input().split()) S = input() S = S[::-1] result = 0 if P == 2 or P == 5: for i in range(N): if int(S[i]) % P == 0: result += N - i else: t <|fim_suffix|>(S[i]) * m n %= P result += t[n] ...
code_fim
medium
{ "lang": "python", "repo": "c-yan/atcoder", "path": "/abc/abc158/abc158e.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: pplonski/jupyterlab-pyflyby path: /jupyterlab_pyflyby/handlers.py from jupyter_server.base.handlers import APIHandler from jupyter_server.utils import url_path_join import tornado import json from notebook.base.handlers import IPythonHandler import os import subprocess class PyflybyStatus(IPyth...
code_fim
hard
{ "lang": "python", "repo": "pplonski/jupyterlab-pyflyby", "path": "/jupyterlab_pyflyby/handlers.py", "mode": "psm", "license": "BSD-3-Clause", "source": "the-stack-v2" }
<|fim_suffix|> with open(pyflyby_settings_file, "w") as f: json.dump(settings, f, indent=4) self.finish({"result": "Disabled pyflyby extension successfully"}) except Exception as err: self.send_error( {"result": "Could not disable pyflyby extens...
code_fim
hard
{ "lang": "python", "repo": "pplonski/jupyterlab-pyflyby", "path": "/jupyterlab_pyflyby/handlers.py", "mode": "spm", "license": "BSD-3-Clause", "source": "the-stack-v2" }
<|fim_suffix|> y = iasubm( iacloserec(f,bdil,bc), f) return y<|fim_prefix|># repo: uraps/ia870 path: /ia870/iacloserecth.py # -*- encoding: utf-8 -*- # Module iacloserecth from numpy import * from iasecross import iasecross def iacloserecth(f, bdil=iasecross(), bc=iasecross()): <|fim_middle|> from iasubm i...
code_fim
medium
{ "lang": "python", "repo": "uraps/ia870", "path": "/ia870/iacloserecth.py", "mode": "spm", "license": "BSD-3-Clause", "source": "the-stack-v2" }
<|fim_suffix|> from iasubm import iasubm from iacloserec import iacloserec y = iasubm( iacloserec(f,bdil,bc), f) return y<|fim_prefix|># repo: uraps/ia870 path: /ia870/iacloserecth.py # -*- encoding: utf-8 -*- # Module iacloserecth <|fim_middle|>from numpy import * from iasecross import iasecross def...
code_fim
medium
{ "lang": "python", "repo": "uraps/ia870", "path": "/ia870/iacloserecth.py", "mode": "spm", "license": "BSD-3-Clause", "source": "the-stack-v2" }
<|fim_prefix|># repo: uraps/ia870 path: /ia870/iacloserecth.py # -*- encoding: utf-8 -*- # Module iacloserecth from numpy import * from iasecross import iasecross def iacloserecth(f, bdil=iasecross(), bc=iasecross()): <|fim_suffix|> y = iasubm( iacloserec(f,bdil,bc), f) return y<|fim_middle|> from iasubm i...
code_fim
medium
{ "lang": "python", "repo": "uraps/ia870", "path": "/ia870/iacloserecth.py", "mode": "psm", "license": "BSD-3-Clause", "source": "the-stack-v2" }
<|fim_suffix|> ''' attempt to load the module and the appropriate classes according to the "Parser" configuration setting. ''' if not self.configuration or self.configuration == None: raise configuration.ConfigurationError( 'Configuration is...
code_fim
hard
{ "lang": "python", "repo": "symeonp/choronzon", "path": "/chromosome/factory.py", "mode": "spm", "license": "LicenseRef-scancode-warranty-disclaimer", "source": "the-stack-v2" }
<|fim_prefix|># repo: symeonp/choronzon path: /chromosome/factory.py import os import importlib import string import chromosome import configuration import campaign class Factory(object): ''' Factory class generates chromosomes using user-defined parsers specified in the configuration. ''' ...
code_fim
hard
{ "lang": "python", "repo": "symeonp/choronzon", "path": "/chromosome/factory.py", "mode": "psm", "license": "LicenseRef-scancode-warranty-disclaimer", "source": "the-stack-v2" }
<|fim_suffix|> def _generate_chromosome(self, fname): ''' It parses the current filename, and then append the genes that found in a chromosome and return it. ''' chromo = chromosome.Chromosome( serializer=self.serializer, deseria...
code_fim
hard
{ "lang": "python", "repo": "symeonp/choronzon", "path": "/chromosome/factory.py", "mode": "spm", "license": "LicenseRef-scancode-warranty-disclaimer", "source": "the-stack-v2" }
<|fim_prefix|># repo: Erotemic/clab path: /clab/models/output_shape_for.py func return _wrap class OutputShapeFor(object): math = math # for hacking in sympy def __init__(self, module): self.module = module self._func = getattr(module, 'output_shape_for', None) if self._func is...
code_fim
hard
{ "lang": "python", "repo": "Erotemic/clab", "path": "/clab/models/output_shape_for.py", "mode": "psm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|> shape = OutputShapeFor(module.layer1)(shape) shape = OutputShapeFor(module.layer2)(shape) shape = OutputShapeFor(module.layer3)(shape) shape = OutputShapeFor(module.layer4)(shape) shape = OutputShapeFor(module.avgpool)(shape) print('pre-flatten-shape = {!r}...
code_fim
hard
{ "lang": "python", "repo": "Erotemic/clab", "path": "/clab/models/output_shape_for.py", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_prefix|># repo: Erotemic/clab path: /clab/models/output_shape_for.py mpy def __init__(self, module): self.module = module self._func = getattr(module, 'output_shape_for', None) if self._func is None: # Lookup shape func if we can't find it for type, _func in R...
code_fim
hard
{ "lang": "python", "repo": "Erotemic/clab", "path": "/clab/models/output_shape_for.py", "mode": "psm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|>class X86Mode(DefaultMode): ret = re.compile(r"ret[q]?") call = re.compile(r"call[q]?\s+([_a-zA-Z0-9]+)") jumps = [] def strip_comments(self, line): return line.split('#')[0] def __str__(self): return "X86" def get_op(self, line: str): return None<|fim_prefi...
code_fim
medium
{ "lang": "python", "repo": "wanming2008/Rositaplusplus", "path": "/ROSITAPP/X86ParserMode.py", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_prefix|># repo: wanming2008/Rositaplusplus path: /ROSITAPP/X86ParserMode.py # Copyright 2021 University of Adelaide # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.ap...
code_fim
medium
{ "lang": "python", "repo": "wanming2008/Rositaplusplus", "path": "/ROSITAPP/X86ParserMode.py", "mode": "psm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|> ret = re.compile(r"ret[q]?") call = re.compile(r"call[q]?\s+([_a-zA-Z0-9]+)") jumps = [] def strip_comments(self, line): return line.split('#')[0] def __str__(self): return "X86" def get_op(self, line: str): return None<|fim_prefix|># repo: wanming2008/Rosit...
code_fim
medium
{ "lang": "python", "repo": "wanming2008/Rositaplusplus", "path": "/ROSITAPP/X86ParserMode.py", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|>#text = 'Change syntax themes, default project pages, and more in preferences.\n hello world' text = "今天" print(t[text])<|fim_prefix|># repo: brightgems/nlptools path: /test/test_restembed.py #!/usr/bin/env python3 from nlptools.text.embedding import Embedding_Rest <|fim_middle|>cfg = {'embedding_resta...
code_fim
medium
{ "lang": "python", "repo": "brightgems/nlptools", "path": "/test/test_restembed.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: brightgems/nlptools path: /test/test_restembed.py #!/usr/bin/env python3 from nlptools.text.embedding import Embedding_Rest <|fim_suffix|>#text = 'Change syntax themes, default project pages, and more in preferences.\n hello world' text = "今天" print(t[text])<|fim_middle|>cfg = {'embedding_resta...
code_fim
medium
{ "lang": "python", "repo": "brightgems/nlptools", "path": "/test/test_restembed.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> roi = old_roi roi[0] = round(moved_by[1]) + roi[0] roi[1] = round(moved_by[0]) + roi[1] return roi def get_name(): return "RawGray"<|fim_prefix|># repo: ducha-aiki/circulant_matrix_tracker path: /descriptors/raw_gray_descriptor.py import pylab def rgb2gray(rgb_image): "Based on...
code_fim
medium
{ "lang": "python", "repo": "ducha-aiki/circulant_matrix_tracker", "path": "/descriptors/raw_gray_descriptor.py", "mode": "spm", "license": "BSD-2-Clause", "source": "the-stack-v2" }
<|fim_prefix|># repo: ducha-aiki/circulant_matrix_tracker path: /descriptors/raw_gray_descriptor.py import pylab def rgb2gray(rgb_image): "Based on http://stackoverflow.com/questions/12201577" # [0.299, 0.587, 0.144] normalized gives [0.29, 0.57, 0.14] return pylab.dot(rgb_image[:, :, :3], [0.29, 0.57, 0...
code_fim
medium
{ "lang": "python", "repo": "ducha-aiki/circulant_matrix_tracker", "path": "/descriptors/raw_gray_descriptor.py", "mode": "psm", "license": "BSD-2-Clause", "source": "the-stack-v2" }
<|fim_suffix|> def emitProperties(self, node, globals): setter_visitor = SetterVisitor(output=self.output, depth=2) for member in node.members(): self.output.write(textwrap.dedent('''\ \t@property \tdef {member_name}(self): \t\t"{member_type...
code_fim
hard
{ "lang": "python", "repo": "leozd1/vector", "path": "/victor-clad/tools/message-buffers/emitters/Python_emitter.py", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_prefix|># repo: leozd1/vector path: /victor-clad/tools/message-buffers/emitters/Python_emitter.py ath not in sys.path: sys.path.insert(0, searchpath) _modify_path() from clad import clad from clad import ast from clad import emitterutil class PythonQualifiedNamer(object): @classmethod def join...
code_fim
hard
{ "lang": "python", "repo": "leozd1/vector", "path": "/victor-clad/tools/message-buffers/emitters/Python_emitter.py", "mode": "psm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_prefix|># repo: leozd1/vector path: /victor-clad/tools/message-buffers/emitters/Python_emitter.py tsetattr(value, cls._tags_by_value[tag], cls._tag_unpack_methods[tag](reader)) \t\t\treturn value \t\telse: \t\t\traise ValueError('{union_name} attempted to unpack unknown tag {{...
code_fim
hard
{ "lang": "python", "repo": "leozd1/vector", "path": "/victor-clad/tools/message-buffers/emitters/Python_emitter.py", "mode": "psm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_prefix|># repo: bailianfa/Fine_Grained_Sentiment_Of_Chinese path: /works/train/work_fine_grained_sentiment/model/aspect_transformer.py #!/usr/bin/env python3 # coding:utf-8 """ __title__ = '' __author__ = 'David Ao' __mtime__ = '2018/10/17' # """ import tensorflow as tf from works.train.base.model_base import ...
code_fim
hard
{ "lang": "python", "repo": "bailianfa/Fine_Grained_Sentiment_Of_Chinese", "path": "/works/train/work_fine_grained_sentiment/model/aspect_transformer.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> lower_triangle = tf.matrix_band_part(tf.ones([sequence_length, sequence_length]), -1, 0) result = -1e9 * (1.0 - lower_triangle) print("get_mask==>result:", result) return result def inference(self): """ building blocks: encoder:6 layers.each layers has ...
code_fim
hard
{ "lang": "python", "repo": "bailianfa/Fine_Grained_Sentiment_Of_Chinese", "path": "/works/train/work_fine_grained_sentiment/model/aspect_transformer.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> def main(): pygame.init() pygame.display.init() pygame.display.set_mode(RESOLUTION, pygame.DOUBLEBUF | pygame.OPENGL) pygame.display.set_caption("3D Terrain - rendering smooth was yesterday") pygame.mouse.set_visible(True) world = World(RESOLUTION) game_loop(world) world....
code_fim
medium
{ "lang": "python", "repo": "xFrednet/3D-Terrain", "path": "/src/main.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: xFrednet/3D-Terrain path: /src/main.py import pygame import pygame.display import pygame.locals from world import World RESOLUTION = 1024, 720 FPS = 60 def game_loop(world): clock = pygame.time.Clock() last_millis = pygame.time.get_ticks() while True: # Delta timing. See h...
code_fim
medium
{ "lang": "python", "repo": "xFrednet/3D-Terrain", "path": "/src/main.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: apache/libcloud path: /libcloud/dns/drivers/worldwidedns.py e is distributed on an "AS IS" BASIS, # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # See the License for the specific language governing permissions and # limitations under the License. """ World Wide DNS Dr...
code_fim
hard
{ "lang": "python", "repo": "apache/libcloud", "path": "/libcloud/dns/drivers/worldwidedns.py", "mode": "psm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|> :rtype: ``bool`` For more info, please see: https://www.worldwidedns.net/dns_api_protocol_transfer.asp """ if self.reseller_id is None: raise WorldWideDNSError("This is not a reseller account", driver=self) params = {"DOMAIN": domain, "NEW_ID": ...
code_fim
hard
{ "lang": "python", "repo": "apache/libcloud", "path": "/libcloud/dns/drivers/worldwidedns.py", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_prefix|># repo: apache/libcloud path: /libcloud/dns/drivers/worldwidedns.py SRV: "SRV", RecordType.TXT: "TXT", } def __init__( self, key, secret=None, reseller_id=None, secure=True, host=None, port=None, **kwargs, ): """...
code_fim
hard
{ "lang": "python", "repo": "apache/libcloud", "path": "/libcloud/dns/drivers/worldwidedns.py", "mode": "psm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|> spec_file = '''<?xml version="1.0"?> <module name="testmodule" include="main.h"> <class type="Thing" use-gc="true"> <property name="member" get="get_obj" set="set_obj"/> </class> <class type="Container" use-gc="true"> <propert...
code_fim
hard
{ "lang": "python", "repo": "Rouslan/PyExpose", "path": "/pyexpose/test/test_compile.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: Rouslan/PyExpose path: /pyexpose/test/test_compile.py </module> ''' def runTest(self): tm = self.compile() self.assertEqual(tm.overloaded(1.0,2.0,3.0,4.0),3) self.assertAlmostEqual(tm.overloaded(1),2e50) self.assertEqual(tm.overloaded(1,2.0,"3"),"yel...
code_fim
hard
{ "lang": "python", "repo": "Rouslan/PyExpose", "path": "/pyexpose/test/test_compile.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> class B2(tm.B): def __init__(self): pass a = A2() self.assertEqual(tm.count(),0) b = B2() self.assertEqual(tm.count(),1) super(A2,a).__init__() self.assertEqual(tm.count(),2) super(B2,b).__init__() self.a...
code_fim
hard
{ "lang": "python", "repo": "Rouslan/PyExpose", "path": "/pyexpose/test/test_compile.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> def address_record_to_dict(self, record): if record.housepostcode in [ "BA11 2TQ", "BA11 4AJ", "BA11 2ED", "BA11 5DU", "BA11 4SA", "BA11 4NY", "BA11 1NB", "BA11 2AU", "BA11 2XG", ...
code_fim
hard
{ "lang": "python", "repo": "DemocracyClub/UK-Polling-Stations", "path": "/polling_stations/apps/data_importers/management/commands/import_mendip.py", "mode": "spm", "license": "BSD-3-Clause", "source": "the-stack-v2" }
<|fim_prefix|># repo: nynhex/doublemixer-python path: /doublemixer/__init__.py #!/usr/bin/python3 __version__ = '0.0.3' import logging import random import aaargh import bitmix import foxmixer import privcoin import pyqrcode from . import validate cli = aaargh.App() logging.basicConfig(level=logging.WARNING) ...
code_fim
hard
{ "lang": "python", "repo": "nynhex/doublemixer-python", "path": "/doublemixer/__init__.py", "mode": "psm", "license": "Unlicense", "source": "the-stack-v2" }
<|fim_suffix|>def mix(currency, output_address): """ currency must be one of: bitcoin output_address is destination for double mixed coins. """ validate.currency(currency) mixers = random_mixers() mix_1 = mixers[0].mix(currency=currency, output_address=output_addres...
code_fim
hard
{ "lang": "python", "repo": "nynhex/doublemixer-python", "path": "/doublemixer/__init__.py", "mode": "spm", "license": "Unlicense", "source": "the-stack-v2" }
<|fim_suffix|> mix_1_letter = mixers[0].letter_of_guarantee(mix_1['id']) mix_2_letter = mixers[1].letter_of_guarantee(mix_2['id']) send_to_address = mix_2['address'] msg = 'Letter of guarantee for first mix: \n\n{}\n\n'\ 'Letter of guarantee for final mix: \n\n{}\n\n'\ '{}\n'\ ...
code_fim
hard
{ "lang": "python", "repo": "nynhex/doublemixer-python", "path": "/doublemixer/__init__.py", "mode": "spm", "license": "Unlicense", "source": "the-stack-v2" }
<|fim_suffix|> try: address = row[10] except IndexError as error: raise IndexError("id %s: address %s" % (id, error)) library.address = address try: zip = row[13] except IndexError as error: raise IndexError("id %s: address %s" % (...
code_fim
hard
{ "lang": "python", "repo": "JoeJasinski/WindyTransit", "path": "/mobiletrans/mtimport/importers/importer_library.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> try: website = row[15][0] except IndexError as error: raise IndexError("id %s: address %s" % (id, error)) library.website = website try: lattitude = row[16][1] except IndexError as error: raise IndexErr...
code_fim
hard
{ "lang": "python", "repo": "JoeJasinski/WindyTransit", "path": "/mobiletrans/mtimport/importers/importer_library.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: JoeJasinski/WindyTransit path: /mobiletrans/mtimport/importers/importer_library.py from django.core.exceptions import ObjectDoesNotExist, MultipleObjectsReturned from django.contrib.gis.geos import Point, fromstr, fromfile, GEOSGeometry, MultiPoint, MultiPolygon, Polygon from autoslug.settings im...
code_fim
hard
{ "lang": "python", "repo": "JoeJasinski/WindyTransit", "path": "/mobiletrans/mtimport/importers/importer_library.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: yakuza8/peniot path: /src/protocols/AMQP/examples/receiver_example.py import pika import argparse import logging import signal import sys import time DEFAULT_BROKER_HOST = "localhost" DEFAULT_QUEUE_NAME = "peniot-queue" DEFAULT_EXCHANGE = "peniot-exchange" DEFAULT_ROUTING_KEY = "peniot-routing-...
code_fim
hard
{ "lang": "python", "repo": "yakuza8/peniot", "path": "/src/protocols/AMQP/examples/receiver_example.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|>def callback(ch, method, properties, body): logger.info("Received %r" % body) def receive_procedure(channel_to_receive, queue_name=DEFAULT_QUEUE_NAME): """ Sending procedure for AMQP protocol :param channel_to_receive: Channel means which is created given host name :param queue_name:...
code_fim
medium
{ "lang": "python", "repo": "yakuza8/peniot", "path": "/src/protocols/AMQP/examples/receiver_example.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> class S3DefaultStorage( # HashedMediaMixin, S3MediaLocationMixin, S3PrivateMixin, S3Boto3Storage): pass class S3PublicStorage( # HashedMediaMixin, S3MediaLocationMixin, S3PublicMixin, S3Boto3Storage): pass<|fim_prefix|># repo: ic...
code_fim
hard
{ "lang": "python", "repo": "ic-labs/django-icekit", "path": "/icekit/utils/storage.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> class S3PrivateMixin(object): """ Enable querystring auth and use `private` as default ACL. """ def __init__(self, *args, **kwargs): kwargs.setdefault('default_acl', 'private') kwargs.setdefault('querystring_auth', True) super(S3PrivateMixin, self).__init__(*args,...
code_fim
hard
{ "lang": "python", "repo": "ic-labs/django-icekit", "path": "/icekit/utils/storage.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: ic-labs/django-icekit path: /icekit/utils/storage.py from django.conf import settings from django.core.files.storage import FileSystemStorage, get_storage_class # from ixc_whitenoise.storage import HashedMediaMixin from storages.backends.s3boto3 import S3Boto3Storage <|fim_suffix|> class S3Defau...
code_fim
hard
{ "lang": "python", "repo": "ic-labs/django-icekit", "path": "/icekit/utils/storage.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> return pyomo.common.Executable("pico_convert").available() def apply(self, *args, **kwargs): """ Run the external pico_convert utility """ if len(args) != 3: raise ConverterError("Cannot apply pico_convert with more than one filename or model") ...
code_fim
hard
{ "lang": "python", "repo": "qtothec/pyomo", "path": "/pyomo/solvers/plugins/converter/pico.py", "mode": "spm", "license": "BSD-3-Clause", "source": "the-stack-v2" }
<|fim_suffix|> """ Run the external pico_convert utility """ if len(args) != 3: raise ConverterError("Cannot apply pico_convert with more than one filename or model") _exe = pyomo.common.Executable("pico_convert") if not _exe: raise ConverterError("...
code_fim
hard
{ "lang": "python", "repo": "qtothec/pyomo", "path": "/pyomo/solvers/plugins/converter/pico.py", "mode": "spm", "license": "BSD-3-Clause", "source": "the-stack-v2" }
<|fim_prefix|># repo: qtothec/pyomo path: /pyomo/solvers/plugins/converter/pico.py # ___________________________________________________________________________ # # Pyomo: Python Optimization Modeling Objects # Copyright 2017 National Technology and Engineering Solutions of Sandia, LLC # Under the terms of Contrac...
code_fim
hard
{ "lang": "python", "repo": "qtothec/pyomo", "path": "/pyomo/solvers/plugins/converter/pico.py", "mode": "psm", "license": "BSD-3-Clause", "source": "the-stack-v2" }
<|fim_prefix|># repo: kayaei/pands-project path: /iris_statistical.py #%% # Etem Kaya 11-Apr-2019 # Iris Data Set Project. # Analysing Iris Dataset with 'mean, max, min, median and mode' functions import pandas as pd # import pandas library import seaborn as sns # import seaborn library # f = pd.read_csv("iris.csv"...
code_fim
hard
{ "lang": "python", "repo": "kayaei/pands-project", "path": "/iris_statistical.py", "mode": "psm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|># find the min value of each attribute for all 3 species print("Min value of all 3 Species") print(group.min()) print("\n") # find the median of each attribute for all 3 species print("Median of all 3 Species") print(group.median()) print("\n")<|fim_prefix|># repo: kayaei/pands-project path: /iris_stati...
code_fim
hard
{ "lang": "python", "repo": "kayaei/pands-project", "path": "/iris_statistical.py", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|># find the mean of each attribute for all 3 species print("Mean of all 3 Species") print(group.mean()) print("\n") # find the max value of each attribute for all 3 species print("Max value of all 3 Species") print(group.max()) print("\n") # find the min value of each attribute for all 3 species print("M...
code_fim
hard
{ "lang": "python", "repo": "kayaei/pands-project", "path": "/iris_statistical.py", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_prefix|># repo: imminfo/mhc-prediction-project path: /emilmelnikov/webapp/mhcpredict.py import numpy as np import xgboost as xgb PROTEIN_ALPHABET = 'ACDEFGHIKLMNPQRSTVWY' PROTEIN_PLACEHOLDER = 'Z' PROTEIN_LETTERS = PROTEIN_ALPHABET + PROTEIN_PLACEHOLDER MIN_SEQ_LEN = 8 MAX_SEQ_LEN = 11 MHC_LIST = ''' HLA-A*...
code_fim
hard
{ "lang": "python", "repo": "imminfo/mhc-prediction-project", "path": "/emilmelnikov/webapp/mhcpredict.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> for i, peptide in enumerate(padded_peptides): for j, aminoacid in enumerate(peptide): x[i, j * len(PROTEIN_LETTERS) + PROTEIN_LETTERS.index(aminoacid)] = 1.0 x[i, MAX_SEQ_LEN * len(PROTEIN_LETTERS) + MHC_LIST.index(mhc)] = 1.0 y = bst.predict(xgb.DMatrix(x)) return...
code_fim
hard
{ "lang": "python", "repo": "imminfo/mhc-prediction-project", "path": "/emilmelnikov/webapp/mhcpredict.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> def _send_error(self, call_id, error_message): return self._send_message([ self.MESSAGE_RESPONSE, call_id, False, error_message ]) async def _run_method(self, service, call_id, method_name, args, no_response): method = getatt...
code_fim
hard
{ "lang": "python", "repo": "Kobzol/abrpc", "path": "/abrpc/connection.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> return self._send_message([ self.MESSAGE_RESPONSE, call_id, False, error_message ]) async def _run_method(self, service, call_id, method_name, args, no_response): method = getattr(service, method_name, None) if method is ...
code_fim
hard
{ "lang": "python", "repo": "Kobzol/abrpc", "path": "/abrpc/connection.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: Kobzol/abrpc path: /abrpc/connection.py import asyncio import traceback from asyncio import IncompleteReadError import msgpack class RemoteException(Exception): pass class Connection: MESSAGE_CALL = 0 MESSAGE_RESPONSE = 1 MESSAGE_CALL_NO_RESPONSE = 2 def __init__(self, r...
code_fim
hard
{ "lang": "python", "repo": "Kobzol/abrpc", "path": "/abrpc/connection.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> def test_something4(self): from sklearn.datasets import fetch_california_housing from sklearn.svm import SVR X, y = fetch_california_housing(return_X_y=True) X = X[:100, :4] y = y[:100] svr = SVR() bf = BackForward(svr, primary_feature=2, random_...
code_fim
medium
{ "lang": "python", "repo": "boliqq07/featurebox", "path": "/test/test_selection/test_back.py", "mode": "spm", "license": "LGPL-3.0-only", "source": "the-stack-v2" }
<|fim_prefix|># repo: boliqq07/featurebox path: /test/test_selection/test_back.py import unittest from featurebox.selection.backforward import BackForward, BackForwardStable class MyTestCase(unittest.TestCase): def test_something(self): from sklearn.datasets import fetch_california_housing from ...
code_fim
hard
{ "lang": "python", "repo": "boliqq07/featurebox", "path": "/test/test_selection/test_back.py", "mode": "psm", "license": "LGPL-3.0-only", "source": "the-stack-v2" }
<|fim_prefix|># repo: Techdox/techdox_todo path: /techdox_notes.py #TODO Date needs to be localdate import sys import sqlite3 import os from time import sleep from datetime import date appPath = os.path.dirname(os.path.abspath( __file__ )) dbPath = os.path.join(appPath, 'notes.db') #Menu #Check for DB def ...
code_fim
hard
{ "lang": "python", "repo": "Techdox/techdox_todo", "path": "/techdox_notes.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|>def main(): dbCheck() os.system('clear') conn = sqlite3.connect(dbPath) c = conn.cursor() c.execute('SELECT todo_id, todo_description FROM todo ORDER BY Timestamp DESC ') result = c.fetchall() #resultFinal = [i for i in result] print(""" _______ _ ...
code_fim
hard
{ "lang": "python", "repo": "Techdox/techdox_todo", "path": "/techdox_notes.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: Negaentropy/scheduler_frame path: /src/strategy/update_stock_daily_average_info.py #coding=utf-8 #-*- coding: utf-8 -*- import os import re import sys import time import math import pytz import numpy import talib import datetime import urllib2 sys.path.append("../frame/") import fetch_data from...
code_fim
hard
{ "lang": "python", "repo": "Negaentropy/scheduler_frame", "path": "/src/strategy/update_stock_daily_average_info.py", "mode": "psm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|> def _get_ma_empty_start_time(self, share_id, table_name): stock_conn_manager_obj = stock_conn_manager() conn_name = stock_conn_manager_obj.get_conn_name(share_id) last_time = fetch_data.get_data(fetch_data.select_db(conn_name, table_name, ["time"], {"close_ma5":[0, "="]}, exten...
code_fim
hard
{ "lang": "python", "repo": "Negaentropy/scheduler_frame", "path": "/src/strategy/update_stock_daily_average_info.py", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_prefix|># repo: BBVA/data-refinery path: /tests/tuple/test_fusion.py from datarefinery.TupleOperations import fusion, wrap def test_empty(): imp = None op = fusion(["a", "b", "c"], "tot", wrap(sum)) (res, err) = op(imp) assert res is None assert err == {"tot": "no input provided"} def t...
code_fim
medium
{ "lang": "python", "repo": "BBVA/data-refinery", "path": "/tests/tuple/test_fusion.py", "mode": "psm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|> imp = {"a": 1, "b": 1, "c": 1} op = fusion(["a", "b", "c"], "tot", wrap(sum)) (res, err) = op(imp) assert res == {"tot": 3} assert err is None def test_some_field_missing(): imp = {"a": 1, "b": 1} op = fusion(["a", "b", "c"], "tot", wrap(sum)) (res, err) = op(imp) ...
code_fim
medium
{ "lang": "python", "repo": "BBVA/data-refinery", "path": "/tests/tuple/test_fusion.py", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|> """ TODO: must return all the field names not found :return: """ imp = {} op = fusion(["a", "b", "c"], "tot", wrap(sum)) (res, err) = op(imp) assert res is None assert err == {"tot": "a not found"}<|fim_prefix|># repo: BBVA/data-refinery path: /tests/tuple/test_fusi...
code_fim
hard
{ "lang": "python", "repo": "BBVA/data-refinery", "path": "/tests/tuple/test_fusion.py", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_prefix|># repo: zhongxinghong/AriticleAnalysis path: /spiders/thepaper.py #!/usr/bin/env python3 # -*- coding: utf-8 -*- # fileame: thepaper.py import os, sys sys.path.append(os.path.join(os.path.dirname(__file__),"..")) from lib.spider import * from lib.spider.error import * __all__ = ["thepaperSpider"] cla...
code_fim
medium
{ "lang": "python", "repo": "zhongxinghong/AriticleAnalysis", "path": "/spiders/thepaper.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> if __name__ == '__main__': spider = thepaperSpider() spider.work(loop=True, errs=["ServerError","Null"])<|fim_prefix|># repo: zhongxinghong/AriticleAnalysis path: /spiders/thepaper.py #!/usr/bin/env python3 # -*- coding: utf-8 -*- # fileame: thepaper.py import os, sys sys.path.append(os.path.join(os....
code_fim
hard
{ "lang": "python", "repo": "zhongxinghong/AriticleAnalysis", "path": "/spiders/thepaper.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> self.dbTable = "thepaper" # self.max_worders = 80 self.workers = 64 # 不反爬虫 self.Max_Queue_Size = 2000 def parse_html(self, html): soup = BeautifulSoup(html,"lxml").find(class_="news_txt") if soup.text == "此文章已下线": raise NotFoundError else: return soup.text def get_urls(self): max...
code_fim
medium
{ "lang": "python", "repo": "zhongxinghong/AriticleAnalysis", "path": "/spiders/thepaper.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: frrad/eopi path: /six/thirteen_test.py import thirteen import unittest class TestStringMethods(unittest.TestCase): <|fim_suffix|> def test_right1(self): self.execute_test('righ1', thirteen.find_substring_start_ind_simple) def test_right2(self): self.execute_test('right2'...
code_fim
hard
{ "lang": "python", "repo": "frrad/eopi", "path": "/six/thirteen_test.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> for start_ind, sub_str, main_str in self.testcases: self.assertEqual(impl(main_str, sub_str), start_ind) def test_right1(self): self.execute_test('righ1', thirteen.find_substring_start_ind_simple) def test_right2(self): self.execute_test('right2', thirteen.fin...
code_fim
medium
{ "lang": "python", "repo": "frrad/eopi", "path": "/six/thirteen_test.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: Om4ar/Design-Patterns path: /python/Builder/user/UserBuilder.py from .User import User class UserBuilder(): def __init__(self): self.firstName = "" self.lastName = "" self.age = 0 self.street = "" @staticmethod def item(): return UserBuilder(...
code_fim
medium
{ "lang": "python", "repo": "Om4ar/Design-Patterns", "path": "/python/Builder/user/UserBuilder.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> return User(self.firstName, self.lastName, self.age, self.street)<|fim_prefix|># repo: Om4ar/Design-Patterns path: /python/Builder/user/UserBuilder.py from .User import User class UserBuilder(): def __init__(self): self.fir...
code_fim
medium
{ "lang": "python", "repo": "Om4ar/Design-Patterns", "path": "/python/Builder/user/UserBuilder.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> self.street = street return self def build(self): return User(self.firstName, self.lastName, self.age, self.street)<|fim_prefix|># repo: Om4ar/Design-Patterns path: /python/Builder/user/UserBuilder.py from .User impo...
code_fim
medium
{ "lang": "python", "repo": "Om4ar/Design-Patterns", "path": "/python/Builder/user/UserBuilder.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: vivainio/jenkem path: /jenq/server.py from jenq import db from flask import Flask import json app = Flask(__name__) # the decorator def enable_cors(fn): def _enable_cors(*args, **kwargs): # set CORS headers app.response.headers['Access-Control-Allow-Origin'] = '*' ...
code_fim
medium
{ "lang": "python", "repo": "vivainio/jenkem", "path": "/jenq/server.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> @app.route('/db/<var>') def db_get(var): r = json.dumps(db[var]) return r #return template('<b>Hello {{name}}</b>!', name=name) app.run() run(host='localhost', port=3001)<|fim_prefix|># repo: vivainio/jenkem path: /jenq/server.py from jenq import db from flask import Flask import ...
code_fim
medium
{ "lang": "python", "repo": "vivainio/jenkem", "path": "/jenq/server.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> product_id = factory.Faker("hexify") vendor_id = factory.Faker("hexify") mount_points = [pathlib.Path(".")] serial_number = factory.Faker("hexify", text=("^" * 20)) # 20 characters serial number serial_port = None<|fim_prefix|># repo: ARMmbed/mbed-tools path: /tests/devices/factories...
code_fim
medium
{ "lang": "python", "repo": "ARMmbed/mbed-tools", "path": "/tests/devices/factories.py", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_prefix|># repo: ARMmbed/mbed-tools path: /tests/devices/factories.py # # Copyright (c) 2020-2021 Arm Limited and Contributors. All rights reserved. # SPDX-License-Identifier: Apache-2.0 # import factory import pathlib from mbed_tools.devices._internal.candidate_device import CandidateDevice <|fim_suffix|> ...
code_fim
medium
{ "lang": "python", "repo": "ARMmbed/mbed-tools", "path": "/tests/devices/factories.py", "mode": "psm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|> model = CandidateDevice product_id = factory.Faker("hexify") vendor_id = factory.Faker("hexify") mount_points = [pathlib.Path(".")] serial_number = factory.Faker("hexify", text=("^" * 20)) # 20 characters serial number serial_port = None<|fim_prefix|># repo: ARMmbed/mbed-tool...
code_fim
medium
{ "lang": "python", "repo": "ARMmbed/mbed-tools", "path": "/tests/devices/factories.py", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_prefix|># repo: Theomat/go-enseirb-2020 path: /nn/src/trainer.py from mcts import MCTS from model import AlphaGoZero from loss import alpha_go_zero_loss import time import torch from torch.utils.tensorboard import SummaryWriter from tqdm import trange class Trainer: def __init__(self, replay_buffer, lr:...
code_fim
hard
{ "lang": "python", "repo": "Theomat/go-enseirb-2020", "path": "/nn/src/trainer.py", "mode": "psm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|> # where p and v are the predicted values and pi and z the target values loss = alpha_go_zero_loss(p, v, pi.to(self.device), z.to(self.device)) loss.backward() self.optimizer.step() # TODO: Also add the loss or print it so we have an update running_loss = l...
code_fim
hard
{ "lang": "python", "repo": "Theomat/go-enseirb-2020", "path": "/nn/src/trainer.py", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|> mcts = MCTS(self.model, self.device) for _ in trange(episodes, desc="episode"): self.replay_buffer.store([mcts.self_play()]) def _training_step(self): self._train_steps_since_last_checkpoint += 1 if self._train_steps_since_last_checkpoint == self.checkpoint...
code_fim
hard
{ "lang": "python", "repo": "Theomat/go-enseirb-2020", "path": "/nn/src/trainer.py", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_prefix|># repo: adam147g/ASD_exercises_solutions path: /Graph algorithms/07_combining_ranges.py # Given set of ranges [ai, bi]. Two ranges can be combined if they have exactly one # common point. Find algorithm that checks if it is possible to get range [a, b] by # combining ranges together. <|fim_suffix|> def...
code_fim
hard
{ "lang": "python", "repo": "adam147g/ASD_exercises_solutions", "path": "/Graph algorithms/07_combining_ranges.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> ranges = [[1, 3], [2, 3], [4, 5], [5, 7], [0, 6], [6, 7], [0, 2], [3, 4], [8, 9]] interval = [0, 1] print(find_range(ranges, interval))<|fim_prefix|># repo: adam147g/ASD_exercises_solutions path: /Graph algorithms/07_combining_ranges.py # Given set of ranges [ai, bi]. Two ranges can be combined if they ...
code_fim
hard
{ "lang": "python", "repo": "adam147g/ASD_exercises_solutions", "path": "/Graph algorithms/07_combining_ranges.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> def find_range(ranges, source): max_vertex = 0 for i in range(len(ranges)): max_vertex = max(max_vertex, max(ranges[i])) graph = [[] for _ in range(max_vertex + 1)] for i in range(len(ranges)): graph[ranges[i][0]].append(ranges[i][1]) graph[ranges[i][1]].append(ran...
code_fim
hard
{ "lang": "python", "repo": "adam147g/ASD_exercises_solutions", "path": "/Graph algorithms/07_combining_ranges.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> if is_new_delayed == is_old_delayed: self.seconds_delayed += new_seconds else: self.seconds_delayed += (new_seconds / 2) @classmethod def __is_status_delayed(cls, status): is_a_delay = { "good": False, "plann...
code_fim
hard
{ "lang": "python", "repo": "deathbyjer/mta_simpletest", "path": "/lib/line_status.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> self.__saveToRedis() self.__writeLog() self.new_status = None self.new_status_at = None def __saveToRedis(self): self.__prepareForRedis() out = { "line": self.line, "status": self.status, "last_logged": se...
code_fim
hard
{ "lang": "python", "repo": "deathbyjer/mta_simpletest", "path": "/lib/line_status.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: deathbyjer/mta_simpletest path: /lib/line_status.py from redis import Redis import json import math from datetime import datetime import time class LineStatus: prefix = "line:status:" redis = Redis(host='redis', port=6379) log_file = "log/line_status.log" @cla...
code_fim
hard
{ "lang": "python", "repo": "deathbyjer/mta_simpletest", "path": "/lib/line_status.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: kript/AdventOfCode2017 path: /day2.py #!/usr/bin/python def day2_partone(row): ''' For each row, determine the difference between the largest value and the smallest value; the checksum is the sum of all of these differences. ''' smallest = 0 largest = 0 for counter, item in enumerate(r...
code_fim
hard
{ "lang": "python", "repo": "kript/AdventOfCode2017", "path": "/day2.py", "mode": "psm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|>print "total: %s" % (total) total = 0 for counter, row in enumerate(myRealArray): result_row = day2_partone(row) total = (total + result_row) print "RealArray counter: %s total: %s" % (counter, result_row) print "total: %s" % (total) total = 0 print "Day two; part two" for counter, row in enumerate(...
code_fim
hard
{ "lang": "python", "repo": "kript/AdventOfCode2017", "path": "/day2.py", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_prefix|># repo: zhy0216/playground path: /overloader.py from functools import partial from types import FunctionType from inspect import signature from itertools import starmap def _raise(msg: str, error=ValueError): raise error(msg) class Overloader: def __init__(self): self.env = {} de...
code_fim
medium
{ "lang": "python", "repo": "zhy0216/playground", "path": "/overloader.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> def __call__(self, *args): for arg_types, func in self.env.items(): if all(starmap(isinstance, zip(args, arg_types))): return func(*args)<|fim_prefix|># repo: zhy0216/playground path: /overloader.py from functools import partial from types import FunctionType from ...
code_fim
hard
{ "lang": "python", "repo": "zhy0216/playground", "path": "/overloader.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> # TODO: cannot deal with any and generic type # read https://github.com/python/mypy, see if can solve this # print(f"dispatcher: {func.__name__}") sig = signature(func) self.env[tuple(para.annotation for para in sig.parameters.values())] = func return lambda...
code_fim
medium
{ "lang": "python", "repo": "zhy0216/playground", "path": "/overloader.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: BruzzeseAgustin/rucio-analysis path: /src/tasks/tests/upload_metadata.py import os from common.rucio.wrappers import RucioWrappersAPI from tasks.task import Task from utility import generateMetadataDict, generateRandomFile class TestRucioMetadata(Task): """ Rucio API test class stub. """ ...
code_fim
hard
{ "lang": "python", "repo": "BruzzeseAgustin/rucio-analysis", "path": "/src/tasks/tests/upload_metadata.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> # Set metadata and verify rucio.setMetadataBulk(did, meta_dict) retrieved_meta = rucio.getMetadata(did, plugin="JSON") if not retrieved_meta == meta_dict: # This crude verification assumes that fixed metadata is all set as JSON # (i.e. no DID Column ...
code_fim
hard
{ "lang": "python", "repo": "BruzzeseAgustin/rucio-analysis", "path": "/src/tasks/tests/upload_metadata.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: foundry4/connected-data-amanita path: /app/clients/elastic/querybuilder/get_content.py from random import randint from app.utils import constants from exceptions.queryexceptions import InvalidInputParameterCombination from elasticsearch_dsl import Search, Q def build_query_body(media_type=Non...
code_fim
hard
{ "lang": "python", "repo": "foundry4/connected-data-amanita", "path": "/app/clients/elastic/querybuilder/get_content.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> if max_duration: search = search.filter('range', duration={'lte': max_duration}) if categories: for cat in categories: search = search.filter('nested', path='genres', query=Q('match', genres__key=cat)) if random: search = search.query('function_score', fun...
code_fim
hard
{ "lang": "python", "repo": "foundry4/connected-data-amanita", "path": "/app/clients/elastic/querybuilder/get_content.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: Mogbo/image-caption path: /train.py import os from core2.solver import CaptioningSolver from core2.model import CaptionGenerator from core2.utils import load_coco_data <|fim_suffix|> os.environ["CUDA_DEVICE_ORDER"]="PCI_BUS_ID" os.environ['CUDA_VISIBLE_DEVICES']='0,1,2,3,4,5,6,7,8' ...
code_fim
hard
{ "lang": "python", "repo": "Mogbo/image-caption", "path": "/train.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }