text
stringlengths
232
16.3k
domain
stringclasses
1 value
difficulty
stringclasses
3 values
meta
dict
<|fim_suffix|>for obj in Movie.objects.all(): if obj.cover and (not obj.is_valid(obj.cover)): print(f"{obj.name}封面失效") obj.cover = None obj.save() print(f"{obj.name}封面已删除")<|fim_prefix|># repo: kqhasaki/Team-Website path: /movies/tests.py from django.test import TestCase <|fim_midd...
code_fim
easy
{ "lang": "python", "repo": "kqhasaki/Team-Website", "path": "/movies/tests.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: kqhasaki/Team-Website path: /movies/tests.py from django.test import TestCase <|fim_suffix|>for obj in Movie.objects.all(): if obj.cover and (not obj.is_valid(obj.cover)): print(f"{obj.name}封面失效") obj.cover = None obj.save() print(f"{obj.name}封面已删除")<|fim_midd...
code_fim
easy
{ "lang": "python", "repo": "kqhasaki/Team-Website", "path": "/movies/tests.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: dzon4xx/company-management path: /employees/models.py from django.db import models class classproperty: def __init__(self, f): self.f = f def __get__(self, obj, owner): return self.f(owner) class ModelNames: @classproperty def name(cls): return cls.__...
code_fim
hard
{ "lang": "python", "repo": "dzon4xx/company-management", "path": "/employees/models.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|>class Profession(models.Model, ModelNames): DEV = 'dev' TEST = 'test' ADM = 'adm' CHOICES = ((DEV, 'Developer'), (TEST, 'Tester'), (ADM, 'Administrator')) name = models.CharField(max_length=20, choices=CHOICES) description = models.TextField() ...
code_fim
medium
{ "lang": "python", "repo": "dzon4xx/company-management", "path": "/employees/models.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: inchiresolver/inchiresolver path: /appsite/inchi/tests.py from django.test import TestCase # Create your tests here. from inchi.identifier import InChI <|fim_suffix|> def test1(self): s = "InChI=1S/C2H6O/c1-2-3/h3H,2H2,1H3" inchi = InChI(s) print(inchi) prin...
code_fim
easy
{ "lang": "python", "repo": "inchiresolver/inchiresolver", "path": "/appsite/inchi/tests.py", "mode": "psm", "license": "BSD-3-Clause", "source": "the-stack-v2" }
<|fim_suffix|> s = "InChI=1S/C2H6O/c1-2-3/h3H,2H2,1H3" inchi = InChI(s) print(inchi) print(inchi.element['well_formatted']) print(inchi.element['is_standard']) print(inchi.element['version'])<|fim_prefix|># repo: inchiresolver/inchiresolver path: /appsite/inchi/tests.py ...
code_fim
easy
{ "lang": "python", "repo": "inchiresolver/inchiresolver", "path": "/appsite/inchi/tests.py", "mode": "spm", "license": "BSD-3-Clause", "source": "the-stack-v2" }
<|fim_prefix|># repo: devbruce/yolov3-tf2 path: /libs/utils/augs.py import cv2 import numpy as np import albumentations as A __all__ = ['get_transform', 'img_letterbox'] def get_transform(img_height, img_width): h_crop_ratio = np.random.uniform(low=0.1, high=0.9) w_crop_ratio = np.random.uniform(low=0.1, h...
code_fim
hard
{ "lang": "python", "repo": "devbruce/yolov3-tf2", "path": "/libs/utils/augs.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> if boxes is None: return img_padded else: boxes[:, [0, 2]] = boxes[:, [0, 2]] * scale + half_pad_width boxes[:, [1, 3]] = boxes[:, [1, 3]] * scale + half_pad_height return img_padded, boxes<|fim_prefix|># repo: devbruce/yolov3-tf2 path: /libs/utils/augs.py import c...
code_fim
hard
{ "lang": "python", "repo": "devbruce/yolov3-tf2", "path": "/libs/utils/augs.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> annotations_dir = args.tao_root / 'annotations' if annotations_dir.exists(): print(f'Annotations directory already exists; skipping.') else: annotations_compressed = args.tao_root / 'annotations.tar.gz' if not annotations_compressed.exists(): banner_log('Dow...
code_fim
hard
{ "lang": "python", "repo": "sukjunhwang/tao", "path": "/scripts/download/download_annotations.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: sukjunhwang/tao path: /scripts/download/download_annotations.py import argparse import urllib.error import urllib.request from pathlib import Path import subprocess ANNOTATIONS_TAR_GZ = 'https://github.com/TAO-Dataset/annotations/archive/v1.2.tar.gz' def banner_log(msg): banner = '#' * le...
code_fim
hard
{ "lang": "python", "repo": "sukjunhwang/tao", "path": "/scripts/download/download_annotations.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> """Round to 2 digits. Returns int if rounded float has only zeroes after the decimal point.""" return int(rounded) if (rounded := round(flt, 2)).is_integer() else rounded<|fim_prefix|># repo: MajorTanya/DTbot path: /util/utils.py from __future__ import annotations <|fim_middle|>def rint(flt: fl...
code_fim
easy
{ "lang": "python", "repo": "MajorTanya/DTbot", "path": "/util/utils.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: MajorTanya/DTbot path: /util/utils.py from __future__ import annotations <|fim_suffix|> """Round to 2 digits. Returns int if rounded float has only zeroes after the decimal point.""" return int(rounded) if (rounded := round(flt, 2)).is_integer() else rounded<|fim_middle|>def rint(flt: fl...
code_fim
easy
{ "lang": "python", "repo": "MajorTanya/DTbot", "path": "/util/utils.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|>setup(name="use_class_before_def", version="0.0.1", install_requires=["quark==0.0.1"], py_modules=['use_class_before_def'], packages=['pkg', 'use_class_before_def', 'use_class_before_def_md'])<|fim_prefix|># repo: bozzzzo/quark path: /quarkc/test/emit/expected/py/use-class-before-...
code_fim
easy
{ "lang": "python", "repo": "bozzzzo/quark", "path": "/quarkc/test/emit/expected/py/use-class-before-def/setup.py", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_prefix|># repo: bozzzzo/quark path: /quarkc/test/emit/expected/py/use-class-before-def/setup.py # Setup file for package use_class_before_def <|fim_suffix|>setup(name="use_class_before_def", version="0.0.1", install_requires=["quark==0.0.1"], py_modules=['use_class_before_def'], packages...
code_fim
easy
{ "lang": "python", "repo": "bozzzzo/quark", "path": "/quarkc/test/emit/expected/py/use-class-before-def/setup.py", "mode": "psm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|>with requests.Session() as s: for keyname in tqdm(keynames): try: r = s.get(schemaUrl + keyname, timeout=61) except requests.exceptions.ReadTimeout: print(keyname, ": Data request read timed out") logging.debug('%s: Data read timed out', keyname) ...
code_fim
hard
{ "lang": "python", "repo": "snatch59/oecd-data-mining", "path": "/oecd_schema.py", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_prefix|># repo: snatch59/oecd-data-mining path: /oecd_schema.py import requests import pandas as pd import lxml.etree as etree from tqdm import tqdm import logging import datetime import os # http://stats.oecd.org/restsdmx/sdmx.ashx/GetSchema/ # Get and save the xml schema for each KeyFamily ID # Should complet...
code_fim
hard
{ "lang": "python", "repo": "snatch59/oecd-data-mining", "path": "/oecd_schema.py", "mode": "psm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_prefix|># repo: Nohossat/exploradome_tangram path: /tangram_app/metrics.py import re import os import seaborn as sns import matplotlib.pyplot as plt from .tangram_game import tangram_game from .utils import get_files from .processing import * from .predictions import * from sklearn.metrics import classification...
code_fim
medium
{ "lang": "python", "repo": "Nohossat/exploradome_tangram", "path": "/tangram_app/metrics.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> if label != predictions.loc[0, 'target']: print(img_path, label, predictions.loc[0, 'target']) y_true.append(label) y_pred.append(predictions.loc[0, 'target']) # get metrics conf_matrix = confusion_matrix(y_true, y_pred, labels=classes) report = classifica...
code_fim
hard
{ "lang": "python", "repo": "Nohossat/exploradome_tangram", "path": "/tangram_app/metrics.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> # for each image, get prediction by our algorithm for label, img_path in images: predictions = game(image=img_path, prepro=prepro, pred_func=pred_func) if predictions is None: continue if label != predictions.loc[0, 'target']: print(img_path, labe...
code_fim
medium
{ "lang": "python", "repo": "Nohossat/exploradome_tangram", "path": "/tangram_app/metrics.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|>if __name__ == "__main__": parser = argparse.ArgumentParser() parser.add_argument("-C", "--parameter", action="append") args = parser.parse_args() function = "do_" + parser.prog.replace("-", "_").replace(".py", "") if function in locals(): locals()[function](args) else: ...
code_fim
medium
{ "lang": "python", "repo": "openbmc/openbmc", "path": "/meta-arm/meta-arm/lib/oeqa/selftest/cases/tests/mock-fvp.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> if function in locals(): locals()[function](args) else: print(f"Unknown mock mode {parser.prog}") sys.exit(1)<|fim_prefix|># repo: openbmc/openbmc path: /meta-arm/meta-arm/lib/oeqa/selftest/cases/tests/mock-fvp.py #! /usr/bin/env python3 import argparse import sys def do...
code_fim
hard
{ "lang": "python", "repo": "openbmc/openbmc", "path": "/meta-arm/meta-arm/lib/oeqa/selftest/cases/tests/mock-fvp.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: openbmc/openbmc path: /meta-arm/meta-arm/lib/oeqa/selftest/cases/tests/mock-fvp.py #! /usr/bin/env python3 import argparse import sys def do_test_parameters(args): if not args.parameter or set(args.parameter) != set(("board.cow=moo", "board.dog=woof")): print(f"Unexpected arguments:...
code_fim
hard
{ "lang": "python", "repo": "openbmc/openbmc", "path": "/meta-arm/meta-arm/lib/oeqa/selftest/cases/tests/mock-fvp.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> """ Add a file picker to the tab """ handler = self._changed_handler(handler) if pick_dir: picker = wx.DirPickerCtrl(self, style=wx.DIRP_USE_TEXTCTRL) picker.Bind(wx.EVT_DIRPICKER_CHANGED, handler) else: picker = wx.FilePi...
code_fim
hard
{ "lang": "python", "repo": "JosephGWoods/oxasl_optpcasl", "path": "/oxasl_optpcasl/gui/widgets.py", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_prefix|># repo: JosephGWoods/oxasl_optpcasl path: /oxasl_optpcasl/gui/widgets.py """ OXASL_OPTPCASL: Useful wx widgets for building the GUI Copyright (c) 2019 University of Oxford """ import os import wx class TabPage(wx.Panel): """ Shared methods used by the various tab pages in the GUI """ d...
code_fim
hard
{ "lang": "python", "repo": "JosephGWoods/oxasl_optpcasl", "path": "/oxasl_optpcasl/gui/widgets.py", "mode": "psm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|> super(NumberChooser, self).__init__(parent) self.minval, self.orig_min, self.maxval, self.orig_max = minval, minval, maxval, maxval self.handler = changed_handler self.hbox = wx.BoxSizer(wx.HORIZONTAL) if label is not None: self.label = wx.StaticText(se...
code_fim
hard
{ "lang": "python", "repo": "JosephGWoods/oxasl_optpcasl", "path": "/oxasl_optpcasl/gui/widgets.py", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|> permission_required = 'projects.delete_project' accept_global_perms = True form_class = ProjectForm def delete(self, request, *args, **kwargs): self.object = self.get_object() success_url = self.get_success_url() messages.add_message( request, message...
code_fim
hard
{ "lang": "python", "repo": "Hedde/fabric_interface", "path": "/src/fabric_interface/projects/views.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: Hedde/fabric_interface path: /src/fabric_interface/projects/views.py __author__ = 'heddevanderheide' # Django specific from django.contrib import messages from django.core.urlresolvers import reverse from django.http import HttpResponseRedirect from django.utils.datastructures import SortedDict...
code_fim
hard
{ "lang": "python", "repo": "Hedde/fabric_interface", "path": "/src/fabric_interface/projects/views.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|>class ProjectUpdateView(PermissionRequiredMixin, UpdateContextMixin, UpdateView): permission_required = 'projects.change_project' accept_global_perms = True form_class = ProjectForm def get_success_url(self): messages.add_message( self.request, messages.SUCCESS, _(u"U...
code_fim
hard
{ "lang": "python", "repo": "Hedde/fabric_interface", "path": "/src/fabric_interface/projects/views.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> read_mask = torch.sigmoid(self.read_mask(inputs)) read_mask = read_mask.view(-1, self.batch_size, self.num_reads, self.memory_dim) write_mask = torch.sigmoid(self.write_mask(inputs)) write_mask = write_mask.view(-1, self.batch_size, self.num_writes, self.memory_dim) mode_strengths = s...
code_fim
hard
{ "lang": "python", "repo": "JimOhman/differentiable-neural-computers", "path": "/core.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> forward_weights = self.linkage.directional_read_weights(self.read_weights, forward=True, strengths=mode_strengths) backward_mode = read_mode[..., :self.num_writes] forward_m...
code_fim
hard
{ "lang": "python", "repo": "JimOhman/differentiable-neural-computers", "path": "/core.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: JimOhman/differentiable-neural-computers path: /core.py torch import jit class TemporalLinkage(jit.ScriptModule): def __init__(self, batch_size, capacity, num_writes): super(TemporalLinkage, self).__init__() self.batch_size = batch_size self.num_writes = num_writes self.capac...
code_fim
hard
{ "lang": "python", "repo": "JimOhman/differentiable-neural-computers", "path": "/core.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: parknert/zonefile-parser path: /zonefile_parser/helper_test.py import pytest import zonefile_parser.helper as helper class TestRemoveComments: def test_correctly_removes_comment(self): input = "value;comment" result = helper.remove_comments(input) assert result == "va...
code_fim
hard
{ "lang": "python", "repo": "parknert/zonefile-parser", "path": "/zonefile_parser/helper_test.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> input = '"A"' result = helper.is_in_quote(input,0) assert result == False class TestParseBind: def test_parses_two_digit_period(self): bind_string = "15M" result = helper.parse_bind(bind_string) assert result == (15*60) def test_parses_multiple_per...
code_fim
hard
{ "lang": "python", "repo": "parknert/zonefile-parser", "path": "/zonefile_parser/helper_test.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|>print(f'R${valor:0.2f} convertidos em {moeda} é igual a ${novo_valor:0.2f}.')<|fim_prefix|># repo: antunesce/Curso-Python-3 path: /Mundo 1 - Fundamentos/Aula007 - Operadores Aritméticos/Desafio010.py # Desafio 10: Crie um programa que leia quanto dinheiro uma pessoa tem na carteira e mostre quantos dólar...
code_fim
medium
{ "lang": "python", "repo": "antunesce/Curso-Python-3", "path": "/Mundo 1 - Fundamentos/Aula007 - Operadores Aritméticos/Desafio010.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: antunesce/Curso-Python-3 path: /Mundo 1 - Fundamentos/Aula007 - Operadores Aritméticos/Desafio010.py # Desafio 10: Crie um programa que leia quanto dinheiro uma pessoa tem na carteira e mostre quantos dólares ela pode comprar. Cotação do dólar no exercício => $ 1,00 = R$ 3,27 print('.' * 40) pri...
code_fim
medium
{ "lang": "python", "repo": "antunesce/Curso-Python-3", "path": "/Mundo 1 - Fundamentos/Aula007 - Operadores Aritméticos/Desafio010.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: mumingpo/2048 path: /2048/_2048board.py from random import randrange as rand from msvcrt import getch as keyin import os class Game(object): """set up the board and movement for the game 2048""" @staticmethod def randp(): return rand(10) == 9 ##i...
code_fim
hard
{ "lang": "python", "repo": "mumingpo/2048", "path": "/2048/_2048board.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> def availloc(self): for row in range(4): for col in range(4): if self.board[row][col] == 0: yield row, col def checkdeadlock(self): if len(self.availlocs) == 0: ##less expensive check first ...
code_fim
hard
{ "lang": "python", "repo": "mumingpo/2048", "path": "/2048/_2048board.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> def on_message(msg, server): text = msg.get("text", "") match = re.findall(r"!(?:deploy) (.*)", text) if not match: return return deploy(match[0])<|fim_prefix|># repo: Bubba9er/Mastering-DevOps path: /Section7/Video3/deploy.py """!deploy <app> will deploy that app to production"...
code_fim
hard
{ "lang": "python", "repo": "Bubba9er/Mastering-DevOps", "path": "/Section7/Video3/deploy.py", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|> def on_message(msg, server): text = msg.get("text", "") match = re.findall(r"!(?:deploy) (.*)", text) if not match: return return deploy(match[0])<|fim_prefix|># repo: Bubba9er/Mastering-DevOps path: /Section7/Video3/deploy.py """!deploy <app> will deploy that app to production...
code_fim
hard
{ "lang": "python", "repo": "Bubba9er/Mastering-DevOps", "path": "/Section7/Video3/deploy.py", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_prefix|># repo: Bubba9er/Mastering-DevOps path: /Section7/Video3/deploy.py """!deploy <app> will deploy that app to production""" import re import hashlib <|fim_suffix|> text = msg.get("text", "") match = re.findall(r"!(?:deploy) (.*)", text) if not match: return return deploy(match[0])...
code_fim
hard
{ "lang": "python", "repo": "Bubba9er/Mastering-DevOps", "path": "/Section7/Video3/deploy.py", "mode": "psm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|> def stop(self): self.stopping.set() self.join() def join(self): super(GPIOThread, self).join() _THREADS.discard(self) class GPIOQueue(GPIOThread): def __init__( self, parent, queue_len=5, sample_wait=0.0, partial=False, average=median)...
code_fim
hard
{ "lang": "python", "repo": "miketrebilcock/python-gpiozero", "path": "/gpiozero/devices.py", "mode": "spm", "license": "BSD-3-Clause", "source": "the-stack-v2" }
<|fim_prefix|># repo: miketrebilcock/python-gpiozero path: /gpiozero/devices.py from __future__ import ( unicode_literals, print_function, absolute_import, division, ) nstr = str str = type('') import atexit import weakref from threading import Thread, Event, RLock from collections import deque fr...
code_fim
hard
{ "lang": "python", "repo": "miketrebilcock/python-gpiozero", "path": "/gpiozero/devices.py", "mode": "psm", "license": "BSD-3-Clause", "source": "the-stack-v2" }
<|fim_suffix|>PATHS = [ '.', '..', './one/two/three', '../one/two/three', ] for path in PATHS: print('{!r:>21} : {!r}'.format(path, os.path.abspath(path)))<|fim_prefix|># repo: Nobodylesszb/python_module path: /FileSystem/os_path/ospath_abspath.py #要将相对路径转换为绝对文件名,请使用 abspath() import os import os...
code_fim
easy
{ "lang": "python", "repo": "Nobodylesszb/python_module", "path": "/FileSystem/os_path/ospath_abspath.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: Nobodylesszb/python_module path: /FileSystem/os_path/ospath_abspath.py #要将相对路径转换为绝对文件名,请使用 abspath() import os import os.path <|fim_suffix|>PATHS = [ '.', '..', './one/two/three', '../one/two/three', ] for path in PATHS: print('{!r:>21} : {!r}'.format(path, os.path.abspath(...
code_fim
easy
{ "lang": "python", "repo": "Nobodylesszb/python_module", "path": "/FileSystem/os_path/ospath_abspath.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: sbroadhead/literate path: /test/test_corpus.py import unittest import literate class LiterateTests(unittest.TestCase): lipsum = ["""Lorem ipsum dolor sit amet, consectetur adipiscing elit. Curabitur placerat neque vitae neque scelaerisque, id blandit tortor condimentum. Nullam ut pe...
code_fim
hard
{ "lang": "python", "repo": "sbroadhead/literate", "path": "/test/test_corpus.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> self.assertNotIn('\\begin', self.corpus._text) self.assertEquals(2, len(self.corpus.code_regions)) self.assertEquals('haskell', self.corpus.code_regions[0].options['lang']) self.assertEquals('scala', self.corpus.code_regions[1].options['lang']) self.assertEquals('ye...
code_fim
hard
{ "lang": "python", "repo": "sbroadhead/literate", "path": "/test/test_corpus.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> def test_find_blocks(self): self.assertNotIn('\\begin', self.corpus._text) self.assertEquals(2, len(self.corpus.code_regions)) self.assertEquals('haskell', self.corpus.code_regions[0].options['lang']) self.assertEquals('scala', self.corpus.code_regions[1].options['lang'...
code_fim
hard
{ "lang": "python", "repo": "sbroadhead/literate", "path": "/test/test_corpus.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: CardiacModelling/PyHillFit path: /python/doseresponse.py import os import pandas as pd import numpy as np import scipy.stats as st #import warnings #warnings.filterwarnings("error") beta = 2. alpha = ((beta+1.)/(beta-1.))**(1./beta) # for mode at 1 mu = 4. s = 2. sigma_uniform_lower = 1e-3 sigm...
code_fim
hard
{ "lang": "python", "repo": "CardiacModelling/PyHillFit", "path": "/python/doseresponse.py", "mode": "psm", "license": "BSD-3-Clause", "source": "the-stack-v2" }
<|fim_suffix|>def samples_file(drug, channel, model, hierarchical, num_samples, temperature): if hierarchical: output_dir = 'output/{}/hierarchical/{}/{}/temperature_{}/'.format(dir_name, drug, channel, temperature) else: output_dir = 'output/{}/single-level/{}/{}/model_{}/temperature_{}/'.forma...
code_fim
hard
{ "lang": "python", "repo": "CardiacModelling/PyHillFit", "path": "/python/doseresponse.py", "mode": "spm", "license": "BSD-3-Clause", "source": "the-stack-v2" }
<|fim_prefix|># repo: joelmpiper/bill_taxonomy path: /bin/write_data.py #!/usr/bin/env python # -*- coding: utf-8 -*- """ write_data Fill in missing data for a subject when the model is available in pickle format. Author: Joel Piper <joelmpiper [at] gmail.com> Created: Saturday, September 27, 2016 """ <|fim_su...
code_fim
hard
{ "lang": "python", "repo": "joelmpiper/bill_taxonomy", "path": "/bin/write_data.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> dbname = cfg['dbname'] username = cfg['username'] sub = cfg['subject'] us_bills = get_us_bills(dbname, username, 50000) subjects = get_subjects(dbname, username, [sub]) X = make_x_values(us_bills) y = make_y_values(us_bills, subjects, sub) f...
code_fim
hard
{ "lang": "python", "repo": "joelmpiper/bill_taxonomy", "path": "/bin/write_data.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|>algo = algorithms.index(parms.algorithm) cert = psycopg2.Binary(get_cert(parms.certificate)) if parms.certificate != None else None local = (parms.type == 'local') conn = psycopg2.connect(database='maildb', user='direct') cur = conn.cursor(); if parms.cmd == 'add': cur.execute("INSERT INTO domains(na...
code_fim
hard
{ "lang": "python", "repo": "Medicasoft/Abelian", "path": "/src/tools/direct_domain", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_prefix|># repo: Medicasoft/Abelian path: /src/tools/direct_domain #!/usr/bin/env python """ Copyright 2014 MedicaSoft LLC USA and Info World SRL Licensed under the Apache License, Version 2.0 the "License"; you may not use this file except in compliance with the License. You may obtain a copy of the License at ...
code_fim
hard
{ "lang": "python", "repo": "Medicasoft/Abelian", "path": "/src/tools/direct_domain", "mode": "psm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|>if (parms.cmd != 'list') and (parms.domain == None): print 'Domain name is required' exit(2) algo = algorithms.index(parms.algorithm) cert = psycopg2.Binary(get_cert(parms.certificate)) if parms.certificate != None else None local = (parms.type == 'local') conn = psycopg2.connect(database='maild...
code_fim
hard
{ "lang": "python", "repo": "Medicasoft/Abelian", "path": "/src/tools/direct_domain", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|>BondsMapper = vtk.vtkPolyDataMapper() BondsMapper.SetInputConnection(Tube.GetOutputPort()) BondsMapper.SetImmediateModeRendering(1) BondsMapper.UseLookupTableScalarRangeOff() BondsMapper.SetScalarVisibility(1) BondsMapper.SetScalarModeToDefault() Bonds = vtk.vtkActor() Bonds.SetMapper(BondsMapper...
code_fim
hard
{ "lang": "python", "repo": "hlzz/dotfiles", "path": "/graphics/VTK-7.0.0/Rendering/Volume/Testing/Python/gaussian.py", "mode": "spm", "license": "BSD-3-Clause", "source": "the-stack-v2" }
<|fim_suffix|>contour = vtk.vtkContourFilter() contour.SetInputData(reader.GetGridOutput()) contour.GenerateValues(5, 0, .05) contourMapper = vtk.vtkPolyDataMapper() contourMapper.SetInputConnection(contour.GetOutputPort()) contourMapper.SetScalarRange(0, .1) contourMapper.GetLookupTable().SetHueRange(0.32, 0) ...
code_fim
hard
{ "lang": "python", "repo": "hlzz/dotfiles", "path": "/graphics/VTK-7.0.0/Rendering/Volume/Testing/Python/gaussian.py", "mode": "spm", "license": "BSD-3-Clause", "source": "the-stack-v2" }
<|fim_prefix|># repo: hlzz/dotfiles path: /graphics/VTK-7.0.0/Rendering/Volume/Testing/Python/gaussian.py #!/usr/bin/env python import vtk from vtk.test import Testing from vtk.util.misc import vtkGetDataRoot VTK_DATA_ROOT = vtkGetDataRoot() ren1 = vtk.vtkRenderer() renWin = vtk.vtkRenderWindow() renWin.SetMu...
code_fim
hard
{ "lang": "python", "repo": "hlzz/dotfiles", "path": "/graphics/VTK-7.0.0/Rendering/Volume/Testing/Python/gaussian.py", "mode": "psm", "license": "BSD-3-Clause", "source": "the-stack-v2" }
<|fim_prefix|># repo: suddi/3DSlantRelief path: /src/modelview.py from math import cos, sin from numpy import array, float32 from tools import deg_to_rad class ModelView(object): def __init__(self, *args, **kwargs): # The matrix is: # 1 0 0 0 # 0 1 0 0 ...
code_fim
hard
{ "lang": "python", "repo": "suddi/3DSlantRelief", "path": "/src/modelview.py", "mode": "psm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|> forward_x *= scale['Z'] forward_y *= scale['Z'] forward_z *= scale['Z'] self.matrix = array([ [left_x, left_y, left_z, 0.0], [up_x, up_y, up_z, 0.0], [forward_x, forward_y, forwar...
code_fim
hard
{ "lang": "python", "repo": "suddi/3DSlantRelief", "path": "/src/modelview.py", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|> self.create_table() \ .build_view()\ .with_name("POSTS_VIEW")\ .select_column("title")\ .with_action("CREATE")\ .to_path(file.name) expected_statement = """ CREATE VIEW POSTS_VIEW AS SELECT title FROM POSTS;""".strip() wi...
code_fim
hard
{ "lang": "python", "repo": "zhangyuan/simple-sql-builder", "path": "/test/view_test.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: zhangyuan/simple-sql-builder path: /test/view_test.py import tempfile import unittest from table import Table from view import ColumnNotExits class ViewTest(unittest.TestCase): def test_build_view_from_table(self): table = self.create_table() view = table.build_view() ...
code_fim
hard
{ "lang": "python", "repo": "zhangyuan/simple-sql-builder", "path": "/test/view_test.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> statement = self.create_table()\ .build_view() \ .with_name("POSTS_VIEW") \ .select_column("title") \ .with_action("CREATE") \ .with_header("/* This is comment */")\ .build() expected_statement = """ /* This is commen...
code_fim
hard
{ "lang": "python", "repo": "zhangyuan/simple-sql-builder", "path": "/test/view_test.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: MaXXXXfeng/flask-scaffolding path: /flask_scaffolding/scaffoldings/basic/proj/models/mongo_models.py from mongoengine import ( DateTimeField, StringField, DictField, ObjectIdField, ListField, IntField, BooleanField, ) from proj.extensions import mongo_db from proj.uti...
code_fim
hard
{ "lang": "python", "repo": "MaXXXXfeng/flask-scaffolding", "path": "/flask_scaffolding/scaffoldings/basic/proj/models/mongo_models.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> _id = IntField(primary_key=True) def to_dict(self): return { 'id': self.id } class Sequence(mongo_db.Document): ''' Generate Auto incrementing IDs by using next_sequence_id method ''' _id = StringField(primary_key=True) value = IntField(required=True) ...
code_fim
hard
{ "lang": "python", "repo": "MaXXXXfeng/flask-scaffolding", "path": "/flask_scaffolding/scaffoldings/basic/proj/models/mongo_models.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|>def main() -> None: from argparse import ArgumentParser def comma_split(s: str) -> Tuple: if not s: return () else: return tuple(map(int, s.split(","))) parser = ArgumentParser( description="Scansort helps to collate and rename book scan images...
code_fim
hard
{ "lang": "python", "repo": "mkuznets/scansort", "path": "/scansort/__main__.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> self.files: Dict[Page, List[str]] = {} self.missing: Dict[Page, List[int]] = {} @property def n_all(self) -> int: return sum(self.n(t) for t in Page) @property def is_valid(self) -> bool: return self.n(Page.odd) - self.n(Page.even) == self.n_all % 2 d...
code_fim
hard
{ "lang": "python", "repo": "mkuznets/scansort", "path": "/scansort/__main__.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: mkuznets/scansort path: /scansort/__main__.py # -*- coding: utf-8 -*- """ scansort.__main__ ~~~~~~~~~ Scansort executable :copyright: (c) 2016, Max Kuznetsov :license: MIT, see LICENSE for more details. """ import os import shutil import subprocess import tempfile from enum...
code_fim
hard
{ "lang": "python", "repo": "mkuznets/scansort", "path": "/scansort/__main__.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: coolspiderghy/preprocessing-workflow path: /fmriprep/workflows/base.py #!/usr/bin/env python # -*- coding: utf-8 -*- # emacs: -*- mode: python; py-indent-offset: 4; indent-tabs-mode: nil -*- # vi: set ft=python sts=4 ts=4 sw=4 et: """ Created on Wed Dec 2 17:35:40 2015 @author: craigmoodie """ ...
code_fim
hard
{ "lang": "python", "repo": "coolspiderghy/preprocessing-workflow", "path": "/fmriprep/workflows/base.py", "mode": "psm", "license": "BSD-3-Clause", "source": "the-stack-v2" }
<|fim_suffix|> workflow.connect([ (inputnode, bidssrc, [('subject_id', 'subject_id')]), (bidssrc, t1w_pre, [('t1w', 'inputnode.t1w')]), (bidssrc, fmap_est, [('fmap', 'inputnode.input_images')]), (bidssrc, sbref_pre, [('sbref', 'inputnode.sbref')]), (fmap_est, sbref_pre, [('out...
code_fim
hard
{ "lang": "python", "repo": "coolspiderghy/preprocessing-workflow", "path": "/fmriprep/workflows/base.py", "mode": "spm", "license": "BSD-3-Clause", "source": "the-stack-v2" }
<|fim_suffix|> if "variables" not in test_block_config: test_block_config["variables"] = {} tavern_box = Box({ "env_vars": dict(os.environ), }) test_block_config["variables"]["tavern"] = tavern_box tests: OrderedDict = { 'all_passed': True, 'tests': list(), '...
code_fim
hard
{ "lang": "python", "repo": "feliphebueno/Tavern", "path": "/tavern/core.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: feliphebueno/Tavern path: /tavern/core.py import logging import os import io from collections import OrderedDict from typing import List, Dict from datetime import datetime import yaml from contextlib2 import ExitStack from box import Box from tavern.response.rest import RestResponse from .uti...
code_fim
hard
{ "lang": "python", "repo": "feliphebueno/Tavern", "path": "/tavern/core.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|>def run(in_file: str, tavern_global_cfg=[]) -> List[dict]: """Run all tests contained in a file For each test this makes sure it matches the expected schema, then runs it. There currently isn't something like pytest's `-x` flag which exits on first failure. Todo: the tavern_g...
code_fim
hard
{ "lang": "python", "repo": "feliphebueno/Tavern", "path": "/tavern/core.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: tanadeau/pubsub path: /test_pubsub.py #! /usr/bin/python """ Unit tests for pubsub module """ import logging import unittest import pubsub class SingleSubscriber(object): def __init__(self, test, bus, exp_topic, exp_data, create_topic=True): self.bus = bus self.test = tes...
code_fim
hard
{ "lang": "python", "repo": "tanadeau/pubsub", "path": "/test_pubsub.py", "mode": "psm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|> def test_multi_sub(self): """Tests one subscriber that subscribes to multiple topics""" # Create bus bus = pubsub.PubSubBus() topic_data_dict = { 'foo': 'data', 'bar': 589, 'baz': {'a': 1, 'b': 2}} # Create multi-subscriber ...
code_fim
hard
{ "lang": "python", "repo": "tanadeau/pubsub", "path": "/test_pubsub.py", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|> """ Create or update a new value in store :param key: key :param value: value """ self._store[key] = value def values(self) -> Iterable[U]: """ Gets all values in store as list :return: List of values """ return s...
code_fim
hard
{ "lang": "python", "repo": "shingkid/electionguard-python", "path": "/src/electionguard/data_store.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: shingkid/electionguard-python path: /src/electionguard/data_store.py from collections.abc import Mapping from typing import ( Dict, Generic, Iterable, Iterator, List, Optional, Tuple, TypeVar, ) T = TypeVar("T") U = TypeVar("U") class DataStore(Generic[T, U], ...
code_fim
hard
{ "lang": "python", "repo": "shingkid/electionguard-python", "path": "/src/electionguard/data_store.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|>class ReadOnlyDataStore(Generic[T, U], Mapping): """ A readonly view to a Data store """ def __init__(self, data: DataStore[T, U]): self._data: DataStore[T, U] = data def __getitem__(self, key: T) -> Optional[U]: return self._data.get(key) def __len__(self) -> in...
code_fim
hard
{ "lang": "python", "repo": "shingkid/electionguard-python", "path": "/src/electionguard/data_store.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: catapult-project/catapult path: /third_party/google-endpoints/future/moves/dbm/__init__.py from __future__ import absolute_import from future.utils import PY3 <|fim_suffix|># Py3.3's dbm/__init__.py imports ndbm but doesn't expose it via __all__. # In case some (badly written) code depends on db...
code_fim
medium
{ "lang": "python", "repo": "catapult-project/catapult", "path": "/third_party/google-endpoints/future/moves/dbm/__init__.py", "mode": "psm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|># Py3.3's dbm/__init__.py imports ndbm but doesn't expose it via __all__. # In case some (badly written) code depends on dbm.ndbm after import dbm, # we simulate this: if PY3: from dbm import ndbm else: try: from future.moves.dbm import ndbm except ImportError: ndbm = None<|fim...
code_fim
medium
{ "lang": "python", "repo": "catapult-project/catapult", "path": "/third_party/google-endpoints/future/moves/dbm/__init__.py", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|> ### visualizations # create prettierplot object p = PrettierPlot(chart_scale=chart_scale, plot_orientation="wide_standard") # if boolean is passed to outliers_out_of_scope if isinstance(outliers_out_of_scope, bool): # if outliers_out_of_scope = True if outliers_out_of_...
code_fim
hard
{ "lang": "python", "repo": "petersontylerd/mlmachine", "path": "/mlmachine/explore/eda_suite.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: petersontylerd/mlmachine path: /mlmachine/explore/eda_suite.py port os import sys from prettierplot.plotter import PrettierPlot from prettierplot import style def eda_cat_target_cat_feat(self, feature, training_data=True, level_count_cap=50, color_map="viridis", legend_labels=None, ...
code_fim
hard
{ "lang": "python", "repo": "petersontylerd/mlmachine", "path": "/mlmachine/explore/eda_suite.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: petersontylerd/mlmachine path: /mlmachine/explore/eda_suite.py directory. """ # dynamically choose training data objects or validation data objects data, target, mlm_dtypes = self.training_or_validation_dataset(training_data) ### data summaries ## feature summary # combin...
code_fim
hard
{ "lang": "python", "repo": "petersontylerd/mlmachine", "path": "/mlmachine/explore/eda_suite.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> redirect('/docs#Package_Developers', 301)<|fim_prefix|># repo: june07/packagecontrol.io path: /app/controllers/developers.py from bottle import route, redirect <|fim_middle|>@route('/docs/developers', name='developers') def developers_controller():
code_fim
medium
{ "lang": "python", "repo": "june07/packagecontrol.io", "path": "/app/controllers/developers.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: june07/packagecontrol.io path: /app/controllers/developers.py from bottle import route, redirect <|fim_suffix|> redirect('/docs#Package_Developers', 301)<|fim_middle|> @route('/docs/developers', name='developers') def developers_controller():
code_fim
medium
{ "lang": "python", "repo": "june07/packagecontrol.io", "path": "/app/controllers/developers.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> def test_no_permissions(self): with self.assertRaises(PermissionDenied): Permission.check_permissions( requester=self.user, permissions=(permission_role_view,) ) def test_with_permissions(self): self.group.user_set.add(self.user) sel...
code_fim
hard
{ "lang": "python", "repo": "kyper999/mayan-edms", "path": "/mayan/apps/permissions/tests/test_models.py", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_prefix|># repo: kyper999/mayan-edms path: /mayan/apps/permissions/tests/test_models.py from __future__ import unicode_literals from django.contrib.auth import get_user_model from django.contrib.auth.models import Group from django.core.exceptions import PermissionDenied from django.test import TestCase from us...
code_fim
medium
{ "lang": "python", "repo": "kyper999/mayan-edms", "path": "/mayan/apps/permissions/tests/test_models.py", "mode": "psm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|> with self.assertRaises(PermissionDenied): Permission.check_permissions( requester=self.user, permissions=(permission_role_view,) ) def test_with_permissions(self): self.group.user_set.add(self.user) self.role.permissions.add(permission_r...
code_fim
hard
{ "lang": "python", "repo": "kyper999/mayan-edms", "path": "/mayan/apps/permissions/tests/test_models.py", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|>from .graphic_selection import * from .stream_reader import * from .model_physics import * from .chi2 import * from .general import * from .psd import * from .manual_fitting import * from .mcmc_addon import *<|fim_prefix|># repo: DimitriMisiak/package_red_magic path: /red_magic/__init__.py #!/usr/bin/env...
code_fim
easy
{ "lang": "python", "repo": "DimitriMisiak/package_red_magic", "path": "/red_magic/__init__.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: DimitriMisiak/package_red_magic path: /red_magic/__init__.py #!/usr/bin/env python3 # -*- coding: utf-8 -*- """ Created on Mon Oct 7 10:03:57 2019 @author: misiak """ <|fim_suffix|>from .graphic_selection import * from .stream_reader import * from .model_physics import * from .chi2 import * fr...
code_fim
easy
{ "lang": "python", "repo": "DimitriMisiak/package_red_magic", "path": "/red_magic/__init__.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: timsainb/avgn_paper path: /avgn/utils/general.py # any snippits of code that don't fit elsewhere import numpy as np import pickle import zipfile from avgn.utils.paths import ensure_dir from tqdm.autonotebook import tqdm import matplotlib.pyplot as plt from zipfile import BadZipFile def prepar...
code_fim
medium
{ "lang": "python", "repo": "timsainb/avgn_paper", "path": "/avgn/utils/general.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> with open(save_loc, "wb") as f: pickle.dump(dict_, f, protocol=pickle.HIGHEST_PROTOCOL) def rescale(X, out_min, out_max): return out_min + (X - np.min(X)) * ((out_max - out_min) / (np.max(X) - np.min(X))) def seconds_to_str(seconds): """ converts a number of seconds to hours, minut...
code_fim
medium
{ "lang": "python", "repo": "timsainb/avgn_paper", "path": "/avgn/utils/general.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> def zero_one_norm(x): return (x - np.min(x)) / (np.max(x) - np.min(x)) def save_dict_pickle(dict_, save_loc): with open(save_loc, "wb") as f: pickle.dump(dict_, f, protocol=pickle.HIGHEST_PROTOCOL) def rescale(X, out_min, out_max): return out_min + (X - np.min(X)) * ((out_max - ou...
code_fim
medium
{ "lang": "python", "repo": "timsainb/avgn_paper", "path": "/avgn/utils/general.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> def run_query(query, records, global_state=None, weights=None): """Executes query on the given set of records as a single sample. Args: query: A PrivateQuery to run. records: An iterable containing records to pass to the query. global_state: The current global state. If None, an initial ...
code_fim
medium
{ "lang": "python", "repo": "tensorflow/privacy", "path": "/tensorflow_privacy/privacy/dp_query/test_utils.py", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|> Returns: A tuple (result, new_global_state) where "result" is the result of the query and "new_global_state" is the updated global state. """ if not global_state: global_state = query.initial_global_state() params = query.derive_sample_params(global_state) sample_state = query.init...
code_fim
hard
{ "lang": "python", "repo": "tensorflow/privacy", "path": "/tensorflow_privacy/privacy/dp_query/test_utils.py", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_prefix|># repo: tensorflow/privacy path: /tensorflow_privacy/privacy/dp_query/test_utils.py # Copyright 2019, The TensorFlow 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 of the License at # ...
code_fim
medium
{ "lang": "python", "repo": "tensorflow/privacy", "path": "/tensorflow_privacy/privacy/dp_query/test_utils.py", "mode": "psm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_prefix|># repo: webclinic017/magnet-migrade path: /magnet/domain/trade/repository.py import asyncio import logging from typing import Dict, Type from .abc import Analyzer, BrokerImpl, TopicProvider logger = logging.getLogger(__name__) class BrokerRepository: __brokers__: Dict[str, Type[BrokerImpl]] = {} ...
code_fim
medium
{ "lang": "python", "repo": "webclinic017/magnet-migrade", "path": "/magnet/domain/trade/repository.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|>class AnalyzersRepository: __analyzers__: Dict[str, Type[Analyzer]] = {} @classmethod def register(cls, analyzer: Type[Analyzer]): name = analyzer.get_name() if name in cls.__analyzers__: raise Exception() cls.__analyzers__[name] = analyzer return ...
code_fim
medium
{ "lang": "python", "repo": "webclinic017/magnet-migrade", "path": "/magnet/domain/trade/repository.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: BoChenGroup/RAFnet path: /rnn_attention_model.py eight_variable([self.opt.hidden_size_global*2 , self.opt.enc_k]) self.enc_W_v = self.weight_variable([self.opt.hidden_size_global*2 , self.opt.enc_v]) self.dec_W_q = self.weight_variable([self.opt.gener_hidden_size*2 , self.opt....
code_fim
hard
{ "lang": "python", "repo": "BoChenGroup/RAFnet", "path": "/rnn_attention_model.py", "mode": "psm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|> gener_xh = tf.reshape(outputs_gener_xh,[self.opt.batch_size * self.opt.dimXg, self.opt.gener_hidden_size*2]) self.dec_xh_query = tf.reshape(tf.matmul(gener_xh, self.dec_W_q),[self.opt.batch_size, self.opt.dimXg, self.opt.dec_q]) self.att_xh_de = self.qk_Attention(self.dec_xh_qu...
code_fim
hard
{ "lang": "python", "repo": "BoChenGroup/RAFnet", "path": "/rnn_attention_model.py", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_prefix|># repo: BoChenGroup/RAFnet path: /rnn_attention_model.py .enc_W_q = self.weight_variable([self.opt.hidden_size_global*2 , self.opt.enc_q]) self.enc_W_k = self.weight_variable([self.opt.hidden_size_global*2 , self.opt.enc_k]) self.enc_W_v = self.weight_variable([self.opt.hidden_size_glob...
code_fim
hard
{ "lang": "python", "repo": "BoChenGroup/RAFnet", "path": "/rnn_attention_model.py", "mode": "psm", "license": "Apache-2.0", "source": "the-stack-v2" }