text stringlengths 232 16.3k | domain stringclasses 1
value | difficulty stringclasses 3
values | meta dict |
|---|---|---|---|
<|fim_suffix|> v = hp.parse_hgvs_variant(h)
return [h, v.posedit.edit.ref, v.posedit.edit.alt, v.posedit.edit.type, v.posedit.length_change()]
rows = [list(map(str, gen1(h))) for h in variants]
print(tabulate(rows, headers=headers)) #, tablefmt="pipe"))<|fim_prefix|># repo: biocommons/hgvs path: /misc/refalt... | code_fim | medium | {
"lang": "python",
"repo": "biocommons/hgvs",
"path": "/misc/refalt-repr-examples.py",
"mode": "spm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_suffix|>rows = [list(map(str, gen1(h))) for h in variants]
print(tabulate(rows, headers=headers)) #, tablefmt="pipe"))<|fim_prefix|># repo: biocommons/hgvs path: /misc/refalt-repr-examples.py
#!/usr/bin/env python
import hgvs
import hgvs.parser
from tabulate import tabulate
from six.moves import map
hp = hgvs... | code_fim | medium | {
"lang": "python",
"repo": "biocommons/hgvs",
"path": "/misc/refalt-repr-examples.py",
"mode": "spm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: izaneighi/FishbowlBot path: /FishbowlBot.py
or scrap in scraps):
return await FishbowlBackend.send_error(ctx, "Scrap(s) too long! %d characters or less, please!" % SCRAP_MAX_LEN)
bad_scraps = [s for s in scraps if check_scrap(s)]
for s in bad_scraps:
await FishbowlBackend... | code_fim | hard | {
"lang": "python",
"repo": "izaneighi/FishbowlBot",
"path": "/FishbowlBot.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|>@see.error
async def see_error(ctx, error):
if isinstance(error, commands.MissingRequiredArgument):
return await FishbowlBackend.send_error(ctx, "Give me `bowl` or `discard`!")
else:
return await general_errors(ctx, error)
@commands.command(name="show")
@check_user_in_session()
a... | code_fim | hard | {
"lang": "python",
"repo": "izaneighi/FishbowlBot",
"path": "/FishbowlBot.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: izaneighi/FishbowlBot path: /FishbowlBot.py
sessions[session_id]['bowl']),
len(sessions[session_id]['discard']),
session_id)
if fail_discard:
the_fun... | code_fim | hard | {
"lang": "python",
"repo": "izaneighi/FishbowlBot",
"path": "/FishbowlBot.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: bokunimowakaru/aws_iot1click_lambda path: /iot1click_onclick_ambient_db.py
# for AWS Lambda Python 3.6
# coding: utf-8
################################################################################
# SORACOM LTE-Button や AWS IoT Buttonが押された時にAmbient へボタン値を送信する
# 過去の押下回数を AWS のデータベースへ保存しておき、Ambi... | code_fim | hard | {
"lang": "python",
"repo": "bokunimowakaru/aws_iot1click_lambda",
"path": "/iot1click_onclick_ambient_db.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> # Ambientへ送信
url = 'https://ambidata.io/api/v2/channels/'+ambient_chid+'/data'
head = {"Content-Type":"application/json"}
body = {"writeKey" : ambient_wkey,
amdient_sum_tag : int(count), amdient_tag : type_num}
print('http:',body)
post = urllib.request.Request(url, jso... | code_fim | hard | {
"lang": "python",
"repo": "bokunimowakaru/aws_iot1click_lambda",
"path": "/iot1click_onclick_ambient_db.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> # 押下回数に1を加算
try:
count = dbVals['Items'][0]['count'] + 1
except Exception as e:
count = 1
print('new type of button: ' + btn)
# データベースへ押下回数を更新
try:
res = dbTable.update_item(
Key = {'type': btn },
AttributeUpdates = {
... | code_fim | hard | {
"lang": "python",
"repo": "bokunimowakaru/aws_iot1click_lambda",
"path": "/iot1click_onclick_ambient_db.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> :param X: The sample data
:param design_scale: design matrix for scale
:param constraints: some design constraints
:param size_factors: size factors for X
:param weights: the weights of the arrays' elements; if `none` it will be ignored.
:param mu: optional, if there are for exampl... | code_fim | hard | {
"lang": "python",
"repo": "SabrinaRichter/batchglm",
"path": "/batchglm/models/glm_nb/utils.py",
"mode": "spm",
"license": "BSD-3-Clause",
"source": "the-stack-v2"
} |
<|fim_suffix|> # calculate group-wise means if necessary
if provided_groupwise_means is None:
if weights is None:
groupwise_means = grouped_X.mean(X.dims[0]).values
else:
# for each group: calculate weighted mean
groupwise_means: xr.... | code_fim | hard | {
"lang": "python",
"repo": "SabrinaRichter/batchglm",
"path": "/batchglm/models/glm_nb/utils.py",
"mode": "spm",
"license": "BSD-3-Clause",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: SabrinaRichter/batchglm path: /batchglm/models/glm_nb/utils.py
from typing import Union
import numpy as np
import xarray as xr
from .external import closedform_glm_mean, groupwise_solve_lm
from .external import weighted_mean
def closedform_nb_glm_logmu(
X: xr.DataArray,
design... | code_fim | hard | {
"lang": "python",
"repo": "SabrinaRichter/batchglm",
"path": "/batchglm/models/glm_nb/utils.py",
"mode": "psm",
"license": "BSD-3-Clause",
"source": "the-stack-v2"
} |
<|fim_suffix|> parser.set_defaults(function=run_daemon)
def run_daemon(args, parser):
return asyncio.get_event_loop().run_until_complete(async_run_daemon(args.root_path))<|fim_prefix|># repo: DONG-Jason/chia-blockchain path: /src/cmds/run_daemon.py
import asyncio
from src.daemon.server import async_run_daemo... | code_fim | easy | {
"lang": "python",
"repo": "DONG-Jason/chia-blockchain",
"path": "/src/cmds/run_daemon.py",
"mode": "spm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: DONG-Jason/chia-blockchain path: /src/cmds/run_daemon.py
import asyncio
from src.daemon.server import async_run_daemon
def make_parser(parser):
<|fim_suffix|>def run_daemon(args, parser):
return asyncio.get_event_loop().run_until_complete(async_run_daemon(args.root_path))<|fim_middle|> ... | code_fim | easy | {
"lang": "python",
"repo": "DONG-Jason/chia-blockchain",
"path": "/src/cmds/run_daemon.py",
"mode": "psm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_suffix|> return asyncio.get_event_loop().run_until_complete(async_run_daemon(args.root_path))<|fim_prefix|># repo: DONG-Jason/chia-blockchain path: /src/cmds/run_daemon.py
import asyncio
from src.daemon.server import async_run_daemon
<|fim_middle|>
def make_parser(parser):
parser.set_defaults(function=r... | code_fim | medium | {
"lang": "python",
"repo": "DONG-Jason/chia-blockchain",
"path": "/src/cmds/run_daemon.py",
"mode": "spm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_suffix|>print(best_weights)
## testing
env= wrappers.Monitor(env, 'brute_force_files', force = True)
done= False
count = 0
observation = env.reset()
while not done:
count = count +1
action = 1 if np.dot(observation,best_weights) >0 else 0
observation,reward,done,_ = env.step(action)
if done:
... | code_fim | hard | {
"lang": "python",
"repo": "adibyte95/CartPole-OpenAI-GYM",
"path": "/prog_bruteforce.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: adibyte95/CartPole-OpenAI-GYM path: /prog_bruteforce.py
# make a random vector which gives good result
# importing the dependencies
import gym
import random
import numpy as np
from gym import wrappers
env = gym.make('CartPole-v1').env
bestLength = 0
episode_length =[]
best_weights = np.zeros(4... | code_fim | medium | {
"lang": "python",
"repo": "adibyte95/CartPole-OpenAI-GYM",
"path": "/prog_bruteforce.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> DistributedObject.__init__(self, cr)
self.defaultSignModel = loader.loadModel('phase_13/models/parties/eventSign')
self.activityIconsModel = loader.loadModel('phase_4/models/parties/eventSignIcons')<|fim_prefix|># repo: TTOFFLINE-LEAK/ttoffline path: /v2.5.7/toontown/toonfest/Dist... | code_fim | medium | {
"lang": "python",
"repo": "TTOFFLINE-LEAK/ttoffline",
"path": "/v2.5.7/toontown/toonfest/DistributedToonFestActivities.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: TTOFFLINE-LEAK/ttoffline path: /v2.5.7/toontown/toonfest/DistributedToonFestActivities.py
from direct.directnotify import DirectNotifyGlobal
from direct.distributed.DistributedObject import DistributedObject
<|fim_suffix|> notify = DirectNotifyGlobal.directNotify.newCategory('DistributedToonF... | code_fim | medium | {
"lang": "python",
"repo": "TTOFFLINE-LEAK/ttoffline",
"path": "/v2.5.7/toontown/toonfest/DistributedToonFestActivities.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> try:
root.propagate()
except EddParser.MyPropagationError, ex :
logging.critical(str(ex))
logging.info("EXIT ON FAILURE")
exit(1)
parsed_edds.append((edd_file.name, root))
return parsed_edds
def generateDomainCommands(logging, a... | code_fim | hard | {
"lang": "python",
"repo": "lz-purple/Source",
"path": "/app/src/main/java/com/syd/source/aosp/external/parameter-framework/upstream/tools/xmlGenerator/domainGenerator.py",
"mode": "spm",
"license": "BSD-3-Clause",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: asealey/crits_dependencies path: /stix-1.1.1.0/stix/core/stix_header.py
# Copyright (c) 2014, The MITRE Corporation. All rights reserved.
# See LICENSE.txt for complete terms.
import stix
import stix.bindings.stix_common as stix_common_binding
import stix.bindings.stix_core as stix_core_bin... | code_fim | hard | {
"lang": "python",
"repo": "asealey/crits_dependencies",
"path": "/stix-1.1.1.0/stix/core/stix_header.py",
"mode": "psm",
"license": "BSD-3-Clause",
"source": "the-stack-v2"
} |
<|fim_suffix|> return return_obj
def to_obj(self, return_obj=None):
if not return_obj:
return_obj = self._binding.STIXHeaderType()
if self.title:
return_obj.set_Title(self.title)
if self.package_intents:
return_obj.set_Package_Intent([x.t... | code_fim | hard | {
"lang": "python",
"repo": "asealey/crits_dependencies",
"path": "/stix-1.1.1.0/stix/core/stix_header.py",
"mode": "spm",
"license": "BSD-3-Clause",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: xin9726/MOTR path: /models/__init__.py
# ------------------------------------------------------------------------
# Deformable DETR
# Copyright (c) 2020 SenseTime. All Rights Reserved.
# Licensed under the Apache License, Version 2.0 [see LICENSE for details]
# -----------------------------------... | code_fim | medium | {
"lang": "python",
"repo": "xin9726/MOTR",
"path": "/models/__init__.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> arch_catalog = {
'deformable_detr': build_deformable_detr,
'motr': build_motr,
}
assert args.meta_arch in arch_catalog, 'invalid arch: {}'.format(args.meta_arch)
build_func = arch_catalog[args.meta_arch]
return build_func(args)<|fim_prefix|># repo: xin9726/MOTR path: /... | code_fim | medium | {
"lang": "python",
"repo": "xin9726/MOTR",
"path": "/models/__init__.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|>
def build_model(args):
arch_catalog = {
'deformable_detr': build_deformable_detr,
'motr': build_motr,
}
assert args.meta_arch in arch_catalog, 'invalid arch: {}'.format(args.meta_arch)
build_func = arch_catalog[args.meta_arch]
return build_func(args)<|fim_prefix|># rep... | code_fim | medium | {
"lang": "python",
"repo": "xin9726/MOTR",
"path": "/models/__init__.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: vveitch/causal-network-embeddings path: /src/relational_ERM/rerm_model/helpers.py
import collections
import tensorflow as tf
import re
def _get_value(value_or_fn):
if callable(value_or_fn):
return value_or_fn()
else:
return value_or_fn
def _default_embedding_optimizer(... | code_fim | hard | {
"lang": "python",
"repo": "vveitch/causal-network-embeddings",
"path": "/src/relational_ERM/rerm_model/helpers.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> return loss
def get_assignment_map_from_checkpoint(tvars, init_checkpoint, name_to_variable=None):
"""Compute the union of the current variables and checkpoint variables."""
assignment_map = {}
initialized_variable_names = {}
name_to_variable2 = collections.OrderedDict()
for var... | code_fim | hard | {
"lang": "python",
"repo": "vveitch/causal-network-embeddings",
"path": "/src/relational_ERM/rerm_model/helpers.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> @data.setter
def data(self, data):
equal_dim = self._repr.shape[1] == data.shape[1]
if self._repr.shape[0] > data.shape[0] and equal_dim:
self._repr[0:data.shape[0]] = data.astype(self._dtype)
elif self._repr.shape[0] == data.shape[0] and equal_dim:
... | code_fim | hard | {
"lang": "python",
"repo": "fury-gl/helios",
"path": "/helios/layouts/ipc_tools.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> self._num_rows = data.shape[0]
self._dimension = data.shape[1] if data.ndim == 2 else 1
self._num_elements = self._num_rows*self._dimension
buffer_arr = np.zeros(
self._num_elements+2, dtype=data.dtype)
self._buffer = shared_memory.SharedMemory(
... | code_fim | hard | {
"lang": "python",
"repo": "fury-gl/helios",
"path": "/helios/layouts/ipc_tools.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: fury-gl/helios path: /helios/layouts/ipc_tools.py
"""Inter-Process communication tools
This Module provides abstract classes and objects to deal with inter-process
communication.
References
----------
[1]“Python GSoC - Post #3: Network layout algorithms using IPC -
demvessias’s Blog.”
... | code_fim | hard | {
"lang": "python",
"repo": "fury-gl/helios",
"path": "/helios/layouts/ipc_tools.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: Xavier-Lam/wechat-django path: /wechat_django/pay/admin/payapp.py
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django import forms
from django.contrib import admin
from django.utils.translation import gettext_lazy as _
from wechat_django.admin.base import has_wechat_perm... | code_fim | hard | {
"lang": "python",
"repo": "Xavier-Lam/wechat-django",
"path": "/wechat_django/pay/admin/payapp.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|>
class WeChatPayInline(admin.StackedInline):
form = WeChatPayForm
model = WeChatPay
def get_extra(self, request, obj=None):
return 0 if obj.pay else 1
admin.site.unregister(WeChatApp)
@admin.register(WeChatApp)
class WeChatAppWithPayAdmin(WeChatAppAdmin):
inlines = (WeChatPayI... | code_fim | hard | {
"lang": "python",
"repo": "Xavier-Lam/wechat-django",
"path": "/wechat_django/pay/admin/payapp.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> first_name = forms.CharField(max_length=100)
last_name = forms.CharField(max_length=100)<|fim_prefix|># repo: andrewp-as-is/django-examples path: /Forms/API/prefix/forms.py
from django import forms
<|fim_middle|>class PersonForm(forms.Form):
| code_fim | easy | {
"lang": "python",
"repo": "andrewp-as-is/django-examples",
"path": "/Forms/API/prefix/forms.py",
"mode": "spm",
"license": "Unlicense",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: andrewp-as-is/django-examples path: /Forms/API/prefix/forms.py
from django import forms
<|fim_suffix|> first_name = forms.CharField(max_length=100)
last_name = forms.CharField(max_length=100)<|fim_middle|>class PersonForm(forms.Form):
| code_fim | easy | {
"lang": "python",
"repo": "andrewp-as-is/django-examples",
"path": "/Forms/API/prefix/forms.py",
"mode": "psm",
"license": "Unlicense",
"source": "the-stack-v2"
} |
<|fim_suffix|># COMMAND ----------
# Light, all data
df = spark.read.table("light").sort("timestamp")
display(df)
# COMMAND ----------
from pyspark.sql.types import DateType,StructType
from pyspark.sql.functions import col, date_format, avg, min, max,input_file_name, count
dfEventReports = spark.sql("select * from ... | code_fim | hard | {
"lang": "python",
"repo": "hadmacker/garden_databricks",
"path": "/Generate Reports.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|># COMMAND ----------
# Light MTD reports
df = spark.read.table("light")
dfLightMtd = df \
.where(df.month == month) \
.where(df.day <= day) \
.sort("timestamp")
# COMMAND ----------
# Light, MTD
display(dfLightMtd)
# COMMAND ----------
# Light, all data
df = spark.read.table("light").sort("time... | code_fim | hard | {
"lang": "python",
"repo": "hadmacker/garden_databricks",
"path": "/Generate Reports.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: hadmacker/garden_databricks path: /Generate Reports.py
# Databricks notebook source
# Tables:
# light
# humidity
# temperature
import os
spark.conf.set("fs.azure.account.key.gardendatabricksstorage.blob.core.windows.net", dbutils.secrets.get("gardendatabricksecrets", "gardendatabricksstorage-acce... | code_fim | hard | {
"lang": "python",
"repo": "hadmacker/garden_databricks",
"path": "/Generate Reports.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: grpc/grpc path: /src/python/grpcio_tests/tests_aio/unit/done_callback_test.py
# Copyright 2020 The gRPC Authors
#
# 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
#
# ... | code_fim | hard | {
"lang": "python",
"repo": "grpc/grpc",
"path": "/src/python/grpcio_tests/tests_aio/unit/done_callback_test.py",
"mode": "psm",
"license": "BSD-3-Clause",
"source": "the-stack-v2"
} |
<|fim_suffix|> validation = await validation_future
await validation
async def test_error_in_handler(self):
"""Errors in the handler still triggers callbacks."""
validation_future = self.loop.create_future()
async def test_handler(request: bytes, context: aio.ServicerContext... | code_fim | hard | {
"lang": "python",
"repo": "grpc/grpc",
"path": "/src/python/grpcio_tests/tests_aio/unit/done_callback_test.py",
"mode": "spm",
"license": "BSD-3-Clause",
"source": "the-stack-v2"
} |
<|fim_suffix|>def test_online_with_custom_jshost():
online(host="https://my-site.com/js")
bar = create_a_bar(TITLE)
html = bar._repr_html_()
expected_jshost = "https://my-site.com/js"
assert expected_jshost in html
CURRENT_CONFIG.jshost = None
def test_nteract_feature():
enable_nteract()
... | code_fim | hard | {
"lang": "python",
"repo": "SmirkCao/pyecharts",
"path": "/test/test_notebook.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: SmirkCao/pyecharts path: /test/test_notebook.py
# coding=utf8
"""
Test cases for rendering in jupyter notebook
"""
from __future__ import unicode_literals
import json
from pyecharts import Bar, Line, Pie, Page, online
from pyecharts import enable_nteract, configure
import pyecharts.constants as... | code_fim | hard | {
"lang": "python",
"repo": "SmirkCao/pyecharts",
"path": "/test/test_notebook.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|>def test_online_feature():
online()
bar = create_a_bar(TITLE)
html = bar._repr_html_()
expected_jshost = "https://pyecharts.github.io/jupyter-echarts/echarts"
assert expected_jshost in html
CURRENT_CONFIG.hosted_on_github = False
def test_online_with_custom_jshost():
online(h... | code_fim | hard | {
"lang": "python",
"repo": "SmirkCao/pyecharts",
"path": "/test/test_notebook.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|>def _process_path(parsed_args, path: pathlib.Path):
if parsed_args.filter_samples is None:
filter_samples = None
else:
filter_samples = parsed_args.filter_samples.encode("utf8").split(b",")
if parsed_args.validate_samples:
LOG.info(f"validating samples {path}")
... | code_fim | hard | {
"lang": "python",
"repo": "mapillary/mapillary_tools",
"path": "/tests/cli/simple_mp4_parser.py",
"mode": "spm",
"license": "BSD-2-Clause",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: mapillary/mapillary_tools path: /tests/cli/simple_mp4_parser.py
import argparse
import io
import logging
import pathlib
import sys
import typing as T
from mapillary_tools import utils
from mapillary_tools.geotag import (
construct_mp4_parser as cparser,
mp4_sample_parser as sample_parser... | code_fim | hard | {
"lang": "python",
"repo": "mapillary/mapillary_tools",
"path": "/tests/cli/simple_mp4_parser.py",
"mode": "psm",
"license": "BSD-2-Clause",
"source": "the-stack-v2"
} |
<|fim_suffix|> switch = WebPowerSwitch(config_id="web_power_switch")
switch.all_on()
@pytest.mark.usefixtures("dummy_config_ini")
def test_all_off():
switch = WebPowerSwitch(config_id="web_power_switch")
switch.all_off()
@pytest.mark.usefixtures("dummy_config_ini")
def test_individual_on():
switc... | code_fim | medium | {
"lang": "python",
"repo": "spacetelescope/catkit",
"path": "/catkit/emulators/tests/test_web_power_switch.py",
"mode": "spm",
"license": "BSD-3-Clause",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: spacetelescope/catkit path: /catkit/emulators/tests/test_web_power_switch.py
import os
import pytest
from requests import HTTPError
from catkit.config import load_config_ini
from catkit.emulators.WebPowerSwitch import WebPowerSwitch
config_filename = os.path.join(os.path.dirname(os.path.realpa... | code_fim | hard | {
"lang": "python",
"repo": "spacetelescope/catkit",
"path": "/catkit/emulators/tests/test_web_power_switch.py",
"mode": "psm",
"license": "BSD-3-Clause",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: kamaal44/graph-keyword-search path: /src/dig/z-attic/wordSimilarity.py
import urllib.request
import sys
import json
import math
from urllib.parse import quote
from threading import Thread
class WordSimilarity:
scoreDictionary = {}
scoreDictionary['esa'] = 0
scoreDictionary['swoogle'] = 0
#... | code_fim | hard | {
"lang": "python",
"repo": "kamaal44/graph-keyword-search",
"path": "/src/dig/z-attic/wordSimilarity.py",
"mode": "psm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_suffix|> esaThread = Thread(target=WordSimilarity.getEasyESAScore, args=(word1,word2,))
swoogleThread = Thread(target=WordSimilarity.getSwoogleScore, args=(word1,word2,))
esaThread.start()
swoogleThread.start()
esaThread.join()
swoogleThread.join()
ESAscore = WordSimilarity.sco... | code_fim | hard | {
"lang": "python",
"repo": "kamaal44/graph-keyword-search",
"path": "/src/dig/z-attic/wordSimilarity.py",
"mode": "spm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_suffix|> parser.add_argument("-c", "--csv", dest="csv",
help="Use CSV format [default Binary]",
action="store_true", default=False)
parser.add_argument("-i", "--instruments", dest="instruments",
help="Security IDs, space separated lis... | code_fim | hard | {
"lang": "python",
"repo": "maxeler/mdmaker",
"path": "/src/stock.py",
"mode": "spm",
"license": "BSD-2-Clause",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: maxeler/mdmaker path: /src/stock.py
abs(math.log10(MIN_TICK)))
DECIMAL_CONVERT = math.pow(10, DECIMALS)
MAX_QUANTITY = 40
VAL_RATIO_MAX = 0.95
SPREAD_MAX = 20 * MIN_TICK
MAX_DEPTH = 20
MAX_QTY = 100
LEVEL_FIELDS = ['price', 'qty', 'order_count']
TRADE_FIELDS = ['price', 'qty', 'aggressor']
FIELD... | code_fim | hard | {
"lang": "python",
"repo": "maxeler/mdmaker",
"path": "/src/stock.py",
"mode": "psm",
"license": "BSD-2-Clause",
"source": "the-stack-v2"
} |
<|fim_suffix|> while generators:
index = random.randint(0, len(generators)-1)
book = rem_books[index]
gen = generators[index]
try:
(orders, mid) = next(gen)
# book.print()
# print("Target mid --> {}".format(mid))
for order in orders:
... | code_fim | hard | {
"lang": "python",
"repo": "maxeler/mdmaker",
"path": "/src/stock.py",
"mode": "spm",
"license": "BSD-2-Clause",
"source": "the-stack-v2"
} |
<|fim_suffix|> @IpDns2.setter
def IpDns2(self, value):
# type: (str) -> None
self._set_attribute(self._SDM_ATT_MAP["IpDns2"], value)
@property
def IpGateway(self):
# type: () -> str
"""
Returns
-------
- str: The Router address advertised in DHCP O... | code_fim | hard | {
"lang": "python",
"repo": "OpenIxia/ixnetwork_restpy",
"path": "/ixnetwork_restpy/testplatform/sessions/ixnetwork/vport/protocolstack/dhcpserverrange_781e83c7275e9ddd3f2fe82325c0b179.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> self.introduce_area()
self.question_area()
self.show_calculus_symbols()
def introduce_area(self):
area = OldTex("\\text{Area}", "=", "\\pi", "R", "^2")
area.next_to(self.pi_creature.get_corner(UP+RIGHT), UP+RIGHT)
self.remove(self.circle, self.radius_g... | code_fim | hard | {
"lang": "python",
"repo": "3b1b/videos",
"path": "/_2017/eoc/chapter1.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> self.play(
transformed_rings.set_fill, None, 0.2,
Animation(highlighted_ring),
*foreground_animations
)
self.play(
self.dr_group.arrange, DOWN,
self.dr_group.next_to, highlighted_ring,
DOWN, SMALL_BUFF
... | code_fim | hard | {
"lang": "python",
"repo": "3b1b/videos",
"path": "/_2017/eoc/chapter1.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: 3b1b/videos path: /_2017/eoc/chapter1.py
elf.wait()
self.play(
rings.rotate, np.pi/2,
rings.move_to, unwrapped_rings.get_top(),
Animation(self.radius_group),
path_arc = np.pi/2,
**ring_anim_kwargs
)
self.play(
... | code_fim | hard | {
"lang": "python",
"repo": "3b1b/videos",
"path": "/_2017/eoc/chapter1.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> return %s;
}
""" % (repr(code), repr(ERR_MARKER))
f = NamedTemporaryFile(delete=False, suffix='.js')
f.write(interceptor_code.encode('utf-8') if six.PY3 else interceptor_code)
f.close()
p = subprocess.Popen(['node', f.name], stderr=subprocess.PIPE, stdout=subprocess.PIPE)
... | code_fim | hard | {
"lang": "python",
"repo": "PiotrDabkowski/Js2Py",
"path": "/tests/node_eval.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: PiotrDabkowski/Js2Py path: /tests/node_eval.py
import subprocess
from tempfile import NamedTemporaryFile
import six
import re
import os
class NodeJsError(Exception):
pass
<|fim_suffix|> ERR_MARKER = "<<<ERROR_MARKER>>>"
ERR_REGEXP = ERR_MARKER + r'([\s\S]*?)' + ERR_MARKER
interc... | code_fim | medium | {
"lang": "python",
"repo": "PiotrDabkowski/Js2Py",
"path": "/tests/node_eval.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> return 1
def define_demo_execution_repo():
from dagster_aws.s3 import s3_pickle_io_manager, s3_resource
from dagster_docker import docker_executor
@repository
def demo_execution_repo():
return [
with_resources([foo], {"s3": s3_resource, "io_manager": s3_pickle_io... | code_fim | hard | {
"lang": "python",
"repo": "prezi/dagster",
"path": "/python_modules/dagster-test/dagster_test/test_project/test_pipelines/pending_repo.py",
"mode": "spm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: prezi/dagster path: /python_modules/dagster-test/dagster_test/test_project/test_pipelines/pending_repo.py
from dagster import (
AssetKey,
AssetsDefinition,
DagsterInstance,
asset,
define_asset_job,
op,
repository,
with_resources,
)
from dagster._core.definitions.ca... | code_fim | medium | {
"lang": "python",
"repo": "prezi/dagster",
"path": "/python_modules/dagster-test/dagster_test/test_project/test_pipelines/pending_repo.py",
"mode": "psm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_suffix|> Example:
>>>Tweets and Date (Tweets Date
@BongaDlulane Please send an email to mediades...
2019-11-29)
>>>Split Tweets [@bongadlulane, please, send, an, email, to, m...@saucy_mamiie Pls log a call on 0860037566
2019-11-29 [@saucy_mamiie, pls... | code_fim | medium | {
"lang": "python",
"repo": "LawrenceHlapa/Analyse",
"path": "/AnalysePredict/word_splitter.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> Returns:
list: with only the date.
Example:
>>>Tweets and Date (Tweets Date
@BongaDlulane Please send an email to mediades...
2019-11-29)
>>>Split Tweets [@bongadlulane, please, send, an, email, to, m...@saucy_mamiie Pls log a call on 0860... | code_fim | medium | {
"lang": "python",
"repo": "LawrenceHlapa/Analyse",
"path": "/AnalysePredict/word_splitter.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: LawrenceHlapa/Analyse path: /AnalysePredict/word_splitter.py
#!/usr/bin/env python
# coding: utf-8
# In[ ]:
### START FUNCTION
def word_splitter(df):
"""
Splits the sentences in a dataframe's column into a list of the separate words.
<|fim_suffix|> list: with only the date.
... | code_fim | medium | {
"lang": "python",
"repo": "LawrenceHlapa/Analyse",
"path": "/AnalysePredict/word_splitter.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: mworion/MountWizzard4 path: /tests/unit_tests/gui/extWindows/test_messageW.py
############################################################
# -*- coding: utf-8 -*-
#
# # # # # # #
# ## ## # ## # #
# # # # # # # # # # #
# # ## # ## ## ######
# # # ... | code_fim | hard | {
"lang": "python",
"repo": "mworion/MountWizzard4",
"path": "/tests/unit_tests/gui/extWindows/test_messageW.py",
"mode": "psm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_suffix|> suc = function.storeConfig()
assert suc
def test_storeConfig_2(function):
function.app.config['messageW'] = {}
suc = function.storeConfig()
assert suc
def test_closeEvent_1(function):
with mock.patch.object(function,
'show'):
with mock.patch.... | code_fim | hard | {
"lang": "python",
"repo": "mworion/MountWizzard4",
"path": "/tests/unit_tests/gui/extWindows/test_messageW.py",
"mode": "spm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: justinclark-dev/CSC110 path: /code/Chapter-2/future_value.py
# Get the desired future value.
future_value = float(input('Enter the desired future value: '))
<|fim_suffix|># Calculate the amount needed to deposit.
present_value = future_value / (1.0 + rate)**years
# Display the amount needed to ... | code_fim | hard | {
"lang": "python",
"repo": "justinclark-dev/CSC110",
"path": "/code/Chapter-2/future_value.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|># Calculate the amount needed to deposit.
present_value = future_value / (1.0 + rate)**years
# Display the amount needed to deposit.
print('You will need to deposit this amount:', present_value)<|fim_prefix|># repo: justinclark-dev/CSC110 path: /code/Chapter-2/future_value.py
# Get the desired future va... | code_fim | hard | {
"lang": "python",
"repo": "justinclark-dev/CSC110",
"path": "/code/Chapter-2/future_value.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|>__WORKBOOK_FIELDS = f"""
luid
name
site {{
luid
name
}}
projectName
owner {{
{__TABLEAU_USER_FIELDS}
}}
sheets {{
{__SHEETS_FIELDS}
}}
description
vizportalUrlId
createdAt
updatedAt
upstreamTables {{
{__DATABAS... | code_fim | hard | {
"lang": "python",
"repo": "GoogleCloudPlatform/datacatalog-connectors-bi",
"path": "/google-datacatalog-tableau-connector/src/google/datacatalog_connectors/tableau/scrape/metadata_api_constants.py",
"mode": "spm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: GoogleCloudPlatform/datacatalog-connectors-bi path: /google-datacatalog-tableau-connector/src/google/datacatalog_connectors/tableau/scrape/metadata_api_constants.py
#!/usr/bin/python
#
# Copyright 2020 Google LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not us... | code_fim | hard | {
"lang": "python",
"repo": "GoogleCloudPlatform/datacatalog-connectors-bi",
"path": "/google-datacatalog-tableau-connector/src/google/datacatalog_connectors/tableau/scrape/metadata_api_constants.py",
"mode": "psm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_suffix|> command = self.command
for key, value in self.injected_vars.items():
command = ' && '.join([
'{}={}'.format(key, value),
command
])
command_res = delegator.run(command, block=True)
if command_res.return_code != 0:
... | code_fim | hard | {
"lang": "python",
"repo": "faycheng/tpl",
"path": "/tpl/sandbox.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: faycheng/tpl path: /tpl/sandbox.py
# -*- coding:utf-8 -*-
import time
import json
import threading
import delegator
from tpl import errors
from pykit.path.temp import TempPipe
<|fim_suffix|>
# FIXME 需要添加超时支持
def shell_execute(command):
with TempPipe() as tp:
DEFAULT_SHELL_VARS['pipe... | code_fim | hard | {
"lang": "python",
"repo": "faycheng/tpl",
"path": "/tpl/sandbox.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|>
# FIXME 需要添加超时支持
def shell_execute(command):
with TempPipe() as tp:
DEFAULT_SHELL_VARS['pipe'] = tp.pipe_path
ShellExec(command, DEFAULT_SHELL_VARS).start()
time.sleep(0.5)
c = tp.pipe.read()
c.strip()
context = json.loads(c)
return context<|fim_pre... | code_fim | hard | {
"lang": "python",
"repo": "faycheng/tpl",
"path": "/tpl/sandbox.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: rozzac90/betdaq path: /betdaq/filters.py
from betdaq.utils import clean_locals
from betdaq.enums import Boolean, WithdrawRepriceOption, OrderKillType
def create_order(SelectionId, Stake, Price, Polarity, ExpectedSelectionResetCount, ExpectedWithdrawalSequenceNumber,
CancelOnIn... | code_fim | hard | {
"lang": "python",
"repo": "rozzac90/betdaq",
"path": "/betdaq/filters.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> :param BetId: ID of the bet to be updated.
:type BetId: int
:param DeltaStake: Amount to change the stake of the bet by.
:type DeltaStake: float
:param Price: Price at which to place bet at.
:param ExpectedSelectionResetCount: must match SelectionResetCount value in GetMarketInform... | code_fim | hard | {
"lang": "python",
"repo": "rozzac90/betdaq",
"path": "/betdaq/filters.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|>def update_order(BetId, DeltaStake, Price, ExpectedSelectionResetCount, ExpectedWithdrawalSequenceNumber,
CancelOnInRunning=None, CancelIfSelectionReset=None, SetToBeSPIfUnmatched=None):
"""
:param BetId: ID of the bet to be updated.
:type BetId: int
:param DeltaStake... | code_fim | hard | {
"lang": "python",
"repo": "rozzac90/betdaq",
"path": "/betdaq/filters.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> # generate the ground truth for the flaw detector (on labeled data only)
lbs = b // 2
l_fd_loss = fd_criterion(l_flawmap[:lbs, ...], l_flawmap_gt)
l_fd_loss = config.fd_scale * torch.mean(l_fd_loss)
r_fd_loss = fd_criterion(r_flawmap[:lbs, ...],... | code_fim | hard | {
"lang": "python",
"repo": "WindRoseR/TorchSemiSeg",
"path": "/exp.voc/voc8.res50v3+.GCT/train.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: WindRoseR/TorchSemiSeg path: /exp.voc/voc8.res50v3+.GCT/train.py
from __future__ import division
import os.path as osp
import os
import sys
import time
import argparse
import math
from tqdm import tqdm
import torch
import torch.nn as nn
import torch.nn.functional as F
import torch.distributed as... | code_fim | hard | {
"lang": "python",
"repo": "WindRoseR/TorchSemiSeg",
"path": "/exp.voc/voc8.res50v3+.GCT/train.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> if engine.distributed:
train_sampler.set_epoch(epoch)
bar_format = '{desc}[{elapsed}<{remaining},{rate_fmt}]'
if is_debug:
pbar = tqdm(range(10), file=sys.stdout, bar_format=bar_format)
else:
pbar = tqdm(range(config.niters_per_epoch), f... | code_fim | hard | {
"lang": "python",
"repo": "WindRoseR/TorchSemiSeg",
"path": "/exp.voc/voc8.res50v3+.GCT/train.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|>
@md.capture
def create_dirs(_log, simulation_dir, overwrite):
"""
Create the directory for the experiment.
Args:
_log:
experiment_dir (str): path to the experiment directory
overwrite (bool): overwrites the model directory if True
"""
_log.info("Create model ... | code_fim | hard | {
"lang": "python",
"repo": "FollowJack/schnetpack",
"path": "/src/sacred_scripts/run_md.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|>
@md.capture
def load_model(model_path):
return torch.load(model_path)
@md.capture
def setup_simulation(simulation_dir, device, path_to_molecules):
model = load_model()
calculator = build_calculator(model=model)
integrator = build_integrator()
system = build_system(device=device, pat... | code_fim | hard | {
"lang": "python",
"repo": "FollowJack/schnetpack",
"path": "/src/sacred_scripts/run_md.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: FollowJack/schnetpack path: /src/sacred_scripts/run_md.py
from sacred import Experiment
import os
import torch
import yaml
from shutil import rmtree
from schnetpack.sacred.calculator_ingredients import (calculator_ingradient,
build_calculator... | code_fim | hard | {
"lang": "python",
"repo": "FollowJack/schnetpack",
"path": "/src/sacred_scripts/run_md.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> # Get the subscription Id from the request that needs to be resumed
# Saving the Subscription ID from Vendor system is encouraged to be able to map the subscription in Connect
# with the subscription in Vendor system
# The Subscription ID can be saved in a fulfillment param... | code_fim | medium | {
"lang": "python",
"repo": "VTimofeenko/connect-processor-template-for-python",
"path": "/{{cookiecutter.project_slug}}/connect_processor/app/resume.py",
"mode": "spm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: VTimofeenko/connect-processor-template-for-python path: /{{cookiecutter.project_slug}}/connect_processor/app/resume.py
# -*- coding: utf-8 -*-
#
# Copyright (c) {% now 'utc', '%Y' %}, {{ cookiecutter.author }}
# All rights reserved.
#
from connect_processor.app.utils.utils import Utils
from cnct ... | code_fim | hard | {
"lang": "python",
"repo": "VTimofeenko/connect-processor-template-for-python",
"path": "/{{cookiecutter.project_slug}}/connect_processor/app/resume.py",
"mode": "psm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_suffix|>class Ui_Dialog(object):
def setupUi(self, Dialog):
Dialog.setObjectName(_fromUtf8("Dialog"))
Dialog.resize(634, 857)
self.gridLayout = QtGui.QGridLayout(Dialog)
self.gridLayout.setObjectName(_fromUtf8("gridLayout"))
self.verticalLayout = QtGui.QVBoxLayout()
... | code_fim | hard | {
"lang": "python",
"repo": "452sunny/CommoditySearch",
"path": "/TaoBao/TaoBaoSearchMachine-master/table_example.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: 452sunny/CommoditySearch path: /TaoBao/TaoBaoSearchMachine-master/table_example.py
# -*- coding: utf-8 -*-
# Form implementation generated from reading ui file 'table_example.ui'
#
# Created: Tue Aug 08 17:25:48 2017
# by: PyQt4 UI code generator 4.10
#
# WARNING! All changes made in this f... | code_fim | hard | {
"lang": "python",
"repo": "452sunny/CommoditySearch",
"path": "/TaoBao/TaoBaoSearchMachine-master/table_example.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> self.retranslateUi(Dialog)
QtCore.QMetaObject.connectSlotsByName(Dialog)
def retranslateUi(self, Dialog):
Dialog.setWindowTitle(_translate("Dialog", "Dialog", None))
self.label.setText(_translate("Dialog", "Item", None))
self.confirm.setText(_translate("Dialog"... | code_fim | hard | {
"lang": "python",
"repo": "452sunny/CommoditySearch",
"path": "/TaoBao/TaoBaoSearchMachine-master/table_example.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: bsoher/vespa_py2 path: /vespa/analysis/chain_prep_timeseries.py
# Python modules
from __future__ import division
# 3rd party modules
import numpy as np
# Our modules
import vespa.analysis.constants as constants
import vespa.analysis.chain_prep_identity as chain_prep_identity
import vespa.analy... | code_fim | hard | {
"lang": "python",
"repo": "bsoher/vespa_py2",
"path": "/vespa/analysis/chain_prep_timeseries.py",
"mode": "psm",
"license": "BSD-3-Clause",
"source": "the-stack-v2"
} |
<|fim_suffix|> Results from processing the last call to run() are maintained in
this object until overwritten by a subsequent call to run(). This
allows the View to update itself from these arrays without having
to re-run the pipeline every time.
Use of 'entry points' ... | code_fim | hard | {
"lang": "python",
"repo": "bsoher/vespa_py2",
"path": "/vespa/analysis/chain_prep_timeseries.py",
"mode": "spm",
"license": "BSD-3-Clause",
"source": "the-stack-v2"
} |
<|fim_suffix|> '''
Retrieve a 'kadastrale afdeling' by id.
:param aid: An id of a `kadastrale afdeling`.
:rtype: A :class:`Afdeling`.
'''
def creator():
url = self.base_url + '/department/%s' % (aid)
h = self.base_headers
p = {
... | code_fim | hard | {
"lang": "python",
"repo": "mbtronics/crabpy",
"path": "/crabpy/gateway/capakey.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: mbtronics/crabpy path: /crabpy/gateway/capakey.py
g for the
calls made by the gateway.
:param client: A :class:`suds.client.Client` for the CAPAKEY service.
:param string action: Which method to call, eg. `ListAdmGemeenten`.
:returns: Result of the SOAP call.
'''
try:
... | code_fim | hard | {
"lang": "python",
"repo": "mbtronics/crabpy",
"path": "/crabpy/gateway/capakey.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> def get_perceel_by_capakey(self, capakey):
'''
Get a `perceel`.
:param capakey: An capakey for a `perceel`.
:rtype: :class:`Perceel`
'''
def creator():
url = self.base_url + '/parcel/%s' % capakey
h = self.base_headers
... | code_fim | hard | {
"lang": "python",
"repo": "mbtronics/crabpy",
"path": "/crabpy/gateway/capakey.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: ihsansaktia/ugrade path: /server/contests/migrations/0006_auto_20190327_0826.py
# Generated by Django 2.1.7 on 2019-03-27 08:26
from django.db import migrations, models
import django.db.models.deletion
class Migration(migrations.Migration):
<|fim_suffix|> operations = [
migrations.... | code_fim | hard | {
"lang": "python",
"repo": "ihsansaktia/ugrade",
"path": "/server/contests/migrations/0006_auto_20190327_0826.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> operations = [
migrations.CreateModel(
name='Grading',
fields=[
('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
('issued_time', models.DateTimeField(auto_now_add=True)),
(... | code_fim | hard | {
"lang": "python",
"repo": "ihsansaktia/ugrade",
"path": "/server/contests/migrations/0006_auto_20190327_0826.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> """
Create a generic interface to wrap salt zeromq req calls.
"""
def __init__(self, master, id_="", serial="msgpack", linger=0, opts=None):
self.master = master
self.id_ = id_
self.linger = linger
self.context = zmq.Context()
self.poller = zmq.Poll... | code_fim | hard | {
"lang": "python",
"repo": "saltstack/salt",
"path": "/salt/payload.py",
"mode": "spm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: saltstack/salt path: /salt/payload.py
"""
Many aspects of the salt payload need to be managed, from the return of
encrypted keys to general payload dynamics and packaging, these happen
in here
"""
import collections.abc
import datetime
import gc
import logging
import salt.loader.context
import ... | code_fim | hard | {
"lang": "python",
"repo": "saltstack/salt",
"path": "/salt/payload.py",
"mode": "psm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: tspannhw/cookiecutter-rest-api path: /{{cookiecutter.app_name}}/setup.py
from setuptools import setup, find_packages
# get required packages for the Pipfile or requirements file
try:
from pipenv.project import Project
from pipenv.utils import convert_deps_to_pip
pfile = Project().pa... | code_fim | hard | {
"lang": "python",
"repo": "tspannhw/cookiecutter-rest-api",
"path": "/{{cookiecutter.app_name}}/setup.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> test_suite='pytest',
tests_require=test_requirements,
data_files=[('', BUILD_REQUIRED_FILES)],
entry_points={
'console_scripts': [
'{{cookiecutter.app_name}} = {{cookiecutter.app_name}}.manage:cli'
]
}
)<|fim_prefix|># repo: tspannhw/cookiec... | code_fim | hard | {
"lang": "python",
"repo": "tspannhw/cookiecutter-rest-api",
"path": "/{{cookiecutter.app_name}}/setup.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|>BUILD_REQUIRED_FILES = (
'LICENSE',
'AUTHORS.rst',
'CONTRIBUTING.rst',
'HISTORY.rst',
'README.md',
'Pipfile',
'Pipfile.lock',
'requirements/prod.txt',
'requirements/dev.txt'
)
readme = open('README.md').read()
history = open('HISTORY.rst').read().replace('.. :changelog... | code_fim | hard | {
"lang": "python",
"repo": "tspannhw/cookiecutter-rest-api",
"path": "/{{cookiecutter.app_name}}/setup.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|>
__all__ = [
"TopDownBottomUp",
"Pythia",
"LoRRA",
"BAN",
"BaseModel",
"BUTD",
"MMBTForClassification",
"MMBTForPreTraining",
"FusionBase",
"ConcatBoW",
"ConcatBERT",
"LateFusion",
"CNNLSTM",
"M4C",
"M4CCaptioner",
"MMBT",
"VisualBERT",
... | code_fim | hard | {
"lang": "python",
"repo": "facebookresearch/worldsheet",
"path": "/mmf/models/__init__.py",
"mode": "spm",
"license": "BSD-3-Clause",
"source": "the-stack-v2"
} |
<|fim_suffix|>__all__ = [
"TopDownBottomUp",
"Pythia",
"LoRRA",
"BAN",
"BaseModel",
"BUTD",
"MMBTForClassification",
"MMBTForPreTraining",
"FusionBase",
"ConcatBoW",
"ConcatBERT",
"LateFusion",
"CNNLSTM",
"M4C",
"M4CCaptioner",
"MMBT",
"VisualBERT",
... | code_fim | hard | {
"lang": "python",
"repo": "facebookresearch/worldsheet",
"path": "/mmf/models/__init__.py",
"mode": "spm",
"license": "BSD-3-Clause",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: facebookresearch/worldsheet path: /mmf/models/__init__.py
# Copyright (c) Facebook, Inc. and its affiliates.
# All rights reserved.
# This source code is licensed under the BSD-style license found in the
# LICENSE file in the root directory of this source tree.
# isort:skip_file
<|fim_suffix|>_... | code_fim | hard | {
"lang": "python",
"repo": "facebookresearch/worldsheet",
"path": "/mmf/models/__init__.py",
"mode": "psm",
"license": "BSD-3-Clause",
"source": "the-stack-v2"
} |
<|fim_suffix|>['deviceName'] = 'sdk_google_phone_x86'<|fim_prefix|># repo: yehonadav/yonadav_tutorials path: /learn_python/learn_appium/sample-code-master/sample-code/examples/python/desired_capabilities.py
desired_caps = {}
desired_caps['platformName'] = 'Android'
# desired_caps['pl<|fim_middle|>atformVersion'] = '5.... | code_fim | easy | {
"lang": "python",
"repo": "yehonadav/yonadav_tutorials",
"path": "/learn_python/learn_appium/sample-code-master/sample-code/examples/python/desired_capabilities.py",
"mode": "spm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.