text stringlengths 232 16.3k | domain stringclasses 1
value | difficulty stringclasses 3
values | meta dict |
|---|---|---|---|
<|fim_suffix|>afParseNode",
"InternalTreebankNode",
"LeafTreebankNode",
"get_position",
)<|fim_prefix|># repo: LucasMoncuit/ucca-parser path: /parser/convert/__init__.py
from .convert import UCCA2tree, to_UCCA
from .trees import InternalParseNode, LeafParseNode
from .trees import InternalTreebankNode, Leaf... | code_fim | medium | {
"lang": "python",
"repo": "LucasMoncuit/ucca-parser",
"path": "/parser/convert/__init__.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|>position
__all__ = (
"UCCA2tree",
"to_UCCA",
"InternalParseNode",
"LeafParseNode",
"InternalTreebankNode",
"LeafTreebankNode",
"get_position",
)<|fim_prefix|># repo: LucasMoncuit/ucca-parser path: /parser/convert/__init__.py
from .convert import UCCA2tree, to_UCCA
from .trees... | code_fim | medium | {
"lang": "python",
"repo": "LucasMoncuit/ucca-parser",
"path": "/parser/convert/__init__.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: lotrien/metis path: /metis/telegram.py
import telegram
class Telegram:
def __init__(self, token, recipient_id):
<|fim_suffix|> with open(path, 'rb') as doc:
self._bot.send_document(chat_id=self._recipient_id, document=doc)<|fim_middle|> self._recipient_id = recipi... | code_fim | hard | {
"lang": "python",
"repo": "lotrien/metis",
"path": "/metis/telegram.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> with open(path, 'rb') as doc:
self._bot.send_document(chat_id=self._recipient_id, document=doc)<|fim_prefix|># repo: lotrien/metis path: /metis/telegram.py
import telegram
class Telegram:
def __init__(self, token, recipient_id):
<|fim_middle|> self._recipient_id = recipi... | code_fim | hard | {
"lang": "python",
"repo": "lotrien/metis",
"path": "/metis/telegram.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|>
@pytest.mark.asyncio
async def test_sync_ctx_manager():
"""Calling scope as a synchronous context manager"""
with pytest.raises(RuntimeError):
with Scope():
pass<|fim_prefix|># repo: RouquinBlanc/traio path: /tests/test_misuse.py
"""
Test various misuse of this library.
"""
... | code_fim | hard | {
"lang": "python",
"repo": "RouquinBlanc/traio",
"path": "/tests/test_misuse.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: RouquinBlanc/traio path: /tests/test_misuse.py
"""
Test various misuse of this library.
"""
import pytest
from traio import Scope
<|fim_suffix|>
@pytest.mark.asyncio
async def test_sync_ctx_manager():
"""Calling scope as a synchronous context manager"""
with pytest.raises(RuntimeError... | code_fim | hard | {
"lang": "python",
"repo": "RouquinBlanc/traio",
"path": "/tests/test_misuse.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|>@pytest.mark.asyncio
async def test_sync_ctx_manager():
"""Calling scope as a synchronous context manager"""
with pytest.raises(RuntimeError):
with Scope():
pass<|fim_prefix|># repo: RouquinBlanc/traio path: /tests/test_misuse.py
"""
Test various misuse of this library.
"""
i... | code_fim | hard | {
"lang": "python",
"repo": "RouquinBlanc/traio",
"path": "/tests/test_misuse.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: Enmin/ModellingJointInferenceOfPhysicsAndMind path: /tests/testDataTools.py
import sys
import os
sys.path.append('..')
import unittest
from ddt import ddt, data, unpack
import numpy as np
from src.neuralNetwork.dataTools import createSymmetricVector
<|fim_suffix|> self.assertTrue(np.allc... | code_fim | hard | {
"lang": "python",
"repo": "Enmin/ModellingJointInferenceOfPhysicsAndMind",
"path": "/tests/testDataTools.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> @data((np.array([1, 1]), np.array([0.5, 0]), np.array([0, 0.5])))
@unpack
def testcreateSymmetricVector(self, symmetricAxis, originalVector, groundTruth):
self.assertTrue(np.allclose(createSymmetricVector(symmetricAxis, originalVector), groundTruth, rtol=1e-05, atol=1e-08))
if __name... | code_fim | medium | {
"lang": "python",
"repo": "Enmin/ModellingJointInferenceOfPhysicsAndMind",
"path": "/tests/testDataTools.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> self.assertTrue(np.allclose(createSymmetricVector(symmetricAxis, originalVector), groundTruth, rtol=1e-05, atol=1e-08))
if __name__ == "__main__":
unittest.main()<|fim_prefix|># repo: Enmin/ModellingJointInferenceOfPhysicsAndMind path: /tests/testDataTools.py
import sys
import os
sys.path.a... | code_fim | hard | {
"lang": "python",
"repo": "Enmin/ModellingJointInferenceOfPhysicsAndMind",
"path": "/tests/testDataTools.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: greenelab/core-accessory-interactome path: /1_processing/composition_of_compendia.py
# ---
# jupyter:
# jupytext:
# formats: ipynb,py
# text_representation:
# extension: .py
# format_name: light
# format_version: '1.5'
# jupytext_version: 1.9.1+dev
# kernelspec... | code_fim | hard | {
"lang": "python",
"repo": "greenelab/core-accessory-interactome",
"path": "/1_processing/composition_of_compendia.py",
"mode": "psm",
"license": "BSD-3-Clause",
"source": "the-stack-v2"
} |
<|fim_suffix|>both_metadata_first_function
# +
# Output function metadata for Georgia to review
# both_metadata_first_function.T.to_csv("gene_function_legend.tsv", sep="\t")
# -
# Note: this figure is no longer used in the manuscript
fig_function = both_metadata_first_function.plot(
kind="bar", stacked=True, colo... | code_fim | hard | {
"lang": "python",
"repo": "greenelab/core-accessory-interactome",
"path": "/1_processing/composition_of_compendia.py",
"mode": "spm",
"license": "BSD-3-Clause",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: zhangzhehong/multiagent-shapeformation path: /cost_heur_astar.py
import pqueue
INSANE_HIGH = 1000
def manhattan_dist(a, b):
return abs(a[0] - b[0]) + abs(a[1] - b[1])
def least_dist_to_b(a, b):
min_dist = manhattan_dist(a, b[0])
for _b in b:
temp_dist = manhattan_dist(a, _b... | code_fim | hard | {
"lang": "python",
"repo": "zhangzhehong/multiagent-shapeformation",
"path": "/cost_heur_astar.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> if not (n in todo):
# we haven't looked at this tile yet, so calculate its costs
g = costs[cur][0] + cost(cur)
h = heuristic(n, end)
costs[n] = (g, h)
parents[n] = cur
todo.update(n, g + h)
... | code_fim | hard | {
"lang": "python",
"repo": "zhangzhehong/multiagent-shapeformation",
"path": "/cost_heur_astar.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> # tiles we've been to
visited = set()
# associated G and H costs for each tile (tuples of G, H)
if(not costs):
costs = dict()
for start_pos in start:
costs[start_pos] = (0, least_dist_to_b(start_pos, end))
# parents for each tile
parents = {}
# while ( ( ... | code_fim | hard | {
"lang": "python",
"repo": "zhangzhehong/multiagent-shapeformation",
"path": "/cost_heur_astar.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> return dict(Counter([
entity[field] for entity in doc_list
if field in entity
]))
def _count_array_field(doc_list, field):
return dict(Counter(_flatten([
entity[field] for entity in doc_list
if field in entity
])))
def _flatten(a_list):
return sum(a_... | code_fim | hard | {
"lang": "python",
"repo": "cebriggs7135/search-api",
"path": "/src/elasticsearch/addl_index_transformations/portal/add_counts.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: cebriggs7135/search-api path: /src/elasticsearch/addl_index_transformations/portal/add_counts.py
from collections import Counter
def add_counts(doc):
'''
>>> from pprint import pprint
>>> doc = {
... 'ancestors': [
... {'entity_type': 'Donor'},
... {'ent... | code_fim | medium | {
"lang": "python",
"repo": "cebriggs7135/search-api",
"path": "/src/elasticsearch/addl_index_transformations/portal/add_counts.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|>def _count_field(doc_list, field):
return dict(Counter([
entity[field] for entity in doc_list
if field in entity
]))
def _count_array_field(doc_list, field):
return dict(Counter(_flatten([
entity[field] for entity in doc_list
if field in entity
])))
def ... | code_fim | hard | {
"lang": "python",
"repo": "cebriggs7135/search-api",
"path": "/src/elasticsearch/addl_index_transformations/portal/add_counts.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> def test_directory_path_with_dot(self):
path = os.path.join('.', 'directory', 'image.png')
key = deploy.key_name_from_path(path)
self.assertEqual(key, 'directory/image.png')<|fim_prefix|># repo: dtolb/s3-deploy-website path: /s3_deploy/tests/test_deploy.py
import unittest
imp... | code_fim | hard | {
"lang": "python",
"repo": "dtolb/s3-deploy-website",
"path": "/s3_deploy/tests/test_deploy.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: dtolb/s3-deploy-website path: /s3_deploy/tests/test_deploy.py
import unittest
import os
from s3_deploy import deploy
class KeyNameFromPathTest(unittest.TestCase):
def test_base_path(self):
key = deploy.key_name_from_path('index.html')
self.assertEqual(key, 'index.html')
<... | code_fim | hard | {
"lang": "python",
"repo": "dtolb/s3-deploy-website",
"path": "/s3_deploy/tests/test_deploy.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: webclinic017/gcp-database-as-a-service-stock-markets path: /data_service/views/scrapper.py
import typing
from flask import jsonify, current_app
from data_service.config.exceptions import DataServiceError
from data_service.store.scrapper import ScrapperTempStore
from data_service.utils.utils impo... | code_fim | medium | {
"lang": "python",
"repo": "webclinic017/gcp-database-as-a-service-stock-markets",
"path": "/data_service/views/scrapper.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> if isinstance(data_id, str):
scrapper_temp_list: typing.List[ScrapperTempStore] = ScrapperTempStore.query(ScrapperTempStore.data_id == data_id).fetch()
if len(scrapper_temp_list) > 0:
scrapper_temp_instance = scrapper_temp_list[0]
scrapper_te... | code_fim | hard | {
"lang": "python",
"repo": "webclinic017/gcp-database-as-a-service-stock-markets",
"path": "/data_service/views/scrapper.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: KolaHSH/Latex-Part1 path: /国外高校/phd-thesis-master/scripts/ch5_tree.py
import numpy as np
import matplotlib.pyplot as plt
np.random.seed(0)
X = np.random.rand(300, 2)
y = (X[:,0] > 0.3) & (X[:,0] < 0.7) & (X[:,1] > 0.3) & (X[:,1] < 0.7)
# randomly flips some labels
mask = np.random.permutation(l... | code_fim | medium | {
"lang": "python",
"repo": "KolaHSH/Latex-Part1",
"path": "/国外高校/phd-thesis-master/scripts/ch5_tree.py",
"mode": "psm",
"license": "BSD-3-Clause",
"source": "the-stack-v2"
} |
<|fim_suffix|># decision tree
from sklearn.tree import DecisionTreeClassifier
clf = DecisionTreeClassifier(max_leaf_nodes=5).fit(X, y)
print "children_left =", clf.tree_.children_left
print "children_right =", clf.tree_.children_right
print "feature =", clf.tree_.feature
print "threshold =", clf.tree_.threshold
print "... | code_fim | medium | {
"lang": "python",
"repo": "KolaHSH/Latex-Part1",
"path": "/国外高校/phd-thesis-master/scripts/ch5_tree.py",
"mode": "spm",
"license": "BSD-3-Clause",
"source": "the-stack-v2"
} |
<|fim_suffix|>X_c2 = X[y == 1]
plt.scatter(X_c2[:, 0], X_c2[:, 1], color=(0, 0, 1.0))
# decision tree
from sklearn.tree import DecisionTreeClassifier
clf = DecisionTreeClassifier(max_leaf_nodes=5).fit(X, y)
print "children_left =", clf.tree_.children_left
print "children_right =", clf.tree_.children_right
print "featu... | code_fim | medium | {
"lang": "python",
"repo": "KolaHSH/Latex-Part1",
"path": "/国外高校/phd-thesis-master/scripts/ch5_tree.py",
"mode": "spm",
"license": "BSD-3-Clause",
"source": "the-stack-v2"
} |
<|fim_suffix|> print(list(features.values()))
# Combination
x = tf.concat(list(features.values()), 1, name='ConcatAllFeatures')
x = tf.layers.dense(x, 64, tf.nn.relu6)
x = tf.layers.dense(x, 64, tf.nn.relu6)
if return_internals:
return... | code_fim | hard | {
"lang": "python",
"repo": "minfawang/cs221-pommerman",
"path": "/playground/examples/pommerman_network.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: minfawang/cs221-pommerman path: /playground/examples/pommerman_network.py
from tensorforce.core.networks import Network
import tensorflow as tf
## DEPRECATED ##
class PommerNet(Network):
def __init__(self, scope='network', summary_labels=None):
super().__init__(scope, summary_labels... | code_fim | hard | {
"lang": "python",
"repo": "minfawang/cs221-pommerman",
"path": "/playground/examples/pommerman_network.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|>##################################################
## V2
##################################################
'''
We use a standard deep RL setup for our agents. The agent’s policy and value functions are
parameterized by a convolutional neural network with 2 layers each of 32 output channels, followed
by t... | code_fim | hard | {
"lang": "python",
"repo": "minfawang/cs221-pommerman",
"path": "/playground/examples/pommerman_network.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> # if c % 16 == 0, h and w == 1, five2four is a reshape operation
if shape_is_dynamic(data):
call_reshape = isinstance(h, int) and isinstance(w, int) and h == 1 and w == 1
else:
call_reshape = h == 1 and w == 1 and c % 16 == 0
c_value = None
expansion = None
if forma... | code_fim | hard | {
"lang": "python",
"repo": "mindspore-ai/akg",
"path": "/python/akg/ops/array/ascend/five2four.py",
"mode": "spm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: mindspore-ai/akg path: /python/akg/ops/array/ascend/five2four.py
#!/usr/bin/env python3
# coding: utf-8
# Copyright 2019-2021 Huawei Technologies Co., Ltd
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You m... | code_fim | hard | {
"lang": "python",
"repo": "mindspore-ai/akg",
"path": "/python/akg/ops/array/ascend/five2four.py",
"mode": "psm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_suffix|> """Custom tiling strategy for five2four op."""
strategy = list()
if c_value is None:
strategy = ct_util.create_template(tensor=tensor,
template=ct_util.TileTemplate.NC1HWC0)
elif not shape_is_dynamic(tensor):
c_value = 16 if c_valu... | code_fim | hard | {
"lang": "python",
"repo": "mindspore-ai/akg",
"path": "/python/akg/ops/array/ascend/five2four.py",
"mode": "spm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_suffix|>loop = asyncio.get_event_loop()
loop.run_until_complete(main())<|fim_prefix|># repo: ligyjoseph26/ShazamIO path: /examples/top_tracks_country.py
import asyncio
from shazamio import Shazam, serialize_track
<|fim_middle|>async def main():
shazam = Shazam()
top_five_track_from_amsterdam = await sh... | code_fim | hard | {
"lang": "python",
"repo": "ligyjoseph26/ShazamIO",
"path": "/examples/top_tracks_country.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: ligyjoseph26/ShazamIO path: /examples/top_tracks_country.py
import asyncio
from shazamio import Shazam, serialize_track
<|fim_suffix|>loop = asyncio.get_event_loop()
loop.run_until_complete(main())<|fim_middle|>async def main():
shazam = Shazam()
top_five_track_from_amsterdam = await sh... | code_fim | hard | {
"lang": "python",
"repo": "ligyjoseph26/ShazamIO",
"path": "/examples/top_tracks_country.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|>6a^1HfYPzedcpSwq*82jYH9R"
SESSION_COOKIE_HTTPONLY = True
SESSION_COOKIE_SECURE = True<|fim_prefix|># repo: uk-gov-mirror/LandRegistry.govuk-frontend-wtf-demo path: /config.py
import os
class Config(object):
SECRET_K<|fim_middle|>EY = os.environ.get("SECRET_KEY") or "5L18nw&y | code_fim | easy | {
"lang": "python",
"repo": "uk-gov-mirror/LandRegistry.govuk-frontend-wtf-demo",
"path": "/config.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|>TTPONLY = True
SESSION_COOKIE_SECURE = True<|fim_prefix|># repo: uk-gov-mirror/LandRegistry.govuk-frontend-wtf-demo path: /config.py
import os
class Config(object):
SECRET_KEY = os.environ.get("SECRET_KEY") or "5L18nw&y<|fim_middle|>6a^1HfYPzedcpSwq*82jYH9R"
SESSION_COOKIE_H | code_fim | easy | {
"lang": "python",
"repo": "uk-gov-mirror/LandRegistry.govuk-frontend-wtf-demo",
"path": "/config.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: uk-gov-mirror/LandRegistry.govuk-frontend-wtf-demo path: /config.py
import os
class Config(object):
SECRET_K<|fim_suffix|>TTPONLY = True
SESSION_COOKIE_SECURE = True<|fim_middle|>EY = os.environ.get("SECRET_KEY") or "5L18nw&y6a^1HfYPzedcpSwq*82jYH9R"
SESSION_COOKIE_H | code_fim | medium | {
"lang": "python",
"repo": "uk-gov-mirror/LandRegistry.govuk-frontend-wtf-demo",
"path": "/config.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|>def main():
files_list = sorted(glob(os.path.join(my_folder, '*.gif')))
for i in range(0, len(files_list)):
doc_name = files_list[i].split('/')[-1]
r = requests.get('https://api.vk.com/method/docs.getUploadServer?', params={'access_token': token, 'v': v}).js... | code_fim | hard | {
"lang": "python",
"repo": "MasterScott/vk_scripts",
"path": "/vk_doc_upload.py",
"mode": "spm",
"license": "WTFPL",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: MasterScott/vk_scripts path: /vk_doc_upload.py
#!/usr/bin/python3
import requests
import json
import os
from time import sleep
from glob import glob
from random import randint
v=5.67
token = 'Your token'
user_id = 415577518
chat_const = 2000000000
peer_id = chat_const + 10
my_folder = "/home/r... | code_fim | hard | {
"lang": "python",
"repo": "MasterScott/vk_scripts",
"path": "/vk_doc_upload.py",
"mode": "psm",
"license": "WTFPL",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: billhhh/mb_pysol path: /3[20170829 师姐给]/demo_sol.py
import numpy
import scipy
from sklearn import datasets
from sol_classifiers import ogd
<|fim_suffix|>
X_test=iris.data[45:46]
Y_test=iris.target[45:46]
clf=ogd(eta=0.1)
clf.fit(X_train,Y_train)
print(clf.predict... | code_fim | medium | {
"lang": "python",
"repo": "billhhh/mb_pysol",
"path": "/3[20170829 师姐给]/demo_sol.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|>
X_test=iris.data[45:46]
Y_test=iris.target[45:46]
clf=ogd(eta=0.1)
clf.fit(X_train,Y_train)
print(clf.predict(X_test))<|fim_prefix|># repo: billhhh/mb_pysol path: /3[20170829 师姐给]/demo_sol.py
import numpy
import scipy
from sklearn import datasets
<|fim_middle|>from sol_cla... | code_fim | medium | {
"lang": "python",
"repo": "billhhh/mb_pysol",
"path": "/3[20170829 师姐给]/demo_sol.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: luogan1234/HEAT path: /processor.py
import torch
import torch.nn as nn
import torch.nn.functional as F
import torch.optim as optim
from sklearn.metrics import accuracy_score, f1_score
import os
import json
import numpy as np
import tqdm
import random
import transformers
from model.mode... | code_fim | hard | {
"lang": "python",
"repo": "luogan1234/HEAT",
"path": "/processor.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> def train(self):
print('Train starts:')
self.model = Model(self.config)
print('model parameters number: {}.'.format(sum(p.numel() for p in self.model.parameters() if p.requires_grad)))
self.model.to(self.config.device)
self.optimizer = optim.AdamW(self.mode... | code_fim | hard | {
"lang": "python",
"repo": "luogan1234/HEAT",
"path": "/processor.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> return F.softmax(outputs, -1).detach().cpu().numpy()
def dropout_tensor(self, tensor):
return torch.empty_like(tensor).bernoulli_(1-self.config.con_dropout_rate)*tensor
def dropout_batch(self, batch):
new_batch = copy.deepcopy(batch)
# dropout token... | code_fim | hard | {
"lang": "python",
"repo": "luogan1234/HEAT",
"path": "/processor.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> def solve(self, numero_bailes):
combinaciones_invitados = []
combinaciones_invitados_append = combinaciones_invitados.append
for invite in combinations_with_replacement(range(numero_bailes + 1), 3):
nlogonia, cuadradonia, cubiconia = invite
if cubiconi... | code_fim | hard | {
"lang": "python",
"repo": "ssebastianj/taip-2012",
"path": "/baile-reconciliacion/solution.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> combinaciones_invitados = []
combinaciones_invitados_append = combinaciones_invitados.append
for invite in combinations_with_replacement(range(numero_bailes + 1), 3):
nlogonia, cuadradonia, cubiconia = invite
if cubiconia >= cuadradonia >= nlogonia:
... | code_fim | hard | {
"lang": "python",
"repo": "ssebastianj/taip-2012",
"path": "/baile-reconciliacion/solution.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: ssebastianj/taip-2012 path: /baile-reconciliacion/solution.py
# -*- coding: utf-8 -*-
from itertools import combinations_with_replacement
class BaileReconciliacion(object):
def solve(self, numero_bailes):
<|fim_suffix|> for invite in combinations_with_replacement(range(numero_bailes... | code_fim | hard | {
"lang": "python",
"repo": "ssebastianj/taip-2012",
"path": "/baile-reconciliacion/solution.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> # ### commands auto generated by Alembic - please adjust! ###
op.drop_column('users', 'is_pass_tutorial')
op.drop_column('users', 'store_code')
op.drop_column('users', 'country')
op.drop_column('users', 'currency')
# ### end Alembic commands ###<|fim_prefix|># repo: Sivanwol/demo-e... | code_fim | hard | {
"lang": "python",
"repo": "Sivanwol/demo-ecom-server",
"path": "/src/migrations/versions/dbad07d7ae72_update_user_that_passed_tutrial.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> # ### commands auto generated by Alembic - please adjust! ###
op.add_column('users', sa.Column('is_pass_tutorial', sa.BOOLEAN(),
nullable=False, default=False))
op.add_column('users', sa.Column('store_code', sa.String(length=100),
... | code_fim | medium | {
"lang": "python",
"repo": "Sivanwol/demo-ecom-server",
"path": "/src/migrations/versions/dbad07d7ae72_update_user_that_passed_tutrial.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: Sivanwol/demo-ecom-server path: /src/migrations/versions/dbad07d7ae72_update_user_that_passed_tutrial.py
"""update user that passed tutrial
Revision ID: dbad07d7ae72
Revises: 18b3eb5a6735
Create Date: 2021-05-24 11:42:34.089588
"""
from alembic import op
import sqlalchemy as sa
# revision iden... | code_fim | medium | {
"lang": "python",
"repo": "Sivanwol/demo-ecom-server",
"path": "/src/migrations/versions/dbad07d7ae72_update_user_that_passed_tutrial.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> # Forward pass
inputs = {'point_clouds': batch_data_label['point_clouds']}
with torch.no_grad():
end_points = net(inputs, end_points)
# Compute loss
for key in batch_data_label:
end_points[key] = batch_data_label[key]
loss, end_point... | code_fim | hard | {
"lang": "python",
"repo": "aiedward/H3DNet",
"path": "/eval.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: aiedward/H3DNet path: /eval.py
# Copyright (c) Facebook, Inc. and its affiliates.
#
# This source code is licensed under the MIT license found in the
# LICENSE file in the root directory of this source tree.
""" Evaluation routine for 3D object detection with SUN RGB-D and ScanNet.
"""
import ... | code_fim | hard | {
"lang": "python",
"repo": "aiedward/H3DNet",
"path": "/eval.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> batch_pred_map_cls = parse_predictions(end_points, CONFIG_DICT, opt_ang=(FLAGS.dataset == 'sunrgbd'))
batch_gt_map_cls = parse_groundtruths(end_points, CONFIG_DICT)
ap_calculator.step(batch_pred_map_cls, batch_gt_map_cls)
batch_pred_map_cls = parse_predictions(end_points,... | code_fim | hard | {
"lang": "python",
"repo": "aiedward/H3DNet",
"path": "/eval.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: Data-Warehouse-Tongji-SSE/README path: /数据存储说明文件/hive数据处理脚本/hive获取schema.py
from flask import Flask,jsonify,request
from impala.dbapi import connect
import time as Time
from xlwt import *
hiveconn = connect(host='8.133.173.118', port=10000, database='default', user='123', password='123', auth_m... | code_fim | medium | {
"lang": "python",
"repo": "Data-Warehouse-Tongji-SSE/README",
"path": "/数据存储说明文件/hive数据处理脚本/hive获取schema.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|>def get_column_info(table):
sql = 'desc {table}'.format(table=table)
info = {'table':table,'fields':[]}
with hiveconn.cursor() as cursor:
cursor.execute(sql)
res = cursor.fetchall()
for item in res:
if item[0] == '':
break
info['f... | code_fim | hard | {
"lang": "python",
"repo": "Data-Warehouse-Tongji-SSE/README",
"path": "/数据存储说明文件/hive数据处理脚本/hive获取schema.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> row += 1
sheet.write(row,0,u'名称')
sheet.write(row,1,u'类型')
sheet.write(row,2,u'解释')
row += 1
fields = tableinfo['fields']
for field in fields:
sheet.write(row,0,field['name'])
sheet.write(row,1,field['type'])
row += 1
return row + 1
de... | code_fim | hard | {
"lang": "python",
"repo": "Data-Warehouse-Tongji-SSE/README",
"path": "/数据存储说明文件/hive数据处理脚本/hive获取schema.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> masks_exc, ambiguities = self._get_masks()
if ambiguities:
raise ValueError('Ambiguous instruction encodings: ' +
', '.join(ambiguities))
self._masks = masks_exc
def grouped_insns(self) -> List[Tuple[InsnGroup, List[Insn]]]:
''... | code_fim | hard | {
"lang": "python",
"repo": "lowRISC/opentitan",
"path": "/hw/ip/otbn/util/shared/insn_yaml.py",
"mode": "spm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_suffix|> # The pair of instructions is ambiguous if a bit pattern might be
# either instruction. That happens if each bit index is either
# allowed to be a 0 in both or allowed to be a 1 in both.
# ambiguous_mask is the set of bits that don't distinguish the
... | code_fim | hard | {
"lang": "python",
"repo": "lowRISC/opentitan",
"path": "/hw/ip/otbn/util/shared/insn_yaml.py",
"mode": "spm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: lowRISC/opentitan path: /hw/ip/otbn/util/shared/insn_yaml.py
utors.
# Licensed under the Apache License, Version 2.0, see LICENSE for details.
# SPDX-License-Identifier: Apache-2.0
'''Support code for reading the instruction database in insns.yml'''
import itertools
import os
import re
from typ... | code_fim | hard | {
"lang": "python",
"repo": "lowRISC/opentitan",
"path": "/hw/ip/otbn/util/shared/insn_yaml.py",
"mode": "psm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_suffix|> command_group_names = ['celery']<|fim_prefix|># repo: briancappello/flask-celery-bundle path: /flask_celery_bundle/__init__.py
"""
flask_celery_bundle
~~~~~~~~~~~~~~~
<|fim_middle|> Adds Celery support to Flask Unchained
:copyright: Copyright © 2018 Brian Cappello
:license: MIT, ... | code_fim | hard | {
"lang": "python",
"repo": "briancappello/flask-celery-bundle",
"path": "/flask_celery_bundle/__init__.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: briancappello/flask-celery-bundle path: /flask_celery_bundle/__init__.py
"""
flask_celery_bundle
~~~~~~~~~~~~~~~
Adds Celery support to Flask Unchained
:copyright: Copyright © 2018 Brian Cappello
:license: MIT, see LICENSE for more details
"""
__version__ = '0.2.2'
from f... | code_fim | easy | {
"lang": "python",
"repo": "briancappello/flask-celery-bundle",
"path": "/flask_celery_bundle/__init__.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|># revision identifiers, used by Alembic.
revision = '204540106539'
down_revision = '1894405f14ef'
def upgrade():
op.drop_constraint('uq_t_control_assessments', 'assessments', 'unique')
def downgrade():
utils.resolve_duplicates(assessment.Assessment, 'title', ' ')
op.create_unique_constraint('uq_... | code_fim | medium | {
"lang": "python",
"repo": "xferra/ggrc-core",
"path": "/src/ggrc/migrations/versions/20160223152916_204540106539_assessment_titles.py",
"mode": "spm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: xferra/ggrc-core path: /src/ggrc/migrations/versions/20160223152916_204540106539_assessment_titles.py
# Copyright (C) 2016 Google Inc.
# Licensed under http://www.apache.org/licenses/LICENSE-2.0 <see LICENSE file>
"""Assessment titles
Revision ID: 204540106539
Revises: 1894405f14ef
Create Date:... | code_fim | hard | {
"lang": "python",
"repo": "xferra/ggrc-core",
"path": "/src/ggrc/migrations/versions/20160223152916_204540106539_assessment_titles.py",
"mode": "psm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_suffix|>from alembic import op
from ggrc.models import assessment
from ggrc.migrations import utils
# revision identifiers, used by Alembic.
revision = '204540106539'
down_revision = '1894405f14ef'
def upgrade():
op.drop_constraint('uq_t_control_assessments', 'assessments', 'unique')
def downgrade():
ut... | code_fim | medium | {
"lang": "python",
"repo": "xferra/ggrc-core",
"path": "/src/ggrc/migrations/versions/20160223152916_204540106539_assessment_titles.py",
"mode": "spm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: yliess86/Snook path: /snook/model/loss.py
import torch
import torch.nn as nn
class AdaptiveWingLoss(nn.Module):
def __init__(
self,
omega: float = 14,
theta: float = 0.5,
eps: float = 1.0,
alpha: float = 2.1,
) -> None:
super(AdaptiveWingL... | code_fim | hard | {
"lang": "python",
"repo": "yliess86/Snook",
"path": "/snook/model/loss.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> A = (
self.omega
* (1 / (1 + (self.theta / self.eps) ** (self.alpha - pred2)))
* (self.alpha - pred2)
* ((self.theta / self.eps) ** (self.alpha - pred2 - 1))
* (1 / self.eps)
)
C = self.theta * A - self.omega * torch.log(... | code_fim | hard | {
"lang": "python",
"repo": "yliess86/Snook",
"path": "/snook/model/loss.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> del cls.__frontend
cls.__grpc_channel.close()
@classmethod
def _send_image_bytes_params(cls, image_bytes_params: 'ImageBytesParams') -> 'List[PredictResult]':
return cls.__frontend.predict_image_bytes(image_bytes_params)
@classmethod
def _send_image_path_params(cl... | code_fim | hard | {
"lang": "python",
"repo": "sipg-isr/tag_my_outfit_client",
"path": "/tests/integration/base_integration_test.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: sipg-isr/tag_my_outfit_client path: /tests/integration/base_integration_test.py
import grpc
import unittest
from typing import TYPE_CHECKING
from outfit_tagging.interface.service_pb2_grpc import TagMyOutfitServiceStub
from outfit_tagging.interface.service_pb2 import PredictRequest
from outfit_t... | code_fim | hard | {
"lang": "python",
"repo": "sipg-isr/tag_my_outfit_client",
"path": "/tests/integration/base_integration_test.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: angr/angr path: /angr/procedures/definitions/win32_api-ms-win-core-memory-l1-1-5.py
# pylint:disable=line-too-long
import logging
from ...sim_type import SimTypeFunction, SimTypeShort, SimTypeInt, SimTypeLong, SimTypeLongLong, SimTypeDouble, SimTypeFloat, SimTypePointer, SimTypeChar,... | code_fim | medium | {
"lang": "python",
"repo": "angr/angr",
"path": "/angr/procedures/definitions/win32_api-ms-win-core-memory-l1-1-5.py",
"mode": "psm",
"license": "BSD-2-Clause",
"source": "the-stack-v2"
} |
<|fim_suffix|>
lib = SimLibrary()
lib.set_default_cc('X86', SimCCStdcall)
lib.set_default_cc('AMD64', SimCCMicrosoftAMD64)
lib.set_library_names("api-ms-win-core-memory-l1-1-5.dll")
prototypes = \
{
#
'MapViewOfFileNuma2': SimTypeFunction([SimTypePointer(SimTypeInt(signed=True, label="Int"), label="... | code_fim | medium | {
"lang": "python",
"repo": "angr/angr",
"path": "/angr/procedures/definitions/win32_api-ms-win-core-memory-l1-1-5.py",
"mode": "spm",
"license": "BSD-2-Clause",
"source": "the-stack-v2"
} |
<|fim_suffix|>lib = SimLibrary()
lib.set_default_cc('X86', SimCCStdcall)
lib.set_default_cc('AMD64', SimCCMicrosoftAMD64)
lib.set_library_names("api-ms-win-core-memory-l1-1-5.dll")
prototypes = \
{
#
'MapViewOfFileNuma2': SimTypeFunction([SimTypePointer(SimTypeInt(signed=True, label="Int"), label="I... | code_fim | medium | {
"lang": "python",
"repo": "angr/angr",
"path": "/angr/procedures/definitions/win32_api-ms-win-core-memory-l1-1-5.py",
"mode": "spm",
"license": "BSD-2-Clause",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: linyingwen/korn path: /filter.py
#!/usr/bin/python3
import sys
import os
DROP = len('svcomp20/sv-benchmarks/c/')
def dump(f):
lines = f.readlines()
index = 0
for line in lines:
line = line.strip()
parts = line.split()
path = parts[1][DROP:]
name = o... | code_fim | medium | {
"lang": "python",
"repo": "linyingwen/korn",
"path": "/filter.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|>if len(sys.argv) > 2:
with open(sys.argv[2]) as f:
dump(f)
else:
dump(sys.stdin)<|fim_prefix|># repo: linyingwen/korn path: /filter.py
#!/usr/bin/python3
import sys
import os
DROP = len('svcomp20/sv-benchmarks/c/')
def dump(f):
lines = f.readlines()
index = 0
for line in l... | code_fim | medium | {
"lang": "python",
"repo": "linyingwen/korn",
"path": "/filter.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> for line in lines:
line = line.strip()
parts = line.split()
path = parts[1][DROP:]
name = os.path.basename(path)
if name in yml:
index += 1
result = [str(index)] + parts[1:]
print("\t".join(result))
with open(sys.argv[1]) as ... | code_fim | medium | {
"lang": "python",
"repo": "linyingwen/korn",
"path": "/filter.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: Ashmawy/zakeeha path: /app.py
#coding:utf8
from flask import Flask, render_template
from flask_restful import Resource, Api, abort
from models import db, app, Dars, Scholar, ScholarSchema, DarsSchema, Book, BookSchema
from flask import jsonify
from sqlalchemy.exc import IntegrityError
app.config... | code_fim | hard | {
"lang": "python",
"repo": "Ashmawy/zakeeha",
"path": "/app.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|>class active_deroos(Resource):
def get(self):
active_deroos = Dars.query.filter(Dars.is_active.is_(True)).all()
result = deroos_schema.dump(active_deroos)
return jsonify({'active_deroos': result.data})
class inactive_deroos(Resource):
def get(self):
inactive_deroos = Dars.query.filter(Dars.is_a... | code_fim | hard | {
"lang": "python",
"repo": "Ashmawy/zakeeha",
"path": "/app.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: spacemanspiff2007/HABApp path: /setup.py
import typing
from pathlib import Path
from setuptools import find_packages, setup
# Load version number without importing HABApp
def load_version() -> str:
version: typing.Dict[str, str] = {}
with open("src/HABApp/__version__.py") as fp:
... | code_fim | medium | {
"lang": "python",
"repo": "spacemanspiff2007/HABApp",
"path": "/setup.py",
"mode": "psm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_suffix|>__version__ = load_version()
print(f'Version: {__version__}')
print('')
# When we run tox tests we don't have these files available, so we skip them
readme = Path(__file__).with_name('readme.md')
long_description = ''
if readme.is_file():
with readme.open("r", encoding='utf-8') as fh:
long_d... | code_fim | medium | {
"lang": "python",
"repo": "spacemanspiff2007/HABApp",
"path": "/setup.py",
"mode": "spm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_suffix|> with open('requirements_setup.txt') as f:
return f.readlines()
__version__ = load_version()
print(f'Version: {__version__}')
print('')
# When we run tox tests we don't have these files available, so we skip them
readme = Path(__file__).with_name('readme.md')
long_description = ''
if readme... | code_fim | medium | {
"lang": "python",
"repo": "spacemanspiff2007/HABApp",
"path": "/setup.py",
"mode": "spm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: seeker1943/creme path: /creme/tree/base.py
"""Generic branch and leaf implementation."""
import collections
class Split:
"""A data class for storing split details."""
def __init__(self, on, how, at):
self.on = on
self.how = how
self.at = at
def __call__(sel... | code_fim | hard | {
"lang": "python",
"repo": "seeker1943/creme",
"path": "/creme/tree/base.py",
"mode": "psm",
"license": "BSD-3-Clause",
"source": "the-stack-v2"
} |
<|fim_suffix|> return 1
@property
def height(self):
return 0
def iter_dfs(self, depth=0):
yield self, depth
def iter_edges(self):
yield None, 0, None, self, 0
def iter_blocks(tree, limits, depth=-1):
"""Returns the block which encloses each node at a given depth.
... | code_fim | hard | {
"lang": "python",
"repo": "seeker1943/creme",
"path": "/creme/tree/base.py",
"mode": "spm",
"license": "BSD-3-Clause",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: TenzinJhopee/GamestonkTerminal path: /gamestonk_terminal/cryptocurrency/due_diligence/bybt_view.py
import os
from matplotlib import pyplot as plt, dates as mdates
import pandas as pd
from gamestonk_terminal.cryptocurrency.due_diligence.bybt_model import (
get_open_interest_per_exchange,
)
fr... | code_fim | medium | {
"lang": "python",
"repo": "TenzinJhopee/GamestonkTerminal",
"path": "/gamestonk_terminal/cryptocurrency/due_diligence/bybt_view.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> Parameters
----------
symbol : str
Crypto symbol to search open interest (e.g., BTC)
interval : int
Interval frequency (e.g., 0)
export : str
Export dataframe data to csv,json,xlsx file"""
df = get_open_interest_per_exchange(symbol, interval)
if df.empty... | code_fim | medium | {
"lang": "python",
"repo": "TenzinJhopee/GamestonkTerminal",
"path": "/gamestonk_terminal/cryptocurrency/due_diligence/bybt_view.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> """Displays open interest by exchange for a certain cryptocurrency
[Source: https://bybt.gitbook.io]
Parameters
----------
symbol : str
Crypto symbol to search open interest (e.g., BTC)
interval : int
Interval frequency (e.g., 0)
export : str
Export dat... | code_fim | medium | {
"lang": "python",
"repo": "TenzinJhopee/GamestonkTerminal",
"path": "/gamestonk_terminal/cryptocurrency/due_diligence/bybt_view.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: gfedi/servififa path: /2019/scripts/esercizio7.py
import json as js
with open("events.json") as events:
events_dict = js.load(events)
with open("teams.json") as teams:
teams_dict = js.load(teams)
<|fim_suffix|>players = [e["playerId"] for e in events_dict if e["playerId"] != 0]
play_e... | code_fim | hard | {
"lang": "python",
"repo": "gfedi/servififa",
"path": "/2019/scripts/esercizio7.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|>players = [e["playerId"] for e in events_dict if e["playerId"] != 0]
play_events = []
for t in set(players):
if [player["role"]["name"] for player in players_dict if player["wyId"]==t] == ["Forward"]:
evs = len([e for e in events_dict if e["playerId"] != 0 and
... | code_fim | hard | {
"lang": "python",
"repo": "gfedi/servififa",
"path": "/2019/scripts/esercizio7.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|>
players = [e["playerId"] for e in events_dict if e["playerId"] != 0]
play_events = []
for t in set(players):
if [player["role"]["name"] for player in players_dict if player["wyId"]==t] == ["Forward"]:
evs = len([e for e in events_dict if e["playerId"] != 0 and
... | code_fim | hard | {
"lang": "python",
"repo": "gfedi/servififa",
"path": "/2019/scripts/esercizio7.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> with open(IN_PATH.format(str(i).zfill(2)), 'w') as file:
for point in tri:
file.write(f"{point[0]} {point[1]}\n")
with open(OUT_PATH.format(str(i).zfill(2)), 'w') as file:
file.write(f"{types[type]}\n")<|fim_prefix|># repo: so77id/Programing-examples path: /contests/e... | code_fim | hard | {
"lang": "python",
"repo": "so77id/Programing-examples",
"path": "/contests/ev1/03-what-triangle-is-it/input_creator.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|>IN_PATH='./tests/inputs/input{}.txt'
OUT_PATH='./tests/outputs/output{}.txt'
N_FILES=15
for i in range(N_FILES):
type = random.choice(types_l)
delta = random.randint(-10, 10)
tri = [[point[0]+delta, point[1]+delta] for point in points[type]]
with open(IN_PATH.format(str(i).zfill(2)), 'w... | code_fim | medium | {
"lang": "python",
"repo": "so77id/Programing-examples",
"path": "/contests/ev1/03-what-triangle-is-it/input_creator.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: so77id/Programing-examples path: /contests/ev1/03-what-triangle-is-it/input_creator.py
#!/bin/python3
import math
import os
import random
import re
import sys
types = {
2: "isoseles",
3: "escaleno"
}
points = {
1: [[2,-2], [13,-2], [8, 3]],
2: [[-1, -1], [3, -1], [1, 5]],
... | code_fim | hard | {
"lang": "python",
"repo": "so77id/Programing-examples",
"path": "/contests/ev1/03-what-triangle-is-it/input_creator.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: ctreffe/alfred path: /src/alfred3/exceptions.py
"""
Das Modul definiert alle Exceptions des Frameworks
"""
class AlfredError(Exception):
"""
Jede Exception des Frameworks ist von dieser Klasse abgeleitet.
"""
pass
class ValidationError(AlfredError):
pass
class AbortMove... | code_fim | medium | {
"lang": "python",
"repo": "ctreffe/alfred",
"path": "/src/alfred3/exceptions.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> pass
class ConditionInconsistency(SlotInconsistency):
pass<|fim_prefix|># repo: ctreffe/alfred path: /src/alfred3/exceptions.py
"""
Das Modul definiert alle Exceptions des Frameworks
"""
class AlfredError(Exception):
"""
Jede Exception des Frameworks ist von dieser Klasse abgeleitet.
... | code_fim | hard | {
"lang": "python",
"repo": "ctreffe/alfred",
"path": "/src/alfred3/exceptions.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> pass
class SavingAgentException(AlfredError):
pass
class SessionTimeout(AlfredError):
pass
class AllSlotsFull(AlfredError):
pass
class AllConditionsFull(AllSlotsFull):
pass
class SlotInconsistency(AlfredError):
pass
class ConditionInconsistency(SlotInconsistency):
p... | code_fim | medium | {
"lang": "python",
"repo": "ctreffe/alfred",
"path": "/src/alfred3/exceptions.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: ccxt/ccxt path: /python/ccxt/abstract/coinbase.py
from ccxt.base.types import Entry
class ImplicitAPI:
v2_public_get_currencies = v2PublicGetCurrencies = Entry('currencies', ['v2', 'public'], 'GET', {})
v2_public_get_time = v2PublicGetTime = Entry('time', ['v2', 'public'], 'GET', {})
... | code_fim | hard | {
"lang": "python",
"repo": "ccxt/ccxt",
"path": "/python/ccxt/abstract/coinbase.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|>ionId = Entry('accounts/{account_id}/transactions/{transaction_id}', ['v2', 'private'], 'DELETE', {})
v3_private_get_brokerage_accounts = v3PrivateGetBrokerageAccounts = Entry('brokerage/accounts', ['v3', 'private'], 'GET', {})
v3_private_get_brokerage_accounts_account_uuid = v3PrivateGetBrokerage... | code_fim | hard | {
"lang": "python",
"repo": "ccxt/ccxt",
"path": "/python/ccxt/abstract/coinbase.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|>@pytest.fixture()
def component_factory(
hass: HomeAssistant, aiohttp_client, aioclient_mock: AiohttpClientMocker
):
"""Return a factory for initializing the withings component."""
with patch(
"homeassistant.components.withings.common.ConfigEntryWithingsApi"
) as api_class_mock:
... | code_fim | medium | {
"lang": "python",
"repo": "BenWoodford/home-assistant",
"path": "/tests/components/withings/conftest.py",
"mode": "spm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: BenWoodford/home-assistant path: /tests/components/withings/conftest.py
"""Fixtures for tests."""
from unittest.mock import patch
import pytest
<|fim_suffix|>@pytest.fixture()
def component_factory(
hass: HomeAssistant, aiohttp_client, aioclient_mock: AiohttpClientMocker
):
"""Return a... | code_fim | medium | {
"lang": "python",
"repo": "BenWoodford/home-assistant",
"path": "/tests/components/withings/conftest.py",
"mode": "psm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_suffix|> hass: HomeAssistant, aiohttp_client, aioclient_mock: AiohttpClientMocker
):
"""Return a factory for initializing the withings component."""
with patch(
"homeassistant.components.withings.common.ConfigEntryWithingsApi"
) as api_class_mock:
yield ComponentFactory(hass, api_cl... | code_fim | medium | {
"lang": "python",
"repo": "BenWoodford/home-assistant",
"path": "/tests/components/withings/conftest.py",
"mode": "spm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: PurpleTurkey/Osu-Background-Blur path: /src/gui.py
# -*- coding: utf-8 -*-
# Form implementation generated from reading ui file 'form.ui'
#
# Created by: PyQt5 UI code generator 5.15.3
#
# WARNING: Any manual changes made to this file will be lost when pyuic5 is
# run again. Do not edit this fi... | code_fim | hard | {
"lang": "python",
"repo": "PurpleTurkey/Osu-Background-Blur",
"path": "/src/gui.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> self.retranslateUi(scan)
QtCore.QMetaObject.connectSlotsByName(scan)
# on button press
self.pushButton_3.clicked.connect(self.button_press_opendir)
self.pushButton_2.clicked.connect(self.button_press_start)
self.pushButton.clicked.connect(self.button_pr... | code_fim | hard | {
"lang": "python",
"repo": "PurpleTurkey/Osu-Background-Blur",
"path": "/src/gui.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> self.fileDialog = QtWidgets.QFileDialog.getExistingDirectory(self.horizontalLayoutWidget_2, "Select Folder")
self.lineEdit.setText(str(self.fileDialog))
self.osu_dir = str(self.fileDialog)
self.driver = OsuDriver(self.osu_dir, self.start)
def blur_slider_change(self):
... | code_fim | hard | {
"lang": "python",
"repo": "PurpleTurkey/Osu-Background-Blur",
"path": "/src/gui.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.