text
stringlengths
232
16.3k
domain
stringclasses
1 value
difficulty
stringclasses
3 values
meta
dict
<|fim_prefix|># repo: c4all/c4all path: /comments/decorators.py from django.http import HttpResponse, HttpResponseBadRequest from django.shortcuts import render from comments.models import Site import json def json_response(func): """ A decorator thats takes a view response and turns it into json. If a...
code_fim
hard
{ "lang": "python", "repo": "c4all/c4all", "path": "/comments/decorators.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|># draw pin 1 ID bubble X.add(Circle(-D/2 + 0.5, -E/2 + 0.5, 0.25)) for y in range(H): for x in range(W): if x in (3, 4, 5): continue X.add(Pad( name="%s%d" % ("ABCDEFGHJKLMN"[y], x + 1), x=x0 + x * BALL_SPACING, y=y0 + y * BALL_SPACING, w=PAD_DIA, h=PAD_DIA, shape='circle', sold...
code_fim
medium
{ "lang": "python", "repo": "myelin/myelin-kicad.pretty", "path": "/sdram_54tfbga.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|># top left ball x0 = -(BALL_SPACING * (W - 1.0) / 2) y0 = -(BALL_SPACING * (H - 1.0) / 2) # draw outline X.add(Line(-D/2, -E/2, -D/2, E/2)) X.add(Line(-D/2, E/2, D/2, E/2)) X.add(Line(D/2, E/2, D/2, -E/2)) X.add(Line(D/2, -E/2, -D/2, -E/2)) # draw pin 1 ID bubble X.add(Circle(-D/2 + 0.5, -E/2 + 0.5, 0.2...
code_fim
hard
{ "lang": "python", "repo": "myelin/myelin-kicad.pretty", "path": "/sdram_54tfbga.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: myelin/myelin-kicad.pretty path: /sdram_54tfbga.py from myelin_kicad_mod import * X = Module( identifier="sdram_54tfbga", description="54 ball TFBGA for SDRAM chips" ) # e.g. https://www.alliancememory.com/wp-content/uploads/pdf/dram/256Mb-AS4C16M16SA-C&I_V3.0_March%202015.pdf # plastic chip...
code_fim
hard
{ "lang": "python", "repo": "myelin/myelin-kicad.pretty", "path": "/sdram_54tfbga.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> return res["unconfirmed"] == unconfirmed * COIN \ and res["confirmed"] == confirmed * COIN waitFor(10, lambda: check_address(scripthash, unconfirmed = 1)) n.generate(1) waitFor(10, lambda: check_address(scripthash, confirmed = 1)) def setup_netwo...
code_fim
hard
{ "lang": "python", "repo": "marcusdiaz/BitcoinUnlimited", "path": "/qa/rpc-tests/electrum_basics.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> # waitFor throws on timeout, failing the test waitFor(10, lambda: compare(n, "index_height", n.getblockcount())) waitFor(10, lambda: compare(n, "index_txns", n.getblockcount() + 1, True)) # +1 is genesis tx waitFor(10, lambda: compare(n, "mempool_count", 0, True)) ...
code_fim
medium
{ "lang": "python", "repo": "marcusdiaz/BitcoinUnlimited", "path": "/qa/rpc-tests/electrum_basics.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: marcusdiaz/BitcoinUnlimited path: /qa/rpc-tests/electrum_basics.py #!/usr/bin/env python3 # Copyright (c) 2019 The Bitcoin Unlimited developers """ Tests to check if basic electrum server integration works """ import random from test_framework.util import waitFor, assert_equal from test_framework...
code_fim
hard
{ "lang": "python", "repo": "marcusdiaz/BitcoinUnlimited", "path": "/qa/rpc-tests/electrum_basics.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: ctfaria2/pyrpg path: /encounters/heal.py def heal(character, enemy): character.heal() <|fim_suffix|> character.print_health() enemy.print_health()<|fim_middle|>enemy.counter_attack(character) if (handle_character_death(character, enemy) == True): exit()
code_fim
medium
{ "lang": "python", "repo": "ctfaria2/pyrpg", "path": "/encounters/heal.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|>acter_death(character, enemy) == True): exit() character.print_health() enemy.print_health()<|fim_prefix|># repo: ctfaria2/pyrpg path: /encounters/heal.py def heal(character, enemy): character.heal() <|fim_middle|>enemy.counter_attack(character) if (handle_char
code_fim
easy
{ "lang": "python", "repo": "ctfaria2/pyrpg", "path": "/encounters/heal.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> def __str__(self): return '({0}, {1})'.format(self.latitude, self.longitude)<|fim_prefix|># repo: astagi/pyphoton path: /pyphoton/models.py class Location: @property def latitude(self): return self._point.latitude @property def longitude(self): return self._p...
code_fim
medium
{ "lang": "python", "repo": "astagi/pyphoton", "path": "/pyphoton/models.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: astagi/pyphoton path: /pyphoton/models.py class Location: @property def latitude(self): return self._point.latitude @property def longitude(self): return self._point.longitude def __str__(self): rep = '{0}\n{1}'.format( str(self.name), ...
code_fim
medium
{ "lang": "python", "repo": "astagi/pyphoton", "path": "/pyphoton/models.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: why2pac/dp-tornado path: /dp_tornado/helper/io/path/__init__.py # -*- coding: utf-8 -*- from dp_tornado.engine.helper import Helper as dpHelper import os class PathHelper(dpHelper): def join(self, path, *paths): return os.path.join(path, *paths) def split(self, path): ...
code_fim
hard
{ "lang": "python", "repo": "why2pac/dp-tornado", "path": "/dp_tornado/helper/io/path/__init__.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> if 'ext' in conditions: ext = self.ext(name, dot='').lower() if isinstance(conditions['ext'], (list, tuple)): if ext not in conditions['ext']: return False elif ext != conditions['ext']: return False ...
code_fim
hard
{ "lang": "python", "repo": "why2pac/dp-tornado", "path": "/dp_tornado/helper/io/path/__init__.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> while True: # make copy of program p1 = copy.deepcopy(program) iterations = iterations + 1 number_of_changes = 0 i = 0 while i < len(p1): if p1[i]['op_code'] == 'nop': number_of_changes = number_of_changes + 1 ...
code_fim
hard
{ "lang": "python", "repo": "UncleTed/adventOfCode2020", "path": "/day8/day8.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: UncleTed/adventOfCode2020 path: /day8/day8.py import copy program = [] class PreviouslyExecutedInstructionException(Exception): def __init__(self, message): self.message = message super().__init__(self.message) def execute_program(p): instruction_pointer = 0 accumu...
code_fim
hard
{ "lang": "python", "repo": "UncleTed/adventOfCode2020", "path": "/day8/day8.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> # change op_code if this is the nth try # try: # execute_program(p1) # break # except PreviouslyExecutedInstructionException: # iterations = iterations + 1 # # print([n for i, n in enumerate(program) if n['op_code'] == 'nop' or n['op_code'] ...
code_fim
hard
{ "lang": "python", "repo": "UncleTed/adventOfCode2020", "path": "/day8/day8.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: openstack/trove path: /trove/tests/unittests/module/test_module_models.py # Copyright 2016 Tesora, Inc. # All Rights Reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); you may # not use this file except in compliance with the License. You may obtain # a copy of...
code_fim
hard
{ "lang": "python", "repo": "openstack/trove", "path": "/trove/tests/unittests/module/test_module_models.py", "mode": "psm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|> ['tenant', True, True, False, None, False, exception.ModuleAccessForbidden], ['tenant', False, False, False, None, False, exception.ModuleAccessForbidden], ['tenant', False, True, True, None, False, exception.ModuleAccessForbidden]...
code_fim
hard
{ "lang": "python", "repo": "openstack/trove", "path": "/trove/tests/unittests/module/test_module_models.py", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|> if post_crop_uniform_scale_pct is not None: output = images.resize(output, width=int(width * post_crop_uniform_scale_pct), output_encoding=output_encoding) if overlay_path is not None: # read the overlay into memory overlay_data = open(overlay_path,'r').read() ...
code_fim
hard
{ "lang": "python", "repo": "PaulKinlan/ChromeWebLab", "path": "/Sketchbots/sw/labqueue/support/imaging.py", "mode": "spm", "license": "BSD-3-Clause", "source": "the-stack-v2" }
<|fim_suffix|> """ # figure out the width/height of the image from the datastore # img = images.Image(image_data=image_data) # img.crop(left_x=0.25, top_y=0.25, right_x=0.25, bottom_y=0.25) # img.resize(width=width, height=height) # logging.info('(b) w=%i, h=%i' % (img.width, img.height)) # o...
code_fim
hard
{ "lang": "python", "repo": "PaulKinlan/ChromeWebLab", "path": "/Sketchbots/sw/labqueue/support/imaging.py", "mode": "spm", "license": "BSD-3-Clause", "source": "the-stack-v2" }
<|fim_prefix|># repo: PaulKinlan/ChromeWebLab path: /Sketchbots/sw/labqueue/support/imaging.py # Copyright 2013 Google Inc # # 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": "PaulKinlan/ChromeWebLab", "path": "/Sketchbots/sw/labqueue/support/imaging.py", "mode": "psm", "license": "BSD-3-Clause", "source": "the-stack-v2" }
<|fim_suffix|> plot = pygal.XY( title="Cover features", x_title = "feature 1 (hist_argmax)", y_title = "feature 2 (hist_median)", stroke=False, logarithmic=False, show_legend = False) for i in range(0,15): if genres[i] == "hip-hop": color = "blu...
code_fim
hard
{ "lang": "python", "repo": "dh-trier/musicovers", "path": "/9EV-skripte/9EV-001.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: dh-trier/musicovers path: /9EV-skripte/9EV-001.py #!/usr/bin/env python3 # -*- coding: utf-8 -*- """ Visualize the feature distribution. """ # general import pandas as pd from os.path import join import os.path #specific import pygal # same package from ZZ_HelperModules import docfile # ====...
code_fim
hard
{ "lang": "python", "repo": "dh-trier/musicovers", "path": "/9EV-skripte/9EV-001.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|>def main(sourcedatafile, targetdatafile, documentationfile, tail): """ Visualize the feature distribution. """ data = load_data(sourcedatafile) genres = get_metadata(data) featurematrix = get_featurematrix(data) make_scatterplot(genres, featurematrix, targetdatafile) docfil...
code_fim
hard
{ "lang": "python", "repo": "dh-trier/musicovers", "path": "/9EV-skripte/9EV-001.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> if not provider in providers: raise Exception('Provider {provider} is not supported.'.format( provider=provider, )) return providers[provider](*options)<|fim_prefix|># repo: typerandom/scrubby path: /scrubby/db/provider/provider_factory.py from .nu...
code_fim
medium
{ "lang": "python", "repo": "typerandom/scrubby", "path": "/scrubby/db/provider/provider_factory.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: typerandom/scrubby path: /scrubby/db/provider/provider_factory.py from .null_provider import NullProvider from .postgres_provider import PostgresProvider class ProviderFactory(object): providers = { 'postgres': PostgresProvider, } <|fim_suffix|> providers = ProviderFactor...
code_fim
medium
{ "lang": "python", "repo": "typerandom/scrubby", "path": "/scrubby/db/provider/provider_factory.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> super().__init__() self.names = names self.setSortingEnabled(True) self.sortItems(order=QtCore.Qt.DescendingOrder) self.reload_items() self.setCurrentRow(0) def reload_items(self): self.clear() self.set_items() def set_items(self): ...
code_fim
medium
{ "lang": "python", "repo": "mchels/FolderBrowser", "path": "/filelistwidget.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> def set_items(self): for name in self.names: item = QtWidgets.QListWidgetItem(name, parent=self) self.addItem(item)<|fim_prefix|># repo: mchels/FolderBrowser path: /filelistwidget.py from PyQt5 import QtCore, QtWidgets from sweep import Sweep import os class FileList(...
code_fim
medium
{ "lang": "python", "repo": "mchels/FolderBrowser", "path": "/filelistwidget.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: mchels/FolderBrowser path: /filelistwidget.py from PyQt5 import QtCore, QtWidgets from sweep import Sweep import os class FileList(QtWidgets.QListWidget): """ Contains a list of sweeps to plot. """ def __init__(self, names): <|fim_suffix|> for name in self.names: ...
code_fim
hard
{ "lang": "python", "repo": "mchels/FolderBrowser", "path": "/filelistwidget.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: tmrob2/BoschDataScience path: /DateData.py import numpy as np import pandas as pd import collections import datetime import matplotlib.pyplot as plt data_init = pd.read_csv("C:/Users/Thomas/Documents/Kaggle/Bosch/train_date.csv", nrows = 10, dtype=float, usecols =...
code_fim
hard
{ "lang": "python", "repo": "tmrob2/BoschDataScience", "path": "/DateData.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|>time_ticks = time_ticks.fillna(0) #Autocorrelation analysis x = time_ticks['cnt'] max_lag = 8000 #some note on np slicing and indexation. # x[i:j:k] is the general syntax # i = starting index # j = stopping index # k = step size # if j is blank then the default is the length of the arra...
code_fim
hard
{ "lang": "python", "repo": "tmrob2/BoschDataScience", "path": "/DateData.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|>time_ticks = pd.DataFrame({'times': time_ticks}) time_ticks = pd.merge(time_ticks, train_station_cnt, how = 'left', on = 'times') time_ticks = time_ticks.fillna(0) #Autocorrelation analysis x = time_ticks['cnt'] max_lag = 8000 #some note on np slicing and indexation. # x[i:j:k] is the ...
code_fim
hard
{ "lang": "python", "repo": "tmrob2/BoschDataScience", "path": "/DateData.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> # print(b) # function(6,6) # import urllib # from urllib.request import urlopen # data1 = urlopen("http://www.baidu.com").read( ) # print(len(data1)) # # data=urlopen("http://www.alipay.com").read() # print(len(data)) from urllib.request import urlopen data=urlopen("http://www.baidu....
code_fim
medium
{ "lang": "python", "repo": "XRTour/big-data", "path": "/python函数.py", "mode": "spm", "license": "Unlicense", "source": "the-stack-v2" }
<|fim_prefix|># repo: XRTour/big-data path: /python函数.py #!usr/bin/env python # -*- coding : utf-8 -*- #作用域 # i=0 # # def func(): # global j # j=10 # j=j+1 # # print(j) # # print(str(j*100)) #<|fim_suffix|> # print(b) # function(6,6) # import urllib # from urllib.request impo...
code_fim
medium
{ "lang": "python", "repo": "XRTour/big-data", "path": "/python函数.py", "mode": "psm", "license": "Unlicense", "source": "the-stack-v2" }
<|fim_prefix|># repo: harshkachhadia/Online-Hotel-Review-Spam-Detection path: /Code/Final_Dataset_Merge_&_Labelling.py # -*- coding: utf-8 -*- """ALDA Implementation.ipynb Automatically generated by Colaboratory. Original file is located at https://colab.research.google.com/drive/1bKao6OZPplh0LAEjI8jxsm3YdnP_3SX...
code_fim
hard
{ "lang": "python", "repo": "harshkachhadia/Online-Hotel-Review-Spam-Detection", "path": "/Code/Final_Dataset_Merge_&_Labelling.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|>text_blob_objs = [] for i in list(to_be_labelled_data): text_blob_objs.append(TextBlob(i)) polarity_list=[] for i in text_blob_objs: if i.sentiment.polarity<0: polarity_list.append("positive") elif i.sentiment.polarity>0: polarity_list.append("negative") elif i.sentiment.polarity==0: ...
code_fim
hard
{ "lang": "python", "repo": "harshkachhadia/Online-Hotel-Review-Spam-Detection", "path": "/Code/Final_Dataset_Merge_&_Labelling.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> @login_required def submit_department_message_form(request): if request.method == 'POST': # This is the group to which SMS has to be sent #try: department = Department.objects.get(id=request.POST.get('department')) #except DoesNotExist: # ToDo: Return to an error page or...
code_fim
hard
{ "lang": "python", "repo": "sara62/rawan-sms", "path": "/smsapp/views.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|>@login_required def submit_group_message_form(request): if request.method == 'POST': # This is the group to which SMS has to be sent #try: group = Group.objects.get(id=request.POST.get('group')) #except DoesNotExist: # ToDo: Return to an error page or the same page with ...
code_fim
hard
{ "lang": "python", "repo": "sara62/rawan-sms", "path": "/smsapp/views.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: sara62/rawan-sms path: /smsapp/views.py from django.http import HttpResponse, HttpResponseRedirect, HttpRequest from django.shortcuts import render from django.contrib.auth.forms import UserCreationForm from django.contrib import auth from django.contrib.auth.decorators import login_required fro...
code_fim
hard
{ "lang": "python", "repo": "sara62/rawan-sms", "path": "/smsapp/views.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: jochen-ott-by/postgraas_server path: /postgraas_server/create_db.py from postgraas_server.management_database import init_db import postgres_instance_driver as pg from postgraas_server.configuration import get_config def create_db_container(): <|fim_suffix|> def main(): from postgraas_serve...
code_fim
hard
{ "lang": "python", "repo": "jochen-ott-by/postgraas_server", "path": "/postgraas_server/create_db.py", "mode": "psm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|> def main(): from postgraas_server import postgraas_api print "creating container for the management db" db_credentials = create_db_container() pg.wait_for_postgres(db_credentials['db_name'], db_credentials['db_username'], db_credentials['db_pwd'], db_credentials[...
code_fim
hard
{ "lang": "python", "repo": "jochen-ott-by/postgraas_server", "path": "/postgraas_server/create_db.py", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|> from postgraas_server import postgraas_api print "creating container for the management db" db_credentials = create_db_container() pg.wait_for_postgres(db_credentials['db_name'], db_credentials['db_username'], db_credentials['db_pwd'], db_credentials['host'], db_c...
code_fim
medium
{ "lang": "python", "repo": "jochen-ott-by/postgraas_server", "path": "/postgraas_server/create_db.py", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|> self.basic = ['sheepdog']<|fim_prefix|># repo: cash2one/xai path: /xai/brain/wordbase/otherforms/_sheepdogs.py #calss header class _SHEEPDOGS(): def __init__(self,): self.name = "SHEEPDOGS" self.definitions = sheepdog <|fim_middle|> self.parents = [] self.childen = [] self.properties = [...
code_fim
medium
{ "lang": "python", "repo": "cash2one/xai", "path": "/xai/brain/wordbase/otherforms/_sheepdogs.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: cash2one/xai path: /xai/brain/wordbase/otherforms/_sheepdogs.py #calss header class _SHEEPDOGS(): def __init__(self,): <|fim_suffix|> self.basic = ['sheepdog']<|fim_middle|> self.name = "SHEEPDOGS" self.definitions = sheepdog self.parents = [] self.childen = [] self.properties = [...
code_fim
medium
{ "lang": "python", "repo": "cash2one/xai", "path": "/xai/brain/wordbase/otherforms/_sheepdogs.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: AIS-Bonn/vp-suite path: /vp_suite/measure/__init__.py r""" This package contains the measures. Measures can either be losses or metrics depending on whether they're differentiable. """ from vp_suite.measure.image_wise import MSE, L1, SmoothL1, LPIPS, SSIM, PSNR from vp_suite.measure.fvd.fvd impo...
code_fim
medium
{ "lang": "python", "repo": "AIS-Bonn/vp-suite", "path": "/vp_suite/measure/__init__.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|># === metrics ================================================================== METRIC_CLASSES = { "mse": MSE, "l1": L1, "smooth_l1": SmoothL1, "lpips": LPIPS, "ssim": SSIM, "psnr": PSNR, "fvd": FrechetVideoDistance } #: A dictionary containing all metric classes and the cor...
code_fim
hard
{ "lang": "python", "repo": "AIS-Bonn/vp-suite", "path": "/vp_suite/measure/__init__.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: chenlei-123/uitester path: /libs/ifeng_video_start.py from keywords import keyword, get_var from remote_classes import UIDevice, InstrumentationRegistry @keyword('scroll_into_main') def scroll_into_main(): """ 滑动欢迎页 进入首页 :return: """ # 滑动四个欢迎页 import time time.s...
code_fim
hard
{ "lang": "python", "repo": "chenlei-123/uitester", "path": "/libs/ifeng_video_start.py", "mode": "psm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|> @keyword('back_reopen') def back_reopen(wait_time=0): """ 模拟按下home键, 置于后台,等待指定时间后再重新唤醒 :param wait_time:指定等待时间 默认为0 :return: """ instrumentation = InstrumentationRegistry.get_instrumentation() context = instrumentation.get_target_context() ui_device = UIDevice.get_instance...
code_fim
hard
{ "lang": "python", "repo": "chenlei-123/uitester", "path": "/libs/ifeng_video_start.py", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_prefix|># repo: CD3/libGBP path: /swig/py_libGBP.py # This file was automatically generated by SWIG (http://www.swig.org). # Version 3.0.10 # # Do not make changes to this file unless you know what you are doing--modify # the SWIG interface file instead. from sys import version_info as _swig_python_version_...
code_fim
hard
{ "lang": "python", "repo": "CD3/libGBP", "path": "/swig/py_libGBP.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> return self.setPowerDP(v) GaussianBeam.setPower = setPower @ureg.wraps( ureg('watt'), None, True ) def getPower (self): return self.getPowerDP() GaussianBeam.getPower = getPower @ureg.wraps( None, (None,ureg('centimeter')), True ) def setCurrentPosition (self,v): return self.setCurrentPositio...
code_fim
hard
{ "lang": "python", "repo": "CD3/libGBP", "path": "/swig/py_libGBP.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|>@ureg.wraps( None, (None,ureg('watt')), True ) def setPower (self,v): return self.setPowerDP(v) GaussianBeam.setPower = setPower @ureg.wraps( ureg('watt'), None, True ) def getPower (self): return self.getPowerDP() GaussianBeam.getPower = getPower @ureg.wraps( None, (None,ureg('centimeter')), T...
code_fim
hard
{ "lang": "python", "repo": "CD3/libGBP", "path": "/swig/py_libGBP.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> uti = fake_uti() self.assertNotEqual( LSHandlerFactory(uti=uti, role='viewer'), LSHandlerFactory(uti=uti, role='editor'), ) def test_equal_if_same_uti_and_existing_role_is_all(self): uti = fake_uti() self.assertEqual( LSHandlerFactory(uti=uti, role='all'), LSHandlerFactory(uti=uti,...
code_fim
hard
{ "lang": "python", "repo": "targendaz2/Mac-Set-Default-Apps", "path": "/tests/tests.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> self.ls.plist = self.seed_plist(XML_PLIST) dest_plist = os.path.join(self.tmp, 'new.dir/tmp.secure.plist') self.ls.read() self.ls.write(dest_plist) self.ls2.plist = dest_plist self.ls2.read() self.assertEqual(dict(self.ls), dict(self.ls2)) def test_stores_LSHandlers_in_contained_list(self...
code_fim
hard
{ "lang": "python", "repo": "targendaz2/Mac-Set-Default-Apps", "path": "/tests/tests.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: targendaz2/Mac-Set-Default-Apps path: /tests/tests.py #!/usr/bin/env python3 from __future__ import print_function import unittest from unittest import TestCase import os from random import randint, random import shutil import sys import tempfile import mock from utils.classes import * from ...
code_fim
hard
{ "lang": "python", "repo": "targendaz2/Mac-Set-Default-Apps", "path": "/tests/tests.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: learningequality/sushi-chef-chocmoose path: /notebooks/extract.py import pickle import os import pprint import re import le_utils import json import pathlib import pkgutil import itertools from operator import itemgetter from le_utils.constants.languages import getlang, _LANGLOOKUP, getlang_by_...
code_fim
hard
{ "lang": "python", "repo": "learningequality/sushi-chef-chocmoose", "path": "/notebooks/extract.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|>projects_tree = {} for project_name, project_langs in projects.items(): print('building subtree for ', project_name) project_dict = dict( project_name=project_name, children=[], ) projects_tree[project_name] = project_dict for lang_tag, langinfo in project_langs.items(...
code_fim
hard
{ "lang": "python", "repo": "learningequality/sushi-chef-chocmoose", "path": "/notebooks/extract.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|># Save tree as JSON class SetEncoder(json.JSONEncoder): def default(self, obj): if isinstance(obj, set): return list(obj) return json.JSONEncoder.default(self, obj) with open('chocmoose_videos_data.json', 'w', encoding='utf8') as json_file: json.dump(projects_tree, jso...
code_fim
hard
{ "lang": "python", "repo": "learningequality/sushi-chef-chocmoose", "path": "/notebooks/extract.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: kyomukyomupurin/Competitive_Programming_Python path: /src/math/osa_k.py class osa_k: def __init__(self, n: int): self.n = n self.min_factor = [0] * (n + 1) self.pr = [] for i in range(2, n + 1, 1): if not self.min_factor[i]: self.mi...
code_fim
hard
{ "lang": "python", "repo": "kyomukyomupurin/Competitive_Programming_Python", "path": "/src/math/osa_k.py", "mode": "psm", "license": "CC0-1.0", "source": "the-stack-v2" }
<|fim_suffix|> res = [] while n != 1: p = self.min_factor[n] cnt = 0 while self.min_factor[n] == p: cnt += 1 n //= p res.append((p, cnt)) return res<|fim_prefix|># repo: kyomukyomupurin/Competitive_Programming_Python ...
code_fim
hard
{ "lang": "python", "repo": "kyomukyomupurin/Competitive_Programming_Python", "path": "/src/math/osa_k.py", "mode": "spm", "license": "CC0-1.0", "source": "the-stack-v2" }
<|fim_suffix|> def prime_factor(self, n : int) -> list : res = [] while n != 1: p = self.min_factor[n] cnt = 0 while self.min_factor[n] == p: cnt += 1 n //= p res.append((p, cnt)) return res<|fim_prefix|># repo: k...
code_fim
hard
{ "lang": "python", "repo": "kyomukyomupurin/Competitive_Programming_Python", "path": "/src/math/osa_k.py", "mode": "spm", "license": "CC0-1.0", "source": "the-stack-v2" }
<|fim_prefix|># repo: NMTHydro/Recharge path: /zobs/orecharge/Point_Analysis/extract_readIn.py from datetime import datetime import numpy as np def read_std_extract_csv(file_name): recs = [] # try: fid = open(file_name) lines = fid.readlines()[:] fid.close() # except IOError: # print ...
code_fim
hard
{ "lang": "python", "repo": "NMTHydro/Recharge", "path": "/zobs/orecharge/Point_Analysis/extract_readIn.py", "mode": "psm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|> # ['date', 'ksat', 'soil_ksat', 'kcb', 'rlin', 'rg', 'etrs_Pm', 'plant height', 'min temp', # 'max temp', 'temp', 'precip', 'fc', 'wp', 'taw', 'aws', 'root_z' data = np.array(recs) return data<|fim_prefix|># repo: NMTHydro/Recharge path: /zobs/orecharge/Point_Anal...
code_fim
hard
{ "lang": "python", "repo": "NMTHydro/Recharge", "path": "/zobs/orecharge/Point_Analysis/extract_readIn.py", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|> def anm_estimate(self, x, y, regressor=GPR(), test_method=hsic_test): """Compute the fitness score of the ANM model in the x->y direction. Parameters ---------- x: array Variable seen as cause y: array Variable seen as effect reg...
code_fim
hard
{ "lang": "python", "repo": "huawei-noah/trustworthyAI", "path": "/gcastle/castle/algorithms/anm/_anm.py", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_prefix|># repo: huawei-noah/trustworthyAI path: /gcastle/castle/algorithms/anm/_anm.py # coding=utf-8 # Copyright (C) 2021. Huawei Technologies Co., Ltd. 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. # Y...
code_fim
hard
{ "lang": "python", "repo": "huawei-noah/trustworthyAI", "path": "/gcastle/castle/algorithms/anm/_anm.py", "mode": "psm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|> n_restarts_optimizer : int, default=0 The number of restarts of the optimizer for finding the kernel's parameters which maximize the log-marginal likelihood. The first run of the optimizer is performed from the kernel's initial parameters, the remaining ones (if any) fr...
code_fim
hard
{ "lang": "python", "repo": "huawei-noah/trustworthyAI", "path": "/gcastle/castle/algorithms/anm/_anm.py", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_prefix|># repo: JeffersonDRego/Exerc-cios_de_aprendizado path: /EXERCÍCIOS_CURSO-EM-VIDEO/ESTRUTURAS_COMPOSTAS/DICIONÁRIOS/ex_DICIONARIO_EM_PYTHON.py alunos=list() aluno=dict() aluno['NOME']=str(input('DIGITE O NOME: ')) aluno['MEDIA']=float(input('DIGITE A M<|fim_suffix|>o["NOME"]}') print(f'A MÉDIA É ...
code_fim
medium
{ "lang": "python", "repo": "JeffersonDRego/Exerc-cios_de_aprendizado", "path": "/EXERCÍCIOS_CURSO-EM-VIDEO/ESTRUTURAS_COMPOSTAS/DICIONÁRIOS/ex_DICIONARIO_EM_PYTHON.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|>print(f'O NOME É {aluno["NOME"]}') print(f'A MÉDIA É {aluno["MEDIA"]}') print('ALUNO APROVADO')<|fim_prefix|># repo: JeffersonDRego/Exerc-cios_de_aprendizado path: /EXERCÍCIOS_CURSO-EM-VIDEO/ESTRUTURAS_COMPOSTAS/DICIONÁRIOS/ex_DICIONARIO_EM_PYTHON.py alunos=list() aluno=dict() aluno['NOM...
code_fim
hard
{ "lang": "python", "repo": "JeffersonDRego/Exerc-cios_de_aprendizado", "path": "/EXERCÍCIOS_CURSO-EM-VIDEO/ESTRUTURAS_COMPOSTAS/DICIONÁRIOS/ex_DICIONARIO_EM_PYTHON.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: 601695931/sdc path: /catalog-be/src/main/resources/scripts/import/tosca/importUsersFromYaml.py import pycurl import sys, getopt from StringIO import StringIO import json import copy import yaml ######################################################################################################...
code_fim
hard
{ "lang": "python", "repo": "601695931/sdc", "path": "/catalog-be/src/main/resources/scripts/import/tosca/importUsersFromYaml.py", "mode": "psm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|> #print("Before get response code") httpRes = c.getinfo(c.RESPONSE_CODE) #print("After get response code") responseCode = c.getinfo(c.RESPONSE_CODE) #print('Status: ' + str(responseCode)) c.close() return (userId, httpRes) except Exception as inst: print(inst) return (userId, Non...
code_fim
hard
{ "lang": "python", "repo": "601695931/sdc", "path": "/catalog-be/src/main/resources/scripts/import/tosca/importUsersFromYaml.py", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_prefix|># repo: gdelfiol/ClinicalKnowledgeSummary path: /CKSapplication/python_scripts/mesh_term_extraction_for_dropdown.py import json import requests import time import datetime now = datetime.datetime.now() start_year = now.year - 10 start_year = str(start_year) current_year = now.year current_year = str(c...
code_fim
hard
{ "lang": "python", "repo": "gdelfiol/ClinicalKnowledgeSummary", "path": "/CKSapplication/python_scripts/mesh_term_extraction_for_dropdown.py", "mode": "psm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|>for line in data[:400009]: # for line in data[400009:]: # I needed to split the file in half to process it try: line = line.decode('ascii') except: continue if (line[0:4] == 'MH ='): dis_med = line[5:len(line)] dis_med = dis_med.rstrip() if (line[0:4] == 'MN ='): if (line[5] == 'C' or line[5...
code_fim
hard
{ "lang": "python", "repo": "gdelfiol/ClinicalKnowledgeSummary", "path": "/CKSapplication/python_scripts/mesh_term_extraction_for_dropdown.py", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|> try: r = requests.get(list_url, params=params, headers=headers) r.raise_for_status() print(r.status_code) r.encoding = "utf-8" print("=" * 10) result = r.json() if db.insert_list(result["pokemons"]): print("插入数据库成功") exce...
code_fim
medium
{ "lang": "python", "repo": "ajavadog/pokemonCollection", "path": "/pokemon_list.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: ajavadog/pokemonCollection path: /pokemon_list.py #获取完整的精灵列表 import requests from pokemonGo import pokemon_db as db list_url = 'https://cn.portal-pokemon.com/play/pokedex/api/v1' headers = { 'Referer': 'https://cn.portal-pokemon.com/play/pokedex', 'User-Agent': 'Mozilla/5.0 (Win...
code_fim
hard
{ "lang": "python", "repo": "ajavadog/pokemonCollection", "path": "/pokemon_list.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> log.debug("parsing best sections using sportgems...") # helper func to be called for each available section kind parser def _get_best_sections_for_section_kind(section_parser, section_distances: List[int]): for distance in section_distances: if self.dis...
code_fim
hard
{ "lang": "python", "repo": "trangiang295/workoutizer", "path": "/wizer/file_helper/parser.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: trangiang295/workoutizer path: /wizer/file_helper/parser.py import os import datetime import logging from typing import List from wizer import configuration from sportgems import DistanceTooSmallException, TooFewDataPointsException, NoSectionFoundException log = logging.getLogger(__name__) ...
code_fim
hard
{ "lang": "python", "repo": "trangiang295/workoutizer", "path": "/wizer/file_helper/parser.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> return path.split("/")[-1] def get_best_sections(self): log.debug("parsing best sections using sportgems...") # helper func to be called for each available section kind parser def _get_best_sections_for_section_kind(section_parser, section_distances: List[int]): ...
code_fim
hard
{ "lang": "python", "repo": "trangiang295/workoutizer", "path": "/wizer/file_helper/parser.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> obj = bigquery_helper._AssignTypeToRow(schema, row) self.assertEqual(obj, {'field_name': '123'}) def testRowsResponseToDicts(self): schema = [{ 'type': 'FOOBAR', 'name': 'f1', 'mode': 'NULLABLE' }, { 'type': 'INTEGER', 'name': 'f2', 'mode'...
code_fim
hard
{ "lang": "python", "repo": "asdfghjjklllllaaa/infra", "path": "/appengine/findit/services/test/bigquery_helper_test.py", "mode": "spm", "license": "BSD-3-Clause", "source": "the-stack-v2" }
<|fim_prefix|># repo: asdfghjjklllllaaa/infra path: /appengine/findit/services/test/bigquery_helper_test.py # Copyright 2018 The Chromium Authors. All rights reserved. # Use of this source code is governed by a BSD-style license that can be # found in the LICENSE file. import datetime import json import mock import un...
code_fim
hard
{ "lang": "python", "repo": "asdfghjjklllllaaa/infra", "path": "/appengine/findit/services/test/bigquery_helper_test.py", "mode": "psm", "license": "BSD-3-Clause", "source": "the-stack-v2" }
<|fim_suffix|> def testBigqueryQueryRequestNoRows(self): mock_client = mock.Mock() mock_client.jobs().query().execute.return_value = { 'jobComplete': True, 'totalRows': '0' } success, rows = bigquery_helper.QueryRequest(mock_client, 'project', ...
code_fim
hard
{ "lang": "python", "repo": "asdfghjjklllllaaa/infra", "path": "/appengine/findit/services/test/bigquery_helper_test.py", "mode": "spm", "license": "BSD-3-Clause", "source": "the-stack-v2" }
<|fim_suffix|> """Returns the coordinate of a tile in a given direction. (x,y)""" x_r = position[x] y_r = position[y] if direction == NORTH: y_r = y_r + 1 elif direction == NORTHEAST: x_r = x_r + 1 y_r = y_r + 1 elif direction == EAST: ...
code_fim
hard
{ "lang": "python", "repo": "wmakley/deathgod", "path": "/deathgod/game_map.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: wmakley/deathgod path: /deathgod/game_map.py from .tile import * from .directions import * from .ordered_pair import * def get_adjacent_coords(pos): return [[pos[x], pos[y]+1], [pos[x], pos[y]-1], [pos[x]+1, pos[y]], [pos[x]+1, pos[y]+1], [pos[...
code_fim
hard
{ "lang": "python", "repo": "wmakley/deathgod", "path": "/deathgod/game_map.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> """main function to solve task A Args: colour ([string]): [name of the colour to be used for calculations] DF ([pandas dataframe]): [dataframe containing input data to be used] Returns: [float]: [max colour difference between any 2 points for the given...
code_fim
hard
{ "lang": "python", "repo": "bruvio/ColourUniformity", "path": "/GO.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: bruvio/ColourUniformity path: /GO.py # To add a new cell, type '# %%' # To add a new markdown cell, type '# %% [markdown]' # %% import pandas as pd import itertools from utility import ( InputingDF, create_list, distance, print_result, create_matrix, get_adjacents, c...
code_fim
hard
{ "lang": "python", "repo": "bruvio/ColourUniformity", "path": "/GO.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: breyenguyen/learn-python path: /hurricaneanalysis.py # names of hurricanes names = ['Cuba I', 'San Felipe II Okeechobee', 'Bahamas', 'Cuba II', 'CubaBrownsville', 'Tampico', 'Labor Day', 'New England', 'Carol', 'Janet', 'Carla', 'Hattie', 'Beulah', 'Camille', 'Edith', 'Anita', 'David', 'Allen', '...
code_fim
hard
{ "lang": "python", "repo": "breyenguyen/learn-python", "path": "/hurricaneanalysis.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|>hurricane_by_mortality = dict_by_mortality(hurricane_dictionary) #print(hurricane_by_mortality) # write your greatest damage function here: def costliest_hurricane(hurricane_dict): greatest_damage = 0 costliest_hurricane = '' for key, value in hurricane_dict.items(): if value.get('Dam...
code_fim
hard
{ "lang": "python", "repo": "breyenguyen/learn-python", "path": "/hurricaneanalysis.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> greatest_damage = 0 costliest_hurricane = '' for key, value in hurricane_dict.items(): if value.get('Damages') != 'Damages not recorded': if float(value.get('Damages')) > greatest_damage: costliest_hurricane = key greatest_damage = float(valu...
code_fim
hard
{ "lang": "python", "repo": "breyenguyen/learn-python", "path": "/hurricaneanalysis.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: midnitekoder/Melanoma_Detection_Using_Deep_Learning path: /butterfly_model/butterResnet_config.py import keras from keras import backend as K #from ror_50 import ResnetBuilder from resnet_Butterfly import ResnetBuilder from keras.preprocessing import image #import cv2 import numpy as np from ker...
code_fim
hard
{ "lang": "python", "repo": "midnitekoder/Melanoma_Detection_Using_Deep_Learning", "path": "/butterfly_model/butterResnet_config.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|>validation_datagen = keras.preprocessing.image.ImageDataGenerator( featurewise_center=True, featurewise_std_normalization=True ) validation_datagen.fit(val_accumulator) #need to do this for training and val #path ='/home/iplab1/Desktop/resnet2/KeraResnetData/train_images' path = '...
code_fim
hard
{ "lang": "python", "repo": "midnitekoder/Melanoma_Detection_Using_Deep_Learning", "path": "/butterfly_model/butterResnet_config.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: jiadaizhao/LeetCode path: /1501-1600/1544-Make The String Great/1544-Make The String Great.py class Solution: def makeGood(self, s: str) -> str: St = [] for c in s: if St and (abs(ord(S<|fim_suffix|> else: St.append(c) return ''.join(St)<|fi...
code_fim
hard
{ "lang": "python", "repo": "jiadaizhao/LeetCode", "path": "/1501-1600/1544-Make The String Great/1544-Make The String Great.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> else: St.append(c) return ''.join(St)<|fim_prefix|># repo: jiadaizhao/LeetCode path: /1501-1600/1544-Make The String Great/1544-Make The String Great.py class Solution: def makeGood(self, s: str) -> str: <|fim_middle|> St = [] for c in s: if St and ...
code_fim
hard
{ "lang": "python", "repo": "jiadaizhao/LeetCode", "path": "/1501-1600/1544-Make The String Great/1544-Make The String Great.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|>def make_executable_path(path: Path) -> Path: if platform.system() == "Windows": return path.with_suffix(".exe") elif platform.system() == "Linux": if '.' not in path.name: return path return path.with_name(path.name.rpartition('.')[-1]) else: raise ...
code_fim
hard
{ "lang": "python", "repo": "renesugar/F", "path": "/general_c_compiler/base.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: renesugar/F path: /general_c_compiler/base.py from __future__ import annotations import platform from abc import ABC, abstractmethod from dataclasses import dataclass from pathlib import Path from typing import TYPE_CHECKING, List, Type <|fim_suffix|> raise NotImplementedError if T...
code_fim
hard
{ "lang": "python", "repo": "renesugar/F", "path": "/general_c_compiler/base.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: vimc/bb8 path: /bin/bb8/docker_rsync.py #!/usr/bin/env python3 import logging from os import getuid, getgid from os.path import join import docker from .logger import log_from_docker class DockerRsync(object): def __init__(self, client=docker.from_env()): self.client = client ...
code_fim
hard
{ "lang": "python", "repo": "vimc/bb8", "path": "/bin/bb8/docker_rsync.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> mounted_volume = join("/", local_volume) volumes = self._get_volume_args(local_volume, "rw") remote_path = "{}{}/".format(remote_path, local_volume) logging.info("Restoring from {} to {}".format(remote_path, local_volu...
code_fim
hard
{ "lang": "python", "repo": "vimc/bb8", "path": "/bin/bb8/docker_rsync.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: geoff-nixon/photons-core path: /tests/photons_app_tests/test_registers.py # coding: spec from photons_app.registers import Target, TargetRegister, ProtocolRegister, MessagesRegister, ReferenceResolerRegister from photons_app.errors import TargetNotFound, ResolverNotFound from photons_app.test_he...
code_fim
hard
{ "lang": "python", "repo": "geoff-nixon/photons-core", "path": "/tests/photons_app_tests/test_registers.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> target2 = mock.Mock(name="target2", spec=[]) maker2 = mock.Mock(name="maker2", return_value=("type2", target2)) register = TargetRegister(self.collector) register.targets["target1"] = maker1 register.targets["target2"] = maker2 self.assertIs(register.resol...
code_fim
hard
{ "lang": "python", "repo": "geoff-nixon/photons-core", "path": "/tests/photons_app_tests/test_registers.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> async def handle(self, request, response): for handler in self.handlers: interrupt = await handler.handle(request, response) if not interrupt is None: return interrupt<|fim_prefix|># repo: br0wn9/lin path: /lin/http/handlers/chainhandler.py # -*- coding...
code_fim
medium
{ "lang": "python", "repo": "br0wn9/lin", "path": "/lin/http/handlers/chainhandler.py", "mode": "spm", "license": "BSD-3-Clause", "source": "the-stack-v2" }
<|fim_prefix|># repo: br0wn9/lin path: /lin/http/handlers/chainhandler.py # -*- coding: utf-8 -*- from lin.http.handlers.ihandler import IHandler class ChainHandler(IHandler): def __init__(self, handlers): self.handlers = handlers def add_handler(self, handler): <|fim_suffix|> async def handle(se...
code_fim
easy
{ "lang": "python", "repo": "br0wn9/lin", "path": "/lin/http/handlers/chainhandler.py", "mode": "psm", "license": "BSD-3-Clause", "source": "the-stack-v2" }
<|fim_suffix|> def test_formatter_no_results(self): out = formatter(self.get_database_mock(), []) print(out) assert out.endswith('reports: []\n...\n')<|fim_prefix|># repo: macbre/index-digest path: /indexdigest/test/formatters/test_yaml.py import yaml from unittest import TestCase from in...
code_fim
hard
{ "lang": "python", "repo": "macbre/index-digest", "path": "/indexdigest/test/formatters/test_yaml.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: macbre/index-digest path: /indexdigest/test/formatters/test_yaml.py import yaml from unittest import TestCase from indexdigest import VERSION from indexdigest.formatters import format_yaml as formatter from . import FormatterTestMixin class TestFormatter(TestCase, FormatterTestMixin): de...
code_fim
hard
{ "lang": "python", "repo": "macbre/index-digest", "path": "/indexdigest/test/formatters/test_yaml.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }