text
stringlengths
232
16.3k
domain
stringclasses
1 value
difficulty
stringclasses
3 values
meta
dict
<|fim_suffix|> """Initialize the evaluator. Args: evaluation_fn: Evaluation function that receives the parameters (model: ArchaiModel, dataloader: torch.utils.data.Dataloader, budget: float) and outputs a float. """ self.evaluation_fn = evalua...
code_fim
hard
{ "lang": "python", "repo": "microsoft/archai", "path": "/archai/discrete_search/evaluators/functional.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|>display_bus = displayio.FourWire(spi, command=tft_dc, chip_select=tft_cs, reset=tft_rst) display = ST7789(display_bus, width=320, height=170, colstart=35, rotation=270) # Make the display context splash = displayio.Group() display.show(splash) color_bitmap = displayio.Bitmap(display.width, display.heig...
code_fim
hard
{ "lang": "python", "repo": "adafruit/Adafruit_Learning_System_Guides", "path": "/Pi_SSD_Media_Server/display-info.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: adafruit/Adafruit_Learning_System_Guides path: /Pi_SSD_Media_Server/display-info.py # SPDX-FileCopyrightText: 2021 ladyada for Adafruit Industries # SPDX-License-Identifier: MIT import subprocess import board import displayio from adafruit_display_text import label from adafruit_bitmap_font impo...
code_fim
hard
{ "lang": "python", "repo": "adafruit/Adafruit_Learning_System_Guides", "path": "/Pi_SSD_Media_Server/display-info.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: davidagoua/django-angular path: /djng/styling/bootstrap3/widgets.py # -*- coding: utf-8 -*- from __future__ import unicode_literals import warnings from django import VERSION as DJANGO_VERSION from django.utils.html import format_html from django.utils.safestring import mark_safe from django.ut...
code_fim
hard
{ "lang": "python", "repo": "davidagoua/django-angular", "path": "/djng/styling/bootstrap3/widgets.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> def render(self, name=None, value=None, attrs=None, choices=()): label_tag = super(RadioChoiceInput, self).render(name, value, choices) return format_html('<div class="radio">{}</div>', label_tag) def tag(self, attrs=None): attrs = attrs or self.attrs tag_attrs = d...
code_fim
hard
{ "lang": "python", "repo": "davidagoua/django-angular", "path": "/djng/styling/bootstrap3/widgets.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: Cally99/Django-Nuxt-Docker-AWS-Cookiecutter path: /{{cookiecutter.app_name}}/backend/apps/accounts/models.py import uuid from django.contrib.auth.models import AbstractUser from django.db import models <|fim_suffix|>class CustomUser(AbstractUser): uuid = models.UUIDField(default=uuid.uuid4,...
code_fim
easy
{ "lang": "python", "repo": "Cally99/Django-Nuxt-Docker-AWS-Cookiecutter", "path": "/{{cookiecutter.app_name}}/backend/apps/accounts/models.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> uuid = models.UUIDField(default=uuid.uuid4, primary_key=True, unique=True) objects = CustomUserManager() email = models.EmailField(unique=True)<|fim_prefix|># repo: Cally99/Django-Nuxt-Docker-AWS-Cookiecutter path: /{{cookiecutter.app_name}}/backend/apps/accounts/models.py import uuid from d...
code_fim
medium
{ "lang": "python", "repo": "Cally99/Django-Nuxt-Docker-AWS-Cookiecutter", "path": "/{{cookiecutter.app_name}}/backend/apps/accounts/models.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: TrustyJAID/Trusty-cogs path: /runescape/__init__.py import json from pathlib import Path <|fim_suffix|>async def setup(bot): n = Runescape(bot) await bot.add_cog(n)<|fim_middle|>from .runescape import Runescape with open(Path(__file__).parent / "info.json") as fp: __red_end_user_dat...
code_fim
medium
{ "lang": "python", "repo": "TrustyJAID/Trusty-cogs", "path": "/runescape/__init__.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> async def setup(bot): n = Runescape(bot) await bot.add_cog(n)<|fim_prefix|># repo: TrustyJAID/Trusty-cogs path: /runescape/__init__.py import json from pathlib import Path <|fim_middle|>from .runescape import Runescape with open(Path(__file__).parent / "info.json") as fp: __red_end_user_da...
code_fim
medium
{ "lang": "python", "repo": "TrustyJAID/Trusty-cogs", "path": "/runescape/__init__.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|>async def setup(bot): n = Runescape(bot) await bot.add_cog(n)<|fim_prefix|># repo: TrustyJAID/Trusty-cogs path: /runescape/__init__.py import json from pathlib import Path <|fim_middle|>from .runescape import Runescape with open(Path(__file__).parent / "info.json") as fp: __red_end_user_dat...
code_fim
medium
{ "lang": "python", "repo": "TrustyJAID/Trusty-cogs", "path": "/runescape/__init__.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: kehsan/simple-games path: /bblocks.py #!/usr/bin/env python3 # -*- encoding: utf-8 -*- import sys from random import choice as rndchoice from itertools import cycle from time import sleep from utils import Loop, TextInput, range1, first, nl from board import Board, BaseTile, Loc, Dir from avkut...
code_fim
hard
{ "lang": "python", "repo": "kehsan/simple-games", "path": "/bblocks.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> class BlockyBlocks(object): winmsg = "player %s wins!" counter = Loop(range(check_moves)) def __init__(self): self.term = Term() def check_end(self, player): """Check if game is finished.""" if all(tile.player==player for tile in board): board.draw()...
code_fim
hard
{ "lang": "python", "repo": "kehsan/simple-games", "path": "/bblocks.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|>class AtariRescale42x42(gym.ObservationWrapper): def __init__(self, env=None): super(AtariRescale42x42, self).__init__(env) self.observation_space = Box(0.0, 1.0, [42, 42, 1]) def _observation(self, observation): return _process_frame42(observation)<|fim_prefix|># repo: vu...
code_fim
hard
{ "lang": "python", "repo": "vuoristo/simpler-usa", "path": "/envs.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: vuoristo/simpler-usa path: /envs.py import cv2 from gym.spaces.box import Box import numpy as np import gym from gym import spaces import logging import time logger = logging.getLogger(__name__) logger.setLevel(logging.INFO) def create_env(env_id, client_id, remotes, **kwargs): spec = gym.sp...
code_fim
hard
{ "lang": "python", "repo": "vuoristo/simpler-usa", "path": "/envs.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> frame = frame[34:34+160, :160] # Resize by half, then down to 42x42 (essentially mipmapping). If we resize # directly we lose pixels that, when mapped to 42x42, aren't close enough # to the pixel boundary. frame = cv2.resize(frame, (80, 80)) frame = cv2.resize(frame, (42, 42)) ...
code_fim
medium
{ "lang": "python", "repo": "vuoristo/simpler-usa", "path": "/envs.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|>*Etot) N0_mean+=N0*math.exp(-Beta*Etot) E_mean/=Z_btm N0_mean/=Z_btm return [t, Z_btm, E_mean/5, N0_mean/5] t=0.1 while t<=1.0: print(naive_bosons(t)) t+=0.1<|fim_prefix|># repo: chw177/Computational-Stat-Mech path: /Chapter 4/naive-bosons.py import math def ...
code_fim
hard
{ "lang": "python", "repo": "chw177/Computational-Stat-Mech", "path": "/Chapter 4/naive-bosons.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: chw177/Computational-Stat-Mech path: /Chapter 4/naive-bosons.py import math def naive_bosons(t): Beta=1./t E=[0.]*1+[1.]*3+[2.]*6+[3.]*10+[4.]*15 Z_btm=0 E_mean=0 N0_mean=0 for sigma1 in range(35): for sigma2 in range(sigma1, 35): <|fim_suffix|>]+E[sigma4]+E[sig...
code_fim
hard
{ "lang": "python", "repo": "chw177/Computational-Stat-Mech", "path": "/Chapter 4/naive-bosons.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: kneelleenk/AShareData path: /scripts/daily_report.py import datetime as dt import sys import pandas as pd from AShareData import AShareDataReader, IndexHighlighter, major_index_valuation, set_global_config <|fim_suffix|> data_reader = AShareDataReader() model_factor_ret = data_reader.mo...
code_fim
medium
{ "lang": "python", "repo": "kneelleenk/AShareData", "path": "/scripts/daily_report.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> data_reader = AShareDataReader() model_factor_ret = data_reader.model_factor_return.bind_params(ids=['FF3_SMB_DD', 'FF3_HML_DD', 'Carhart_UMD_DD']) date = dt.datetime.combine(dt.date.today(), dt.time()) print(pd.concat([data_reader.market_return.get_data(dates=date), model_factor_ret.get_d...
code_fim
medium
{ "lang": "python", "repo": "kneelleenk/AShareData", "path": "/scripts/daily_report.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> self.page = self.ui.new_ui_page(title="Toggles", prev_text="Back", onprevclick=self.main_menu) self.list = self.page.add_list() self.list.add_item("Lights", chevron=False, toggle=True, ontoggle=functools.partial(self.ontoggle, "lights")) self.list.add_item("TV", chevron=Fal...
code_fim
hard
{ "lang": "python", "repo": "krattai/AEBL", "path": "/blades/piui/piui_demo.py", "mode": "spm", "license": "BSD-2-Clause", "source": "the-stack-v2" }
<|fim_prefix|># repo: krattai/AEBL path: /blades/piui/piui_demo.py import functools import os import random import time from piui import PiUi current_dir = os.path.dirname(os.path.abspath(__file__)) class DemoPiUi(object): def __init__(self): self.title = None self.txt = None self.img =...
code_fim
hard
{ "lang": "python", "repo": "krattai/AEBL", "path": "/blades/piui/piui_demo.py", "mode": "psm", "license": "BSD-2-Clause", "source": "the-stack-v2" }
<|fim_suffix|> def onupclick(self): self.title.set_text("Up ") print "Up" def ondownclick(self): self.title.set_text("Down") print "Down" def onhelloclick(self): print "onstartclick" self.title.set_text("Hello " + self.txt.get_text()) print "Start" ...
code_fim
hard
{ "lang": "python", "repo": "krattai/AEBL", "path": "/blades/piui/piui_demo.py", "mode": "spm", "license": "BSD-2-Clause", "source": "the-stack-v2" }
<|fim_suffix|> csv_file = args.csv_file csv_file_no_extension = os.path.splitext(csv_file)[0] manifest_file = csv_file_no_extension + '.manifest' # Create manifest file if there are no duplicate images. if check_errors(csv_file): print(f"Issues found. Use {csv_file_no...
code_fim
hard
{ "lang": "python", "repo": "awsdocs/aws-doc-sdk-examples", "path": "/python/example_code/lookoutvision/csv_to_manifest.py", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_prefix|># repo: awsdocs/aws-doc-sdk-examples path: /python/example_code/lookoutvision/csv_to_manifest.py # Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. # SPDX-License-Identifier: Apache-2.0 """ Purpose Shows how to create an Amazon Lookout for Vision manifest file from a CSV file. The CSV ...
code_fim
hard
{ "lang": "python", "repo": "awsdocs/aws-doc-sdk-examples", "path": "/python/example_code/lookoutvision/csv_to_manifest.py", "mode": "psm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|> """ Add command line arguments to the parser. :param parser: The command line parser. """ parser.add_argument( "csv_file", help="The CSV file that you want to process." ) parser.add_argument( "--s3_path", help="The Amazon S3 bucket and folder path for the imag...
code_fim
hard
{ "lang": "python", "repo": "awsdocs/aws-doc-sdk-examples", "path": "/python/example_code/lookoutvision/csv_to_manifest.py", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|>def main_loop(): tests = [BitVector(intVal=0, size=32)] while True: print 'Trying with tests: {}'.format(crc32.to_expr(tests)) # Find a candidate program pgm = sat_step(tests) if pgm is None: # Unsat means no program of this length is possible ...
code_fim
hard
{ "lang": "python", "repo": "GaloisInc/pycryptol", "path": "/examples/crc32.py", "mode": "spm", "license": "BSD-3-Clause", "source": "the-stack-v2" }
<|fim_suffix|>crc32 = cryptol.Cryptol().load_module(os.path.abspath('CRC32.cry')) def sat_step(tests): """Find a program that agrees with the oracle for the given tests""" prop = ('\\program -> ' 'compute_program(program:[26][lginsn], ' 'CRC32_oracle, [CRC32_to_state(test) | test <- ? ]...
code_fim
medium
{ "lang": "python", "repo": "GaloisInc/pycryptol", "path": "/examples/crc32.py", "mode": "spm", "license": "BSD-3-Clause", "source": "the-stack-v2" }
<|fim_prefix|># repo: GaloisInc/pycryptol path: /examples/crc32.py """CRC32 Synthesis Example This uses iterative ``sat`` and ``prove`` commands to derive an implementation of CRC32 given a set of possible instructions defined in ``CRC32.cry``. This example shows the flexibility gained when using Python control struc...
code_fim
hard
{ "lang": "python", "repo": "GaloisInc/pycryptol", "path": "/examples/crc32.py", "mode": "psm", "license": "BSD-3-Clause", "source": "the-stack-v2" }
<|fim_prefix|># repo: HelloYeew/rurusetto-django-allauth path: /allauth/socialaccount/providers/osu/urls.py from allauth.socialaccount.providers.oauth2.urls import default_urlpatterns <|fim_suffix|> urlpatterns = default_urlpatterns(OsuProvider)<|fim_middle|>from .provider import OsuProvider
code_fim
easy
{ "lang": "python", "repo": "HelloYeew/rurusetto-django-allauth", "path": "/allauth/socialaccount/providers/osu/urls.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|>urlpatterns = default_urlpatterns(OsuProvider)<|fim_prefix|># repo: HelloYeew/rurusetto-django-allauth path: /allauth/socialaccount/providers/osu/urls.py from allauth.socialaccount.providers.oauth2.urls import default_urlpatterns <|fim_middle|>from .provider import OsuProvider
code_fim
easy
{ "lang": "python", "repo": "HelloYeew/rurusetto-django-allauth", "path": "/allauth/socialaccount/providers/osu/urls.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> urlpatterns = default_urlpatterns(OsuProvider)<|fim_prefix|># repo: HelloYeew/rurusetto-django-allauth path: /allauth/socialaccount/providers/osu/urls.py from allauth.socialaccount.providers.oauth2.urls import default_urlpatterns <|fim_middle|>from .provider import OsuProvider
code_fim
easy
{ "lang": "python", "repo": "HelloYeew/rurusetto-django-allauth", "path": "/allauth/socialaccount/providers/osu/urls.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> def _require_size(name, value, size): if len(value) != size: raise ValueError(f"{name} needs size of {size}") return value class ImageMessage(Message): ''' An image message contains the "blob identifier" to a image resource. ''' type_byte = b'\x02' def __init__(self...
code_fim
hard
{ "lang": "python", "repo": "coffeemakr/python-thr", "path": "/thr/messages.py", "mode": "spm", "license": "Unlicense", "source": "the-stack-v2" }
<|fim_prefix|># repo: coffeemakr/python-thr path: /thr/messages.py import secrets from typing import Optional, Union from pathlib import Path import json from .crypto import SYMMETRIC_KEY_LENGTH def generate_padding(length: Optional[int] = None) -> bytes: ''' Generates a padding with a random length or the s...
code_fim
hard
{ "lang": "python", "repo": "coffeemakr/python-thr", "path": "/thr/messages.py", "mode": "psm", "license": "Unlicense", "source": "the-stack-v2" }
<|fim_prefix|># repo: Saadkhalid913/LinkedListinPython path: /SinglyLinkedList.py ''' Singly linked list and node classes by Saadkhalid913 ''' class node(): ''' node class for implementation purposes ''' def __init__(self, data, next=None): self.data = data self.next = next ...
code_fim
hard
{ "lang": "python", "repo": "Saadkhalid913/LinkedListinPython", "path": "/SinglyLinkedList.py", "mode": "psm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|> while node != None: arr.append(node) node = node.next return list(map(lambda node: node.data, arr)) def reverse(self): prevnode = self.first_node node = prevnode.next while node != None: nex = node.next ...
code_fim
hard
{ "lang": "python", "repo": "Saadkhalid913/LinkedListinPython", "path": "/SinglyLinkedList.py", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|> # Define the edges, the numbers are indices to the vertices above. self.edges = [ # Back (0, 1), (1, 2), (2, 3), (3, 0), # Front (5, 4), (4, 7), (7, 6), (6, 5), ...
code_fim
hard
{ "lang": "python", "repo": "niyaziC52/uPy_Course", "path": "/Level1_032021/samples/OLED_3dcube.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: niyaziC52/uPy_Course path: /Level1_032021/samples/OLED_3dcube.py # SOURCE: https://www.mfitzp.com/article/3d-rotating-cube-micropython-oled/ from machine import I2C, Pin import ssd1306 import math i2c = I2C(scl=Pin(18), sda=Pin(19), freq=400000) display=ssd1306.SSD1306_I2C(128,64,i2c) class Poi...
code_fim
hard
{ "lang": "python", "repo": "niyaziC52/uPy_Course", "path": "/Level1_032021/samples/OLED_3dcube.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|>def create_game(name, id, gamemode): id = UUID(id) game = Assassins(name, id) games[id] = game def destroy_game(id): del games[id]<|fim_prefix|># repo: Celdir/Reactive path: /game/reactive.py import requests from classes import Game, User from json import loads from assassins import Assa...
code_fim
hard
{ "lang": "python", "repo": "Celdir/Reactive", "path": "/game/reactive.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: Celdir/Reactive path: /game/reactive.py import requests from classes import Game, User from json import loads from assassins import Assassins from uuid import UUID LB_SERVER = "http://aws1.bitwisehero.com/" # map from ID to Game games = {} def load_user(username): url = LB_SERVER + "get_us...
code_fim
hard
{ "lang": "python", "repo": "Celdir/Reactive", "path": "/game/reactive.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|>tory from which you want to convert annotations outputDirectory = './output' # Directory where Yolo annotation output will be saved ) # ==============================================================================<|fim_prefix|># repo: edowson/bounding-box-annotation-tool path: /config.py # ========...
code_fim
hard
{ "lang": "python", "repo": "edowson/bounding-box-annotation-tool", "path": "/config.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: edowson/bounding-box-annotation-tool path: /config.py # ============================== Config ======================================== PARAMS = dict( imageFormat = 'JPG', # Specify Image format [JPG / JPEG / PNG ], Default will be taken as JPG sourc<|fim_suffix|>tory from ...
code_fim
hard
{ "lang": "python", "repo": "edowson/bounding-box-annotation-tool", "path": "/config.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: martincss/first-captioning path: /preprocess_encode_images.py import tensorflow as tf import numpy as np import json from tqdm import tqdm from config import DATASET_NAME, DIRECTORIES, CNN_ENCODER from params import CACHE_FEATURES_BATCH_SIZE from utils import enable_gpu_memory_growth from coco...
code_fim
hard
{ "lang": "python", "repo": "martincss/first-captioning", "path": "/preprocess_encode_images.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> if __name__ == '__main__': enable_gpu_memory_growth() if DATASET_NAME == 'COCO': print('Now caching image features for COCO train') _, img_paths_train = image_fnames_captions( DIRECTORIES['ANNOTATIONS_TRAIN'], ...
code_fim
hard
{ "lang": "python", "repo": "martincss/first-captioning", "path": "/preprocess_encode_images.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: strigazi/athena path: /InnerDetector/InDetDetDescr/SCT_GeoModel/python/SCT_GeoModelConfig.py # Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration from AthenaConfiguration.ComponentFactory import CompFactory from IOVDbSvc.IOVDbSvcConfig import addFoldersSplitOnline def SCT_G...
code_fim
hard
{ "lang": "python", "repo": "strigazi/athena", "path": "/InnerDetector/InDetDetDescr/SCT_GeoModel/python/SCT_GeoModelConfig.py", "mode": "psm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|>lags.Detector.OverlaySCT: SCT_AlignCondAlg=CompFactory.SCT_AlignCondAlg sctAlignCondAlg = SCT_AlignCondAlg(name = "SCT_AlignCondAlg", UseDynamicAlignFolders = flags.GeoModel.Align.Dynamic) acc.addCondAlgo(sctAlignCondAlg) ...
code_fim
hard
{ "lang": "python", "repo": "strigazi/athena", "path": "/InnerDetector/InDetDetDescr/SCT_GeoModel/python/SCT_GeoModelConfig.py", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|> 1. Associates Config classes with type_hint, plugin, and upgrader, which is necessary for polymorphic deserialization. See build_config() for more details. 2. Adds a constant `type_hint` field to the Config which is set to type_hint. Args: type_hint (str): a ...
code_fim
hard
{ "lang": "python", "repo": "azavea/raster-vision", "path": "/rastervision_pipeline/rastervision/pipeline/config.py", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|> Adapted from: https://github.com/samuelcolvin/pydantic/issues/1864#issuecomment-679044432 """ *_, validation_error = validate_model(self.__class__, self.__dict__) if validation_error: raise validation_error self.validate_config() def recursi...
code_fim
hard
{ "lang": "python", "repo": "azavea/raster-vision", "path": "/rastervision_pipeline/rastervision/pipeline/config.py", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_prefix|># repo: azavea/raster-vision path: /rastervision_pipeline/rastervision/pipeline/config.py from typing import List, Type, Union, Optional, Callable, Dict, TYPE_CHECKING import inspect from pydantic import ( # noqa BaseModel, create_model, Field, root_validator, validate_model, ValidationError, v...
code_fim
hard
{ "lang": "python", "repo": "azavea/raster-vision", "path": "/rastervision_pipeline/rastervision/pipeline/config.py", "mode": "psm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_prefix|># repo: splunk/splunk-sdk-python path: /tests/searchcommands/test_reporting_command.py import io import splunklib.searchcommands as searchcommands from . import chunked_data_stream as chunky def test_simple_reporting_command(): <|fim_suffix|> cmd = TestReportingCommand() ifile = io.BytesIO() ...
code_fim
hard
{ "lang": "python", "repo": "splunk/splunk-sdk-python", "path": "/tests/searchcommands/test_reporting_command.py", "mode": "psm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|> cmd = TestReportingCommand() ifile = io.BytesIO() data = list() for i in range(0, 10): data.append({"value": str(i)}) ifile.write(chunky.build_getinfo_chunk()) ifile.write(chunky.build_data_chunk(data)) ifile.seek(0) ofile = io.BytesIO() cmd._process_protocol_v2...
code_fim
hard
{ "lang": "python", "repo": "splunk/splunk-sdk-python", "path": "/tests/searchcommands/test_reporting_command.py", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_prefix|># repo: theotherphp/relay path: /relay_config.py """ Configure global stuff like hostname and port """ class Config(object): @property def app_host(self): return 'localhost' @property def app_port(self): <|fim_suffix|> return 'teams' def rest_url(self, api): ...
code_fim
hard
{ "lang": "python", "repo": "theotherphp/relay", "path": "/relay_config.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> @property def db_host(self): return 'localhost' @property def db_port(self): return '28015' @property def db_name(self): return 'relay' @property def walker_table(self): return 'walkers' @property def team_table(self): ret...
code_fim
medium
{ "lang": "python", "repo": "theotherphp/relay", "path": "/relay_config.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> def getCorrelation(self): coeff = np.corrcoef(self.data[-2].getData(), self.data[-1].getData()) assert(int(coeff[0][1]*1000) == int(coeff[1][0]*1000)) return coeff[0][1] def plot(self): fig, ax = plt.subplots(self.count, 2) for i in range(self.count): self.data[i]._plot(ax[i][0], ax[i][1]...
code_fim
hard
{ "lang": "python", "repo": "capstone-2019/capstone", "path": "/visualizer/circuitSimulatorResults.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> for i in range(self.count): self.data[i]._plotSignal(ax[i]) plt.show() def plotFft(self): fig, ax = plt.subplots(self.count) for i in range(self.count): self.data[i]._plotFft(ax[i]) plt.show() def getCorrelation(self): coeff = np.corrcoef(self.data[-2].getData(), self.data[-1].getDat...
code_fim
medium
{ "lang": "python", "repo": "capstone-2019/capstone", "path": "/visualizer/circuitSimulatorResults.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: capstone-2019/capstone path: /visualizer/circuitSimulatorResults.py import numpy as np import matplotlib.pyplot as plt from circuitSimulatorOutput import CircuitSimulatorOutput class CircuitSimulatorResults(CircuitSimulatorOutput): <|fim_suffix|> fig, ax = plt.subplots(self.count) for i in r...
code_fim
hard
{ "lang": "python", "repo": "capstone-2019/capstone", "path": "/visualizer/circuitSimulatorResults.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: NiftyR/FiveM-Discord-Bot path: /status.py ####################################### ####################################### ################ ABOUT ################ ####################################### ####################################### # GITHUB REPO: https://github.com/jcfoxtrot54/FiveM-Di...
code_fim
hard
{ "lang": "python", "repo": "NiftyR/FiveM-Discord-Bot", "path": "/status.py", "mode": "psm", "license": "Unlicense", "source": "the-stack-v2" }
<|fim_suffix|>####################################### ####################################### ######## DON'T EDIT BELOW HERE ######## ####################################### ####################################### try: import discord # import discord library import requests # import requests library import json # i...
code_fim
hard
{ "lang": "python", "repo": "NiftyR/FiveM-Discord-Bot", "path": "/status.py", "mode": "spm", "license": "Unlicense", "source": "the-stack-v2" }
<|fim_suffix|>def get_parser(): return GooeyParser(prog="example_progress_bar_1") if __name__ == '__main__': main()<|fim_prefix|># repo: neuroradiology/Gooey path: /gooey/tests/integration/programs/auto_start.py import sys from gooey import Gooey from gooey import GooeyParser from argparse import Arg...
code_fim
hard
{ "lang": "python", "repo": "neuroradiology/Gooey", "path": "/gooey/tests/integration/programs/auto_start.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> return GooeyParser(prog="example_progress_bar_1") if __name__ == '__main__': main()<|fim_prefix|># repo: neuroradiology/Gooey path: /gooey/tests/integration/programs/auto_start.py import sys from gooey import Gooey from gooey import GooeyParser from argparse import ArgumentParser @Goo...
code_fim
medium
{ "lang": "python", "repo": "neuroradiology/Gooey", "path": "/gooey/tests/integration/programs/auto_start.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: neuroradiology/Gooey path: /gooey/tests/integration/programs/auto_start.py import sys from gooey import Gooey from gooey import GooeyParser from argparse import ArgumentParser @Gooey( progress_regex=r"^progress: (-?\d+)%$", disable_progress_bar_animation=True, dump_build_co...
code_fim
medium
{ "lang": "python", "repo": "neuroradiology/Gooey", "path": "/gooey/tests/integration/programs/auto_start.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|>DOMAIN = "schlage" LOGGER = logging.getLogger(__package__) MANUFACTURER = "Schlage" UPDATE_INTERVAL = timedelta(seconds=30)<|fim_prefix|># repo: home-assistant/core path: /homeassistant/components/schlage/const.py """Constants for the Schlage integration.""" <|fim_middle|>from datetime import timedelta ...
code_fim
easy
{ "lang": "python", "repo": "home-assistant/core", "path": "/homeassistant/components/schlage/const.py", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_prefix|># repo: home-assistant/core path: /homeassistant/components/schlage/const.py """Constants for the Schlage integration.""" <|fim_suffix|>DOMAIN = "schlage" LOGGER = logging.getLogger(__package__) MANUFACTURER = "Schlage" UPDATE_INTERVAL = timedelta(seconds=30)<|fim_middle|>from datetime import timedelta ...
code_fim
easy
{ "lang": "python", "repo": "home-assistant/core", "path": "/homeassistant/components/schlage/const.py", "mode": "psm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|> (r'^traffic_log/', include('traffic_log.urls')), ('^common/', include('common.urls')), ('^jobs/', include('jobs.urls')), ('^errors/', include('errors.urls')), # Facebook app. ('^fbapp/', include('fbapp.urls')), (r'^m', 'landing_page.views.go_mobile'), ('^_ah/warmup/?'...
code_fim
hard
{ "lang": "python", "repo": "chirpradio/chirpradio", "path": "/urls.py", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_prefix|># repo: chirpradio/chirpradio path: /urls.py # Copyright 2008 Google Inc. # Copyright 2009 The Chicago Independent Radio Project # # 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": "chirpradio/chirpradio", "path": "/urls.py", "mode": "psm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_prefix|># repo: bidivermaak/Advanced-Python-Programming-Second-Edition path: /Chapter07/example5.py import time class Timer: def __init__(self, timeout): <|fim_suffix|> while True: if timer.done(): print("Timer is done!") break<|fim_middle|> self.timeout = timeout ...
code_fim
medium
{ "lang": "python", "repo": "bidivermaak/Advanced-Python-Programming-Second-Edition", "path": "/Chapter07/example5.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> if __name__ == "__main__": timer = Timer(1.0) while True: if timer.done(): print("Timer is done!") break<|fim_prefix|># repo: bidivermaak/Advanced-Python-Programming-Second-Edition path: /Chapter07/example5.py import time class Timer: def __init__(self, tim...
code_fim
medium
{ "lang": "python", "repo": "bidivermaak/Advanced-Python-Programming-Second-Edition", "path": "/Chapter07/example5.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: EconForge/interpolation.py path: /misc/speed_comparison_cuda.py from interpolation.splines.eval_cubic_numba import vec_eval_cubic_spline_3 from interpolation.splines.filter_cubic import filter_coeffs from interpolation.splines.multilinear_numba import multilinear_interpolation from interpolation...
code_fim
hard
{ "lang": "python", "repo": "EconForge/interpolation.py", "path": "/misc/speed_comparison_cuda.py", "mode": "psm", "license": "BSD-2-Clause", "source": "the-stack-v2" }
<|fim_suffix|># warmup res_cuda = numpy.zeros_like(res) jitted[(N, 1)](a, b, orders, C, X, res_cuda, Ad, dAd) cuda.synchronize() t4 = time.time() d_a = cuda.to_device(a) d_b = cuda.to_device(b) d_orders = cuda.to_device(orders) d_C = cuda.to_device(C) d_Ad = cuda.to_device(Ad) d_dAd = cuda.to_device(dAd) d_X = cuda.t...
code_fim
hard
{ "lang": "python", "repo": "EconForge/interpolation.py", "path": "/misc/speed_comparison_cuda.py", "mode": "spm", "license": "BSD-2-Clause", "source": "the-stack-v2" }
<|fim_prefix|># repo: chrisrgunn/cs156project path: /PEAK-0.5a4dev_r2085/src/peak/storage/api.py from interfaces import * from transactions import * from data_managers import * from connections import * from caches import * from lazy_loader import * from peak.util.imports import lazyModule xmi = lazyModule('peak.sto...
code_fim
easy
{ "lang": "python", "repo": "chrisrgunn/cs156project", "path": "/PEAK-0.5a4dev_r2085/src/peak/storage/api.py", "mode": "psm", "license": "Python-2.0", "source": "the-stack-v2" }
<|fim_suffix|> from peak.api import config return config.ProviderOf(IDataManager,*classes)<|fim_prefix|># repo: chrisrgunn/cs156project path: /PEAK-0.5a4dev_r2085/src/peak/storage/api.py from interfaces import * from transactions import * from data_managers import * from connections import * from caches import ...
code_fim
easy
{ "lang": "python", "repo": "chrisrgunn/cs156project", "path": "/PEAK-0.5a4dev_r2085/src/peak/storage/api.py", "mode": "spm", "license": "Python-2.0", "source": "the-stack-v2" }
<|fim_suffix|>print("loading images...") Images = loadBatch(imagePaths) print("loading SVM model...") clf = joblib.load(svmPath); print("Extracting features, this may take a while for large collections of images...") # should probably use batches for this as well extractor = FeatureExtractor() features = extracto...
code_fim
hard
{ "lang": "python", "repo": "aymen-mouelhi/glyphreader", "path": "/src/classify.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: aymen-mouelhi/glyphreader path: /src/classify.py #!/usr/bin/python3 ''' Created on 7 Jan 2017 @author: Morris Franken Classifies an image or a set of images inside a directory ''' import numpy as np import os import sys from sklearn.externals import joblib from os.path import join, isdir, isfi...
code_fim
hard
{ "lang": "python", "repo": "aymen-mouelhi/glyphreader", "path": "/src/classify.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|># ------------------- Joined Disk ------------------- class JoinedWheel(cqparts.Part): # Parameters l_radius = PositiveFloat(100, doc="left wheel's radius") l_width = PositiveFloat(10, doc="left wheel's radius") r_radius = PositiveFloat(100, doc="right wheel's radius") r_width = Posit...
code_fim
hard
{ "lang": "python", "repo": "jmwright/cqparts", "path": "/docs/doc/_static/iframes/parts/generate.py", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|>from cqparts.display import render_props, display class Box(cqparts.Part): _render = render_props(template='red', alpha=0.2) def make(self): return cadquery.Workplane('XY').box(10,10,10) red_box = Box() # ------------------- Export ------------------- from cqparts.display import get_di...
code_fim
hard
{ "lang": "python", "repo": "jmwright/cqparts", "path": "/docs/doc/_static/iframes/parts/generate.py", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_prefix|># repo: jmwright/cqparts path: /docs/doc/_static/iframes/parts/generate.py #!/usr/bin/env python # The code here should be representative of that in: # https://cqparts.github.io/cqparts/doc/tutorials/assembly.html # ------------------- Box ------------------- import cadquery import cqparts from cqp...
code_fim
hard
{ "lang": "python", "repo": "jmwright/cqparts", "path": "/docs/doc/_static/iframes/parts/generate.py", "mode": "psm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_prefix|># repo: dmonroy/spa path: /spa/middlewares.py from spa import gzip_util COMPRESSABLE_MIMETYPES = ( 'text/plain', 'text/html', 'text/css', 'application/json', 'application/javascript', 'application/x-javascript', 'text/xml', 'application/xml', 'application/xml+rss', ...
code_fim
hard
{ "lang": "python", "repo": "dmonroy/spa", "path": "/spa/middlewares.py", "mode": "psm", "license": "BSD-3-Clause", "source": "the-stack-v2" }
<|fim_suffix|> data = self.app(environ, _start_response) if buffer['status'].startswith('200 ') and buffer['to_gzip']: data = gzip_util.compress(data, self.compress_level) headers = buffer['headers'] headers.append(('Content-Encoding', 'gzip')) headers.appe...
code_fim
hard
{ "lang": "python", "repo": "dmonroy/spa", "path": "/spa/middlewares.py", "mode": "spm", "license": "BSD-3-Clause", "source": "the-stack-v2" }
<|fim_prefix|># repo: philippkraft/decomp path: /examples/multi_layer_cmf.py """ An example with multiple decomp layers, connected with water flux modelled with CMF requires: cmf """ import cmf from decomp.cmfconnector import CmfConnector import datetime import numpy as np import xarray as xr class MultiLayerDECOM...
code_fim
hard
{ "lang": "python", "repo": "philippkraft/decomp", "path": "/examples/multi_layer_cmf.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> """ Plots the result dataset :param a: The result xarray.Dataset :return: """ import matplotlib.pyplot as plt fig, axes = plt.subplots(nrows=len(a.data_vars), sharex='all', sharey='all') for ax, var in zip(axes, a.data_vars): data...
code_fim
hard
{ "lang": "python", "repo": "philippkraft/decomp", "path": "/examples/multi_layer_cmf.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: yangzhou6666/CONTA path: /pseudo_mask/prepare_food103.py import os import json import argparse import numpy as np def process_images(data_path, split_rate=0.9): '''Convert image information into json files''' label_dict = {} with open(os.path.join(data_path, "label.txt"), 'r') as f:...
code_fim
hard
{ "lang": "python", "repo": "yangzhou6666/CONTA", "path": "/pseudo_mask/prepare_food103.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> if __name__ == "__main__": parser = argparse.ArgumentParser() # Usage: --data_path /your/dataset/path/VOCdevkit parser.add_argument("--data_path", default="data/food_public/", type=str, help="The path of Food 103 dataset") args = parser.parse_args() if not os.path.exists("data/food10...
code_fim
hard
{ "lang": "python", "repo": "yangzhou6666/CONTA", "path": "/pseudo_mask/prepare_food103.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|># Add bounding boxes attrib = {"layer": "BBOX"} boxes = [] # The "primitive" representation for TEXT entities is the bounding box: for prim in disassemble.to_primitives(text_entities): p = msp.add_lwpolyline(prim.vertices(), dxfattribs=attrib) boxes.append(p) # Zoom on bounding boxes (fast): zoo...
code_fim
hard
{ "lang": "python", "repo": "triroakenshield/ezdxf", "path": "/examples/addons/text_to_virtual_entities.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|># The "primitive" representation for TEXT entities is the bounding box: for prim in disassemble.to_primitives(text_entities): p = msp.add_lwpolyline(prim.vertices(), dxfattribs=attrib) boxes.append(p) # Zoom on bounding boxes (fast): zoom.objects(msp, boxes, factor=1.1) doc.saveas(OUTBOX / FILE)<...
code_fim
hard
{ "lang": "python", "repo": "triroakenshield/ezdxf", "path": "/examples/addons/text_to_virtual_entities.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: triroakenshield/ezdxf path: /examples/addons/text_to_virtual_entities.py # Copyright (c) 2021, Manfred Moitzi # License: MIT License from pathlib import Path import ezdxf from ezdxf.addons import text2path from ezdxf import zoom, disassemble from ezdxf.lldxf import const EXAMPLES = Path(__file__...
code_fim
hard
{ "lang": "python", "repo": "triroakenshield/ezdxf", "path": "/examples/addons/text_to_virtual_entities.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: dereyly/mmdet_sota path: /mmdet/models/losses/gaussian_focal_loss.py import torch.nn as nn from ..builder import LOSSES from .utils import weighted_loss @weighted_loss def gaussian_focal_loss(pred, gaussian_target, alpha=2.0, gamma=4.0): eps = 1e-12 pos_weights = gaussian_target.eq(1) ...
code_fim
hard
{ "lang": "python", "repo": "dereyly/mmdet_sota", "path": "/mmdet/models/losses/gaussian_focal_loss.py", "mode": "psm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|> def forward(self, pred, target, weight=None, avg_factor=None, reduction_override=None): assert reduction_override in (None, 'none', 'mean', 'sum') reduction = ( reduction_override if reduction_o...
code_fim
hard
{ "lang": "python", "repo": "dereyly/mmdet_sota", "path": "/mmdet/models/losses/gaussian_focal_loss.py", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|> def equals(self, __a0: object) -> bool: ... def getClass(self) -> java.lang.Class: ... def getDescription(self) -> unicode: ... def getName(self) -> unicode: ... def getValue(self, settings: ghidra.docking.settings.Settings) -> bool: ... def hasValue(self, settings: ghidra.do...
code_fim
hard
{ "lang": "python", "repo": "kohnakagawa/ghidra_scripts", "path": "/ghidra9.2.1_pyi/ghidra/util/table/field/FunctionThunkSettingsDefinition.pyi", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: kohnakagawa/ghidra_scripts path: /ghidra9.2.1_pyi/ghidra/util/table/field/FunctionThunkSettingsDefinition.pyi from typing import List import ghidra.docking.settings import java.lang class FunctionThunkSettingsDefinition(object, ghidra.docking.settings.BooleanSettingsDefinition): DEF: ghidra...
code_fim
medium
{ "lang": "python", "repo": "kohnakagawa/ghidra_scripts", "path": "/ghidra9.2.1_pyi/ghidra/util/table/field/FunctionThunkSettingsDefinition.pyi", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> def equals(self, __a0: object) -> bool: ... def getClass(self) -> java.lang.Class: ... def getDescription(self) -> unicode: ... def getName(self) -> unicode: ... def getValue(self, settings: ghidra.docking.settings.Settings) -> bool: ... def hasValue(self, settings: ghidra.doc...
code_fim
hard
{ "lang": "python", "repo": "kohnakagawa/ghidra_scripts", "path": "/ghidra9.2.1_pyi/ghidra/util/table/field/FunctionThunkSettingsDefinition.pyi", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: Gandabh/E-commerce-Site path: /account/users/pipeline.py def update_user_social_data(strategy, *args, **kwargs): response = kwargs['response'] backend = kwargs['backend'] user = kwargs['user'] user_id = response.get('id') picture = response.get('picture<|fim_suffix|>dth=600&he...
code_fim
medium
{ "lang": "python", "repo": "Gandabh/E-commerce-Site", "path": "/account/users/pipeline.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|>dth=600&height=600' user.image = picture_data else: user.image = picture user.save()<|fim_prefix|># repo: Gandabh/E-commerce-Site path: /account/users/pipeline.py def update_user_social_data(strategy, *args, **kwargs): response = kwargs['response'] backend = kwargs['backen...
code_fim
medium
{ "lang": "python", "repo": "Gandabh/E-commerce-Site", "path": "/account/users/pipeline.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: songxiaoyuan/leetcode path: /python/kmp.py def getNext(s): ret =[0]*(len(s)+1) j = 0 for x in xrange(1,len(s)): while j>0 and s[j] != s[x]: j = ret[j] if s[j] == s[x]: j+=1 ret[x+1] = j return ret def findLength(target,find,next): <...
code_fim
hard
{ "lang": "python", "repo": "songxiaoyuan/leetcode", "path": "/python/kmp.py", "mode": "psm", "license": "BSD-3-Clause", "source": "the-stack-v2" }
<|fim_suffix|> """ :type A: List[int] :type B: List[int] :rtype: int """ j = 0 for x in xrange(0,len(target)): while j>0 and target[x] != find[j]: j = next[j] if target[x] == find[j]: j+=1 if j == len(find): return x-j+1 return -...
code_fim
medium
{ "lang": "python", "repo": "songxiaoyuan/leetcode", "path": "/python/kmp.py", "mode": "spm", "license": "BSD-3-Clause", "source": "the-stack-v2" }
<|fim_prefix|># repo: commandlinegirl/hail path: /query/test/test_query.py import pytest import hail as hl from hailtop.hailctl.dev.query import cli def test_simple_table(): t = hl.utils.range_table(50, 3) t = t.filter((t.idx % 3 == 0) | ((t.idx / 7) % 3 == 0)) n = t.count() print(f'n {n}') assert...
code_fim
hard
{ "lang": "python", "repo": "commandlinegirl/hail", "path": "/query/test/test_query.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> if test_value is not None: old = await client.set_flag(test_flag, test_value) assert old is None flags, invalid = await client.get_flag(["invalid"]) assert invalid == ["'invalid'"] assert flags == {}<|fim_prefix|># repo: commandlinegirl/...
code_fim
hard
{ "lang": "python", "repo": "commandlinegirl/hail", "path": "/query/test/test_query.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|>class UserRejectedKey(Exception): """ The user interactively rejected a key. """ class InvalidEntry(Exception): """ An entry in a known_hosts file could not be interpreted as a valid entry. """ class HostKeyChanged(Exception): """ The host key of a remote host has cha...
code_fim
hard
{ "lang": "python", "repo": "civascu/hue", "path": "/desktop/core/ext-py/Twisted/twisted/conch/error.py", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_prefix|># repo: civascu/hue path: /desktop/core/ext-py/Twisted/twisted/conch/error.py # Copyright (c) 2001-2008 Twisted Matrix Laboratories. # See LICENSE for details. """ An error to represent bad things happening in Conch. Maintainer: Paul Swartz """ class ConchError(Exception): def __init__(self, valu...
code_fim
hard
{ "lang": "python", "repo": "civascu/hue", "path": "/desktop/core/ext-py/Twisted/twisted/conch/error.py", "mode": "psm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|> @ivar lineno: The line number of the offending entry in the given path. @type lineno: L{int} """ def __init__(self, offendingEntry, path, lineno): Exception.__init__(self) self.offendingEntry = offendingEntry self.path = path self.lineno = lineno<|fim_prefi...
code_fim
hard
{ "lang": "python", "repo": "civascu/hue", "path": "/desktop/core/ext-py/Twisted/twisted/conch/error.py", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|> def test_winning_numbers(lotteryround): r = lottery.winning_numbers(lotteryround) assert r def test_ticket_winnings(lotteryround, ticketid): r = lottery.ticket_winnings(lotteryround, ticketid) assert r def test_address_winnings(address, lotteryround): r = lottery.address_winnings(...
code_fim
hard
{ "lang": "python", "repo": "asmitbhantana/pancakeswap-lottery", "path": "/tests/test_lotteryv2.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: asmitbhantana/pancakeswap-lottery path: /tests/test_lotteryv2.py import pytest from pancakeswap_lottery import LotteryV2 lottery = LotteryV2() @pytest.fixture def ticketid(): return 158408 @pytest.fixture def lotteryround(): return 10 <|fim_suffix|> r = lottery.prize_pool() ...
code_fim
hard
{ "lang": "python", "repo": "asmitbhantana/pancakeswap-lottery", "path": "/tests/test_lotteryv2.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }