text stringlengths 232 16.3k | domain stringclasses 1
value | difficulty stringclasses 3
values | meta dict |
|---|---|---|---|
<|fim_prefix|># repo: matchms/matchms path: /tests/filtering/test_correct_charge.py
import pytest
from matchms.filtering import correct_charge
from ..builder_Spectrum import SpectrumBuilder
@pytest.mark.parametrize("metadata, expected", [
[{}, 0],
[{"ionmode": "positive"}, 1],
[{"ionmode": "positive", "c... | code_fim | hard | {
"lang": "python",
"repo": "matchms/matchms",
"path": "/tests/filtering/test_correct_charge.py",
"mode": "psm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_suffix|> assert spectrum.get("charge") == expected
def test_correct_charge_empty_spectrum():
spectrum_in = None
spectrum = correct_charge(spectrum_in)
assert spectrum is None, "Expected different handling of None spectrum."<|fim_prefix|># repo: matchms/matchms path: /tests/filtering/test_correc... | code_fim | medium | {
"lang": "python",
"repo": "matchms/matchms",
"path": "/tests/filtering/test_correct_charge.py",
"mode": "spm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_suffix|> @classmethod
def from_token(cls, token, reader, builder=None):
"""
Assembles a `TokenDict` by walking a graph of tokens.
Parameters:
`token`: the "token" identifying the top-level structure
to be converted to a `TokenDict`.
... | code_fim | hard | {
"lang": "python",
"repo": "ethanrowe/python-merky",
"path": "/merky/cases/tokendict.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: ethanrowe/python-merky path: /merky/cases/tokendict.py
import six
from merky import util
NO_DEFAULT = object()
class TokenDict(object):
"""
A `dict`-like structure that annotates its values and ensures order.
While the `TokenDict` looks and acts like a `dict`, its values are alway... | code_fim | hard | {
"lang": "python",
"repo": "ethanrowe/python-merky",
"path": "/merky/cases/tokendict.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|>
def dir_queue():
"""The absolute path of the task queue directory.
This path is valid on the tester machine."""
return abspath('queue')
def dir_tester_unzip_tmp():
"""The absolute path of the directory where submission
archives are unzipped.
This path is valid on the tester mach... | code_fim | hard | {
"lang": "python",
"repo": "ironmissy/vmchecker",
"path": "/bin/vmcheckerpaths.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: ironmissy/vmchecker path: /bin/vmcheckerpaths.py
# -*- coding: utf-8 -*-
"""All paths related to vmchecker."""
import os
_STORER_CONFIG_FILE = 'vmchecker_storer.ini'
_TESTER_CONFIG_FILE = 'vmchecker_tester.ini'
GRADE_FILENAME = 'results/job_results'
root = None
repository = None
def set_roo... | code_fim | hard | {
"lang": "python",
"repo": "ironmissy/vmchecker",
"path": "/bin/vmcheckerpaths.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|>
class ModuleState:
active = "active"
inactive = "inactive"
def getDelay():
x = datetime.datetime.today()
if not any((mu_conf.Update.hour, mu_conf.Update.minute, mu_conf.Update.second)):
y = x.replace(day=x.day, hour=x.hour, minute=x.minute, second=x.second, microsecond=0) + date... | code_fim | medium | {
"lang": "python",
"repo": "y-du/module-update-service",
"path": "/update/util.py",
"mode": "spm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_suffix|>
from .configuration import mu_conf, EnvVars
import datetime
__all__ = ("ModuleState", "getDelay")
class ModuleState:
active = "active"
inactive = "inactive"
def getDelay():
x = datetime.datetime.today()
if not any((mu_conf.Update.hour, mu_conf.Update.minute, mu_conf.Update.second)):... | code_fim | hard | {
"lang": "python",
"repo": "y-du/module-update-service",
"path": "/update/util.py",
"mode": "spm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: y-du/module-update-service path: /update/util.py
"""
Copyright 2020 Yann Dumont
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licen... | code_fim | medium | {
"lang": "python",
"repo": "y-du/module-update-service",
"path": "/update/util.py",
"mode": "psm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_suffix|> """solve first challenge for day 03"""
return len(get_visited_houses(read_instructions('aoc/aoc2015/input/03A.txt')))
def day_03_b() -> int:
"""solve second challenge for day 03"""
instructions = read_instructions('aoc/aoc2015/input/03A.txt')
santa_instructions = ''.join(w for i, w i... | code_fim | hard | {
"lang": "python",
"repo": "llulai/advent_of_py",
"path": "/aoc/aoc2015/main.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: llulai/advent_of_py path: /aoc/aoc2015/main.py
"""aoc 2015 implementation"""
import itertools
import hashlib
from aoc.utils import *
# day 01
def _follow_floor_instruction(current_floor: int, instruction: str):
return (1 if instruction == "(" else -1) + current_floor
def get_floor(instruc... | code_fim | hard | {
"lang": "python",
"repo": "llulai/advent_of_py",
"path": "/aoc/aoc2015/main.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|>
def get_ribbon(*args) -> int:
return sum(l_mult(n_smallest(args, 2), 2)) + product(args)
def day_02_a() -> int:
"""solve first challenge for day 02"""
instructions = read_instructions('aoc/aoc2015/input/02A.txt').split('\n')
return sum(get_wrapping_paper(*l_to_int(box.split('x'))) for b... | code_fim | hard | {
"lang": "python",
"repo": "llulai/advent_of_py",
"path": "/aoc/aoc2015/main.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: fnbillimoria/OPEN path: /Test_Scripts/zbus_3ph_pf_test.py
# -*- coding: utf-8 -*-
import os
import pandas as pd
import numpy as np
import matplotlib.pyplot as plt
import matplotlib
import copy
import time
#set the directory one level up to be able to import from OxEMF_Files folders
path = os.pat... | code_fim | hard | {
"lang": "python",
"repo": "fnbillimoria/OPEN",
"path": "/Test_Scripts/zbus_3ph_pf_test.py",
"mode": "psm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_suffix|>
#check line current calculations
net_ieee13.update_line_pf_results()
#for each bus, check current injected and line currents sum to zero on each phase
Ibus_inj = np.zeros([net_ieee13.N_buses,3],dtype=np.complex_)
Ibus_lines = np.zeros([net_ieee13.N_buses,3],dtype=np.complex_)
for bus_i in range(net_ieee1... | code_fim | hard | {
"lang": "python",
"repo": "fnbillimoria/OPEN",
"path": "/Test_Scripts/zbus_3ph_pf_test.py",
"mode": "spm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_suffix|> sleep(0.8)
titulo(f'Acessandoo o manual do comando \'{msg}\'', cor = 'lilas')
sleep(0.5)
print(cores['branco'])
help(msg)
print(cores['limpa'])
# Função com cores
def titulo(msg, cor = 'limpa'):
print(cores[cor], end='')
tam = len(msg)
print('~' * tam)
print(msg)... | code_fim | hard | {
"lang": "python",
"repo": "duartecgustavo/PythonProgress",
"path": "/desafios/Mundo 3/Ex106CORES.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: duartecgustavo/PythonProgress path: /desafios/Mundo 3/Ex106CORES.py
# Desafio 106 - Aula 21: Programa que utilize o 'interactive help' do Python.
# O usuario irá digitar o comando e o terminal deve retornar sua explicação.
# Para sair digite 'FIM!'
from time import sleep
# Dict com cores
<|fim... | code_fim | medium | {
"lang": "python",
"repo": "duartecgustavo/PythonProgress",
"path": "/desafios/Mundo 3/Ex106CORES.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: kkheon/QARC path: /QARC/VQPN/gru/test_main.py
import os
#kernel_array = [8,16,32,128,256]
kernel_array = [16]
lr_array = [1e-4]
for k in kernel_array:
#for d in dense_array:
for l in lr_array:
<|fim_suffix|>os.system('python test_vqpn_full_size.py ' + str(k) + ' ' + str(k) + ' ' ... | code_fim | medium | {
"lang": "python",
"repo": "kkheon/QARC",
"path": "/QARC/VQPN/gru/test_main.py",
"mode": "psm",
"license": "BSD-3-Clause",
"source": "the-stack-v2"
} |
<|fim_suffix|>os.system('python test_vqpn_full_size.py ' + str(k) + ' ' + str(k) + ' ' + str(l))<|fim_prefix|># repo: kkheon/QARC path: /QARC/VQPN/gru/test_main.py
import os
#kernel_array = [8,16,32,128,256]
kernel_array = [16]
lr_array = [1e-4]<|fim_middle|>
for k in kernel_array:
#for d in dense_array:
for ... | code_fim | medium | {
"lang": "python",
"repo": "kkheon/QARC",
"path": "/QARC/VQPN/gru/test_main.py",
"mode": "spm",
"license": "BSD-3-Clause",
"source": "the-stack-v2"
} |
<|fim_suffix|> """Test successful creation of a new MOA"""
MOA = models.MOA.objects.create(
moa="H2 inhibitor"
)
self.assertEqual(str(MOA), MOA.moa)<|fim_prefix|># repo: finish06/django-drugs-api path: /app/core/tests/test_models.py
from django.test import TestCase
from core... | code_fim | hard | {
"lang": "python",
"repo": "finish06/django-drugs-api",
"path": "/app/core/tests/test_models.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> def test_create_route_successful(self):
"""Test successful creation of a new route"""
route = models.Route.objects.create(
route="oral"
)
self.assertEqual(str(route), route.route)
def test_create_moa_successful(self):
"""Test successful creatio... | code_fim | medium | {
"lang": "python",
"repo": "finish06/django-drugs-api",
"path": "/app/core/tests/test_models.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: finish06/django-drugs-api path: /app/core/tests/test_models.py
from django.test import TestCase
from core import models
class ModelTest(TestCase):
def test_create_drug_successful(self):
<|fim_suffix|> """Test successful creation of a new MOA"""
MOA = models.MOA.objects.creat... | code_fim | hard | {
"lang": "python",
"repo": "finish06/django-drugs-api",
"path": "/app/core/tests/test_models.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> return accel
def motors_output(t, x, u, params={}):
return x
motors = ct.NonlinearIOSystem(
motors_update, motors_output, name='motors',
inputs=('u1', 'u2', 'u3', 'u4'),
outputs=('w1', 'w2', 'w3', 'w4'),
states=('w1', 'w2', 'w3', 'w4'),
dt=0)<|fim_prefix|># repo: tchamelot/... | code_fim | hard | {
"lang": "python",
"repo": "tchamelot/drosix",
"path": "/model/motors.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|>motors = ct.NonlinearIOSystem(
motors_update, motors_output, name='motors',
inputs=('u1', 'u2', 'u3', 'u4'),
outputs=('w1', 'w2', 'w3', 'w4'),
states=('w1', 'w2', 'w3', 'w4'),
dt=0)<|fim_prefix|># repo: tchamelot/drosix path: /model/motors.py
import numpy as np
import control as ct
... | code_fim | medium | {
"lang": "python",
"repo": "tchamelot/drosix",
"path": "/model/motors.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: tchamelot/drosix path: /model/motors.py
import numpy as np
import control as ct
def motors_update(t, x, u, params={}):
"""
Motor dynamics for thrust control system
Paramters
---------
x: array
System state: motors speed
u: array
System input: motors thro... | code_fim | medium | {
"lang": "python",
"repo": "tchamelot/drosix",
"path": "/model/motors.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: thomas-vl/airbyte path: /airbyte-integrations/connectors/source-facebook-marketing/source_facebook_marketing/utils.py
#
# Copyright (c) 2023 Airbyte, Inc., all rights reserved.
#
import logging
from typing import Union
import pendulum
from pendulum import Date, DateTime
logger = logging.getLog... | code_fim | hard | {
"lang": "python",
"repo": "thomas-vl/airbyte",
"path": "/airbyte-integrations/connectors/source-facebook-marketing/source_facebook_marketing/utils.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> today = cast_to_type(start_date, pendulum.today())
retention_date = today.subtract(months=DATA_RETENTION_PERIOD)
if retention_date.day != today.day:
# `.subtract(months=37)` can be erroneous, for instance:
# 2023-03-31 - 37 month = 2020-02-29 which is incorrect, should be 2020-... | code_fim | hard | {
"lang": "python",
"repo": "thomas-vl/airbyte",
"path": "/airbyte-integrations/connectors/source-facebook-marketing/source_facebook_marketing/utils.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|>x = javascript.SimpleJSON({1: u'Andr\xe9 \u2028\u2029</---]]>'}, inlined=True)
print repr(x)
print repr(str(x))
print repr(unicode(x))
print repr(x.as_json())
print repr(x.as_json(inlined=True))
print repr(x.as_json(inlined=False))
x = javascript.SimpleJSON({1: 'Andr\xe9 </---]]>'})
print repr(x)
print r... | code_fim | hard | {
"lang": "python",
"repo": "ndparker/tdi",
"path": "/tests/tools/js_json_simple.py",
"mode": "spm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: ndparker/tdi path: /tests/tools/js_json_simple.py
#!/usr/bin/env python
import sys as _sys
import warnings as _warnings
_warnings.resetwarnings()
_warnings.filterwarnings('error')
from tdi.tools import javascript
try:
unicode(javascript.SimpleJSON(u''))
except ImportError: # fake output. ea... | code_fim | hard | {
"lang": "python",
"repo": "ndparker/tdi",
"path": "/tests/tools/js_json_simple.py",
"mode": "psm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_suffix|>x = javascript.SimpleJSON({1: 'Andr\xe9 </---]]>'})
print repr(x)
print repr(str(x))
print repr(unicode(x))
print repr(x.as_json())
print repr(x.as_json(inlined=True))
print repr(x.as_json(inlined=False))
x = javascript.SimpleJSON({1: 'Andr\xe9 </---]]>'}, inlined=True)
print repr(x)
print repr(str(x))
p... | code_fim | hard | {
"lang": "python",
"repo": "ndparker/tdi",
"path": "/tests/tools/js_json_simple.py",
"mode": "spm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_suffix|> async def http_get(self, end_url: str, query_params: dict = None, headers: dict = None):
# 处理GET请求
url = join(self.url, self.api_version, end_url)
return await aio_get(url, query_params, headers=headers)
async def http_post(self, end_url: str, payload: dict = None, header... | code_fim | hard | {
"lang": "python",
"repo": "418sec/py-crypto-exchange-api-client",
"path": "/crypto_exchange/utils/rest/bitmex.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> async def http_post(self, end_url: str, payload: dict = None, headers: dict = None):
# 处理POST请求
url = join(self.url, self.api_version, end_url)
return await aio_post(url, json_data=payload, headers=headers)
async def http_delete(self, end_url: str, query_params: dict = No... | code_fim | hard | {
"lang": "python",
"repo": "418sec/py-crypto-exchange-api-client",
"path": "/crypto_exchange/utils/rest/bitmex.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: 418sec/py-crypto-exchange-api-client path: /crypto_exchange/utils/rest/bitmex.py
import hashlib
import hmac
import logging
import time
import json as js
import urllib
from os.path import join
from crypto_exchange.utils.aio_http import aio_get, aio_post, aio_delete
from crypto_exchange.utils.rest... | code_fim | hard | {
"lang": "python",
"repo": "418sec/py-crypto-exchange-api-client",
"path": "/crypto_exchange/utils/rest/bitmex.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|>fibermodes_effective_indexes = get_fibermodes_indexes(
mode_number_list=['LP01', 'LP02', 'LP21'],
itr_list=superset.itr_list,
wavelength=wavelength,
)
figure = Scene2D(unit_size=(12, 4))
ax = Axis(
col=0,
row=0,
x_label='Inverse taper ratio',
y_label='Effective index',
sh... | code_fim | medium | {
"lang": "python",
"repo": "MartinPdeS/SuPyMode",
"path": "/SuPyMode/examples/validation/plot_validation_fibermodes_neff.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: MartinPdeS/SuPyMode path: /SuPyMode/examples/validation/plot_validation_fibermodes_neff.py
#!/usr/bin/env python
# -*- coding: utf-8 -*-
from SuPyMode.tools.fibermodes_validation import get_SuPyMode_smf28_taper, get_fibermodes_indexes
# from utils import get_SuPyMode_smf28_taper, get_fibermodes... | code_fim | hard | {
"lang": "python",
"repo": "MartinPdeS/SuPyMode",
"path": "/SuPyMode/examples/validation/plot_validation_fibermodes_neff.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: nwchemgit/nwchem path: /contrib/parsers/rotate_fft.py
#!/usr/bin/python
import sys
import math
def rotate_spectrum (data):
for v in data:
w = v[0]
re = v[1]
im = v[2]
ab = v[3]
r = math.sqrt (re**2 + im**2)
if abs (r - ab) > 1e-6:
... | code_fim | hard | {
"lang": "python",
"repo": "nwchemgit/nwchem",
"path": "/contrib/parsers/rotate_fft.py",
"mode": "psm",
"license": "LicenseRef-scancode-warranty-disclaimer",
"source": "the-stack-v2"
} |
<|fim_suffix|>def main ():
data = parse_stdin ()
data_rot = rotate_spectrum (data)
for d in data_rot:
print ("%20.10e\t%20.10e\t%20.10e\t%20.10e" %(d[0], d[1], d[2], d[3]))
if __name__ == "__main__":
main()<|fim_prefix|># repo: nwchemgit/nwchem path: /contrib/parsers/rotate_fft.py
#!/usr/bin... | code_fim | hard | {
"lang": "python",
"repo": "nwchemgit/nwchem",
"path": "/contrib/parsers/rotate_fft.py",
"mode": "spm",
"license": "LicenseRef-scancode-warranty-disclaimer",
"source": "the-stack-v2"
} |
<|fim_suffix|> new_column_names=['VerifyBam_Omni_Free','VerifyBam_Affy_Free','VerifyBam_Omni_Chip','VerifyBam_Affy_Chip','Indel_Ratio','Passed_QC']
df=""
if group=="low coverage":
df=sheet.iloc[:,6:12]
elif group=="exome":
df=sheet.iloc[:,0:6]
... | code_fim | hard | {
"lang": "python",
"repo": "vj573/igsr_analysis",
"path": "/build/lib/p3/p3BAMQC.py",
"mode": "spm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: vj573/igsr_analysis path: /build/lib/p3/p3BAMQC.py
'''
Created on 27 Jan 2017
@author: ernesto
'''
import pandas as pd
class p3BAMQC(object):
'''
Class representing a spreadsheet located at ftp://ftp.1000genomes.ebi.ac.uk/vol1/ftp/technical/working/20130606_sample_info/20130606_sample_... | code_fim | hard | {
"lang": "python",
"repo": "vj573/igsr_analysis",
"path": "/build/lib/p3/p3BAMQC.py",
"mode": "psm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_suffix|>@pytest.mark.functions
def test_multicolumn_factorize_columns_suffix_change():
"""Tests if Multi Column Factorize works with suffix change"""
df = pd.DataFrame(
{
"a": ["hello", "hello", "sup"],
"b": [1, 2, 3],
"c": ["aloha", "nihao", "nihao"],
}... | code_fim | hard | {
"lang": "python",
"repo": "samukweku/pyjanitor",
"path": "/tests/functions/test_factorize_columns.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: samukweku/pyjanitor path: /tests/functions/test_factorize_columns.py
"""
Author: Vamsi Krishna
Date: 23 July 2021
The intent of these tests is to test factorize_columns function works.
Because underneath the hood we are using `pd.factorize`,
we intentionally do not test the values of the resulta... | code_fim | hard | {
"lang": "python",
"repo": "samukweku/pyjanitor",
"path": "/tests/functions/test_factorize_columns.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> fig = plt.figure(figsize=(8,8))
ax = fig.add_subplot(111, projection='3d')
ax.scatter(x,y,z, marker='.', s=1)
ax.set_xlabel(r'$x$')
ax.set_ylabel(r'$y$')
ax.set_zlabel(r'$z$')
plt.savefig('monte_carlo_sampling.pdf')
fig = plt.figure(figsize=(8,8))
ax = fig.add_subplot(... | code_fim | hard | {
"lang": "python",
"repo": "jkadowaki/paper_plots",
"path": "/redshift_paper/code/thin_disk.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: jkadowaki/paper_plots path: /redshift_paper/code/thin_disk.py
#!/usr/bin/env python
################################################################################
import numpy as np
from mpl_toolkits.mplot3d import Axes3D
import matplotlib.pyplot as plt
from numpy.random import rand, seed
fo... | code_fim | hard | {
"lang": "python",
"repo": "jkadowaki/paper_plots",
"path": "/redshift_paper/code/thin_disk.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|>def save_h5(data_root, h5_dir, mode, ratio=0.125):
all_dict_list = getfileinfo(os.path.join(data_root, mode), ['_gt'], ['.png'], '.mat')
mode_dir = os.path.join(data_root, h5_dir, mode+"H5")
mkdirs(mode_dir, erase=True)
klg_dict = {}
with open(os.path.join(data_root, mode, mode + "_k... | code_fim | hard | {
"lang": "python",
"repo": "PingjunChen/GradingKneeOA",
"path": "/DetJoint/preprocess/save_det_h5.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> img_path = ele["thisfile"]
cur_img = imread(img_path)
mat_path = ele["thismatfile"]
contour_mat = load_mat(mat_path)
cur_bbox = get_bbox(contour_mat)
assert len(cur_bbox) == 2, "Error, there are not 2 bbox"
pat_id= os.path.splitext(os.path.basename(... | code_fim | hard | {
"lang": "python",
"repo": "PingjunChen/GradingKneeOA",
"path": "/DetJoint/preprocess/save_det_h5.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: PingjunChen/GradingKneeOA path: /DetJoint/preprocess/save_det_h5.py
# -*- coding: utf-8 -*-
import os, sys, pdb
import numpy as np
import h5py, json
from scipy.io import loadmat
import deepdish as dd
import scipy.misc as misc
import numpy as np
FILE_PATH = os.path.abspath(__file__)
PRJ_PATH = o... | code_fim | hard | {
"lang": "python",
"repo": "PingjunChen/GradingKneeOA",
"path": "/DetJoint/preprocess/save_det_h5.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> #FIXME: *UGH.* This is redundant. Ideally:
#* There should exist a concrete TypeHint._is_subhint_branch()
# implementation performing this logic on behalf of *EVERY* subclass.
#* TypeHint._is_subhint_branch() should then call a subclass-specific
# abstract TypeHin... | code_fim | hard | {
"lang": "python",
"repo": "beartype/beartype",
"path": "/beartype/door/_cls/pep/pep484/doorpep484class.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: beartype/beartype path: /beartype/door/_cls/pep/pep484/doorpep484class.py
#!/usr/bin/env python3
# --------------------( LICENSE )--------------------
# Copyright (c) 2014-2023 Beartype authors.
# See "LICENSE" for further details.
'''
**Decidedly Object-Oriented Runti... | code_fim | hard | {
"lang": "python",
"repo": "beartype/beartype",
"path": "/beartype/door/_cls/pep/pep484/doorpep484class.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> operations = [
migrations.AddField(
model_name='scheduletrigger',
name='schedule_args',
field=models.JSONField(default=[]),
preserve_default=False,
),
]<|fim_prefix|># repo: chen1932390299/drf-backend-platform path: /rookie/mysite/mi... | code_fim | medium | {
"lang": "python",
"repo": "chen1932390299/drf-backend-platform",
"path": "/rookie/mysite/migrations/0028_scheduletrigger_schedule_args.py",
"mode": "spm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_suffix|>
dependencies = [
('mysite', '0027_auto_20210613_1808'),
]
operations = [
migrations.AddField(
model_name='scheduletrigger',
name='schedule_args',
field=models.JSONField(default=[]),
preserve_default=False,
),
]<|fim_... | code_fim | medium | {
"lang": "python",
"repo": "chen1932390299/drf-backend-platform",
"path": "/rookie/mysite/migrations/0028_scheduletrigger_schedule_args.py",
"mode": "spm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: chen1932390299/drf-backend-platform path: /rookie/mysite/migrations/0028_scheduletrigger_schedule_args.py
# Generated by Django 3.2.2 on 2021-06-13 19:29
<|fim_suffix|>class Migration(migrations.Migration):
dependencies = [
('mysite', '0027_auto_20210613_1808'),
]
operation... | code_fim | easy | {
"lang": "python",
"repo": "chen1932390299/drf-backend-platform",
"path": "/rookie/mysite/migrations/0028_scheduletrigger_schedule_args.py",
"mode": "psm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_suffix|>p' ),
path('edit/<int:id>' ,edit, name='edit' ),
path('problemset' ,problemsets, name='problemset' ),
path('clist' , clist , name='clist'),
path('addCpRecord',addCpRecord , name='addcprecord'),
# path('pr' , pr, name='pr')
]<|fim_prefix|># repo: Kunal614/Resources path: /cp/urls.... | code_fim | medium | {
"lang": "python",
"repo": "Kunal614/Resources",
"path": "/cp/urls.py",
"mode": "spm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: Kunal614/Resources path: /cp/urls.py
from django.urls import path
# from .views import home , first_sem , ec1 , second_sem , third_sem , fourth_sem , fifth_sem<|fim_suffix|>t' , clist , name='clist'),
path('addCpRecord',addCpRecord , name='addcprecord'),
# path('pr' , pr, name='pr')
... | code_fim | hard | {
"lang": "python",
"repo": "Kunal614/Resources",
"path": "/cp/urls.py",
"mode": "psm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: duyunhe/vehAnalysis path: /mq_split.py
# -*- coding: utf-8 -*-
# @Time : 2019/9/6 9:57
# @Author :
# @简介 :
# @File : mq_split.py
import stomp
import time
import logging
import os
import subprocess
import json
import struct
import redis
from datetime import datetime
from geo import i... | code_fim | hard | {
"lang": "python",
"repo": "duyunhe/vehAnalysis",
"path": "/mq_split.py",
"mode": "psm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_suffix|>
def bcd2time(bcd_time):
dig = []
for bcd in bcd_time:
a = (ord(bcd) & 0xF0) >> 4
b = (ord(bcd) & 0x0F) >> 0
dig.append(a * 10 + b)
yy, mm, dd, hh, mi, ss = dig[0:6]
try:
dt = datetime(2000 + yy, mm, dd, hh, mi, ss)
except ValueError:
# print yy,... | code_fim | hard | {
"lang": "python",
"repo": "duyunhe/vehAnalysis",
"path": "/mq_split.py",
"mode": "spm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_suffix|> global conn_mq
print 'ActiveMQ connecting...'
try:
c = conn_mq[gateway]
if c is not None:
try:
c.stop()
except Exception as e:
print e, 'can not stop'
listener = My905Listener(gateway)
c = stomp.Connection1... | code_fim | hard | {
"lang": "python",
"repo": "duyunhe/vehAnalysis",
"path": "/mq_split.py",
"mode": "spm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: smirolo/django-urldecorators path: /urldecorators/__init__.py
from django.conf import urls
from django.core.exceptions import ImproperlyConfigured
from django.utils import six
from urldecorators.urlresolvers import RegexURLPattern, RegexURLResolver
from urldecorators.helpers import get_decorato... | code_fim | hard | {
"lang": "python",
"repo": "smirolo/django-urldecorators",
"path": "/urldecorators/__init__.py",
"mode": "psm",
"license": "BSD-3-Clause",
"source": "the-stack-v2"
} |
<|fim_suffix|> def _url(regex, view, kwargs=None, name=None, prefix=''):
if not view:
raise ImproperlyConfigured(
'Empty URL pattern view name not permitted (for pattern %r)'
% regex)
if isinstance(view, (list, tuple)):
# For include(...) proces... | code_fim | hard | {
"lang": "python",
"repo": "smirolo/django-urldecorators",
"path": "/urldecorators/__init__.py",
"mode": "spm",
"license": "BSD-3-Clause",
"source": "the-stack-v2"
} |
<|fim_suffix|> Example urls.py file:
from urldecorators import url, include
urlpatterns = [
url(r'^private/$', include('example.private.urls'),
decorators=['django.contrib.auth.decorators.login_required']),
url(r'^articles/$', include('example.articles.urls')... | code_fim | hard | {
"lang": "python",
"repo": "smirolo/django-urldecorators",
"path": "/urldecorators/__init__.py",
"mode": "spm",
"license": "BSD-3-Clause",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: songzhaozhe/youtube-8m path: /frame_level_models.py
[bw_lstm_cell] * number_of_layers,
model_input, sequence_length=num_frames,
... | code_fim | hard | {
"lang": "python",
"repo": "songzhaozhe/youtube-8m",
"path": "/frame_level_models.py",
"mode": "psm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: songzhaozhe/youtube-8m path: /frame_level_models.py
on(output, 1024, [3], stride = 1, padding = "SAME")
output = tf.contrib.layers.batch_norm(output,center = True, scale = True, is_training = True, scope = None)
output = slim.pool(output, [2], "MAX", stride = 2)
output = slim.convolu... | code_fim | hard | {
"lang": "python",
"repo": "songzhaozhe/youtube-8m",
"path": "/frame_level_models.py",
"mode": "psm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_suffix|> output = slim.fully_connected(output, 2048)
# output = tf.contrib.layers.batch_norm(output,center = True, scale = True, is_training = True, scope = None)
output = slim.dropout(output)
output = slim.fully_connected(output, 2048)
# output = tf.contrib.layers.batch_norm(output,center = T... | code_fim | hard | {
"lang": "python",
"repo": "songzhaozhe/youtube-8m",
"path": "/frame_level_models.py",
"mode": "spm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: uros-5/easy-tk path: /easy_tk/TkMaster.py
from tkinter import *
class TkMaster(object):
def __init__(self):
self.name = ""
self.layout = ""
self.__row = 0
self.__column = -1
self.obj = object
def get(self):
return self.obj
... | code_fim | medium | {
"lang": "python",
"repo": "uros-5/easy-tk",
"path": "/easy_tk/TkMaster.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> @property
def row(self):
return self.__row
@row.getter
def row(self):
return self.__row
@row.setter
def row(self, increment):
if increment == True:
self.__row += 1
self.__column = -1<|fim_prefix|># repo: uros-5/easy-tk ... | code_fim | medium | {
"lang": "python",
"repo": "uros-5/easy-tk",
"path": "/easy_tk/TkMaster.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> @row.setter
def row(self, increment):
if increment == True:
self.__row += 1
self.__column = -1<|fim_prefix|># repo: uros-5/easy-tk path: /easy_tk/TkMaster.py
from tkinter import *
class TkMaster(object):
def __init__(self):
self.name = ""
... | code_fim | hard | {
"lang": "python",
"repo": "uros-5/easy-tk",
"path": "/easy_tk/TkMaster.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: Ritankar-Ultraboy09/Microsoft_Teams_Automated-lol path: /Test_Leaving_meeting.py
import time
import pyautogui
import webbrowser
Time_of_Leaving = input("Please enter your leaving time:-")
Meeting_Link = input("Enter the meeting link to leave at the proper time")
TimeRn = time.strftime("%H:... | code_fim | medium | {
"lang": "python",
"repo": "Ritankar-Ultraboy09/Microsoft_Teams_Automated-lol",
"path": "/Test_Leaving_meeting.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|>if (TimeRn == Time_of_Leaving):
print("It's time to go!")
webbrowser.open(Meeting_Link)
time.sleep(12)
pyautogui.moveTo(1550,97)
pyautogui.click()<|fim_prefix|># repo: Ritankar-Ultraboy09/Microsoft_Teams_Automated-lol path: /Test_Leaving_meeting.py
import time
import pyautogui
... | code_fim | medium | {
"lang": "python",
"repo": "Ritankar-Ultraboy09/Microsoft_Teams_Automated-lol",
"path": "/Test_Leaving_meeting.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> def __init__(self, value=None):
self.aval = ffi.new("AVal *")
if value is not None:
self.value = value
@property
def value(self):
buf = ffi.buffer(self.aval.av_val, self.aval.av_len)
return buf[:]
@value.setter
def value(self, value):
... | code_fim | medium | {
"lang": "python",
"repo": "pratikbarjatya/hotstar-stream-downloader",
"path": "/tools/livestreamer/librtmp/aval.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: pratikbarjatya/hotstar-stream-downloader path: /tools/livestreamer/librtmp/aval.py
from .compat import bytes, integer_types, string_types
from librtmp_ffi.ffi import ffi
__all__ = ["AVal"]
class AVal(object):
def __init__(self, value=None):
<|fim_suffix|> buf = ffi.buffer(self.aval.a... | code_fim | medium | {
"lang": "python",
"repo": "pratikbarjatya/hotstar-stream-downloader",
"path": "/tools/livestreamer/librtmp/aval.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> @value.setter
def value(self, value):
if isinstance(value, integer_types):
value = str(value)
if isinstance(value, string_types):
value = bytes(value, "utf8")
elif isinstance(value, bool):
value = str(value).lower()
self.value_st... | code_fim | medium | {
"lang": "python",
"repo": "pratikbarjatya/hotstar-stream-downloader",
"path": "/tools/livestreamer/librtmp/aval.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: jingyi7777/CasRx_guide_efficiency path: /models/Linear_ensemble/hyperparameter tuning/Gradient_boosting_fullmodel_hp.py
#!/usr/bin/env python
# coding: utf-8
# In[1]:
import matplotlib.pyplot as plt
import pandas as pd
import numpy as np
import statistics
import math
from sklearn.model_selecti... | code_fim | hard | {
"lang": "python",
"repo": "jingyi7777/CasRx_guide_efficiency",
"path": "/models/Linear_ensemble/hyperparameter tuning/Gradient_boosting_fullmodel_hp.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|>def normalize(a: np.ndarray):
"""
:param a: numpy array of size N x D, where N is number of examples, D is number of features
:return: a, normalized so that all feature columns are now between 0 and 1
"""
a_normed, norms = sklearn.preprocessing.normalize(a, norm='max', axis=0, return_n... | code_fim | hard | {
"lang": "python",
"repo": "jingyi7777/CasRx_guide_efficiency",
"path": "/models/Linear_ensemble/hyperparameter tuning/Gradient_boosting_fullmodel_hp.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> """
:param a: numpy array of size N x D, where N is number of examples, D is number of features
:return: a, normalized so that all feature columns are now between 0 and 1
"""
a_normed, norms = sklearn.preprocessing.normalize(a, norm='max', axis=0, return_norm=True)
print("Norms:", ... | code_fim | hard | {
"lang": "python",
"repo": "jingyi7777/CasRx_guide_efficiency",
"path": "/models/Linear_ensemble/hyperparameter tuning/Gradient_boosting_fullmodel_hp.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: mrtommyb/textended path: /code/get_time_on_silicon.py
# -*- coding: utf-8 -*-
# code taken from
# https://github.com/lgbouma/tessmaps/blob/master/src/get_time_on_silicon.py#L10-L143
# by Luke Bouma
from __future__ import division, print_function
import numpy as np, pandas as pd
from astropy im... | code_fim | hard | {
"lang": "python",
"repo": "mrtommyb/textended",
"path": "/code/get_time_on_silicon.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> n_segs (int): the number of "sectors" per hemisphere.
Returns:
a pandas DataFrame with columns:
ra, dec, elat, elon,
sector_1, sector_2, ..., sector_13, total_sectors_obsd
Nomenclature:
"Sector" means one "grouping" of 4 cameras. There are 13 secto... | code_fim | hard | {
"lang": "python",
"repo": "mrtommyb/textended",
"path": "/code/get_time_on_silicon.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: cwang25/-Shakespeare-in-Motion-Senior-Design-Project- path: /packages/custom/demo/PythonScripts/ArticleDatabaseClean.py
from RestCall import RestCaller
from alchemyapi_python.alchemyapi import AlchemyAPI
import urllib2
import urllib
import json
import argparse
import time
import RestCall
import r... | code_fim | hard | {
"lang": "python",
"repo": "cwang25/-Shakespeare-in-Motion-Senior-Design-Project-",
"path": "/packages/custom/demo/PythonScripts/ArticleDatabaseClean.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> for data in text_data:
if "Full text not available. Please use associated URL to view full text:" in data['content']:
missing_content[data['_id']] = data['url']
else:
continue
if missing_content:
alchemy_text_extraction(missing_content)
prin... | code_fim | medium | {
"lang": "python",
"repo": "cwang25/-Shakespeare-in-Motion-Senior-Design-Project-",
"path": "/packages/custom/demo/PythonScripts/ArticleDatabaseClean.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|>def alchemy_text_extraction(id_list_here):
global rest_caller
for ids in id_list_here:
news_url = id_list_here[ids]
textURL = 'http://gateway-a.watsonplatform.net/calls/url/URLGetText?' \
'url='+news_url+\
'&apikey='+api_key_2+\
'&... | code_fim | medium | {
"lang": "python",
"repo": "cwang25/-Shakespeare-in-Motion-Senior-Design-Project-",
"path": "/packages/custom/demo/PythonScripts/ArticleDatabaseClean.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: seasonZhu/AnimationSpider path: /SwiftStyle.py
import math
""" 今天看了一篇Python的文章,才发现还有这种写法,这基本上和Swift没什么区别了 """
def swiftStyle():
""" 一个Swift风格的函数表达式 """
a: str = "aa"
b: int = 1
# 虽然a被定义成了str类型,但是这里还是可以对a赋值2,并且不会报错,print也没什么异常
a = 2
print(a)
isinstance(a, int)
#... | code_fim | hard | {
"lang": "python",
"repo": "seasonZhu/AnimationSpider",
"path": "/SwiftStyle.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> distance2 = distanceBetweenPoint2(point=(0, 2), toPoint=(5, 7))
print(distance2)
distance3 = distanceBetweenPoint3(point=(0, 2), toPoint=(5, 7))
print(distance3)
# 这么写会崩溃
#distance4 = distanceBetweenPoint3(point="haha", toPoint="hehe")
#print(distance4)
if __name__ == "__mai... | code_fim | hard | {
"lang": "python",
"repo": "seasonZhu/AnimationSpider",
"path": "/SwiftStyle.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> settings["blog_title"] = options.blog_title
settings["blog_url"] = options.blog_url
settings["cookie_secret"] = options.cookie_secret
settings["debug"] = options.debug
settings["description"] = options.description
settings["google_oauth"] = {"key": options.googl... | code_fim | medium | {
"lang": "python",
"repo": "waterdrinker/gblog",
"path": "/gblog/config.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: waterdrinker/gblog path: /gblog/config.py
import tornado.options
from tornado.options import define, options
# Settings available to handlers
define("blog_title", default="gblog", help="blog name")
define("blog_url", default='127.0.0.1', help="your site domain")
define("cookie_sec... | code_fim | hard | {
"lang": "python",
"repo": "waterdrinker/gblog",
"path": "/gblog/config.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|>
config_file_path = settings["config_file"];
tornado.options.parse_config_file(config_file_path)
tornado.options.parse_command_line()
settings["blog_title"] = options.blog_title
settings["blog_url"] = options.blog_url
settings["cookie_secret"] = options.cookie_secret
s... | code_fim | hard | {
"lang": "python",
"repo": "waterdrinker/gblog",
"path": "/gblog/config.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|>}
subgraph "cluster_uqbar.graphs.core" {
graph [label="uqbar.graphs.core"];
node [color=2];
"uqbar.graphs.core.Attachable" [label=Attachable];
"uqbar.graphs.core.Edge" [label="Edge"];
"uqbar... | code_fim | hard | {
"lang": "python",
"repo": "josiah-wolf-oberholtzer/uqbar",
"path": "/tests/test_apis_InheritanceGraph.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: josiah-wolf-oberholtzer/uqbar path: /tests/test_apis_InheritanceGraph.py
menter" [label="Member\nDocumenter"];
"uqbar.apis.documenters.ModuleDocumenter" [label="Module\nDocumenter"];
"uqbar.apis.documenters.RootDocumenter" [label="Root\nDocumenter"];
... | code_fim | hard | {
"lang": "python",
"repo": "josiah-wolf-oberholtzer/uqbar",
"path": "/tests/test_apis_InheritanceGraph.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: josiah-wolf-oberholtzer/uqbar path: /tests/test_apis_InheritanceGraph.py
ph {
graph [bgcolor=transparent,
color=lightsteelblue2,
fontname=Arial,
fontsize=10,
outputorder=edgesfirst,
... | code_fim | hard | {
"lang": "python",
"repo": "josiah-wolf-oberholtzer/uqbar",
"path": "/tests/test_apis_InheritanceGraph.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: pkpio/inkakinada-thumbs path: /bomb-thumbs.py
#!/usr/bin/env python
# Developer: Praveen Kumar Pendyala
# Created: 22/07/2014
#
# bomb your review with lots of thumbs ups.
#
# Note: This is created just to show how simple getting thumbs up for reviews
# on this site is. Well, most of the thumbs... | code_fim | medium | {
"lang": "python",
"repo": "pkpio/inkakinada-thumbs",
"path": "/bomb-thumbs.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|>start = time.time()
sys.stdout.write('Starting..')
sys.stdout.flush()
for i in range(thumbs_count):
urllib.urlopen(thumb_url)
sys.stdout.write('\rThumbs added: ' + str(i+1))
sys.stdout.flush()
time = time.time() - start
print 'took: ' + repr(time) + 'seconds!'<|fim_prefix|># rep... | code_fim | medium | {
"lang": "python",
"repo": "pkpio/inkakinada-thumbs",
"path": "/bomb-thumbs.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|>for i in range(thumbs_count):
urllib.urlopen(thumb_url)
sys.stdout.write('\rThumbs added: ' + str(i+1))
sys.stdout.flush()
time = time.time() - start
print 'took: ' + repr(time) + 'seconds!'<|fim_prefix|># repo: pkpio/inkakinada-thumbs path: /bomb-thumbs.py
#!/usr/bin/env python... | code_fim | hard | {
"lang": "python",
"repo": "pkpio/inkakinada-thumbs",
"path": "/bomb-thumbs.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: bencko/django-signal-disabler path: /tests/test_decorator.py
from __future__ import absolute_import
from .models import CustomModel, PostSaveCalled
import pytest
import signal_disabler
def test_as_decorator(db):
<|fim_suffix|> obj.save()
with pytest.raises(PostSaveCalled):
o... | code_fim | medium | {
"lang": "python",
"repo": "bencko/django-signal-disabler",
"path": "/tests/test_decorator.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|>
def test_fail_as_uninstantiated_decorator(db):
obj = CustomModel()
@signal_disabler.disable
def save():
obj.save()
with pytest.raises(AttributeError):
save()<|fim_prefix|># repo: bencko/django-signal-disabler path: /tests/test_decorator.py
from __future__ import absolut... | code_fim | medium | {
"lang": "python",
"repo": "bencko/django-signal-disabler",
"path": "/tests/test_decorator.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: yogeshwaran01/Python-Scripts path: /Scripts/duck-duck-go.py
from urllib.parse import quote_plus
import requests
class DuckDuckGO:
url = "https://api.duckduckgo.com/?q={}&format=json"
def __init__(self, query: str):
<|fim_suffix|> @property
def AbstractSource(self):
ret... | code_fim | hard | {
"lang": "python",
"repo": "yogeshwaran01/Python-Scripts",
"path": "/Scripts/duck-duck-go.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> @property
def AbstractText(self):
return self.data["AbstractText"]
@property
def AbstractSource(self):
return self.data["AbstractSource"]
if __name__ == "__main__":
query = input("Enter the Query: ")
a = DuckDuckGO(query)
print(f"Source: {a.AbstractSourc... | code_fim | hard | {
"lang": "python",
"repo": "yogeshwaran01/Python-Scripts",
"path": "/Scripts/duck-duck-go.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|>
return self.data["AbstractSource"]
if __name__ == "__main__":
query = input("Enter the Query: ")
a = DuckDuckGO(query)
print(f"Source: {a.AbstractSource}" + "\n")
print(a.AbstractText)<|fim_prefix|># repo: yogeshwaran01/Python-Scripts path: /Scripts/duck-duck-go.py
from urll... | code_fim | medium | {
"lang": "python",
"repo": "yogeshwaran01/Python-Scripts",
"path": "/Scripts/duck-duck-go.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: yuyaokeng/biliBot path: /initDatabase.py
import sqlite3
from json import loads,dumps
import requests
import time
headers = {
'accept': 'text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,image/apng,*/*;q=0.8',
'user-agent': 'Mozilla/5.0 (Windows NT 10.0; WOW64) Appl... | code_fim | hard | {
"lang": "python",
"repo": "yuyaokeng/biliBot",
"path": "/initDatabase.py",
"mode": "psm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_suffix|> res = ''
conn = sqlite3.connect('robot.db', 30.0)
c = conn.cursor()
index = 0
for row in c.execute("SELECT UP.UID,UP.Name FROM subPerson,UP WHERE subPerson.Person_Number=? AND subPerson.UID=UP.UID AND Sub_Type=?",(PersonNum,subType)):
index = index + 1
res = res + "\n" ... | code_fim | hard | {
"lang": "python",
"repo": "yuyaokeng/biliBot",
"path": "/initDatabase.py",
"mode": "spm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_suffix|>def deleteGroupSub(uid, GroupNum):
conn = sqlite3.connect('robot.db', 30.0)
c = conn.cursor()
cur = c.execute("SELECT * FROM subGroup WHERE UID=? AND Group_Number=?",(uid,GroupNum))
curLen = len(list(cur))
for row in c.execute("SELECT Name FROM UP WHERE UID=?",(uid,)):
name = r... | code_fim | hard | {
"lang": "python",
"repo": "yuyaokeng/biliBot",
"path": "/initDatabase.py",
"mode": "spm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_suffix|>val_dataloader = dict(
batch_size=1,
num_workers=4,
persistent_workers=True,
pin_memory=True,
sampler=dict(type='DefaultSampler', shuffle=False),
dataset=totaltext_textspotting_test)
test_dataloader = val_dataloader
val_cfg = dict(type='ValLoop')
test_cfg = dict(type='TestLoop')
... | code_fim | hard | {
"lang": "python",
"repo": "open-mmlab/mmocr",
"path": "/projects/SPTS/config/spts/spts_resnet50_8xb8-200e_totaltext.py",
"mode": "spm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: open-mmlab/mmocr path: /projects/SPTS/config/spts/spts_resnet50_8xb8-200e_totaltext.py
_base_ = [
'_base_spts_resnet50_mmocr.py',
'../_base_/datasets/totaltext.py',
'../_base_/default_runtime.py',
]
load_from = 'work_dirs/spts_resnet50_150e_pretrain-spts/epoch_150.pth'
num_epochs = ... | code_fim | hard | {
"lang": "python",
"repo": "open-mmlab/mmocr",
"path": "/projects/SPTS/config/spts/spts_resnet50_8xb8-200e_totaltext.py",
"mode": "psm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_suffix|>val_cfg = dict(type='ValLoop')
test_cfg = dict(type='TestLoop')
val_evaluator = [
dict(
type='E2EPointMetric',
prefix='none',
word_spotting=True,
match_dist_thr=0.4),
dict(
type='E2EPointMetric',
prefix='full',
lexicon_path='data/totaltext/l... | code_fim | hard | {
"lang": "python",
"repo": "open-mmlab/mmocr",
"path": "/projects/SPTS/config/spts/spts_resnet50_8xb8-200e_totaltext.py",
"mode": "spm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: lxtGH/flownet_pytorch path: /test/testFlowNetS.py
import imageio
import numpy as np
from torch.autograd import Variable
import torch
from models.FlowNetS import flownets
<|fim_suffix|>flownet = flownets()
flownet.cuda()
im1 = imageio.imread(im1_path)
im2 = imageio.imread(im2_path)
print("each... | code_fim | hard | {
"lang": "python",
"repo": "lxtGH/flownet_pytorch",
"path": "/test/testFlowNetS.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.