text
stringlengths
232
16.3k
domain
stringclasses
1 value
difficulty
stringclasses
3 values
meta
dict
<|fim_suffix|> shandler = logging.StreamHandler(sys.stdout) shandler.setLevel(log_level) shandler.setFormatter(formatter) logger.addHandler(shandler)<|fim_prefix|># repo: zommiommy/soap_incident_client path: /soap_incident_client/utils/logger.py import os import sys import logging logger = logging.getL...
code_fim
medium
{ "lang": "python", "repo": "zommiommy/soap_incident_client", "path": "/soap_incident_client/utils/logger.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|>if __name__ == '__main__': pubsub = PubSubFactory("google") pubsub.Subscribe("devnet_tests_downstream", printlogs) while True: time.sleep(1)<|fim_prefix|># repo: sdgithubber/devnet path: /runner.py from google_pubsub import GooglePubSub import time import pubsub def PubSubFactory(pr...
code_fim
easy
{ "lang": "python", "repo": "sdgithubber/devnet", "path": "/runner.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: sdgithubber/devnet path: /runner.py from google_pubsub import GooglePubSub import time import pubsub <|fim_suffix|> if provider == "google": return GooglePubSub() def printlogs(message): print message if __name__ == '__main__': pubsub = PubSubFactory("google") ...
code_fim
easy
{ "lang": "python", "repo": "sdgithubber/devnet", "path": "/runner.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> def printlogs(message): print message if __name__ == '__main__': pubsub = PubSubFactory("google") pubsub.Subscribe("devnet_tests_downstream", printlogs) while True: time.sleep(1)<|fim_prefix|># repo: sdgithubber/devnet path: /runner.py from google_pubsub import GooglePubSub impo...
code_fim
medium
{ "lang": "python", "repo": "sdgithubber/devnet", "path": "/runner.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: wangxl12/TurtleDraw path: /references/雪花.py import turtle as p import random """turtle.hideturtle() #将画笔隐藏 turtle.setup(width,height,startx,trarty):设置窗体大小 turtle.goto(x,y):直接到达(x,y)位置 turtle.fd(d):朝海龟的正前方前进 turtle.forward(d) 功能类似 turtle.bk(d):朝海龟的后方前进 turtle.forward(d) 功能类似 turtle.circle(r,ang...
code_fim
hard
{ "lang": "python", "repo": "wangxl12/TurtleDraw", "path": "/references/雪花.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> p.setup(800, 600, 0, 0) #设置显示窗口大小,和画笔初始位置 # p.tracer(False) p.bgcolor("black") # p.tracer(False) #设置动画开关,可以用来加速绘画,不显示过程。默认为ture显示过程 snow(30) ground(20) p.mainloop() #画图执行的命令或者p.done() main()<|fim_prefix|># repo: wangxl12/TurtleDraw path: /references/雪花.py import turtle...
code_fim
medium
{ "lang": "python", "repo": "wangxl12/TurtleDraw", "path": "/references/雪花.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|>ts_mock = mocker.patch.object(demisto, 'results') algosec_query() assert results_mock.call_args[0][0]['Contents'] == [{'some_info': 'info: test'}]<|fim_prefix|># repo: demisto/content path: /Packs/Algosec/Scripts/AlgosecQuery/AlgosecQuery_test.py import demistomock as demisto def test_algosec_q...
code_fim
medium
{ "lang": "python", "repo": "demisto/content", "path": "/Packs/Algosec/Scripts/AlgosecQuery/AlgosecQuery_test.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: demisto/content path: /Packs/Algosec/Scripts/AlgosecQuery/AlgosecQuery_test.py import demistomock as demisto def test_algosec_query(mocker): """ Given: - response mock. When: - running AlgosecQuery script. Then: - Ensure that the results were built correc...
code_fim
medium
{ "lang": "python", "repo": "demisto/content", "path": "/Packs/Algosec/Scripts/AlgosecQuery/AlgosecQuery_test.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> def get_environments(self): return self.service_endpoints.keys() def get_services(self, environment=DEFAULT_ENVIRONMENT): return self.service_endpoints[environment].keys() def get_endpoint(self, environment=DEFAULT_ENVIRONMENT, service=None): return self.service_endpo...
code_fim
hard
{ "lang": "python", "repo": "abesto/practical-microservices", "path": "/fibpro/servicedir.py", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_prefix|># repo: abesto/practical-microservices path: /fibpro/servicedir.py from config import (PROD_HOSTNAME, PROD_PORT, DEV_HOSTNAME, SERVICE_CONFIG_FILE, DEFAULT_SERVICE_DIR_ENDPOINT, DEFAULT_ENVIRONMENT) from rpc import Client, Server, ServerConfig from util import load_config, dict_map_string from logsink im...
code_fim
hard
{ "lang": "python", "repo": "abesto/practical-microservices", "path": "/fibpro/servicedir.py", "mode": "psm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|>og2.helpers.js', ] return {'toplinks':a, 'depends':['jquery']}<|fim_prefix|># repo: WisdomZheng/plugs path: /plugs/ui/bootstrap/template_plugins/jqdialog2.py def call(): a = ['bootstrap/jquery.dialog2/jquery.dialog2.css', 'bootstrap/jquery.dialog2/jquery.controls.js', ...
code_fim
medium
{ "lang": "python", "repo": "WisdomZheng/plugs", "path": "/plugs/ui/bootstrap/template_plugins/jqdialog2.py", "mode": "spm", "license": "BSD-3-Clause", "source": "the-stack-v2" }
<|fim_prefix|># repo: WisdomZheng/plugs path: /plugs/ui/bootstrap/template_plugins/jqdialog2.py def call(): a = ['bootstrap/jquery.dialog2/jquery.dialog2.css', 'bootstrap/jquery.dialog2/jquery.controls.js', 'bootstrap/jquer<|fim_suffix|>og2.helpers.js', ] return {'toplinks':a, 'de...
code_fim
medium
{ "lang": "python", "repo": "WisdomZheng/plugs", "path": "/plugs/ui/bootstrap/template_plugins/jqdialog2.py", "mode": "psm", "license": "BSD-3-Clause", "source": "the-stack-v2" }
<|fim_prefix|># repo: satra/nipype path: /nipype/interfaces/tests/test_auto_XNATSink.py # AUTO-GENERATED by tools/checkspecs.py - DO NOT EDIT from __future__ import unicode_literals from ..io import XNATSink <|fim_suffix|> for key, metadata in list(input_map.items()): for metakey, value in list(metadata.it...
code_fim
hard
{ "lang": "python", "repo": "satra/nipype", "path": "/nipype/interfaces/tests/test_auto_XNATSink.py", "mode": "psm", "license": "BSD-3-Clause", "source": "the-stack-v2" }
<|fim_suffix|> best_adv['img'] = current_adv.data.clone() best_adv['original_label'] = orig_l.cpu().numpy() best_adv['adversarial_label'] = pred_l.cpu().numpy() best_adv['distance'] = np.mean((current_adv - orig_x).cpu().numpy()**2) def post_process_reconst(self, reconst, x): ...
code_fim
hard
{ "lang": "python", "repo": "PacktPublishing/Machine-Learning-for-Cybersecurity-Cookbook", "path": "/Chapter08/Testing Adversarial-Robustness of Neural Networks/abs_models/attack_utils.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> def update_adv(self, best_adv, current_adv, pred_l, orig_l, orig_x): best_adv['img'] = current_adv.data.clone() best_adv['original_label'] = orig_l.cpu().numpy() best_adv['adversarial_label'] = pred_l.cpu().numpy() best_adv['distance'] = np.mean((current_adv - orig_x).c...
code_fim
hard
{ "lang": "python", "repo": "PacktPublishing/Machine-Learning-for-Cybersecurity-Cookbook", "path": "/Chapter08/Testing Adversarial-Robustness of Neural Networks/abs_models/attack_utils.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: PacktPublishing/Machine-Learning-for-Cybersecurity-Cookbook path: /Chapter08/Testing Adversarial-Robustness of Neural Networks/abs_models/attack_utils.py import foolbox import foolbox.attacks as fa import numpy as np import torch from abs_models import utils as u from abs_models import models ...
code_fim
hard
{ "lang": "python", "repo": "PacktPublishing/Machine-Learning-for-Cybersecurity-Cookbook", "path": "/Chapter08/Testing Adversarial-Robustness of Neural Networks/abs_models/attack_utils.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: yunqingqing/exercise path: /code/python/day12/day12.py """请实现一个函数,输入一个整数,输出该数二进制表示中的1的个数. """ import unittest def number_of_1(num): count = 0 <|fim_suffix|> self.assertEqual(number_of_1(0), 0) self.assertEqual(number_of_1(1), 1) self.assertEqual(number_of_1(10), 2) ...
code_fim
medium
{ "lang": "python", "repo": "yunqingqing/exercise", "path": "/code/python/day12/day12.py", "mode": "psm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|> def test_1(self): self.assertEqual(number_of_1(0), 0) self.assertEqual(number_of_1(1), 1) self.assertEqual(number_of_1(10), 2) self.assertEqual(number_of_1(0x7FFFFFFF), 31) self.assertEqual(number_of_1(0xFFFFFFFF), 32) if __name__ == '__main__': unittest.m...
code_fim
medium
{ "lang": "python", "repo": "yunqingqing/exercise", "path": "/code/python/day12/day12.py", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_prefix|># repo: kdungs/adventofcode path: /2015/python/22.py from collections import namedtuple from copy import deepcopy import functools as ft import itertools as it Player = namedtuple('Player', ['hp', 'mana', 'armor']) Boss = namedtuple('Boss', ['hp', 'dmg']) def compose(f, g): def compose_impl(*args,...
code_fim
hard
{ "lang": "python", "repo": "kdungs/adventofcode", "path": "/2015/python/22.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|>spells = { 'Magic Missile': { 'cost': 53, 'instant': damage_spell(4) }, 'Drain': { 'cost': 73, 'instant': compose(damage_spell(2), heal_spell(2)) }, 'Shield': { 'cost': 113, 'turns': 6, 'instant': armor_spell(7), 'cleanup'...
code_fim
hard
{ "lang": "python", "repo": "kdungs/adventofcode", "path": "/2015/python/22.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: thoongnv/yosim path: /yosim/locations/migrations/0001_initial.py # -*- coding: utf-8 -*- # Generated by Django 1.10.8 on 2017-12-25 16:33 from __future__ import unicode_literals from django.db import migrations, models import django.db.models.deletion class Migration(migrations.Migration): <|...
code_fim
medium
{ "lang": "python", "repo": "thoongnv/yosim", "path": "/yosim/locations/migrations/0001_initial.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> operations = [ migrations.CreateModel( name='Location', fields=[ ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')), ('name', models.CharField(max_length=128)), ('server', mod...
code_fim
medium
{ "lang": "python", "repo": "thoongnv/yosim", "path": "/yosim/locations/migrations/0001_initial.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> if __name__ == '__main__': app.run(port=5001, debug=True)<|fim_prefix|># repo: marcinbodnar/debugger path: /mock-node/src/near/dash_mock_node/app.py from flask import ( Flask, jsonify, ) from near.dash_mock_node import client app = Flask(__name__) action_fns = { 'get-observer-data': c...
code_fim
medium
{ "lang": "python", "repo": "marcinbodnar/debugger", "path": "/mock-node/src/near/dash_mock_node/app.py", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_prefix|># repo: marcinbodnar/debugger path: /mock-node/src/near/dash_mock_node/app.py from flask import ( Flask, jsonify, ) <|fim_suffix|> @app.route('/<action>', methods=['GET']) def get_action(action): action_fn = action_fns[action] value = action_fn() return jsonify(value) if __name__ =...
code_fim
medium
{ "lang": "python", "repo": "marcinbodnar/debugger", "path": "/mock-node/src/near/dash_mock_node/app.py", "mode": "psm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_prefix|># repo: samuelcolvin/fastapi path: /docs_src/additional_status_codes/tutorial001_an_py39.py from typing import Annotated, Union from fastapi import Body, FastAPI, status from fastapi.responses import JSONResponse <|fim_suffix|>@app.put("/items/{item_id}") async def upsert_item( item_id: str, na...
code_fim
medium
{ "lang": "python", "repo": "samuelcolvin/fastapi", "path": "/docs_src/additional_status_codes/tutorial001_an_py39.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|>@app.put("/items/{item_id}") async def upsert_item( item_id: str, name: Annotated[Union[str, None], Body()] = None, size: Annotated[Union[int, None], Body()] = None, ): if item_id in items: item = items[item_id] item["name"] = name item["size"] = size return...
code_fim
medium
{ "lang": "python", "repo": "samuelcolvin/fastapi", "path": "/docs_src/additional_status_codes/tutorial001_an_py39.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: imdaveho/intermezzo path: /intermezzo/__init__.py import os import platform import intermezzo from ._ffi import ffi PKGPATH = os.path.dirname(os.path.abspath(__file__)) OS = platform.system() ARCH = platform.machine() lib = None # TODO: differentiate between 32-bit and 64-bit if OS == 'Windows...
code_fim
hard
{ "lang": "python", "repo": "imdaveho/intermezzo", "path": "/intermezzo/__init__.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> return lib.RuneWidth(ord(r)) @staticmethod def is_ambiguous_width(r): is_ambiguous = lib.IsAmbiguousWidth(ord(r)) if is_ambiguous == 0: return False elif is_ambiguous == 1: return True @staticmethod def fill_left(s, w): ffi_...
code_fim
hard
{ "lang": "python", "repo": "imdaveho/intermezzo", "path": "/intermezzo/__init__.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: uber/causalml path: /tests/test_datasets.py import pytest from causalml.dataset import ( simulate_nuisance_and_easy_treatment, simulate_hidden_confounder, simulate_randomized_trial, ) from causalml.dataset import ( get_synthetic_preds, get_synthetic_summary, get_synthetic...
code_fim
hard
{ "lang": "python", "repo": "uber/causalml", "path": "/tests/test_datasets.py", "mode": "psm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|> preds_train, preds_valid = get_synthetic_preds_holdout( synthetic_data_func=simulate_nuisance_and_easy_treatment, n=1000, estimators={ "S Learner (LR)": LRSRegressor(), "T Learner (XGB)": XGBTRegressor(), }, ) assert ( preds_trai...
code_fim
hard
{ "lang": "python", "repo": "uber/causalml", "path": "/tests/test_datasets.py", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|>def test_get_synthetic_auuc(): preds_dict = get_synthetic_preds( synthetic_data_func=simulate_nuisance_and_easy_treatment, n=1000, estimators={ "S Learner (LR)": LRSRegressor(), "T Learner (XGB)": XGBTRegressor(), }, ) auuc_df = get_synt...
code_fim
hard
{ "lang": "python", "repo": "uber/causalml", "path": "/tests/test_datasets.py", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|> Parameters ---------- obj : object The object to use to create the seed. bits : nonnegative integer. Number of bits needed for the seed. This function can produce a maximum of 512 bits from a Unicode or string object. Returns ------- seed : integer ...
code_fim
hard
{ "lang": "python", "repo": "mdickinson/pcgrandom", "path": "/pcgrandom/seeding.py", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|> if numbytes > len(digest): raise ValueError( "Cannot provide more than {} bits of seed.".format( 8 * len(digest))) return int.from_bytes(digest[:numbytes], byteorder="big") >> excess raise TypeError( "Unable to create seed from ...
code_fim
hard
{ "lang": "python", "repo": "mdickinson/pcgrandom", "path": "/pcgrandom/seeding.py", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_prefix|># repo: mdickinson/pcgrandom path: /pcgrandom/seeding.py # Copyright 2017 Mark Dickinson # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LI...
code_fim
hard
{ "lang": "python", "repo": "mdickinson/pcgrandom", "path": "/pcgrandom/seeding.py", "mode": "psm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|>delR", "ModelS", "InfoPolicy", "Lenience", "HystericQ", "CommBias", "RandomPolicy", ]<|fim_prefix|># repo: vbhatt-cs/inference-based-messaging path: /signaling-games/algs/__init__.py from .model_free_value import ( IQL, IQ, CentralizedQLearning, InfoQ, ) from .mode...
code_fim
hard
{ "lang": "python", "repo": "vbhatt-cs/inference-based-messaging", "path": "/signaling-games/algs/__init__.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: vbhatt-cs/inference-based-messaging path: /signaling-games/algs/__init__.py from .model_free_value import ( IQL, IQ, CentralizedQLearning, InfoQ, ) from .model_agents im<|fim_suffix|>delR", "ModelS", "InfoPolicy", "Lenience", "HystericQ", "CommBias", "Rando...
code_fim
hard
{ "lang": "python", "repo": "vbhatt-cs/inference-based-messaging", "path": "/signaling-games/algs/__init__.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: MasiCal354/gateflow path: /gateflow/externals/indodax/dataframe.py from .client import IndodaxClient import requests import pandas as pd import numpy as np class IndodaxDataFrame: def __init__(self, key, secret, pairs, requests_session=requests.Session()): self.__cl...
code_fim
hard
{ "lang": "python", "repo": "MasiCal354/gateflow", "path": "/gateflow/externals/indodax/dataframe.py", "mode": "psm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|> pairs = self._get_pairs() client = self._get_client() frames = list() for pair in pairs: currency = pair.split('_')[0] paired_currency = pair.split('_')[1] resp = client.order_history(pair) frame = pd.DataFrame(resp['return']...
code_fim
hard
{ "lang": "python", "repo": "MasiCal354/gateflow", "path": "/gateflow/externals/indodax/dataframe.py", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|> ''' Input is "<neutral> word word </neutral> <positive> word word word </positive> <negative> word word word </negative> word ..." Returns a list of sentences in the format ['word word word', 1] if positive or ['word word word', 0] if neutral or ['word word word', -1] if...
code_fim
hard
{ "lang": "python", "repo": "elisa-aleman/EntropyBasedSVM", "path": "/Posi-Nega-Neutra_Tagged-Sentence-Parsing.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: elisa-aleman/EntropyBasedSVM path: /Posi-Nega-Neutra_Tagged-Sentence-Parsing.py #-*- coding: utf-8 -*- #################################### ########## Training Data ########## #################################### def PosiNegaSentences(comment): ''' Input is "word word <positive> word w...
code_fim
hard
{ "lang": "python", "repo": "elisa-aleman/EntropyBasedSVM", "path": "/Posi-Nega-Neutra_Tagged-Sentence-Parsing.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: yc2013501516/Unofficial-Zhihu-API path: /train_workspace/helper.py # coding: utf-8 import numpy as np import os import string from pai_image import ImageCaptcha from random import choice from tqdm import tqdm from ufzh import zhihu from PIL import Image from io import BytesIO import shutil cha...
code_fim
hard
{ "lang": "python", "repo": "yc2013501516/Unofficial-Zhihu-API", "path": "/train_workspace/helper.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> return file_names # 生成模拟数据,模拟知乎的验证码,只有这样才能获得大量训练数据 def gen_simulated_img(images_path, num_imgs=10000, captcha_num=4, width=150, height=60, font_sizes=range(45,50)): ''' 默认只需要传入生成图片的路径即可,如果路径不存在则新建,如果存在则追加图片(用户可以自行删除已有的图片) ''' if not os.path.exists(images_path): os.makedirs(ima...
code_fim
hard
{ "lang": "python", "repo": "yc2013501516/Unofficial-Zhihu-API", "path": "/train_workspace/helper.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> def mark(num=50): client=zhihu.Zhihu() dirname="mark" if os.path.exists(dirname): shutil.rmtree('mark') os.mkdir(dirname) captchaURL = r"https://www.zhihu.com/captcha.gif?type=login" print("\n\n"+"*"*50) print("开始测试验证码识别功能") for i in tqdm(range(num), ncols=50): ...
code_fim
hard
{ "lang": "python", "repo": "yc2013501516/Unofficial-Zhihu-API", "path": "/train_workspace/helper.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: databill86/HyperFoods path: /src/torch/legacy/nn/Linear.py import math import torch from .Module import Module from .utils import clear class Linear(Module): def __init__(self, inputSize, outputSize, bias=True): super(Linear, self).__init__() self.weight = torch.Tensor(outp...
code_fim
hard
{ "lang": "python", "repo": "databill86/HyperFoods", "path": "/src/torch/legacy/nn/Linear.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> def accGradParameters(self, input, gradOutput, scale=1): assert input.dim() == 2 self.gradWeight.addmm_(scale, gradOutput.t(), input) if self.bias is not None: # update the size of addBuffer if the input is not the same size as the one we had in last updateGradInput...
code_fim
hard
{ "lang": "python", "repo": "databill86/HyperFoods", "path": "/src/torch/legacy/nn/Linear.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: ChrisLR/Python-Roguelike-Template path: /combat/attacks/__init__.py from combat.attacks.melee import Melee<|fim_suffix|>s.ranged import FireWeapon, ThrowWeapon<|fim_middle|>Attack from combat.attacks.unarmed import Punch, Bite, Claw from combat.attack
code_fim
medium
{ "lang": "python", "repo": "ChrisLR/Python-Roguelike-Template", "path": "/combat/attacks/__init__.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|>rt Punch, Bite, Claw from combat.attacks.ranged import FireWeapon, ThrowWeapon<|fim_prefix|># repo: ChrisLR/Python-Roguelike-Template path: /combat/attacks/__init__.py from combat.attacks.melee import Melee<|fim_middle|>Attack from combat.attacks.unarmed impo
code_fim
easy
{ "lang": "python", "repo": "ChrisLR/Python-Roguelike-Template", "path": "/combat/attacks/__init__.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> self.pool = nn.MaxPool2d(kernel_size, stride=stride, padding=padding, dilation=dilation, return_indices=return_indices, ceil_mode=ceil_mode) def forward(self, x): (*batch, height, width, channels) = x.shape x = x.view(-1, height, width, channels) ...
code_fim
hard
{ "lang": "python", "repo": "cbarrick/toys", "path": "/toys/layers/pool.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: cbarrick/toys path: /toys/layers/pool.py from typing import Sequence import torch from torch import nn class MaxPool2d(nn.Module): def __init__(self, kernel_size, **kwargs): super().__init__() stride = kwargs.setdefault('stride', kernel_size) padding = kwargs.setdef...
code_fim
medium
{ "lang": "python", "repo": "cbarrick/toys", "path": "/toys/layers/pool.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> datasetID = parsedResponseProject.json()['dataSets'][i]['id']; if datasetID == None: return None return datasetID; def getFieldID(self,fieldName,parsedResponseProject): datasetID = None for i in range(0,parsedResponseProject.json()['f...
code_fim
hard
{ "lang": "python", "repo": "AlanRosenthal/iSENSE-API", "path": "/Python/class/API.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> r = requests.post(url, data=json.dumps(payload), headers=headers) def postDatasetHorizontal(self,fields,title,data): timestamp = time.time() timestamp_reformatted = datetime.datetime.fromtimestamp(timestamp).strftime('%Y-%m-%d %H:%M:%S') parsedResponseProject = self.p...
code_fim
hard
{ "lang": "python", "repo": "AlanRosenthal/iSENSE-API", "path": "/Python/class/API.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: AlanRosenthal/iSENSE-API path: /Python/class/API.py import requests,json,time,datetime baseUrl = 'http://rsense-dev.cs.uml.edu/api/v1/'; class Isense: def __init__(self,projectID,contributorKey,contributorName): self.projectID = projectID self.contributorKey = contributorKe...
code_fim
hard
{ "lang": "python", "repo": "AlanRosenthal/iSENSE-API", "path": "/Python/class/API.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: uehara1414/anime-face-collector path: /api/image.py from PIL import Image import cv2 import requests from .util import get_suffix class InvalidImageFormatError(BaseException): pass <|fim_suffix|> if cropped.size[0] <= min_size[0] or cropped.size[1] <= min_size[1]: raise Invalid...
code_fim
hard
{ "lang": "python", "repo": "uehara1414/anime-face-collector", "path": "/api/image.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> ret = requests.get(link, allow_redirects=False) suffix = get_suffix(link) if not suffix: raise InvalidImageFormatError("不正なファイルです ( 処理が面倒くさいから省いてるだけ )") filename = "images/tmp/tmp{}".format(suffix) open(filename, "wb").write(ret.content) return filename<|fim_prefix|># rep...
code_fim
hard
{ "lang": "python", "repo": "uehara1414/anime-face-collector", "path": "/api/image.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> suffix = get_suffix(link) if not suffix: raise InvalidImageFormatError("不正なファイルです ( 処理が面倒くさいから省いてるだけ )") filename = "images/tmp/tmp{}".format(suffix) open(filename, "wb").write(ret.content) return filename<|fim_prefix|># repo: uehara1414/anime-face-collector path: /api/image....
code_fim
medium
{ "lang": "python", "repo": "uehara1414/anime-face-collector", "path": "/api/image.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: NeoGeographyToolkit/StereoPipeline path: /src/asp/IceBridge/gen_ortho.py asepath + '/../bin') # for packaged ASP icebridgepath = os.path.abspath(basepath + '/../IceBridge') # IceBridge tools toolspath = os.path.abspath(basepath + '/../Tools') # ASP Tools # Prepend to Python path...
code_fim
hard
{ "lang": "python", "repo": "NeoGeographyToolkit/StereoPipeline", "path": "/src/asp/IceBridge/gen_ortho.py", "mode": "psm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|> # There is no need for this file to exist unless it is stray junk if os.path.exists(tempOrtho): os.remove(tempOrtho) # If needed, generate a temporary camera file to correct a mounting rotation. # - When the camera mount is rotated 90 degree...
code_fim
hard
{ "lang": "python", "repo": "NeoGeographyToolkit/StereoPipeline", "path": "/src/asp/IceBridge/gen_ortho.py", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|>def sanitise(row): return tuple(int(b) if type(b) == numpy.bool_ else b for b in row) hdf_table = f['variants'] names = [name.lower() if name in ['CHROM', 'POS'] else name for name, dtype in hdf_table.dtype.descr] types = [dtype_to_column_type(dtype) for name, dtype in hdf_table.dtype.descr] columns...
code_fim
hard
{ "lang": "python", "repo": "pombredanne/panoptes", "path": "/importscripts/HDF5_to_SQL.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|>subs = ','.join(['%s ' for name in names]) names = ','.join(names) pbar = pb.ProgressBar(widgets=widgets, maxval=len(hdf_table)).start() step_size = 500 for start in range(0, len(hdf_table), step_size): end = min(start + step_size, len(hdf_table)) cur.executemany("INSERT INTO "+table+" (" + names...
code_fim
hard
{ "lang": "python", "repo": "pombredanne/panoptes", "path": "/importscripts/HDF5_to_SQL.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: pombredanne/panoptes path: /importscripts/HDF5_to_SQL.py #!/usr/bin/python import MySQLdb import h5py import re import progressbar as pb import numpy widgets = ['Load table:', ' ', pb.Percentage(), ' ', pb.Counter(), ' ', pb.Bar(marker=pb.RotatingMarker()), ' ', pb.ETA(), ' ', pb.File...
code_fim
hard
{ "lang": "python", "repo": "pombredanne/panoptes", "path": "/importscripts/HDF5_to_SQL.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> """ Asks the management script to re-sync the database. Having test-only models is a pain. """ apps.clear_cache() call_command('migrate', interactive=False, verbosity=0) call_command('loaddata', 'initial_data', verbosity=0) super(DatatableViewTestCa...
code_fim
hard
{ "lang": "python", "repo": "Mogost/django-datatable-view", "path": "/datatableview/tests/testcase.py", "mode": "spm", "license": "LicenseRef-scancode-warranty-disclaimer", "source": "the-stack-v2" }
<|fim_suffix|> def _pre_setup(self): """ Asks the management script to re-sync the database. Having test-only models is a pain. """ apps.clear_cache() call_command('migrate', interactive=False, verbosity=0) call_command('loaddata', 'initial_data', verbosity=0) ...
code_fim
medium
{ "lang": "python", "repo": "Mogost/django-datatable-view", "path": "/datatableview/tests/testcase.py", "mode": "spm", "license": "LicenseRef-scancode-warranty-disclaimer", "source": "the-stack-v2" }
<|fim_prefix|># repo: Mogost/django-datatable-view path: /datatableview/tests/testcase.py from django.apps import apps from django.core.management import call_command from django.test import TestCase, override_settings <|fim_suffix|> def _pre_setup(self): """ Asks the management script to re-sync t...
code_fim
hard
{ "lang": "python", "repo": "Mogost/django-datatable-view", "path": "/datatableview/tests/testcase.py", "mode": "psm", "license": "LicenseRef-scancode-warranty-disclaimer", "source": "the-stack-v2" }
<|fim_suffix|> for x in key: keylist.append(associations.find(x)) if inp=="e": sumlist=[] for x in range(0,len(message)): sumlist.append(keylist[x]+messagelist[x]) for x in sumlist: sys.stdout.write(associations[x%85]) print("\n") if inp==...
code_fim
hard
{ "lang": "python", "repo": "APikielny/Cryptography", "path": "/cryptography.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: APikielny/Cryptography path: /cryptography.py """ cryptography.py Author: Adam Pikielny Credit: http://www.tutorialspoint.com/python/string_len.htm Assignment: Write and submit a program that encrypts and decrypts user data. <|fim_suffix|> for x in key: keylist.append(associations.f...
code_fim
hard
{ "lang": "python", "repo": "APikielny/Cryptography", "path": "/cryptography.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> def __str__(self): return str(self.member_name)+"age: " + str(self.age)+ ",has glasses: " +str(self.has_glasses)<|fim_prefix|># repo: ydang5/week-10-assignment path: /api_mil_recruit/milrecruit/foundation/models.py from django.db import models # Create your models here. class MilitaryDb(mod...
code_fim
medium
{ "lang": "python", "repo": "ydang5/week-10-assignment", "path": "/api_mil_recruit/milrecruit/foundation/models.py", "mode": "spm", "license": "BSD-3-Clause", "source": "the-stack-v2" }
<|fim_prefix|># repo: ydang5/week-10-assignment path: /api_mil_recruit/milrecruit/foundation/models.py from django.db import models # Create your models here. class MilitaryDb(models.Model): <|fim_suffix|> return str(self.member_name)+"age: " + str(self.age)+ ",has glasses: " +str(self.has_glasses)<|fim_middl...
code_fim
hard
{ "lang": "python", "repo": "ydang5/week-10-assignment", "path": "/api_mil_recruit/milrecruit/foundation/models.py", "mode": "psm", "license": "BSD-3-Clause", "source": "the-stack-v2" }
<|fim_prefix|># repo: dfd/sktutor path: /tests/test_pipeline.py #!/usr/bin/env python # -*- coding: utf-8 -*- import pytest from sktutor.preprocessing import (GroupByImputer, MissingValueFiller, ColumnExtractor, ColumnDropper) from sktutor.pipeline import (FeatureUnion, make_union) ...
code_fim
hard
{ "lang": "python", "repo": "dfd/sktutor", "path": "/tests/test_pipeline.py", "mode": "psm", "license": "BSD-3-Clause", "source": "the-stack-v2" }
<|fim_suffix|> # Test make_union CONTINUOUS_FIELDS = missing_data.select_dtypes( ['int64', 'float64']).columns.tolist() FACTOR_FIELDS = missing_data.select_dtypes(['object']).columns CONTINUOUS_FIELDS.append('b') fu = make_union( make_pipeline( ...
code_fim
hard
{ "lang": "python", "repo": "dfd/sktutor", "path": "/tests/test_pipeline.py", "mode": "spm", "license": "BSD-3-Clause", "source": "the-stack-v2" }
<|fim_suffix|> CONTINUOUS_FIELDS = missing_data.select_dtypes( ['int64', 'float64']).columns.tolist() FACTOR_FIELDS = missing_data.select_dtypes(['object']).columns CONTINUOUS_FIELDS.append('b') fu = FeatureUnion( [('Continuous Pipeline', make_pipeline( ...
code_fim
hard
{ "lang": "python", "repo": "dfd/sktutor", "path": "/tests/test_pipeline.py", "mode": "spm", "license": "BSD-3-Clause", "source": "the-stack-v2" }
<|fim_suffix|> super(BookForm, self).__init__(*args, **kwargs) self.fields['title'].widget.attrs.update({'class': 'form-control'}) self.fields['cover'].widget.attrs.update( {'class': 'form-control-file'}) self.fields['authors'].widget.attrs.update({'class': 'form-control'}) ...
code_fim
medium
{ "lang": "python", "repo": "TeraDew/DjangoNovelSite", "path": "/novel/forms.py", "mode": "spm", "license": "BSD-3-Clause", "source": "the-stack-v2" }
<|fim_suffix|>class CategoryForm(forms.ModelForm): class Meta: model = Category fields = ['name']<|fim_prefix|># repo: TeraDew/DjangoNovelSite path: /novel/forms.py from novel.models import Book, Author, Category from django import forms class BookForm(forms.ModelForm): <|fim_middle|> class Me...
code_fim
hard
{ "lang": "python", "repo": "TeraDew/DjangoNovelSite", "path": "/novel/forms.py", "mode": "spm", "license": "BSD-3-Clause", "source": "the-stack-v2" }
<|fim_prefix|># repo: TeraDew/DjangoNovelSite path: /novel/forms.py from novel.models import Book, Author, Category from django import forms class BookForm(forms.ModelForm): class Meta: model = Book fields = ['title', 'cover', 'authors', 'intro', 'category'] <|fim_suffix|> super(BookForm,...
code_fim
medium
{ "lang": "python", "repo": "TeraDew/DjangoNovelSite", "path": "/novel/forms.py", "mode": "psm", "license": "BSD-3-Clause", "source": "the-stack-v2" }
<|fim_suffix|> signed_tx = web3.eth.account.signTransaction(tx, fromPrivateKey) tx_hash = web3.eth.sendRawTransaction(signed_tx.rawTransaction)<|fim_prefix|># repo: picaproject/wallet path: /withdraw/BEP20/bnb_withdraw.py from web3 import Web3, HTTPProvider from web3.middleware import geth_poa_middleware ...
code_fim
hard
{ "lang": "python", "repo": "picaproject/wallet", "path": "/withdraw/BEP20/bnb_withdraw.py", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_prefix|># repo: picaproject/wallet path: /withdraw/BEP20/bnb_withdraw.py from web3 import Web3, HTTPProvider from web3.middleware import geth_poa_middleware <|fim_suffix|> signed_tx = web3.eth.account.signTransaction(tx, fromPrivateKey) tx_hash = web3.eth.sendRawTransaction(signed_tx.rawTransaction...
code_fim
hard
{ "lang": "python", "repo": "picaproject/wallet", "path": "/withdraw/BEP20/bnb_withdraw.py", "mode": "psm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|> t_start, t_stop): # not supported return None ### # event and epoch zone def _event_count(self, block_index, seg_index, event_channel_index): # Retrieve size of either event or epoch channel: # event_channel_index: 0 AxoGrap...
code_fim
hard
{ "lang": "python", "repo": "NeuralEnsemble/python-neo", "path": "/neo/rawio/axographrawio.py", "mode": "spm", "license": "BSD-3-Clause", "source": "the-stack-v2" }
<|fim_suffix|> for key, fmt in GroupHeaderDescription: group_header_info[key] = f.read_f(fmt) # AxoGraph groups are 0-indexed in GUI, so use i below group_header_info_list[i] = group_header_info self.logger.debug(gro...
code_fim
hard
{ "lang": "python", "repo": "NeuralEnsemble/python-neo", "path": "/neo/rawio/axographrawio.py", "mode": "spm", "license": "BSD-3-Clause", "source": "the-stack-v2" }
<|fim_prefix|># repo: NeuralEnsemble/python-neo path: /neo/rawio/axographrawio.py - AxoGraph X User Manual, provided with AxoGraph and also available online: https://axograph.com/documentation/AxoGraph%20User%20Manual.pdf - AxoGraph_ReadWrite.h, a header file that is part of a C++ program provided ...
code_fim
hard
{ "lang": "python", "repo": "NeuralEnsemble/python-neo", "path": "/neo/rawio/axographrawio.py", "mode": "psm", "license": "BSD-3-Clause", "source": "the-stack-v2" }
<|fim_suffix|> return json.dumps(loaded, indent=2)<|fim_prefix|># repo: port-zero/lens path: /lens/parsers/json.py import json from pygments.lexers.data import JsonLexer from lens.parsers.base import LensParser class Parser(LensParser): lexer = JsonLexer def treat(self, inpt, keys): loaded ...
code_fim
easy
{ "lang": "python", "repo": "port-zero/lens", "path": "/lens/parsers/json.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: port-zero/lens path: /lens/parsers/json.py import json from pygments.lexers.data import JsonLexer from lens.parsers.base import LensParser class Parser(LensParser): <|fim_suffix|> return json.dumps(loaded, indent=2)<|fim_middle|> lexer = JsonLexer def treat(self, inpt, keys): ...
code_fim
medium
{ "lang": "python", "repo": "port-zero/lens", "path": "/lens/parsers/json.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> loaded = json.loads(inpt) for key in keys: loaded = loaded[key] return json.dumps(loaded, indent=2)<|fim_prefix|># repo: port-zero/lens path: /lens/parsers/json.py import json from pygments.lexers.data import JsonLexer <|fim_middle|>from lens.parsers.base import L...
code_fim
medium
{ "lang": "python", "repo": "port-zero/lens", "path": "/lens/parsers/json.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> # Open file and extract lines with open(file, "r") as f: lines = f.readlines() # Loop through equation lines for el in eq_lines: # Modify lines lines[el] = "$${#eq:" + f"{prefix}_eq" + str(eq_num).zfill(2) + "}\n" eq_num += 1 # Write file with open...
code_fim
hard
{ "lang": "python", "repo": "mrazomej/phd", "path": "/src/add_eq_labels.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: mrazomej/phd path: /src/add_eq_labels.py # %% import numpy as np import os import glob import re # %% # Define chapter chapter = "chapter_05" prefix = "ch5" # List files files = np.sort(glob.glob(f"{chapter}/*md")) # %% # Define regex pattern to find pattern = re.compile("\$\$") # Initialize...
code_fim
medium
{ "lang": "python", "repo": "mrazomej/phd", "path": "/src/add_eq_labels.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: MD2Korg/memphis-dataprocessingframework path: /code/functions/ExtractDatabase/ExtractDatabase.py ############################################################################### # Copyright 2014 University of Memphis # # Licensed under the Apache License, Version 2.0 (the "License"); # you may...
code_fim
hard
{ "lang": "python", "repo": "MD2Korg/memphis-dataprocessingframework", "path": "/code/functions/ExtractDatabase/ExtractDatabase.py", "mode": "psm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|> x = r.fetchall() print >> fout, string.join(fieldnames,',') for line in x: stroutput = [] for ind,part in enumerate(line): if ind == idfieldind: continue if isinstance(part,unicode): stroutput.append(str(part)) elif isinstance(part,str): stroutp...
code_fim
hard
{ "lang": "python", "repo": "MD2Korg/memphis-dataprocessingframework", "path": "/code/functions/ExtractDatabase/ExtractDatabase.py", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|> df = df.fillna(0.0) y_test = df.sim.values.tolist() y_predict = df.predict.values.tolist() y_score = df.usim.values.tolist() return y_test, y_predict, y_score def main(): parser = argparse.ArgumentParser(description='RUSSE Evaluation Script. See http://russe.nlpub.ru for mor...
code_fim
hard
{ "lang": "python", "repo": "nlpub/russe-evaluation", "path": "/russe/evaluation/evaluate.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: nlpub/russe-evaluation path: /russe/evaluation/evaluate.py #!/usr/bin/env python import argparse from pandas import read_csv from scipy.stats import pearsonr, spearmanr from os.path import splitext import matplotlib matplotlib.use('Agg') import matplotlib.pyplot as plt import numpy as np from sk...
code_fim
hard
{ "lang": "python", "repo": "nlpub/russe-evaluation", "path": "/russe/evaluation/evaluate.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> parser = argparse.ArgumentParser(description='RUSSE Evaluation Script. See http://russe.nlpub.ru for more details.') subparsers = parser.add_subparsers(description='Help for subcommand.') parser_hj = subparsers.add_parser('hj', description='Evaluation based on correlations with human judgemen...
code_fim
hard
{ "lang": "python", "repo": "nlpub/russe-evaluation", "path": "/russe/evaluation/evaluate.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> ''' Gaussian CDF. ''' return 0.5 * (1 + torch.erf(x / math.sqrt(2))) # TODO: How? def _apply(self, fn): super(FeatureSelector, self)._apply(fn) self.noise = fn(self.noise) return self def get_gates(self, mode): if mode == 'raw': return...
code_fim
medium
{ "lang": "python", "repo": "bmistry4/nalu-stable-exp-neurips-review", "path": "/stable_nalu/layer/unused/feature_selector.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: bmistry4/nalu-stable-exp-neurips-review path: /stable_nalu/layer/unused/feature_selector.py import torch.nn as nn import torch import math import numpy as np """ Ack: Paper: https://arxiv.org/pdf/1810.04247.pdf (Feature Selection using Stochastic Gates) Code: https://github.com/runopti/stg/blob/...
code_fim
hard
{ "lang": "python", "repo": "bmistry4/nalu-stable-exp-neurips-review", "path": "/stable_nalu/layer/unused/feature_selector.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> def forward(self, prev_x): z = self.mu + self.sigma * self.noise.normal_() * self.training stochastic_gate = self.hard_sigmoid(z) new_x = prev_x * stochastic_gate return new_x def hard_sigmoid(self, x): return torch.clamp(x + 0.5, 0.0, 1.0) def regular...
code_fim
hard
{ "lang": "python", "repo": "bmistry4/nalu-stable-exp-neurips-review", "path": "/stable_nalu/layer/unused/feature_selector.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> return Convert.to_list('onedrive', data_ac_sh) # fld = folder # act = action def set_act(self, p_act): if p_act == 'upload': self.up_files() # [OK] if p_act == 'download': self.dw_files() # [OK] if p_act == 'delete': ...
code_fim
hard
{ "lang": "python", "repo": "john-mestas-t/impi-core", "path": "/BL_Server_Sharing.py", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|> ls_it = DB_Item.select('all') ls_it = ls_it.where( (Items.id_account == self.id_ac) & (Items.type_item == 'FOLDER') & (Items.name_item == nm_fld) & (Items.ph_item_ser == ph_fld) & (Items.id_oned == id_fld) ) if ls...
code_fim
hard
{ "lang": "python", "repo": "john-mestas-t/impi-core", "path": "/BL_Server_Sharing.py", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_prefix|># repo: john-mestas-t/impi-core path: /BL_Server_Sharing.py from BL_Item import * from BL_Server_Sharing_Utils import * from DB_Controlers import * class ServerSharing(object): def __init__(self): pass def start_engine(self): # self.init_actio_server('download') self.in...
code_fim
hard
{ "lang": "python", "repo": "john-mestas-t/impi-core", "path": "/BL_Server_Sharing.py", "mode": "psm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|> def test_stay(self): assert self.rook.move_check((3, 4)) == 'I' @pytest.mark.parametrize('pos', wrong_poses) def test_wrong_moves(self, pos): assert self.rook.move_check(pos) == 'I' class TestBishop(TestCase): bishop = Figure(True, 'bishop', 'N', (6, 4)) combo = {*[(...
code_fim
hard
{ "lang": "python", "repo": "Pythongor/Chess-DRF", "path": "/ChessDRF/logic/tests/test_figures.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: Pythongor/Chess-DRF path: /ChessDRF/logic/tests/test_figures.py from itertools import product import pytest from ..figure import Figure class TestCase: pass class TestKing(TestCase): king = Figure(False, 'king', 'N', (1, 4)) start_king = Figure(True, 'king', 'S', (0, 4)) combo...
code_fim
hard
{ "lang": "python", "repo": "Pythongor/Chess-DRF", "path": "/ChessDRF/logic/tests/test_figures.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> class TestKnight(TestCase): knight = Figure(True, 'knight', 'N', (4, 4)) combo = *product((1, -1), (2, -2)), *product((2, -2), (1, -1)) combo = {(i[0] + 4, i[1] + 4) for i in combo} @pytest.mark.parametrize('pos', combo) def test_move(self, pos): assert self.knight.move_check...
code_fim
hard
{ "lang": "python", "repo": "Pythongor/Chess-DRF", "path": "/ChessDRF/logic/tests/test_figures.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> if num_major / num_all < 0.9: inconsis += 1 continue if num_all == 1: if base in alt: osa += 1 elif base in ref: osr += 1 else: if base in alt: msa += 1 elif bas...
code_fim
hard
{ "lang": "python", "repo": "HaoKuo/MrBam", "path": "/MrBam/count.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: HaoKuo/MrBam path: /MrBam/count.py from collections import Counter def count_different_type(o, pairs, single, alt, ref): mor, mnr, msr, oor, onr, osr, moa, mna, msa, ooa, ona, osa, inconsis = 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 <|fim_suffix|> for reads in single.values(): c = C...
code_fim
hard
{ "lang": "python", "repo": "HaoKuo/MrBam", "path": "/MrBam/count.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> if num_all == 1: if base in alt: osa += 1 elif base in ref: osr += 1 else: if base in alt: msa += 1 elif base in ref: msr += 1 return mor, mnr, msr, oor, onr, osr, moa, mna,...
code_fim
hard
{ "lang": "python", "repo": "HaoKuo/MrBam", "path": "/MrBam/count.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }