text
stringlengths
232
16.3k
domain
stringclasses
1 value
difficulty
stringclasses
3 values
meta
dict
<|fim_suffix|> return line.encode("ascii", "ignore").decode() def escape_ansi(line): ansi_escape = re.compile(r'(?:\x1B[@-_]|[\x80-\x9F])[0-?]*[ -/]*[@-~]') return ansi_escape.sub('', line) def sanitize_line(line): line = remove_non_ascii(line) line = escape_ansi(line) line = line.strip() return...
code_fim
medium
{ "lang": "python", "repo": "qwertyquerty/QMTR", "path": "/util.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: RSurya99/sistem-pembayaran-spp-django path: /authentication/migrations/0005_remove_siswa_id_spp.py # Generated by Django 2.2.12 on 2021-04-01 13:41 from django.db import migrations <|fim_suffix|> operations = [ migrations.RemoveField( model_name='siswa', name=...
code_fim
medium
{ "lang": "python", "repo": "RSurya99/sistem-pembayaran-spp-django", "path": "/authentication/migrations/0005_remove_siswa_id_spp.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> operations = [ migrations.RemoveField( model_name='siswa', name='id_spp', ), ]<|fim_prefix|># repo: RSurya99/sistem-pembayaran-spp-django path: /authentication/migrations/0005_remove_siswa_id_spp.py # Generated by Django 2.2.12 on 2021-04-01 13:41 from dja...
code_fim
medium
{ "lang": "python", "repo": "RSurya99/sistem-pembayaran-spp-django", "path": "/authentication/migrations/0005_remove_siswa_id_spp.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> dependencies = [ ('authentication', '0004_auto_20210329_1649'), ] operations = [ migrations.RemoveField( model_name='siswa', name='id_spp', ), ]<|fim_prefix|># repo: RSurya99/sistem-pembayaran-spp-django path: /authentication/migrations/000...
code_fim
easy
{ "lang": "python", "repo": "RSurya99/sistem-pembayaran-spp-django", "path": "/authentication/migrations/0005_remove_siswa_id_spp.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: psibot/GoogleScraper path: /Examples/headless-firefox.py from selenium import webdriver from selenium.webdriver.firefox.options import Options from selenium.webdriver.firefox.firefox_binary import FirefoxBinary <|fim_suffix|>options = Options() options.set_headless(headless=True) driver = webdri...
code_fim
medium
{ "lang": "python", "repo": "psibot/GoogleScraper", "path": "/Examples/headless-firefox.py", "mode": "psm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|>options = Options() options.set_headless(headless=True) driver = webdriver.Firefox(firefox_binary=binary, firefox_options=options, executable_path='../Drivers/geckodriver') driver.get("http://google.com/") print ("Headless Firefox Initialized") driver.quit()<|fim_prefix|># repo: psibot/GoogleScraper ...
code_fim
medium
{ "lang": "python", "repo": "psibot/GoogleScraper", "path": "/Examples/headless-firefox.py", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|>#test loss_arr = [] for i in range(epochs): history=model.fit(x_train,y_train, batch_size=batch_size, epochs=1, shuffle=True, verbose=1) loss_arr.append( history.history['loss'][0]) x_test = np.copy(x_train) y_pred = model.predict(x_test) ...
code_fim
hard
{ "lang": "python", "repo": "ann0218/codehome", "path": "/tensorflow_learning.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: ann0218/codehome path: /tensorflow_learning.py # -*- coding: utf-8 -*- import numpy as np np.set_printoptions(threshold=np.inf) import tensorflow as tf from tensorflow import keras import matplotlib.pyplot as plt from tensorflow.keras.models import Sequential from tensorflow.keras.layers import...
code_fim
hard
{ "lang": "python", "repo": "ann0218/codehome", "path": "/tensorflow_learning.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: so77id/Programing-examples path: /contests/ev2/01-rango_de_efes/input_creator.py #!/bin/python3 import math import os import random import re import sys <|fim_suffix|> # print(x_i, x_j) results = [ (x + pow(x - 1, 2)) for x in range(x_i, x_j+1)] with open(IN_PATH.format(s...
code_fim
hard
{ "lang": "python", "repo": "so77id/Programing-examples", "path": "/contests/ev2/01-rango_de_efes/input_creator.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> results = [ (x + pow(x - 1, 2)) for x in range(x_i, x_j+1)] with open(IN_PATH.format(str(i).zfill(2)), 'w') as file: file.write(f"{x_i} {x_j}\n") with open(OUT_PATH.format(str(i).zfill(2)), 'w') as file: for n in results: file.write(f"{n}\n")<|fim_prefix...
code_fim
medium
{ "lang": "python", "repo": "so77id/Programing-examples", "path": "/contests/ev2/01-rango_de_efes/input_creator.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: levii/jig-py path: /tests/collector/jig_ast/test_jig_ast.py from jig.collector.domain.ast import Import, ImportFrom, JigAST class TestJigASTImport: def test_simple_import(self): source = """ import dataclasses @dataclasses.dataclass(frozen=True) class Sample: value: str ...
code_fim
medium
{ "lang": "python", "repo": "levii/jig-py", "path": "/tests/collector/jig_ast/test_jig_ast.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> nodes = JigAST.parse(source).import_froms() assert len(nodes) == 1 assert isinstance(nodes[0], ImportFrom) assert len(nodes[0].names) == 1 assert nodes[0].module == "typing" assert nodes[0].names[0].name == "Optional" assert nodes[0].level == 0 ...
code_fim
hard
{ "lang": "python", "repo": "levii/jig-py", "path": "/tests/collector/jig_ast/test_jig_ast.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> assert len(nodes) == 1 assert isinstance(nodes[0], ImportFrom) assert len(nodes[0].names) == 1 assert nodes[0].module == "typing" assert nodes[0].names[0].name == "*" assert nodes[0].level == 0<|fim_prefix|># repo: levii/jig-py path: /tests/collector/jig_as...
code_fim
hard
{ "lang": "python", "repo": "levii/jig-py", "path": "/tests/collector/jig_ast/test_jig_ast.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: cmu-db/noisepage path: /script/testing/replication/log_throughput/__main__.py import argparse from .constants import (DEFAULT_BENCHMARK, DEFAULT_CONNECTION_THREADS, DEFAULT_SCALE_FACTOR, TATP, TPCC, YCSB) from .log_throughput import log_throughput from .test_type import T...
code_fim
hard
{ "lang": "python", "repo": "cmu-db/noisepage", "path": "/script/testing/replication/log_throughput/__main__.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> log_throughput(TestType(args["test-type"]), args["build_type"], args["replication_enabled"], args["async_replication"], args["async_commit"], args["oltp_benchmark"], int(args["oltp_scale_factor"]), args["log_file"], int(args["connection_threads"]), ...
code_fim
hard
{ "lang": "python", "repo": "cmu-db/noisepage", "path": "/script/testing/replication/log_throughput/__main__.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> """ Dummy interface for unit tests. """ def bar(baz): """ Just a note. """<|fim_prefix|># repo: wistbean/learn_python3_spider path: /stackoverflow/venv/lib/python3.6/site-packages/zope/interface/tests/idummy.py ##################################################################...
code_fim
medium
{ "lang": "python", "repo": "wistbean/learn_python3_spider", "path": "/stackoverflow/venv/lib/python3.6/site-packages/zope/interface/tests/idummy.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: wistbean/learn_python3_spider path: /stackoverflow/venv/lib/python3.6/site-packages/zope/interface/tests/idummy.py ############################################################################## # # Copyright (c) 2001, 2002 Zope Foundation and Contributors. # All Rights Reserved. # # This software...
code_fim
medium
{ "lang": "python", "repo": "wistbean/learn_python3_spider", "path": "/stackoverflow/venv/lib/python3.6/site-packages/zope/interface/tests/idummy.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|># Routine to create the blinking motion def blink(timedata): UpperEyeLid.moveTo(150) # close the upper eye lid LowerEyeLid.moveTo(150) # close the lower eye lid sleep(0.5) UpperEyeLid.moveTo(45) # Open the upper eye lid LowerEyeLid.moveTo(45) # Open the lower eye lid BlinkClock.setInterval(randint(5...
code_fim
hard
{ "lang": "python", "repo": "ProjectHewitt/Fred_Inmoov", "path": "/Old_Versions/Fred_2.py", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|>HeadYaw = Runtime.createAndStart("HeadYaw", "Servo") # attach it to the pwm board - pin 8 HeadYaw.attach(Head,8) HeadYaw.setMinMax(0,180) HeadYaw.map(0,180,1,180) HeadYaw.setRest(90) HeadYaw.setInverted(False) HeadYaw.setVelocity(120) HeadYaw.setAutoDisable(True) HeadYaw.rest() HeadPitch = Runtime.create...
code_fim
hard
{ "lang": "python", "repo": "ProjectHewitt/Fred_Inmoov", "path": "/Old_Versions/Fred_2.py", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_prefix|># repo: ProjectHewitt/Fred_Inmoov path: /Old_Versions/Fred_2.py ######################################## # # Program Code for Fred Inmoov # Of the Cyber_One YouTube Channel # # This is version 2 with Blink and TTS # ######################################### generate random integer values from random impo...
code_fim
hard
{ "lang": "python", "repo": "ProjectHewitt/Fred_Inmoov", "path": "/Old_Versions/Fred_2.py", "mode": "psm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|> if with_target: target_names=sorted(list(set(targets))) target=[] for t in targets: target.append(target_names.index(t)) data.targets=np.array(target) data.target_names=target_names else: target_names=[] data.targets=None ...
code_fim
hard
{ "lang": "python", "repo": "bblais/Classy", "path": "/classy/bio.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: bblais/Classy path: /classy/bio.py import classy.datasets from .Struct import Struct import os import glob import numpy as np def load_sequences(fname,sheet=None,verbose=True): import xlrd base,ext=os.path.splitext(fname) data=Struct() data.DESCR="Sequences" data.data=[...
code_fim
hard
{ "lang": "python", "repo": "bblais/Classy", "path": "/classy/bio.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: gabrielmonzato20/testePython path: /controller/OrderController.py from flask import request from flask_classful import FlaskView, route import service.OrderService from Validation.OrderValidate import OrderValidate class OrderController(FlaskView): def __init__(self): self.serve = ...
code_fim
medium
{ "lang": "python", "repo": "gabrielmonzato20/testePython", "path": "/controller/OrderController.py", "mode": "psm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|> return self.serve.delete(id) @route("/<int:id>",methods=['GET']) def read(self,id): return self.serve.read(id) @route("/",methods=['GET']) def readAll(self): return self.serve.readAll()<|fim_prefix|># repo: gabrielmonzato20/testePython path: /controller/OrderCo...
code_fim
medium
{ "lang": "python", "repo": "gabrielmonzato20/testePython", "path": "/controller/OrderController.py", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|> with translation.override('en-US'): assert make_key(u'é@øel') == 'eb7592119dace3b998755ef61d90b91b' assert make_key( u'é@øel', with_locale=False) == 'f40676a34ef1787123e49e1317f9ed31' with translation.override('fr'): assert make_key(u'é@øel') == 'e0c0ff9a07c763506dc6d...
code_fim
medium
{ "lang": "python", "repo": "deepanshu-jain1999/addons-server", "path": "/src/olympia/lib/tests/test_cache.py", "mode": "spm", "license": "BSD-3-Clause", "source": "the-stack-v2" }
<|fim_prefix|># repo: deepanshu-jain1999/addons-server path: /src/olympia/lib/tests/test_cache.py # -*- coding: utf-8 -*- from django.test.utils import override_settings from django.utils import translation from olympia.lib.cache import cached, make_key @override_settings(KEY_PREFIX='amo:test:') def test_make_key()...
code_fim
medium
{ "lang": "python", "repo": "deepanshu-jain1999/addons-server", "path": "/src/olympia/lib/tests/test_cache.py", "mode": "psm", "license": "BSD-3-Clause", "source": "the-stack-v2" }
<|fim_suffix|>INSTALLED_APPS + ('wagtail_textract',)<|fim_prefix|># repo: overcastsoftware/wagtail_textract path: /src/wagtail_textract/settings.py from wagtail.tests.settings import * <|fim_middle|> WAGTAILDOCS_DOCUMENT_MODEL = 'wagtail_textract.document' INSTALLED_APPS =
code_fim
medium
{ "lang": "python", "repo": "overcastsoftware/wagtail_textract", "path": "/src/wagtail_textract/settings.py", "mode": "spm", "license": "BSD-3-Clause", "source": "the-stack-v2" }
<|fim_prefix|># repo: overcastsoftware/wagtail_textract path: /src/wagtail_textract/settings.py from wagtail.tests.settings import * <|fim_suffix|>INSTALLED_APPS + ('wagtail_textract',)<|fim_middle|> WAGTAILDOCS_DOCUMENT_MODEL = 'wagtail_textract.document' INSTALLED_APPS =
code_fim
medium
{ "lang": "python", "repo": "overcastsoftware/wagtail_textract", "path": "/src/wagtail_textract/settings.py", "mode": "psm", "license": "BSD-3-Clause", "source": "the-stack-v2" }
<|fim_suffix|> def intersects_bounds(self, bounds, inds=None): x0, y0, x1, y1 = bounds if x1 < x0: x0, x1 = x1, x0 if y1 < y0: y0, y1 = y1, y0 xs = self.x ys = self.y if inds is not None: xs = xs[inds] ys = ys[inds] ...
code_fim
hard
{ "lang": "python", "repo": "xhochy/spatialpandas", "path": "/spatialpandas/geometry/point.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: xhochy/spatialpandas path: /spatialpandas/geometry/point.py from __future__ import absolute_import import numpy as np from pandas.core.dtypes.dtypes import register_extension_dtype from spatialpandas.geometry.base import GeometryDtype from spatialpandas.geometry.basefixed import GeometryFixed, G...
code_fim
hard
{ "lang": "python", "repo": "xhochy/spatialpandas", "path": "/spatialpandas/geometry/point.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> @classmethod def from_geopandas(cls, ga): """ Build a spatialpandas MultiPointArray from a geopandas GeometryArray or GeoSeries. Args: ga: A geopandas GeometryArray or GeoSeries of MultiPoint or Point shapes. Returns: Mu...
code_fim
hard
{ "lang": "python", "repo": "xhochy/spatialpandas", "path": "/spatialpandas/geometry/point.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: briandrawert/stochss path: /app/lib/molns/MolnsLib/DockerProvider.py import logging import os import tempfile import time import DockerProxy import constants import installSoftware from collections import OrderedDict from DockerSSH import DockerSSH from constants import Constants from molns_provi...
code_fim
hard
{ "lang": "python", "repo": "briandrawert/stochss", "path": "/app/lib/molns/MolnsLib/DockerProvider.py", "mode": "psm", "license": "BSD-3-Clause", "source": "the-stack-v2" }
<|fim_suffix|> return named_dockerfile, dockerfile_file @staticmethod def _preprocess(command): """ Prepends "shell only" commands with '/bin/bash -c'. """ for shell_command in DockerProxy.DockerProxy.shell_commands: if shell_command in command: replace_string...
code_fim
hard
{ "lang": "python", "repo": "briandrawert/stochss", "path": "/app/lib/molns/MolnsLib/DockerProvider.py", "mode": "spm", "license": "BSD-3-Clause", "source": "the-stack-v2" }
<|fim_suffix|> _flows = KW_ARGS["flows"] if path == "robots.txt": return static(environ, start_response, "static/robots.txt") elif path.startswith("static/"): return static(environ, start_response, path) elif path.startswith("export/"): return static(environ, start_response, path...
code_fim
hard
{ "lang": "python", "repo": "selfissued/oidctest", "path": "/test_tool/test_rp/rplib/wb/wbrp.py", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_prefix|># repo: selfissued/oidctest path: /test_tool/test_rp/rplib/wb/wbrp.py import logging from mako.lookup import TemplateLookup from oic.utils.http_util import Response from oic.utils.http_util import ServiceError from oic.utils.http_util import NotFound from oidctest.common import main_setup from oidctest....
code_fim
hard
{ "lang": "python", "repo": "selfissued/oidctest", "path": "/test_tool/test_rp/rplib/wb/wbrp.py", "mode": "psm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|>def flow_list(environ, start_response, flows, done): resp = Response(mako_template="flowlist.mako", template_lookup=LOOKUP, headers=[]) argv = {"base": KW_ARGS["conf"].BASE, "flows": flows, "done": done} return resp(environ, start_response, **argv) de...
code_fim
hard
{ "lang": "python", "repo": "selfissued/oidctest", "path": "/test_tool/test_rp/rplib/wb/wbrp.py", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|> plt.show() # Generate training and testing set. X_train, X_test, y_train, y_test = train_test_split(X_scaled, y, test_size = 0.5)<|fim_prefix|># repo: PacktPublishing/Learn-Machine-Learning-in-3-Hours path: /Section 5/Video 3/S5V3_example.py import numpy as np import matplotlib.pyplot as plt...
code_fim
medium
{ "lang": "python", "repo": "PacktPublishing/Learn-Machine-Learning-in-3-Hours", "path": "/Section 5/Video 3/S5V3_example.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: PacktPublishing/Learn-Machine-Learning-in-3-Hours path: /Section 5/Video 3/S5V3_example.py import numpy as np import matplotlib.pyplot as plt from sklearn.preprocessing import StandardScaler from sklearn.model_selection import train_test_split if __name__ == "__main__": FILENAME = 'sample.n...
code_fim
hard
{ "lang": "python", "repo": "PacktPublishing/Learn-Machine-Learning-in-3-Hours", "path": "/Section 5/Video 3/S5V3_example.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> # Scale data. scaler = StandardScaler() scaler.fit(X) X_scaled = scaler.transform(X) # Plot scaled data. fig2, ax2 = plt.subplots() ax2.set_xlabel('Stress 1 (Scaled)') ax2.set_ylabel('Stress 2 (MPa)') sc = ax2.scatter(X_scaled, y) plt.show() # Generate traini...
code_fim
medium
{ "lang": "python", "repo": "PacktPublishing/Learn-Machine-Learning-in-3-Hours", "path": "/Section 5/Video 3/S5V3_example.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> self.S = np.swapaxes(self.S, 0, 1) self.S = np.swapaxes(self.S, 1, 2) def estimate(self): pc = [] for data in self.S: out = fss(data, self.args['Ls'], self.args['ps'], vary_exponents=False) pc.append(out.params['pc'].value...
code_fim
hard
{ "lang": "python", "repo": "brands-d/Percolation", "path": "/percolation/data_processing/crit_exponents.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: brands-d/Percolation path: /percolation/data_processing/crit_exponents.py from pathlib import Path from configparser import ConfigParser import numpy as np from percolation.model.fss import fss class CritExponentEstimator: def __init__(self, path): <|fim_suffix|> def read_output(self)...
code_fim
hard
{ "lang": "python", "repo": "brands-d/Percolation", "path": "/percolation/data_processing/crit_exponents.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> processors = int(config.get('main', 'num_processors')) Ls = [int(x) for x in config.get('main', 'lattice-sizes').split(',')] start, stop, num = config.get('main', 'probabilities').split(',') ps = np.linspace(float(start), float(stop), int(num), endpoint=True) num = ...
code_fim
hard
{ "lang": "python", "repo": "brands-d/Percolation", "path": "/percolation/data_processing/crit_exponents.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: kernel72/game-of-words path: /backend/src/tools/indexDictonary.py # python 3.9 required import sys import json from dataclasses import dataclass, asdict DICTIONARY_PATH = "../../dicts/hagen-morf.txt" @dataclass class MainWord: word: str included_words: list[str] def load_and_filter_w...
code_fim
hard
{ "lang": "python", "repo": "kernel72/game-of-words", "path": "/backend/src/tools/indexDictonary.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> sorted_words_list = sorted(words_list) print("Getting main words") main_words_index = list( map( lambda w: MainWord(word=w, included_words=[]), filter(lambda w: len(w) > 13, sorted_words_list), ) ) print("Indexing other words") for indx, ...
code_fim
hard
{ "lang": "python", "repo": "kernel72/game-of-words", "path": "/backend/src/tools/indexDictonary.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> if main_word_map[ch] == 0: del main_word_map[ch] return True def index_words(words_list: set[str]) -> list[MainWord]: sorted_words_list = sorted(words_list) print("Getting main words") main_words_index = list( map( lambda w: MainWord(word=w, in...
code_fim
hard
{ "lang": "python", "repo": "kernel72/game-of-words", "path": "/backend/src/tools/indexDictonary.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> for key in restrict: if key <= len(l) and l[key - 1] != restrict[key]: allow = False if allow and (allow_smaller or len(l) == depth): yield l def __traverse(ndict, depth): if depth == 0: return [] if not isinstance(ndict, dict): ...
code_fim
hard
{ "lang": "python", "repo": "17451k/clade", "path": "/clade/types/nested_dict.py", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_prefix|># repo: 17451k/clade path: /clade/types/nested_dict.py # Copyright (c) 2020 ISP RAS (http://www.ispras.ru) # Ivannikov Institute for System Programming of the Russian Academy of Sciences # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance w...
code_fim
hard
{ "lang": "python", "repo": "17451k/clade", "path": "/clade/types/nested_dict.py", "mode": "psm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|> Args: depth: limit depth of the dictionary to traverse. restrict: ability to restrict output by specifying the exact value that must be at a specified position of the output list. Example: restrict={3: "calls"}. allow_smaller: allow to return...
code_fim
hard
{ "lang": "python", "repo": "17451k/clade", "path": "/clade/types/nested_dict.py", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_prefix|># repo: archeranimesh/Geeks4Geeks-Python path: /SRC/01_Array/05_array_rotation.py # Finding element in a sorted but rotated array # http://theoryofprogramming.com/2017/12/16/find-pivot-element-sorted-rotated-array/ # https://www.geeksforgeeks.org/python-program-for-binary-search/ # https://www.geeksforge...
code_fim
hard
{ "lang": "python", "repo": "archeranimesh/Geeks4Geeks-Python", "path": "/SRC/01_Array/05_array_rotation.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|>if __name__ == "__main__": arr = [12,14,18,2, 3, 6,8,9] binary_arr = [3,6,8,9,12,14,18,21] x = 18 result = binary_search(binary_arr, 0, len(binary_arr) - 1, x, True) if result != -1: print("The element is found in index ", result, " value is ", binary_arr[result], " matches wi...
code_fim
hard
{ "lang": "python", "repo": "archeranimesh/Geeks4Geeks-Python", "path": "/SRC/01_Array/05_array_rotation.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> if key == arr[mid]: return mid if key > arr[mid]: return geeks_binary_search(arr, (mid + 1), high, key) return geeks_binary_search(arr, low, (mid -1), key) # Normal Binary Search Function. def binary_search(arr, low, high, x, debug=False): if debug: print("arr = "...
code_fim
hard
{ "lang": "python", "repo": "archeranimesh/Geeks4Geeks-Python", "path": "/SRC/01_Array/05_array_rotation.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> """ Gives bonus points to everyone in sequence netids This is a PROCEDURE. It modifies the contents of grades. However, it only modifies grades with a key that appears in the sequence netids. Parameter grades: The dictionary of student grades Precondition: grades has ne...
code_fim
medium
{ "lang": "python", "repo": "LizzieDeng/kalman_fliter_analysis", "path": "/docs/cornell CS class/lesson 19. Dictionaries/demos/grader2.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: LizzieDeng/kalman_fliter_analysis path: /docs/cornell CS class/lesson 19. Dictionaries/demos/grader2.py """ Student grade example for dictionaries. This module shows several a mutable function on dictionaries. Author: Walker M. White Date: June 7, 2019 """ # Global variable store the grade s...
code_fim
medium
{ "lang": "python", "repo": "LizzieDeng/kalman_fliter_analysis", "path": "/docs/cornell CS class/lesson 19. Dictionaries/demos/grader2.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: dmegahan/TwitchStats path: /TwitchGraph/Stream.py import datetime import os import threading import logging import sys import requests import time from JsonEditor import JsonEditor from Statistics import Statistics import TwitchAPI from TwitchBot import TwitchThread from TwitchGraph import Graph ...
code_fim
hard
{ "lang": "python", "repo": "dmegahan/TwitchStats", "path": "/TwitchGraph/Stream.py", "mode": "psm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|> while 1: #if stream is online if TwitchAPI.isOnline(self.stream): #start the bots up if self.GrabBot is None and self.IRCBot is None: #initialize the dates and filepaths self.initFileNames() ...
code_fim
hard
{ "lang": "python", "repo": "dmegahan/TwitchStats", "path": "/TwitchGraph/Stream.py", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|> append += '   ' for x in files: print "%s%s" %(point, x) directory = [f for f in os.listdir(path) if os.path.isdir(path+'/'+f)] for x in directory: point = point.replace('├', '└') print "%s%s%s%s" %(point, CYAN, x, WHITE) dir_tree(path+'/'+x, append, string)<|fim_prefix|># repo: flouthoc/dir...
code_fim
medium
{ "lang": "python", "repo": "flouthoc/dir_tree", "path": "/dir_tree.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: flouthoc/dir_tree path: /dir_tree.py # -*- coding: utf-8 -*- #_author_ = flouthoc (http://github.com/flouthoc, http://twitter.com/flouthoc) import os def dir_tree(path, append, string=""): <|fim_suffix|> for x in files: print "%s%s" %(point, x) directory = [f for f in os.listdir(path) if os.p...
code_fim
hard
{ "lang": "python", "repo": "flouthoc/dir_tree", "path": "/dir_tree.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: jhong16/HLD-TT path: /2019/src/truthtrees.py # -*- coding: utf-8 -*- from __future__ import print_function, unicode_literals import argparse from forseti.formula import Formula, Predicate, Symbol, Not, And, Or, If, Iff import forseti.parser from six import string_types from src import util from ...
code_fim
hard
{ "lang": "python", "repo": "jhong16/HLD-TT", "path": "/2019/src/truthtrees.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> """ Readjust the formula id of all nodess in self.nodess @effect: Make all of the TreeNode's node_id match there location in self.nodes """ for i in range(lowerbound, len(self.nodes)): if self.nodes[i]: self.nodes[i].node_id = i de...
code_fim
hard
{ "lang": "python", "repo": "jhong16/HLD-TT", "path": "/2019/src/truthtrees.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> def branch(self, node, formula = None): """ Branch on a node using a parent formula @param: Node is a TreeNode that is being branched on @param: formula is the "parent" formula of the branch return: true on successful branch false on not success...
code_fim
hard
{ "lang": "python", "repo": "jhong16/HLD-TT", "path": "/2019/src/truthtrees.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: NicolasLM/feedsubs path: /reader/http_fetcher.py from datetime import datetime import hashlib from logging import getLogger from typing import Optional import attr from allauth.utils import build_absolute_uri from django.conf import settings from django.urls import reverse from django.utils.http...
code_fim
hard
{ "lang": "python", "repo": "NicolasLM/feedsubs", "path": "/reader/http_fetcher.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|>def get_user_agent(subscriber_count: Optional[int]=None, feed_id: Optional[int]=None) -> str: """Generate a user-agent allowing publisher to gather subscribers count. See https://support.feed.press/article/66-how-to-be-a-good-feed-fetcher """ options = list() if se...
code_fim
hard
{ "lang": "python", "repo": "NicolasLM/feedsubs", "path": "/reader/http_fetcher.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> self.unix_time = tmp_list[0] + tmp_list[1] self.mac_addr = tmp_list[2] + tmp_list[3] + tmp_list[4][:4] self.pid_hex = tmp_list[4][4:9] self.sequence_num = tmp_list[4][9:] _timestamp = self.__hex2int(_hex_str=self.unix_time) / 10.0 ** 5 _res_info['timesta...
code_fim
hard
{ "lang": "python", "repo": "smuer/timi_uuid", "path": "/timi_uuid/main_uuid.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: smuer/timi_uuid path: /timi_uuid/main_uuid.py # coding: utf-8 import os import time import uuid from datetime import datetime class TimiUUID(object): """ 单机实现自增UUID发号器的功能,能够集成timestamp, mac_addr, pid, seq_number等信息。使用方法如下: from timi_uuid import TimiUUID new_obj = TimiUUID() ...
code_fim
hard
{ "lang": "python", "repo": "smuer/timi_uuid", "path": "/timi_uuid/main_uuid.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|>while(p.health > 0): line = input("> ") args = line.split() if len(args) > 0: commandFound = False for c in Commands.keys(): if args[0] == c[:len(args[0])]: Commands[c](p) commandFound = True break if not commandFound: print ("%s doesn't understand the...
code_fim
hard
{ "lang": "python", "repo": "shreekanti/rpygame", "path": "/main.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: shreekanti/rpygame path: /main.py from random import randint from character import Character from enemy import Enemy from player import Player <|fim_suffix|>while(p.health > 0): line = input("> ") args = line.split() if len(args) > 0: commandFound = False for c in Commands.keys(): ...
code_fim
hard
{ "lang": "python", "repo": "shreekanti/rpygame", "path": "/main.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: yzoz/python-option-calculator path: /searching.py from pricing import Pricing #in deep development class Search(Pricing): def searchDelta(self, fPrice, deep, acc, paramD, params): """if paramD['dType'] == 'C': if paramD['quant'] < 0: direct = 'U' ...
code_fim
hard
{ "lang": "python", "repo": "yzoz/python-option-calculator", "path": "/searching.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|>dType = 'F' strike = 0 price = 0 quant = -1 vola = 0 paramD_1 = {'dType': dType, 'price': price, 'quant': quant, 'strike': strike, 'vola': vola, 'exp': exp} dType = 'F' strike = 0 price = 0 quant = 1 vola = 0 paramD1 = {'dType': dType, 'price': price, 'quant': quant, 'strike': strike, 'vola': vola, 'exp'...
code_fim
hard
{ "lang": "python", "repo": "yzoz/python-option-calculator", "path": "/searching.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|>dType = 'P' quant = 1 price = 100 strike = 15000 vola = 0.75 params.append({'dType': dType, 'price': price, 'quant': quant, 'strike': strike, 'vola': vola, 'exp': exp}) dType = 'P' quant = -1 price = 25 strike = 10000 vola = 1.5 params.append({'dType': dType, 'price': price, 'quant': quant, 'strike': str...
code_fim
hard
{ "lang": "python", "repo": "yzoz/python-option-calculator", "path": "/searching.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: RiptideBo/folium path: /folium/plugins/__init__.py # -*- coding: utf-8 -*- """ Folium plugins -------------- Add different objects/effects on a folium map. """ <|fim_suffix|>__all__ = [ 'MarkerCluster', 'ScrollZoomToggler', 'Terminator', 'BoatMarker', 'TimestampedGeoJson', ...
code_fim
hard
{ "lang": "python", "repo": "RiptideBo/folium", "path": "/folium/plugins/__init__.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|>__all__ = [ 'MarkerCluster', 'ScrollZoomToggler', 'Terminator', 'BoatMarker', 'TimestampedGeoJson', 'HeatMap', 'ImageOverlay', 'Fullscreen', 'PolyLineTextPath', 'FloatImage' ]<|fim_prefix|># repo: RiptideBo/folium path: /folium/plugins/__init__.py # -*- coding:...
code_fim
hard
{ "lang": "python", "repo": "RiptideBo/folium", "path": "/folium/plugins/__init__.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> def __init__(self, parser, parent:ParserRuleContext=None, invokingState:int=-1): super().__init__(parent, invokingState) self.parser = parser def getRuleIndex(self): return seedotParser.RULE_expr def copyFrom(self, ctx:ParserRuleContext...
code_fim
hard
{ "lang": "python", "repo": "MJ10/EdgeML", "path": "/tools/SeeDot/seedot/compiler/antlr/seedotParser.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: MJ10/EdgeML path: /tools/SeeDot/seedot/compiler/antlr/seedotParser.py .state = 51 self._errHandler.sync(self) _la = self._input.LA(1) while _la==seedotParser.T__3: self.state = 47 self.match(seedotParser.T__3)...
code_fim
hard
{ "lang": "python", "repo": "MJ10/EdgeML", "path": "/tools/SeeDot/seedot/compiler/antlr/seedotParser.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: MJ10/EdgeML path: /tools/SeeDot/seedot/compiler/antlr/seedotParser.py def IntConst(self, i:int=None): if i is None: return self.getTokens(seedotParser.IntConst) else: return self.getToken(seedotParser.IntConst, i) def expr(s...
code_fim
hard
{ "lang": "python", "repo": "MJ10/EdgeML", "path": "/tools/SeeDot/seedot/compiler/antlr/seedotParser.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: nipy/nipy path: /nipy/io/tests/test_save.py # emacs: -*- mode: python; py-indent-offset: 4; indent-tabs-mode: nil -*- # vi: set ft=python sts=4 ts=4 sw=4 et: from __future__ import with_statement from __future__ import absolute_import import numpy as np from nibabel.affines import from_matvec ...
code_fim
hard
{ "lang": "python", "repo": "nipy/nipy", "path": "/nipy/io/tests/test_save.py", "mode": "psm", "license": "BSD-3-Clause", "source": "the-stack-v2" }
<|fim_suffix|>def test_save4(): # Same as test_save3 except we have reordered the 'ijk' input axes. shape = (13,5,7,3) step = np.array([3.45,2.3,4.5,6.9]) # When the input coords are in the 'ljki' order, the affines get # rearranged. Note that the 'start' below, must be 0 for # non-spatial dime...
code_fim
hard
{ "lang": "python", "repo": "nipy/nipy", "path": "/nipy/io/tests/test_save.py", "mode": "spm", "license": "BSD-3-Clause", "source": "the-stack-v2" }
<|fim_suffix|> def test_save2(): # A test to ensure that when a file is saved, the affine and the # data agree. This image comes from a NIFTI file shape = (13,5,7,3) step = np.array([3.45,2.3,4.5,6.93]) cmap = api.AffineTransform.from_start_step('ijkt', 'xyzt', [1,3,5,0], step) data = np.random...
code_fim
hard
{ "lang": "python", "repo": "nipy/nipy", "path": "/nipy/io/tests/test_save.py", "mode": "spm", "license": "BSD-3-Clause", "source": "the-stack-v2" }
<|fim_suffix|> Args: x: A 4-D tensorflow tensor. training: If `True`, add the spectral norm assign ops. name: String to pass to the variable scope context. Returns: A new volume with self-attention having been applied. """ with tf.variable_scope(name): _, h, w, num_channels = x.shape.as_list(...
code_fim
hard
{ "lang": "python", "repo": "tensorflow/gan", "path": "/tensorflow_gan/examples/self_attention_estimator/ops.py", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_prefix|># repo: tensorflow/gan path: /tensorflow_gan/examples/self_attention_estimator/ops.py # coding=utf-8 # Copyright 2023 The TensorFlow GAN Authors. # # 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 ...
code_fim
hard
{ "lang": "python", "repo": "tensorflow/gan", "path": "/tensorflow_gan/examples/self_attention_estimator/ops.py", "mode": "psm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|> if not hasattr(Databases, name): raise InvalidName("Database name is Invalid") self._database = client[name] @property def collection(self): if self._collection is None: raise InvalidName("Collection name is None") return self._collection ...
code_fim
hard
{ "lang": "python", "repo": "team-12-csc-510/adilytics", "path": "/src/database/init_db.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: team-12-csc-510/adilytics path: /src/database/init_db.py import os from motor.motor_asyncio import AsyncIOMotorClient # type: ignore from pymongo.errors import InvalidName <|fim_suffix|> def __int__(self): self._database = None self._collection = None @property def ...
code_fim
hard
{ "lang": "python", "repo": "team-12-csc-510/adilytics", "path": "/src/database/init_db.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> if self._database is None: raise InvalidName("Database is None") return self._database @database.setter def database(self, name: str): if not hasattr(Databases, name): raise InvalidName("Database name is Invalid") self._database = client[nam...
code_fim
hard
{ "lang": "python", "repo": "team-12-csc-510/adilytics", "path": "/src/database/init_db.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> # always include a default feincms page, so we can retrieve # top-level navigation return { 'feincms_page': Page.objects.in_navigation().first() }<|fim_prefix|># repo: jpkarlsberg/readux path: /readux/pages/context_processors.py from feincms.module.page.models import Page <|fim_m...
code_fim
easy
{ "lang": "python", "repo": "jpkarlsberg/readux", "path": "/readux/pages/context_processors.py", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_prefix|># repo: jpkarlsberg/readux path: /readux/pages/context_processors.py from feincms.module.page.models import Page <|fim_suffix|> # always include a default feincms page, so we can retrieve # top-level navigation return { 'feincms_page': Page.objects.in_navigation().first() }<|fim_m...
code_fim
easy
{ "lang": "python", "repo": "jpkarlsberg/readux", "path": "/readux/pages/context_processors.py", "mode": "psm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|> try: down = subs[index+1].get_last_read() except IndexError: down = None left, right = item.get_siblings() subs[index].last_read = item subs[index].save() context.update({ 'up': up, 'down': down, ...
code_fim
hard
{ "lang": "python", "repo": "ImmaculateObsession/nest", "path": "/reader/views.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: ImmaculateObsession/nest path: /reader/views.py from django.views.generic import TemplateView from django.views.generic.detail import DetailView from reader.models import Item, Reader class ReaderView(TemplateView): template_name = "reader/item.html" def get_context_data(self, **kwarg...
code_fim
hard
{ "lang": "python", "repo": "ImmaculateObsession/nest", "path": "/reader/views.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: onicagroup/runway path: /typings/docker/types/containers.pyi """This type stub file was generated by pyright.""" # pylint: disable=C,E,W,R from __future__ import annotations from .base import DictType class LogConfigTypesEnum: _values = ... class LogConfig(DictType): types = LogConfigT...
code_fim
hard
{ "lang": "python", "repo": "onicagroup/runway", "path": "/typings/docker/types/containers.pyi", "mode": "psm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|>def host_config_version_error(param, version, less_than=...): ... def host_config_value_error(param, param_value): ... def host_config_incompatible_error(param, param_value, incompatible_param): ... class ContainerConfig(dict): def __init__( self, version, image, comma...
code_fim
hard
{ "lang": "python", "repo": "onicagroup/runway", "path": "/typings/docker/types/containers.pyi", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_prefix|># repo: enihsyou/Sorting-algorithm path: /algorithm_Python/__init__.py # -*- coding: utf-8 -*- """ File name: __init__ Reference: Introduction: Date: 2016-05-20 Last modified: 2016-05-22 Author: enihsyou """ import algorithm.bubble_sort imp<|fim_suffix|>k_sort import algorithm.selection_sort __all__ = [...
code_fim
medium
{ "lang": "python", "repo": "enihsyou/Sorting-algorithm", "path": "/algorithm_Python/__init__.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|>k_sort', 'build_in'] n2 = ['bubble_sort', 'cocktail_shaker_sort', 'selection_sort', 'insertion_sort'] nlogn = ['heap_sort', 'merge_sort', 'quick_sort', 'build_in']<|fim_prefix|># repo: enihsyou/Sorting-algorithm path: /algorithm_Python/__init__.py # -*- coding: utf-8 -*- """ File name: __init__ Ref...
code_fim
hard
{ "lang": "python", "repo": "enihsyou/Sorting-algorithm", "path": "/algorithm_Python/__init__.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> list = {} list['name'] = '燈具照明系統' list['id'] = 'lighting-system' lighting_system = {} lighting_system['lightings'] = '燈具' lighting_system['lighting-systems'] = '照明' list['sub'] = lighting_system return list # 電池 batteries class Batteries(object): def b...
code_fim
hard
{ "lang": "python", "repo": "a1b2c3d4e5x/spider_iyp", "path": "/const/sub_categories/industry/electrical_material.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> list['sub'] = batteries return list # 熔接焊接電熱 electric-welding-service class ElectricWeldingService(object): def electric_welding_service() -> Dict[str, Dict[str, str]]: list = {} list['name'] = '熔接焊接電熱' list['id'] = 'electric-welding-service' electric_welding_servi...
code_fim
hard
{ "lang": "python", "repo": "a1b2c3d4e5x/spider_iyp", "path": "/const/sub_categories/industry/electrical_material.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: a1b2c3d4e5x/spider_iyp path: /const/sub_categories/industry/electrical_material.py from typing import Dict from ..base_category import BaseCategory # 冷凍空調設備 air-conditioning-supplies class AirConditioningSupplies(object): def air_conditioning_supplies() -> Dict[str, Dict[str, str]]: lis...
code_fim
hard
{ "lang": "python", "repo": "a1b2c3d4e5x/spider_iyp", "path": "/const/sub_categories/industry/electrical_material.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: baronrustamov/gsevpt path: /tests/views/test_organizer.py import pytest @pytest.mark.parametrize("db_error", [True, False]) def test_create(client, app, utils, seeder, mocker, db_error): user_id, admin_unit_id = seeder.setup_base() url = utils.get_url("manage_admin_unit_organizer_creat...
code_fim
hard
{ "lang": "python", "repo": "baronrustamov/gsevpt", "path": "/tests/views/test_organizer.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|>@pytest.mark.parametrize("db_error", [True, False]) @pytest.mark.parametrize("non_match", [True, False]) def test_delete(client, seeder, utils, app, mocker, db_error, non_match): user_id, admin_unit_id = seeder.setup_base() organizer_id = seeder.upsert_event_organizer(admin_unit_id, "Mein Organisa...
code_fim
hard
{ "lang": "python", "repo": "baronrustamov/gsevpt", "path": "/tests/views/test_organizer.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> if verbose: print('Downloading "{}" => "{}"'.format(object, target)) cw.download_object(bucket, object, target) object_count = object_count + 1 if object_count == 0: raise DownloadError('No objects in bucket "{}" match the ' ...
code_fim
hard
{ "lang": "python", "repo": "CODAIT/cos-utils", "path": "/cos_utils/download_files.py", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_prefix|># repo: CODAIT/cos-utils path: /cos_utils/download_files.py #!/usr/bin/env python # # Copyright 2018-2019 IBM Corp. 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 Li...
code_fim
hard
{ "lang": "python", "repo": "CODAIT/cos-utils", "path": "/cos_utils/download_files.py", "mode": "psm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|> # Bad data is bad with self.raises(s_exc.BadArg) as cm: s_config.Config.getConfFromCell(SchemaCell, {'test:newp': 'haha'}) with self.raises(s_exc.BadConfValu) as cm: s_config.Config.getConfFromCell(SchemaCell, {'apikey': 1234}) self.eq(cm.exception....
code_fim
hard
{ "lang": "python", "repo": "vertexproject/synapse", "path": "/synapse/tests/test_lib_config.py", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_prefix|># repo: vertexproject/synapse path: /synapse/tests/test_lib_config.py import copy import regex import argparse import yaml import synapse.exc as s_exc import synapse.common as s_common import synapse.lib.cell as s_cell import synapse.lib.config as s_config import synapse.tests.utils as s_test class ...
code_fim
hard
{ "lang": "python", "repo": "vertexproject/synapse", "path": "/synapse/tests/test_lib_config.py", "mode": "psm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|> def on_train_end(self, logs={}): self.train_end = dt.datetime.now()<|fim_prefix|># repo: psteinb/deeprace path: /src/deeprace/models/keras_details/callbacks.py import keras from keras.callbacks import Callback import datetime as dt class stopwatch(keras.callbacks.Callback): def on_train...
code_fim
medium
{ "lang": "python", "repo": "psteinb/deeprace", "path": "/src/deeprace/models/keras_details/callbacks.py", "mode": "spm", "license": "BSD-3-Clause", "source": "the-stack-v2" }