text
stringlengths
232
16.3k
domain
stringclasses
1 value
difficulty
stringclasses
3 values
meta
dict
<|fim_prefix|># repo: vgrem/Office365-REST-Python-Client path: /examples/sharepoint/folders/folder_exists.py """ How to determine whether folder exist? """ from office365.sharepoint.client_context import ClientContext from tests import te<|fim_suffix|>r_path = "SitePages" folder = ctx.web.get_folder_by_server_relativ...
code_fim
medium
{ "lang": "python", "repo": "vgrem/Office365-REST-Python-Client", "path": "/examples/sharepoint/folders/folder_exists.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: greendwin/puzzles path: /ProjectEuler/Task018_067_MaximumPathSum.py from collections import Counter def iterRows(path): with open(path) as f: for line in f: yield map(int, line.strip().split()) def process(path): prev = Counter() next = Counter() <|fim_suffix|...
code_fim
medium
{ "lang": "python", "repo": "greendwin/puzzles", "path": "/ProjectEuler/Task018_067_MaximumPathSum.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|>if __name__ == '__main__': print process('task018_example.txt') print process('task018_input.txt') print process('task018_067_input.txt')<|fim_prefix|># repo: greendwin/puzzles path: /ProjectEuler/Task018_067_MaximumPathSum.py from collections import Counter def iterRows(path): with ope...
code_fim
medium
{ "lang": "python", "repo": "greendwin/puzzles", "path": "/ProjectEuler/Task018_067_MaximumPathSum.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: blocus/naturalSim path: /pixie.py from utils import * import random import numpy as np class Pixie: def __init__(self, canvas, x, y): self.x = x self.y = y self.r = 3 self.speed = int(random.random() * 5) + 1 xS = self.x - self.r xE = self.x + ...
code_fim
hard
{ "lang": "python", "repo": "blocus/naturalSim", "path": "/pixie.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> record = np.inf index = 0 i = 0 if(len(foods) == 0): return False for food in foods: d = dist(self.x, self.y, food.x, food.y) if d < record: record = d index = i i += 1 food = ...
code_fim
hard
{ "lang": "python", "repo": "blocus/naturalSim", "path": "/pixie.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: rl-institut/smooth path: /smooth/components/external_component_h2_dispenser.py """ This external component class is created to represent the dispenser unit of a hydrogen refuelling station. ***** Scope ***** The dispenser unit of a hydrogen refuelling station does not need to be included in the ...
code_fim
hard
{ "lang": "python", "repo": "rl-institut/smooth", "path": "/smooth/components/external_component_h2_dispenser.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> # ------------------- PARAMETERS ------------------- self.name = 'Test_additional/external_costs_default_name' self.life_time = 20 self.vehicle_tank_size = 40 self.number_of_hoses = 2 self.refuelling_time = 15 self.nominal_value = 1 self.csv...
code_fim
hard
{ "lang": "python", "repo": "rl-institut/smooth", "path": "/smooth/components/external_component_h2_dispenser.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> KBList = [] for R in RList: node = Formula(None) for symbol in R: node = parseToTree(symbol, node) node = findRoot(node) KBList.append(node) return KBList def toCNF(node, step): if not node: return None if step == 0: if node.symbol =...
code_fim
hard
{ "lang": "python", "repo": "rickxu0423/Automatic-Reasoning", "path": "/parser.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: rickxu0423/Automatic-Reasoning path: /parser.py from formula import Formula, Atom, Negation, Conjunction, Disjunction, Implication, Biconditional import copy operatorList = ['^', 'v', '~', '=>', '<=>'] afterList = ['(', '>'] beforeList = [')', '=', '<'] def splitString(logic): RList = [] ...
code_fim
hard
{ "lang": "python", "repo": "rickxu0423/Automatic-Reasoning", "path": "/parser.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: liuzhaomax/pyGUI-BakeShop path: /src/view/login/Login_Failed_Dialog.py #!/usr/bin/python3 # coding=utf-8 ''''''''''''''''''''''''''''''''''''''''''''''''''' @FileName Login_Failed_Dialog.py @Author Zhao Liu @StudId 30822750 @StartDate 24-09-2020 @LastModified 24-09-20...
code_fim
medium
{ "lang": "python", "repo": "liuzhaomax/pyGUI-BakeShop", "path": "/src/view/login/Login_Failed_Dialog.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> def on_click_btn_ok(self): ''' Callback when the OK button is clicked @return: ''' self.dialog.frame.close()<|fim_prefix|># repo: liuzhaomax/pyGUI-BakeShop path: /src/view/login/Login_Failed_Dialog.py #!/usr/bin/python3 # coding=utf-8 ''''''''''''''''''''''''''...
code_fim
hard
{ "lang": "python", "repo": "liuzhaomax/pyGUI-BakeShop", "path": "/src/view/login/Login_Failed_Dialog.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: tianhm/stock path: /fund/fund_holding_person.py import datetime import time import akshare as ak import pandas as pd symbol_dict = {"股票型", "混合型", "指数型", "QDII", "LOF",} import sys sys.path.append('..') from configure.settings import DBSelector import pymongo def get_mongo_doc(): client = ...
code_fim
hard
{ "lang": "python", "repo": "tianhm/stock", "path": "/fund/fund_holding_person.py", "mode": "psm", "license": "BSD-2-Clause", "source": "the-stack-v2" }
<|fim_suffix|> doc = get_mongo_doc() for item in symbol_dict: fund_open_fund_rank_em_df = ak.fund_open_fund_rank_em(symbol=item) print(fund_open_fund_rank_em_df.head()) print(item,len(fund_open_fund_rank_em_df)) obj_list = fund_open_fund_rank_em_df.to_dict('records') for ...
code_fim
hard
{ "lang": "python", "repo": "tianhm/stock", "path": "/fund/fund_holding_person.py", "mode": "spm", "license": "BSD-2-Clause", "source": "the-stack-v2" }
<|fim_suffix|> @Cog.listener() async def on_member_leave(self, member: Member) -> None: config = await self.get_config(member.guild.id) await self.log( "MEMBER_LEAVE", config, member_mention=member.mention, member_name=member.name, memb...
code_fim
hard
{ "lang": "python", "repo": "vcokltfre/Raptor", "path": "/bot/cogs/logging/guilds.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: vcokltfre/Raptor path: /bot/cogs/logging/guilds.py from datetime import datetime from typing import Optional from discord import Member from discord.abc import GuildChannel from discord.ext.commands import Cog from loguru import logger from bot.components.bot import Raptor from common.schemas.l...
code_fim
hard
{ "lang": "python", "repo": "vcokltfre/Raptor", "path": "/bot/cogs/logging/guilds.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> if isinstance(v, datetime): ts_format = config.formats.timestamp or "%Y-%m-%d %H:%M:%S" v = f"{v.strftime(ts_format)}" fmt = fmt.replace(repl, v) return fmt async def log( self, event: str, config: LoggingModel, in_channel: Opt...
code_fim
hard
{ "lang": "python", "repo": "vcokltfre/Raptor", "path": "/bot/cogs/logging/guilds.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> @property def supported_deploy_interfaces(self): """List of classes of supported deploy interfaces.""" return [fake.FakeDeploy] + super().supported_deploy_interfaces @property def supported_inspect_interfaces(self): """List of classes of supported inspect interface...
code_fim
hard
{ "lang": "python", "repo": "openstack/ironic", "path": "/ironic/drivers/fake_hardware.py", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_prefix|># repo: openstack/ironic path: /ironic/drivers/fake_hardware.py # Copyright 2016 Red Hat, Inc. # # 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/li...
code_fim
hard
{ "lang": "python", "repo": "openstack/ironic", "path": "/ironic/drivers/fake_hardware.py", "mode": "psm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|> convertTrajectoryToStateDf = ConvertTrajectoryToStateDf(getAllLevelValuesRange, conditionDfFromParametersDict, extractColumnValues) df = convertTrajectoryToStateDf(trajectory) print(df) saveToPickle(df, 'df.pickle') if __name__ ...
code_fim
hard
{ "lang": "python", "repo": "Enmin/ModellingJointInferenceOfPhysicsAndMind", "path": "/exec/createTrajectoryDf.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: Enmin/ModellingJointInferenceOfPhysicsAndMind path: /exec/createTrajectoryDf.py import os import sys DIRNAME = os.path.dirname(__file__) sys.path.append(os.path.join(DIRNAME, '..')) import numpy as np from exec.trajectoriesSaveLoad import ConvertTrajectoryToStateDf, GetAgentCoordinateFromTrajec...
code_fim
hard
{ "lang": "python", "repo": "Enmin/ModellingJointInferenceOfPhysicsAndMind", "path": "/exec/createTrajectoryDf.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> for h in handle: h.remove() gradAmpmap = gradabsdata.permute([1, 2, 0]).abs().mean(dim=2).cpu() / cnt if show: plt.figure(figsize=[6, 6.5]) plt.pcolor(gradAmpmap) plt.gca().invert_yaxis() plt.axis("image") plt.title("L %s Unit %s"%(target_layer, ...
code_fim
hard
{ "lang": "python", "repo": "Animadversio/Visual_Neuro_InSilico_Exp", "path": "/grad_RF_estim.py", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_prefix|># repo: Animadversio/Visual_Neuro_InSilico_Exp path: /grad_RF_estim.py """ Small lib to calculate RF by back prop towards the image. It has functions that calculate population RF based on a tensor of weights recombining. """ import numpy as np import torch, torchvision import matplotlib.pylab as plt impo...
code_fim
hard
{ "lang": "python", "repo": "Animadversio/Visual_Neuro_InSilico_Exp", "path": "/grad_RF_estim.py", "mode": "psm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|> device="cuda", show=True, reps=200, batch=1, label="", figdir=None): # (slice(None), 7, 7) handle, module_names, module_types = register_hook_by_module_names(target_layer, get_activation("record", unit=None, ingraph=True), model, input_size, device=device, ) ...
code_fim
hard
{ "lang": "python", "repo": "Animadversio/Visual_Neuro_InSilico_Exp", "path": "/grad_RF_estim.py", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_prefix|># repo: guoxuesong/deepstacks path: /deepstacks/framework/macros.py #!/usr/bin/env python # coding:utf-8 # vi:tabstop=4:shiftwidth=4:expandtab:sts=4 <|fim_suffix|> return ( (0,0,0,0,0,0,{ 'equal':[target,'classify',lambda x,y:r*lasagne.objectives.categorical_crossentropy(x...
code_fim
medium
{ "lang": "python", "repo": "guoxuesong/deepstacks", "path": "/deepstacks/framework/macros.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> return ( (0,0,0,0,0,0,{ 'equal':[target,'classify',lambda x,y:r*lasagne.objectives.categorical_crossentropy(x,y),], }), (0,0,0,0,0,0,{ 'nonlinearity':lambda x:T.argmax(x, axis=1),'shape':(curr_batchsize,), 'watch':...
code_fim
medium
{ "lang": "python", "repo": "guoxuesong/deepstacks", "path": "/deepstacks/framework/macros.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: herohenu/logmon path: /logmon/config.py ''' logmon.config ------------- Flask configuration. ''' <|fim_suffix|> # indicates the file to watch #LOG_FILE = '/var/log/nginx/access.log' # For your Rails app, feel free change it to your production.log or development.log #L...
code_fim
medium
{ "lang": "python", "repo": "herohenu/logmon", "path": "/logmon/config.py", "mode": "psm", "license": "BSD-3-Clause", "source": "the-stack-v2" }
<|fim_suffix|> SITE_NAME = 'Logmon' SITE_DOMAIN = 'localhost' # indicates the file to watch #LOG_FILE = '/var/log/nginx/access.log' # For your Rails app, feel free change it to your production.log or development.log #LOG_FILE = '/www/fosun/log/development.log' LOG_FILE = '/var/rails/fosu...
code_fim
easy
{ "lang": "python", "repo": "herohenu/logmon", "path": "/logmon/config.py", "mode": "spm", "license": "BSD-3-Clause", "source": "the-stack-v2" }
<|fim_suffix|>print(execute(test_func, "Tanya", 22)) # "I am Tanya and I am 22 years old"<|fim_prefix|># repo: Andrey-V-Georgiev/PythonOOP path: /_06_PolymorphismLab/_01_Execute.py def execute(f, *args): return f(*args) def test_func(name, age): <|fim_middle|> return f"I am {name} and I am {age} years old" ...
code_fim
easy
{ "lang": "python", "repo": "Andrey-V-Georgiev/PythonOOP", "path": "/_06_PolymorphismLab/_01_Execute.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: Andrey-V-Georgiev/PythonOOP path: /_06_PolymorphismLab/_01_Execute.py def execute(f, *args): <|fim_suffix|> return f"I am {name} and I am {age} years old" print(execute(test_func, "Tanya", 22)) # "I am Tanya and I am 22 years old"<|fim_middle|> return f(*args) def test_func(name, age):...
code_fim
easy
{ "lang": "python", "repo": "Andrey-V-Georgiev/PythonOOP", "path": "/_06_PolymorphismLab/_01_Execute.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: letcsv/python-csvorm path: /csvorm/relations.py class RelationType(object): ONE_TO_MANY = "one_to_many" ONE_TO_ONE = "one_to_one" class Relation(object): def __init__(self, cls): self.cls = cls class HasOne(Relation): def get(self, id): return self.cls.get(id=i...
code_fim
easy
{ "lang": "python", "repo": "letcsv/python-csvorm", "path": "/csvorm/relations.py", "mode": "psm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|>class HasOne(Relation): def get(self, id): return self.cls.get(id=id) class HasMany(Relation): def get(self, id): value = [] tokens = id.split(",") for token in tokens: value += (self.cls.get(id=token.strip())) return value<|fim_prefix|># rep...
code_fim
easy
{ "lang": "python", "repo": "letcsv/python-csvorm", "path": "/csvorm/relations.py", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_prefix|># repo: tsuru/rpaas path: /rpaas/api.py est from raven.contrib.flask import Sentry import hm.log from rpaas import (admin_api, router_api, admin_plugin, auth, get_manager, manager, plugin, storage, tasks) from rpaas.misc import (validate_name, validate_content, ValidationError, requir...
code_fim
hard
{ "lang": "python", "repo": "tsuru/rpaas", "path": "/rpaas/api.py", "mode": "psm", "license": "BSD-3-Clause", "source": "the-stack-v2" }
<|fim_prefix|># repo: tsuru/rpaas path: /rpaas/api.py = check_option_enable(os.environ.get("API_DEBUG")) handler = logging.StreamHandler() if api.debug: logging.basicConfig(level=logging.DEBUG) handler.setLevel(logging.DEBUG) else: handler.setLevel(logging.WARN) api.logger.addHandler(handler) hm.log.set_h...
code_fim
hard
{ "lang": "python", "repo": "tsuru/rpaas", "path": "/rpaas/api.py", "mode": "psm", "license": "BSD-3-Clause", "source": "the-stack-v2" }
<|fim_suffix|> @api.route("/resources/<name>/block/<block_name>", methods=["DELETE"]) @auth.required def delete_block(name, block_name): try: get_manager().delete_block(name, block_name) except tasks.NotReadyError as e: return "Instance not ready: {}".format(e), 412 return "", 200 @api.rou...
code_fim
hard
{ "lang": "python", "repo": "tsuru/rpaas", "path": "/rpaas/api.py", "mode": "spm", "license": "BSD-3-Clause", "source": "the-stack-v2" }
<|fim_suffix|>SerializerType = enum_type_wrapper.EnumTypeWrapper(_SERIALIZERTYPE) DEFAULT = 0 STRING = 1 NUMPY = 2 _FUNCTION = _descriptor.Descriptor( name='Function', full_name='Function', filename=None, file=DESCRIPTOR, containing_type=None, fields=[ _descriptor.FieldDescriptor( name='name', ...
code_fim
hard
{ "lang": "python", "repo": "jssmith/fluent", "path": "/functions/include/functions_pb2.py", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_prefix|># repo: jssmith/fluent path: /functions/include/functions_pb2.py # Generated by the protocol buffer compiler. DO NOT EDIT! # source: functions.proto import sys _b=sys.version_info[0]<3 and (lambda x:x) or (lambda x:x.encode('latin1')) from google.protobuf.internal import enum_type_wrapper from google.p...
code_fim
hard
{ "lang": "python", "repo": "jssmith/fluent", "path": "/functions/include/functions_pb2.py", "mode": "psm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|> _VALUE = _descriptor.Descriptor( name='Value', full_name='Value', filename=None, file=DESCRIPTOR, containing_type=None, fields=[ _descriptor.FieldDescriptor( name='body', full_name='Value.body', index=0, number=1, type=12, cpp_type=9, label=2, has_default_value=False, de...
code_fim
hard
{ "lang": "python", "repo": "jssmith/fluent", "path": "/functions/include/functions_pb2.py", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|> if (i,j) in visited: continue # visited.add((i,j)) if mat[i][j] == 1: res.append(explore_islands_using_dfs(mat, i, j, visited)) print("Number of islands present is ", mat, len(res))<|fim_prefix|># repo: iamlmn/PyDS path: /algos/pat...
code_fim
medium
{ "lang": "python", "repo": "iamlmn/PyDS", "path": "/algos/patterns/dfs/numberOfIslands.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: iamlmn/PyDS path: /algos/patterns/dfs/numberOfIslands.py ''' Calculate the area of an island ''' def validate(matrix, i, j,visited): if j < 0 or i < 0 or i >= len(matrix) or j >= len(matrix[0]) or (i,j) in visited or matrix[i][j] != 1: return False return True def explore_islands...
code_fim
hard
{ "lang": "python", "repo": "iamlmn/PyDS", "path": "/algos/patterns/dfs/numberOfIslands.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: RemDelaporteMathurin/FESTIM path: /test/unit/test_sources.py import festim import fenics as f import sympy as sp import numpy as np def test_implantation_flux_attributes(): """ Checks all attributes of the ImplantationFlux class """ flux = 1 imp_depth = 5e-9 width = 5e-9...
code_fim
hard
{ "lang": "python", "repo": "RemDelaporteMathurin/FESTIM", "path": "/test/unit/test_sources.py", "mode": "psm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|> assert my_source.value._cppcode == expected_value def test_source_with_float_value(): """ Tests that Source can be created with a float value and that the .value attribute is Constant """ source = festim.Source(2.0, volume=1, field="solute") assert isinstance(source.value, f....
code_fim
hard
{ "lang": "python", "repo": "RemDelaporteMathurin/FESTIM", "path": "/test/unit/test_sources.py", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|> # input inputs = Input(shape=(height,), dtype='int32') embed = Embedding(input_set_size, width, input_length=height)(inputs) sentence_model = Bidirectional(LSTM(64, return_sequences=True))(embed) pool = GlobalMaxPooling1D()(sentence_model) # output out = [Dense(mul_nb_classes[i], activation='sigmoi...
code_fim
medium
{ "lang": "python", "repo": "susht3/Text_Mutil_Classification_keras", "path": "/model/para_lstm.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: susht3/Text_Mutil_Classification_keras path: /model/para_lstm.py from keras.layers import Input, Dense, Dropout, Flatten, merge, Reshape, Activation, Permute from keras.layers.convolutional import Convolution1D, Convolution2D from keras.layers.pooling import GlobalMaxPooling1D, MaxPooling1D from ...
code_fim
medium
{ "lang": "python", "repo": "susht3/Text_Mutil_Classification_keras", "path": "/model/para_lstm.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: mesmith/ModelClarity path: /air_force_shared.py # Shared functions and variables used in both training and in production. # import numpy as np import math import pandas as pd import io import torch import torch.nn as nn import torch.nn.functional as F # For reusing the same categorical encoder f...
code_fim
hard
{ "lang": "python", "repo": "mesmith/ModelClarity", "path": "/air_force_shared.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> return (x - mean) / std s = pd.Series(data[field]) numerics = pd.to_numeric(s, errors='coerce') mapped = numerics.map(lambda x: 0 if math.isnan(x) else norm(x, mean, std)) norm_field = norm_prefix + '_' + field out = pd.DataFrame({norm_field: mapped}) return out # Apply ...
code_fim
hard
{ "lang": "python", "repo": "mesmith/ModelClarity", "path": "/air_force_shared.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: mesonbuild/meson path: /mesonbuild/templates/objctemplates.py # Copyright 2019 The Meson development team # 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://w...
code_fim
hard
{ "lang": "python", "repo": "mesonbuild/meson", "path": "/mesonbuild/templates/objctemplates.py", "mode": "psm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|>hello_objc_meson_template = '''project('{project_name}', 'objc', version : '{version}', default_options : ['warning_level=3']) exe = executable('{exe_name}', '{source_name}', install : true) test('basic', exe) ''' class ObjCProject(FileHeaderImpl): source_ext = 'm' header_ext = 'h' ...
code_fim
hard
{ "lang": "python", "repo": "mesonbuild/meson", "path": "/mesonbuild/templates/objctemplates.py", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|> @staticmethod def convert2ace_js(completions): """ 转换completions为ace.js所需要的补全列表格式[{"caption":,"meta":,"name":,"value":,"score":] caption :字幕,也就是展示在列表中的内容 meta :展示类型 name :名称 value :值 score :分数,越大的排在越上面 :return: """ ace...
code_fim
hard
{ "lang": "python", "repo": "lgq9220/archery", "path": "/sql/completer/__init__.py", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_prefix|># repo: lgq9220/archery path: /sql/completer/__init__.py # -*- coding: UTF-8 -*- """ @author: hhyo @license: Apache Licence @file: completion_engines.py @time: 2019/03/09 """ __author__ = 'hhyo' class Completer: @property def name(self): """返回engine名称""" return 'Completer engi...
code_fim
hard
{ "lang": "python", "repo": "lgq9220/archery", "path": "/sql/completer/__init__.py", "mode": "psm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|> """ 刷新completer对象元数据 :param reset: :return: """ def _on_completions_refreshed(self, new_completer): """ 刷新completer对象回调函数,替换对象 :param new_completer: :return: """ def get_completions(self, text, cursor_position): ...
code_fim
medium
{ "lang": "python", "repo": "lgq9220/archery", "path": "/sql/completer/__init__.py", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_prefix|># repo: baverman/cachel path: /cachel/__init__.py from .base import (SERIALIZERS, make_key_func, NullCache, BaseCache, <|fim_suffix|>e_cache from .offload import make_offload_cache from . import compat if compat.ASYNC_AWAIT: # pragma: no cover from .base import AsyncBaseCache<|fim_middle|> ...
code_fim
medium
{ "lang": "python", "repo": "baverman/cachel", "path": "/cachel/__init__.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|>ompat.ASYNC_AWAIT: # pragma: no cover from .base import AsyncBaseCache<|fim_prefix|># repo: baverman/cachel path: /cachel/__init__.py from .base import (SERIALIZERS, make_key_func, NullCache, BaseCache, <|fim_middle|> wrap_in, wrap_dict_value_in, expire) from .simple import make_ca...
code_fim
medium
{ "lang": "python", "repo": "baverman/cachel", "path": "/cachel/__init__.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|>class CompanyProfileUpdateForm(forms.ModelForm): """ CustomerProfile update form. Field enhancements: * time uses forms.TimeField with format '%H:%M' * serviceproviderType uses forms.TypedChoiceField choices from CompanyProfile.SERVICEPROVIDER_TYPE_CHOICES * invoiceRefType uses for...
code_fim
hard
{ "lang": "python", "repo": "lususnaturae/terapialaskutus", "path": "/therapyinvoicing/customers/forms.py", "mode": "spm", "license": "BSD-3-Clause", "source": "the-stack-v2" }
<|fim_prefix|># repo: lususnaturae/terapialaskutus path: /therapyinvoicing/customers/forms.py from django import forms from django.utils.translation import ugettext_lazy as _ from .models import Customer, Session, CompanyProfile class CustomerUpdateForm(forms.ModelForm): """ Update Customer form Field en...
code_fim
hard
{ "lang": "python", "repo": "lususnaturae/terapialaskutus", "path": "/therapyinvoicing/customers/forms.py", "mode": "psm", "license": "BSD-3-Clause", "source": "the-stack-v2" }
<|fim_suffix|> """ CustomerProfile update form. Field enhancements: * time uses forms.TimeField with format '%H:%M' * serviceproviderType uses forms.TypedChoiceField choices from CompanyProfile.SERVICEPROVIDER_TYPE_CHOICES * invoiceRefType uses forms.TypedChoiceField choices from CompanyProfile.I...
code_fim
hard
{ "lang": "python", "repo": "lususnaturae/terapialaskutus", "path": "/therapyinvoicing/customers/forms.py", "mode": "spm", "license": "BSD-3-Clause", "source": "the-stack-v2" }
<|fim_suffix|> # Polling of the client until the job is complete while True: message = yield from client.socket.recv() if message is None or message.strip().lower()=="terminate": # Kill thread if running if job.status==Job.RUNNING or job.status==Job.WAITING: client.log("Terminate request \"%s\""%ha...
code_fim
hard
{ "lang": "python", "repo": "sebMathieu/dsima", "path": "/server/iginterface.py", "mode": "spm", "license": "BSD-3-Clause", "source": "the-stack-v2" }
<|fim_suffix|> # Agree to receive the instance parameters and waits yield from client.socket.send("ok instance generation request") xmlParameters=yield from client.socket.recv() if xmlParameters is None: return yield from client.socket.send("ok instance received") client.log("\n"+xmlParameters) # Star...
code_fim
hard
{ "lang": "python", "repo": "sebMathieu/dsima", "path": "/server/iginterface.py", "mode": "spm", "license": "BSD-3-Clause", "source": "the-stack-v2" }
<|fim_prefix|># repo: sebMathieu/dsima path: /server/iginterface.py ##@package iginterface # Instance generator interface. #@author Sebastien MATHIEU import time, sys, threading, queue, subprocess,traceback,os import asyncio,websockets import xml.etree.ElementTree as ElementTree from .job import Job from .l...
code_fim
hard
{ "lang": "python", "repo": "sebMathieu/dsima", "path": "/server/iginterface.py", "mode": "psm", "license": "BSD-3-Clause", "source": "the-stack-v2" }
<|fim_prefix|># repo: Pulecz/convert_currency path: /tests_long.py #!/usr/bin/env python import convert_currency import unittest from CONST import supported_currencies class Args_for_convert_currency: 'simulate Namespace class for argsparse with all arguments convert_currency takes' def __init__(self, amount,...
code_fim
hard
{ "lang": "python", "repo": "Pulecz/convert_currency", "path": "/tests_long.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> ''' go over each currency_code and print output for all since input is always different, request from API is needed in each run therefore we can just run the main with different input parameter for each country_code and test that it returns 0 ''' pri...
code_fim
hard
{ "lang": "python", "repo": "Pulecz/convert_currency", "path": "/tests_long.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> return np.concatenate((warmup_lr_schedule, cosine_lr_schedule)) def length_to_mask(length, stride=1, max_len=None, dtype=None): """length: B. return B x max_len. If max_len is None, then max of length will be used. """ assert len(length.shape) == 1, 'Length shape should be 1 dime...
code_fim
hard
{ "lang": "python", "repo": "SABER-labs/SABERv2", "path": "/utils/training_utils.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: SABER-labs/SABERv2 path: /utils/training_utils.py import math from utils.config import config import numpy as np import torch import torch.distributed as dist class GatherLayer(torch.autograd.Function): @staticmethod def forward(ctx, tensor): ctx.batch_size = tensor.shape[0] ...
code_fim
medium
{ "lang": "python", "repo": "SABER-labs/SABERv2", "path": "/utils/training_utils.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> start_lr = config.trainer.start_lr final_lr = config.trainer.final_lr learning_rate = config.trainer.learning_rate warmup_epochs = config.trainer.warmup_epochs max_epochs = config.trainer.max_epochs warmup_lr_schedule = np.linspace( start_lr, learning_rate, int(train_iters...
code_fim
hard
{ "lang": "python", "repo": "SABER-labs/SABERv2", "path": "/utils/training_utils.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|>class SituacaoUpdate(UpdateView): model = Situacao template_name = 'situacao.html' form_class = SituacaoForm def produto_json(request, pk): ''' Retorna o produto, id e estoque. ''' produto = Produto.objects.filter(pk=pk) data = [item.to_dict_json() for item in produto] return...
code_fim
hard
{ "lang": "python", "repo": "CSAAtibaia/Listas", "path": "/ERP/core/views.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: CSAAtibaia/Listas path: /ERP/core/views.py from django.shortcuts import render from django.http import JsonResponse, HttpResponseRedirect from django.urls import reverse from django.views.generic import CreateView, UpdateView, ListView from .models import Item as Produto, Situacao from .forms imp...
code_fim
hard
{ "lang": "python", "repo": "CSAAtibaia/Listas", "path": "/ERP/core/views.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> ''' Retorna o produto, id e estoque. ''' produto = Produto.objects.filter(pk=pk) data = [item.to_dict_json() for item in produto] return JsonResponse({'data': data}) def save_data(data): ''' Salva os dados no banco. ''' aux = [] for item in data: produto = ite...
code_fim
hard
{ "lang": "python", "repo": "CSAAtibaia/Listas", "path": "/ERP/core/views.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> self.cnn = nn.Sequential( nn.Conv1d(self.embed_size, 128, 4, 2), nn.BatchNorm1d(128), nn.ELU(), nn.Conv1d(128, 256, 4, 2), nn.BatchNorm1d(256), nn.ELU(), nn.Conv1d(256, 256, 4, 2), nn.BatchNorm1d(256)...
code_fim
hard
{ "lang": "python", "repo": "asiddhant/hybrid_rvae", "path": "/model/encoder.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> """ :param input: An float tensor with shape of [batch_size, seq_len, embed_size] :return: An float tensor with shape of [batch_size, latent_variable_size] """ ''' Transpose input to the shape of [batch_size, embed_size, seq_len] ''' input =...
code_fim
hard
{ "lang": "python", "repo": "asiddhant/hybrid_rvae", "path": "/model/encoder.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: asiddhant/hybrid_rvae path: /model/encoder.py import torch as t import torch.nn as nn import torch.nn.functional as F class Encoder(nn.Module): def __init__(self, embed_size, latent_size): super(Encoder, self).__init__() <|fim_suffix|> """ :param input: An float tens...
code_fim
hard
{ "lang": "python", "repo": "asiddhant/hybrid_rvae", "path": "/model/encoder.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> # Set up coords x = x[:,np.newaxis] y = y[np.newaxis,:] # Integrate over vortex M00 = np.sum(np.abs(vtx_field-edge)*(x**0)*(y**0)) M10 = np.sum(np.abs(vtx_field-edge)*(x**1)*(y**0)) M01 = np.sum(np.abs(vtx_field-edge)*(x**0)*(y**1)) Marea = np.sum(np.abs(vtx_field-edge)*(x*...
code_fim
hard
{ "lang": "python", "repo": "BrisClimate/How-well-are-Sudden-Stratospheric-Warming-surface-impacts-captured-in-CMIP6-climate-models-", "path": "/vor_fast.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> *field* A :py:class:`numpy.ndarray` or :py:class:`numpy.ma.core.MasekdArray` with two dimensions. The 0th dimension should represent latitude, and the 1st dimension longitude. *lats* A one dimensional array or list with the latitude grid values for field ...
code_fim
hard
{ "lang": "python", "repo": "BrisClimate/How-well-are-Sudden-Stratospheric-Warming-surface-impacts-captured-in-CMIP6-climate-models-", "path": "/vor_fast.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: BrisClimate/How-well-are-Sudden-Stratospheric-Warming-surface-impacts-captured-in-CMIP6-climate-models- path: /vor_fast.py ''' This file is part of vortex-moments on William Sevour's Github page. Please see README.md for more information, including citations. vortex-moments is free software:...
code_fim
hard
{ "lang": "python", "repo": "BrisClimate/How-well-are-Sudden-Stratospheric-Warming-surface-impacts-captured-in-CMIP6-climate-models-", "path": "/vor_fast.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> Standard methods for instantiation, printing, and type information. """ ... def SetArrayComponent(self, p_int): """ V.SetArrayComponent(int) C++: virtual void SetArrayComponent(int _arg) Set/get which component of a multi-co...
code_fim
hard
{ "lang": "python", "repo": "gen4438/vtk-python-stubs", "path": "/typings/vtkmodules/vtkFiltersGeneral/vtkDiscreteFlyingEdgesClipper2D.pyi", "mode": "spm", "license": "BSD-3-Clause", "source": "the-stack-v2" }
<|fim_suffix|> """ V.SetComputeScalars(int) C++: virtual void SetComputeScalars(int _arg) Option to set the cell scalars of the output. The scalars will be the contour values. By default this flag is on. """ ... def SetNumberOfContours(self, p_int...
code_fim
hard
{ "lang": "python", "repo": "gen4438/vtk-python-stubs", "path": "/typings/vtkmodules/vtkFiltersGeneral/vtkDiscreteFlyingEdgesClipper2D.pyi", "mode": "spm", "license": "BSD-3-Clause", "source": "the-stack-v2" }
<|fim_prefix|># repo: gen4438/vtk-python-stubs path: /typings/vtkmodules/vtkFiltersGeneral/vtkDiscreteFlyingEdgesClipper2D.pyi """ This type stub file was generated by pyright. """ import vtkmodules.vtkCommonExecutionModel as __vtkmodules_vtkCommonExecutionModel class vtkDiscreteFlyingEdgesClipper2D(__vtkmodules_vtk...
code_fim
hard
{ "lang": "python", "repo": "gen4438/vtk-python-stubs", "path": "/typings/vtkmodules/vtkFiltersGeneral/vtkDiscreteFlyingEdgesClipper2D.pyi", "mode": "psm", "license": "BSD-3-Clause", "source": "the-stack-v2" }
<|fim_suffix|> Args: channels: The channel that the barrier applies to. name: Name of the directive for display purposes. """ super().__init__(operands=tuple(channels), name=name) @property def channels(self) -> Tuple[chans.Channel]: """Returns the channel...
code_fim
hard
{ "lang": "python", "repo": "CoolProgrammerX/qiskit-terra", "path": "/qiskit/pulse/instructions/directives.py", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|> @property def duration(self) -> int: """Duration of this instruction.""" return 0 class RelativeBarrier(Directive): """Pulse ``RelativeBarrier`` directive.""" def __init__(self, *channels: chans.Channel, name: Optional[str] = None): """Create a relative barrier d...
code_fim
hard
{ "lang": "python", "repo": "CoolProgrammerX/qiskit-terra", "path": "/qiskit/pulse/instructions/directives.py", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_prefix|># repo: CoolProgrammerX/qiskit-terra path: /qiskit/pulse/instructions/directives.py # This code is part of Qiskit. # # (C) Copyright IBM 2020. # # This code is licensed under the Apache License, Version 2.0. You may # obtain a copy of this license in the LICENSE.txt file in the root directory # of this s...
code_fim
hard
{ "lang": "python", "repo": "CoolProgrammerX/qiskit-terra", "path": "/qiskit/pulse/instructions/directives.py", "mode": "psm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|> else: # top # get y y = 0 # get x b_right_part = True if angle > angle_top_left: angle = np.abs(360 - angle) b_right_part = False if angle == 0: x = 0 ...
code_fim
hard
{ "lang": "python", "repo": "neutronimaging/python_notebooks", "path": "/notebooks/__code/radial_profile/event_handler.py", "mode": "spm", "license": "BSD-3-Clause", "source": "the-stack-v2" }
<|fim_prefix|># repo: neutronimaging/python_notebooks path: /notebooks/__code/radial_profile/event_handler.py import numpy as np import pyqtgraph as pg from qtpy import QtGui from __code._utilities.parent import Parent from __code.radial_profile.display import Display class EventHandler(Parent): def file_index...
code_fim
hard
{ "lang": "python", "repo": "neutronimaging/python_notebooks", "path": "/notebooks/__code/radial_profile/event_handler.py", "mode": "psm", "license": "BSD-3-Clause", "source": "the-stack-v2" }
<|fim_suffix|> if self.parent.angle_0: self.parent.ui.image_view.removeItem(self.parent.angle_0) if self.parent.angle_90: self.parent.ui.image_view.removeItem(self.parent.angle_90) if self.parent.angle_180: self.parent.ui.image_view.removeItem(self.parent.ang...
code_fim
hard
{ "lang": "python", "repo": "neutronimaging/python_notebooks", "path": "/notebooks/__code/radial_profile/event_handler.py", "mode": "spm", "license": "BSD-3-Clause", "source": "the-stack-v2" }
<|fim_suffix|> job = self.registry[task.job] retries = getattr(job, 'retries', self.retries) backoff = getattr(job, 'backoff', self.backoff) try: await asyncio.wait_for(job(task), timeout=task.timeout) await self.queue.remove(task) except Exception: ...
code_fim
hard
{ "lang": "python", "repo": "knowark/schedulark", "path": "/schedulark/worker/worker.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: knowark/schedulark path: /schedulark/worker/worker.py import time import asyncio import logging from typing import Type, Tuple, Dict, Callable from ..base import Job from ..queue import Queue Registry = Dict[str, Job] class Worker: def __init__(self, registry: Registry, queue: Queue) -> N...
code_fim
hard
{ "lang": "python", "repo": "knowark/schedulark", "path": "/schedulark/worker/worker.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> self.iterations = 0 async def _process(self, task) -> None: if not task: return await asyncio.sleep(self.sleep) job = self.registry[task.job] retries = getattr(job, 'retries', self.retries) backoff = getattr(job, 'backoff', self.backoff) tr...
code_fim
hard
{ "lang": "python", "repo": "knowark/schedulark", "path": "/schedulark/worker/worker.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> strides = list(data.strides) strides[axis] *= stepsize strides.append(data.strides[axis]) strided = np.lib.stride_tricks.as_strided( data, shape=shape, strides=strides ) return strided @staticmethod def get_MFCC(path, window=10, step=1...
code_fim
hard
{ "lang": "python", "repo": "gundamMC/animius", "path": "/animius/SpeakerVerification/MFCC.py", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_prefix|># repo: gundamMC/animius path: /animius/SpeakerVerification/MFCC.py import numpy as np import scipy.io.wavfile as wav import speechpy class MFCC: @staticmethod def sliding_window(data, size, stepsize=1, axis=0): """ Calculate a sliding window over a signal Parameters ...
code_fim
hard
{ "lang": "python", "repo": "gundamMC/animius", "path": "/animius/SpeakerVerification/MFCC.py", "mode": "psm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|> def send(self, worker: int, msg: Any) -> bool: try: self.pipes[worker].send(msg) return True except BrokenPipeError: self._on_error(worker) return False def broadcast(self, obj: Any) -> List[bool]: ret = [] for pipe i...
code_fim
hard
{ "lang": "python", "repo": "i404788/distributed-worker", "path": "/distributed_worker/manager.py", "mode": "spm", "license": "BSD-2-Clause", "source": "the-stack-v2" }
<|fim_suffix|> return [(x, self.pipes[x]) for x in self.get_active_workers()] def get_active_workers(self): ret = [] for i, pipe in enumerate(self.pipes): last_msg = self.last_message_time.get(i, 0) if last_msg + self.ttl > time.time(): ret.append(i) ...
code_fim
hard
{ "lang": "python", "repo": "i404788/distributed-worker", "path": "/distributed_worker/manager.py", "mode": "spm", "license": "BSD-2-Clause", "source": "the-stack-v2" }
<|fim_prefix|># repo: i404788/distributed-worker path: /distributed_worker/manager.py from typing import Tuple, Mapping, List, Any import multiprocessing from multiprocessing.connection import Listener, Client, Pipe import select import time from .worker import create_worker default_address = 'localhost' default_po...
code_fim
hard
{ "lang": "python", "repo": "i404788/distributed-worker", "path": "/distributed_worker/manager.py", "mode": "psm", "license": "BSD-2-Clause", "source": "the-stack-v2" }
<|fim_suffix|># return it mohamed #uriMementos.txt mementosFile = open("memento.txt","w") i = 0 for s in links: p = subprocess.Popen(['curl',"http://web.archive.org/web/timemap/link/"+s], stdout=subprocess.PIPE, stderr=subprocess.PIPE) out, err = p.communicate() i = i + 1 sys.stdout.flush() sys.stdout.write("calc...
code_fim
medium
{ "lang": "python", "repo": "maturban/cs595-f13", "path": "/Assignment2/CDXaggregator/getMementos.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: maturban/cs595-f13 path: /Assignment2/CDXaggregator/getMementos.py # -*- encoding: utf-8 -*- import os import sys from datetime import datetime,date import subprocess import simplejson <|fim_suffix|>i = 0 for s in links: p = subprocess.Popen(['curl',"http://web.archive.org/web/timemap/link/"+s...
code_fim
medium
{ "lang": "python", "repo": "maturban/cs595-f13", "path": "/Assignment2/CDXaggregator/getMementos.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> return 'soft' elif obj[0] == 'pre-presbyopic': return 'soft' elif obj[2] == 'yes': return 'none'<|fim_prefix|># repo: rajes95/intro_to_artificial_intelligence path: /4_ID3_classifier/outputs/rules/rules.py def findDecision(obj): #obj[0]: age, obj[1]: spectacle...
code_fim
hard
{ "lang": "python", "repo": "rajes95/intro_to_artificial_intelligence", "path": "/4_ID3_classifier/outputs/rules/rules.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: rajes95/intro_to_artificial_intelligence path: /4_ID3_classifier/outputs/rules/rules.py def findDecision(obj): #obj[0]: age, obj[1]: spectacle-prescription, obj[2]: astigmatism, obj[3]: tear-prod-rate if obj[3] == 'reduced': <|fim_suffix|>': return 'none' elif obj[1]...
code_fim
hard
{ "lang": "python", "repo": "rajes95/intro_to_artificial_intelligence", "path": "/4_ID3_classifier/outputs/rules/rules.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: amcardie/discord-bot path: /cogs/moderation.py import discord from discord.ext import commands import re import asyncio time_regex = re.compile("(?:(\d{1,5})(h|s|m|d))+?") time_dict = {"h":3600, "s":1, "m":60, "d":86400} class TimeConverter(commands.Converter): async def convert(se...
code_fim
hard
{ "lang": "python", "repo": "amcardie/discord-bot", "path": "/cogs/moderation.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> if time: await asyncio.sleep(time) await member.remove_roles(role) @commands.command() @commands.has_permissions(manage_roles=True) async def unmute(self, ctx, member: discord.Member = None): if not member: return await ctx.reply...
code_fim
hard
{ "lang": "python", "repo": "amcardie/discord-bot", "path": "/cogs/moderation.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: feer56/Kitsune1 path: /kitsune/questions/migrations/0005_auto__add_field_answer_is_spam__add_field_answer_marked_as_spam__add_f.py # -*- coding: utf-8 -*- import datetime from south.db import db from south.v2 import SchemaMigration from django.db import models class Migration(SchemaMigration): ...
code_fim
hard
{ "lang": "python", "repo": "feer56/Kitsune1", "path": "/kitsune/questions/migrations/0005_auto__add_field_answer_is_spam__add_field_answer_marked_as_spam__add_f.py", "mode": "psm", "license": "BSD-3-Clause", "source": "the-stack-v2" }
<|fim_suffix|> models = { u'auth.group': { 'Meta': {'object_name': 'Group'}, u'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}), 'name': ('django.db.models.fields.CharField', [], {'unique': 'True', 'max_length': '80'}), 'permissions': ('d...
code_fim
hard
{ "lang": "python", "repo": "feer56/Kitsune1", "path": "/kitsune/questions/migrations/0005_auto__add_field_answer_is_spam__add_field_answer_marked_as_spam__add_f.py", "mode": "spm", "license": "BSD-3-Clause", "source": "the-stack-v2" }
<|fim_suffix|> models = { u'auth.group': { 'Meta': {'object_name': 'Group'}, u'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}), 'name': ('django.db.models.fields.CharField', [], {'unique': 'True', 'max_length': '80'}), 'permissions': ('...
code_fim
hard
{ "lang": "python", "repo": "feer56/Kitsune1", "path": "/kitsune/questions/migrations/0005_auto__add_field_answer_is_spam__add_field_answer_marked_as_spam__add_f.py", "mode": "spm", "license": "BSD-3-Clause", "source": "the-stack-v2" }
<|fim_prefix|># repo: gcandal/ripe-api path: /src/ripe/order.py #!/usr/bin/python # -*- coding: utf-8 -*- import json class OrderAPI(object): @classmethod def load_order(cls, order): structure = order.get("structure", None) if structure: order["details"] = json.loads(structure) ...
code_fim
hard
{ "lang": "python", "repo": "gcandal/ripe-api", "path": "/src/ripe/order.py", "mode": "psm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|> url = self.base_url + "orders" contents = self.post(url, data_j = order) return contents def get_order(self, number): url = self.base_url + "orders/%d" % number contents = self.get(url) return contents def price_order(self, number, currenc...
code_fim
hard
{ "lang": "python", "repo": "gcandal/ripe-api", "path": "/src/ripe/order.py", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }