text
stringlengths
232
16.3k
domain
stringclasses
1 value
difficulty
stringclasses
3 values
meta
dict
<|fim_suffix|> x, y = point x = x * inverseClipperScale if int(x) == x: x = int(x) y = y * inverseClipperScale if int(y) == y: y = int(y) return x, y # ---------- # Attributes # ---------- def _get_final(self): # XXX this c...
code_fim
hard
{ "lang": "python", "repo": "typemytype/booleanOperations", "path": "/Lib/booleanOperations/flatten.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> sat_images, pos, neg, alt, slp = dataset.make_small_dataset("data/") gen = dataset.patch_generator(sat_images, pos, neg, alt, slp, area, batch_size, 0.4) X, y = next(gen) assert X.shape == (batch_size, area, area, 14)<|fim_prefix|># repo: MVPTylerE/landslide path: /test/test_dataset....
code_fim
medium
{ "lang": "python", "repo": "MVPTylerE/landslide", "path": "/test/test_dataset.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: MVPTylerE/landslide path: /test/test_dataset.py import dataset def test_call_patch_generator(): sat_images, pos, neg, alt, slp = dataset.make_small_dataset("data/") gen = dataset.patch_generator(sat_images, pos, neg, alt, slp, 25, 512, 0.4) next(gen) <|fim_suffix|> sat_images, p...
code_fim
medium
{ "lang": "python", "repo": "MVPTylerE/landslide", "path": "/test/test_dataset.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: JeffreyUrban/count-sequences path: /iterate_and_count.py # Naive approach as point of truth and performance benchmark. # Single dictionary: Iterate through items. Count sequences of all lengths ending at that item. from collections import Counter <|fim_suffix|> sequences = Counter() for...
code_fim
medium
{ "lang": "python", "repo": "JeffreyUrban/count-sequences", "path": "/iterate_and_count.py", "mode": "psm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|> for sequence in sequences.most_common(): if sequence[1] < 2: # Keep only repeated sequences del sequences[sequence[0]] return sequences<|fim_prefix|># repo: JeffreyUrban/count-sequences path: /iterate_and_count.py # Naive approach as point of truth and performance...
code_fim
hard
{ "lang": "python", "repo": "JeffreyUrban/count-sequences", "path": "/iterate_and_count.py", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|> def test_mnist_model_register_using_non_existent_handler_with_nonzero_workers(): ''' Validates that a model cannot be registered with a non existent handler if the initial number of workers is greater than zero. ''' response = requests.post( 'http://127.0.0.1:8081/models?handl...
code_fim
hard
{ "lang": "python", "repo": "AbishekIdeas/serve", "path": "/test/pytest/test_handler.py", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_prefix|># repo: AbishekIdeas/serve path: /test/pytest/test_handler.py import subprocess import time import os import glob import requests import json from os import path ROOT_DIR = "/workspace/" MODEL_STORE = ROOT_DIR + "model_store/" # CHANGE THIS TO CORRECT PYTORCH CODE REPOSITORY CODEBUILD_WD = path.abspath(...
code_fim
hard
{ "lang": "python", "repo": "AbishekIdeas/serve", "path": "/test/pytest/test_handler.py", "mode": "psm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|> for k in old_values: if k in new_values: if old_values[k] != new_values[k]: audit_values.append({"key": k, "action": "updated", "value": new_values[k]}) else: audit_values.append({"key": k, "action": "removed", "value": old_values[k]}) new_keys = set(new_valu...
code_fim
hard
{ "lang": "python", "repo": "HeqetLabs/dynaconfig", "path": "/dynaconfig/endpoints.py", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|> current_config = list(r.table("config").get_all(config_id(user_id, config_name), index="name").run(db.conn)) if current_config: current_config = current_config[0] if 0 <= version <= current_config["highest_version"]: current_version = current_config["version"] audit_tr...
code_fim
hard
{ "lang": "python", "repo": "HeqetLabs/dynaconfig", "path": "/dynaconfig/endpoints.py", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_prefix|># repo: HeqetLabs/dynaconfig path: /dynaconfig/endpoints.py import datetime import rethinkdb as r from flask import request from flask.ext.restful import Resource, abort from dynaconfig import db from time import time def config_id(user_id, config_name): return "{}-{}".format(user_id, config_name) ...
code_fim
hard
{ "lang": "python", "repo": "HeqetLabs/dynaconfig", "path": "/dynaconfig/endpoints.py", "mode": "psm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_prefix|># repo: log2timeline/plaso path: /tests/parsers/text_plugins/gdrive_synclog.py #!/usr/bin/env python3 # -*- coding: utf-8 -*- """Tests for the Google Drive Sync log log text parser plugin.""" import unittest from dfvfs.helpers import fake_file_system_builder from plaso.parsers import text_parser from ...
code_fim
hard
{ "lang": "python", "repo": "log2timeline/plaso", "path": "/tests/parsers/text_plugins/gdrive_synclog.py", "mode": "psm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|> number_of_warnings = storage_writer.GetNumberOfAttributeContainers( 'recovery_warning') self.assertEqual(number_of_warnings, 0) expected_event_values = { 'added_time': '2018-03-01T12:48:14.224-08:00', 'data_type': 'google_drive_sync_log:entry', 'level': 'INFO',...
code_fim
hard
{ "lang": "python", "repo": "log2timeline/plaso", "path": "/tests/parsers/text_plugins/gdrive_synclog.py", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_prefix|># repo: liyanting0403/tongjierban path: /5.2.py #猜数字:第一关总共10轮,每一个100分. # 由电脑随机产生两个数字,让用户输入这两个数字的和. # 最后看是进入第二关还是’Game Over’ import random def youxi(): <|fim_suffix|> if count == 1000: print('开始第二关') else: print('Game Over.') def start(): youxi() start()<|fim...
code_fim
hard
{ "lang": "python", "repo": "liyanting0403/tongjierban", "path": "/5.2.py", "mode": "psm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|> count = 0 for i in range(5): num1 = random.randint(0,5) num2 = random.randint(0,5) print(num1,num2) num3 = int(input("请输入num1+num2 == ")) if num3 == num1+num2: print("please continue") count+=200 else: pr...
code_fim
medium
{ "lang": "python", "repo": "liyanting0403/tongjierban", "path": "/5.2.py", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|> return tuple(result), code def rebuild(self, conversion, tail_code, cf_cap=None): """ Recreates the voltage from a conversion :param conversion: Tuples of references of convesion, shape = base_shape + (n_caps-1, n_diff,) :type conversion: :class:`t...
code_fim
hard
{ "lang": "python", "repo": "jabozzo/delta_sigma_pipe_lascas_2020", "path": "/calib/calib/gen.py", "mode": "spm", "license": "BSD-2-Clause", "source": "the-stack-v2" }
<|fim_suffix|> """ Represents a number of configuration and inputs pairs. """ @classmethod def Stack(cls, conf_set0, *conf_sets): assert all(conf_set0.ds_samples == conf_set.ds_samples for conf_set in conf_sets) conf_sets = (conf_set0,) + conf_sets inputs = tuple(e for conf_...
code_fim
hard
{ "lang": "python", "repo": "jabozzo/delta_sigma_pipe_lascas_2020", "path": "/calib/calib/gen.py", "mode": "spm", "license": "BSD-2-Clause", "source": "the-stack-v2" }
<|fim_prefix|># repo: jabozzo/delta_sigma_pipe_lascas_2020 path: /calib/calib/gen.py les, self.n_cs, n_diff,) crop_idx = (slice(start_sample, start_sample+n_samples), slice(None), slice(None),) ins = np.broadcast_to(np.reshape([-1] * self.n_cs * n_diff, shape), full_shape) ins = ins[crop_idx] ...
code_fim
hard
{ "lang": "python", "repo": "jabozzo/delta_sigma_pipe_lascas_2020", "path": "/calib/calib/gen.py", "mode": "psm", "license": "BSD-2-Clause", "source": "the-stack-v2" }
<|fim_prefix|># repo: fvigo/content path: /Packs/mnemonicMDR/Integrations/ArgusManagedDefence/ArgusManagedDefence.py mit=args.get("limit", None), sortBy=sort_by, ) return CommandResults( readable_output=pretty_print_comments( result["data"], f"# #{case_id}: Comments\n" ), ...
code_fim
hard
{ "lang": "python", "repo": "fvigo/content", "path": "/Packs/mnemonicMDR/Integrations/ArgusManagedDefence/ArgusManagedDefence.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> result = get_case_metadata_by_id( id=case_id, skipRedirect=args.get("skip_redirect", None) ) return CommandResults( readable_output=pretty_print_case_metadata(result), outputs_prefix="Argus.Case", outputs=result, raw_response=result, ) def list_ca...
code_fim
hard
{ "lang": "python", "repo": "fvigo/content", "path": "/Packs/mnemonicMDR/Integrations/ArgusManagedDefence/ArgusManagedDefence.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> def remove_case_tag_by_key_value_command(args: Dict[str, Any]) -> CommandResults: case_id = args.get("case_id", None) key = args.get("key", None) value = args.get("value", None) if not case_id: raise ValueError("case id not specified") if not key: raise ValueError("key...
code_fim
hard
{ "lang": "python", "repo": "fvigo/content", "path": "/Packs/mnemonicMDR/Integrations/ArgusManagedDefence/ArgusManagedDefence.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: girder/dkc-next path: /dkc/core/models/quota.py from typing import Type from django.conf import settings from django.contrib.auth.models import User from django.db import IntegrityError, models, transaction from django.db.models.signals import post_save from django.dispatch import receiver from...
code_fim
hard
{ "lang": "python", "repo": "girder/dkc-next", "path": "/dkc/core/models/quota.py", "mode": "psm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|> try: # Use an .update query instead of a .save, to avoid assigning an F-expression on the # local instance, which might need to be rolled back on a failure Quota.objects.filter(pk=self.pk).update(used=(models.F('used') + amount)) except IntegrityError as...
code_fim
hard
{ "lang": "python", "repo": "girder/dkc-next", "path": "/dkc/core/models/quota.py", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_prefix|># repo: odchavez/CausalDART path: /bartpy/examples/ols.py import pandas as pd import numpy as np from matplotlib import pyplot as plt from bartpy.extensions.baseestimator import ResidualBART from bartpy.sklearnmodel import SklearnModel def run(alpha, beta, n_trees, n_regressors, n_burn=50, n_samples=2...
code_fim
hard
{ "lang": "python", "repo": "odchavez/CausalDART", "path": "/bartpy/examples/ols.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|>if __name__ == "__main__": import cProfile from datetime import datetime as dt print(dt.now()) # model, x, y = run(0.95, 2., 200, 50, n_obsv=100000) cProfile.run("run(0.95, 2., 200, 40)", "restats") print(dt.now())<|fim_prefix|># repo: odchavez/CausalDART path: /bartpy/examples/o...
code_fim
hard
{ "lang": "python", "repo": "odchavez/CausalDART", "path": "/bartpy/examples/ols.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> if __name__ == "__main__": import cProfile from datetime import datetime as dt print(dt.now()) # model, x, y = run(0.95, 2., 200, 50, n_obsv=100000) cProfile.run("run(0.95, 2., 200, 40)", "restats") print(dt.now())<|fim_prefix|># repo: odchavez/CausalDART path: /bartpy/examples/...
code_fim
hard
{ "lang": "python", "repo": "odchavez/CausalDART", "path": "/bartpy/examples/ols.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: clawnchair/svexdb path: /svexdb/settings.py """ Django settings for svexdb project. Generated by 'django-admin startproject' using Django 2.0. For more information on this file, see https://docs.djangoproject.com/en/2.0/topics/settings/ For the full list of settings and their values, see https...
code_fim
hard
{ "lang": "python", "repo": "clawnchair/svexdb", "path": "/svexdb/settings.py", "mode": "psm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|> @pytest.mark.parametrize("missing_attr", ["result_paths", "cross_experiment_key"]) def test_invalid_environment(monkeypatch, env_fixture_0, missing_attr): monkeypatch.delattr(settings.G.Env, missing_attr) with pytest.raises(EnvironmentInvalidError): CrossExperimentKeyMaker(dict(a="foo", b...
code_fim
hard
{ "lang": "python", "repo": "mdjabc/hyperparameter_hunter", "path": "/tests/test_keys.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> assert make_hash_sha256(obj) == expected @pytest.mark.parametrize(["obj", "expected"], **args_ids_for(scenarios_lambda)) def test_make_hash_sha256_lambda(obj, expected): assert make_hash_sha256(obj) == expected @pytest.mark.parametrize(["obj", "expected"], **args_ids_for(scenarios_partial)) de...
code_fim
hard
{ "lang": "python", "repo": "mdjabc/hyperparameter_hunter", "path": "/tests/test_keys.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: mdjabc/hyperparameter_hunter path: /tests/test_keys.py "LjjneyLDFKRJ6R-v7ZKkOCasaqQDrmqKy2z1gjn7r10="], # Same as empty list, dict [("foo", "bar"), "nLa17RepW5vZ-h-Tmoj56p_xIznyxOK7HXJX-Y4XieE="], [("bar", "foo"), "5UmXFMC8LmyZJLnaImLH108nXTNQE4Ei4ZzmLsqxzCE="], ] scenarios_list = [ ...
code_fim
hard
{ "lang": "python", "repo": "mdjabc/hyperparameter_hunter", "path": "/tests/test_keys.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|>benchmark = Benchmarker(**params) benchmark.benchmark_all() benchmark.print_results() benchmark.plot_results()<|fim_prefix|># repo: EduardoRubioM/mat281_portfolio path: /m02_data_analysis/m02_c06_development/fast_pandas/benchmark_prod.py from Benchmarker import Benchmarker import numpy as np def pandas...
code_fim
hard
{ "lang": "python", "repo": "EduardoRubioM/mat281_portfolio", "path": "/m02_data_analysis/m02_c06_development/fast_pandas/benchmark_prod.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> params = { "df_generator": 'pd.DataFrame(np.random.randint(1, df_size, (df_size, 2)), columns=list("AB"))', "functions_to_evaluate": [numpy_values_prod, numpy_values_nanprod, pandas_prod, numpy_prod], "title": "Pandas Prod vs Numpy Prod", } benchmark = Benchmarker(**params) benchmark.benchma...
code_fim
hard
{ "lang": "python", "repo": "EduardoRubioM/mat281_portfolio", "path": "/m02_data_analysis/m02_c06_development/fast_pandas/benchmark_prod.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: prometheusresearch/baseline-codebase path: /src/rex.widget/demo/src/rex/widget_demo.py """ rex.widget_demo =============== :copyright: 2015, Prometheus Research, LLC """ from rex.core import Setting, SeqVal, RecordVal, StrVal, get_settings from rex.widget import computed_field, Wi...
code_fim
hard
{ "lang": "python", "repo": "prometheusresearch/baseline-codebase", "path": "/src/rex.widget/demo/src/rex/widget_demo.py", "mode": "psm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|> class DemoPageHome(Widget): name = 'DemoPageHome' js_type = 'rex-widget-demo', 'Home' class DemoPageLayout(Widget): name = 'DemoPageLayout' js_type = 'rex-widget-demo', 'Layout' class DemoPageUI(Widget): name = 'DemoPageUI' js_type = 'rex-widget-demo', 'UI' class DemoPageFor...
code_fim
hard
{ "lang": "python", "repo": "prometheusresearch/baseline-codebase", "path": "/src/rex.widget/demo/src/rex/widget_demo.py", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_prefix|># repo: ibaiGorordo/lanedet path: /configs/condlane/resnet101_culane.py net = dict( type='Detector', ) backbone = dict( type='ResNetWrapper', resnet='resnet101', pretrained=True, replace_stride_with_dilation=[False, False, False], out_conv=False, in_channels=[64, 128, 256, 51...
code_fim
hard
{ "lang": "python", "repo": "ibaiGorordo/lanedet", "path": "/configs/condlane/resnet101_culane.py", "mode": "psm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|> ), dict(type='CollectLane', down_scale=mask_down_scale, hm_down_scale=hm_down_scale, max_mask_sample=5, line_width=line_width, radius=radius, keys=['img', 'gt_hm'], meta_keys=[ 'gt_masks', 'mask_shape', 'hm_shape', 'do...
code_fim
hard
{ "lang": "python", "repo": "ibaiGorordo/lanedet", "path": "/configs/condlane/resnet101_culane.py", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|>bbox = np.array([[[-100,-100,0], [-5, -100, 0], [-5,-5,0], [-100,-5,0], [-100,-100,100], [-5, -100, 100], [-5,-5,100], [-100,-5,100]]]) image_size = (2000, 2000) rays,rgbs = ray_sampling(Ks,Ts,image_size) # print(bbox) bbox = torch.from_numpy(bbox).reshape((1, 8, 3)) sample_t = rsp.forward(rays[:5000].re...
code_fim
hard
{ "lang": "python", "repo": "suoxinkey/PlenOctrees_NeRF-SH", "path": "/tests/test_ray_samplepoint.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: suoxinkey/PlenOctrees_NeRF-SH path: /tests/test_ray_samplepoint.py import sys sys.path.append('..') from layers.RaySamplePoint import RaySamplePoint import torch import numpy as np from utils.ray_sampling import ray_sampling from mpl_toolkits.mplot3d.axes3d import Axes3D import matplotlib.pyplot ...
code_fim
hard
{ "lang": "python", "repo": "suoxinkey/PlenOctrees_NeRF-SH", "path": "/tests/test_ray_samplepoint.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|>image_size = (2000, 2000) rays,rgbs = ray_sampling(Ks,Ts,image_size) # print(bbox) bbox = torch.from_numpy(bbox).reshape((1, 8, 3)) sample_t = rsp.forward(rays[:5000].reshape(-1,6), bbox, method=None)<|fim_prefix|># repo: suoxinkey/PlenOctrees_NeRF-SH path: /tests/test_ray_samplepoint.py import sys sys.p...
code_fim
medium
{ "lang": "python", "repo": "suoxinkey/PlenOctrees_NeRF-SH", "path": "/tests/test_ray_samplepoint.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> def lista_wektorow(self, typ): """ Metoda obliczająca iloczyn kartezjański dla dwóch wygenerowanych list metodą 'wspolrzedna_wektora'. :param typ: Określa, z jakiego zakresu mają być wybierane wektory sieci odwrotnej. Wartość min oznacza, że z podstawowego tzn. dla tych...
code_fim
hard
{ "lang": "python", "repo": "szymag/ZFN", "path": "/src/eig_problem/WektorySieciOdwrotnej.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: szymag/ZFN path: /src/eig_problem/WektorySieciOdwrotnej.py from math import sqrt import numpy as np class WektorySieciOdwrotnej: """ Klasa, której zadaniem jest wygenerowanie wektorow sieci odwrotnej, służących dalej do definiowania macierzy zagadnienia własnego. W tym przypadku wy...
code_fim
hard
{ "lang": "python", "repo": "szymag/ZFN", "path": "/src/eig_problem/WektorySieciOdwrotnej.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> :param k: Określa, którą współrzędną metoda ma obliczyć. Dla k=1 igrekową, dla k=2 zetową. :param typ: Określa, z jakiego zakresu mają być wybierane wektory sieci odwrotnej. Wartość min oznacza, że z podstawowego tzn. dla tych wektorów generuje się zagadnienie własne. Wartość max o...
code_fim
hard
{ "lang": "python", "repo": "szymag/ZFN", "path": "/src/eig_problem/WektorySieciOdwrotnej.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: pedrohenriquebraga/Curso-Python path: /Mundo 3/Exercícios/ex_106.py # Mini-Menu para Interactive Help from time import sleep cores = {"limpa":"\033[m", "azul":"\033[7;36m", "roxo":"\033[7;35m", "negrito":"\033[1m", "branco":"\033[7m", "verde":"\033[7;32m", "amarelo":"\033[33m", "vermelho":"\...
code_fim
hard
{ "lang": "python", "repo": "pedrohenriquebraga/Curso-Python", "path": "/Mundo 3/Exercícios/ex_106.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> funcao = str(input(f"{cores['negrito']}QUAL COMANDO VOCÊ QUER PESQUISAR?[FIM para] = ")) if funcao.upper() == "FIM": break print() print(f"{cores['azul']}=" * 50) print(f"{f'ACESSANDO PYHELP PARA {funcao.upper()}':^50}") print("=" * 50) sleep(1) print(f"{c...
code_fim
medium
{ "lang": "python", "repo": "pedrohenriquebraga/Curso-Python", "path": "/Mundo 3/Exercícios/ex_106.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> def __init__(self, *args, always_show_modifiers=False, **kwargs): super().__init__(*args, **kwargs) self.time_total = None self.run_state = None self.always_show_modifiers = always_show_modifiers def initialize(self): self.time_total = 0 self.run_st...
code_fim
hard
{ "lang": "python", "repo": "RacconAppend/modlunky2", "path": "/src/modlunky2/ui/trackers/category.py", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_prefix|># repo: RacconAppend/modlunky2 path: /src/modlunky2/ui/trackers/category.py from enum import Enum import logging from logging import CRITICAL, WARNING import tkinter as tk from tkinter import ttk from queue import Empty from PIL import Image, ImageTk from modlunky2.config import Config from modlunky2.c...
code_fim
hard
{ "lang": "python", "repo": "RacconAppend/modlunky2", "path": "/src/modlunky2/ui/trackers/category.py", "mode": "psm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|> def __init__(self, *args, always_show_modifiers=False, **kwargs): super().__init__(file_name="category.txt", *args, **kwargs) self.watcher_thread = CategoryWatcherThread( self.queue, always_show_modifiers=always_show_modifiers, ) self.watcher_th...
code_fim
hard
{ "lang": "python", "repo": "RacconAppend/modlunky2", "path": "/src/modlunky2/ui/trackers/category.py", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_prefix|># repo: MouseHu/emdqn path: /baselines/ecbp/agents/buffer/ps_learning_process.py import numpy as np from sklearn.neighbors import BallTree, KDTree import os from baselines.ecbp.agents.buffer.lru_knn_gpu_ps import LRU_KNN_GPU_PS from baselines.ecbp.agents.buffer.lru_knn_gpu_ps_density import LRU_KNN_GPU_P...
code_fim
hard
{ "lang": "python", "repo": "MouseHu/emdqn", "path": "/baselines/ecbp/agents/buffer/ps_learning_process.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> # recursive backup # self.log("begin backup", self.run_sweep) self.num_iters += 1 # self.log("bk pqueue len", len(self.pqueue)) if len(self.pqueue) > 0: if self.iters_per_step < self.min_iter: self.iters_per_step += 1 # self.l...
code_fim
hard
{ "lang": "python", "repo": "MouseHu/emdqn", "path": "/baselines/ecbp/agents/buffer/ps_learning_process.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> while self.run_sweep: self.backup() if self.update_enough: self.recv_msg() # self.update_enough = 0 def retrieve_q_value(self, obj): z, h, knn = obj extrinsic_qs, intrinsic_qs, find, neighbour_ind,neighbour_dist = self.e...
code_fim
hard
{ "lang": "python", "repo": "MouseHu/emdqn", "path": "/baselines/ecbp/agents/buffer/ps_learning_process.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> def add(self, what, **attributes): if type(what) in [C, Y, X]: child = what else: child = X(what, **attributes) self.children.append(child) return child def to_xml_lines(self, margin=0, indent=2): output = [] spaces = ' ' * m...
code_fim
hard
{ "lang": "python", "repo": "guitarmanvt/cson2lang", "path": "/xmlish.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: guitarmanvt/cson2lang path: /xmlish.py """Dirt-simple XML structure building, without the nasties. Simplifications/limitations: - XML comments are only allowed as siblings to other tags and strictly formatted. - Internal Text is allowed, but cannot be intermixed with children or comments. - Attr...
code_fim
hard
{ "lang": "python", "repo": "guitarmanvt/cson2lang", "path": "/xmlish.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> def detach_template(self, api, template_index, filter_fn): """ :param api: Instance of Rest API :param template_index: Instance of DeviceTemplateIndex :param filter_fn: Function used to filter elements to be returned :return: List of worker actions to monitor [(...
code_fim
hard
{ "lang": "python", "repo": "jeremypng/sastre", "path": "/cisco_sdwan/tasks/common.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: jeremypng/sastre path: /cisco_sdwan/tasks/common.py s): self._log('warning', *args) def log_error(self, *args): self._log('error', *args) def log_critical(self, *args): self._log('critical', *args) def _log(self, level, *args): getattr(logging.getLog...
code_fim
hard
{ "lang": "python", "repo": "jeremypng/sastre", "path": "/cisco_sdwan/tasks/common.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> self._rows.extend(self._row_class(*row_values) for row_values in row_values_iter) def __iter__(self): return iter(self._rows) def __len__(self): total_len = len(self._rows) - self._rows.count(None) return total_len if total_len > 0 else 0 def _column_max_widt...
code_fim
hard
{ "lang": "python", "repo": "jeremypng/sastre", "path": "/cisco_sdwan/tasks/common.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: Apkawa/django-querybuilder-rules path: /querybuilder_rules/variables/simple.py from collections import namedtuple from django.utils.encoding import smart_text <|fim_suffix|>class IntegerVariable(SimpleTypeVariable): type = int class FloatVariable(SimpleTypeVariable): type = float cl...
code_fim
hard
{ "lang": "python", "repo": "Apkawa/django-querybuilder-rules", "path": "/querybuilder_rules/variables/simple.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> return { 'value': TypeVariableField(self.title, self.help_text, None, self.get_context) } class IntegerVariable(SimpleTypeVariable): type = int class FloatVariable(SimpleTypeVariable): type = float class TextVariable(SimpleTypeVariable): type = str class Boo...
code_fim
medium
{ "lang": "python", "repo": "Apkawa/django-querybuilder-rules", "path": "/querybuilder_rules/variables/simple.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: kajweb/myj_crawler path: /main.py #!/usr/bin/python # -*- coding: UTF-8 -*- from function import * from globalvar import * from util import * import json # 初始化全局变量 globalvar_init(); # 初始化mysql库 connectMysql(); #初始化Urllib # curl = initUrllib(); <|fim_suffix|>categoryResponse = getCategory(auth...
code_fim
medium
{ "lang": "python", "repo": "kajweb/myj_crawler", "path": "/main.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|>mysql = get_value("mysql"); mysql.execute("select * from myj_category where deal = 0"); data = mysql.fetchall() for i in data: id = i[0]; name = i[1]; title = i[2]; #datetime = i[4]; # getBook( id, name, title ) getBook( id, authorization );<|fim_prefix|># repo: kajweb/myj_crawler path: /main.py #!...
code_fim
medium
{ "lang": "python", "repo": "kajweb/myj_crawler", "path": "/main.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|>def init_fcm_config(config_file): if not os.path.exists(config_file): with open(config_file, 'w') as config: json.dump(INITIAL_CONFIG, config)<|fim_prefix|># repo: jphacks/SD_1806 path: /server/fcmconfig.py import json, os INITIAL_CONFIG = { 'id': '' } def set_fcm_config(co...
code_fim
medium
{ "lang": "python", "repo": "jphacks/SD_1806", "path": "/server/fcmconfig.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> if not os.path.exists(config_file): with open(config_file, 'w') as config: json.dump(INITIAL_CONFIG, config)<|fim_prefix|># repo: jphacks/SD_1806 path: /server/fcmconfig.py import json, os INITIAL_CONFIG = { 'id': '' } <|fim_middle|>def set_fcm_config(config, form): if '...
code_fim
medium
{ "lang": "python", "repo": "jphacks/SD_1806", "path": "/server/fcmconfig.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: jphacks/SD_1806 path: /server/fcmconfig.py import json, os INITIAL_CONFIG = { 'id': '' } def set_fcm_config(config, form): if 'id' in form: json.dump({"id": form['id']}, config) return config <|fim_suffix|> if not os.path.exists(config_file): with open(config_fil...
code_fim
easy
{ "lang": "python", "repo": "jphacks/SD_1806", "path": "/server/fcmconfig.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: steev/etest path: /etest_test/fixtures_test/scripts_test/ed59fae4f26745cda3050c9d60077a2a.py """Unadorned curly braces.""" import textwrap from etest_test.fixtures_test.scripts_test import SCRIPTS <|fim_suffix|>SCRIPTS.setdefault("all", []).append(_) SCRIPTS.setdefault("bash", []).append(_)<|f...
code_fim
hard
{ "lang": "python", "repo": "steev/etest", "path": "/etest_test/fixtures_test/scripts_test/ed59fae4f26745cda3050c9d60077a2a.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: xxxxHolic/pypcl path: /pcl/pointcloud.py else: shape = dtype.subdtype[1][0] if len(dtype.subdtype[1]) == 1 else dtype.subdtype[1] return str(shape) + _numpy_to_txt(dtype.subdtype[0]) def _cast_fields_to_tuples(dtype): # Cast point fields into specific tuples that can be ...
code_fim
hard
{ "lang": "python", "repo": "xxxxHolic/pypcl", "path": "/pcl/pointcloud.py", "mode": "psm", "license": "BSD-3-Clause", "source": "the-stack-v2" }
<|fim_prefix|># repo: xxxxHolic/pypcl path: /pcl/pointcloud.py p.array([]) self.__width = abs(width) self.__height = abs(height) # adjust points with width and height automatically if width is 0: if _safe_len(self.__points) > 0: widt...
code_fim
hard
{ "lang": "python", "repo": "xxxxHolic/pypcl", "path": "/pcl/pointcloud.py", "mode": "psm", "license": "BSD-3-Clause", "source": "the-stack-v2" }
<|fim_suffix|> def __len__(self): return _safe_len(self.__points) def __iter__(self): return iter(self.__points) def __contains__(self, item): # for the field names, use 'names' property for instead. return item in self.__points def __reduce__(self): # Pickle su...
code_fim
hard
{ "lang": "python", "repo": "xxxxHolic/pypcl", "path": "/pcl/pointcloud.py", "mode": "spm", "license": "BSD-3-Clause", "source": "the-stack-v2" }
<|fim_suffix|>treefarmcfg = configparser.ConfigParser() treefarmcfg.read(os.path.join(CONFIG_DIR, "treefarmrc")) if not treefarmcfg.has_section("treefarm"): treefarmcfg.add_section("treefarm")<|fim_prefix|># repo: ytree-project/treefarm path: /treefarm/config.py """ ytree config """ #--------------------------...
code_fim
medium
{ "lang": "python", "repo": "ytree-project/treefarm", "path": "/treefarm/config.py", "mode": "spm", "license": "BSD-3-Clause", "source": "the-stack-v2" }
<|fim_prefix|># repo: ytree-project/treefarm path: /treefarm/config.py """ ytree config """ #----------------------------------------------------------------------------- # Copyright (c) ytree development team. All rights reserved. # # Distributed under the terms of the Modified BSD License. # # The full license i...
code_fim
medium
{ "lang": "python", "repo": "ytree-project/treefarm", "path": "/treefarm/config.py", "mode": "psm", "license": "BSD-3-Clause", "source": "the-stack-v2" }
<|fim_prefix|># repo: dkp-1024/my_machine_learning path: /pandas_practice/a2_basic.py import pandas as pd #Let's create another data frame. data = pd.DataFrame({'group':['a', 'a', 'a', 'b','b', 'b', 'c', 'c','c'],'ounces':[4, 3, 12, 6, 7.5, 8, 3, 5, 6]}) print(data) <|fim_suffix|># sorting by multiple columns data.s...
code_fim
medium
{ "lang": "python", "repo": "dkp-1024/my_machine_learning", "path": "/pandas_practice/a2_basic.py", "mode": "psm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|># sorting by multiple columns data.sort_values(by=['group','ounces'],ascending=[True,False],inplace=False) print(data)<|fim_prefix|># repo: dkp-1024/my_machine_learning path: /pandas_practice/a2_basic.py import pandas as pd #Let's create another data frame. data = pd.DataFrame({'group':['a', 'a', 'a', '...
code_fim
medium
{ "lang": "python", "repo": "dkp-1024/my_machine_learning", "path": "/pandas_practice/a2_basic.py", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|># 2. Draw the 'Vertical Wall' outlines. They will go to the # Left/Right of the 'base' outline, interlocking with it. # 'Left' wall: # (Flat line across the top.) svg.write((" <path d=\"M0,%.2f h%.2f v%.2f h%.2f " %(base_y, cell_h, cren_l, gaps_t))) # Top-Right -> Bottom-Right. c_sign = "...
code_fim
hard
{ "lang": "python", "repo": "WRansohoff/grid_box_pattern_gen", "path": "/gen_grid_box.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: WRansohoff/grid_box_pattern_gen path: /gen_grid_box.py import sys import math # Check that the right number of arguments were passed in. if len(sys.argv) != 7: print(("Usage: 'python gen_grid_box.py [W] [L] [H] [C] [R] [T]'\n" " [W] = Interior width (x-axis) of one cell, in mm\n" ...
code_fim
hard
{ "lang": "python", "repo": "WRansohoff/grid_box_pattern_gen", "path": "/gen_grid_box.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|># Draw the 'Grid Box' pattern. # 1. Draw the 'Base' outline, and its notches for the # horizontal/vertical divider columns. # Draw a path to outline the base of the box. base_x = cell_h base_y = (svg_h - (box_l + (cell_h))) svg.write(" <path d=\"M%.2f,%.2f "%(base_x, base_y)) # Top-Left -> Top-Right...
code_fim
hard
{ "lang": "python", "repo": "WRansohoff/grid_box_pattern_gen", "path": "/gen_grid_box.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> if log is not None: log.progress_update(minibatch_num) self._on_minibatch_end(epoch_num, minibatch_num) if log is not None: log.progress_end() val_score = self._get_val_score(epoch_num) return val_score ####################...
code_fim
hard
{ "lang": "python", "repo": "werywjw/mBERT-FineTuning", "path": "/mufins-project/mufins/common/model/training_process_adversarial.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: werywjw/mBERT-FineTuning path: /mufins-project/mufins/common/model/training_process_adversarial.py ''' Adversarial abstract training process class. Like normal training process, but each epoch consists of training the model once on data set and once on another data set, with the aim being to cre...
code_fim
hard
{ "lang": "python", "repo": "werywjw/mBERT-FineTuning", "path": "/mufins-project/mufins/common/model/training_process_adversarial.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> if log is not None: log.progress_update(minibatch_num) self._on_minibatch_end_disc(epoch_num, minibatch_num) if log is not None: log.progress_end() self._on_discriminator_trained(epoch_num) model.set...
code_fim
hard
{ "lang": "python", "repo": "werywjw/mBERT-FineTuning", "path": "/mufins-project/mufins/common/model/training_process_adversarial.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: simplextech/udi-poly-withings path: /nodes/withings_activity_tracker_node.py try: import polyinterface except ImportError: import pgc_interface as polyinterface import utils LOGGER = polyinterface.LOGGER class WithingsActivityTrackerNode(polyinterface.Node): def __init__(self, co...
code_fim
hard
{ "lang": "python", "repo": "simplextech/udi-poly-withings", "path": "/nodes/withings_activity_tracker_node.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> class WithingsActivityTrackerSleepNode(polyinterface.Node): def __init__(self, controller, primary, address, name, devices, sleep): super(WithingsActivityTrackerSleepNode, self).__init__(controller, primary, address, name) self.devices = devices self.sleep = sleep self...
code_fim
hard
{ "lang": "python", "repo": "simplextech/udi-poly-withings", "path": "/nodes/withings_activity_tracker_node.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|>''' Sample Input/Output: Example 1: Input: n = 27 Output: true Example 2: Input: n = 0 Output: false '''<|fim_prefix|># repo: UG-SEP/Data-Structure-and-Algorithms path: /Leetcode/Power of Three/Power of Three.py ''' A python program to implement Power of Three Given an integer n, return true if it ...
code_fim
medium
{ "lang": "python", "repo": "UG-SEP/Data-Structure-and-Algorithms", "path": "/Leetcode/Power of Three/Power of Three.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: UG-SEP/Data-Structure-and-Algorithms path: /Leetcode/Power of Three/Power of Three.py ''' A python program to implement Power of Three Given an integer n, return true if it is a power of three. Otherwise, return false. ''' class Solution: def isPowerOfThree(self, n: int) -> bool: <|fim_suffix...
code_fim
medium
{ "lang": "python", "repo": "UG-SEP/Data-Structure-and-Algorithms", "path": "/Leetcode/Power of Three/Power of Three.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|>Example 1: Input: n = 27 Output: true Example 2: Input: n = 0 Output: false '''<|fim_prefix|># repo: UG-SEP/Data-Structure-and-Algorithms path: /Leetcode/Power of Three/Power of Three.py ''' A python program to implement Power of Three Given an integer n, return true if it is a power of three. Otherwise...
code_fim
hard
{ "lang": "python", "repo": "UG-SEP/Data-Structure-and-Algorithms", "path": "/Leetcode/Power of Three/Power of Three.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> def initFromOwner(self, rid): # There are four possibilities here: # # 1: this instance is the instance for the master component # # 2: this instance is an expanded instance derived directly from the # master component # # 3: This instan...
code_fim
hard
{ "lang": "python", "repo": "eventable/PyCalendar", "path": "/src/pycalendar/icalendar/componentexpanded.py", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_prefix|># repo: eventable/PyCalendar path: /src/pycalendar/icalendar/componentexpanded.py ## # Copyright (c) 2007-2013 Cyrus Daboo. 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 obt...
code_fim
hard
{ "lang": "python", "repo": "eventable/PyCalendar", "path": "/src/pycalendar/icalendar/componentexpanded.py", "mode": "psm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|>class VlanId(TextualConvention, Integer32): status = 'current' subtypeSpec = Integer32.subtypeSpec + ValueRangeConstraint(1, 4094) wwpGenIgmpSnoopMIBObjects = MibIdentifier((1, 3, 6, 1, 4, 1, 6141, 2, 19, 1)) wwpGenIgmpSnoop = MibIdentifier((1, 3, 6, 1, 4, 1, 6141, 2, 19, 1, 1)) wwpGenIgmpSnoopMI...
code_fim
hard
{ "lang": "python", "repo": "agustinhenze/mibs.snmplabs.com", "path": "/pysnmp/WWP-GENERIC-IGMP-SNOOP-MIB.py", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|> status = 'current' subtypeSpec = Integer32.subtypeSpec + ValueRangeConstraint(1, 4094) wwpGenIgmpSnoopMIBObjects = MibIdentifier((1, 3, 6, 1, 4, 1, 6141, 2, 19, 1)) wwpGenIgmpSnoop = MibIdentifier((1, 3, 6, 1, 4, 1, 6141, 2, 19, 1, 1)) wwpGenIgmpSnoopMIBNotificationPrefix = MibIdentifier((1, 3, 6...
code_fim
hard
{ "lang": "python", "repo": "agustinhenze/mibs.snmplabs.com", "path": "/pysnmp/WWP-GENERIC-IGMP-SNOOP-MIB.py", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_prefix|># repo: agustinhenze/mibs.snmplabs.com path: /pysnmp/WWP-GENERIC-IGMP-SNOOP-MIB.py # # PySNMP MIB module WWP-GENERIC-IGMP-SNOOP-MIB (http://snmplabs.com/pysmi) # ASN.1 source file:///Users/davwang4/Dev/mibs.snmplabs.com/asn1/WWP-GENERIC-IGMP-SNOOP-MIB # Produced by pysmi-0.3.4 at Mon Apr 29 21:30:50 2019...
code_fim
hard
{ "lang": "python", "repo": "agustinhenze/mibs.snmplabs.com", "path": "/pysnmp/WWP-GENERIC-IGMP-SNOOP-MIB.py", "mode": "psm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|># Create pysqlite connection from APSW connection con = sqlite3.connect(apsw_con) result = con.execute("select times_two(15)").fetchone()[0] assert result == 30 con.close()<|fim_prefix|># repo: oyorooms/hue path: /desktop/core/ext-py/pysqlite/doc/includes/sqlite3/apsw_example.py from pysqlite2 import dba...
code_fim
medium
{ "lang": "python", "repo": "oyorooms/hue", "path": "/desktop/core/ext-py/pysqlite/doc/includes/sqlite3/apsw_example.py", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_prefix|># repo: oyorooms/hue path: /desktop/core/ext-py/pysqlite/doc/includes/sqlite3/apsw_example.py from pysqlite2 import dbapi2 as sqlite3 import apsw <|fim_suffix|># Create pysqlite connection from APSW connection con = sqlite3.connect(apsw_con) result = con.execute("select times_two(15)").fetchone()[0] ass...
code_fim
medium
{ "lang": "python", "repo": "oyorooms/hue", "path": "/desktop/core/ext-py/pysqlite/doc/includes/sqlite3/apsw_example.py", "mode": "psm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_prefix|># repo: contractshark/dispatch path: /src/dispatch/individual/models.py from datetime import datetime from typing import List, Optional from sqlalchemy import Column, ForeignKey, Integer, PrimaryKeyConstraint, String, Table from sqlalchemy.orm import relationship from sqlalchemy_utils import TSVectorTyp...
code_fim
hard
{ "lang": "python", "repo": "contractshark/dispatch", "path": "/src/dispatch/individual/models.py", "mode": "psm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|>class IndividualContactCreate(IndividualContactBase): terms: Optional[List[TermCreate]] = [] incident_priorities: Optional[List[IncidentPriorityCreate]] = [] incident_types: Optional[List[IncidentTypeCreate]] = [] class IndividualContactUpdate(IndividualContactBase): terms: Optional[List...
code_fim
hard
{ "lang": "python", "repo": "contractshark/dispatch", "path": "/src/dispatch/individual/models.py", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|> class IndividualContactBase(ContactBase): weblink: Optional[str] mobile_phone: Optional[str] office_phone: Optional[str] title: Optional[str] class IndividualContactCreate(IndividualContactBase): terms: Optional[List[TermCreate]] = [] incident_priorities: Optional[List[IncidentP...
code_fim
hard
{ "lang": "python", "repo": "contractshark/dispatch", "path": "/src/dispatch/individual/models.py", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_prefix|># repo: tskkst51/lplTrade path: /PTP/multi_tasking/timer_task.py import datetime from typing import Optional, Any from multi_tasking.job_server import JobServer from multi_tasking.task import Task from trade_interface import current_time # # # class TimerTask(Task): # # # ...
code_fim
hard
{ "lang": "python", "repo": "tskkst51/lplTrade", "path": "/PTP/multi_tasking/timer_task.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> # # # def f(self, parent: JobServer, data: Any) -> (bool, tuple, Optional[str], Optional[datetime.datetime]): """Executes the job task at specific time. Args: parent: JobServer object. ...
code_fim
hard
{ "lang": "python", "repo": "tskkst51/lplTrade", "path": "/PTP/multi_tasking/timer_task.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: mtn/advent16 path: /day03/part2.py #!/usr/bin/env python3 from itertools import combinations count = 0 with open('input.txt') as f: for line1 in f: line2 = f.next() line3 = f.next() <|fim_suffix|> for (p1, p2) in combinations(triangle, 2): if p1 +...
code_fim
hard
{ "lang": "python", "repo": "mtn/advent16", "path": "/day03/part2.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> for (p1, p2) in combinations(triangle, 2): if p1 + p2 <= total - (p1 + p2): break else: count += 1 print(count)<|fim_prefix|># repo: mtn/advent16 path: /day03/part2.py #!/usr/bin/env python3 from itertools import combinations ...
code_fim
hard
{ "lang": "python", "repo": "mtn/advent16", "path": "/day03/part2.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> for i, _ in enumerate(line1): triangle = [line1[i], line2[i], line3[i]] total = sum(triangle) for (p1, p2) in combinations(triangle, 2): if p1 + p2 <= total - (p1 + p2): break else: count += 1 pri...
code_fim
medium
{ "lang": "python", "repo": "mtn/advent16", "path": "/day03/part2.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: slack333/Python path: /sentencia if.py if True: #Se ejectua print ("se cumple la condicion") if False: #No se ejecuta print ("se cumple la condicion") a = 5 if a == 2: #no detecta ya que a = 5 print ("a vale 2") if a == 5: #se cumple la funcion print ("a vale 5") a = 5 b = 10 ...
code_fim
medium
{ "lang": "python", "repo": "slack333/Python", "path": "/sentencia if.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|>nota = float(input("Introduce una nota: ")) if nota >= 9: print ("Sobresaliente") elif nota >= 7: print ("Notable") elif nota >= 6: print ("Bien") elif nota >= 5: print ("Suficiente") else: print ("Insuficiente") if True: pass<|fim_prefix|># repo: slack333/Python path: /sentenci...
code_fim
hard
{ "lang": "python", "repo": "slack333/Python", "path": "/sentencia if.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: joaocarlos1994/tekton path: /backend/appengine/routes/login_rh/form.py # -*- coding: utf-8 -*- from __future__ import absolute_import, unicode_literals from google.appengine.ext import ndb from config.template_middleware import TemplateResponse from gaecookie.decorator import no_csrf from gaeperm...
code_fim
hard
{ "lang": "python", "repo": "joaocarlos1994/tekton", "path": "/backend/appengine/routes/login_rh/form.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> @no_csrf @login_not_required def verifica_registro(**propriedades): query = User.query(User.email == propriedades['email']).get() result = query if result.email == propriedades['email'] and result.password == propriedades['password']: return TemplateResponse(template_path="/candidato/...
code_fim
medium
{ "lang": "python", "repo": "joaocarlos1994/tekton", "path": "/backend/appengine/routes/login_rh/form.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: m0re4u/machine path: /machine/models/seq2seq.py import torch.nn.functional as F from .baseSeqModel import BaseSeqModel class Seq2seq(BaseSeqModel): """ Standard sequence-to-sequence architecture with configurable encoder and decoder. """ def __init__(self, encoder, decoder, de...
code_fim
hard
{ "lang": "python", "repo": "m0re4u/machine", "path": "/machine/models/seq2seq.py", "mode": "psm", "license": "Apache-2.0", "source": "the-stack-v2" }