text
stringlengths
232
16.3k
domain
stringclasses
1 value
difficulty
stringclasses
3 values
meta
dict
<|fim_suffix|># Pull in the declared identifiers code_all = (set(phonenumbers.__all__) | set(phonenumbers.geocoder.__all__) | set(phonenumbers.carrier.__all__) | set(phonenumbers.timezone.__all__)) # Compare code_not_grepped = (code_all - grepped_all) grepped_not_code = (grepped_all...
code_fim
hard
{ "lang": "python", "repo": "daviddrysdale/python-phonenumbers", "path": "/tools/python/allcheck.py", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|># creating buttons, images etc testImage = Image.open("void.jpg") testImage = testImage.resize((1280, 720)) analysisImg = ImageTk.PhotoImage(Image.open("analysis.png").resize((24, 24))) bgImage = ImageTk.PhotoImage(testImage) bgLabel = Label(root, image=bgImage) font = fonts.Font(family="ComicSansMS...
code_fim
hard
{ "lang": "python", "repo": "Jatin020403/Space-Defence", "path": "/endMenu.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: Jatin020403/Space-Defence path: /endMenu.py import pickle from tkinter import * from PIL import ImageTk, Image import tkinter.font as fonts from tkinter import messagebox import os # initialise root = Tk() root.title("Space Defence") root.iconbitmap("game_icon.ico") root.wm_geometry("...
code_fim
hard
{ "lang": "python", "repo": "Jatin020403/Space-Defence", "path": "/endMenu.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> if len(self.line) > 1: for robot in self.line: robot.get_neighbors(self.line) self.line = robot.move_neighbors(self.line) def display(self): if self.line: for index, robot in enumerate(self.line): if index == len(...
code_fim
hard
{ "lang": "python", "repo": "sbitters/robots", "path": "/package/line.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: sbitters/robots path: /package/line.py #!/usr/bin/env python3 # -*- coding: utf-8 -*- # # 2018-08-14 # STB # from random import randint from package import Robot class Line(): def __init__(self, rule): self.line = [] self.rule = rule def add_robot(self): <|fim_suffi...
code_fim
hard
{ "lang": "python", "repo": "sbitters/robots", "path": "/package/line.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: ngocbh/stavia path: /stavia/log_linear_model.py from __future__ import absolute_import from .feature_set import FeatureSet from scipy.optimize import fmin_l_bfgs_b from math import exp, log from sklearn.model_selection import train_test_split from .utils.parameters import * from .utils.utils i...
code_fim
hard
{ "lang": "python", "repo": "ngocbh/stavia", "path": "/stavia/log_linear_model.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> max_acc = 0 self.lambda_reg = -1 for lambda_reg in self.lambda_regs: self.params = self.__estimate_parameters(X_train, y_train, lambda_reg, self.mini_num_iter, verbose = verbose) acc = self.score(X_dev, y_dev) if acc > max_acc: max_acc = acc self.lambda_reg = lambda_reg print('te...
code_fim
hard
{ "lang": "python", "repo": "ngocbh/stavia", "path": "/stavia/log_linear_model.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: boklm/tbb-testsuite path: /marionette/tor_browser_tests/test_slider_settings.py from marionette_harness import MarionetteTestCase import testsuite class Test(MarionetteTestCase): def setUp(self): MarionetteTestCase.setUp(self) ts = testsuite.TestSuite() self.ts = ts...
code_fim
hard
{ "lang": "python", "repo": "boklm/tbb-testsuite", "path": "/marionette/tor_browser_tests/test_slider_settings.py", "mode": "psm", "license": "CC0-1.0", "source": "the-stack-v2" }
<|fim_suffix|> with self.marionette.using_context('content'): self.marionette.navigate('about:robots') slider_mode = int(self.ts.t['test']['slider_mode']) self.assertEqual(slider_mode, self.marionette.get_pref('extensions.torbutton.security_slider'), ...
code_fim
hard
{ "lang": "python", "repo": "boklm/tbb-testsuite", "path": "/marionette/tor_browser_tests/test_slider_settings.py", "mode": "spm", "license": "CC0-1.0", "source": "the-stack-v2" }
<|fim_suffix|> msg = InvalidPermissionsMessage() msg.message = json_dict['message'] return msg<|fim_prefix|># repo: zadjii/nebula path: /messages/InvalidPermissionsMessage.py # last generated 2016-08-30 02:47:27.049000 from messages import BaseMessage from msg_codes import INVALID_PERMISSIONS as...
code_fim
medium
{ "lang": "python", "repo": "zadjii/nebula", "path": "/messages/InvalidPermissionsMessage.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: zadjii/nebula path: /messages/InvalidPermissionsMessage.py # last generated 2016-08-30 02:47:27.049000 from messages import BaseMessage from msg_codes import INVALID_PERMISSIONS as INVALID_PERMISSIONS __author__ = 'Mike' <|fim_suffix|> @staticmethod def deserialize(json_dict): msg...
code_fim
hard
{ "lang": "python", "repo": "zadjii/nebula", "path": "/messages/InvalidPermissionsMessage.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> super(InvalidPermissionsMessage, self).__init__() self.type = INVALID_PERMISSIONS self.message = message @staticmethod def deserialize(json_dict): msg = InvalidPermissionsMessage() msg.message = json_dict['message'] return msg<|fim_prefix|># repo: z...
code_fim
medium
{ "lang": "python", "repo": "zadjii/nebula", "path": "/messages/InvalidPermissionsMessage.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> return df def inner_processing_stock_data(symbol, input_data, window, day_selection, week_selection, month_selection): # start_date = pd.Timestamp(paras.start_date) # end_date = pd.Timestamp(paras.end_date) # input_data = input_data.loc[(input_data.index >= start_date) & (input_data.ind...
code_fim
hard
{ "lang": "python", "repo": "doncat99/StockRecommendSystem", "path": "/Source/StockProcessing/Filter_Stock_CHN_1.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> years = [2016, 2015, 2014] main_symbols = [] grow_symbols = [] if os.path.exists("year_2016.csv") == False: df_main = ts.get_report_data(2016, 4) mainData = pd.DataFrame(df_main) mainData.to_csv("year_2016.csv") if os.path.exists("grow_2016.csv") == False: ...
code_fim
hard
{ "lang": "python", "repo": "doncat99/StockRecommendSystem", "path": "/Source/StockProcessing/Filter_Stock_CHN_1.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: doncat99/StockRecommendSystem path: /Source/StockProcessing/Filter_Stock_CHN_1.py import sys, os, time, datetime, warnings, configparser import pandas as pd import numpy as np import talib import concurrent.futures import tushare as ts import matplotlib.pyplot as plt from stockstats import StockD...
code_fim
hard
{ "lang": "python", "repo": "doncat99/StockRecommendSystem", "path": "/Source/StockProcessing/Filter_Stock_CHN_1.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> for event in pygame.event.get(): if event.type == pygame.QUIT: self.done = True self.button.check_event(event) def main_loop(self): while not self.done: self.event_loop() self.screen.fill(self.color) self.butt...
code_fim
medium
{ "lang": "python", "repo": "stivosaurus/rpi-snippets", "path": "/reference_scripts/button_class.py", "mode": "spm", "license": "Unlicense", "source": "the-stack-v2" }
<|fim_suffix|> def __init__(self): self.screen = pygame.display.set_mode((500,500)) self.screen_rect = self.screen.get_rect() self.clock = pygame.time.Clock() self.done = False self.fps = 60.0 self.color = WHITE message = "Change the screen color." self...
code_fim
medium
{ "lang": "python", "repo": "stivosaurus/rpi-snippets", "path": "/reference_scripts/button_class.py", "mode": "spm", "license": "Unlicense", "source": "the-stack-v2" }
<|fim_prefix|># repo: stivosaurus/rpi-snippets path: /reference_scripts/button_class.py import os import sys import random import pygame as pygame from button import Button os.environ["SDL_VIDEO_CENTERED"] = '0' pygame.init() RED = (255,0,0) BLUE = (0,0,255) GREEN = (0,255,0) BLACK = (0,0,0) WHITE = (255,255,255)...
code_fim
hard
{ "lang": "python", "repo": "stivosaurus/rpi-snippets", "path": "/reference_scripts/button_class.py", "mode": "psm", "license": "Unlicense", "source": "the-stack-v2" }
<|fim_prefix|># repo: tungstenfabric/tf-controller path: /src/config/common/cfgm_common/datastore/api.py import abc import collections import copy import cProfile import functools import os import six from cfgm_common.datastore.keyspace import ConfigKeyspaceMap from sandesh_common.vns import constants as vns_constant...
code_fim
hard
{ "lang": "python", "repo": "tungstenfabric/tf-controller", "path": "/src/config/common/cfgm_common/datastore/api.py", "mode": "psm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|> """Returns size of pool based on options or deducts it from `_server_list`.""" if self.options.pool_size == 0: return 2 * len(self._server_list) return self.options.pool_size def nodes(self): """Returns numbers of nodes in cluster.""" # TODO(sahid):...
code_fim
hard
{ "lang": "python", "repo": "tungstenfabric/tf-controller", "path": "/src/config/common/cfgm_common/datastore/api.py", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_prefix|># repo: globality-corp/microcosm-pubsub path: /microcosm_pubsub/main.py """ PubSub CLI """ from __future__ import print_function from argparse import ArgumentParser from json import dumps from sys import stdout from microcosm.api import create_object_graph from microcosm.loaders import load_from_dict ...
code_fim
hard
{ "lang": "python", "repo": "globality-corp/microcosm-pubsub", "path": "/microcosm_pubsub/main.py", "mode": "psm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|> def write(args): loader = load_from_dict( sns_producer=dict( profile_name=args.profile, region_name=args.region, ), sns_topic_arns=dict( default=args.topic_arn, ), ) graph = create_object_graph("pubsub", debug=args.debug, lo...
code_fim
hard
{ "lang": "python", "repo": "globality-corp/microcosm-pubsub", "path": "/microcosm_pubsub/main.py", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|> print("Read in prostate data.") hdf = h2o.upload_file(pyunit_utils.locate("smalldata/prostate/prostate_complete.csv.zip")) print("Testing for family: TWEEDIE") print("Set variables for h2o.") y = "CAPSULE" x = ["AGE","RACE","DCAPS","PSA","VOL","DPROS","GLEASON"] print("Create models with c...
code_fim
medium
{ "lang": "python", "repo": "h2oai/h2o-3", "path": "/h2o-py/tests/testdir_algos/glm/pyunit_link_functions_tweedie_basic_glm.py", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_prefix|># repo: h2oai/h2o-3 path: /h2o-py/tests/testdir_algos/glm/pyunit_link_functions_tweedie_basic_glm.py from past.utils import old_div import sys sys.path.insert(1,"../../../") import h2o from tests import pyunit_utils from h2o.estimators.glm import H2OGeneralizedLinearEstimator <|fim_suffix|> if __name_...
code_fim
hard
{ "lang": "python", "repo": "h2oai/h2o-3", "path": "/h2o-py/tests/testdir_algos/glm/pyunit_link_functions_tweedie_basic_glm.py", "mode": "psm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|> print("Testing for family: TWEEDIE") print("Set variables for h2o.") y = "CAPSULE" x = ["AGE","RACE","DCAPS","PSA","VOL","DPROS","GLEASON"] print("Create models with canonical link: TWEEDIE") model_h2o_tweedie = H2OGeneralizedLinearEstimator(family="tweedie", link="tweedie", alpha=0.5, Lambda...
code_fim
medium
{ "lang": "python", "repo": "h2oai/h2o-3", "path": "/h2o-py/tests/testdir_algos/glm/pyunit_link_functions_tweedie_basic_glm.py", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_prefix|># repo: pyvandenbussche/AnnotationQueryPython path: /AQPython/Utilities.py import sys import io import os from pyspark.sql.functions import * from pyspark.sql.types import * from pyspark.sql import SparkSession from urllib.parse import quote_plus from urllib.parse import unquote_plus spark = SparkSessio...
code_fim
hard
{ "lang": "python", "repo": "pyvandenbussche/AnnotationQueryPython", "path": "/AQPython/Utilities.py", "mode": "psm", "license": "BSD-3-Clause", "source": "the-stack-v2" }
<|fim_suffix|> """This function converts a Dataframe of AQAnnotations to a Dataframe of CATAnnotations. If specific properties (name-value pairs to set in the CATAnnotation other column) are desired, you have the option of specifying an Array of names (for these name-value pairs). Additionally, you have th...
code_fim
hard
{ "lang": "python", "repo": "pyvandenbussche/AnnotationQueryPython", "path": "/AQPython/Utilities.py", "mode": "spm", "license": "BSD-3-Clause", "source": "the-stack-v2" }
<|fim_prefix|># repo: raft-tech/cfgov-refresh path: /cfgov/regulations3k/models/__init__.py # flake8: noqa F401 from regulations3k.models.django import ( <|fim_suffix|>label_re_str, sortable_label, validate_label ) from regulations3k.models.pages import RegulationLandingPage, RegulationPage<|fim_middle|> Effect...
code_fim
medium
{ "lang": "python", "repo": "raft-tech/cfgov-refresh", "path": "/cfgov/regulations3k/models/__init__.py", "mode": "psm", "license": "CC0-1.0", "source": "the-stack-v2" }
<|fim_suffix|>label_re_str, sortable_label, validate_label ) from regulations3k.models.pages import RegulationLandingPage, RegulationPage<|fim_prefix|># repo: raft-tech/cfgov-refresh path: /cfgov/regulations3k/models/__init__.py # flake8: noqa F401 from regulations3k.models.django import ( <|fim_middle|> Effect...
code_fim
medium
{ "lang": "python", "repo": "raft-tech/cfgov-refresh", "path": "/cfgov/regulations3k/models/__init__.py", "mode": "spm", "license": "CC0-1.0", "source": "the-stack-v2" }
<|fim_prefix|># repo: nocproject/noc path: /core/topology/goal/level.py # ---------------------------------------------------------------------- # ManagedObjectLevel goal # ---------------------------------------------------------------------- # Copyright (C) 2007-2020 The NOC Project # See LICENSE for details # -----...
code_fim
medium
{ "lang": "python", "repo": "nocproject/noc", "path": "/core/topology/goal/level.py", "mode": "psm", "license": "BSD-3-Clause", "source": "the-stack-v2" }
<|fim_suffix|> """ Matches when current level greater of equal to defined """ TOWARDS_COST = 1 SAME_LEVEL_COST = 10 BACKWARDS_COST = 100 def __init__(self, level): super().__init__() self.level = level def cost_estimate( self, neighbor: ManagedObject, current: O...
code_fim
medium
{ "lang": "python", "repo": "nocproject/noc", "path": "/core/topology/goal/level.py", "mode": "spm", "license": "BSD-3-Clause", "source": "the-stack-v2" }
<|fim_suffix|> """ Adds any configuration options that the db layer might have. :param parser: An optparse.OptionParser object :retval None """ help_text = "The following configuration options are specific to the "\ "Glance image registry database." group = optparse.OptionGr...
code_fim
medium
{ "lang": "python", "repo": "ashokcse/openstack-bill", "path": "/stack/glance/glance/registry/db/__init__.py", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_prefix|># repo: ashokcse/openstack-bill path: /stack/glance/glance/registry/db/__init__.py # vim: tabstop=4 shiftwidth=4 softtabstop=4 # Copyright 2010 United States Government as represented by the # Administrator of the National Aeronautics and Space Administration. # Copyright 2010-2011 OpenStack LLC. # All ...
code_fim
medium
{ "lang": "python", "repo": "ashokcse/openstack-bill", "path": "/stack/glance/glance/registry/db/__init__.py", "mode": "psm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_prefix|># repo: huggingface/diffusers path: /tests/pipelines/stable_diffusion/test_stable_diffusion_pix2pix_zero.py ype == "pil": image = VaeImageProcessor.pt_to_numpy(inputs["image"]) image = VaeImageProcessor.numpy_to_pil(image) else: raise ValueError(f"unsupported i...
code_fim
hard
{ "lang": "python", "repo": "huggingface/diffusers", "path": "/tests/pipelines/stable_diffusion/test_stable_diffusion_pix2pix_zero.py", "mode": "psm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|> device = "cpu" # ensure determinism for the device-dependent torch.Generator components = self.get_dummy_components() components["scheduler"] = DDPMScheduler() sd_pipe = StableDiffusionPix2PixZeroPipeline(**components) sd_pipe = sd_pipe.to(device) sd_pipe.s...
code_fim
hard
{ "lang": "python", "repo": "huggingface/diffusers", "path": "/tests/pipelines/stable_diffusion/test_stable_diffusion_pix2pix_zero.py", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_prefix|># repo: shjoshi/vispy path: /vispy/scene/visuals/tests/test_ellipse.py # -*- coding: utf-8 -*- """ Tests for EllipseVisual All images are of size (100,100) to keep a small file size """ from vispy import gloo from vispy.scene import visuals, transforms from vispy.testing import (requires_application, a...
code_fim
hard
{ "lang": "python", "repo": "shjoshi/vispy", "path": "/vispy/scene/visuals/tests/test_ellipse.py", "mode": "psm", "license": "BSD-3-Clause", "source": "the-stack-v2" }
<|fim_suffix|> """Test drawing arcs using EllipseVisual""" with TestingCanvas(): ellipse = visuals.Ellipse(pos=(0., 0.), radius=(0.4, 0.3), start_angle=90., span_angle=120., color=(0, 0, 1, 1)) ellipse.draw() assert_image...
code_fim
hard
{ "lang": "python", "repo": "shjoshi/vispy", "path": "/vispy/scene/visuals/tests/test_ellipse.py", "mode": "spm", "license": "BSD-3-Clause", "source": "the-stack-v2" }
<|fim_suffix|> @requires_application() def test_arc_draw1(): """Test drawing arcs using EllipseVisual""" with TestingCanvas(): ellipse = visuals.Ellipse(pos=(0., 0.), radius=(0.4, 0.3), start_angle=90., span_angle=120., color=(0, 0, 1, ...
code_fim
hard
{ "lang": "python", "repo": "shjoshi/vispy", "path": "/vispy/scene/visuals/tests/test_ellipse.py", "mode": "spm", "license": "BSD-3-Clause", "source": "the-stack-v2" }
<|fim_prefix|># repo: project-callisto/django-decorator-include path: /tests/included2.py from __future__ import unicode_literals <|fim_suffix|> return HttpResponse('deeply nested!') urlpatterns = [ url(r'^deeply_nested/$', deeply_nested, name='deeply_nested'), ]<|fim_middle|>from django.conf.urls import url...
code_fim
medium
{ "lang": "python", "repo": "project-callisto/django-decorator-include", "path": "/tests/included2.py", "mode": "psm", "license": "BSD-2-Clause", "source": "the-stack-v2" }
<|fim_suffix|>urlpatterns = [ url(r'^deeply_nested/$', deeply_nested, name='deeply_nested'), ]<|fim_prefix|># repo: project-callisto/django-decorator-include path: /tests/included2.py from __future__ import unicode_literals <|fim_middle|>from django.conf.urls import url from django.http import HttpResponse def ...
code_fim
medium
{ "lang": "python", "repo": "project-callisto/django-decorator-include", "path": "/tests/included2.py", "mode": "spm", "license": "BSD-2-Clause", "source": "the-stack-v2" }
<|fim_prefix|># repo: xpharry/PythonRobotics path: /SLAM/GraphBasedSLAM/graphslam/util.py # Copyright (c) 2020 Jeff Irion and contributors # # This file originated from the `graphslam` package: # # https://github.com/JeffLIrion/python-graphslam """Utility functions used throughout the package. """ import numpy as...
code_fim
hard
{ "lang": "python", "repo": "xpharry/PythonRobotics", "path": "/SLAM/GraphBasedSLAM/graphslam/util.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> """Given an upper triangular matrix, return the full matrix. Parameters ---------- arr : np.ndarray The upper triangular portion of the matrix n : int The size of the matrix Returns ------- mat : np.ndarray The full matrix """ triu0 = np.t...
code_fim
hard
{ "lang": "python", "repo": "xpharry/PythonRobotics", "path": "/SLAM/GraphBasedSLAM/graphslam/util.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: talkncloud/tyhac-aws-hackster path: /aws-cdk/src/lambda/staging/coughvid/src/segmentation.py import numpy as np #Use old segmentation def segment_cough(x,fs, cough_padding=0.2,min_cough_len=0.2, th_l_multiplier = 0.1, th_h_multiplier = 2): """Preprocess the data by segmenting each file into ...
code_fim
hard
{ "lang": "python", "repo": "talkncloud/tyhac-aws-hackster", "path": "/aws-cdk/src/lambda/staging/coughvid/src/segmentation.py", "mode": "psm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|>def compute_SNR(x, fs): """Compute the Signal-to-Noise ratio of the audio signal x (np.array) with sampling frequency fs (float)""" segments, cough_mask = segment_cough(x,fs) RMS_signal = 0 if len(x[cough_mask])==0 else np.sqrt(np.mean(np.square(x[cough_mask]))) RMS_noise = np.sqrt(np.mean...
code_fim
hard
{ "lang": "python", "repo": "talkncloud/tyhac-aws-hackster", "path": "/aws-cdk/src/lambda/staging/coughvid/src/segmentation.py", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_prefix|># repo: nikcbg/Introduction-to-Python-Development path: /Common Uses and Debugging/Decorators/decorators.py def inspect(func): def wrapped_func(*args, **kwargs): print(f"Running {func.__name__}") val = func(*args, **kwargs) print(f"Result: {val}") return val <|fim_suf...
code_fim
hard
{ "lang": "python", "repo": "nikcbg/Introduction-to-Python-Development", "path": "/Common Uses and Debugging/Decorators/decorators.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> @classmethod def query(cls, query_string): return cls.base_url + '?' + query_string @staticmethod def name(): return "Kevin Bacon" @property def full_name(self): return f"{self.first_name} {self.last_name}" ...
code_fim
hard
{ "lang": "python", "repo": "nikcbg/Introduction-to-Python-Development", "path": "/Common Uses and Debugging/Decorators/decorators.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> def floatx(): """Returns the default float type, as a string. E.g. `'float16'`, `'float32'`, `'float64'`. Returns: String, the current default float type. Example: >>> tf.keras.backend.floatx() 'float32' """ return _FLOATX def set_floatx(value): """Sets the default float type...
code_fim
hard
{ "lang": "python", "repo": "tensorflow/tensorflow", "path": "/tensorflow/python/keras/backend_config.py", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_prefix|># repo: tensorflow/tensorflow path: /tensorflow/python/keras/backend_config.py # Copyright 2019 The TensorFlow Authors. 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 th...
code_fim
hard
{ "lang": "python", "repo": "tensorflow/tensorflow", "path": "/tensorflow/python/keras/backend_config.py", "mode": "psm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|> pass def toggle(self): self.state = not self.state base.setFrameRateMeter(self.state)<|fim_prefix|># repo: gamingrobot/second-sunrise path: /game/plugins/core/framerate/framerate.py from direct.showbase import DirectObject class FrameRate(DirectObject.DirectObject): <|fim_m...
code_fim
hard
{ "lang": "python", "repo": "gamingrobot/second-sunrise", "path": "/game/plugins/core/framerate/framerate.py", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_prefix|># repo: gamingrobot/second-sunrise path: /game/plugins/core/framerate/framerate.py from direct.showbase import DirectObject class FrameRate(DirectObject.DirectObject): """Toggles displaying the framerate""" """TODO: fix with register control""" def __init__(self, xml): self.state = ...
code_fim
medium
{ "lang": "python", "repo": "gamingrobot/second-sunrise", "path": "/game/plugins/core/framerate/framerate.py", "mode": "psm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|> self.accept('f12', self.toggle) def stop(self): self.ignore('f12') def destroy(self): pass def toggle(self): self.state = not self.state base.setFrameRateMeter(self.state)<|fim_prefix|># repo: gamingrobot/second-sunrise path: /game/plugins/core/frame...
code_fim
medium
{ "lang": "python", "repo": "gamingrobot/second-sunrise", "path": "/game/plugins/core/framerate/framerate.py", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|>dPrescription("guttagonol") patient.update() trialResultsTot[step].append(patient.getTotalPop()) trialResultsRes[step].append(patient.getResistPop(["guttagonol"])) resultsSummaryTot = [sum(l) / float(len(l)) for l in trialResultsTot] resultsSummaryRes = [su...
code_fim
hard
{ "lang": "python", "repo": "MErmanProject/My-Projects", "path": "/6.00.2x Intro to CS II/Week 3/PS3eAnalyzingSimWithDrugs.py", "mode": "spm", "license": "CC0-1.0", "source": "the-stack-v2" }
<|fim_prefix|># repo: MErmanProject/My-Projects path: /6.00.2x Intro to CS II/Week 3/PS3eAnalyzingSimWithDrugs.py import pylab def simulationWithDrug(numViruses, maxPop, maxBirthProb, clearProb, resistances, mutProb, numTrials): steps = 300 treatOnStep = 150 trialResultsTot = [[...
code_fim
hard
{ "lang": "python", "repo": "MErmanProject/My-Projects", "path": "/6.00.2x Intro to CS II/Week 3/PS3eAnalyzingSimWithDrugs.py", "mode": "psm", "license": "CC0-1.0", "source": "the-stack-v2" }
<|fim_suffix|>@router.post("/ask") async def ask_question(item: Item): return item_service.answer_question(item)<|fim_prefix|># repo: peterdeepsix/entroprise-api path: /app/api/item.py from fastapi import APIRouter from models.item_model import Item from service import item_service router = APIRouter() <|fim_m...
code_fim
medium
{ "lang": "python", "repo": "peterdeepsix/entroprise-api", "path": "/app/api/item.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|>router = APIRouter() @router.get("/") async def read_root(): return {"Hello": "Universe"} @router.post("/ask") async def ask_question(item: Item): return item_service.answer_question(item)<|fim_prefix|># repo: peterdeepsix/entroprise-api path: /app/api/item.py from fastapi import APIRouter <...
code_fim
medium
{ "lang": "python", "repo": "peterdeepsix/entroprise-api", "path": "/app/api/item.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: peterdeepsix/entroprise-api path: /app/api/item.py from fastapi import APIRouter <|fim_suffix|>@router.get("/") async def read_root(): return {"Hello": "Universe"} @router.post("/ask") async def ask_question(item: Item): return item_service.answer_question(item)<|fim_middle|>from model...
code_fim
medium
{ "lang": "python", "repo": "peterdeepsix/entroprise-api", "path": "/app/api/item.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|>d.c", "nanomsg/src/utils/efd_eventfd.h", "nanomsg/src/utils/efd_eventfd.inc", "nanomsg/src/utils/efd.h", "nanomsg/src/utils/efd_pipe.h", "nanomsg/src/utils/efd_pipe.inc", "nanomsg/src/utils/efd_socketpair.h", "nanomsg/src/utils/efd_sock...
code_fim
hard
{ "lang": "python", "repo": "redsift/node-nanomsg", "path": "/deps/download.gypi", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: redsift/node-nanomsg path: /deps/download.gypi "action_name": "download_nmsg", "inputs": [], "outputs": ["nanomsg-1.1.0.tar.gz"], "action": ["curl", "-L", "https://github.com/nanomsg/nanomsg/archive/refs/tags/1.1.0.tar.gz", "-o", "nanomsg-1.1.0.tar.gz"], }, ...
code_fim
hard
{ "lang": "python", "repo": "redsift/node-nanomsg", "path": "/deps/download.gypi", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: redsift/node-nanomsg path: /deps/download.gypi : "download_nmsg", "inputs": [], "outputs": ["nanomsg-1.1.0.tar.gz"], "action": ["curl", "-L", "https://github.com/nanomsg/nanomsg/archive/refs/tags/1.1.0.tar.gz", "-o", "nanomsg-1.1.0.tar.gz"], }, { "action_na...
code_fim
hard
{ "lang": "python", "repo": "redsift/node-nanomsg", "path": "/deps/download.gypi", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: shuryhin-oleksandr/happy_dogs path: /happy_dogs/dogs/views.py import calendar import logging from datetime import date, timedelta import random from django.shortcuts import redirect from django.urls import reverse_lazy from django.views.generic import TemplateView, ListView, CreateView from rest...
code_fim
hard
{ "lang": "python", "repo": "shuryhin-oleksandr/happy_dogs", "path": "/happy_dogs/dogs/views.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> class BoardingAPIView(APIView): filter_form_class = BoardingFilterForm def get(self, request): today = date.today() last_month_day = calendar.monthrange(today.year, today.month)[1] start_date = self.request.GET.get('start_date') or today.replace(day=1) end_date = ...
code_fim
hard
{ "lang": "python", "repo": "shuryhin-oleksandr/happy_dogs", "path": "/happy_dogs/dogs/views.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> return reverse_lazy('dogs:boarding') class BoardingVisitCreateView(CreateView): model = BoardingVisit fields = ['dog', 'start_date', 'end_date'] template_name = 'dogs/create_visit.html' def get_success_url(self): return reverse_lazy('dogs:boarding') class CreateBoardin...
code_fim
hard
{ "lang": "python", "repo": "shuryhin-oleksandr/happy_dogs", "path": "/happy_dogs/dogs/views.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> # 创建test_为前缀的方法,里面用self.assert方法调用被测试的对象 def test_circumference(self): self.assertAlmostEqual(circle_func.circumference(1), math.pi*2) self.assertl #5.unittest.main()作为主函数入口 if __name__ == '__main__': unittest.main()<|fim_prefix|># repo: fxyyy123/book_codes path: /ch10/exerci...
code_fim
medium
{ "lang": "python", "repo": "fxyyy123/book_codes", "path": "/ch10/exercises/test_circle_func.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: fxyyy123/book_codes path: /ch10/exercises/test_circle_func.py import unittest, math import circle_func # 导入被测试模块 # 创建一个继承unittest.TestCase的类 class Tests(unittest.TestCase): <|fim_suffix|> self.assertAlmostEqual(circle_func.circumference(1), math.pi*2) self.assertl #5.unittest.ma...
code_fim
hard
{ "lang": "python", "repo": "fxyyy123/book_codes", "path": "/ch10/exercises/test_circle_func.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> print('') print('when no input file is specified') train([], 10, 5) print('') print('visualize') visualize(['input.json'], os.getcwd()) if __name__ == '__main__': test()<|fim_prefix|># repo: vishwasuppoor/Bookworms path: /test/test.py from bookworms.train import train f...
code_fim
medium
{ "lang": "python", "repo": "vishwasuppoor/Bookworms", "path": "/test/test.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: vishwasuppoor/Bookworms path: /test/test.py from bookworms.train import train from bookworms.visualize import visualize import os def test(): <|fim_suffix|> print('') print('when no input file is specified') train([], 10, 5) print('') print('visualize') visualize(['in...
code_fim
medium
{ "lang": "python", "repo": "vishwasuppoor/Bookworms", "path": "/test/test.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> print('') print('visualize') visualize(['input.json'], os.getcwd()) if __name__ == '__main__': test()<|fim_prefix|># repo: vishwasuppoor/Bookworms path: /test/test.py from bookworms.train import train from bookworms.visualize import visualize import os def test(): print('training i...
code_fim
medium
{ "lang": "python", "repo": "vishwasuppoor/Bookworms", "path": "/test/test.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> dependencies = [ ] operations = [ migrations.CreateModel( name='GitHubUser', fields=[ ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')), ('login', models.CharField(max_length=255, u...
code_fim
hard
{ "lang": "python", "repo": "coronavirus-cpu/novel", "path": "/golgotha/apps/gh/migrations/0001_initial.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> operations = [ migrations.CreateModel( name='GitHubUser', fields=[ ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')), ('login', models.CharField(max_length=255, unique=True)), ...
code_fim
hard
{ "lang": "python", "repo": "coronavirus-cpu/novel", "path": "/golgotha/apps/gh/migrations/0001_initial.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: coronavirus-cpu/novel path: /golgotha/apps/gh/migrations/0001_initial.py # Generated by Django 2.2.10 on 2020-02-09 02:11 from django.db import migrations, models import django.utils.timezone class Migration(migrations.Migration): <|fim_suffix|> dependencies = [ ] operations = [ ...
code_fim
hard
{ "lang": "python", "repo": "coronavirus-cpu/novel", "path": "/golgotha/apps/gh/migrations/0001_initial.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> x = self.pool_3_2_0(self.conv_layers_1(x)) x = self.pool_3_2_0(self.conv_layers_2(x)) x = self.Mixed5b(x) x = self.Mixed5c(x) x = self.Mixed5d(x) x = self.Mixed6a(x) x = self.Mixed6b(x) x = self.Mixed6c(x) x = self.Mixed6d(x) ...
code_fim
hard
{ "lang": "python", "repo": "whq-hqw/omni_torch", "path": "/examples/inception_net_v3.py", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_prefix|># repo: whq-hqw/omni_torch path: /examples/inception_net_v3.py import torch import torch.nn as nn import torch.nn.functional as F import omni_torch.networks.initialization as init from omni_torch.networks import blocks as omth_blocks # Compare with the vanilla implementation here: # https://github.com/p...
code_fim
hard
{ "lang": "python", "repo": "whq-hqw/omni_torch", "path": "/examples/inception_net_v3.py", "mode": "psm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|> # Assert self.assertEqual(response.status_code, status.HTTP_202_ACCEPTED) def test_extension_is_allowed_when_vm_is_running(self): self.disk.vm.runtime_state = models.VirtualMachine.RuntimeStates.POWERED_ON self.disk.vm.save() self.client.force_authenticate(self...
code_fim
hard
{ "lang": "python", "repo": "virtengine/ve-waldur-v2", "path": "/src/waldur_vmware/tests/test_disk.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|>class VirtualDiskExtendTest(test.APITransactionTestCase): def setUp(self): self.fixture = fixtures.VMwareFixture() self.disk = self.fixture.disk self.url = factories.DiskFactory.get_url(self.disk, 'extend') self.disk.vm.runtime_state = models.VirtualMachine.RuntimeState...
code_fim
hard
{ "lang": "python", "repo": "virtengine/ve-waldur-v2", "path": "/src/waldur_vmware/tests/test_disk.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: virtengine/ve-waldur-v2 path: /src/waldur_vmware/tests/test_disk.py from rest_framework import status, test from waldur_vmware import models from . import factories, fixtures class VirtualDiskCreateTest(test.APITransactionTestCase): def setUp(self): self.fixture = fixtures.VMwareF...
code_fim
hard
{ "lang": "python", "repo": "virtengine/ve-waldur-v2", "path": "/src/waldur_vmware/tests/test_disk.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|>supportedDataExtensions = tuple([_data_classname_to_extension(cls) for cls in supportedClasses]) # Define SynCoPy's general file-/directory-naming conventions FILE_EXT = {"dir" : ".spy", "info" : ".info", "data" : supportedDataExtensions}<|fim_pref...
code_fim
hard
{ "lang": "python", "repo": "esi-neuroscience/syncopy", "path": "/syncopy/shared/filetypes.py", "mode": "spm", "license": "BSD-3-Clause", "source": "the-stack-v2" }
<|fim_prefix|># repo: esi-neuroscience/syncopy path: /syncopy/shared/filetypes.py # -*- coding: utf-8 -*- # # Supported Syncopy classes and file extensions # <|fim_suffix|># data file extensions are first word of data class name in lower-case supportedClasses = ('AnalogData', 'SpectralData', 'CrossSpectralData', # Co...
code_fim
medium
{ "lang": "python", "repo": "esi-neuroscience/syncopy", "path": "/syncopy/shared/filetypes.py", "mode": "psm", "license": "BSD-3-Clause", "source": "the-stack-v2" }
<|fim_prefix|># repo: jockbo/jockjebi-web path: /jockbo/apps/jockboAuth/apps.py from django.apps import AppConfig <|fim_suffix|> name = 'jockbo.apps.jockboAuth' #model이 있는 폴더 # label = 'api' #실제 migration이나 db에 적용되는 라벨<|fim_middle|> class JockboAuthConfig(AppConfig):
code_fim
easy
{ "lang": "python", "repo": "jockbo/jockjebi-web", "path": "/jockbo/apps/jockboAuth/apps.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> name = 'jockbo.apps.jockboAuth' #model이 있는 폴더 # label = 'api' #실제 migration이나 db에 적용되는 라벨<|fim_prefix|># repo: jockbo/jockjebi-web path: /jockbo/apps/jockboAuth/apps.py from django.apps import AppConfig <|fim_middle|> class JockboAuthConfig(AppConfig):
code_fim
easy
{ "lang": "python", "repo": "jockbo/jockjebi-web", "path": "/jockbo/apps/jockboAuth/apps.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> @gen.coroutine def consumer(): while True: item = yield q.get() print '\t\t', 'Got', item q.task_done() if __name__ == '__main__': producer() consumer() loop = ioloop.IOLoop.current() def stop(future): loop.stop() future.result() # Raise err...
code_fim
hard
{ "lang": "python", "repo": "ajdavis/toro", "path": "/examples/producer_consumer_example.py", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_prefix|># repo: ajdavis/toro path: /examples/producer_consumer_example.py """A classic producer-consumer example for using :class:`~toro.JoinableQueue`. """ # start-file from tornado import ioloop, gen import toro q = toro.JoinableQueue(maxsize=3) @gen.coroutine def producer(): <|fim_suffix|> while True: ...
code_fim
medium
{ "lang": "python", "repo": "ajdavis/toro", "path": "/examples/producer_consumer_example.py", "mode": "psm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|> if kind == 'a': models = Article.objects.all() elif kind == 'p': models = Program.objects.all() else: raise base.CommandError('No valid arguments specified') for model in models: model.title = titlecase.titlecase(model.title)...
code_fim
hard
{ "lang": "python", "repo": "megaprojectske/megaprojects.co.ke-archive", "path": "/megaprojects/core/management/commands/capitalize.py", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|> kind = args[0] if kind == 'a': models = Article.objects.all() elif kind == 'p': models = Program.objects.all() else: raise base.CommandError('No valid arguments specified') for model in models: model.title = titlecas...
code_fim
medium
{ "lang": "python", "repo": "megaprojectske/megaprojects.co.ke-archive", "path": "/megaprojects/core/management/commands/capitalize.py", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_prefix|># repo: megaprojectske/megaprojects.co.ke-archive path: /megaprojects/core/management/commands/capitalize.py from django.core.management import base import _titlecase as titlecase from articles.models import Article from programs.models import Program <|fim_suffix|> args = 'a (Article), or p (Progr...
code_fim
medium
{ "lang": "python", "repo": "megaprojectske/megaprojects.co.ke-archive", "path": "/megaprojects/core/management/commands/capitalize.py", "mode": "psm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_prefix|># repo: decred/tinydecred path: /decred/decred/dcr/txscript.py drs is a convenience function to attempt to convert the passed hash to a pay-to-script-hash address housed within an address list. It is used to consolidate common code. """ return [addrlib.AddressScriptHash(scriptHash, netPa...
code_fim
hard
{ "lang": "python", "repo": "decred/tinydecred", "path": "/decred/decred/dcr/txscript.py", "mode": "psm", "license": "ISC", "source": "the-stack-v2" }
<|fim_suffix|> def estimateOutputSize(scriptSize): """ estimateOutputSize returns the worst case serialize size estimate for a tx output - 8 bytes amount - 2 bytes version - the compact int representation of the script size - the supplied script size Args: scriptSize int: By...
code_fim
hard
{ "lang": "python", "repo": "decred/tinydecred", "path": "/decred/decred/dcr/txscript.py", "mode": "spm", "license": "ISC", "source": "the-stack-v2" }
<|fim_suffix|> except Exception as e: log.debug("isSSGen: {}".format(e)) else: return True def checkSSGen(tx): """ CheckSSGen returns an error if a transaction is not a stake submission generation transaction. It does some simple validation steps to make sure the number of inp...
code_fim
hard
{ "lang": "python", "repo": "decred/tinydecred", "path": "/decred/decred/dcr/txscript.py", "mode": "spm", "license": "ISC", "source": "the-stack-v2" }
<|fim_prefix|># repo: shomohs/python-frontynium path: /frontynium/exceptions.py class ObjectMappingNotFound(Exception): <|fim_suffix|> def __init__(self, message): Exception.__init__(self, message)<|fim_middle|> def __init__(self, message): Exception.__init__(self, message) class InvalidObjectM...
code_fim
medium
{ "lang": "python", "repo": "shomohs/python-frontynium", "path": "/frontynium/exceptions.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> Exception.__init__(self, message)<|fim_prefix|># repo: shomohs/python-frontynium path: /frontynium/exceptions.py class ObjectMappingNotFound(Exception): def __init__(self, message): Exception.__init__(self, message) <|fim_middle|>class InvalidObjectMapping(Exception): def __ini...
code_fim
medium
{ "lang": "python", "repo": "shomohs/python-frontynium", "path": "/frontynium/exceptions.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> def __init__(self, message): Exception.__init__(self, message)<|fim_prefix|># repo: shomohs/python-frontynium path: /frontynium/exceptions.py class ObjectMappingNotFound(Exception): def __init__(self, message): Exception.__init__(self, message) <|fim_middle|>class InvalidObject...
code_fim
easy
{ "lang": "python", "repo": "shomohs/python-frontynium", "path": "/frontynium/exceptions.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> a.problems.append(quiz.Problem( "What does Eulerian Method imply?", "Fixed points in space.", "B", "C", "A")) a.problems.append(quiz.Problem( "What does Lagrangian Method imply?", "Following particles as they move.", "B", "C", "A")) a.problems.append(quiz.Pr...
code_fim
hard
{ "lang": "python", "repo": "nicholasmalaya/arcanus", "path": "/inspectio/fluids_quiz.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> a.problems.append(quiz.Problem( "What does Lagrangian Method imply?", "Following particles as they move.", "B", "C", "A")) a.problems.append(quiz.Problem( "What are the units of viscosity (kinematic)?", "meters squared per second.", "B", "C", "A")) a.problem...
code_fim
hard
{ "lang": "python", "repo": "nicholasmalaya/arcanus", "path": "/inspectio/fluids_quiz.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: nicholasmalaya/arcanus path: /inspectio/fluids_quiz.py import quiz # # fluid quiz # def loadProblems(a): a.problems.append(quiz.Problem( "What is the Reynolds Number?", "I don't know.", "A non-dimensional ratio of the product of the velocity and the length scale, divided by the vi...
code_fim
hard
{ "lang": "python", "repo": "nicholasmalaya/arcanus", "path": "/inspectio/fluids_quiz.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> async with aiohttp.ClientSession() as session: async with session.post("https://radiko.jp/v2/api/auth1_fms", data="\r\n", headers=self.headers) as response: self.headers["X-Radiko-AuthToken"] = response.headers["X-RADIKO-AUTHTOKEN"] tmp_headers = self.heade...
code_fim
hard
{ "lang": "python", "repo": "SlashNephy/RadioBot", "path": "/bot/radiko.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: SlashNephy/RadioBot path: /bot/radiko.py from __future__ import annotations import asyncio import base64 import logging import re import time from dataclasses import dataclass from datetime import datetime, timedelta from subprocess import PIPE, Popen from threading import Thread from typing imp...
code_fim
hard
{ "lang": "python", "repo": "SlashNephy/RadioBot", "path": "/bot/radiko.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> uid = int(self.request.get('id')) user = Users.get_by_id(uid) self.render("user.html", user=user)<|fim_prefix|># repo: peakBreaker/BasicBlog path: /handlers/user.py from MainHandler import Handler from context import Users class user(Handler): # Shows information about the specific user <|fim_mi...
code_fim
easy
{ "lang": "python", "repo": "peakBreaker/BasicBlog", "path": "/handlers/user.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: peakBreaker/BasicBlog path: /handlers/user.py from MainHandler import Handler from context import Users <|fim_suffix|> def get(self): uid = int(self.request.get('id')) user = Users.get_by_id(uid) self.render("user.html", user=user)<|fim_middle|>class user(Handler): # Shows information ab...
code_fim
medium
{ "lang": "python", "repo": "peakBreaker/BasicBlog", "path": "/handlers/user.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: jettify/aiogibson path: /tests/test_commands.py from ._testutil import GibsonTest, run_until_complete from aiogibson import errors class CommandsTest(GibsonTest): """Gibson high level commands. :see: http://gibson-db.in/commands/ """ @run_until_complete def test_set(self):...
code_fim
hard
{ "lang": "python", "repo": "jettify/aiogibson", "path": "/tests/test_commands.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> key1, value1 = b'test:mget_limit:1', b'10' key2, value2 = b'test:mget_limit:2', b'20' key3, value3 = b'test:mget_limit:3', b'30' yield from self.gibson.set(key1, value1, 100) yield from self.gibson.set(key2, value2, 100) yield from self.gibson.set(key3, valu...
code_fim
hard
{ "lang": "python", "repo": "jettify/aiogibson", "path": "/tests/test_commands.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: nyu-devops/lab-flask-bdd path: /features/steps/pets_steps.py ###################################################################### # Copyright 2016, 2023 John J. Rofrano. All Rights Reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except i...
code_fim
hard
{ "lang": "python", "repo": "nyu-devops/lab-flask-bdd", "path": "/features/steps/pets_steps.py", "mode": "psm", "license": "Apache-2.0", "source": "the-stack-v2" }