text stringlengths 232 16.3k | domain stringclasses 1
value | difficulty stringclasses 3
values | meta dict |
|---|---|---|---|
<|fim_suffix|> """Get sample array.
Returns:
sample array.
"""
splitter = StratifiedShuffleSplit(
n_splits=self.number_of_splits, test_size=self.test_size
)
data_placeholder = torch.randn(self.targets.size(0), 2).numpy()
targets = self.targ... | code_fim | hard | {
"lang": "python",
"repo": "GT4SD/gt4sd-core",
"path": "/src/gt4sd/frameworks/granular/dataloader/sampler.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> u, v, w = state_vector[0:3]
p, q, r = state_vector[3:6]
theta, phi, psi = state_vector[6:9]
# Linear momentum equations
du_dt = Fx / mass + r * v - q * w
dv_dt = Fy / mass - r * u + p * w
dw_dt = Fz / mass + q * u - p * v
# Angular momentum equations
dp_dt = (L * Iz +... | code_fim | hard | {
"lang": "python",
"repo": "AeroPython/PyFME",
"path": "/src/pyfme/models/euler_flat_earth.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: AeroPython/PyFME path: /src/pyfme/models/euler_flat_earth.py
# -*- coding: utf-8 -*-
"""
Python Flight Mechanics Engine (PyFME).
Copyright (c) AeroPython Development Team.
Distributed under the terms of the MIT License.
Euler Flat Earth
----------------
Classical aircraft motion equations assum... | code_fim | hard | {
"lang": "python",
"repo": "AeroPython/PyFME",
"path": "/src/pyfme/models/euler_flat_earth.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> if grad.is_sparse:
raise RuntimeError("JITLamb does not support sparse gradients.")
state = self.state[p]
# State initialization
if len(state) == 0:
state["step"] = 0
# Exponential... | code_fim | hard | {
"lang": "python",
"repo": "microsoft/archai",
"path": "/archai/trainers/lamb_optimizer.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: microsoft/archai path: /archai/trainers/lamb_optimizer.py
# Copyright (c) 2019-2020, NVIDIA CORPORATION.
# Licensed under the Apache License, Version 2.0.
# https://github.com/NVIDIA/DeepLearningExamples/blob/master/PyTorch/LanguageModeling/Transformer-XL/pytorch/lamb.py
#
# Copyright (c) 2019 cy... | code_fim | hard | {
"lang": "python",
"repo": "microsoft/archai",
"path": "/archai/trainers/lamb_optimizer.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> state = self.state[p]
# State initialization
if len(state) == 0:
state["step"] = 0
# Exponential moving average of gradient values
state["exp_avg"] = torch.zeros_like(p.data)
# ... | code_fim | hard | {
"lang": "python",
"repo": "microsoft/archai",
"path": "/archai/trainers/lamb_optimizer.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: stan4git/bitcoin-arbitrage path: /arbitrage/clearing_house/clearinghouse.py
'''
Created on Oct 5, 2017
@author: stan4
'''
class ClearingHouse(object):
def __init__(self, depths):
self.depths = depths
def get_profit_for(self, mi, mj, kask, kbid):
if self... | code_fim | hard | {
"lang": "python",
"repo": "stan4git/bitcoin-arbitrage",
"path": "/arbitrage/clearing_house/clearinghouse.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|>
def tick(self):
for observer in self.observers:
observer.begin_opportunity_finder(self.depths)
for kmarket1 in self.depths:
for kmarket2 in self.depths:
if kmarket1 == kmarket2: # same market
continue
... | code_fim | hard | {
"lang": "python",
"repo": "stan4git/bitcoin-arbitrage",
"path": "/arbitrage/clearing_house/clearinghouse.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> def arbitrage_depth_opportunity(self, kask, kbid):
maxi, maxj = self.get_max_depth(kask, kbid)
best_profit = 0
best_i, best_j = (0, 0)
best_w_buyprice, best_w_sellprice = (0, 0)
best_volume = 0
for i in range(maxi + 1):
for j in range(maxj + ... | code_fim | hard | {
"lang": "python",
"repo": "stan4git/bitcoin-arbitrage",
"path": "/arbitrage/clearing_house/clearinghouse.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> def __eq__(self, other):
return (self._next_id == other._next_id and
self._associated_ids == other._associated_ids)
def load(self, filename):
try:
with open(filename) as f:
_data = json.loads(f.read())
self._next_id = _da... | code_fim | hard | {
"lang": "python",
"repo": "frans-fuerst/meddle",
"path": "/meddle-server.py",
"mode": "spm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: frans-fuerst/meddle path: /meddle-server.py
+ text).encode(), participant.encode()])
socket.send_multipart(
tuple(str(x).encode()
for x in (channel, json.dumps(
{'user':participant,
'time':timestamp,
'text':text})... | code_fim | hard | {
"lang": "python",
"repo": "frans-fuerst/meddle",
"path": "/meddle-server.py",
"mode": "psm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_suffix|> _new_user = False
if _id not in self._users_online:
self._users_online[_id] = (name, user())
_new_user = True
_, _user = self._users_online[_id]
return (_new_user, _id, _user)
def get_name(self, id):
""" returns name """
if id in... | code_fim | hard | {
"lang": "python",
"repo": "frans-fuerst/meddle",
"path": "/meddle-server.py",
"mode": "spm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_suffix|> import operator
return operator.itemgetter("bt")(data_item)
if __name__ == '__main__':
#
# read_items = [
# PlcDataItem(
# key='temperature',
# area=S7AreaDB,
# word_len=S7WLReal,
# db_number=3,
# start=2,
# ... | code_fim | hard | {
"lang": "python",
"repo": "sylvainbonnot/stream2py",
"path": "/stream2py/sources/plc.py",
"mode": "spm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: sylvainbonnot/stream2py path: /stream2py/sources/plc.py
import threading
import time
from asyncio import Queue
from collections import deque
from pprint import pprint
from typing import List, Optional, Any
import snap7
from snap7.snap7types import S7AreaDB, S7WLReal, S7WLBit, S7WLByte
from stre... | code_fim | hard | {
"lang": "python",
"repo": "sylvainbonnot/stream2py",
"path": "/stream2py/sources/plc.py",
"mode": "psm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: tyrylu/pyfmodex path: /pyfmodex/roomproperties.py
from enum import Enum, IntEnum
from ctypes import *
class MaterialNames(Enum):
kTransparent = 0
kAcousticCeilingTiles = 1
kBrickBare = 2
kBrickPainted = 3
kConcreteBlockCoarse = 4
kConcreteBlockPainted = 5
kCurtainHea... | code_fim | hard | {
"lang": "python",
"repo": "tyrylu/pyfmodex",
"path": "/pyfmodex/roomproperties.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> self.position[0] = x
self.position[1] = y
self.position[2] = z
def set_rotation(self, x, y, z, w):
self.rotation[0] = x
self.rotation[1] = y
self.rotation[2] = z
self.rotation[3] = w
def set_dimensions(self, x, y, z):
self.dimension... | code_fim | hard | {
"lang": "python",
"repo": "tyrylu/pyfmodex",
"path": "/pyfmodex/roomproperties.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|>while True:
opcao = int(input('Mostrar notas de qual aluno? (999 interrompe) '))
if opcao == 999:
print('Finalizando...')
print('<<< Volte sempre >>>')
break
elif opcao > len(listaPrincipal):
print('Erro...')
print('Tente um número válido!')
else:
... | code_fim | hard | {
"lang": "python",
"repo": "RicardoMart922/estudo_Python",
"path": "/Exercicios/Exercicio090.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: RicardoMart922/estudo_Python path: /Exercicios/Exercicio090.py
# Crie um programa que leia nome e duas notas de vários alunos e guarde tudo em uma lista composta.
# No final, mostre um boletim contendo a média de cada um e permita que o usuário possa mostrar as
# notas de cada aluno individualmen... | code_fim | hard | {
"lang": "python",
"repo": "RicardoMart922/estudo_Python",
"path": "/Exercicios/Exercicio090.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|># p0, p1, p2, p3, p4, p5 =\
p0, p1 = priorities =\
[afy.budgeter.Priority(get(x)) for x in
(
#'boa visa 5071',
#'chase 1.5%, chase amazon',
'irs, interest & fees',
'digital subscription, electric, groceries, phone, renter\'s insurance',
#'housekeeping, x... | code_fim | hard | {
"lang": "python",
"repo": "dmlerner/assistantforynab",
"path": "/tests/test_budget.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|>def get(x):
return [names[name.lower().strip()] for name in x.split(',')]
# p0, p1, p2, p3, p4, p5 =\
p0, p1 = priorities =\
[afy.budgeter.Priority(get(x)) for x in
(
#'boa visa 5071',
#'chase 1.5%, chase amazon',
'irs, interest & fees',
'digital subscript... | code_fim | hard | {
"lang": "python",
"repo": "dmlerner/assistantforynab",
"path": "/tests/test_budget.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: dmlerner/assistantforynab path: /tests/test_budget.py
import assistantforynab as afy
def test():
pass
afy.Assistant.load_ynab(categories=True, accounts=True, local=True)
goals = list(filter(lambda g: g.category.name != 'Miscasdf', map(afy.budgeter.Goal, afy.Assistant.categories)))
goals.... | code_fim | hard | {
"lang": "python",
"repo": "dmlerner/assistantforynab",
"path": "/tests/test_budget.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|>for currentGID in geneDict:
thisGene = geneDict[currentGID]
outline = '%s\t%s\t%s' % (currentGID,thisGene.geneID,thisGene.geneAnnot)
#
KNOWN = 0
NIC = 0
NNC = 0
for aTranscript in thisGene.getTranscripts('Known'):
for dataset in datasets:
KNOWN += aTranscript.getCounts(dataset... | code_fim | hard | {
"lang": "python",
"repo": "dewyman/TALON-paper-2019",
"path": "/pipeline/table_figure_scripts/S35table.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: dewyman/TALON-paper-2019 path: /pipeline/table_figure_scripts/S35table.py
"""
Generates a table with gene read counts based on novelty category """
import sys
from TALONClass import Transcript, Gene, talonResults, writeOutfile
# check that there is enough command line parameters
# sys.arg... | code_fim | hard | {
"lang": "python",
"repo": "dewyman/TALON-paper-2019",
"path": "/pipeline/table_figure_scripts/S35table.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: slavaGanzin/ramda.py path: /ramda/private/min_index.py
from functools import partial
def index_of(lst, item):
return lst.index(item)
def indices(lst, items):
<|fim_suffix|>
def min_index(lst, items):
return min(indices(lst, items))<|fim_middle|> return map(partial(index_of, lst), i... | code_fim | easy | {
"lang": "python",
"repo": "slavaGanzin/ramda.py",
"path": "/ramda/private/min_index.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|>
def min_index(lst, items):
return min(indices(lst, items))<|fim_prefix|># repo: slavaGanzin/ramda.py path: /ramda/private/min_index.py
from functools import partial
<|fim_middle|>
def index_of(lst, item):
return lst.index(item)
def indices(lst, items):
return map(partial(index_of, lst), i... | code_fim | medium | {
"lang": "python",
"repo": "slavaGanzin/ramda.py",
"path": "/ramda/private/min_index.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: mtanlee07/black-box-bmv2 path: /packettest/packettest/test_context.py
from packettest.sniff_future import SniffFuture
from packettest.predicates import Predicate
from concurrent.futures import ThreadPoolExecutor
from threading import Lock, Event, Thread
from scapy.all import AsyncSniffer
impor... | code_fim | hard | {
"lang": "python",
"repo": "mtanlee07/black-box-bmv2",
"path": "/packettest/packettest/test_context.py",
"mode": "psm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_suffix|>
def stop_condition(pkt):
''' Wrapper for stop condition.
This is wrapped so that if the the condition indicates
that the sniffer should stop, the `timed_out` flag is unset;
by default, it is `True`.
'''
# nonloca... | code_fim | hard | {
"lang": "python",
"repo": "mtanlee07/black-box-bmv2",
"path": "/packettest/packettest/test_context.py",
"mode": "spm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_suffix|> Is used like the following:
test = context.expect('eth0', saw_src_mac('ab:ab:ab:ab:ab:ab'))
assert(test.result() == True)
If the underlying sniffer sees a packet that matches, then the
future's result will return True.
Calling `result()` on the fu... | code_fim | hard | {
"lang": "python",
"repo": "mtanlee07/black-box-bmv2",
"path": "/packettest/packettest/test_context.py",
"mode": "spm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: monarch-initiative/monarch-app path: /backend/tests/integration/test_sql_entity.py
import pytest
from monarch_py.implementations.sql.sql_implementation import SQLImplementation
<|fim_suffix|> data = SQLImplementation()
entity = data.get_entity("MONDO:0007947")
assert entity
assert... | code_fim | medium | {
"lang": "python",
"repo": "monarch-initiative/monarch-app",
"path": "/backend/tests/integration/test_sql_entity.py",
"mode": "psm",
"license": "BSD-3-Clause",
"source": "the-stack-v2"
} |
<|fim_suffix|>
def test_entity():
data = SQLImplementation()
entity = data.get_entity("MONDO:0007947")
assert entity
assert entity.name == "Marfan syndrome"<|fim_prefix|># repo: monarch-initiative/monarch-app path: /backend/tests/integration/test_sql_entity.py
import pytest
from monarch_py.implementati... | code_fim | easy | {
"lang": "python",
"repo": "monarch-initiative/monarch-app",
"path": "/backend/tests/integration/test_sql_entity.py",
"mode": "spm",
"license": "BSD-3-Clause",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: NBISweden/agda path: /agda/agda/templatetags/percentage.py
from django import template
register = template.Library()
<|fim_suffix|> return format(decimal, ".%d%%" % round)<|fim_middle|>
@register.filter
def percentage(decimal, round=2):
| code_fim | easy | {
"lang": "python",
"repo": "NBISweden/agda",
"path": "/agda/agda/templatetags/percentage.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> return format(decimal, ".%d%%" % round)<|fim_prefix|># repo: NBISweden/agda path: /agda/agda/templatetags/percentage.py
from django import template
register = template.Library()
<|fim_middle|>
@register.filter
def percentage(decimal, round=2):
| code_fim | easy | {
"lang": "python",
"repo": "NBISweden/agda",
"path": "/agda/agda/templatetags/percentage.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: NBISweden/agda path: /agda/agda/templatetags/percentage.py
from django import template
<|fim_suffix|>@register.filter
def percentage(decimal, round=2):
return format(decimal, ".%d%%" % round)<|fim_middle|>register = template.Library()
| code_fim | easy | {
"lang": "python",
"repo": "NBISweden/agda",
"path": "/agda/agda/templatetags/percentage.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: brendo61-byte/Saras_Project path: /C19R/C19R/teamMembers/migrations/0005_sector_testbs.py
# Generated by Django 3.0.4 on 2020-03-31 03:53
<|fim_suffix|>
class Migration(migrations.Migration):
dependencies = [
('teamMembers', '0004_auto_20200330_2028'),
]
operations = [
... | code_fim | easy | {
"lang": "python",
"repo": "brendo61-byte/Saras_Project",
"path": "/C19R/C19R/teamMembers/migrations/0005_sector_testbs.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> dependencies = [
('teamMembers', '0004_auto_20200330_2028'),
]
operations = [
migrations.AddField(
model_name='sector',
name='testBS',
field=models.CharField(blank=True, default=None, max_length=25, null=True),
),
]<|fim_prefix|>... | code_fim | easy | {
"lang": "python",
"repo": "brendo61-byte/Saras_Project",
"path": "/C19R/C19R/teamMembers/migrations/0005_sector_testbs.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|>__all__ = ['read_mongo', 'to_mongo']
__version__ = '0.1.0'<|fim_prefix|># repo: manuelding/python-pandas-mongo path: /src/pdmongo/__init__.py
import pandas
from .core import read_mongo # noqa
from .core import to_mongo
<|fim_middle|>pandas.DataFrame.to_mongo = to_mongo
| code_fim | easy | {
"lang": "python",
"repo": "manuelding/python-pandas-mongo",
"path": "/src/pdmongo/__init__.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: manuelding/python-pandas-mongo path: /src/pdmongo/__init__.py
import pandas
from .core import read_mongo # noqa
from .core import to_mongo
<|fim_suffix|>__all__ = ['read_mongo', 'to_mongo']
__version__ = '0.1.0'<|fim_middle|>pandas.DataFrame.to_mongo = to_mongo
| code_fim | easy | {
"lang": "python",
"repo": "manuelding/python-pandas-mongo",
"path": "/src/pdmongo/__init__.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> context = pos_history[1]
if not context in pos_context1: pos_context1[context] = []
pos_context1[context].append(pos_history[2])
context = pos_history[0]+" "+pos_history[1]
if not context in pos_context2: pos_context2[context] = []
pos_context2[context].append(pos_his... | code_fim | medium | {
"lang": "python",
"repo": "dylanfried/the-false-peach",
"path": "/code/old/acc.py",
"mode": "spm",
"license": "BSD-2-Clause",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: dylanfried/the-false-peach path: /code/old/acc.py
import random
import re
def clean(x):
while re.match("(.*)\ ([.,?!:;]+.*)",x):
x = re.sub("(.*)\ ([.,?!:;]+.*)","\\1\\2",x)
x = re.sub("(.*)[.;:,]+","\\1",x)
return x.strip()
data = open("data/ham.txt").readlines()
<|fim_suffix|... | code_fim | medium | {
"lang": "python",
"repo": "dylanfried/the-false-peach",
"path": "/code/old/acc.py",
"mode": "psm",
"license": "BSD-2-Clause",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: IntelLabs/coach path: /rl_coach/presets/CartPole_DFP.py
from rl_coach.agents.dfp_agent import DFPAgentParameters, HandlingTargetsAfterEpisodeEnd
from rl_coach.base_parameters import VisualizationParameters, EmbedderScheme, PresetValidationParameters
from rl_coach.core_types import TrainingSteps, ... | code_fim | hard | {
"lang": "python",
"repo": "IntelLabs/coach",
"path": "/rl_coach/presets/CartPole_DFP.py",
"mode": "psm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_suffix|>graph_manager = BasicRLGraphManager(agent_params=agent_params, env_params=env_params,
schedule_params=schedule_params, vis_params=VisualizationParameters(),
preset_validation_params=preset_validation_params)<|fim_prefix|># repo: Intel... | code_fim | hard | {
"lang": "python",
"repo": "IntelLabs/coach",
"path": "/rl_coach/presets/CartPole_DFP.py",
"mode": "spm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: lyminhtan/PyDataLib path: /pydatalib/notify.py
import smtplib
from email.mime.text import MIMEText
from email.mime.image import MIMEImage
from email.mime.application import MIMEApplication
from email.mime.multipart import MIMEMultipart
from email.utils import COMMASPACE, formatdate
<|fim_suffix|... | code_fim | hard | {
"lang": "python",
"repo": "lyminhtan/PyDataLib",
"path": "/pydatalib/notify.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> msg = MIMEMultipart()
msg['Date'] = formatdate(localtime=True)
msg['To'] = to
msg['Subject'] = subject
msg.attach(MIMEText(body, 'html')) # 'plain'
with smtplib.SMTP_SSL(smtp_ssl_host, smtp_ssl_port) as server:
server.login(self.__usr, self.__pwd... | code_fim | medium | {
"lang": "python",
"repo": "lyminhtan/PyDataLib",
"path": "/pydatalib/notify.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: Michael-E-Rose/Woolridge_IntroEconometrics_Solutions path: /02-02.py
"""Python script for C2, Chapter 2 of Wooldridge: Intr. Economometrics"""
import pandas as pd
import statsmodels.formula.api as smf
<|fim_suffix|># ii)
print("# of values in ceoten that are equal to 0:")
print(len(df.loc[df['ce... | code_fim | medium | {
"lang": "python",
"repo": "Michael-E-Rose/Woolridge_IntroEconometrics_Solutions",
"path": "/02-02.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|># ii)
print("# of values in ceoten that are equal to 0:")
print(len(df.loc[df['ceoten'] == 0]))
print(">>>>")
# iii)
lm = smf.ols('lsalary ~ ceoten', data=df).fit()
print(lm.summary())
print(">>>>")<|fim_prefix|># repo: Michael-E-Rose/Woolridge_IntroEconometrics_Solutions path: /02-02.py
"""Python scrip... | code_fim | medium | {
"lang": "python",
"repo": "Michael-E-Rose/Woolridge_IntroEconometrics_Solutions",
"path": "/02-02.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> def test_create_lrouter_port_nonexistent_router_raises(self):
self.assertRaises(
exceptions.NotFound, routerlib.create_router_lport,
self.fake_cluster, 'booo', 'pippo', 'neutron_port_id',
'name', True, ['192.168.0.1'], '00:11:22:33:44:55')
def test_upda... | code_fim | hard | {
"lang": "python",
"repo": "projectcalico/calico-neutron",
"path": "/neutron/tests/unit/vmware/nsxlib/test_router.py",
"mode": "spm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_suffix|> def test_update_lrouter_port(self):
lrouter = routerlib.create_lrouter(self.fake_cluster,
uuidutils.generate_uuid(),
'pippo',
'fake-lrouter',
... | code_fim | hard | {
"lang": "python",
"repo": "projectcalico/calico-neutron",
"path": "/neutron/tests/unit/vmware/nsxlib/test_router.py",
"mode": "spm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: projectcalico/calico-neutron path: /neutron/tests/unit/vmware/nsxlib/test_router.py
(self):
router_name = 'fake_router_name'
tenant_id = 'fake_tenant_id'
neutron_router_id = 'pipita_higuain'
router_type = 'SingleDefaultRouteImplicitRoutingConfig'
route_conf... | code_fim | hard | {
"lang": "python",
"repo": "projectcalico/calico-neutron",
"path": "/neutron/tests/unit/vmware/nsxlib/test_router.py",
"mode": "psm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_suffix|> """Return True if there is an edge connecting val1 and val2.
False if not; raises an error if either of the supplied.
values are not in g.
"""
if val1 not in self or val2 not in self:
raise ValueError('Node not found.')
if val2 in self[val1]:
... | code_fim | hard | {
"lang": "python",
"repo": "Casey0Kane/data-structures",
"path": "/src/weighted_graph.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: Casey0Kane/data-structures path: /src/weighted_graph.py
"""Module implements a weighted graph data strcture."""
class WeightedGraph(dict):
"""Create a graph data strcture modeled off a dictionary."""
def __init__(self):
"""Inialize probably wont need anthing."""
pass
... | code_fim | hard | {
"lang": "python",
"repo": "Casey0Kane/data-structures",
"path": "/src/weighted_graph.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> """Return the path with depth transversal."""
if not path:
path = []
if start_val not in self.keys():
raise ValueError('No such starting value')
if start_val not in path:
path.append(start_val)
for val in self.neighbors(start_... | code_fim | hard | {
"lang": "python",
"repo": "Casey0Kane/data-structures",
"path": "/src/weighted_graph.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: mtlynch/GreenPiThumb path: /tests/test_db_store.py
import unittest
import datetime
import mock
from dateutil import tz
import pytz
from greenpithumb import db_store
# Timezone offset info for EST (UTC minus 5 hours).
UTC_MINUS_5 = tz.tzoffset(None, -18000)
class StoreClassesTest(unittest.Tes... | code_fim | hard | {
"lang": "python",
"repo": "mtlynch/GreenPiThumb",
"path": "/tests/test_db_store.py",
"mode": "psm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_suffix|> def test_retrieve_humidity(self):
mock_cursor = mock.Mock()
store = db_store.HumidityStore(mock_cursor)
mock_cursor.fetchall.return_value = [
('2016-07-23 10:51:09.928000-05:00', 50),
('2016-07-23 10:52:09.928000-05:00', 51)
]
humidity_da... | code_fim | hard | {
"lang": "python",
"repo": "mtlynch/GreenPiThumb",
"path": "/tests/test_db_store.py",
"mode": "spm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_suffix|> global UK_HDI
UK_HDI = [tree.xpath('/html/body/div[2]/div/section/div/div/div/div/div/table/tbody/tr[15]/td[3]/text()')]
UK_HDI = str(UK_HDI[0][0])
UK_HDI = float(UK_HDI)
global IND_HDI
IND_HDI = [tree.xpath('/html/body/div[2]/div/section/div/div/div/div/div/table/tbody/tr[133]/td... | code_fim | hard | {
"lang": "python",
"repo": "urvishramaiya/GDPScraper",
"path": "/kwhs.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: urvishramaiya/GDPScraper path: /kwhs.py
from lxml import html
import requests
import string
import re
CHINA_GDP = None;
CHINA_GNI = None;
CHINA_HDI = None;
US_GDP = 0;
US_GNI = 0;
US_HDI = 0;
UK_GDP = None;
UK_GNI = None;
UK_HDI = None;
IND_GDP = None;
IND_GNI = None;
IND_HDI = None;
def ge... | code_fim | hard | {
"lang": "python",
"repo": "urvishramaiya/GDPScraper",
"path": "/kwhs.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: TimWeaving/z-quantum-core path: /src/python/zquantum/core/circuits/_gates.py
"""Data structures for ZQuantum gates."""
import math
from dataclasses import dataclass, replace
from typing import Callable, Dict, Iterable, Sequence, Tuple, Union
import numpy as np
import sympy
from typing_extensions... | code_fim | hard | {
"lang": "python",
"repo": "TimWeaving/z-quantum-core",
"path": "/src/python/zquantum/core/circuits/_gates.py",
"mode": "psm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_suffix|>
@dataclass(frozen=True)
class CustomGateDefinition:
"""Use this class to define a non-built-in gate.
See "Defining new gates" section in `help(zquantum.core.circuits)` for
usage guide.
User-defined gates are treated differently than the built-in ones,
because the built-in ones are d... | code_fim | hard | {
"lang": "python",
"repo": "TimWeaving/z-quantum-core",
"path": "/src/python/zquantum/core/circuits/_gates.py",
"mode": "spm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: home-assistant/core path: /tests/components/rflink/test_utils.py
"""Test for RFLink utils methods."""
from homeassistant.components.rflink.utils import (
brightness_to_rflink,
rflink_to_brightness,
)
from homeassistant.core import HomeAssistant
<|fim_suffix|> # test rflink_to_brightn... | code_fim | hard | {
"lang": "python",
"repo": "home-assistant/core",
"path": "/tests/components/rflink/test_utils.py",
"mode": "psm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_suffix|> # test rflink_to_brightness
assert rflink_to_brightness(0) == 0
assert rflink_to_brightness(1) == 17
assert rflink_to_brightness(5) == 85
assert rflink_to_brightness(10) == 170
assert rflink_to_brightness(12) == 204
assert rflink_to_brightness(15) == 255<|fim_prefix|># repo: ho... | code_fim | hard | {
"lang": "python",
"repo": "home-assistant/core",
"path": "/tests/components/rflink/test_utils.py",
"mode": "spm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_suffix|> assert brightness_to_rflink(10) == 0
assert brightness_to_rflink(20) == 1
assert brightness_to_rflink(30) == 1
assert brightness_to_rflink(40) == 2
assert brightness_to_rflink(50) == 2
assert brightness_to_rflink(60) == 3
assert brightness_to_rflink(70) == 4
assert brightne... | code_fim | hard | {
"lang": "python",
"repo": "home-assistant/core",
"path": "/tests/components/rflink/test_utils.py",
"mode": "spm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_suffix|>iso_new[:,:nbin] = iso
iso_new[0,nbin:] = np.exp(x[-1] + dx*np.linspace(1,4,4))
iso_new[1,nbin:] = np.exp(y[-1] + dydx*np.linspace(1,4,4)*dx)
np.savetxt(outfile,iso_new.T)<|fim_prefix|># repo: fermiPy/extpipe path: /scripts/extrapolate_iso.py
import numpy as np
import os
import sys
from fermipy.skymap ... | code_fim | hard | {
"lang": "python",
"repo": "fermiPy/extpipe",
"path": "/scripts/extrapolate_iso.py",
"mode": "spm",
"license": "BSD-3-Clause",
"source": "the-stack-v2"
} |
<|fim_suffix|>iso = np.loadtxt(sys.argv[1],unpack=True)
x = np.log(iso[0])
y = np.log(iso[1])
yerr = iso[2]
dx = (x[-1] - x[-2])
dydx = (y[-1] - y[-2])/dx
nbin = iso.shape[1]
shape = list(iso.shape)
shape[1] += 4
iso_new = np.zeros(shape)
iso_new[:,:nbin] = iso
iso_new[0,nbin:] = np.exp(x[-1] + dx*np.linspace(1,4,4... | code_fim | medium | {
"lang": "python",
"repo": "fermiPy/extpipe",
"path": "/scripts/extrapolate_iso.py",
"mode": "spm",
"license": "BSD-3-Clause",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: fermiPy/extpipe path: /scripts/extrapolate_iso.py
import numpy as np
import os
import sys
from fermipy.skymap import Map
from fermipy.wcs_utils import create_wcs
from astropy.io import fits
from astropy.table import Table,Column
outfile = os.path.splitext(sys.argv[1])[0] + '_ext.txt'
<|fim_suf... | code_fim | medium | {
"lang": "python",
"repo": "fermiPy/extpipe",
"path": "/scripts/extrapolate_iso.py",
"mode": "psm",
"license": "BSD-3-Clause",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: RobotApocalypseCommittee/AncientGrammar path: /ancientgrammar/noun/noun3.py
from ancientgrammar.data import NENDINGS
from ancientgrammar.noun.noun import Noun
from ancientgrammar.qualifiers import Gender, Case, ContractType
from ancientgrammar.utils import calculate_contraction, is_equal
<|fim_s... | code_fim | hard | {
"lang": "python",
"repo": "RobotApocalypseCommittee/AncientGrammar",
"path": "/ancientgrammar/noun/noun3.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> def decline_regular(self, case: Case, is_plural: bool):
gender = self.gender if self.gender is not Gender.FEMININE else Gender.MASCULINE
ending = NENDINGS["NOUN_3"][gender.name][int(is_plural)][int(case)]
if ending == "nom":
return self.nominative
elif endi... | code_fim | hard | {
"lang": "python",
"repo": "RobotApocalypseCommittee/AncientGrammar",
"path": "/ancientgrammar/noun/noun3.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|># Simulate a data stream composed by two data distributions
data_stream = np.concatenate((np.random.randint(2, size=1000),
np.random.randint(4, high=8, size=1000)))
# Update drift detector and verify if change is detected
for i, val in enumerate(data_stream):
in_drift, i... | code_fim | medium | {
"lang": "python",
"repo": "Demigodice/hacktoberfest2021",
"path": "/python/adwin.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: Demigodice/hacktoberfest2021 path: /python/adwin.py
# ADWIN
import numpy as np
from river.drift import ADWIN
np.random.seed(12345)
<|fim_suffix|># Update drift detector and verify if change is detected
for i, val in enumerate(data_stream):
in_drift, in_warning = adwin.update(val)
if in_... | code_fim | hard | {
"lang": "python",
"repo": "Demigodice/hacktoberfest2021",
"path": "/python/adwin.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: ESPuPy/ESP32WiFiCAM-OV7670 path: /src/mylib.py
#-------------------------------------------
#
# ESP32 WiFi Camera (OV7670 FIFO Version)
# ESP32WiFiCAM-OV7670
#
# file:mylib.py
#
SYSDIR='/sd/sys'
TMPDIR='/sd/tmp'
PHOTODIR='/sd/DCIM'
DIFF_UTC_JST = 32400 # JST = UTC + 9H (9 * 60 * 60... | code_fim | hard | {
"lang": "python",
"repo": "ESPuPy/ESP32WiFiCAM-OV7670",
"path": "/src/mylib.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> status = None
print('setup NTP:')
ntp_hosts = ('ntp.nict.jp', 'time.google.com')
for host in ntp_hosts:
print('connect[{:s}]: '.format(host), end='')
try:
ntptime.host = host
ntptime.settime()
except Exception as e:
print('Error! ... | code_fim | hard | {
"lang": "python",
"repo": "ESPuPy/ESP32WiFiCAM-OV7670",
"path": "/src/mylib.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|>#book_authers = soup.select("p.pl")
#for book_auther in book_authers:
# book_auther = book_auther.get_text().split("/")[0]
# print(book_auther)
#book_scores = soup.select(".star .rating_nums")
#for book_score in book_scores:
# book_score = book_score.get_text()
# print(book_score)
... | code_fim | hard | {
"lang": "python",
"repo": "muzi131313/python_reptitle",
"path": "/grab_others/豆瓣图书250.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: muzi131313/python_reptitle path: /grab_others/豆瓣图书250.py
import requests
from bs4 import BeautifulSoup
base_url = 'https://book.douban.com/top250?start='
headers = {
'User-Agent':'Mozilla/5.0 (Windows NT 10.0; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/70.0.3538.77 Safari/537.... | code_fim | medium | {
"lang": "python",
"repo": "muzi131313/python_reptitle",
"path": "/grab_others/豆瓣图书250.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> returns.append(episode_return)
if wandb_project:
wandb.log({'episode': episode, 'return': episode_return})
if save_model and ((episode + 1) % save_model_each == 0):
agent.save(MODEL_PATH)
return_array = np.array(returns)
... | code_fim | hard | {
"lang": "python",
"repo": "tarod13/ConceptLearning_RL",
"path": "/cl/trainer.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> if save_model and ((episode + 1) % save_model_each == 0):
agent.save(MODEL_PATH)
return_array = np.array(returns)
if store_video:
video.release()
return return_array
def second_level_step(self, env, agent, state, skill):
n... | code_fim | hard | {
"lang": "python",
"repo": "tarod13/ConceptLearning_RL",
"path": "/cl/trainer.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: tarod13/ConceptLearning_RL path: /cl/trainer.py
import collections
import numpy as np
from buffers import ExperienceFirstLevel, PixelExperienceSecondLevel
from policy_optimizers import Second_Level_SAC_PolicyOptimizer
import wandb
import cv2
video_folder = '/home/researcher/Diego/Concept_Learni... | code_fim | hard | {
"lang": "python",
"repo": "tarod13/ConceptLearning_RL",
"path": "/cl/trainer.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|>def parse_sequence(types, details):
base_type = parse_type(types, details["type"])
sequence_max_count = details.get("capacity", None)
array_dimensions = details.get("size", None)
if array_dimensions is not None:
return ArrayType(base_type, array_dimensions)
else:
return... | code_fim | hard | {
"lang": "python",
"repo": "iguessthislldo/pyopendds",
"path": "/pyopendds/dev/itl2py/itl.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: iguessthislldo/pyopendds path: /pyopendds/dev/itl2py/itl.py
# Currently ITL is missing the following functionality:
# - No way to get annotations
# - No constants
# - Would not differentiate between octet and int8_t
# - Does not differentiate between bounded and unbounded strings
from .ast impor... | code_fim | hard | {
"lang": "python",
"repo": "iguessthislldo/pyopendds",
"path": "/pyopendds/dev/itl2py/itl.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> raise NotImplementedError
def parse_alias(types, details):
the_type = parse_type(types, details['type'])
the_type.set_name(details['name'])
if not the_type.is_topic_type:
the_type.is_topic_type = bool(get_detail(details, 'note', 'is_dcps_data_type'))
return the_type
def par... | code_fim | hard | {
"lang": "python",
"repo": "iguessthislldo/pyopendds",
"path": "/pyopendds/dev/itl2py/itl.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|>
def test_read_wrong_number_of_fields(tmp_path):
path = tmp_path / "genetic.map"
path.write_text(
"ignored header\n" "55550 0 0\n" "568322 0 0 17\n" "723891 2.9813105581 0.417644215424158\n"
)
with pytest.raises(ParseError):
_ = GeneticMapRecombinationCostComputer(str(path)... | code_fim | medium | {
"lang": "python",
"repo": "whatshap/whatshap",
"path": "/tests/test_geneticmap.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> path = tmp_path / "genetic.map"
path.write_text("ignored header\n" "55550 0 abc\n")
with pytest.raises(ParseError):
_ = GeneticMapRecombinationCostComputer(str(path))<|fim_prefix|># repo: whatshap/whatshap path: /tests/test_geneticmap.py
import pytest
from whatshap.pedigree import Gen... | code_fim | hard | {
"lang": "python",
"repo": "whatshap/whatshap",
"path": "/tests/test_geneticmap.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: whatshap/whatshap path: /tests/test_geneticmap.py
import pytest
from whatshap.pedigree import GeneticMapRecombinationCostComputer, ParseError
def test_read_genetic_map(tmp_path):
path = tmp_path / "genetic.map"
path.write_text("ignored header\n" "568527 0 0\n" "723891 2.9813105581 0.417... | code_fim | hard | {
"lang": "python",
"repo": "whatshap/whatshap",
"path": "/tests/test_geneticmap.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: futhewo/alicia path: /setup.py
#!/usr/bin/python
# -*- encoding: iso-8859-1 -*-
###############################################################################
# Copyright 2017 @fuzztheworld
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file excep... | code_fim | medium | {
"lang": "python",
"repo": "futhewo/alicia",
"path": "/setup.py",
"mode": "psm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_suffix|>config = {
'description': 'Fuzz case generator for black-box fuzzing',
'author': '@fuzztheworld',
'url': '',
'download_url': '',
'version': '0.200',
'install_requires': ['nose', 'bitarray'],
'packages': ['alicia'],
'scripts': [],
'name': 'alicia'
}
setup(**config)<|fim... | code_fim | medium | {
"lang": "python",
"repo": "futhewo/alicia",
"path": "/setup.py",
"mode": "spm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: acorg/acmacs-tree-maker path: /bin/tree-maker-2019
#! /usr/bin/env python3
# -*- Python -*-
"""
======================================================================
Makes phylogenetic tree on the AC cluster.
See acmacs-whocc/doc/make-trees.org for instruction on making trees
Initilialize tr... | code_fim | hard | {
"lang": "python",
"repo": "acorg/acmacs-tree-maker",
"path": "/bin/tree-maker-2019",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> parser.add_argument('-d', '--debug', action='store_const', dest='loglevel', const=logging.DEBUG, default=logging.INFO, help='Enable debugging output.')
args = parser.parse_args()
logging.basicConfig(level=args.loglevel, format="%(levelname)s %(asctime)s: %(message)s")
exit_... | code_fim | hard | {
"lang": "python",
"repo": "acorg/acmacs-tree-maker",
"path": "/bin/tree-maker-2019",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> # Copy images from temporary to permanent storage. Receive back a list of the copy operations that succeeded and failed.
# Note: Format for copy_succeeded_dict and copy_error_dict is { sourceURL : destinationURL }
copy_succeeded_dict, copy_error_dict = copy_images_to_permanent_storage(image... | code_fim | hard | {
"lang": "python",
"repo": "CatalystCode/active-learning-detect",
"path": "/functions/pipeline/onboarding/__init__.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> try:
data_access = ImageTagDataAccess(get_postgres_provider())
except Exception as e:
logging.error("Error: Database connection failed. Exception: " + str(e))
return func.HttpResponse(
status_code=500,
headers=DEFAULT_RETURN_HEADER,
... | code_fim | hard | {
"lang": "python",
"repo": "CatalystCode/active-learning-detect",
"path": "/functions/pipeline/onboarding/__init__.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: CatalystCode/active-learning-detect path: /functions/pipeline/onboarding/__init__.py
import os
import logging
import json
import azure.functions as func
from urllib.request import urlopen
from PIL import Image
from ..shared.db_provider import get_postgres_provider
from ..shared.db_access i... | code_fim | hard | {
"lang": "python",
"repo": "CatalystCode/active-learning-detect",
"path": "/functions/pipeline/onboarding/__init__.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: zhubonan/phono3py path: /test/phonon3/test_triplets.py
import unittest
import os
import numpy as np
from phonopy.interface.phonopy_yaml import read_cell_yaml
from phono3py.phonon3.triplets import (get_grid_point_from_address,
get_grid_point_from_address_py)... | code_fim | medium | {
"lang": "python",
"repo": "zhubonan/phono3py",
"path": "/test/phonon3/test_triplets.py",
"mode": "psm",
"license": "BSD-3-Clause",
"source": "the-stack-v2"
} |
<|fim_suffix|> self._mesh = (10, 10, 10)
print("Compare get_grid_point_from_address from spglib and that "
"written in python")
print("with mesh numbers [%d %d %d]" % self._mesh)
for address in list(np.ndindex(self._mesh)):
gp_spglib = get_grid_point_from_addres... | code_fim | medium | {
"lang": "python",
"repo": "zhubonan/phono3py",
"path": "/test/phonon3/test_triplets.py",
"mode": "spm",
"license": "BSD-3-Clause",
"source": "the-stack-v2"
} |
<|fim_suffix|> def test_get_grid_point_from_address(self):
self._mesh = (10, 10, 10)
print("Compare get_grid_point_from_address from spglib and that "
"written in python")
print("with mesh numbers [%d %d %d]" % self._mesh)
for address in list(np.ndindex(self._mesh)):
... | code_fim | medium | {
"lang": "python",
"repo": "zhubonan/phono3py",
"path": "/test/phonon3/test_triplets.py",
"mode": "spm",
"license": "BSD-3-Clause",
"source": "the-stack-v2"
} |
<|fim_suffix|> print("{0} {1}".format(li[0], li[1]))<|fim_prefix|># repo: ClaudeU/Algorithm_Review path: /MoonHyuk/07JOSEPHUS/josephus_basic.py
for i in range(int(input())):
n, k = input().split()
li = list(range(1, int(n) + 1))
k = int(k)
index = 0
<|fim_middle|> while len(li) > 2:
del ... | code_fim | medium | {
"lang": "python",
"repo": "ClaudeU/Algorithm_Review",
"path": "/MoonHyuk/07JOSEPHUS/josephus_basic.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: ClaudeU/Algorithm_Review path: /MoonHyuk/07JOSEPHUS/josephus_basic.py
for i in range(int(input())):
n, k = input().split()
li = list(range(1, int(n) + 1))
k = int(k)
index = 0
<|fim_suffix|> print("{0} {1}".format(li[0], li[1]))<|fim_middle|> while len(li) > 2:
del ... | code_fim | medium | {
"lang": "python",
"repo": "ClaudeU/Algorithm_Review",
"path": "/MoonHyuk/07JOSEPHUS/josephus_basic.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|>etector
from .retinanet import RetinaNet
from .rpn import RPN
from .s2anet import S2ANetDetector
from .single_stage import SingleStageDetector
from .two_stage import TwoStageDetector
__all__ = [
'BaseDetector', 'SingleStageDetector', 'TwoStageDetector', 'RPN',
'FastRCNN', 'FasterRCNN', 'MaskRCNN'... | code_fim | hard | {
"lang": "python",
"repo": "Rooooyy/BUAA_PR",
"path": "/ass3-airplane_det/mmdet/models/detectors/__init__.py",
"mode": "spm",
"license": "BSD-2-Clause",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: Rooooyy/BUAA_PR path: /ass3-airplane_det/mmdet/models/detectors/__init__.py
from .base import BaseDetector
from .cascade_rcnn import CascadeRCNN
from .cascade_s2anet import CascadeS2ANetDetector
from .double_head_rcnn import DoubleHeadRCNN
from .fast_rcnn import FastRCNN
from .faster_rcnn import ... | code_fim | hard | {
"lang": "python",
"repo": "Rooooyy/BUAA_PR",
"path": "/ass3-airplane_det/mmdet/models/detectors/__init__.py",
"mode": "psm",
"license": "BSD-2-Clause",
"source": "the-stack-v2"
} |
<|fim_suffix|>'RPN',
'FastRCNN', 'FasterRCNN', 'MaskRCNN', 'CascadeRCNN', 'HybridTaskCascade',
'DoubleHeadRCNN', 'RetinaNet', 'FCOS', 'GridRCNN', 'MaskScoringRCNN',
'RepPointsDetector', 'FOVEA',
'S2ANetDetector', 'FasterRCNNHBBOBB', 'CascadeS2ANetDetector'
]<|fim_prefix|># repo: Rooooyy/BUAA_PR path: /... | code_fim | hard | {
"lang": "python",
"repo": "Rooooyy/BUAA_PR",
"path": "/ass3-airplane_det/mmdet/models/detectors/__init__.py",
"mode": "spm",
"license": "BSD-2-Clause",
"source": "the-stack-v2"
} |
<|fim_suffix|> return [
{
"label": _("Verein / Team / Mitglieder"),
"items": [
{
"type": "doctype",
"name": "Verein",
},
{
"type": "doctype",
"name": "Team",
"dependencies": ["Verein"]
},
{
"type": "doctype",
"name": "Mitglied",
"depend... | code_fim | medium | {
"lang": "python",
"repo": "joelios/TeamPlaner",
"path": "/teamplaner/config/teamplaner.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: joelios/TeamPlaner path: /teamplaner/config/teamplaner.py
from __future__ import unicode_literals
from frappe import _
<|fim_suffix|> return [
{
"label": _("Verein / Team / Mitglieder"),
"items": [
{
"type": "doctype",
"name": "Verein",
},
{
"type":... | code_fim | medium | {
"lang": "python",
"repo": "joelios/TeamPlaner",
"path": "/teamplaner/config/teamplaner.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: dem4ply/chibi_requests path: /tests/auth.py
from unittest.mock import Mock
from chibi_requests import Chibi_url
from chibi_requests.auth import Token, Bearer
from tests.chibi_url import Test_url
<|fim_suffix|> def test_when_have_the_name_should_change_the_name_of_the_token( self ):
... | code_fim | hard | {
"lang": "python",
"repo": "dem4ply/chibi_requests",
"path": "/tests/auth.py",
"mode": "psm",
"license": "WTFPL",
"source": "the-stack-v2"
} |
<|fim_suffix|> def test_when_is_called_should_add_the_header( self ):
token = Token( token='hello' )
mock = Mock( headers=dict() )
result = token( mock )
self.assertIs( mock, result )
self.assertEqual( mock.headers, { 'Authorization': 'Token hello' } )
def test_when_have_... | code_fim | medium | {
"lang": "python",
"repo": "dem4ply/chibi_requests",
"path": "/tests/auth.py",
"mode": "spm",
"license": "WTFPL",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: mball002/cs595-s21 path: /assignments/McLain/3/scripts/results.py
# Darin McLain
# CS595 - Web Security - ODU - Spring 2021
# Assignment 3
#
# Script to read cookies.json and output results to markdown table file
import requests
import json
import os
import re
from pytablewriter import Markdown... | code_fim | hard | {
"lang": "python",
"repo": "mball002/cs595-s21",
"path": "/assignments/McLain/3/scripts/results.py",
"mode": "psm",
"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.