text
stringlengths
232
16.3k
domain
stringclasses
1 value
difficulty
stringclasses
3 values
meta
dict
<|fim_suffix|> for key, value in pairs.items(): self.assertEqual(config.getKey(key, value), value) for key in exceptionKeys: with self.assertRaises(easydms.config.ErrorConfigKeyNotFound): config.getRequiredKey(key) finally: ...
code_fim
hard
{ "lang": "python", "repo": "pkess/easydms", "path": "/test/test_core.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: appcove/DocStruct path: /Bin/docstruct-instance-status #!/usr/bin/python3 # vim:fileencoding=utf-8:ts=2:sw=2:expandtab # Setup the path import os, os.path, sys; sys.path.insert(1, os.path.abspath(sys.path[0] + "/../Python")) import json from base64 import b64encode try: from DocStruct import...
code_fim
hard
{ "lang": "python", "repo": "appcove/DocStruct", "path": "/Bin/docstruct-instance-status", "mode": "psm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|>groups = {} # Loop over the instances and group them using the EnvironmentID for instance in instances: if 'Instances' in instance and len(instance['Instances']): # Extract the actual instance information i = instance['Instances'][0] if len(i.get('Tags', [])) == 0: if 'Untagged' not i...
code_fim
hard
{ "lang": "python", "repo": "appcove/DocStruct", "path": "/Bin/docstruct-instance-status", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|> def check_collision(self, rect, index): global coins_collected '''Check for the colloision with given rect and remove the coin from the list with the help of index and increase coins_collected Params : Rect, int(index)''' if self.rect.colliderect(rect): ...
code_fim
hard
{ "lang": "python", "repo": "whyadiwhy/Awesome_Python_Scripts", "path": "/PyGamesScripts/Dodge Charger Game/Related_Files/main_game.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> def check_collision(self, rect): global init_time '''Check for the colloision with given rect and reset the x and y position of the heart image and if true return true Params : int(index) Return : boolean''' if self.rect.colliderect(rect): ...
code_fim
hard
{ "lang": "python", "repo": "whyadiwhy/Awesome_Python_Scripts", "path": "/PyGamesScripts/Dodge Charger Game/Related_Files/main_game.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: whyadiwhy/Awesome_Python_Scripts path: /PyGamesScripts/Dodge Charger Game/Related_Files/main_game.py import sqlite3 import pygame import os import sys import random import time from Related_Files.garage_menu import fetch_all_data from Related_Files.garage_menu import COINS from Related_Files.gara...
code_fim
hard
{ "lang": "python", "repo": "whyadiwhy/Awesome_Python_Scripts", "path": "/PyGamesScripts/Dodge Charger Game/Related_Files/main_game.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> for k in range(0, ngen): # a is annealed from 2 to 0 self.a = self.a0 - k * ((self.a0) / (ngen)) # fac is annealed from -1 to -2 to estimate l self.fac = -1 + k * ((-1) / ngen) #----------------------------- ...
code_fim
hard
{ "lang": "python", "repo": "onelieV/neorl", "path": "/build/lib/neorl/evolu/woa.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: onelieV/neorl path: /build/lib/neorl/evolu/woa.py # -*- coding: utf-8 -*- #""" #Created on Thu Dec 3 14:42:29 2020 # #@author: Majdi #""" import random import numpy as np import math import time import joblib class WOA(object): """ Whale Optimization Algorithm ...
code_fim
hard
{ "lang": "python", "repo": "onelieV/neorl", "path": "/build/lib/neorl/evolu/woa.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> """ This exception is raised if the application expects a version number to be present in the config file but does not find one. """ pass<|fim_prefix|># repo: exhuma/config_resolver path: /config_resolver/exc.py """ Exceptions for the config_resolver package """ <|fim_middle|>class...
code_fim
easy
{ "lang": "python", "repo": "exhuma/config_resolver", "path": "/config_resolver/exc.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: exhuma/config_resolver path: /config_resolver/exc.py """ Exceptions for the config_resolver package """ <|fim_suffix|> """ This exception is raised if the application expects a version number to be present in the config file but does not find one. """ pass<|fim_middle|> class...
code_fim
easy
{ "lang": "python", "repo": "exhuma/config_resolver", "path": "/config_resolver/exc.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> """ Return the path to the template as a relative (dir, file_name) pair. The directory returned is relative to the directory containing the class definition of the given object. The method returns None for this directory if the directory is unknown without first s...
code_fim
hard
{ "lang": "python", "repo": "Samsung/Castanets", "path": "/third_party/pystache/specloader.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: Samsung/Castanets path: /third_party/pystache/specloader.py # coding: utf-8 """ This module supports customized (aka special or specified) template loading. """ import os.path from pystache.loader import Loader # TODO: add test cases for this class. class SpecLoader(object): """ Su...
code_fim
hard
{ "lang": "python", "repo": "Samsung/Castanets", "path": "/third_party/pystache/specloader.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: mingquzheye/Neural_Turing_Machine path: /train.py #!/usr/bin/python3 import argparse import datetime import numpy as np import tensorflow as tf import matplotlib.pyplot as plt import tensorflow.keras.backend as K from ntm.ntm import NTM from seqgen import generate_patterns parser = argparse...
code_fim
hard
{ "lang": "python", "repo": "mingquzheye/Neural_Turing_Machine", "path": "/train.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> y_pred = ntm_model(x) rt, r_wt, at, w_wt, Mt = ntm_model.debug_ntm() cmap_jet = plt.get_cmap('jet') cmap_gray = plt.get_cmap('gray') if arg.visualize: fig_ntm, (ax_at, ax_wwt, ax_mt, ax_rwt, ax_rt) = plt.subplots(5, 1) fig_ntm.subplots_adjust(top=0.85, bottom=0.15, le...
code_fim
hard
{ "lang": "python", "repo": "mingquzheye/Neural_Turing_Machine", "path": "/train.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> # axes[0, 1].plot(t, np.sum(i_t[:, :, 1], axis=-1)/1000000, label='Infected GP Seeking') axes[0, 1].plot(t, i_t[:, group, 2] / 100000, label='Infected Hospitalised') axes[0, 1].plot(t, i_t[:, group, 3] / 100000, label='Infected ICU') axes[0, 1].set_ylabel("Serious cases ('0...
code_fim
hard
{ "lang": "python", "repo": "davestrugnell/seir-model", "path": "/seir/utils.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> axes[1, 0].plot(t, np.sum(r_t[:, group, :], axis=-1) / 1000000, label='Recovered Total') axes[1, 0].plot(t, r_t[:, group, 0] / 1000000, label='Recovered Asymptomatic') axes[1, 0].plot(t, r_t[:, group, 1] / 1000000, label='Recovered Symptomatic') axes[1, 0].plot(t, np.sum(r_...
code_fim
hard
{ "lang": "python", "repo": "davestrugnell/seir-model", "path": "/seir/utils.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: davestrugnell/seir-model path: /seir/utils.py import numpy as np import matplotlib.pyplot as plt import matplotlib as mpl import seaborn as sns # make figures sns.set(style='whitegrid') mpl.rcParams['figure.figsize'] = (13, 8) mpl.rcParams['figure.dpi'] = 100 def plot_solution(solution, t, gro...
code_fim
hard
{ "lang": "python", "repo": "davestrugnell/seir-model", "path": "/seir/utils.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: millefalcon/httpx path: /httpx/middleware.py import typing from .models import Request, Response <|fim_suffix|> async def __call__( self, request: Request, get_response: typing.Callable ) -> Response: raise NotImplementedError # pragma: no cover<|fim_middle|>class Middl...
code_fim
easy
{ "lang": "python", "repo": "millefalcon/httpx", "path": "/httpx/middleware.py", "mode": "psm", "license": "BSD-3-Clause", "source": "the-stack-v2" }
<|fim_suffix|> async def __call__( self, request: Request, get_response: typing.Callable ) -> Response: raise NotImplementedError # pragma: no cover<|fim_prefix|># repo: millefalcon/httpx path: /httpx/middleware.py import typing from .models import Request, Response <|fim_middle|> class Middl...
code_fim
easy
{ "lang": "python", "repo": "millefalcon/httpx", "path": "/httpx/middleware.py", "mode": "spm", "license": "BSD-3-Clause", "source": "the-stack-v2" }
<|fim_prefix|># repo: paulross/pprune-calc path: /A340-SBKP/analysis/plot.py """ Plots video data. """ import shutil import sys from analysis import plot_acceleration, plot_angle_of_view, video_data from analysis import plot_aspect from analysis import plot_common from analysis import plot_constants from analysis imp...
code_fim
hard
{ "lang": "python", "repo": "paulross/pprune-calc", "path": "/A340-SBKP/analysis/plot.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> # Print out the markdown tables print() for i, table_fn in enumerate( ( plot_distance.markdown_table_aircraft_start, plot_transits.markdown_table_full_transits, plot_transits.markdown_table_distance_from_start_by_transit, plot_acceleratio...
code_fim
hard
{ "lang": "python", "repo": "paulross/pprune-calc", "path": "/A340-SBKP/analysis/plot.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> def test_complex(self): self.check_as_python((b"", b"foo")) self.check_as_python((b"", b"1")) self.check_as_python([b"2", (b"", b"1")]) self.check_as_python([b"", b"2", (b"", b"1")]) self.check_as_python( [b"", b"1", b"2", [b"30", b"40", b"90"], b"60...
code_fim
hard
{ "lang": "python", "repo": "sielicki/clvm", "path": "/tests/as_python_test.py", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_prefix|># repo: sielicki/clvm path: /tests/as_python_test.py import unittest from clvm import SExp class AsPythonTest(unittest.TestCase): def check_as_python(self, p): v = SExp.to(p) p1 = v.as_python() self.assertEqual(p, p1) def test_null(self): self.check_as_python(b...
code_fim
hard
{ "lang": "python", "repo": "sielicki/clvm", "path": "/tests/as_python_test.py", "mode": "psm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|> self.check_as_python((b"", b"foo")) self.check_as_python((b"", b"1")) self.check_as_python([b"2", (b"", b"1")]) self.check_as_python([b"", b"2", (b"", b"1")]) self.check_as_python( [b"", b"1", b"2", [b"30", b"40", b"90"], b"600", (b"", b"18")] )<...
code_fim
medium
{ "lang": "python", "repo": "sielicki/clvm", "path": "/tests/as_python_test.py", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|> if p.ok: # if it was successful, logs the success and saves status as true logging.basicConfig(filename = 'sync.log', filemode = 'a', format='%(name)s -%(process)d - %(asctime)s - %(levelname)s - %(message)s', level = logging.INFO) logging.info( "title of articl...
code_fim
hard
{ "lang": "python", "repo": "jmrocco/docsupport", "path": "/wordpress/sync.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: jmrocco/docsupport path: /wordpress/sync.py #TODO->Line 54 and 55: Gateway and jwt token #TODO->Line 33: jwt token import logging import requests import json from configparser import ConfigParser import re from wordpress.file_handler import IpfsHandler class syncToKauri(): global status ...
code_fim
hard
{ "lang": "python", "repo": "jmrocco/docsupport", "path": "/wordpress/sync.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: weiweichen-lab1009/Eatender path: /project/food/main.py import random import re import string import sys import threading from datetime import datetime, timedelta from .google_maps.info import GM_Restaurant from .ifoodie.ifoodie import Ifoodie sys.path.append(".") from bson.son import SON from ...
code_fim
hard
{ "lang": "python", "repo": "weiweichen-lab1009/Eatender", "path": "/project/food/main.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> Args: complete_mode (bool, optional): Set it to True to get complete data. Defaults to False. """ if "[|]" not in self.page_token: page_token = self.page_token index = 0 else: page_token, index = self.page_token.split("[|]") ...
code_fim
hard
{ "lang": "python", "repo": "weiweichen-lab1009/Eatender", "path": "/project/food/main.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|>@click.command("environment") @click.argument("name") def delete_environment(name): """Delete environment""" console = Console() try: thread = environmentClient.delete_environment_async(name) timeout = time.time() + TIMEOUT with console.status(f"[bold green] Deleting En...
code_fim
hard
{ "lang": "python", "repo": "apache/submarine", "path": "/submarine-sdk/pysubmarine/submarine/cli/environment/command.py", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_prefix|># repo: apache/submarine path: /submarine-sdk/pysubmarine/submarine/cli/environment/command.py """ Licensed to the Apache Software Foundation (ASF) under one or more contributor license agreements. See the NOTICE file distributed with this work for additional information regarding copyright ownershi...
code_fim
hard
{ "lang": "python", "repo": "apache/submarine", "path": "/submarine-sdk/pysubmarine/submarine/cli/environment/command.py", "mode": "psm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|> """List environment""" COLS_TO_SHOW = ["Name", "Id", "dockerImage"] console = Console() try: thread = environmentClient.list_environments_async() timeout = time.time() + TIMEOUT with console.status("[bold green] Fetching Environments..."): while not thre...
code_fim
hard
{ "lang": "python", "repo": "apache/submarine", "path": "/submarine-sdk/pysubmarine/submarine/cli/environment/command.py", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_prefix|># repo: htomeht/euler path: /002/python/problem2.py #! /bin/env python def fib(upto): n1, n2 = 0, 1 <|fim_suffix|>print sum([x for x in fib(4000000) if (x % 2 == 0)])<|fim_middle|> while n2 < upto: n1, n2 = n2, n1+n2 yield n1
code_fim
easy
{ "lang": "python", "repo": "htomeht/euler", "path": "/002/python/problem2.py", "mode": "psm", "license": "Unlicense", "source": "the-stack-v2" }
<|fim_suffix|>print sum([x for x in fib(4000000) if (x % 2 == 0)])<|fim_prefix|># repo: htomeht/euler path: /002/python/problem2.py #! /bin/env python def fib(upto): <|fim_middle|> n1, n2 = 0, 1 while n2 < upto: n1, n2 = n2, n1+n2 yield n1
code_fim
medium
{ "lang": "python", "repo": "htomeht/euler", "path": "/002/python/problem2.py", "mode": "spm", "license": "Unlicense", "source": "the-stack-v2" }
<|fim_prefix|># repo: ielvisd/Coding_Challenges path: /Other/other.py # def IDsOfPackages(truckSpace, packagesSpace): # # Algorithm # original = packagesSpace.copy() # # Sort the packagesSpace list by size # packagesSpace.sort(reverse=True) # # target = 30 (for safety, per the proble spec) # ...
code_fim
hard
{ "lang": "python", "repo": "ielvisd/Coding_Challenges", "path": "/Other/other.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> optimal_routes_dictionary = { } # Will add arrays into this list when we are done from the optimal_routes dictionary optimal_routes_list = [] max_travel_distance = maxTravelDist length_of_forwardRouteList = len(forwardRouteList) length_of_returnRouteList = len(returnRouteLi...
code_fim
hard
{ "lang": "python", "repo": "ielvisd/Coding_Challenges", "path": "/Other/other.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|>r_ratio=0.2, warmup_factor=0.25, warmup_iterations=27000, policy='MultiStepScheduler') total_epochs = 8<|fim_prefix|># repo: linxi1158/iMIX path: /configs/_base_/schedules/schedule_vqa.py optimizer = dict(type='AdamW', lr=0.00005, weight_decay=0, eps=1e-9, betas=[0.9, 0.98], training_encoder...
code_fim
medium
{ "lang": "python", "repo": "linxi1158/iMIX", "path": "/configs/_base_/schedules/schedule_vqa.py", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_prefix|># repo: linxi1158/iMIX path: /configs/_base_/schedules/schedule_vqa.py optimizer = dict(type='AdamW', lr=0.00005, weight_decay=0, eps=1e-9, betas=[0.9, 0.98], training_encoder_lr_multipl<|fim_suffix|>factor=0.5, growth_interval=2000, ) lr_config = dict( use_warmup=True, lr_steps=[90000, 1080...
code_fim
medium
{ "lang": "python", "repo": "linxi1158/iMIX", "path": "/configs/_base_/schedules/schedule_vqa.py", "mode": "psm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_prefix|># repo: MikulasZelinka/pyfiction path: /pyfiction/games/Six/six.py import os from pyfiction.games.game import Game <|fim_suffix|> def __init__(self): pass name = 'Six' author = 'Wade Clarke' path = os.path.join(os.path.dirname(os.path.abspath(__file__)), 'Six.gblorb') # is...
code_fim
easy
{ "lang": "python", "repo": "MikulasZelinka/pyfiction", "path": "/pyfiction/games/Six/six.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> pass name = 'Six' author = 'Wade Clarke' path = os.path.join(os.path.dirname(os.path.abspath(__file__)), 'Six.gblorb') # issue extra SPACE commands just to be sure startup_actions = [' \n', ' \n', ' \n', ' \n', '1\n', ' \n']<|fim_prefix|># repo: MikulasZelinka/pyfiction path...
code_fim
easy
{ "lang": "python", "repo": "MikulasZelinka/pyfiction", "path": "/pyfiction/games/Six/six.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> # issue extra SPACE commands just to be sure startup_actions = [' \n', ' \n', ' \n', ' \n', '1\n', ' \n']<|fim_prefix|># repo: MikulasZelinka/pyfiction path: /pyfiction/games/Six/six.py import os from pyfiction.games.game import Game <|fim_middle|> class Six(Game): def __init__(self): ...
code_fim
medium
{ "lang": "python", "repo": "MikulasZelinka/pyfiction", "path": "/pyfiction/games/Six/six.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|>ctx.a = cell("int") ctx.a.set(10) ctx.tf = transformer({"a": "input", "aa": "output"}) ctx.tf._debug = { "direct_print" : True } ctx.tf.code.cell().set("print('RUN', a); aa = 2 * a") ctx.a.connect(ctx.tf.a) ctx.aa = cell("int") ctx.tf.aa.connect(ctx.aa) ctx.compute() checksum = ctx.aa.checksum print(c...
code_fim
medium
{ "lang": "python", "repo": "sjdv1982/seamless", "path": "/tests/lowlevel/fingertip.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: sjdv1982/seamless path: /tests/lowlevel/fingertip.py import asyncio, traceback loop = asyncio.get_event_loop() import sys from seamless.core.cache.buffer_cache import buffer_cache, CacheMissError buffer_cache.LIFETIME_TEMP = 0.1 buffer_cache.LIFETIME_TEMP_SMALL = 0.1 buffer_cache.LOCAL_MODE_FULL...
code_fim
hard
{ "lang": "python", "repo": "sjdv1982/seamless", "path": "/tests/lowlevel/fingertip.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> except Exception as e: zu.status = 'Error' zu.details+= '%s\n' % (e,) zu.save() return zu class ZipcodeUpdate(models.Model): """ Zipcode Update """ date_added = models.DateTimeField(auto_now_add=True) status = models.CharFie...
code_fim
hard
{ "lang": "python", "repo": "davisd/django-zipcodes", "path": "/zipcodes/models.py", "mode": "spm", "license": "BSD-3-Clause", "source": "the-stack-v2" }
<|fim_suffix|> return '%s %s' % (self.zipcode,self.location_text,) class ZipcodeUpload(models.Model): """ Zipcode Upload """ csv_file = models.FileField(upload_to='apps/zipcodes/csv') complete_update = models.BooleanField(default=False, help_text='a complete update wi...
code_fim
hard
{ "lang": "python", "repo": "davisd/django-zipcodes", "path": "/zipcodes/models.py", "mode": "spm", "license": "BSD-3-Clause", "source": "the-stack-v2" }
<|fim_prefix|># repo: davisd/django-zipcodes path: /zipcodes/models.py from django.db import models from managers import ZipcodeManager import csv class Zipcode(models.Model): """ Zipcode """ zipcode = models.CharField(db_index=True, max_length=5, unique=True) lat = models.DecimalField(max_digits=...
code_fim
hard
{ "lang": "python", "repo": "davisd/django-zipcodes", "path": "/zipcodes/models.py", "mode": "psm", "license": "BSD-3-Clause", "source": "the-stack-v2" }
<|fim_suffix|> Args: field: The field to sort on. Defaults to 'word' order: The order function or dict to sort by. If it is a dict, it should have key/value pairs corresponding to characters or sequences of characters, and the order they should be sorted ...
code_fim
hard
{ "lang": "python", "repo": "zyxw59/soundchanger", "path": "/conlang/dictionary.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: zyxw59/soundchanger path: /conlang/dictionary.py ame == 'Dictionary': return Dictionary(*value) return dct class DictionaryMethods(object): """Methods for a Dictionary. """ def apply_rule_list(self, lines, field1='pron', field2=None): """Applies a list of s...
code_fim
hard
{ "lang": "python", "repo": "zyxw59/soundchanger", "path": "/conlang/dictionary.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: zyxw59/soundchanger path: /conlang/dictionary.py A DictionaryView containing all the Entries that match the string. """ indices = (i for i, v in enumerate(self) if v.check(s, field, cats)) return DictionaryView(self, indices) def sorted(self, field='word', order=None...
code_fim
hard
{ "lang": "python", "repo": "zyxw59/soundchanger", "path": "/conlang/dictionary.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: pedrudehuere/otftp path: /tests/unit/file_util_test.py import os import unittest as t from unittest import mock from contextlib import contextmanager from io import BytesIO from otftp.file_io import FileReader, FileWriter, sanitize_fname class FileReaderTest(t.TestCase): def setUp(self): ...
code_fim
hard
{ "lang": "python", "repo": "pedrudehuere/otftp", "path": "/tests/unit/file_util_test.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|>class TestSanitizeFname(t.TestCase): @classmethod def setUpClass(cls): from os import getcwd from os.path import join as path_join cls.target_dir = bytes( path_join(getcwd(), 'tmp/testfile'), encoding='ascii') def test_under_root_dir(self): ...
code_fim
hard
{ "lang": "python", "repo": "pedrudehuere/otftp", "path": "/tests/unit/file_util_test.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> def tearDown(self): if os.path.exists(self.filename): os.unlink(self.filename) def test_writes_full_file_to_disk(self): self.writer.write_chunk(self.msg) self.assertTrue(os.path.exists(self.filename)) self.writer._flush() with open(self.filena...
code_fim
hard
{ "lang": "python", "repo": "pedrudehuere/otftp", "path": "/tests/unit/file_util_test.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> # check that it works with assumeRole creator session_factory = self.replay_flight_data("test_ec2_autotag_assumed") policy = self.load_policy( { "name": "ec2-auto-tag", "resource": "ec2", "mode": {"type": "cloudtrail", "ev...
code_fim
hard
{ "lang": "python", "repo": "cloud-custodian/cloud-custodian", "path": "/tests/test_autotag.py", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_prefix|># repo: cloud-custodian/cloud-custodian path: /tests/test_autotag.py works with assumed roles and can optionally update session_factory = self.replay_flight_data("test_ec2_autotag_assumed") policy = self.load_policy( { "name": "ec2-auto-tag", "...
code_fim
hard
{ "lang": "python", "repo": "cloud-custodian/cloud-custodian", "path": "/tests/test_autotag.py", "mode": "psm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_prefix|># repo: cloud-custodian/cloud-custodian path: /tests/test_autotag.py opyright The Cloud Custodian Authors. # SPDX-License-Identifier: Apache-2.0 from c7n.exceptions import PolicyValidationError from c7n.actions import AutoTagUser from c7n.utils import query_instances from .common import BaseTest, event_d...
code_fim
hard
{ "lang": "python", "repo": "cloud-custodian/cloud-custodian", "path": "/tests/test_autotag.py", "mode": "psm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_prefix|># repo: GFZ-Centre-for-Early-Warning/shakyground path: /openquake/hazardlib/contexts.py 18, GEM Foundation # OpenQuake is free software: you can redistribute it and/or modify it # under the terms of the GNU Affero General Public License as published # by the Free Software Foundation, either version 3...
code_fim
hard
{ "lang": "python", "repo": "GFZ-Centre-for-Early-Warning/shakyground", "path": "/openquake/hazardlib/contexts.py", "mode": "psm", "license": "BSD-3-Clause", "source": "the-stack-v2" }
<|fim_prefix|># repo: GFZ-Centre-for-Early-Warning/shakyground path: /openquake/hazardlib/contexts.py nder the terms of the GNU Affero General Public License as published # by the Free Software Foundation, either version 3 of the License, or # (at your option) any later version. # OpenQuake is distributed in the h...
code_fim
hard
{ "lang": "python", "repo": "GFZ-Centre-for-Early-Warning/shakyground", "path": "/openquake/hazardlib/contexts.py", "mode": "psm", "license": "BSD-3-Clause", "source": "the-stack-v2" }
<|fim_suffix|> if sitecol is not None: self.sids = sitecol.sids for name in self._slots_ if slots is None else slots: setattr(self, name, getattr(sitecol, name)) class DistancesContext(BaseContext): """ Distances context for ground shaking intensity models. ...
code_fim
hard
{ "lang": "python", "repo": "GFZ-Centre-for-Early-Warning/shakyground", "path": "/openquake/hazardlib/contexts.py", "mode": "spm", "license": "BSD-3-Clause", "source": "the-stack-v2" }
<|fim_suffix|> """Discriminator, Auxiliary Classifier.""" def __init__(self, batch_size=64, image_size=64, c_dim=5, conv_dim=64): super(Discriminator, self).__init__() self.imsize = image_size layer1 = [] # 3x64x64 -> 64x32x32 layer1.append(SpectralNorm(n...
code_fim
hard
{ "lang": "python", "repo": "ktxlh/sa-stargan", "path": "/sagan_models.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: ktxlh/sa-stargan path: /sagan_models.py import torch import torch.nn as nn import torch.nn.functional as F from torch.autograd import Variable from spectral import SpectralNorm import numpy as np class ResidualBlock(nn.Module): """Residual Block with instance normalization.""" d...
code_fim
hard
{ "lang": "python", "repo": "ktxlh/sa-stargan", "path": "/sagan_models.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> # 256x8x8 -> 512x4x4 layer3 = [] layer3.append(SpectralNorm(nn.Conv2d(curr_dim, curr_dim * 2, 4, 2, 1))) layer3.append(nn.LeakyReLU(0.1)) curr_dim = curr_dim * 2 self.l3 = nn.Sequential(*layer3) #repeat_num = int(np.log2(self.imsize)) - 3 #TO...
code_fim
hard
{ "lang": "python", "repo": "ktxlh/sa-stargan", "path": "/sagan_models.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: bharwani/gpiozero path: /docs/examples/rgbled_pot_2.py from gpiozero import RGBLED, MCP3008 from gpiozero.tools import zip_values from signal import pause <|fim_suffix|>led.source = zip_values(red_pot, green_pot, blue_pot) pause()<|fim_middle|>led = RGBLED(2, 3, 4) red_pot = MCP3008(0) green_po...
code_fim
medium
{ "lang": "python", "repo": "bharwani/gpiozero", "path": "/docs/examples/rgbled_pot_2.py", "mode": "psm", "license": "BSD-3-Clause", "source": "the-stack-v2" }
<|fim_suffix|>led.source = zip_values(red_pot, green_pot, blue_pot) pause()<|fim_prefix|># repo: bharwani/gpiozero path: /docs/examples/rgbled_pot_2.py from gpiozero import RGBLED, MCP3008 from gpiozero.tools import zip_values from signal import pause <|fim_middle|>led = RGBLED(2, 3, 4) red_pot = MCP3008(0) green_po...
code_fim
medium
{ "lang": "python", "repo": "bharwani/gpiozero", "path": "/docs/examples/rgbled_pot_2.py", "mode": "spm", "license": "BSD-3-Clause", "source": "the-stack-v2" }
<|fim_prefix|># repo: lemonnader/LeetCode-Solution-Well-Formed path: /bit-manipulation/0371-sum-of-two-integers.py class Solution: def getSum(self, a: int, b: int) -> int: <|fim_suffix|> # 在 Python 中,只截取低 32 位, # 0xFFFFFFFF 表示的二进制,每个数位都是 1 ,Ox 表示 16 禁止,F 表示 1111,8 个 F 就是 32 个 1 ...
code_fim
hard
{ "lang": "python", "repo": "lemonnader/LeetCode-Solution-Well-Formed", "path": "/bit-manipulation/0371-sum-of-two-integers.py", "mode": "psm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|> # 在 Python 中,只截取低 32 位, # 0xFFFFFFFF 表示的二进制,每个数位都是 1 ,Ox 表示 16 禁止,F 表示 1111,8 个 F 就是 32 个 1 a = temp & 0xFFFFFFFF if a >> 31 == 0: return a return a - (1 << 32)<|fim_prefix|># repo: lemonnader/LeetCode-Solution-Well-Formed path: /bit-manipul...
code_fim
hard
{ "lang": "python", "repo": "lemonnader/LeetCode-Solution-Well-Formed", "path": "/bit-manipulation/0371-sum-of-two-integers.py", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_prefix|># repo: hengrumay/cartoframes path: /cartoframes/utils.py """ private functions used in cartoframes methods """ import pandas as pd def get_auth_client(username=None, api_key=None, baseurl=None, cdb_client=None): """Instantiates a SQL Client from the CARTO Python SDK (v1.0.0) ...
code_fim
hard
{ "lang": "python", "repo": "hengrumay/cartoframes", "path": "/cartoframes/utils.py", "mode": "psm", "license": "BSD-3-Clause", "source": "the-stack-v2" }
<|fim_suffix|> """ Get the geometry type in tablename for storing in dataframe metadata :param sql_auth_client: object SQL Auth client from CARTO Python SDK :param tablename: string Name of table for cartoframe :returns: Geometry type. One of 'point', 'line', 'polygon', or None ...
code_fim
hard
{ "lang": "python", "repo": "hengrumay/cartoframes", "path": "/cartoframes/utils.py", "mode": "spm", "license": "BSD-3-Clause", "source": "the-stack-v2" }
<|fim_suffix|> def df_from_table(query, carto_sql_client, index=None): """ Create a pandas DataFrame from a CARTO table :returns: DataFrame associated with a CARTO table :rtype: cartoframe """ resp = carto_sql_client.send(query) schema = transform_schema(resp['fields']) if index: ...
code_fim
hard
{ "lang": "python", "repo": "hengrumay/cartoframes", "path": "/cartoframes/utils.py", "mode": "spm", "license": "BSD-3-Clause", "source": "the-stack-v2" }
<|fim_suffix|> resp = requests.get(self.fake_vault_url + '/v1/auth/token/lookup-self', headers=headers) assert resp.json() == { 'data': { 'policies': ['default', 'django-consumer'] } } @responses.activate def test_get_ps...
code_fim
hard
{ "lang": "python", "repo": "chr1s-hub/vaultkeeper", "path": "/vaultkeeper/tests/test_fakevault.py", "mode": "spm", "license": "BSD-3-Clause", "source": "the-stack-v2" }
<|fim_suffix|> payload = { 'lease_id': 'database/creds/postgresql_myschema_readonly/lease-id1', 'increment': 30 } resp = requests.put(self.fake_vault_url + '/v1/sys/leases/renew', headers=headers, json...
code_fim
hard
{ "lang": "python", "repo": "chr1s-hub/vaultkeeper", "path": "/vaultkeeper/tests/test_fakevault.py", "mode": "spm", "license": "BSD-3-Clause", "source": "the-stack-v2" }
<|fim_prefix|># repo: chr1s-hub/vaultkeeper path: /vaultkeeper/tests/test_fakevault.py import requests import responses from fake_vault import FakeVault class TestFakeVault(object): def setup(self): self.fake_vault = FakeVault() self.fake_vault.setup() self.fake_vault_url = 'https://test...
code_fim
hard
{ "lang": "python", "repo": "chr1s-hub/vaultkeeper", "path": "/vaultkeeper/tests/test_fakevault.py", "mode": "psm", "license": "BSD-3-Clause", "source": "the-stack-v2" }
<|fim_suffix|>for i in range(-128, 129, 16): for j in range(-128, 129, 16): print(f"execute at @s positioned ~{i} ~ ~{j} unless entity @e[tag=marker,tag=processed,distance=..0.1] run function pin-pack:chunks/populate")<|fim_prefix|># repo: UnsignedByte/pin-pack path: /loadchunks.py # -*- coding: utf-8 -*- ...
code_fim
medium
{ "lang": "python", "repo": "UnsignedByte/pin-pack", "path": "/loadchunks.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: UnsignedByte/pin-pack path: /loadchunks.py # -*- coding: utf-8 -*- # @Author: edl # @Date: 11:59:24, 16-Mar-2020 # @Last Modified by: edl # @Last Modified time: 11:59:51, 16-Mar-2020 <|fim_suffix|>for i in range(-128, 129, 16): for j in range(-128, 129, 16): print(f"execute at @s...
code_fim
medium
{ "lang": "python", "repo": "UnsignedByte/pin-pack", "path": "/loadchunks.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: JonathanKuelz/Advanced_NLP-models path: /DNC/Dataset/NLP/ptb.py import tensorflow as tf import chainer import numpy as np from datasets.text_dataset import TextDataset from embeddings.embedding import GloVeEmbedding class PTB(TextDataset): def __init__( self, ...
code_fim
hard
{ "lang": "python", "repo": "JonathanKuelz/Advanced_NLP-models", "path": "/DNC/Dataset/NLP/ptb.py", "mode": "psm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|> sentences = [] for idx in range(len(eos) - 1): if (eos[idx + 1] - eos[idx] - 1) <= self.sequence_length: # deletes too short sentences continue sentences += list([data[eos[idx] + 1: eos[idx + 1]]]) return tf.data.Dataset.from_generato...
code_fim
hard
{ "lang": "python", "repo": "JonathanKuelz/Advanced_NLP-models", "path": "/DNC/Dataset/NLP/ptb.py", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_prefix|># repo: wardi/seantis-questionnaire path: /example/urls.py from django.conf.urls.defaults import patterns, include, url from django.contrib import admin admin.autodiscover() <|fim_suffix|> url(r'q/', include('questionnaire.urls')), url(r'^take/(?P<questionnaire_id>[0-9]+)/$', 'questionnaire...
code_fim
medium
{ "lang": "python", "repo": "wardi/seantis-questionnaire", "path": "/example/urls.py", "mode": "psm", "license": "BSD-2-Clause", "source": "the-stack-v2" }
<|fim_suffix|> url(r'^take/(?P<questionnaire_id>[0-9]+)/$', 'questionnaire.views.generate_run'), url(r'^$', 'questionnaire.page.views.page', {'page' : 'index'}), url(r'^(?P<page>.*)\.html$', 'questionnaire.page.views.page'), url(r'^(?P<lang>..)/(?P<page>.*)\.html$', 'questionnaire.page.views.langpage'), ...
code_fim
medium
{ "lang": "python", "repo": "wardi/seantis-questionnaire", "path": "/example/urls.py", "mode": "spm", "license": "BSD-2-Clause", "source": "the-stack-v2" }
<|fim_suffix|> url(r'q/', include('questionnaire.urls')), url(r'^take/(?P<questionnaire_id>[0-9]+)/$', 'questionnaire.views.generate_run'), url(r'^$', 'questionnaire.page.views.page', {'page' : 'index'}), url(r'^(?P<page>.*)\.html$', 'questionnaire.page.views.page'), url(r'^(?P<lang>..)/(?P<page...
code_fim
medium
{ "lang": "python", "repo": "wardi/seantis-questionnaire", "path": "/example/urls.py", "mode": "spm", "license": "BSD-2-Clause", "source": "the-stack-v2" }
<|fim_suffix|> def _data_is_temporal(self): self._temporal_data_flag = True self._ui.timeSkip_pushButton.setEnabled(True) def _confirm_and_load(self): if self._temporal_data_flag: self._ui.timePoint_spinBox.setEnabled(True) self._ui.timePoint_label.setEnabled(True...
code_fim
hard
{ "lang": "python", "repo": "mahyar-osn/mapclientplugins.scaffoldrigidalignerstep", "path": "/mapclientplugins/scaffoldrigidalignerstep/view/scaffoldrigidalignerwidget.py", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|> self._model.set_data_axis('Y') def _data_x_up(self): self._model.set_data_axis('X') def _data_upside_down(self): pass def _data_is_partial(self): if self._ui.partialData_checkBox.isChecked(): self._ui.partialZ_lineEdit.setEnabled(True) ...
code_fim
hard
{ "lang": "python", "repo": "mahyar-osn/mapclientplugins.scaffoldrigidalignerstep", "path": "/mapclientplugins/scaffoldrigidalignerstep/view/scaffoldrigidalignerwidget.py", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_prefix|># repo: mahyar-osn/mapclientplugins.scaffoldrigidalignerstep path: /mapclientplugins/scaffoldrigidalignerstep/view/scaffoldrigidalignerwidget.py from PySide import QtGui from .ui_scaffoldrigidalignerwidget import Ui_ScaffoldRigidAlignerWidget from opencmiss.zinchandlers.scenemanipulation import SceneMa...
code_fim
hard
{ "lang": "python", "repo": "mahyar-osn/mapclientplugins.scaffoldrigidalignerstep", "path": "/mapclientplugins/scaffoldrigidalignerstep/view/scaffoldrigidalignerwidget.py", "mode": "psm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_prefix|># repo: chinmoykalita/alphachats path: /AlphaChats/migrations/0004_remove_chat_ip_add.py # Generated by Django 3.2 on 2021-04-28 10:19 <|fim_suffix|> dependencies = [ ('AlphaChats', '0003_chat_ip_address'), ] operations = [ migrations.RemoveField( model_name='chat...
code_fim
medium
{ "lang": "python", "repo": "chinmoykalita/alphachats", "path": "/AlphaChats/migrations/0004_remove_chat_ip_add.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> operations = [ migrations.RemoveField( model_name='chat', name='ip_add', ), ]<|fim_prefix|># repo: chinmoykalita/alphachats path: /AlphaChats/migrations/0004_remove_chat_ip_add.py # Generated by Django 3.2 on 2021-04-28 10:19 from django.db import migratio...
code_fim
medium
{ "lang": "python", "repo": "chinmoykalita/alphachats", "path": "/AlphaChats/migrations/0004_remove_chat_ip_add.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: EvanMu96/human-reid path: /experiments.py torch.div(input, norm) return output def train_softmax(model, criterion, optimizer, trainloader, use_gpu, epoch, num_classes): model.train() model.feature = False trainloss = 0 for batch_idx, (data, labels) in enumerate(trainloader): ...
code_fim
hard
{ "lang": "python", "repo": "EvanMu96/human-reid", "path": "/experiments.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> if self.use_gpu: self.centers = nn.Parameter(torch.randn(self.num_classes, self.feat_dim).cuda()) else: self.centers = nn.Parameter(torch.randn(self.num_classes, self.feat_dim)) def forward(self, x, labels): batch_centers = self....
code_fim
hard
{ "lang": "python", "repo": "EvanMu96/human-reid", "path": "/experiments.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: EvanMu96/human-reid path: /experiments.py def train_softmax(model, criterion, optimizer, trainloader, use_gpu, epoch, num_classes): model.train() model.feature = False trainloss = 0 for batch_idx, (data, labels) in enumerate(trainloader): if use_gpu: data, labe...
code_fim
hard
{ "lang": "python", "repo": "EvanMu96/human-reid", "path": "/experiments.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: wafec/wafec-py-fsm path: /PyFSM/pyfsm/elements/link_element.py from .base_unit import BaseUnit from ..utils import ListUtils from .transport_event import TransportEvent class LinkElement(BaseUnit): def __init__(self): BaseUnit.__init__(self) self.sources = None ...
code_fim
medium
{ "lang": "python", "repo": "wafec/wafec-py-fsm", "path": "/PyFSM/pyfsm/elements/link_element.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> self.sources = ListUtils.add_or_create(self.sources, source) def add_destination(self, destination): self.destinations = ListUtils.add_or_create(self.destinations, destination) def add_guard(self, guard): self.guards = ListUtils.add_or_create(self.guards, guard) ...
code_fim
medium
{ "lang": "python", "repo": "wafec/wafec-py-fsm", "path": "/PyFSM/pyfsm/elements/link_element.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> def add_guard(self, guard): self.guards = ListUtils.add_or_create(self.guards, guard) def add_accept(self, accept): self.accepts = ListUtils.add_or_create(self.accepts, accept) def accept(self, event): self_event = TransportEvent.of(event, self) if Lis...
code_fim
hard
{ "lang": "python", "repo": "wafec/wafec-py-fsm", "path": "/PyFSM/pyfsm/elements/link_element.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: lvgu597/mm_frequency path: /config/cascade_rcnn_r50_detectors_dcn.py _base_ = './cascade_rcnn_r50_fpn_70e_733.py' model = dict( backbone=dict( type='DetectoRS_ResNet', conv_cfg=dict(type='ConvAWS'), sac=dict(type='SAC', use_deform=True), stage_with_sac=(False, ...
code_fim
hard
{ "lang": "python", "repo": "lvgu597/mm_frequency", "path": "/config/cascade_rcnn_r50_detectors_dcn.py", "mode": "psm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|> out_indices=(0, 1, 2, 3), frozen_stages=1, norm_cfg=dict(type='BN', requires_grad=True), norm_eval=True, conv_cfg=dict(type='ConvAWS'), sac=dict(type='SAC', use_deform=True), stage_with_sac=(False, True, True, True), ...
code_fim
hard
{ "lang": "python", "repo": "lvgu597/mm_frequency", "path": "/config/cascade_rcnn_r50_detectors_dcn.py", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_prefix|># repo: ERPGO/odoo-useful-customizations path: /hr_worked_days/models/models.py # -*- coding: utf-8 -*- from odoo import models, fields, api import datetime class PayslipInherit(models.Model): _inherit = 'hr.payslip' <|fim_suffix|> def _compute_working_days(self): now = self.date_f...
code_fim
hard
{ "lang": "python", "repo": "ERPGO/odoo-useful-customizations", "path": "/hr_worked_days/models/models.py", "mode": "psm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|> now = self.date_from businessdays = 0 holidays = [] global_leaves = self.contract_id.resource_calendar_id.global_leave_ids for leave in global_leaves: start_date = leave.date_from.date() end_date = leave.date_to.date() delta = end...
code_fim
hard
{ "lang": "python", "repo": "ERPGO/odoo-useful-customizations", "path": "/hr_worked_days/models/models.py", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|> # shutil.copyfile(file, p3) exit apt_pkg.init() cache = apt_pkg.Cache(None) for k in cache.packages: if k.current_ver: print(k.name) ver = k.current_ver for (file, i) in ver.file_list: print(i, "\t", file.filename) if F...
code_fim
hard
{ "lang": "python", "repo": "kaymccormick/sysconfig", "path": "/sys-config-files.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: kaymccormick/sysconfig path: /sys-config-files.py #!/usr/bin/python3 import shutil import apt_pkg import apt_inst import apt import apt.debfile import apt.progress import aptsources.distinfo import os.path from pathlib import Path cache = apt.Cache() for pkg in cache: if not pkg.installed: ...
code_fim
hard
{ "lang": "python", "repo": "kaymccormick/sysconfig", "path": "/sys-config-files.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: pyne/pyne path: /tests/test_ace.py #!/usr/bin/env python from __future__ import unicode_literals import os import pytest import pyne.ace def setup(): try: import urllib.request as urllib except ImportError: import urllib if not os.path.isfile("C012-n.ace"): ...
code_fim
hard
{ "lang": "python", "repo": "pyne/pyne", "path": "/tests/test_ace.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> c12 = pyne.ace.Library("C012-n-2p0.ace") c12.read() assert "6000.000nc" in c12.tables table = c12.tables["6000.000nc"] assert table.nxs[1] == 38937 assert table.nxs[2] == 6000 assert table.nxs[3] == 1513 assert table.jxs[1] == 1 assert 2 in table.reactions assert...
code_fim
hard
{ "lang": "python", "repo": "pyne/pyne", "path": "/tests/test_ace.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> @param text: the real topic text @param addition: an entity of addition @param year: a (randomly) generated year for the topic addition @param user: the name of the user who likes to add the topic @return: None """ topic = Topic(date=...
code_fim
hard
{ "lang": "python", "repo": "msteinhoff/foption-bot", "path": "/src/python/components/topic.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: msteinhoff/foption-bot path: /src/python/components/topic.py # -*- coding: UTF-8 -*- ''' Created on 30.01.2012 @author: rack ''' import logging from sqlalchemy import func,desc from sqlalchemy.orm.exc import NoResultFound from datetime import date from core import runlevel from ...
code_fim
hard
{ "lang": "python", "repo": "msteinhoff/foption-bot", "path": "/src/python/components/topic.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> parsedmove = parse_move(move, self.turn) self.allmoves += " " + parsedmove s = "position startpos moves%s" % self.allmoves self.engine.stdin.write(s + "\n") self.engine.stdin.write("isready\n") self._poll_until("readyok", 10) if self.turn == "White":...
code_fim
hard
{ "lang": "python", "repo": "agoose77/hivesystem", "path": "/manual/chess/components/UCIChessEngine.py", "mode": "spm", "license": "BSD-2-Clause", "source": "the-stack-v2" }
<|fim_prefix|># repo: agoose77/hivesystem path: /manual/chess/components/UCIChessEngine.py import subprocess, select, time import chesskeeper def parse_move(move, turn): fr, to, special = chesskeeper.parse_move(move, turn) if special in ("O-O", "0-0"): if turn == "White": return "e1g1" ...
code_fim
hard
{ "lang": "python", "repo": "agoose77/hivesystem", "path": "/manual/chess/components/UCIChessEngine.py", "mode": "psm", "license": "BSD-2-Clause", "source": "the-stack-v2" }