text
stringlengths
232
16.3k
domain
stringclasses
1 value
difficulty
stringclasses
3 values
meta
dict
<|fim_suffix|> default_label = "SpikeInterface - Quality Metrics" pass QualityMetricsPlotter.register(QualityMetricsWidget)<|fim_prefix|># repo: alejoe91/spikeinterface path: /src/spikeinterface/widgets/sortingview/quality_metrics.py from .metrics import MetricsPlotter from ..quality_metrics import QualityMe...
code_fim
easy
{ "lang": "python", "repo": "alejoe91/spikeinterface", "path": "/src/spikeinterface/widgets/sortingview/quality_metrics.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: alejoe91/spikeinterface path: /src/spikeinterface/widgets/sortingview/quality_metrics.py from .metrics import MetricsPlotter from ..quality_metrics import QualityMetricsWidget <|fim_suffix|>QualityMetricsPlotter.register(QualityMetricsWidget)<|fim_middle|>class QualityMetricsPlotter(MetricsPlot...
code_fim
medium
{ "lang": "python", "repo": "alejoe91/spikeinterface", "path": "/src/spikeinterface/widgets/sortingview/quality_metrics.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: fabioderendinger/movie-website path: /generate_movie_page.py import media import fresh_tomatoes # create movie objects of favorite movies in_bruges = media.Movie("In Bruges", "Guilt-stricken after a job gone wrong, hitman Ray and his partner await orders from their ruthl...
code_fim
hard
{ "lang": "python", "repo": "fabioderendinger/movie-website", "path": "/generate_movie_page.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|>lord_of_the_rings = media.Movie("The Lord of the Rings: The Return of the King", "Gandalf and Aragorn lead the World of Men against Sauron's army to draw his gaze from Frodo and Sam as they approach Mount Doom with the One Ring.", "https://upload.wikimedia....
code_fim
hard
{ "lang": "python", "repo": "fabioderendinger/movie-website", "path": "/generate_movie_page.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|>setup(name='junkoda_cellularlib', version='0.0.%d' % ver, author='Jun Koda', py_modules=['junkoda_cellularlib.cellularroot', 'junkoda_cellularlib.clusters', 'junkoda_cellularlib.data', 'junkoda_cellularlib.delaunay', ...
code_fim
hard
{ "lang": "python", "repo": "junkoda/junkoda_cellularlib", "path": "/py/setup.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: junkoda/junkoda_cellularlib path: /py/setup.py # # $ make # #from distutils.core import setup, Extension from setuptools import setup, Extension import numpy as np import os # Set default cellularroot dirctory path, _ = os.path.split(os.path.abspath(__file__)) libroot = os.path.abspath(os.path....
code_fim
hard
{ "lang": "python", "repo": "junkoda/junkoda_cellularlib", "path": "/py/setup.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> def parse(self, response): pass<|fim_prefix|># repo: redhead520/django-blog path: /src/novel/novel_spider/novel_spider/spiders/get_new_novel.py import scrapy class GetNewNovelSpider(scrapy.Spider): <|fim_middle|> name = 'get_new_novel' allowed_domains = ['https://www.qidian.com'] ...
code_fim
medium
{ "lang": "python", "repo": "redhead520/django-blog", "path": "/src/novel/novel_spider/novel_spider/spiders/get_new_novel.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: redhead520/django-blog path: /src/novel/novel_spider/novel_spider/spiders/get_new_novel.py import scrapy class GetNewNovelSpider(scrapy.Spider): <|fim_suffix|> def parse(self, response): pass<|fim_middle|> name = 'get_new_novel' allowed_domains = ['https://www.qidian.com'] ...
code_fim
medium
{ "lang": "python", "repo": "redhead520/django-blog", "path": "/src/novel/novel_spider/novel_spider/spiders/get_new_novel.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> async def bind_axg_with_options_async( self, request: dyplsapi_20170525_models.BindAxgRequest, runtime: util_models.RuntimeOptions, ) -> dyplsapi_20170525_models.BindAxgResponse: UtilClient.validate_model(request) query = {} if not UtilClient.is_unse...
code_fim
hard
{ "lang": "python", "repo": "aliyun/alibabacloud-python-sdk", "path": "/dyplsapi-20170525/alibabacloud_dyplsapi20170525/client.py", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|> def delete_secret_blacklist_with_options( self, request: dyplsapi_20170525_models.DeleteSecretBlacklistRequest, runtime: util_models.RuntimeOptions, ) -> dyplsapi_20170525_models.DeleteSecretBlacklistResponse: UtilClient.validate_model(request) query = {} ...
code_fim
hard
{ "lang": "python", "repo": "aliyun/alibabacloud-python-sdk", "path": "/dyplsapi-20170525/alibabacloud_dyplsapi20170525/client.py", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_prefix|># repo: aliyun/alibabacloud-python-sdk path: /dyplsapi-20170525/alibabacloud_dyplsapi20170525/client.py otocol='HTTPS', pathname='/', method='POST', auth_type='AK', style='RPC', req_body_type='formData', body_type='json' ) ...
code_fim
hard
{ "lang": "python", "repo": "aliyun/alibabacloud-python-sdk", "path": "/dyplsapi-20170525/alibabacloud_dyplsapi20170525/client.py", "mode": "psm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|> def checkpoint(self, epoch: int): """Method to save the state dictionaries of model, optimizer,etc. Args: epoch : The epoch at which model is saved. """ if self.exp.scheduler_stepper is not None: torch.save( { ...
code_fim
hard
{ "lang": "python", "repo": "earlbabson/torchflare", "path": "/torchflare/callbacks/model_checkpoint.py", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_prefix|># repo: earlbabson/torchflare path: /torchflare/callbacks/model_checkpoint.py """Implements Model Checkpoint Callback.""" from abc import ABC from typing import Dict import numpy as np import torch from torchflare.callbacks.callback import Callbacks from torchflare.callbacks.states import CallbackOrder...
code_fim
hard
{ "lang": "python", "repo": "earlbabson/torchflare", "path": "/torchflare/callbacks/model_checkpoint.py", "mode": "psm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|> #fce.plot() #with h5py.File("test_file_1",driver="core", # backing_store=False) as f: with tempfile.TemporaryFile() as f: fce.save(f, test=True) fce2 = DFunction() fce2 = fce2.load(f, test=True) ...
code_fim
medium
{ "lang": "python", "repo": "tmancal74/quantarhei", "path": "/tests/unit/core/test_dfunction.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: tmancal74/quantarhei path: /tests/unit/core/test_dfunction.py # -*- coding: utf-8 -*- import unittest import numpy #import h5py import tempfile from quantarhei import DFunction, FrequencyAxis class TestDFunction(unittest.TestCase): """Tests for the units package """ ...
code_fim
hard
{ "lang": "python", "repo": "tmancal74/quantarhei", "path": "/tests/unit/core/test_dfunction.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> fce = DFunction(wa,fw) val_mez_linear = fce.at(20.5) val_mez_spline = fce.at(20.5, approx="spline") # print("init", fce._splines_initialized) # print(val_mez_linear) # print(val_mez_spline) #with h5py.File("test_file_1",driver="core",...
code_fim
hard
{ "lang": "python", "repo": "tmancal74/quantarhei", "path": "/tests/unit/core/test_dfunction.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: digital-science/dimcli path: /dimcli/core/dsl_grammar_categories.py 379", "name": "Regenerative Medicine" }, { "count": 260234, "id": "543", "name": "Orphan Drug" }, { "count": 243219, "id": "4...
code_fim
hard
{ "lang": "python", "repo": "digital-science/dimcli", "path": "/dimcli/core/dsl_grammar_categories.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> }, { "count": 461587, "id": "2539", "name": "0406 Physical Geography and Environmental Geoscience" }, { "count": 448145, "id": "2878", "name": "0907 Environmental Engineering" }, { ...
code_fim
hard
{ "lang": "python", "repo": "digital-science/dimcli", "path": "/dimcli/core/dsl_grammar_categories.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> "id": "529", "name": "Health Effects of Indoor Air Pollution" }, { "count": 5530, "id": "402", "name": "Teenage Pregnancy" }, { "count": 5465, "id": "590", "name": "Youth Violence Preven...
code_fim
hard
{ "lang": "python", "repo": "digital-science/dimcli", "path": "/dimcli/core/dsl_grammar_categories.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: srz-zumix/wandbox-api path: /wandbox/__php__.py import re import os from .cli import CLI from .runner import Runner from .utils import split_statements class PhpRunner(Runner): REQUIRE_INCLUDE_REGEX = re.compile(r'.*(require|require_once|include|include_once)\s*[\'"\(\)](.*?)[\'"\(\)]\s*;...
code_fim
hard
{ "lang": "python", "repo": "srz-zumix/wandbox-api", "path": "/wandbox/__php__.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> strings = tokens.split('.') path = "" for s in strings: s = s.strip().strip('\'"()') if s == 'PATH_SEPARATOR': self.add_include_path(dir, path) path = "" else: path += s if len(path) > 0: ...
code_fim
hard
{ "lang": "python", "repo": "srz-zumix/wandbox-api", "path": "/wandbox/__php__.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: Jiezhi/myleetcode path: /src/1207-UniqueNumberOfOccurrences.py #!/usr/bin/env python3 """ CREATED AT: 2022-11-30 URL: https://leetcode.com/problems/unique-number-of-occurrences/ GITHUB: https://github.com/Jiezhi/myleetcode FileName: 1207-UniqueNumberOfOccurrences <|fim_suffix|>Tag: See: "...
code_fim
medium
{ "lang": "python", "repo": "Jiezhi/myleetcode", "path": "/src/1207-UniqueNumberOfOccurrences.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> assert Solution().uniqueOccurrences(arr=[1, 2, 2, 1, 1, 3]) assert not Solution().uniqueOccurrences(arr=[1, 2]) assert Solution().uniqueOccurrences(arr=[-3, 0, 1, -3, 1, 1, 1, -3, 10, 0]) if __name__ == '__main__': test()<|fim_prefix|># repo: Jiezhi/myleetcode path: /src/1207-UniqueNumb...
code_fim
hard
{ "lang": "python", "repo": "Jiezhi/myleetcode", "path": "/src/1207-UniqueNumberOfOccurrences.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: beer-garden/brewtils path: /brewtils/test/comparable.py # -*- coding: utf-8 -*- """Module to simplify model comparisons. .. warning:: This module was created to simplify testing. As such, it's not recommended for production use. .. warning:: This module subject to change outside of ...
code_fim
hard
{ "lang": "python", "repo": "beer-garden/brewtils", "path": "/brewtils/test/comparable.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> def assert_role_equal(obj1, obj2, do_raise=False): return _assert_wrapper( obj1, obj2, expected_type=LegacyRole, deep_fields={"roles": partial(assert_role_equal, do_raise=True)}, do_raise=do_raise, ) def assert_system_equal(obj1, obj2, do_raise=False): ...
code_fim
hard
{ "lang": "python", "repo": "beer-garden/brewtils", "path": "/brewtils/test/comparable.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> try: assert ( isinstance(dict1, dict) and "ids" in dict1 ), "Not a job ID dict: %s" % str(dict1) assert ( isinstance(dict2, dict) and "ids" in dict2 ), "Not a job ID dict: %s" % str(dict2) lst1, lst2 = dict1.get("ids", None), dict2.get("...
code_fim
hard
{ "lang": "python", "repo": "beer-garden/brewtils", "path": "/brewtils/test/comparable.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> # plotting fig, axs = plt.subplots(2, 2, figsize=(2 * 3.5, 2 * 2.45), constrained_layout=True) ax0, ax1, ax2, ax3 = axs.flat for ax in axs[0].flat: ax.plot(xs, exact, label='exact', lw=1.5) ax.plot(xs, x, label='xs irfft', ls=':', lw=1.5) ax.legend(fontsize='x-smal...
code_fim
hard
{ "lang": "python", "repo": "mynl/aggregate", "path": "/aggregate/extensions/ft.py", "mode": "spm", "license": "BSD-3-Clause", "source": "the-stack-v2" }
<|fim_suffix|> #. Compute aggregate with enough space for the supported part of the distribution (say, where density > 1e-15 or so) #. Subtract the mean by rolling left (negative shift) by mean / bs buckets (mod n) #. fft shift = roll (in either direction) by n / 2 buckets, because the distributi...
code_fim
hard
{ "lang": "python", "repo": "mynl/aggregate", "path": "/aggregate/extensions/ft.py", "mode": "spm", "license": "BSD-3-Clause", "source": "the-stack-v2" }
<|fim_prefix|># repo: mynl/aggregate path: /aggregate/extensions/ft.py oll(wrap, B >> 1) df = pd.DataFrame({'x': xs, 'FFT pmf': pmf}) po = poisson(en) df['Exact pmf'] = po.pmf(df.x) df = df.set_index('x', drop=True) fig, [ax0, ax1] = plt.subplots(1, 2, figsize=(FIG_W * 2, FIG_H + 0.3), constrained_...
code_fim
hard
{ "lang": "python", "repo": "mynl/aggregate", "path": "/aggregate/extensions/ft.py", "mode": "psm", "license": "BSD-3-Clause", "source": "the-stack-v2" }
<|fim_prefix|># repo: Tetrite/cBinder path: /cBinder/HeaderFile.py import os import pathlib from cBinder.Scrapers import ScrapedData class HeaderFile: """ Class representing one C header file. Attributes ---------- filepath : Path Path object pointing to header file includes : list ...
code_fim
medium
{ "lang": "python", "repo": "Tetrite/cBinder", "path": "/cBinder/HeaderFile.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> d = ScrapedData(h_path, export_symbols) self.filepath = h_path self.enums = d.enums self.functions = d.functions self.structs = d.structs self.includes = d.includes self.defines = d.defines def __str__(self): return 'Header file path: ' ...
code_fim
medium
{ "lang": "python", "repo": "Tetrite/cBinder", "path": "/cBinder/HeaderFile.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> """ Gets paths to all header files in directory (recursively) Parameters --------- dirpath : str Library directory path string export_symbols: dict Dict containing lists of export symbols Returns ------- paths : list List of HeaderFile objects ...
code_fim
medium
{ "lang": "python", "repo": "Tetrite/cBinder", "path": "/cBinder/HeaderFile.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: X-DataInitiative/tick path: /tick/base_model/model_lipschitz.py # License: BSD 3 clause from abc import abstractmethod from . import Model __author__ = 'Stephane Gaiffas' class ModelLipschitz(Model): """An abstract base class for a model that implements lipschitz constants Parame...
code_fim
hard
{ "lang": "python", "repo": "X-DataInitiative/tick", "path": "/tick/base_model/model_lipschitz.py", "mode": "psm", "license": "BSD-3-Clause", "source": "the-stack-v2" }
<|fim_suffix|> """Returns the best Lipschitz constant, using all samples Warning: this might take some time, since it requires a SVD computation. Returns ------- output : `float` The best Lipschitz constant """ if self._fitted: if self._rea...
code_fim
hard
{ "lang": "python", "repo": "X-DataInitiative/tick", "path": "/tick/base_model/model_lipschitz.py", "mode": "spm", "license": "BSD-3-Clause", "source": "the-stack-v2" }
<|fim_suffix|> # Evento pygame.KEYDOWN es generado al presionar una tecla # Evento pygame.KEYUP es generado al soltar una tecla # ----------------------- Bucle principal del programa------- while not hecho: # -------- Bucle principal de eventos --------------- # Cerrar la pantalla de pygame al presionar en la ...
code_fim
hard
{ "lang": "python", "repo": "osmandi/programarcadegames", "path": "/Capítulo 10: Mando de juegos y gráficos/control_con_teclado.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> # Evento pygame.KEYDOWN es generado al presionar una tecla # Evento pygame.KEYUP es generado al soltar una tecla # ----------------------- Bucle principal del programa------- while not hecho: # -------- Bucle principal de eventos --------------- # Cerrar la pantalla de pygame al presionar en la...
code_fim
hard
{ "lang": "python", "repo": "osmandi/programarcadegames", "path": "/Capítulo 10: Mando de juegos y gráficos/control_con_teclado.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: osmandi/programarcadegames path: /Capítulo 10: Mando de juegos y gráficos/control_con_teclado.py # Importamos la librería de pygame import pygame # Iniciamos pygame pygame.init() # Definimos algunos colores NEGRO = [0, 0, 0] BLANCO = (255,255,255) VERDE = (0,255,0) ROJO = (255,0,0) AZUL = (0,0,...
code_fim
hard
{ "lang": "python", "repo": "osmandi/programarcadegames", "path": "/Capítulo 10: Mando de juegos y gráficos/control_con_teclado.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|>plugins.bsto.standalone( # initial window-size. Tuple of (X,Y) or "fullscreen" size = (1024,768), #"Size" : "fullscreen", # which mediaplayer do you use? I really like mplayer playerCmd = "mplayer -fs '%s'")<|fim_prefix|># repo: inkeso/pselect path: /bsto_standalone.py #!/usr/bin/env...
code_fim
medium
{ "lang": "python", "repo": "inkeso/pselect", "path": "/bsto_standalone.py", "mode": "spm", "license": "LicenseRef-scancode-warranty-disclaimer", "source": "the-stack-v2" }
<|fim_prefix|># repo: inkeso/pselect path: /bsto_standalone.py #!/usr/bin/env python2 # -*- coding: utf-8 -*- import plugins.bsto <|fim_suffix|>plugins.bsto.standalone( # initial window-size. Tuple of (X,Y) or "fullscreen" size = (1024,768), #"Size" : "fullscreen", # which mediaplayer do you use? I...
code_fim
medium
{ "lang": "python", "repo": "inkeso/pselect", "path": "/bsto_standalone.py", "mode": "psm", "license": "LicenseRef-scancode-warranty-disclaimer", "source": "the-stack-v2" }
<|fim_prefix|># repo: Ankuraxz/Major_Project path: /inference_example.py import cv2 import engine as eng import inference as inf import numpy as np import tensorrt as trt TRT_LOGGER = trt.Logger(trt.Logger.WARNING) trt_runtime = trt.Runtime(TRT_LOGGER) class_list=['n000037', 'n000021', 'n000005', 'n000104', 'n00008...
code_fim
medium
{ "lang": "python", "repo": "Ankuraxz/Major_Project", "path": "/inference_example.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|># PREDICTION ON DEFAULT h_input, d_input, h_output, d_output, stream = inf.allocate_buffers(engine, 1, trt.float32) out1 = inf.do_inference(engine, img1, h_input, d_input, h_output, d_output, stream, 1, HEIGHT, WIDTH) out2 = inf.do_inference(engine,img2,h_input,d_input,h_output,d_output,stream,1,HEIGHT,WI...
code_fim
hard
{ "lang": "python", "repo": "Ankuraxz/Major_Project", "path": "/inference_example.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> txid, rnd = self.proxy._call("name_new", 'd/' + name) # XXX: Store txid and/or rnd for name_firstupdate, poll at/around expected time def test_connection(self): try: self.proxy._call('help') return True except: return False def...
code_fim
hard
{ "lang": "python", "repo": "probar/syncnet", "path": "/namecoin.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: probar/syncnet path: /namecoin.py #!/usr/bin/env python2 import json from bitcoin.rpc import Proxy import httplib import os.path import platform def get_proxy(user, password, port=8336): return Proxy(service_url="http://{0}:{1}@localhost:{2}".format(user, password, port)) class NameTake...
code_fim
medium
{ "lang": "python", "repo": "probar/syncnet", "path": "/namecoin.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> def _build_json_value(self, secret, existing=None): existing = dict(existing) or {} existing['syncnet'] = existing.get('syncnet', {}) existing['syncnet']['secret'] = secret return existing<|fim_prefix|># repo: probar/syncnet path: /namecoin.py #!/usr/bin/env python2 i...
code_fim
hard
{ "lang": "python", "repo": "probar/syncnet", "path": "/namecoin.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> def test_percent_encoding(): """ Test whether percent encoding is working correctly based on an artificial test file. """ file = gff.GFFFile.read(join(data_dir("sequence"), "percent_test.gff3")) seqid, source, type, start, end, score, strand, phase, attrib \ = file[0] ...
code_fim
hard
{ "lang": "python", "repo": "biotite-dev/biotite", "path": "/tests/sequence/test_gff.py", "mode": "spm", "license": "BSD-3-Clause", "source": "the-stack-v2" }
<|fim_suffix|>@pytest.mark.parametrize( "path", ["bt_lysozyme.gp", "gg_avidin.gb", "ec_bl21.gb", "sc_chrom1.gb"] ) def test_genbank_consistency(path): """ Test whether the same annotation (if reasonable) can be read from a GFF3 file and a GenBank file. """ gb_file = gb.GenBankFile.read(join(data...
code_fim
hard
{ "lang": "python", "repo": "biotite-dev/biotite", "path": "/tests/sequence/test_gff.py", "mode": "spm", "license": "BSD-3-Clause", "source": "the-stack-v2" }
<|fim_prefix|># repo: biotite-dev/biotite path: /tests/sequence/test_gff.py # This source code is part of the Biotite package and is distributed # under the 3-Clause BSD License. Please see 'LICENSE.rst' for further # information. from tempfile import TemporaryFile from os.path import join import biotite.sequence as ...
code_fim
hard
{ "lang": "python", "repo": "biotite-dev/biotite", "path": "/tests/sequence/test_gff.py", "mode": "psm", "license": "BSD-3-Clause", "source": "the-stack-v2" }
<|fim_suffix|> seconds = int((self - dt.datetime.min).total_seconds()) remainder = dt.timedelta( seconds=seconds % delta.total_seconds(), microseconds=self.microsecond, ) quotient = self - remainder return quotient, remainder def __floordiv__(self, del...
code_fim
medium
{ "lang": "python", "repo": "Lakerfield/timelapse", "path": "/datetime_modulo.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: Lakerfield/timelapse path: /datetime_modulo.py import datetime as dt #treyhunner: https://gist.github.com/treyhunner/6218526 class datetime(dt.datetime): def __divmod__(self, delta): seconds = int((self - dt.datetime.min).total_seconds()) remainder = dt.timedelta( ...
code_fim
medium
{ "lang": "python", "repo": "Lakerfield/timelapse", "path": "/datetime_modulo.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: ryanfmurphy/c-sounds-fft path: /fastfour.py import numpy as np import sys import matplotlib.pyplot as plt ''' def arr_from_stdin(chunk_size) data = sys.stdin.read(chunk_size) arr = np.frombuffer(data,dtype=np.uint8) if arr.shape != (chunk_size,): raise IOError("not enough bytes ...
code_fim
medium
{ "lang": "python", "repo": "ryanfmurphy/c-sounds-fft", "path": "/fastfour.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|>chunk_size = 128*1024 nbins = 128 #with open('funsounds.wav','rb') as fh: if True: data = sys.stdin.read(chunk_size) arr = np.frombuffer(data,dtype=np.uint8) bins = np.fft.fft(arr,n=nbins) plt.plot(bins) sys.stdout.write(data) plt.show()<|fim_prefix|># repo: ryanfmurphy/c-sounds-f...
code_fim
medium
{ "lang": "python", "repo": "ryanfmurphy/c-sounds-fft", "path": "/fastfour.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: SocialFinanceDigitalLabs/AdventOfCode path: /solutions/2022/pughmds/day01/__main__.py EXPECTED_TEST_ANSWER_PART1 = [24000] EXPECTED_TEST_ANSWER_PART2 = [45000] def set_max(calories, max_calories): """ Returns the larger value """ return calories if calories > max_calories else m...
code_fim
medium
{ "lang": "python", "repo": "SocialFinanceDigitalLabs/AdventOfCode", "path": "/solutions/2022/pughmds/day01/__main__.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> """ Takes a list of values in "data" and returns sum of the largest group. Groups are separated by blank entries in the list. """ calorie_list = [] calories = 0 for item in data: item = item.strip() if item != "": calories += int(item) else: ...
code_fim
hard
{ "lang": "python", "repo": "SocialFinanceDigitalLabs/AdventOfCode", "path": "/solutions/2022/pughmds/day01/__main__.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> return max_calories def run_p2(data): """ Takes a list of values in "data" and returns sum of the largest group. Groups are separated by blank entries in the list. """ calorie_list = [] calories = 0 for item in data: item = item.strip() if item != "": ...
code_fim
hard
{ "lang": "python", "repo": "SocialFinanceDigitalLabs/AdventOfCode", "path": "/solutions/2022/pughmds/day01/__main__.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> self.fc2 = ln.Linear(inputs, 1, gain=1) def encode(self, x, lod): x = self.from_rgb[self.layer_count - lod - 1](x) x = F.leaky_relu(x, 0.2) for i in range(self.layer_count - lod - 1, self.layer_count): x = self.encode_block[i](x) return self.fc2(x...
code_fim
hard
{ "lang": "python", "repo": "LendelTheGreat/SCALAE", "path": "/net.py", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_prefix|># repo: LendelTheGreat/SCALAE path: /net.py self.instance_norm_1 = nn.InstanceNorm2d(outputs, affine=False, eps=1e-8) self.style_1 = ln.Linear(latent_size, 2 * outputs, gain=1) self.popmap_1 = ln.Conv2d(1, 2 * outputs, 3, 1, 1, bias=False) self.conv_2 = ln.Conv2d(outputs, o...
code_fim
hard
{ "lang": "python", "repo": "LendelTheGreat/SCALAE", "path": "/net.py", "mode": "psm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_prefix|># repo: LendelTheGreat/SCALAE path: /net.py nn.ModuleList() resolution = 2 ** (self.layer_count + 1) for i in range(self.layer_count): outputs = min(self.maxf, startf * mul) self.from_rgb.append(FromRGB(channels, inputs)) fused_scale = resolution >...
code_fim
hard
{ "lang": "python", "repo": "LendelTheGreat/SCALAE", "path": "/net.py", "mode": "psm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_prefix|># repo: Ryanb58/fastapi-saas-base path: /app/dependencies/auth.py from fastapi import Depends, FastAPI, HTTPException from sqlalchemy.orm import Session from starlette.status import HTTP_401_UNAUTHORIZED import jwt from jwt import PyJWTError from app.dependencies import get_db from app.controllers.auth...
code_fim
hard
{ "lang": "python", "repo": "Ryanb58/fastapi-saas-base", "path": "/app/dependencies/auth.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> # async def get_current_active_account(current_user: Account = Depends(get_current_account)): # if current_user.disabled: # raise HTTPException(status_code=400, detail="Inactive user") # return current_user<|fim_prefix|># repo: Ryanb58/fastapi-saas-base path: /app/dependencies/auth.py fr...
code_fim
hard
{ "lang": "python", "repo": "Ryanb58/fastapi-saas-base", "path": "/app/dependencies/auth.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> dataframe['Hour'] = dataframe[column].dt.hour dataframe['Minute'] = dataframe[column].dt.minute dataframe['Second'] = dataframe[column].dt.second return dataframe # Return new dataframe<|fim_prefix|># repo: KennethTBarrett/lambdata path: /dt.py import pandas as pd def date_splitter(data...
code_fim
hard
{ "lang": "python", "repo": "KennethTBarrett/lambdata", "path": "/dt.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|>def time_splitter(dataframe, column): # Splits times into hour / minute / second dataframe['Hour'] = dataframe[column].dt.hour dataframe['Minute'] = dataframe[column].dt.minute dataframe['Second'] = dataframe[column].dt.second return dataframe # Return new dataframe<|fim_prefix|># repo: K...
code_fim
medium
{ "lang": "python", "repo": "KennethTBarrett/lambdata", "path": "/dt.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: KennethTBarrett/lambdata path: /dt.py import pandas as pd def date_splitter(dataframe, column): # Splits dates into month / day / year dataframe['Month'] = dataframe[column].dt.month dataframe['Day'] = dataframe[column].dt.day dataframe['Year'] = dataframe[column].dt.year return...
code_fim
medium
{ "lang": "python", "repo": "KennethTBarrett/lambdata", "path": "/dt.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: Ascend/ModelZoo-PyTorch path: /PyTorch/built-in/cv/semantic_segmentation/Attention_R2U_Net_for_PyTorch/dataset.py # BSD 3-Clause License # # Copyright (c) 2017 xxxx # All rights reserved. # Copyright 2021 Huawei Technologies Co., Ltd # # Redistribution and use in source and binary forms, wi...
code_fim
hard
{ "lang": "python", "repo": "Ascend/ModelZoo-PyTorch", "path": "/PyTorch/built-in/cv/semantic_segmentation/Attention_R2U_Net_for_PyTorch/dataset.py", "mode": "psm", "license": "BSD-3-Clause", "source": "the-stack-v2" }
<|fim_suffix|> # model hyper-parameters parser.add_argument('--train_ratio', type=float, default=0.7) parser.add_argument('--valid_ratio', type=float, default=0.1) parser.add_argument('--test_ratio', type=float, default=0.2) # data path parser.add_argument('--origin_data_path', type=str, d...
code_fim
hard
{ "lang": "python", "repo": "Ascend/ModelZoo-PyTorch", "path": "/PyTorch/built-in/cv/semantic_segmentation/Attention_R2U_Net_for_PyTorch/dataset.py", "mode": "spm", "license": "BSD-3-Clause", "source": "the-stack-v2" }
<|fim_suffix|> src = os.path.join(config.origin_data_path, data_list[idx]) dst = os.path.join(config.test_path,data_list[idx]) copyfile(src, dst) src = os.path.join(config.origin_GT_path, GT_list[idx]) dst = os.path.join(config.test_GT_path, GT_list[idx]) co...
code_fim
hard
{ "lang": "python", "repo": "Ascend/ModelZoo-PyTorch", "path": "/PyTorch/built-in/cv/semantic_segmentation/Attention_R2U_Net_for_PyTorch/dataset.py", "mode": "spm", "license": "BSD-3-Clause", "source": "the-stack-v2" }
<|fim_prefix|># repo: as23187/WeFe path: /kernel/components/feature/onehot/horzonehot/param.py # Copyright 2021 Tianmian Tech. All Rights Reserved. # # 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 Lice...
code_fim
hard
{ "lang": "python", "repo": "as23187/WeFe", "path": "/kernel/components/feature/onehot/horzonehot/param.py", "mode": "psm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|> def __init__(self, transform_col_indexes=-1, transform_col_names=None, need_run=True, need_alignment=True): super(HorzOneHotParam, self).__init__() if transform_col_names is None: transform_col_names = [] self.transform_col_indexes = transform_col_indexes se...
code_fim
medium
{ "lang": "python", "repo": "as23187/WeFe", "path": "/kernel/components/feature/onehot/horzonehot/param.py", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_prefix|># repo: nasingfaund/iterm2-images path: /iterm2_images/transfer_cli.py #!/usr/bin/env python3 """Transfers files from the machine you are logged into to your desktop.""" <|fim_suffix|>from .payloads import FileEsc @click.command() @click.argument('file', type=click_pathlib.Path(readable=True)) def ma...
code_fim
easy
{ "lang": "python", "repo": "nasingfaund/iterm2-images", "path": "/iterm2_images/transfer_cli.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> @click.command() @click.argument('file', type=click_pathlib.Path(readable=True)) def main(file): """The main function.""" FileEsc.open(file).write()<|fim_prefix|># repo: nasingfaund/iterm2-images path: /iterm2_images/transfer_cli.py #!/usr/bin/env python3 """Transfers files from the machine you...
code_fim
medium
{ "lang": "python", "repo": "nasingfaund/iterm2-images", "path": "/iterm2_images/transfer_cli.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|>color(color3) begin_fill() forward(lado) left(45) forward(pequenoAngulo) left(135) forward(lado) left(45) forward(pequenoAngulo) end_fill() left(135) forward(lado) color(color2) begin_fill() left(45) forward(pequenoAngulo) right(135) forward(lado) right(45) forward(pequenoAngulo) right(135) forward(lado...
code_fim
hard
{ "lang": "python", "repo": "programingfrik/randomPython", "path": "/fichaTetris.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: programingfrik/randomPython path: /fichaTetris.py #!/usr/bin/python3 from turtle import * from math import * lado = 100 doble = lado * 2 mitad = lado * 0.5 pequeno = lado * 0.2 pequenoAngulo = (pequeno / sin(radians(45))) interior = lado - (pequeno * 2) dobleInterior = doble - (pequeno * 2) co...
code_fim
hard
{ "lang": "python", "repo": "programingfrik/randomPython", "path": "/fichaTetris.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: antocuni/python-zeep path: /src/zeep/wsse/utils.py import datetime import pytz from lxml import etree from lxml.builder import ElementMaker NSMAP = { 'wsse': 'http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-secext-1.0.xsd', } WSSE = ElementMaker(namespace=NSMAP['wsse']) ...
code_fim
hard
{ "lang": "python", "repo": "antocuni/python-zeep", "path": "/src/zeep/wsse/utils.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> """ header_qname = '{http://schemas.xmlsoap.org/soap/envelope/}Header' header = doc.find(header_qname) if header is None: header = etree.Element(header_qname) doc.insert(0, header) security = header.find('wsse:Security', namespaces=NSMAP) if security is None: ...
code_fim
medium
{ "lang": "python", "repo": "antocuni/python-zeep", "path": "/src/zeep/wsse/utils.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: fujimakishouten/unzip-cp932 path: /unzip.py #!/usr/bin/env python3 # vim: set expandtab tabstop=4 shiftwidth=4 softtabstop=4: import argparse import chardet import os import zipfile parser = argparse.ArgumentParser(description = "Extract zip file includes cp932 encoding file name") parser.a...
code_fim
hard
{ "lang": "python", "repo": "fujimakishouten/unzip-cp932", "path": "/unzip.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|>with zipfile.ZipFile(args.file, 'r') as archive: for item in archive.namelist(): encoding = chardet.detect(item.encode("cp437")) filename = os.path.join(args.directory, item.encode("cp437").decode(encoding['encoding'])) directory = os.path.dirname(filename) if not os.p...
code_fim
hard
{ "lang": "python", "repo": "fujimakishouten/unzip-cp932", "path": "/unzip.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: pytorch/pytorch path: /torch/nn/quantized/modules/__init__.py r"""Quantized Modules Note:: The `torch.nn.quantized` namespace is in the process of being deprecated. Please, use `torch.ao.nn.quantized` instead. """ from torch.ao.nn.quantized.modules.activation import ReLU6, Hardswish, EL...
code_fim
hard
{ "lang": "python", "repo": "pytorch/pytorch", "path": "/torch/nn/quantized/modules/__init__.py", "mode": "psm", "license": "BSD-3-Clause", "source": "the-stack-v2" }
<|fim_suffix|>__all__ = [ 'BatchNorm2d', 'BatchNorm3d', 'Conv1d', 'Conv2d', 'Conv3d', 'ConvTranspose1d', 'ConvTranspose2d', 'ConvTranspose3d', 'DeQuantize', 'ELU', 'Embedding', 'EmbeddingBag', 'GroupNorm', 'Hardswish', 'InstanceNorm1d', 'InstanceNorm2d', ...
code_fim
hard
{ "lang": "python", "repo": "pytorch/pytorch", "path": "/torch/nn/quantized/modules/__init__.py", "mode": "spm", "license": "BSD-3-Clause", "source": "the-stack-v2" }
<|fim_suffix|> return "prelink-" + self.version def dependencies(self) -> Iterator[Package]: yield self.libelf def fetch(self, ctx: Context) -> None: run( ctx, [ "svn", "co", "-r" + self.version, "sv...
code_fim
hard
{ "lang": "python", "repo": "vusec/instrumentation-infra", "path": "/infra/packages/prelink/__init__.py", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|> def __init__(self, version: str): self.version = version # assert version == '209' self.libelf = LibElf("0.7.0") def ident(self) -> str: return "prelink-" + self.version def dependencies(self) -> Iterator[Package]: yield self.libelf def fetch(self...
code_fim
hard
{ "lang": "python", "repo": "vusec/instrumentation-infra", "path": "/infra/packages/prelink/__init__.py", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_prefix|># repo: vusec/instrumentation-infra path: /infra/packages/prelink/__init__.py import os import shutil from typing import Iterator from ...context import Context from ...package import Package from ...util import apply_patch, download, run class LibElf(Package): """ :identifier: libelf-<version...
code_fim
hard
{ "lang": "python", "repo": "vusec/instrumentation-infra", "path": "/infra/packages/prelink/__init__.py", "mode": "psm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|>url_domain_dict = {} reader = csv.DictReader( csv_file, fieldnames) for row in reader: url_domain_dict[row["BASE_DOMAIN_PK"]] = row url_domain_dict[row["BASE_DOMAIN_PK"]].pop("BASE_DOMAIN_PK", None) helper.dump_json_to_file('resources/data/annotations/json/ALL_URL_DOMAIN_METADATA.json', url_domai...
code_fim
hard
{ "lang": "python", "repo": "stevenzim/chiir-2019", "path": "/resources/scripts/setup/all_annotations_to_json.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: stevenzim/chiir-2019 path: /resources/scripts/setup/all_annotations_to_json.py # Scripts to convert 1) cochrane annotation csv files to json import csv from src import helper # COCHRANE QUESTIONS CONVESRION csv_file = open('resources/data/annotations/csv/COCHRANE_QUESTION_DEFINITIONS_FINAL.c...
code_fim
medium
{ "lang": "python", "repo": "stevenzim/chiir-2019", "path": "/resources/scripts/setup/all_annotations_to_json.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> # PAIN IN ASS.... needed to add title... there is some strange character in first postion of CSV...hence the correction # of field name 0 # The file name is now XLS_JUDGMENTS_HELPFUL csv_file = open('resources/data/annotations/csv/ALL_JUDGMENTS_v_1.csv', 'r') reader = csv.reader(csv_file) fieldnames = ne...
code_fim
medium
{ "lang": "python", "repo": "stevenzim/chiir-2019", "path": "/resources/scripts/setup/all_annotations_to_json.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> for data_file_name in data_filenames: metadata_file_name = data_file_name.split('.')[0] + '_metadata.json' shutil.copyfile(args.data_dir + data_file_name, output_dir + data_file_name) shutil.copyfile(args.data_dir + metadata_file_name, output_dir + metadata_file_name) copy_d...
code_fim
hard
{ "lang": "python", "repo": "BlissChapman/SyntheticStatistics", "path": "/brainpedia/tag_splitter.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> shutil.copyfile(args.data_dir + data_file_name, output_dir + data_file_name) shutil.copyfile(args.data_dir + metadata_file_name, output_dir + metadata_file_name) copy_data(data_filenames_with_tag, args.output_dir_with_tag) copy_data(data_filenames_without_tag, args.output_dir_without_tag...
code_fim
hard
{ "lang": "python", "repo": "BlissChapman/SyntheticStatistics", "path": "/brainpedia/tag_splitter.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: BlissChapman/SyntheticStatistics path: /brainpedia/tag_splitter.py import argparse import os import random import shutil import sys from preprocessor import Preprocessor parser = argparse.ArgumentParser(description="Utility script that given a folder of Brainpedia data can generate two new fold...
code_fim
hard
{ "lang": "python", "repo": "BlissChapman/SyntheticStatistics", "path": "/brainpedia/tag_splitter.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> tf.Variable(777) with tf.Session() as sess: init = tf.global_variables_initializer() sess.run(init) start = global_step.eval() for i in range(start,128): for start,end in zip(range(0,len(trX),128),range(128,len(trX)+1,128)): sess.run(train_op,feed_dict={X:trX[start:end...
code_fim
hard
{ "lang": "python", "repo": "fanshaohua001/tfnote", "path": "/code/tf_load.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: fanshaohua001/tfnote path: /code/tf_load.py import tensorflow as tf import numpy as np import os from tensorflow.examples.tutorials.mnist import input_data def init_weights(shape): return tf.Variable(tf.random_normal(shape,mean=0,stddev=0.01)) def model(X,w_h,w_h2,w_o,p_keep_input,p_keep_hidd...
code_fim
hard
{ "lang": "python", "repo": "fanshaohua001/tfnote", "path": "/code/tf_load.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: Azure/autorest.az path: /test/unittest/expected/tests/cmdlet/test_positive_empty.py # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. # Licensed under the MIT License. See License.txt in the project root for # ...
code_fim
medium
{ "lang": "python", "repo": "Azure/autorest.az", "path": "/test/unittest/expected/tests/cmdlet/test_positive_empty.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|># Test class for Scenario class PositiveTest(ScenarioTest): def __init__(self, *args, **kwargs): super(PositiveTest, self).__init__(*args, **kwargs)<|fim_prefix|># repo: Azure/autorest.az path: /test/unittest/expected/tests/cmdlet/test_positive_empty.py # ------------------------------------...
code_fim
medium
{ "lang": "python", "repo": "Azure/autorest.az", "path": "/test/unittest/expected/tests/cmdlet/test_positive_empty.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> def __init__(self, *args, **kwargs): super(PositiveTest, self).__init__(*args, **kwargs)<|fim_prefix|># repo: Azure/autorest.az path: /test/unittest/expected/tests/cmdlet/test_positive_empty.py # -------------------------------------------------------------------------- # Copyright (c) Micros...
code_fim
medium
{ "lang": "python", "repo": "Azure/autorest.az", "path": "/test/unittest/expected/tests/cmdlet/test_positive_empty.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> def fit(self, X, Y=None): """ Nothing to be done, but useful when included in a scikit-learn Pipeline. """ return self def __transform(self, cells): cells = np.asarray(cells) if len(cells.shape) == 1 and self.min_persistence >= 0: res = ...
code_fim
hard
{ "lang": "python", "repo": "GUDHI/gudhi-devel", "path": "/src/python/gudhi/sklearn/cubical_persistence.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: GUDHI/gudhi-devel path: /src/python/gudhi/sklearn/cubical_persistence.py # This file is part of the Gudhi Library - https://gudhi.inria.fr/ - which is released under MIT. # See file LICENSE or go to https://gudhi.inria.fr/licensing/ for full license details. # Author(s): Vincent Rouvreau # ...
code_fim
hard
{ "lang": "python", "repo": "GUDHI/gudhi-devel", "path": "/src/python/gudhi/sklearn/cubical_persistence.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: aws/aws-cli path: /tests/functional/ecs/test_execute_command.py # Copyright 2021 Amazon.com, Inc. or its affiliates. All Rights Reserved. # # Licensed under the Apache License, Version 2.0 (the "License"). You # may not use this file except in compliance with the License. A copy of # the License ...
code_fim
hard
{ "lang": "python", "repo": "aws/aws-cli", "path": "/tests/functional/ecs/test_execute_command.py", "mode": "psm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|> @mock.patch('awscli.customizations.ecs.executecommand.check_call') def test_execute_command_fails(self, mock_check_call): cmdline = 'ecs execute-command --cluster someCluster ' \ '--task someTaskId ' \ '--interactive --command ls ' \ '-...
code_fim
hard
{ "lang": "python", "repo": "aws/aws-cli", "path": "/tests/functional/ecs/test_execute_command.py", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|> matrix = [ [3, 0, 1, 4, 2], [5, 6, 3, 2, 1], [1, 2, 0, 1, 5], [4, 1, 0, 1, 7], [1, 0, 3, 0, 5] ] obj = NumMatrix(matrix) assert obj.sumRegion(2, 1, 4, 3) == 8 assert obj.sumRegion(1, 1, 2, 2) == 11 assert obj.sumRegion(1, 2, 3, 4)...
code_fim
medium
{ "lang": "python", "repo": "shubhamoli/solutions", "path": "/leetcode/medium/304-Range_sum_2D.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> # call to this will be frequent, so try to avoid calculation in this def sumRegion(self, row1: int, col1: int, row2: int, col2: int) -> int: return self._sum[row2+1][col2+1] - self._sum[row1][col2+1] - self._sum[row2+1][col1] + self._sum[row1][col1] if __name__ == "__main__": matri...
code_fim
hard
{ "lang": "python", "repo": "shubhamoli/solutions", "path": "/leetcode/medium/304-Range_sum_2D.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: shubhamoli/solutions path: /leetcode/medium/304-Range_sum_2D.py """ Leetcode #304 """ from typing import List # Extension of LC#307 class NumMatrix: def __init__(self, matrix: List[List[int]]): if not matrix or not matrix[0]: return M = len(matrix) ...
code_fim
hard
{ "lang": "python", "repo": "shubhamoli/solutions", "path": "/leetcode/medium/304-Range_sum_2D.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: InsaneMonster/USienaRL path: /usienarl/interfaces/pass_through.py # # Copyright (C) 2019 Luca Pasqualini # University of Siena - Artificial Intelligence Laboratory - SAILab # # # USienaRL is licensed under a BSD 3-Clause. # # You should have received a copy of the license along with this # work. ...
code_fim
hard
{ "lang": "python", "repo": "InsaneMonster/USienaRL", "path": "/usienarl/interfaces/pass_through.py", "mode": "psm", "license": "BSD-3-Clause", "source": "the-stack-v2" }
<|fim_suffix|> @property def observation_space_shape(self): # Just return the environment state space shape return self._environment.state_space_shape @property def agent_action_space_type(self) -> SpaceType: # Just return the environment action space type return self._en...
code_fim
hard
{ "lang": "python", "repo": "InsaneMonster/USienaRL", "path": "/usienarl/interfaces/pass_through.py", "mode": "spm", "license": "BSD-3-Clause", "source": "the-stack-v2" }