text
stringlengths
232
16.3k
domain
stringclasses
1 value
difficulty
stringclasses
3 values
meta
dict
<|fim_prefix|># repo: thanhdat369/adc-detect-lane path: /test_detect_on_pi.py from cv2 import cv2 import time from config import system_config as sys_cfg from camera.camera import CameraGet from sign_detect.ssd.ssd_detect_thread import SSDDetectThread CAMERA_INDEX = sys_cfg.CAMERA_INDEX <|fim_suffix|> if fr...
code_fim
hard
{ "lang": "python", "repo": "thanhdat369/adc-detect-lane", "path": "/test_detect_on_pi.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> key = cv2.waitKey(1) if(key==ord('q')): break #Set_frame frame = cam.frame detect_sign.frame = frame #Set_image final_image = detect_sign.final_image if frame is not None and final_image is not None: cv2.ims...
code_fim
medium
{ "lang": "python", "repo": "thanhdat369/adc-detect-lane", "path": "/test_detect_on_pi.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: sling254/Pre-Natal_care path: /Pre_Natal_care/maternal_care/migrations/0001_initial.py # Generated by Django 3.1.2 on 2021-08-02 20:24 from django.db import migrations, models class Migration(migrations.Migration): initial = True dependencies = [ ] operations = [ mig...
code_fim
hard
{ "lang": "python", "repo": "sling254/Pre-Natal_care", "path": "/Pre_Natal_care/maternal_care/migrations/0001_initial.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|>'positive', 'positive')], max_length=50)), ('Rh_factor', models.CharField(max_length=50)), ('Diabetes', models.CharField(max_length=50)), ('Hepatitis_B', models.CharField(max_length=50)), ('pregnancy_test', models.CharField(choices=[('negativ...
code_fim
hard
{ "lang": "python", "repo": "sling254/Pre-Natal_care", "path": "/Pre_Natal_care/maternal_care/migrations/0001_initial.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|>omment', models.TextField(max_length=100)), ('breast_pelvic', models.CharField(max_length=50)), ('baby_HeartBeart_rate', models.CharField(max_length=50)), ('cervical_exam', models.CharField(max_length=50)), ('sti', models.CharField(max_length...
code_fim
hard
{ "lang": "python", "repo": "sling254/Pre-Natal_care", "path": "/Pre_Natal_care/maternal_care/migrations/0001_initial.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: dthadi3/aiohttp-wsgi path: /tests/base.py import unittest from collections import namedtuple from contextlib import contextmanager from tempfile import NamedTemporaryFile import aiohttp from aiohttp_wsgi.wsgi import run_server from aiohttp_wsgi.utils import parse_sockname Response = namedtuple(...
code_fim
hard
{ "lang": "python", "repo": "dthadi3/aiohttp-wsgi", "path": "/tests/base.py", "mode": "psm", "license": "BSD-2-Clause", "source": "the-stack-v2" }
<|fim_suffix|> response = self.request(*args, data=data, **kwargs) self._test_case.assertEqual(response.status, 200) def noop_application(environ, start_response): start_response("200 OK", [ ("Content-Type", "text/plain"), ]) return [] def echo_application(environ, start_response)...
code_fim
hard
{ "lang": "python", "repo": "dthadi3/aiohttp-wsgi", "path": "/tests/base.py", "mode": "spm", "license": "BSD-2-Clause", "source": "the-stack-v2" }
<|fim_prefix|># repo: CMFiltenborg/satsense path: /satsense/image.py """ Methods for loading images """ import math import warnings import numpy as np from osgeo import gdal from six import iteritems from skimage import color, img_as_ubyte from skimage.feature import canny from skimage.filters.rank import equalize f...
code_fim
hard
{ "lang": "python", "repo": "CMFiltenborg/satsense", "path": "/satsense/image.py", "mode": "psm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|> @property def name(self): return self.__name @staticmethod def load_from_file(path, bands): """ Loads the specified path from file and loads the bands into a numpy array @returns dataset The raw gdal dataset image The image loaded as a nump...
code_fim
hard
{ "lang": "python", "repo": "CMFiltenborg/satsense", "path": "/satsense/image.py", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|> """Context processor for pattern library URL.""" return { "PATTERN_LIBRARY_URL": settings.PATTERN_LIBRARY_URL, }<|fim_prefix|># repo: iamtomc/IATI-Standard-Website path: /iati/context_processors.py """Module containing custom context processors for IATI's website.""" from django.conf ...
code_fim
easy
{ "lang": "python", "repo": "iamtomc/IATI-Standard-Website", "path": "/iati/context_processors.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: iamtomc/IATI-Standard-Website path: /iati/context_processors.py """Module containing custom context processors for IATI's website.""" from django.conf import settings <|fim_suffix|> """Context processor for pattern library URL.""" return { "PATTERN_LIBRARY_URL": settings.PATTERN_L...
code_fim
easy
{ "lang": "python", "repo": "iamtomc/IATI-Standard-Website", "path": "/iati/context_processors.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: paulray/NICERsoft path: /scripts/merge.py #!/usr/bin/env python import os, sys import matplotlib.pyplot as plt import numpy as np import argparse from astropy import log from os import path from glob import glob from subprocess import check_call import shutil from astropy.table import Table from ...
code_fim
hard
{ "lang": "python", "repo": "paulray/NICERsoft", "path": "/scripts/merge.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|># Make final merged clean plot log.info("Making Science Plots of merged event file") cmd = [ "nicerql.py", "--save", "--merge", "--sci", outname, "--allspec", "--alllc", "--lcbinsize", "{}".format(args.lcbinsize), "--basename", path.splitext(outname)[0], ] runcm...
code_fim
hard
{ "lang": "python", "repo": "paulray/NICERsoft", "path": "/scripts/merge.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> super(Asteroid, self).__init__() if size == None: self.__size = random.randint(1, 3) else: self.__size = size angle = random.uniform(0, 2*math.pi) speed = random.randint(100, 400) self.__velocity = scale_vec(speed, (math.cos(angle), math.sin(angle))) self.set_position(position) self....
code_fim
medium
{ "lang": "python", "repo": "NelsonCory/StarBlasters", "path": "/src/gui/entity/asteroid.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: NelsonCory/StarBlasters path: /src/gui/entity/asteroid.py from . entity import * from core.event_manager import * from core.resource_manager import * from utils.vector import * import math import pygame import random <|fim_suffix|> SCORE = [50, 25, 10] def __init__(self, size=None, position=(...
code_fim
medium
{ "lang": "python", "repo": "NelsonCory/StarBlasters", "path": "/src/gui/entity/asteroid.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> pos = add_vecs(self.get_position(), (cx, cy)) screen.blit(self.get_texture(), pos) def split(self): scene = self.get_scene() EventManager.get_instance().send("award_score", Asteroid.SCORE[self.__size-1]) if self.__size > 1: scene.add_entity(Asteroid(self.__size - 1, self.get_position())) ...
code_fim
hard
{ "lang": "python", "repo": "NelsonCory/StarBlasters", "path": "/src/gui/entity/asteroid.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: tensorflow/probability path: /tensorflow_probability/python/math/bessel.py 1mv def _temme_series(v, z, output_log_space=False): """Computes Kve(v, z) and Kve(v + 1., z) via Power series expansion.""" # This is based on: # [1] N. Temme, On the Numerical Evaluation of the Modified Bessel Fu...
code_fim
hard
{ "lang": "python", "repo": "tensorflow/probability", "path": "/tensorflow_probability/python/math/bessel.py", "mode": "psm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_prefix|># repo: tensorflow/probability path: /tensorflow_probability/python/math/bessel.py 62737, 0., -2499.8304818112092, 0., 24.380529699556064, 0., 0., 0., 0., 0., 0., 0., 0., 0.0], [3284469.8530720375, 0., -19706819.11843222, 0., 50952602.492664628, 0., -74105148.211532637, 0., 66344512.27...
code_fim
hard
{ "lang": "python", "repo": "tensorflow/probability", "path": "/tensorflow_probability/python/math/bessel.py", "mode": "psm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|> should_stop, index, partial_numerator, partial_denominator, denominator_ratio, convergent_difference, hypergeometric_ratio, # Terms for recurrence in 6.7.36 in [3]. k_0, k_1, # Intermediate coefficient in 6.7.30 in [3]. c, # Int...
code_fim
hard
{ "lang": "python", "repo": "tensorflow/probability", "path": "/tensorflow_probability/python/math/bessel.py", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|> # SONDAS_AOA self.NUMERO_DE_SONDAS_AOA = 1 self.NOME_DAS_SONDAS_AOA = ['Sonda AoA 0'] self.APELIDO_DAS_SONDAS_AOA = ["aoa0"] self.CALFACTS_DAS_SONDAS_AOA = [[5.0, 0.834]] self.APELIDO_PITOTS_AOA = [['pt3', 'pt2']] # CELULAS self.NUMERO_D...
code_fim
hard
{ "lang": "python", "repo": "solkan1201/Vivace", "path": "/code/libs/configurador.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> self.CALFACTS_DAS_CELULAS = [64100.0, 22100.0, 19600.0, 21500.0, 21400.0] # CONFIGURACOES DE TESTE self.NOME_DA_AERONAVE = 'Aeronave de teste' self.LOCAL_DE_VOO = 'Local de teste' self.TEMPERATURA = 'NaN' self.ANGULO_INCIDENCIA_ASA = 'NaN' self.ANGU...
code_fim
hard
{ "lang": "python", "repo": "solkan1201/Vivace", "path": "/code/libs/configurador.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: solkan1201/Vivace path: /code/libs/configurador.py import os class Configurador(object): def __init__(self): # GERAIS self.NOME_DO_ARQUIVO = 'Bancada' self.PASTA_DESTINO = os.path.expanduser('~/Documents/DadosBancada') self.LISTA_SENSORES = ['GERAL', 'ARDUI...
code_fim
medium
{ "lang": "python", "repo": "solkan1201/Vivace", "path": "/code/libs/configurador.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: mzy2240/learning-DD path: /models/maxcut-random/maxcut_evaluate_random.py import numpy as np import networkx as nx import pickle as cp import random import ctypes import os import sys import time import glob import re sys.path.append( '%s/code' % os.path.dirname(os.path.realpath(__file__)) ) fr...
code_fim
hard
{ "lang": "python", "repo": "mzy2240/learning-DD", "path": "/models/maxcut-random/maxcut_evaluate_random.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> result_file = '%s/test-g_type-%s-density-%s-nodes-%s-%s.csv' % (path, opt['test_g_type'], opt['test_density'], opt['test_min_n'], opt['test_max_n']) with open(result_file, 'w') as f_out: sys.stdout.flush() idx = 0 f_out.write("seed,graph_type,density,nodes,width,bound,ord...
code_fim
hard
{ "lang": "python", "repo": "mzy2240/learning-DD", "path": "/models/maxcut-random/maxcut_evaluate_random.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> assert model_file is not None sys.stdout.flush() api.LoadModel(model_file) #Initialize seed for test seed = int(opt['seed']) np.random.seed(seed) path = '%s/eval' % opt['save_dir'] if not os.path.exists(path): os.mkdir(path) result_file = '%s/test-g_type-%s...
code_fim
hard
{ "lang": "python", "repo": "mzy2240/learning-DD", "path": "/models/maxcut-random/maxcut_evaluate_random.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: geekodour/pinterest-dashbot path: /src/bot/follow_users_boards.py import json import os import random import time import os from core import pinBot bot_dir = os.path.dirname(__file__) with open(os.path.join(bot_dir,'pinterestBot.json')) as json_data: bot_config = json.load(json_data) bot =<...
code_fim
hard
{ "lang": "python", "repo": "geekodour/pinterest-dashbot", "path": "/src/bot/follow_users_boards.py", "mode": "psm", "license": "Unlicense", "source": "the-stack-v2" }
<|fim_suffix|> bot.followUser(user) time.sleep(1) # maybe randomize # follow boards for board in random.sample(boardIds,bot_config['board']['follow']): bot.followBoard(board) time.sleep(1) # maybe randomize<|fim_prefix|># repo: geekodour/pinterest-dashbot path: /src/bot/follow_use...
code_fim
hard
{ "lang": "python", "repo": "geekodour/pinterest-dashbot", "path": "/src/bot/follow_users_boards.py", "mode": "spm", "license": "Unlicense", "source": "the-stack-v2" }
<|fim_suffix|>arch_box = driver.find_element_by_name('q') search_box.send_keys('ChromeDriver') search_box.submit() time.sleep(5) driver.quit()<|fim_prefix|># repo: Rina81/Selenium1 path: /Task1-test1.py import time from selenium import webdriver driver = webdriver.Ch<|fim_middle|>rome() driver.get('http://www.m...
code_fim
medium
{ "lang": "python", "repo": "Rina81/Selenium1", "path": "/Task1-test1.py", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_prefix|># repo: Rina81/Selenium1 path: /Task1-test1.py import time from selenium import webdriver driver = webdriver.Ch<|fim_suffix|>arch_box = driver.find_element_by_name('q') search_box.send_keys('ChromeDriver') search_box.submit() time.sleep(5) driver.quit()<|fim_middle|>rome() driver.get('http://www.m...
code_fim
medium
{ "lang": "python", "repo": "Rina81/Selenium1", "path": "/Task1-test1.py", "mode": "psm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|>'ChromeDriver') search_box.submit() time.sleep(5) driver.quit()<|fim_prefix|># repo: Rina81/Selenium1 path: /Task1-test1.py import time from selenium import webdriver driver = webdriver.Ch<|fim_middle|>rome() driver.get('http://www.mail.ru/xhtml'); time.sleep(5) search_box = driver.find_element_b...
code_fim
medium
{ "lang": "python", "repo": "Rina81/Selenium1", "path": "/Task1-test1.py", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|> X_train['target'] = 0 X_test['target'] = 1 auc, importance = adversarial_validate(X_train, X_test) assert importance['feature'][0] == 'target' assert auc >= 0.9<|fim_prefix|># repo: nyanp/nyaggle path: /tests/validation/test_adversarial_validate.py from sklearn.model_selection impor...
code_fim
hard
{ "lang": "python", "repo": "nyanp/nyaggle", "path": "/tests/validation/test_adversarial_validate.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: nyanp/nyaggle path: /tests/validation/test_adversarial_validate.py from sklearn.model_selection import train_test_split <|fim_suffix|> def test_adv(): X, y = make_classification_df(1024) X_train, X_test, y_train, y_test = train_test_split(X, y, test_size=0.5, random_state=0) X_train...
code_fim
medium
{ "lang": "python", "repo": "nyanp/nyaggle", "path": "/tests/validation/test_adversarial_validate.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> ''' Input: 1. ckpt - Path to existing checkpoint. If present, returns only the subset of variables that exist in given checkpoint. Output: Returns list of variables that should be saved/restored Description: List of all variables that need to be saved/restored. ''' mo...
code_fim
hard
{ "lang": "python", "repo": "sanket1414/Priority-Based-Alert-System", "path": "/Depth_Model/util.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: sanket1414/Priority-Based-Alert-System path: /Depth_Model/util.py """ Contains common utilities and functions """ import locale import os import re from absl import logging import matplotlib matplotlib.use('Agg') import matplotlib.pyplot as plt import numpy as np import tensorflow as tf import c...
code_fim
hard
{ "lang": "python", "repo": "sanket1414/Priority-Based-Alert-System", "path": "/Depth_Model/util.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> def validate(cls, status, new_status): " Validate workflow " if not status: return new_status if repr(status) == repr(new_status): return new_status if not cls._rules.get(status) or \ new_status not in cls._rules.get(status): ...
code_fim
hard
{ "lang": "python", "repo": "valdergallo/django-choices-flow", "path": "/django_choices_flow/base.py", "mode": "spm", "license": "BSD-3-Clause", "source": "the-stack-v2" }
<|fim_prefix|># repo: valdergallo/django-choices-flow path: /django_choices_flow/base.py # -*- coding: utf-8 -*- try: from django.conf import settings except ImportError: settings = None if hasattr(settings, 'DJANGO_CHOICES_FLOW_ERROR_MESSAGE'): DEFAULT_DJANGO_CHOICES_FLOW_ERROR_MESSAGE = settings.DJANGO_...
code_fim
hard
{ "lang": "python", "repo": "valdergallo/django-choices-flow", "path": "/django_choices_flow/base.py", "mode": "psm", "license": "BSD-3-Clause", "source": "the-stack-v2" }
<|fim_suffix|> @error_msg.setter def error_msg(cls, value): "set default error message for instance" cls.__validate_msg = value def get_value(cls, key): return cls._hash.get(key) def validate(cls, status, new_status): " Validate workflow " if not status: ...
code_fim
hard
{ "lang": "python", "repo": "valdergallo/django-choices-flow", "path": "/django_choices_flow/base.py", "mode": "spm", "license": "BSD-3-Clause", "source": "the-stack-v2" }
<|fim_prefix|># repo: altairengineering/pkr path: /pkr/__main__.py #!/usr/bin/env python # -*- coding: utf-8 -*- # Copyright© 1986-2018 Altair Engineering Inc. """Main module. This calls the main function. This is designed to be used as a command line. To display the help, run: pkr --help. """ import sys import trac...
code_fim
medium
{ "lang": "python", "repo": "altairengineering/pkr", "path": "/pkr/__main__.py", "mode": "psm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|>def main(): """Main function""" try: parser = get_parser() cli_args = parser.parse_args() log.set_debug(cli_args.debug) set_use_env_var(not cli_args.no_env_var) cli_args.func(cli_args) except Exception as exc: # pylint: disable=W0703 # Here we d...
code_fim
hard
{ "lang": "python", "repo": "altairengineering/pkr", "path": "/pkr/__main__.py", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|> x: bytes32 = keccak256("moose", 3) """, ] @pytest.mark.parametrize('bad_code', fail_list) def test_invalid_literal_exception(bad_code): with pytest.raises(ArgumentException): compiler.compile_code(bad_code)<|fim_prefix|># repo: andrelfpinto/vyper path: /tests/parser/exceptions/test_...
code_fim
medium
{ "lang": "python", "repo": "andrelfpinto/vyper", "path": "/tests/parser/exceptions/test_argument_exception.py", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_prefix|># repo: andrelfpinto/vyper path: /tests/parser/exceptions/test_argument_exception.py import pytest from vyper import compiler from vyper.exceptions import ArgumentException <|fim_suffix|>@pytest.mark.parametrize('bad_code', fail_list) def test_invalid_literal_exception(bad_code): with pytest.raises...
code_fim
hard
{ "lang": "python", "repo": "andrelfpinto/vyper", "path": "/tests/parser/exceptions/test_argument_exception.py", "mode": "psm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_prefix|># repo: ManuelHuber-Github/yeoda path: /src/yeoda/errors.py # Copyright (c) 2019, Vienna University of Technology (TU Wien), Department of # Geodesy and Geoinformation (GEO). # All rights reserved. # # Redistribution and use in source and binary forms, with or without # modification, are permitted provid...
code_fim
hard
{ "lang": "python", "repo": "ManuelHuber-Github/yeoda", "path": "/src/yeoda/errors.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> return self.message class TileNotAvailable(Exception): """ Class to handle exceptions thrown by unknown tile names of a grid.""" def __init__(self, tilename): """ Constructor of `DimensionUnknown`. Parameters ---------- tilename : str ...
code_fim
hard
{ "lang": "python", "repo": "ManuelHuber-Github/yeoda", "path": "/src/yeoda/errors.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> """ String representation of this class. """ return self.message class LoadingDataError(IOError): """ Class to handle exceptions thrown when it is not possible to read data.""" def __init__(self): """Constructor of `LoadingDataError`.""" self.message = "Failed ...
code_fim
hard
{ "lang": "python", "repo": "ManuelHuber-Github/yeoda", "path": "/src/yeoda/errors.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> if not isinstance(index_offset, int) or index_offset < 0: raise TypeError('Index offset must be an unsigned integer') self._native.set_primitive_index_offset(index_offset) def get_primitive_index_offset(self): return self._native.get_primitive_index_offset() ...
code_fim
hard
{ "lang": "python", "repo": "MathGaron/PyOptiX", "path": "/pyoptix/geometry.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> self._intersection_program = program self._native.set_intersection_program(program._native) def get_intersection_program(self): return self._intersection_program def validate(self): self._native.validate()<|fim_prefix|># repo: MathGaron/PyOptiX path: /pyoptix/geo...
code_fim
hard
{ "lang": "python", "repo": "MathGaron/PyOptiX", "path": "/pyoptix/geometry.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: MathGaron/PyOptiX path: /pyoptix/geometry.py from pyoptix.context import current_context from pyoptix.mixins.graphnode import GraphNodeMixin from pyoptix.mixins.scoped import ScopedObject from pyoptix.mixins.hascontext import HasContextMixin class Geometry(GraphNodeMixin, ScopedObject, HasConte...
code_fim
hard
{ "lang": "python", "repo": "MathGaron/PyOptiX", "path": "/pyoptix/geometry.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> if args.verbose: print 'Number of absorbers: %d' % absorber_redshifts.shape[0] print 'Mean number per target: %.2f' % (absorber_redshifts.shape[0]/len(target_list)) print 'Mean absorber redshift: %.4f' % np.mean(absorber_redshifts) print 'Mean transimission: %.4f' % np....
code_fim
hard
{ "lang": "python", "repo": "dmargala/qusp", "path": "/examples/estimate_lya_deltas.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: dmargala/qusp path: /examples/estimate_lya_deltas.py #!/usr/bin/env python """ """ import argparse import numpy as np import scipy.stats import scipy.interpolate import matplotlib as mpl mpl.use('Agg') import matplotlib.pyplot as plt import h5py import qusp def main(): # parse command-li...
code_fim
hard
{ "lang": "python", "repo": "dmargala/qusp", "path": "/examples/estimate_lya_deltas.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> plt.hist2d(absorber_redshifts, absorber_transmissions, weights=absorber_weights, bins=[zbins, trans_bins], cmap='Greens') plt.plot(zbin_centers, mean_transmission, 'b.') plt.plot(zbin_centers, mean_transmission_interp(zbin_centers), 'r-') plt.xlabel('absorber redshift') plt.y...
code_fim
hard
{ "lang": "python", "repo": "dmargala/qusp", "path": "/examples/estimate_lya_deltas.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: trisduong/trove-develop path: /trove/tests/unittests/metadata/test_metadata_controller.py # Copyright 2014 Rackspace # 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 #...
code_fim
hard
{ "lang": "python", "repo": "trisduong/trove-develop", "path": "/trove/tests/unittests/metadata/test_metadata_controller.py", "mode": "psm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|> def test_validate_create_metadata(self): body = { "metadata": { "ids": [], "name": "test", "failover": { "instance-1": True, "instance-2": False } } } ...
code_fim
hard
{ "lang": "python", "repo": "trisduong/trove-develop", "path": "/trove/tests/unittests/metadata/test_metadata_controller.py", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_prefix|># repo: pfjob09/datascience path: /datascience/tests.py from numpy.random import permutation <|fim_suffix|> all_samples = observed.append(expected) n_obs = len(observed) values = [] for i in range(n_samples): samples = permutation(all_samples) values.append(stat_func(samp...
code_fim
medium
{ "lang": "python", "repo": "pfjob09/datascience", "path": "/datascience/tests.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> all_samples = observed.append(expected) n_obs = len(observed) values = [] for i in range(n_samples): samples = permutation(all_samples) values.append(stat_func(samples[:n_obs], samples[n_obs:])) return values<|fim_prefix|># repo: pfjob09/datascience path: /datascience/...
code_fim
medium
{ "lang": "python", "repo": "pfjob09/datascience", "path": "/datascience/tests.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: FGtatsuro/myatcoder path: /regular_contest/081/C.py import sys input = sys.stdin.readline sys.setrecursionlimit(10 ** 7) from collections import Counter<|fim_suffix|>a) < 2: print(0) sys.exit(0) else: k = sorted(a.keys(), reverse=True) if a[k[0]] >= 4: print(k[0] ** 2) ...
code_fim
medium
{ "lang": "python", "repo": "FGtatsuro/myatcoder", "path": "/regular_contest/081/C.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> print(k[0] ** 2) sys.exit(0) else: print(k[0] * k[1]) sys.exit(0)<|fim_prefix|># repo: FGtatsuro/myatcoder path: /regular_contest/081/C.py import sys input = sys.stdin.readline sys.setrecursionlimit(10 ** 7) from collections import Counter<|fim_middle|> n = int(input...
code_fim
hard
{ "lang": "python", "repo": "FGtatsuro/myatcoder", "path": "/regular_contest/081/C.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|>a) < 2: print(0) sys.exit(0) else: k = sorted(a.keys(), reverse=True) if a[k[0]] >= 4: print(k[0] ** 2) sys.exit(0) else: print(k[0] * k[1]) sys.exit(0)<|fim_prefix|># repo: FGtatsuro/myatcoder path: /regular_contest/081/C.py import sys input = sys.stdi...
code_fim
medium
{ "lang": "python", "repo": "FGtatsuro/myatcoder", "path": "/regular_contest/081/C.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: jz-meng/modelarts-dataset-sdk path: /huaweicloud-sdk-python-modelarts-dataset/modelarts/test/test_read_voc_xml_empty.py # Copyright 2018 Deep Learning Service of Huawei Cloud. All Rights Reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file exce...
code_fim
hard
{ "lang": "python", "repo": "jz-meng/modelarts-dataset-sdk", "path": "/huaweicloud-sdk-python-modelarts-dataset/modelarts/test/test_read_voc_xml_empty.py", "mode": "psm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|> def test_read_voc_xml_with_empty_segmented(): path = os.path.abspath('../../../') + "/resources/voc/errorFiles/2007_000027_segmented_empty.xml" try: pascal_voc = PascalVocIO.parse_xml(path) except Exception as e: print(e) assert ("Can't parse the XML file, segmented ca...
code_fim
hard
{ "lang": "python", "repo": "jz-meng/modelarts-dataset-sdk", "path": "/huaweicloud-sdk-python-modelarts-dataset/modelarts/test/test_read_voc_xml_empty.py", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|>def test_read_voc_xml_with_empty_file_name(): path = os.path.abspath('../../../') + "/resources/voc/errorFiles/2007_000027_filename_error.xml" try: pascal_voc = PascalVocIO.parse_xml(path) except Exception as e: print(e) assert ("Can't parse the XML file, filename can't...
code_fim
hard
{ "lang": "python", "repo": "jz-meng/modelarts-dataset-sdk", "path": "/huaweicloud-sdk-python-modelarts-dataset/modelarts/test/test_read_voc_xml_empty.py", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|> return [] # noqa def _default_definition(self): return "A representation of the computational entities of the model equations" # noqa<|fim_prefix|># repo: jomoeller/simphony-common path: /simphony/cuds/meta/data_set.py from simphony.core import Default # noqa from .cuds_component ...
code_fim
hard
{ "lang": "python", "repo": "jomoeller/simphony-common", "path": "/simphony/cuds/meta/data_set.py", "mode": "spm", "license": "BSD-2-Clause", "source": "the-stack-v2" }
<|fim_suffix|> @classmethod def supported_parameters(cls): try: base_params = super(DataSet, cls).supported_parameters() except AttributeError: base_params = () return tuple(set(() + base_params)) def _init_models(self): self._models = self._default_mo...
code_fim
medium
{ "lang": "python", "repo": "jomoeller/simphony-common", "path": "/simphony/cuds/meta/data_set.py", "mode": "spm", "license": "BSD-2-Clause", "source": "the-stack-v2" }
<|fim_prefix|># repo: jomoeller/simphony-common path: /simphony/cuds/meta/data_set.py from simphony.core import Default # noqa from .cuds_component import CUDSComponent from simphony.core.cuba import CUBA class DataSet(CUDSComponent): <|fim_suffix|> def _default_definition(self): return "A representation...
code_fim
hard
{ "lang": "python", "repo": "jomoeller/simphony-common", "path": "/simphony/cuds/meta/data_set.py", "mode": "psm", "license": "BSD-2-Clause", "source": "the-stack-v2" }
<|fim_prefix|># repo: Uche-Clare/python-challenge-solutions path: /Ekeopara_Praise/Phase 1/Python Basic 2/Day17 Tasks/Task2.py '''2. Write a Python program to create all possible per<|fim_suffix|>rm = permutations(lst) for i in list(perm): print(i)<|fim_middle|>mutations from a given collection of distinct numbers...
code_fim
medium
{ "lang": "python", "repo": "Uche-Clare/python-challenge-solutions", "path": "/Ekeopara_Praise/Phase 1/Python Basic 2/Day17 Tasks/Task2.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|>rm = permutations(lst) for i in list(perm): print(i)<|fim_prefix|># repo: Uche-Clare/python-challenge-solutions path: /Ekeopara_Praise/Phase 1/Python Basic 2/Day17 Tasks/Task2.py '''2. Write a Python program to create all possible per<|fim_middle|>mutations from a given collection of distinct numbers...
code_fim
medium
{ "lang": "python", "repo": "Uche-Clare/python-challenge-solutions", "path": "/Ekeopara_Praise/Phase 1/Python Basic 2/Day17 Tasks/Task2.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> if self.real_star is not None: return f"{self.real_star.hip_number}" return f"x: {self.centroid.x}, y: {self.centroid.y}" def get_unitary_vector(self): f = self.FOCAL_LENGTH x = self.centroid.x - self.CENTER_X y = self.centroid.y - self.CENTER_Y ...
code_fim
hard
{ "lang": "python", "repo": "granasat/startrackerpy", "path": "/startrackerpy/server/startracker/image_star.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: granasat/startrackerpy path: /startrackerpy/server/startracker/image_star.py import math import numpy as np from math import cos, atan, atan2, sin, sqrt, pi class Centroid: def __init__(self, x, y): self.x = x self.y = y class ImageStar: """Represents an image star""" ...
code_fim
hard
{ "lang": "python", "repo": "granasat/startrackerpy", "path": "/startrackerpy/server/startracker/image_star.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> unitary_a = self.get_unitary_vector() unitary_b = star.get_unitary_vector() dab = math.degrees(math.acos(unitary_a[0] * unitary_b[0] + unitary_a[1] * unitary_b[1] + unitary_a[2] * unitary_b[2])) retur...
code_fim
hard
{ "lang": "python", "repo": "granasat/startrackerpy", "path": "/startrackerpy/server/startracker/image_star.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: venkateshwarant/CatchMeIfYouCan path: /Implementation/StatisticalTestToChooseBestAlgorithmForIntruder.py import math from enum import Enum import numpy as np import random as rd import numpy as np import matplotlib.pyplot as plt from numpy import random from scipy import stats from A import A,...
code_fim
hard
{ "lang": "python", "repo": "venkateshwarant/CatchMeIfYouCan", "path": "/Implementation/StatisticalTestToChooseBestAlgorithmForIntruder.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> catching_time_list_1 = runStatisticalTest(Vector3D(0, 0, 0), Vector3D(60, 60, 60), IntruderAlgorithms.ONE) catching_time_list_2 = runStatisticalTest(Vector3D(0, 0, 0), Vector3D(60, 60, 60), IntruderAlgorithms.TWO) catching_time_list = [catching_time_list_1, catching_time_list_2] for i in...
code_fim
hard
{ "lang": "python", "repo": "venkateshwarant/CatchMeIfYouCan", "path": "/Implementation/StatisticalTestToChooseBestAlgorithmForIntruder.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: SysCompass/compass path: /compass/tests/config_management/installers/test_package_installer.py import unittest2 from compass.config_management.installers import package_installer class DummyInstaller(package_installer.Installer): NAME = 'dummy' def __init__(self): pass class...
code_fim
hard
{ "lang": "python", "repo": "SysCompass/compass", "path": "/compass/tests/config_management/installers/test_package_installer.py", "mode": "psm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|> package_installer.INSTALLERS = {} def test_found_installer(self): package_installer.register(DummyInstaller) intaller = package_installer.get_installer_by_name( DummyInstaller.NAME) self.assertIsInstance(intaller, DummyInstaller) def test_notfound_unre...
code_fim
hard
{ "lang": "python", "repo": "SysCompass/compass", "path": "/compass/tests/config_management/installers/test_package_installer.py", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|> def test_notfound_unregistered_installer(self): self.assertRaises(KeyError, package_installer.get_installer_by_name, DummyInstaller.NAME) def test_multi_registered_installer(self): package_installer.register(DummyInstaller) self.assertRaises(KeyEr...
code_fim
hard
{ "lang": "python", "repo": "SysCompass/compass", "path": "/compass/tests/config_management/installers/test_package_installer.py", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|>def remove_veth_pair(nic, peer_ns): exec_cmd(f"ip link del {nic}".split()) exec_cmd(f"ip netns del {peer_ns}".split()) # Use nmstate to ensure nic is deleted instead of using `ip link del` libnmstate.apply( { Interface.KEY: [ { Interf...
code_fim
hard
{ "lang": "python", "repo": "nmstate/nmstate", "path": "/tests/integration/testlib/veth.py", "mode": "spm", "license": "LGPL-2.1-only", "source": "the-stack-v2" }
<|fim_prefix|># repo: nmstate/nmstate path: /tests/integration/testlib/veth.py # SPDX-License-Identifier: LGPL-2.1-or-later from contextlib import contextmanager import libnmstate from libnmstate.schema import Interface from libnmstate.schema import InterfaceState from libnmstate.schema import InterfaceType from lib...
code_fim
medium
{ "lang": "python", "repo": "nmstate/nmstate", "path": "/tests/integration/testlib/veth.py", "mode": "psm", "license": "LGPL-2.1-only", "source": "the-stack-v2" }
<|fim_prefix|># repo: kanzure/python-brlcad path: /brlcad/primitives/superell.py """ Python wrappers for the SUPERELL primitives of BRL-CAD. """ from base import Primitive from brlcad.vmath import Vector class Superell(Primitive): def __init__(self,name, center=(0, 0, 0), a=(1, 0, 0), b=(0, 1, 0), c=(0, 0, 1), n...
code_fim
hard
{ "lang": "python", "repo": "kanzure/python-brlcad", "path": "/brlcad/primitives/superell.py", "mode": "psm", "license": "BSD-3-Clause", "source": "the-stack-v2" }
<|fim_suffix|> return Superell( name=name, center=data.v, a=data.a, b=data.b, c=data.c, n=data.n, e=data.e, )<|fim_prefix|># repo: kanzure/python-brlcad path: /brlcad/primitives/superell.py """ Python wrappers for the SU...
code_fim
hard
{ "lang": "python", "repo": "kanzure/python-brlcad", "path": "/brlcad/primitives/superell.py", "mode": "spm", "license": "BSD-3-Clause", "source": "the-stack-v2" }
<|fim_suffix|> print(dia, mes, ano) a = Data('02/03/2019',28 , 5, 2019, 20) print(a.inicializaData())<|fim_prefix|># repo: matheusscheu/AED2 path: /Tad/TadData.py class Data: def __init__(self, data, dia, mes, ano, dias): self.dia = dia self.mes = mes self.ano = ano self.data = data self.d...
code_fim
medium
{ "lang": "python", "repo": "matheusscheu/AED2", "path": "/Tad/TadData.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> def acrescentaDia(data,dias): x =self.data.split('/') x[0] = dia x[1] = mes x[2] = ano print(dia, mes, ano) a = Data('02/03/2019',28 , 5, 2019, 20) print(a.inicializaData())<|fim_prefix|># repo: matheusscheu/AED2 path: /Tad/TadData.py class Data: def __init__(self, data, ...
code_fim
hard
{ "lang": "python", "repo": "matheusscheu/AED2", "path": "/Tad/TadData.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: matheusscheu/AED2 path: /Tad/TadData.py class Data: def __init__(self, data, dia, mes, ano, dias): self.dia = dia self.mes = mes self.ano = ano self.data = data self.dias = dias <|fim_suffix|> print(dia, mes, ano) a = Data('02/03/2019',28 , 5, 2019, 20) print(a.i...
code_fim
hard
{ "lang": "python", "repo": "matheusscheu/AED2", "path": "/Tad/TadData.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> return _p.createFunction( function,_p.PLATFORM.GL,'GL_ARB_texture_rg',error_checker=_errors._error_checker) GL_R16=_C('GL_R16',0x822A) GL_R16F=_C('GL_R16F',0x822D) GL_R16I=_C('GL_R16I',0x8233) GL_R16UI=_C('GL_R16UI',0x8234) GL_R32F=_C('GL_R32F',0x822E) GL_R32I=_C('GL_R32I',0x8235) GL_R32UI=_C('GL_R32U...
code_fim
medium
{ "lang": "python", "repo": "juso40/bl2sdk_Mods", "path": "/blimgui/dist/OpenGL/raw/GL/ARB/texture_rg.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: juso40/bl2sdk_Mods path: /blimgui/dist/OpenGL/raw/GL/ARB/texture_rg.py '''Autogenerated by xml_generate script, do not edit!''' from OpenGL import platform as _p, arrays # Code generation uses this from OpenGL.raw.GL import _types as _cs # End users want this... from OpenGL.raw.GL._types import *...
code_fim
medium
{ "lang": "python", "repo": "juso40/bl2sdk_Mods", "path": "/blimgui/dist/OpenGL/raw/GL/ARB/texture_rg.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: Victory/realpython-tdd path: /contacts/user_contacts/models.py from django.db import models from user_contacts.validators import ( validate_string, validate_number) <|fim_suffix|> class Phone(models.Model): person = models.ForeignKey('Person') number = models.CharField( ...
code_fim
hard
{ "lang": "python", "repo": "Victory/realpython-tdd", "path": "/contacts/user_contacts/models.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> return self.last_name + ", " + self.first_name class Phone(models.Model): person = models.ForeignKey('Person') number = models.CharField( max_length=15, validators=[validate_number]) def __unicode__(self): return self.number<|fim_prefix|># repo: Victory/realp...
code_fim
hard
{ "lang": "python", "repo": "Victory/realpython-tdd", "path": "/contacts/user_contacts/models.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> person = models.ForeignKey('Person') number = models.CharField( max_length=15, validators=[validate_number]) def __unicode__(self): return self.number<|fim_prefix|># repo: Victory/realpython-tdd path: /contacts/user_contacts/models.py from django.db import models fro...
code_fim
medium
{ "lang": "python", "repo": "Victory/realpython-tdd", "path": "/contacts/user_contacts/models.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: smarek/ci_targets path: /compiled/python/str_literals.py # This is a generated file! Please edit source .ksy file and use kaitai-struct-compiler to rebuild from pkg_resources import parse_version import kaitaistruct from kaitaistruct import KaitaiStruct, KaitaiStream, BytesIO if parse_version(...
code_fim
hard
{ "lang": "python", "repo": "smarek/ci_targets", "path": "/compiled/python/str_literals.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> pass @property def octal_eatup2(self): if hasattr(self, '_m_octal_eatup2'): return self._m_octal_eatup2 if hasattr(self, '_m_octal_eatup2') else None self._m_octal_eatup2 = u"\0022" return self._m_octal_eatup2 if hasattr(self, '_m_octal_eatup2') else N...
code_fim
medium
{ "lang": "python", "repo": "smarek/ci_targets", "path": "/compiled/python/str_literals.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: aniljava/zero-cluster path: /bin/router #!/usr/bin/env python from __future__ import print_function import zmq import random import time import cloudpickle as pickle import sys try: import Queue as queue except: import queue taskdefs = {} tasks = queue.Queue() workers = queue.Queue() wo...
code_fim
hard
{ "lang": "python", "repo": "aniljava/zero-cluster", "path": "/bin/router", "mode": "psm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|> log('[{}] with instance id [{}] registered.'.format(name, instance_id)) if command == b'CALL': call_data = payload[0] if not workers.empty(): worker = workers.get_nowait() workers_set.remove(worker) payload = [ wo...
code_fim
hard
{ "lang": "python", "repo": "aniljava/zero-cluster", "path": "/bin/router", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|> def process(request): address = request[0] command = request[1] payload = request[2:] if command == b'REGISTER': instance_id, encoded_object = payload taskdefs[instance_id] = encoded_object obj = pickle.loads(encoded_object) name = obj...
code_fim
hard
{ "lang": "python", "repo": "aniljava/zero-cluster", "path": "/bin/router", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_prefix|># repo: gozfree/gear-lib path: /build/c_cpp_project_framework/tools/flash/flash.py # # @file from https://github.com/Neutree/c_cpp_project_framework # @author neucrack # @license Apache 2.0 # import argparse import os, sys, time, re, shutil import subprocess from multiprocessing import cpu_count import ...
code_fim
hard
{ "lang": "python", "repo": "gozfree/gear-lib", "path": "/build/c_cpp_project_framework/tools/flash/flash.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> # mask options that not read from file for key in config: if key in dict_arg_not_save: config[key] = dict_arg[key] print("== flash start ==") ############## Add flash command here ################ print("!!! please write flash ops here ...") print("-- flash por...
code_fim
hard
{ "lang": "python", "repo": "gozfree/gear-lib", "path": "/build/c_cpp_project_framework/tools/flash/flash.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: RyanDsilva/blockchain-simulation path: /transaction.py class Transaction: def __init__(self, toAddress, fromAddress, amount): <|fim_suffix|> def __repr__(self): return " <Transaction To:%s\tFrom:%s\tAmount:%s>" % (self.toAddress, self.fromAddress, self.amount)<|fim_middle|> ...
code_fim
medium
{ "lang": "python", "repo": "RyanDsilva/blockchain-simulation", "path": "/transaction.py", "mode": "psm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|> return " <Transaction To:%s\tFrom:%s\tAmount:%s>" % (self.toAddress, self.fromAddress, self.amount)<|fim_prefix|># repo: RyanDsilva/blockchain-simulation path: /transaction.py class Transaction: def __init__(self, toAddress, fromAddress, amount): self.toAddress = toAddress sel...
code_fim
easy
{ "lang": "python", "repo": "RyanDsilva/blockchain-simulation", "path": "/transaction.py", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_prefix|># repo: mardiros/pyramid_asyncio path: /pyramid_asyncio/cache.py import asyncio import simplejson as json from pyramid.events import NewRequest from .kvs import cache, serializer class ApplicationCache(cache.ApplicationCache): @classmethod @asyncio.coroutine def connect(cls, settings): ...
code_fim
hard
{ "lang": "python", "repo": "mardiros/pyramid_asyncio", "path": "/pyramid_asyncio/cache.py", "mode": "psm", "license": "BSD-3-Clause-Modification", "source": "the-stack-v2" }
<|fim_suffix|> settings = config.registry.settings if 'kvs.cache' in settings: yield from ApplicationCache.connect(settings) config.add_subscriber(subscribe_cache, NewRequest)<|fim_prefix|># repo: mardiros/pyramid_asyncio path: /pyramid_asyncio/cache.py import asyncio import simplejson as json ...
code_fim
hard
{ "lang": "python", "repo": "mardiros/pyramid_asyncio", "path": "/pyramid_asyncio/cache.py", "mode": "spm", "license": "BSD-3-Clause-Modification", "source": "the-stack-v2" }
<|fim_suffix|> """Reset instance to the default value or the default to Qutip's default""" if self._isDefault: self.options = self.__class__.options.copy() if _recursive: for child in self._children: child.reset() else: self.options = self._defaultInstance....
code_fim
hard
{ "lang": "python", "repo": "hodgestar/qutip", "path": "/qutip/solve/optionsclass.py", "mode": "spm", "license": "BSD-3-Clause", "source": "the-stack-v2" }
<|fim_suffix|> out = self._fullname + ":\n" longest = max(len(key) for key in self.options) if self.read_only_options: longest_readonly = max(len(key) for key in self.read_only_options) longest = max((longest, longest_readonly)) for key, val in self.options.items(): if isinstance(...
code_fim
hard
{ "lang": "python", "repo": "hodgestar/qutip", "path": "/qutip/solve/optionsclass.py", "mode": "spm", "license": "BSD-3-Clause", "source": "the-stack-v2" }
<|fim_prefix|># repo: hodgestar/qutip path: /qutip/solve/optionsclass.py class AllOptions: """ Class that serve as the parent of all other options class. """ # Temporary patch to make changes in solver's options minimal. # TODO: Follow up PR based on #1812 should replace this. def __init__(se...
code_fim
hard
{ "lang": "python", "repo": "hodgestar/qutip", "path": "/qutip/solve/optionsclass.py", "mode": "psm", "license": "BSD-3-Clause", "source": "the-stack-v2" }
<|fim_suffix|> # Assume: if self-rating is NaN, then this person is a total newbie ssr['rank'] = ssr['rank'].replace('nan', 10) # get the list of players for this team players = self.team_players[team_id] experience_rating = [] draft_rating = [] captain_rating = ...
code_fim
hard
{ "lang": "python", "repo": "sbussmann/buda-ratings", "path": "/src/data/scrape_buda.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }