text
stringlengths
232
16.3k
domain
stringclasses
1 value
difficulty
stringclasses
3 values
meta
dict
<|fim_suffix|> Arguments: com (dict): SQL DB record `com` bucket ext (dict): SQL DB record `ext` bucket Returns: dict: An event record representing SQL DB with disabled TDE """ friendly_cloud_type = util.friendly_string(com.get('cloud_type')) reference = com.get('reference') ...
code_fim
hard
{ "lang": "python", "repo": "TinLe/cloudmarker", "path": "/cloudmarker/events/azsqldatabasetdeevent.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: PRBonn/voxblox_pybind path: /tests/test_voxblox_pybind.py """Test the C++/Python bindings.""" import unittest import numpy as np from voxblox import ( BaseTsdfIntegrator, FastTsdfIntegrator, MergedTsdfIntegrator, SimpleTsdfIntegrator, ) class VoxbloxPybindTest(unittest.TestCas...
code_fim
hard
{ "lang": "python", "repo": "PRBonn/voxblox_pybind", "path": "/tests/test_voxblox_pybind.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> self._test_integrator( FastTsdfIntegrator(voxel_size=self.voxel_size, sdf_trunc=self.sdf_trunc) ) def test_merged_tsdf_integrator(self): self._test_integrator( MergedTsdfIntegrator(voxel_size=self.voxel_size, sdf_trunc=self.sdf_trunc) ) def...
code_fim
hard
{ "lang": "python", "repo": "PRBonn/voxblox_pybind", "path": "/tests/test_voxblox_pybind.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: emgoinv/card-games path: /deck_of_cards.py import random class card: """a single standard playing card""" def __init__(self, suit, number): self.suit = suit self.num = number def __str__(self): suit_str = {0:'♥', 1:'♦', 2: '♣', 3:'♠'} if sel...
code_fim
medium
{ "lang": "python", "repo": "emgoinv/card-games", "path": "/deck_of_cards.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> self.deck = [card(s, n) for s in range(3) for n in range(1, 14) ] def __str__(self): for c in self.deck: print(c.__str__()) def shuffle(self): random.shuffle(self.deck) def deal(self): self.deck.append(self.deck.pop(0)) return self.d...
code_fim
medium
{ "lang": "python", "repo": "emgoinv/card-games", "path": "/deck_of_cards.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: sanjastevanovic/epnurbs path: /build/lib/epnurbs/createnurbsopening.py # epnurbs.createopening module contains a method for creating approximation of a NURBS opening in EnergyPlus files from eppy import modeleditor from eppy.modeleditor import IDF from .helper_methods import subtract, dotp...
code_fim
hard
{ "lang": "python", "repo": "sanjastevanovic/epnurbs", "path": "/build/lib/epnurbs/createnurbsopening.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> vert_str = "{:f}, {:f}, {:f}, {:f}, {:f}, {:f}, {:f}, {:f}, {:f}, {:f}, {:f}, {:f}".format( vertex1[0], vertex1[1], vertex1[2], vertex2[0], vertex2[1], vertex2[2], vertex3[0], vertex3[1], ve...
code_fim
hard
{ "lang": "python", "repo": "sanjastevanovic/epnurbs", "path": "/build/lib/epnurbs/createnurbsopening.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> ################################################################################# # create string of idf definitions for rectangles that approximate NURBS opening ################################################################################# idf_total_opening_def = "" for i in...
code_fim
hard
{ "lang": "python", "repo": "sanjastevanovic/epnurbs", "path": "/build/lib/epnurbs/createnurbsopening.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> gm_ups_k = gm_ups_k.prune(self.elim_threshold) gm_ups_k = gm_ups_k.merge_and_cap(self.merge_threshold, self.L_max) return gm_ups_k def update(self, Z, preds_k): # == Gating == cand_Z = self.gating(Z, preds_k) \ if self.use_gating \ else ...
code_fim
hard
{ "lang": "python", "repo": "vltanh/trackun", "path": "/trackun/filters/phd/gms.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: vltanh/trackun path: /trackun/filters/phd/gms.py from dataclasses import dataclass from trackun.filters.base import GMSFilter from trackun.common.gaussian_mixture import GaussianMixture from trackun.common.kalman_filter import KalmanFilter from trackun.common.gating import EllipsoidallGating im...
code_fim
hard
{ "lang": "python", "repo": "vltanh/trackun", "path": "/trackun/filters/phd/gms.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> w = (preds_k.gm.w * qs.T) \ * self.model.detection_model.get_probability() w = w / (self.model.clutter_model.lambda_c * self.model.clutter_model.pdf_c + w.sum(1)[:, np.newaxis]) gm_upds_k.w[N1:] = w.reshape(-1) ...
code_fim
hard
{ "lang": "python", "repo": "vltanh/trackun", "path": "/trackun/filters/phd/gms.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> with open(options.input_files[0], 'r') as f: p = Parser(f.read()) ast = p.program() if options.show_ast: print(ast.pprint(0)) print("-----") if options.parse_only: sys.exit(0) if options.typecheck: t = TypeChecker(...
code_fim
hard
{ "lang": "python", "repo": "catseye/Castile", "path": "/src/castile/main.py", "mode": "spm", "license": "BSD-3-Clause", "source": "the-stack-v2" }
<|fim_suffix|> argparser = ArgumentParser() argparser.add_argument('input_files', nargs='+', metavar='FILENAME', type=str, help='Source files containing the Castile program' ) argparser.add_argument("-a", "--show-ast", action="store_true", dest="show_ast", default=False, help="sh...
code_fim
medium
{ "lang": "python", "repo": "catseye/Castile", "path": "/src/castile/main.py", "mode": "spm", "license": "BSD-3-Clause", "source": "the-stack-v2" }
<|fim_prefix|># repo: catseye/Castile path: /src/castile/main.py """castile {options} program-file.castile Interpreter/compiler for Castile, a programming language with union types. """ import sys from argparse import ArgumentParser from castile.parser import Parser from castile.eval import Program from castile.t...
code_fim
medium
{ "lang": "python", "repo": "catseye/Castile", "path": "/src/castile/main.py", "mode": "psm", "license": "BSD-3-Clause", "source": "the-stack-v2" }
<|fim_suffix|> def _main(): if len(sys.argv) == 1: # https://twitter.com/semiexp/status/1227192389120356353 height = 8 width = 8 problem = [ [0, 0, 0, 5, 4, 0, 0, 0], [0, 0, 0, 4, 1, 3, 0, 0], [1, 0, 0, 0, 0, 0, 0, 4], [6, 0, 4, 0, 0, 0...
code_fim
hard
{ "lang": "python", "repo": "semiexp/cspuz", "path": "/cspuz/puzzle/fillomino.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: semiexp/cspuz path: /cspuz/puzzle/fillomino.py import sys import subprocess import cspuz from cspuz import Solver, graph from cspuz.puzzle import util from cspuz.generator import generate_problem, count_non_default_values, ArrayBuilder2D def solve_fillomino(height, width, problem, checkered=Fa...
code_fim
hard
{ "lang": "python", "repo": "semiexp/cspuz", "path": "/cspuz/puzzle/fillomino.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> if len(sys.argv) == 1: # https://twitter.com/semiexp/status/1227192389120356353 height = 8 width = 8 problem = [ [0, 0, 0, 5, 4, 0, 0, 0], [0, 0, 0, 4, 1, 3, 0, 0], [1, 0, 0, 0, 0, 0, 0, 4], [6, 0, 4, 0, 0, 0, 0, 7], ...
code_fim
hard
{ "lang": "python", "repo": "semiexp/cspuz", "path": "/cspuz/puzzle/fillomino.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|># use case for IFERROR: you want to scan an iterable of mixed data # types, and just plain find the ones that match a string, w/out # worrying about the fact that some are np.NaN or an int or something assert not if_error(partial(op.contains, 1), "spam", False) #^^ exception b/c float not iterable asse...
code_fim
hard
{ "lang": "python", "repo": "kevintroy/funktools", "path": "/funktools.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: kevintroy/funktools path: /funktools.py """ A few higher-order functions to help learn how certain libraries work and facilate doing stupid hacky stuff with data. These will not be super-fast like numpy functions, so in general you're better off looking at the numpy docs first to see if there's...
code_fim
hard
{ "lang": "python", "repo": "kevintroy/funktools", "path": "/funktools.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> inputs_np = [] for i in range(4): inputs_np.append(np.random.randint(-128, 127, size=[1, 4], dtype="int8")) compare_fq_to_int(out, inputs_np) @pytest.mark.parametrize("k", [0, 1, 5]) @pytest.mark.parametrize("axis", [0, -1, 1]) @pytest.mark.parametrize("is_ascend", [True, False]) @p...
code_fim
hard
{ "lang": "python", "repo": "apache/tvm", "path": "/tests/python/relay/test_pass_fake_quantization_to_integer.py", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|>def test_fake_quantize_clip_per_channel(): x = relay.var("x", shape=[1, 3, 224, 224], dtype="uint8") x = relay.qnn.op.dequantize( x, relay.const([1.0, 2.0, 3.0]), relay.const([96, 114, 128]), axis=1 ) op = relay.op.clip(x, 0, 6) op = relay.qnn.op.quantize( op, relay.co...
code_fim
hard
{ "lang": "python", "repo": "apache/tvm", "path": "/tests/python/relay/test_pass_fake_quantization_to_integer.py", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_prefix|># repo: apache/tvm path: /tests/python/relay/test_pass_fake_quantization_to_integer.py x = relay.var("x", shape=[1, 3, 224, 224], dtype="int8") zero = relay.const(0) x = relay.qnn.op.dequantize(x, relay.const(2.0), zero) op = relay.op.transpose(x, [1, 0, 2, 3]) op = relay.op.reshape(op...
code_fim
hard
{ "lang": "python", "repo": "apache/tvm", "path": "/tests/python/relay/test_pass_fake_quantization_to_integer.py", "mode": "psm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|> sut.load() expected += 'EOF' self.assertEqual(sut.content, expected) def _mock_sublime_load_resource(self, path, modified=False): """Mocks the sublime.load_resource function """ path = os.path.join( os.path.dirname(__file__), ...
code_fim
hard
{ "lang": "python", "repo": "DamnWidget/libconda", "path": "/st3/libconda/tests/test_template.py", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|> path = os.path.join( os.path.dirname(__file__), '..', 'ui', 'templates', 'golconda_panel.jinja' ) with open(path) as f: if not modified: return f.read() return f.read() + 'EOF'<|fim_prefix|># repo: DamnWidget/libcond...
code_fim
hard
{ "lang": "python", "repo": "DamnWidget/libconda", "path": "/st3/libconda/tests/test_template.py", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_prefix|># repo: DamnWidget/libconda path: /st3/libconda/tests/test_template.py import os import unittest from unittest.mock import Mock, patch class TestTemplate(unittest.TestCase): """Tests Template class """ def setUp(self): self.sublime = Mock() self.sublime.load_resource = self...
code_fim
hard
{ "lang": "python", "repo": "DamnWidget/libconda", "path": "/st3/libconda/tests/test_template.py", "mode": "psm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|> packages = get_packages_from_directory(file_system, 'packages') expected_packages = { 'org-art-x64-linux-gcc-debug-12.4.0.SNAPSHOT20230120115015000006.tar.gz', 'org-art-x64-linux-gcc-debug-12.4.0.tar.gz' } self.assertCountEqual(packages, expected_p...
code_fim
hard
{ "lang": "python", "repo": "dansandu/praline", "path": "/sources/praline/common/package_test.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: dansandu/praline path: /sources/praline/common/package_test.py from praline.common import (Architecture, ArtifactManifest, ArtifactVersion, ArtifactType, ArtifactDependency, ArtifactLoggingLevel, Compiler, ExportedSymbols, Mode, DependencyScope, ...
code_fim
hard
{ "lang": "python", "repo": "dansandu/praline", "path": "/sources/praline/common/package_test.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> self.assertEqual(identifier, 'org-art-x64-windows-msvc-release') self.assertEqual(version, '12.4.0.SNAPSHOT20210125115010123456') def test_get_matching_packages(self): dependency = 'org-art-x64-linux-gcc-debug-12.+4.+0.SNAPSHOT.tar.gz' candidates = [ 'org-...
code_fim
hard
{ "lang": "python", "repo": "dansandu/praline", "path": "/sources/praline/common/package_test.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: jo-gay/py_alpha_amd_release path: /filters/apply_filters.py # # Py-Alpha-AMD Registration Framework # Author: Johan Ofverstedt, Jo Gay # Reference: Fast and Robust Symmetric Image Registration Based on Distances Combining Intensity and Spatial Information # # Copyright 2019 Johan Ofverstedt # # P...
code_fim
hard
{ "lang": "python", "repo": "jo-gay/py_alpha_amd_release", "path": "/filters/apply_filters.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> if equalize: im = filters.image_histogram_equalization(im) if quantize: im = np.rint(im * (quantize-1))/(quantize-1) return im def openAndPreProcessImage(path, copyOrig=False, preproc={}): """Open an image file, optionally make a copy, and apply preprocessing...
code_fim
hard
{ "lang": "python", "repo": "jo-gay/py_alpha_amd_release", "path": "/filters/apply_filters.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> if quantize: im = np.rint(im * (quantize-1))/(quantize-1) return im def openAndPreProcessImage(path, copyOrig=False, preproc={}): """Open an image file, optionally make a copy, and apply preprocessing to it. """ try: im = Image.open(path).convert('L') #Open as a u...
code_fim
hard
{ "lang": "python", "repo": "jo-gay/py_alpha_amd_release", "path": "/filters/apply_filters.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> # 返回数据的数目 # ...<|fim_prefix|># repo: DataXujing/PyTorchIntroduction path: /Chapter2/ex_2_31.py """ 该代码仅为演示类的构造方法所用,并不能实际运行 (#号及其后面内容为注释,可以忽略) """ class Dataset(object): <|fim_middle|> def __getitem__(self, index): # index: 数据缩索引(整数,范围为0到数据数目-1) # ... # 返回数据张...
code_fim
medium
{ "lang": "python", "repo": "DataXujing/PyTorchIntroduction", "path": "/Chapter2/ex_2_31.py", "mode": "spm", "license": "BSD-3-Clause", "source": "the-stack-v2" }
<|fim_prefix|># repo: DataXujing/PyTorchIntroduction path: /Chapter2/ex_2_31.py """ 该代码仅为演示类的构造方法所用,并不能实际运行 (#号及其后面内容为注释,可以忽略) """ class Dataset(object): <|fim_suffix|> # 返回数据的数目 # ...<|fim_middle|> def __getitem__(self, index): # index: 数据缩索引(整数,范围为0到数据数目-1) # ... # 返回数据张...
code_fim
medium
{ "lang": "python", "repo": "DataXujing/PyTorchIntroduction", "path": "/Chapter2/ex_2_31.py", "mode": "psm", "license": "BSD-3-Clause", "source": "the-stack-v2" }
<|fim_suffix|> # index: 数据缩索引(整数,范围为0到数据数目-1) # ... # 返回数据张量 def __len__(self): # 返回数据的数目 # ...<|fim_prefix|># repo: DataXujing/PyTorchIntroduction path: /Chapter2/ex_2_31.py """ 该代码仅为演示类的构造方法所用,并不能实际运行 (#号及其后面内容为注释,可以忽略) """ class Dataset(object): <|fim_middle|> def ...
code_fim
easy
{ "lang": "python", "repo": "DataXujing/PyTorchIntroduction", "path": "/Chapter2/ex_2_31.py", "mode": "spm", "license": "BSD-3-Clause", "source": "the-stack-v2" }
<|fim_suffix|> return mock.Mock() @pytest.fixture def track_uri(): return path.path_to_uri(path_to_data_dir("song1.wav")) def test_lookup(config, audio, track_uri): provider = backend.FileBackend(audio=audio, config=config).library result = provider.lookup(track_uri) assert len(result) == 1 ...
code_fim
medium
{ "lang": "python", "repo": "fatg3erman/mopidy", "path": "/tests/file/test_lookup.py", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_prefix|># repo: fatg3erman/mopidy path: /tests/file/test_lookup.py from unittest import mock import pytest from mopidy.file import backend from mopidy.internal import path <|fim_suffix|> result = provider.lookup(track_uri) assert len(result) == 1 track = result[0] assert track.uri == track_uri...
code_fim
hard
{ "lang": "python", "repo": "fatg3erman/mopidy", "path": "/tests/file/test_lookup.py", "mode": "psm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_prefix|># repo: windystrife/UnrealEngine_NVIDIAGameWorks path: /Engine/Extras/Maya_AnimationRiggingTools/ArtToolsOSX/MayaTools/General/Scripts/Modules/ART_rigUtils.py import maya.cmds as cmds import maya.mel as mel import os #rigging utilities # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # #...
code_fim
hard
{ "lang": "python", "repo": "windystrife/UnrealEngine_NVIDIAGameWorks", "path": "/Engine/Extras/Maya_AnimationRiggingTools/ArtToolsOSX/MayaTools/General/Scripts/Modules/ART_rigUtils.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|># # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # ...
code_fim
hard
{ "lang": "python", "repo": "windystrife/UnrealEngine_NVIDIAGameWorks", "path": "/Engine/Extras/Maya_AnimationRiggingTools/ArtToolsOSX/MayaTools/General/Scripts/Modules/ART_rigUtils.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: jmontoyac/disk-space path: /rabbitFunctions.py import pika import json def publish_to_rabbit(aQueue, aBody, aHost): connection = pika.BlockingConnection(pika.ConnectionParameters(aHost)) channel = connection.channel() channel<|fim_suffix|>ing_key=aQueue, ...
code_fim
medium
{ "lang": "python", "repo": "jmontoyac/disk-space", "path": "/rabbitFunctions.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|>ing_key=aQueue, body=json.dumps(aBody, indent=4)) connection.close()<|fim_prefix|># repo: jmontoyac/disk-space path: /rabbitFunctions.py import pika import json def publish_to_rabbit(aQueue, aBody, aHost): connection = pika.BlockingConnection(pika.ConnectionPara...
code_fim
medium
{ "lang": "python", "repo": "jmontoyac/disk-space", "path": "/rabbitFunctions.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|>.queue_declare(queue=aQueue) channel.basic_publish(exchange="", routing_key=aQueue, body=json.dumps(aBody, indent=4)) connection.close()<|fim_prefix|># repo: jmontoyac/disk-space path: /rabbitFunctions.py import pika import json def pu...
code_fim
medium
{ "lang": "python", "repo": "jmontoyac/disk-space", "path": "/rabbitFunctions.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> self.cpp_info.set_property("pkg_config_name", "libbrigand") self.cpp_info.bindirs = [] self.cpp_info.frameworkdirs = [] self.cpp_info.libdirs = [] self.cpp_info.resdirs = [] if self.options.with_boost: self.cpp_info.requires = ["boost::headers"] ...
code_fim
hard
{ "lang": "python", "repo": "conan-io/conan-center-index", "path": "/recipes/brigand/all/conanfile.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> pass def package(self): copy(self, "LICENSE", src=self.source_folder, dst=os.path.join(self.package_folder, "licenses")) include_path = os.path.join("include", "brigand") copy(self, "*.hpp", src=os.path.join(self.source_folder, include_path), dst=os.path.join(self.pack...
code_fim
hard
{ "lang": "python", "repo": "conan-io/conan-center-index", "path": "/recipes/brigand/all/conanfile.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: conan-io/conan-center-index path: /recipes/brigand/all/conanfile.py from conan import ConanFile from conan.tools.build import check_min_cppstd from conan.tools.files import copy, get from conan.tools.layout import basic_layout import os required_conan_version = ">=1.50.0" class BrigandConan(Co...
code_fim
hard
{ "lang": "python", "repo": "conan-io/conan-center-index", "path": "/recipes/brigand/all/conanfile.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: ryanreh99/pandas path: /pandas/plotting/__init__.py """ Plotting public API """ from pandas.plotting._core import ( FramePlotMethods, SeriesPlotMethods, boxplot, boxplot_frame, boxplot_frame_groupby, hist_frame, hist_series) from pandas.plotting._misc import ( andrews_curves, autocorr...
code_fim
hard
{ "lang": "python", "repo": "ryanreh99/pandas", "path": "/pandas/plotting/__init__.py", "mode": "psm", "license": "BSD-3-Clause", "source": "the-stack-v2" }
<|fim_suffix|>ws_curves', 'bootstrap_plot', 'parallel_coordinates', 'lag_plot', 'autocorrelation_plot', 'table', 'plot_params', 'register_matplotlib_converters', 'deregister_matplotlib_converters']<|fim_prefix|># repo: ryanreh99/pandas path: /pandas/plotting/__init__.py """ Plotting pu...
code_fim
hard
{ "lang": "python", "repo": "ryanreh99/pandas", "path": "/pandas/plotting/__init__.py", "mode": "spm", "license": "BSD-3-Clause", "source": "the-stack-v2" }
<|fim_suffix|>eval_dataset = datasets.ImageFolder( os.path.dirname("./torch_neuron_test/"), transforms.Compose([ transforms.Resize([224, 224]), transforms.ToTensor(), normalize, ]) ) image, _ = eval_dataset[0] image = torch.tensor(image.numpy()[np.newaxis, ...]) ## Load model model_neuron = to...
code_fim
hard
{ "lang": "python", "repo": "aws-samples/aws-inf1-gcr-workshop", "path": "/src/lab3/infer_resnet50.py", "mode": "spm", "license": "MIT-0", "source": "the-stack-v2" }
<|fim_prefix|># repo: aws-samples/aws-inf1-gcr-workshop path: /src/lab3/infer_resnet50.py import os import time import torch import torch_neuron import json import numpy as np from urllib import request from torchvision import models, transforms, datasets <|fim_suffix|>## Load model model_neuron = torch.jit.load( '...
code_fim
hard
{ "lang": "python", "repo": "aws-samples/aws-inf1-gcr-workshop", "path": "/src/lab3/infer_resnet50.py", "mode": "psm", "license": "MIT-0", "source": "the-stack-v2" }
<|fim_suffix|> return super(RunTimeViewset, self).retrieve(request, *args, **kwargs) def update(self, request, *args, **kwargs): instance = self.get_object() before_put_api.send( sender=self.model, instance=instance, requested_data=request....
code_fim
hard
{ "lang": "python", "repo": "iashraful/fast-drf", "path": "/fast_drf/core/viewset_generator.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: iashraful/fast-drf path: /fast_drf/core/viewset_generator.py from rest_framework import viewsets from rest_framework.response import Response from fast_drf.core.class_factory import class_factory from fast_drf.signals import * from fast_drf.utils.parser import parse_filters __author__ = 'Ashraf...
code_fim
hard
{ "lang": "python", "repo": "iashraful/fast-drf", "path": "/fast_drf/core/viewset_generator.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> def partial_update(self, request, *args, **kwargs): instance = self.get_object() before_patch_api.send( sender=self.model, instance=instance, requested_data=request.data) serializer = self.serializer_class( ...
code_fim
hard
{ "lang": "python", "repo": "iashraful/fast-drf", "path": "/fast_drf/core/viewset_generator.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: ebellocchia/py_crypto_hd_wallet path: /py_crypto_hd_wallet/electrum/v1/__init__.py from py_crypto_hd_wallet.electrum.v1.hd_wallet_electrum_v1 import HdWalletElectrumV1 from py_crypto_hd_wallet.electrum.v1.hd_wallet_electrum_v1_addr import HdWalletElectrumV1Addresses from py_crypto_hd_wallet.elect...
code_fim
medium
{ "lang": "python", "repo": "ebellocchia/py_crypto_hd_wallet", "path": "/py_crypto_hd_wallet/electrum/v1/__init__.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|>1KeyTypes, HdWalletElectrumV1Languages, HdWalletElectrumV1WordsNum ) from py_crypto_hd_wallet.electrum.v1.hd_wallet_electrum_v1_factory import HdWalletElectrumV1Factory from py_crypto_hd_wallet.electrum.v1.hd_wallet_electrum_v1_keys import ( HdWalletElectrumV1DerivedKeys, HdWalletElectrumV1MasterKeys ...
code_fim
medium
{ "lang": "python", "repo": "ebellocchia/py_crypto_hd_wallet", "path": "/py_crypto_hd_wallet/electrum/v1/__init__.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: Asmodasis/Cancer_detection_system path: /interface/test.py from driver import driver def main(): x = driver("Breast", False, "G:/Senior Project/dataset/Breast/pr<|fim_suffix|>ass1.png") #print("Value y returned from driver : ") #print(y) if __name__ == "__main__": main()<|fim_m...
code_fim
hard
{ "lang": "python", "repo": "Asmodasis/Cancer_detection_system", "path": "/interface/test.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|>ass1.png") #print("Value y returned from driver : ") #print(y) if __name__ == "__main__": main()<|fim_prefix|># repo: Asmodasis/Cancer_detection_system path: /interface/test.py from driver import driver def main(): x = driver("Breast", False, "G:/Senior Project/dataset/Breast/prepared/...
code_fim
medium
{ "lang": "python", "repo": "Asmodasis/Cancer_detection_system", "path": "/interface/test.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: ilebrero/cargoScript path: /src/MyHTMLparser.py from BeautifulSoup import BeautifulSoup <|fim_suffix|> soup = BeautifulSoup(html) for link in soup.findAll('a'): if name in str(link): return link.get('href')<|fim_middle|>def retrieveRef(html, name):
code_fim
easy
{ "lang": "python", "repo": "ilebrero/cargoScript", "path": "/src/MyHTMLparser.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> for link in soup.findAll('a'): if name in str(link): return link.get('href')<|fim_prefix|># repo: ilebrero/cargoScript path: /src/MyHTMLparser.py from BeautifulSoup import BeautifulSoup def retrieveRef(html, name): <|fim_middle|> soup = BeautifulSoup(html)
code_fim
easy
{ "lang": "python", "repo": "ilebrero/cargoScript", "path": "/src/MyHTMLparser.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: ilebrero/cargoScript path: /src/MyHTMLparser.py from BeautifulSoup import BeautifulSoup def retrieveRef(html, name): <|fim_suffix|> for link in soup.findAll('a'): if name in str(link): return link.get('href')<|fim_middle|> soup = BeautifulSoup(html)
code_fim
easy
{ "lang": "python", "repo": "ilebrero/cargoScript", "path": "/src/MyHTMLparser.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> orm_mode = True class GlobalReEvaluation(BaseModel): """全局重新开始评估""" id: int class PartReEvaluation(GlobalReEvaluation): """局部重新评估""" configuration: Dict[str, str] class UserOperation(BaseModel): """用户操作""" class Operation(str, Enum): create = "create" ...
code_fim
hard
{ "lang": "python", "repo": "Link-Go/document", "path": "/project/models/rep_models.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|>class UserOperation(BaseModel): """用户操作""" class Operation(str, Enum): create = "create" update = "update" delete = "delete" operation_time: datetime evaluation_id: int evaluation_items_id: Optional[int] operation: Operation operation_field: str old...
code_fim
hard
{ "lang": "python", "repo": "Link-Go/document", "path": "/project/models/rep_models.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: Link-Go/document path: /project/models/rep_models.py from typing import List, Dict, Union, Optional from enum import Enum from datetime import datetime from pydantic import BaseModel class SafetyLevel(int, Enum): """安全级别""" second_level = 2 third_level = 3 class Status(int, Enum)...
code_fim
hard
{ "lang": "python", "repo": "Link-Go/document", "path": "/project/models/rep_models.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> super(TestImporterAFMAsc, cls).tearDownClass() shutil.rmtree(cls.tmpdir, ignore_errors=True) def setUp(self): unittest.TestCase.setUp(self) self.filepath = os.path.join(self.tmpdir, 'afm.asc') self.imp = ImporterAFMAsc() def tearDown(self): unitte...
code_fim
medium
{ "lang": "python", "repo": "pyhmsa/pyhmsa-afm", "path": "/pyhmsa_afm/fileformat/importer/test_asc.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> unittest.TestCase.tearDown(self) def testimport_(self): filepath = os.path.join(self.tmpdir, 'afm.asc') self.imp.import_(filepath) datafile = self.imp.get() self.assertEqual(1, len(datafile.conditions)) self.assertEqual(1, len(datafile.data)) ...
code_fim
medium
{ "lang": "python", "repo": "pyhmsa/pyhmsa-afm", "path": "/pyhmsa_afm/fileformat/importer/test_asc.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: pyhmsa/pyhmsa-afm path: /pyhmsa_afm/fileformat/importer/test_asc.py #!/usr/bin/env python """ """ # Standard library modules. import unittest import logging import shutil import tempfile import os # Third party modules. from pyhmsa.type.numerical import convert_unit # Local modules. from pyhms...
code_fim
hard
{ "lang": "python", "repo": "pyhmsa/pyhmsa-afm", "path": "/pyhmsa_afm/fileformat/importer/test_asc.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: zh-plus/Code_Library_Python path: /LeetCode/top_interview_questions/Medium/Subsets.py from typing import List class Solution: def __init__(self): self.result = None def subsets(self, nums: List[int]) -> List[List[int]]: self._subsets2(sorted(nums)) <|fim_suffix|> ...
code_fim
hard
{ "lang": "python", "repo": "zh-plus/Code_Library_Python", "path": "/LeetCode/top_interview_questions/Medium/Subsets.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> def _subsets2(self, nums): """ Iterative """ self.result = [[]] for num in nums: temp = [r + [num] for r in self.result] self.result.extend(temp) def _subsets3(self, nums): """ Bit Manipulation """ se...
code_fim
medium
{ "lang": "python", "repo": "zh-plus/Code_Library_Python", "path": "/LeetCode/top_interview_questions/Medium/Subsets.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> async def task_runner(urls): """ Docstring """ client_session = await create_session() async with client_session as session: tasks = [asyncio.create_task(fetch_album(session, url)) for url in urls] return await asyncio.gather(*tasks)<|fim_prefix|># repo: pythoninja/adarklib ...
code_fim
hard
{ "lang": "python", "repo": "pythoninja/adarklib", "path": "/adarklib/utils.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> async with client_session as session: tasks = [asyncio.create_task(fetch_album(session, url)) for url in urls] return await asyncio.gather(*tasks)<|fim_prefix|># repo: pythoninja/adarklib path: /adarklib/utils.py #!/usr/bin/env python3 """ Collection of useful functions """ import as...
code_fim
hard
{ "lang": "python", "repo": "pythoninja/adarklib", "path": "/adarklib/utils.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: pythoninja/adarklib path: /adarklib/utils.py #!/usr/bin/env python3 """ Collection of useful functions """ import asyncio import aiohttp from adarklib.client import fetch_album def generate_header() -> dict: """ Generates header for HTTP request """ origin = "http://dark-world.ru" ...
code_fim
medium
{ "lang": "python", "repo": "pythoninja/adarklib", "path": "/adarklib/utils.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> """Is activated when game ends, either naturally or due to player typing "quit". Parameter: :user_quit: Boolean parameter, True is passed when player sends "quit" instead of a move, otherwise defaults to False. Functionality: Prints final score...
code_fim
hard
{ "lang": "python", "repo": "Niki-Sklirou/Rock-Paper-Scissors", "path": "/rockpaperscissors.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: Niki-Sklirou/Rock-Paper-Scissors path: /rockpaperscissors.py # IMPORTS: import random # VARIABLES: moves = ['rock', 'paper', 'scissors'] # CLASSES: # Parent Class - Non-Random Player: class Player: def move(self): return 'rock' def learn(self, my_move, their_move...
code_fim
hard
{ "lang": "python", "repo": "Niki-Sklirou/Rock-Paper-Scissors", "path": "/rockpaperscissors.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: darcyabjones/seqrenamer path: /seqrenamer/xsv.py import csv from seqrenamer.exceptions import XsvColumnNumberError class Xsv(object): def __init__(self, handle, comment="#", sep=","): self.handle = self._filter_comments(handle, comment) self.id_map = list() self.se...
code_fim
hard
{ "lang": "python", "repo": "darcyabjones/seqrenamer", "path": "/seqrenamer/xsv.py", "mode": "psm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|> return def flush_ids(self, handle): for new_id, old_id in self.id_map: handle.write(f"{new_id}\t{old_id}\n") self.id_map = list() return @staticmethod def _filter_comments(handle, comment): for line in handle: if not line.start...
code_fim
hard
{ "lang": "python", "repo": "darcyabjones/seqrenamer", "path": "/seqrenamer/xsv.py", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|> @staticmethod def _filter_comments(handle, comment): for line in handle: if not line.startswith(comment): yield line return<|fim_prefix|># repo: darcyabjones/seqrenamer path: /seqrenamer/xsv.py import csv from seqrenamer.exceptions import XsvColumnNumbe...
code_fim
hard
{ "lang": "python", "repo": "darcyabjones/seqrenamer", "path": "/seqrenamer/xsv.py", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|> cran = "party" version("1.3-10", sha256="e5892955f6ce662ade568e646d1d672c3ecbf5d4e74b4a887a353e6160f7b56a") version("1.3-9", sha256="29a1fefdb86369285ebf5d48ab51268a83e2011fb9d9f609a2250b5f0b169089") version("1.3-5", sha256="1c3a35d3fe56498361542b3782de2326561c14a8fa1b76f3c9f13beb1fd51364...
code_fim
hard
{ "lang": "python", "repo": "JayjeetAtGithub/spack", "path": "/var/spack/repos/builtin/packages/r-party/package.py", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|> depends_on("r@2.14.0:", type=("build", "run")) depends_on("r@3.0.0:", type=("build", "run"), when="@1.2-3:") depends_on("r-mvtnorm@1.0-2:", type=("build", "run")) depends_on("r-modeltools@0.2-21:", type=("build", "run")) depends_on("r-strucchange", type=("build", "run")) depends_on...
code_fim
hard
{ "lang": "python", "repo": "JayjeetAtGithub/spack", "path": "/var/spack/repos/builtin/packages/r-party/package.py", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_prefix|># repo: JayjeetAtGithub/spack path: /var/spack/repos/builtin/packages/r-party/package.py # Copyright 2013-2022 Lawrence Livermore National Security, LLC and other # Spack Project Developers. See the top-level COPYRIGHT file for details. # # SPDX-License-Identifier: (Apache-2.0 OR MIT) from spack.package...
code_fim
hard
{ "lang": "python", "repo": "JayjeetAtGithub/spack", "path": "/var/spack/repos/builtin/packages/r-party/package.py", "mode": "psm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|> scores_dict = { 'acc': [], 'f1': [], 'precision': [], 'recall': [], } for idx in range(7): scores_dict['acc'].append(accuracy_score(gold_labels_dict[f'q{idx + 1}'], predictions_dict[f'q{idx + 1}'])) scores_dict['f1'].append( f1_score(...
code_fim
hard
{ "lang": "python", "repo": "paper-NLP/nlp4if-2021", "path": "/src/training_utils/eval_metrics.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: paper-NLP/nlp4if-2021 path: /src/training_utils/eval_metrics.py from typing import List, Dict import numpy as np from sklearn.metrics import accuracy_score, f1_score, precision_score, recall_score def compute_metrics( gold_labels: List[List[str]], predictions: List[List[str]], ...
code_fim
hard
{ "lang": "python", "repo": "paper-NLP/nlp4if-2021", "path": "/src/training_utils/eval_metrics.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|>class Migration(migrations.Migration): dependencies = [ ('home', '0019_comment_content_type'), ] operations = [ migrations.RemoveField( model_name='comment', name='content_type', ), ]<|fim_prefix|># repo: yys534640040/blog path: /home/migr...
code_fim
easy
{ "lang": "python", "repo": "yys534640040/blog", "path": "/home/migrations/0020_remove_comment_content_type.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: yys534640040/blog path: /home/migrations/0020_remove_comment_content_type.py # Generated by Django 3.0.5 on 2020-07-03 20:33 from django.db import migrations class Migration(migrations.Migration): <|fim_suffix|> operations = [ migrations.RemoveField( model_name='comment...
code_fim
medium
{ "lang": "python", "repo": "yys534640040/blog", "path": "/home/migrations/0020_remove_comment_content_type.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: angr/cle path: /tests/test_runpath.py import os import shutil import tempfile import cle TEST_BASE = os.path.join(os.path.dirname(os.path.realpath(__file__)), os.path.join("..", "..", "binaries")) def test_runpath(): tempdir = tempfile.mkdtemp() try: runpath_file = os.path.joi...
code_fim
hard
{ "lang": "python", "repo": "angr/cle", "path": "/tests/test_runpath.py", "mode": "psm", "license": "BSD-2-Clause", "source": "the-stack-v2" }
<|fim_suffix|> loader = cle.Loader(relocated_file, except_missing_libs=True) assert loader.all_objects[1].binary in expected_libs assert loader.all_objects[2].binary in expected_libs finally: shutil.rmtree(tempdir) if __name__ == "__main__": test_runpath()<|fim_prefix|># repo: a...
code_fim
hard
{ "lang": "python", "repo": "angr/cle", "path": "/tests/test_runpath.py", "mode": "spm", "license": "BSD-2-Clause", "source": "the-stack-v2" }
<|fim_prefix|># repo: aquariumbio/aquarium-provenance path: /src/aquarium/trace/part_visitor.py import json import logging import re from aquarium.provenance import (CollectionEntity, PartEntity) from aquarium.trace.visitor import ProvenanceVisitor from util.plate import well_coordinates, coordinates_for from collecti...
code_fim
hard
{ "lang": "python", "repo": "aquariumbio/aquarium-provenance", "path": "/src/aquarium/trace/part_visitor.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> if AddPartsVisitor.samples_match(source=source_entity, target=part_entity): logging.debug("Sample mismatch for source %s of part %s", source_entity.item_id, part_entity.item_id) part_entity.add_source(source...
code_fim
hard
{ "lang": "python", "repo": "aquariumbio/aquarium-provenance", "path": "/src/aquarium/trace/part_visitor.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> May have one of the forms - item_id - item_id/well - object_type_name/item_id/sample_id/well The latter form is used in cases where the item is not a collection, but consists of subparts that are not explicitly modeled. An example is a yeast plate wi...
code_fim
hard
{ "lang": "python", "repo": "aquariumbio/aquarium-provenance", "path": "/src/aquarium/trace/part_visitor.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> _COMMENT = _descriptor.Descriptor( name='Comment', full_name='core.feeds.Comment', filename=None, file=DESCRIPTOR, containing_type=None, fields=[ _descriptor.FieldDescriptor( name='user', full_name='core.feeds.Comment.user', index=0, number=1, type=11, cpp_type=10, label=1, ...
code_fim
hard
{ "lang": "python", "repo": "haoguangming2046/rss_aggregator", "path": "/service/feeds_pb2.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|>_FEED_LINKSENTRY = _descriptor.Descriptor( name='LinksEntry', full_name='core.feeds.Feed.LinksEntry', filename=None, file=DESCRIPTOR, containing_type=None, fields=[ _descriptor.FieldDescriptor( name='key', full_name='core.feeds.Feed.LinksEntry.key', index=0, number=1, type=9, c...
code_fim
hard
{ "lang": "python", "repo": "haoguangming2046/rss_aggregator", "path": "/service/feeds_pb2.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: haoguangming2046/rss_aggregator path: /service/feeds_pb2.py PTOR), _descriptor.FieldDescriptor( name='title', full_name='core.feeds.Feed.title', index=2, number=3, type=9, cpp_type=9, label=1, has_default_value=False, default_value=_b("").decode('utf-8'), message_type=...
code_fim
hard
{ "lang": "python", "repo": "haoguangming2046/rss_aggregator", "path": "/service/feeds_pb2.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> delta_kl = np.asarray(delta_kl, dtype='f') return tp_rate def get_train_stats(sess, model, x, X_train, Y_train, batch_size): y_logit_op = model.predict(x, softmax=False) # compute logits on train samples and clean test samples y_logit_train = [] for i in range(int(X_train.shape[...
code_fim
hard
{ "lang": "python", "repo": "JoelSass/adaptive_attacks_paper", "path": "/03_generative/defense/detector.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: JoelSass/adaptive_attacks_paper path: /03_generative/defense/detector.py # copy of the kl-detection scheme logic from # https://github.com/ysharma1126/DeepBayes/blob/b7d7833/test_attacks/detect_attacks_logp.py import numpy as np from scipy.special import logsumexp from six.moves import xrange ...
code_fim
hard
{ "lang": "python", "repo": "JoelSass/adaptive_attacks_paper", "path": "/03_generative/defense/detector.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> results_train, y_logit_train, y_train = train_stats # get the stats computed on the training set logit_mean, _, kl_mean, kl_std, softmax_mean = results_train[-5:] # the detection targets a FP rate of 5% fp_rate = [] # keep track of all true positives tp_rate = np...
code_fim
hard
{ "lang": "python", "repo": "JoelSass/adaptive_attacks_paper", "path": "/03_generative/defense/detector.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> call_alembic(['init', _hash, '-t', 'async']) env = ALEMBIC_MIGRATION_PATH / _hash / 'env.py' injected_py = [] with open(env, mode='r') as f: for line in f.readlines(): if line == 'target_metadata = None\n': injected_py.append('from utils.database import ...
code_fim
hard
{ "lang": "python", "repo": "webclinic017/api.ethpch", "path": "/utils/database/alembic.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: webclinic017/api.ethpch path: /utils/database/alembic.py from logging import getLogger from hashlib import md5 from importlib import import_module from typing import List from constants import APP_DIR, ALEMBIC_MIGRATION_PATH from utils.scripts import run_subprocess from .session import DB_SETTING...
code_fim
hard
{ "lang": "python", "repo": "webclinic017/api.ethpch", "path": "/utils/database/alembic.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: f4bio/xfishpy path: /xfish.py #!/usr/bin/env python ### # # FiSH/Mircryption clone for (He)X-Chat in 100% Python # # Requirements: PyCrypto, and Python 3.3+ # # Copyright 2010 Nam T. Nguyen # Released under the BSD license # # irccrypt module is copyright 2009 Bjorn Edstrom # with modi...
code_fim
hard
{ "lang": "python", "repo": "f4bio/xfishpy", "path": "/xfish.py", "mode": "psm", "license": "BSD-3-Clause", "source": "the-stack-v2" }
<|fim_suffix|> id = (xchat.get_info('server'), word[1]) try: KEY_MAP[id].cbc_mode = int(word[2]) print('CBC mode', bool(KEY_MAP[id].cbc_mode)) except KeyError: print('Key not found') return xchat.EAT_ALL # handle topic line def server_332(word, word_eol, userdata): if is_processing(): return xch...
code_fim
hard
{ "lang": "python", "repo": "f4bio/xfishpy", "path": "/xfish.py", "mode": "spm", "license": "BSD-3-Clause", "source": "the-stack-v2" }
<|fim_suffix|> def all(self) -> List[Transaction]: return self.transactions def account_transactions(self, account_id: str) -> List[Transaction]: return [x for x in self.transactions if x.account_id == account_id]<|fim_prefix|># repo: cassioeskelsen/ravendb_python path: /app/adapter/inmemory_tr...
code_fim
hard
{ "lang": "python", "repo": "cassioeskelsen/ravendb_python", "path": "/app/adapter/inmemory_transaction_repository.py", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_prefix|># repo: cassioeskelsen/ravendb_python path: /app/adapter/inmemory_transaction_repository.py from abc import ABC from typing import List from app.domain.transaction import Transaction from app.domain.transaction_repository import TransactionRepository <|fim_suffix|> def all(self) -> List[Transaction]...
code_fim
hard
{ "lang": "python", "repo": "cassioeskelsen/ravendb_python", "path": "/app/adapter/inmemory_transaction_repository.py", "mode": "psm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|> return [x for x in self.transactions if x.account_id == account_id]<|fim_prefix|># repo: cassioeskelsen/ravendb_python path: /app/adapter/inmemory_transaction_repository.py from abc import ABC from typing import List from app.domain.transaction import Transaction from app.domain.transaction_repo...
code_fim
hard
{ "lang": "python", "repo": "cassioeskelsen/ravendb_python", "path": "/app/adapter/inmemory_transaction_repository.py", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_prefix|># repo: Mostofa-Najmus-Sakib/Applied-Algorithm path: /Leetcode/Python Solutions/Strings/BreakaPalindrome.py """ LeetCode Problem 1328. Break a Palindrome Link: https://leetcode.com/problems/break-a-palindrome/ Written by: Mostofa Adib Shakib Language: Python """ # Optimal Solution # Time Complexity: O(...
code_fim
medium
{ "lang": "python", "repo": "Mostofa-Najmus-Sakib/Applied-Algorithm", "path": "/Leetcode/Python Solutions/Strings/BreakaPalindrome.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }