text stringlengths 232 16.3k | domain stringclasses 1
value | difficulty stringclasses 3
values | meta dict |
|---|---|---|---|
<|fim_suffix|> if level == 0:
drawLine(turt, x1, y1, x2, y2)
else:
xm = (x1 + x2 + y1 - y2) / 2
ym = (x2 + y1 + y2 - x1) / 2
cCurve(turt, x1, y1, xm, ym, level-1)
cCurve(turt, xm, ym, x2, y2, level-1)
cCurve(pen, 75, -75, 75, 75, 12)
#Refresh the screen
turtle.update()
t... | code_fim | medium | {
"lang": "python",
"repo": "roni-kemp/python_programming_curricula",
"path": "/CS2/1275_turtle_recursion/c_curve_turtle_fractal_NOT_DONE/c_curve_00.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|>ning, FileDoesNotExistError, DirectoryDoesNotExistError<|fim_prefix|># repo: whigg/pds4lib path: /pds4lib/__init__.py
from .datafile import DataFile
from .label import Lab<|fim_middle|>el, ContextLabel
from .product import Product, Collection
from .product import EmptyCollectionDirectoryWar | code_fim | medium | {
"lang": "python",
"repo": "whigg/pds4lib",
"path": "/pds4lib/__init__.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: whigg/pds4lib path: /pds4lib/__init__.py
from .datafile import DataFile
from .label import Lab<|fim_suffix|>tion
from .product import EmptyCollectionDirectoryWarning, FileDoesNotExistError, DirectoryDoesNotExistError<|fim_middle|>el, ContextLabel
from .product import Product, Collec | code_fim | easy | {
"lang": "python",
"repo": "whigg/pds4lib",
"path": "/pds4lib/__init__.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: Amos-zq/justpic path: /justpic/markpic/admin.py
from django.contrib import admin
from mark<|fim_suffix|>ister(Log5k)
admin.site.register(Picture5K)<|fim_middle|>pic.models import Student,Picture5K,Log5k
admin.site.register(Student)
admin.site.reg | code_fim | medium | {
"lang": "python",
"repo": "Amos-zq/justpic",
"path": "/justpic/markpic/admin.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|>ister(Log5k)
admin.site.register(Picture5K)<|fim_prefix|># repo: Amos-zq/justpic path: /justpic/markpic/admin.py
from django.contrib import admin
from markpic.models import Student,Picture5K,Log5k
<|fim_middle|>admin.site.register(Student)
admin.site.reg | code_fim | easy | {
"lang": "python",
"repo": "Amos-zq/justpic",
"path": "/justpic/markpic/admin.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> def __init__(self, name='', page=None):
'''
Constructor.
'''
self.name = name
self.page = page<|fim_prefix|># repo: YSturkenboom/viaduct path: /app/models/file.py
from app import db
from app.models import BaseEntity
class File(db.Model, BaseEntity):
'''
... | code_fim | medium | {
"lang": "python",
"repo": "YSturkenboom/viaduct",
"path": "/app/models/file.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: YSturkenboom/viaduct path: /app/models/file.py
from app import db
from app.models import BaseEntity
<|fim_suffix|> name = db.Column(db.String(200), unique=True)
page_id = db.Column(db.Integer, db.ForeignKey('page.id'))
page = db.relationship('Page', backref=db.backref('files', lazy='... | code_fim | medium | {
"lang": "python",
"repo": "YSturkenboom/viaduct",
"path": "/app/models/file.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> def _autograd(self, x):
self.de_function.sensitivity = self.sensitivity
return torchdiffeq.odeint(self.de_function, x, self.t_span, rtol=self.rtol, atol=self.atol,
method=self.solver)[-1]
@property
def nfe(self):
return self.de_functi... | code_fim | hard | {
"lang": "python",
"repo": "seemurgh/phynn",
"path": "/src/maths/dennet.py",
"mode": "spm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_suffix|> def forward(self, x: torch.Tensor):
# not being used atm
x = self._prep_odeint(x)
switcher = {
'autograd': self._autograd,
'adjoint': self._adjoint,
}
odeint = switcher.get(self.sensitivity)
out = odeint(x)
return out
... | code_fim | medium | {
"lang": "python",
"repo": "seemurgh/phynn",
"path": "/src/maths/dennet.py",
"mode": "spm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: seemurgh/phynn path: /src/maths/dennet.py
import torch
import torch.nn as nn
import torchdiffeq
import pytorch_lightning as pl
from src.maths.diffeq import DiffEq
from src.maths.diffeq_1DWave import Diffeq1DWave
class DENNet(pl.LightningModule):
"""
A class to handle lower-level paramet... | code_fim | hard | {
"lang": "python",
"repo": "seemurgh/phynn",
"path": "/src/maths/dennet.py",
"mode": "psm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: alifianmahardhika/galaxy_simpy path: /new-code/simple-code-program.py
import numpy as np
import matplotlib.pyplot as plt
#initil-parameter-symple-model
R = 2
N = 150
m = 10
m_0 = 10*m
dt = 0.002
G = 13.37*10**(-11)
eps =0.3
alpha_0 = 1.2e-8
omega = np.random.normal(0,2*np.pi)
#inital_array
x = ... | code_fim | hard | {
"lang": "python",
"repo": "alifianmahardhika/galaxy_simpy",
"path": "/new-code/simple-code-program.py",
"mode": "psm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_suffix|># euler_mond
a = np.zeros((N,2))
for k in range(100):
no= np.str(k)
qq = (np.abs(force(f,x,x_center,N))/alpha_0)
a= force(f,x,x_center,N)*beta(qq)
x += v*dt
v += a*dt
plt.xlim(-6,6)
plt.ylim(-6,6)
plt.scatter(x[:,0],x[:,1],s=10,c='k')
plt.savefig('./output_mond_euler/pl... | code_fim | hard | {
"lang": "python",
"repo": "alifianmahardhika/galaxy_simpy",
"path": "/new-code/simple-code-program.py",
"mode": "spm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: AlanRosenthal/git-repo-move path: /git_repo_move/keepfiles.py
"""
Keep Files class
"""
import os
import random
class KeepFiles:
"""
KeepFiles class. These are the files and directories you want to save
"""
def __init__(
self, keep_files, keep_directories, is_dir_struct... | code_fim | hard | {
"lang": "python",
"repo": "AlanRosenthal/git-repo-move",
"path": "/git_repo_move/keepfiles.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> @property
def commands(self):
return self._commands
@property
def common_path(self):
"""
Return a common path (if any) for all files and directories
"""
directories = []
for file in self.keep_files:
directories.append(os.path.dir... | code_fim | hard | {
"lang": "python",
"repo": "AlanRosenthal/git-repo-move",
"path": "/git_repo_move/keepfiles.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|>
Pin(num='8',name='GPIO2',func=Pin.BIDIR,do_erc=True),
Pin(num='9',name='SCLK',do_erc=True),
Pin(num='10',name='SDI',do_erc=True),
Pin(num='11',name='SDO',do_erc=True),
Pin(num='12',name='SEL',do_erc=True)])])<|fim_prefix|># repo: UncleRus/skidl ... | code_fim | hard | {
"lang": "python",
"repo": "UncleRus/skidl",
"path": "/skidl/libs/RFSolutions_sklib.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: UncleRus/skidl path: /skidl/libs/RFSolutions_sklib.py
from skidl import Pin, Part, SchLib, SKIDL, TEMPLATE
SKIDL_lib_version = '0.0.1'
RFSolutions = SchLib(tool=SKIDL).add_parts(*[
Part(name='ZETA-433-SO',dest=TEMPLATE,tool=SKIDL,keywords='RF TRANSCEIVER MODULE',description='FM ZETA TRA... | code_fim | hard | {
"lang": "python",
"repo": "UncleRus/skidl",
"path": "/skidl/libs/RFSolutions_sklib.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|>True),
Pin(num='4',name='VCC',func=Pin.PWRIN,do_erc=True),
Pin(num='5',name='IRQ',func=Pin.OUTPUT,do_erc=True),
Pin(num='6',name='NC',func=Pin.NOCONNECT,do_erc=True),
Pin(num='7',name='GPIO1',func=Pin.BIDIR,do_erc=True),
Pin(num='8',name='GPIO2',... | code_fim | hard | {
"lang": "python",
"repo": "UncleRus/skidl",
"path": "/skidl/libs/RFSolutions_sklib.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> def __execute_ratio(self, position: tuple):
"""
Calculates the position given when multiplied by the image to screen ratio.
:param position: (x, y,) of the position to move the cursor to.
:return: (x, y,) of the new position after being multiplied by the ratio.
... | code_fim | hard | {
"lang": "python",
"repo": "RhysRead/camControl",
"path": "/src/CursorProcessing.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: RhysRead/camControl path: /src/CursorProcessing.py
#!/usr/bin/env python3
"""CursorProcessing.py: This file contains code that is used for processing
the cursor, screen axes, and general OS utilities."""
__author__ = "Rhys Read"
__copyright__ = "Copyright 2018, Rhys Read"
import pyautogui
impo... | code_fim | hard | {
"lang": "python",
"repo": "RhysRead/camControl",
"path": "/src/CursorProcessing.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> fe = TfidfVectorizer(ngram_range=(4, 4), analyzer='word',
min_df=0.25, max_df=0.75)
X = fe.fit_transform([jabberwocky,
jabberwocky + jabberwocky_author,
jabberwocky_author,
jabberwocky])
sh... | code_fim | hard | {
"lang": "python",
"repo": "FreeDiscovery/FreeDiscovery",
"path": "/freediscovery/tests/test_near_duplicates.py",
"mode": "spm",
"license": "BSD-3-Clause",
"source": "the-stack-v2"
} |
<|fim_suffix|> sh = IMatchNearDuplicates(n_rand_lexicons=n_rand_lexicons)
sh.fit(X)
assert sh.labels_.shape[0] == X.shape[0]
assert sh.hash_.shape[0] == X.shape[0]
assert sh.hash_is_dup_.shape[0] == X.shape[0]
# different documents produce different hash
assert sh.labels_[0] != sh.labels_[2... | code_fim | hard | {
"lang": "python",
"repo": "FreeDiscovery/FreeDiscovery",
"path": "/freediscovery/tests/test_near_duplicates.py",
"mode": "spm",
"license": "BSD-3-Clause",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: FreeDiscovery/FreeDiscovery path: /freediscovery/tests/test_near_duplicates.py
# -*- coding: utf-8 -*-
from unittest import SkipTest
import pytest
# adapted from https://github.com/seomoz/simhash-py/blob/master/test/test.py
jabberwocky = '''
Twas brillig, and the slithy toves
Did gyre... | code_fim | hard | {
"lang": "python",
"repo": "FreeDiscovery/FreeDiscovery",
"path": "/freediscovery/tests/test_near_duplicates.py",
"mode": "psm",
"license": "BSD-3-Clause",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: liangtianxin/SLM-Lab path: /slm_lab/agent/algorithm/sac.py
from slm_lab.agent import net
from slm_lab.agent.algorithm import policy_util
from slm_lab.agent.algorithm.actor_critic import ActorCritic
from slm_lab.agent.net import net_util
from slm_lab.lib import logger, util
from slm_lab.lib.decora... | code_fim | hard | {
"lang": "python",
"repo": "liangtianxin/SLM-Lab",
"path": "/slm_lab/agent/algorithm/sac.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> # V-value loss
v_preds = self.calc_v(states, net=self.critic_net)
v_targets = self.calc_v_targets(batch, action_pd)
val_loss = self.calc_reg_loss(v_preds, v_targets)
self.critic_net.train_step(val_loss, self.critic_optim, self... | code_fim | hard | {
"lang": "python",
"repo": "liangtianxin/SLM-Lab",
"path": "/slm_lab/agent/algorithm/sac.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> '''
Networks: net(actor/policy), critic (value), target_critic, q1_net, q1_net
All networks are separate, and have the same hidden layer architectures and optim specs, so tuning is minimal
'''
self.shared = False # SAC does not share networks
in_dim = self.... | code_fim | hard | {
"lang": "python",
"repo": "liangtianxin/SLM-Lab",
"path": "/slm_lab/agent/algorithm/sac.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: bbyun28/kinoml path: /kinoml/features/complexes.py
pdb_id(
system.protein.pdb_id,
system.protein.klifs_kinase_id,
system.protein.chain_id,
system.protein.alternate_location
)
else:
kinase_details = sel... | code_fim | hard | {
"lang": "python",
"repo": "bbyun28/kinoml",
"path": "/kinoml/features/complexes.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: bbyun28/kinoml path: /kinoml/features/complexes.py
chain_id=expression_tag["chain_id"],
residue_name=expression_tag["residue_name"],
residue_id=expression_tag["residue_id"]
)
except ValueError:
p... | code_fim | hard | {
"lang": "python",
"repo": "bbyun28/kinoml",
"path": "/kinoml/features/complexes.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> def _interpret_kinase(self, protein: ProteinSystem):
"""
Interpret the kinase information stored in the given Protein object.
Parameters
----------
protein: Protein
The Protein object.
"""
import pandas as pd
from ..core.sequ... | code_fim | hard | {
"lang": "python",
"repo": "bbyun28/kinoml",
"path": "/kinoml/features/complexes.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> @mock.patch.object(wsgi_proxy, 'make_transparent_proxy')
def test_process_request_proxies_to_heat(self, mock_proxy):
cfg.CONF.reset()
cfg.CONF = mock.Mock(proxy=mock.Mock(heat_host="foo.com"))
app = mock.MagicMock()
conf = mock.MagicMock()
req = mock.MagicMo... | code_fim | medium | {
"lang": "python",
"repo": "vineethtw/fusion",
"path": "/fusion/tests/unit/test_proxy_middleware.py",
"mode": "spm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_suffix|> self.assertEqual(response, final_response)
calls = [mock.call(app), mock.call(mock_proxy.return_value)]
req.get_response.assert_has_calls(calls)
def test_process_request_by_fusion(self):
cfg.CONF.reset()
cfg.CONF = mock.Mock(proxy=mock.Mock(heat_host="foo.com")... | code_fim | hard | {
"lang": "python",
"repo": "vineethtw/fusion",
"path": "/fusion/tests/unit/test_proxy_middleware.py",
"mode": "spm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: vineethtw/fusion path: /fusion/tests/unit/test_proxy_middleware.py
import mock
import unittest
from paste import proxy as wsgi_proxy
from oslo.config import cfg
from fusion.common.proxy_middleware import ProxyMiddleware
class ProxyMiddlewareTest(unittest.TestCase):
@mock.patch.object(wsgi... | code_fim | hard | {
"lang": "python",
"repo": "vineethtw/fusion",
"path": "/fusion/tests/unit/test_proxy_middleware.py",
"mode": "psm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: Kelvinrr/PySAT path: /libpysat/derived/m3/development.py
from . import development_funcs as dv_funcs
from ..utils import generic_func
def bd1umratio(data, **kwargs):
"""
Name: BD1um Ratio
Parameter: BD930 / BD990
Formulation:
BD930 = 1 - ((R929) / (((R1579 - R699)/(1579 - 6... | code_fim | hard | {
"lang": "python",
"repo": "Kelvinrr/PySAT",
"path": "/libpysat/derived/m3/development.py",
"mode": "psm",
"license": "LicenseRef-scancode-warranty-disclaimer",
"source": "the-stack-v2"
} |
<|fim_suffix|> wv_array : ndarray
(n,1) array of wavelengths that correspond to the p
dimension of the data array
Returns
-------
: ndarray
the processed ndarray
"""
wavelengths = [2538, 2578, 2618, 2817, 2857, 2897]
return generic_func(data, wavelengths... | code_fim | hard | {
"lang": "python",
"repo": "Kelvinrr/PySAT",
"path": "/libpysat/derived/m3/development.py",
"mode": "spm",
"license": "LicenseRef-scancode-warranty-disclaimer",
"source": "the-stack-v2"
} |
<|fim_suffix|> Parameters
----------
data : ndarray
(n,m,p) array
wv_array : ndarray
(n,1) array of wavelengths that correspond to the p
dimension of the data array
Returns
-------
: ndarray
the processed ndarray
"""
wavelengths = [14... | code_fim | hard | {
"lang": "python",
"repo": "Kelvinrr/PySAT",
"path": "/libpysat/derived/m3/development.py",
"mode": "spm",
"license": "LicenseRef-scancode-warranty-disclaimer",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: xyj77/keras-spp path: /tests/test_roi_pooling.py
import keras.backend as K
import numpy as np
from keras.layers import Input
from keras.models import Model
from spp.RoiPooling import RoiPooling
dim_ordering = K.image_dim_ordering()
assert dim_ordering in {'tf', 'th'}, 'dim_ordering must be in {... | code_fim | hard | {
"lang": "python",
"repo": "xyj77/keras-spp",
"path": "/tests/test_roi_pooling.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> if dim_ordering == 'th':
X_curr = X_img[0, :, X_roi[0, roi, 0]:X_roi[0, roi, 2], X_roi[0, roi, 1]:X_roi[0, roi, 3]]
row_length = [float(X_curr.shape[1]) / i for i in pooling_regions]
col_length = [float(X_curr.shape[2]) / i for i in pooling_regions]
elif... | code_fim | hard | {
"lang": "python",
"repo": "xyj77/keras-spp",
"path": "/tests/test_roi_pooling.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> X_roi = np.reshape(X_roi, (1, num_rois, 4))
Y = model.predict([X_img, X_roi])
for roi in range(num_rois):
if dim_ordering == 'th':
X_curr = X_img[0, :, X_roi[0, roi, 0]:X_roi[0, roi, 2], X_roi[0, roi, 1]:X_roi[0, roi, 3]]
row_length = [float(X_curr.shape[1]) ... | code_fim | hard | {
"lang": "python",
"repo": "xyj77/keras-spp",
"path": "/tests/test_roi_pooling.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> provider_name = "route53"
domain = "fullcr1stal.tk"
def _filter_headers(self):
"""Sensitive headers to be filtered."""
return ["Authorization"]
def test_provider_authenticate_private_zone_only(self):
with self._use_vcr("IntegrationTests/test_provider_authenticate.... | code_fim | medium | {
"lang": "python",
"repo": "alexAubin/lexicon",
"path": "/lexicon/tests/providers/test_route53.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: alexAubin/lexicon path: /lexicon/tests/providers/test_route53.py
"""Test for route53 implementation of the interface."""
from contextlib import contextmanager
from unittest import TestCase
import pytest
from lexicon.tests.providers import integration_tests
class Route53ProviderTests(TestCase,... | code_fim | hard | {
"lang": "python",
"repo": "alexAubin/lexicon",
"path": "/lexicon/tests/providers/test_route53.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> with self._use_vcr("IntegrationTests/test_provider_authenticate.yaml"):
provider = self._build_provider_with_overrides({"private_zone": "false"})
provider.authenticate()
assert provider.domain_id is not None
def _build_provider_with_overrides(self, override... | code_fim | hard | {
"lang": "python",
"repo": "alexAubin/lexicon",
"path": "/lexicon/tests/providers/test_route53.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: kwitnacy/wti path: /wtiproj05/zad_12_cherry.py
try:
from cheroot.wsgi import Server as WSGIServer, PathInfoDispatcher
except ImportError:
from cherrypy.wsgiserver import CherryPyWSGIServer as WSGIServer, WSGIPathInfoDispatcher as PathInfoDispatcher
<|fim_suffix|>if __name__ == '__main__'... | code_fim | medium | {
"lang": "python",
"repo": "kwitnacy/wti",
"path": "/wtiproj05/zad_12_cherry.py",
"mode": "psm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_suffix|>if __name__ == '__main__':
try:
server.start()
except KeyboardInterrupt:
server.stop()<|fim_prefix|># repo: kwitnacy/wti path: /wtiproj05/zad_12_cherry.py
try:
from cheroot.wsgi import Server as WSGIServer, PathInfoDispatcher
except ImportError:
from cherrypy.wsgiserver import C... | code_fim | medium | {
"lang": "python",
"repo": "kwitnacy/wti",
"path": "/wtiproj05/zad_12_cherry.py",
"mode": "spm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_suffix|> filename = str(age) + '_' + str(gender) + '_' + str(random.randint(10**14, 10**15-1)) + '.JPG'
next_path = join(dirname(cur_path), filename)
print(cur_path, next_path)
os.rename(cur_path, next_path)<|fim_prefix|># repo: guliashvili/ageDetection path: /normalization/morph/morphNorm.py
im... | code_fim | medium | {
"lang": "python",
"repo": "guliashvili/ageDetection",
"path": "/normalization/morph/morphNorm.py",
"mode": "spm",
"license": "Unlicense",
"source": "the-stack-v2"
} |
<|fim_suffix|> cur_path = join(mypath, loc)
filename = str(age) + '_' + str(gender) + '_' + str(random.randint(10**14, 10**15-1)) + '.JPG'
next_path = join(dirname(cur_path), filename)
print(cur_path, next_path)
os.rename(cur_path, next_path)<|fim_prefix|># repo: guliashvili/ageDetection path: /n... | code_fim | hard | {
"lang": "python",
"repo": "guliashvili/ageDetection",
"path": "/normalization/morph/morphNorm.py",
"mode": "spm",
"license": "Unlicense",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: guliashvili/ageDetection path: /normalization/morph/morphNorm.py
import os
from os.path import join, dirname
import random
mypath = '/Users/gguli/Desktop/bachelor/MORPH_nonCommercial/'
csv = [x.split(',') for x in list(filter(None,open('/Users/gguli/Desktop/bachelor/MORPH_nonCommercial/morph_2... | code_fim | medium | {
"lang": "python",
"repo": "guliashvili/ageDetection",
"path": "/normalization/morph/morphNorm.py",
"mode": "psm",
"license": "Unlicense",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: sumanthratna/nlu path: /nlu/components/chunker.py
from nlu.pipe_components import SparkNLUComponent, NLUComponent
class Chunker(SparkNLUComponent):
<|fim_suffix|> SparkNLUComponent.__init__(self,component_name,component_type)
if model != None : self.model = model
else :
... | code_fim | hard | {
"lang": "python",
"repo": "sumanthratna/nlu",
"path": "/nlu/components/chunker.py",
"mode": "psm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_suffix|> SparkNLUComponent.__init__(self,component_name,component_type)
if model != None : self.model = model
else :
if component_name == 'default_chunker':
from nlu import DefaultChunker
if get_default : self.model = DefaultChunker.get_default_... | code_fim | hard | {
"lang": "python",
"repo": "sumanthratna/nlu",
"path": "/nlu/components/chunker.py",
"mode": "spm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_suffix|>
class CustomUserCreationForm(PopRequestMixin, CreateUpdateAjaxMixin,
UserCreationForm):
class Meta:
model = User
fields = ['username', 'password1', 'password2']
class CustomAuthenticationForm(AuthenticationForm):
class Meta:
model = User
... | code_fim | hard | {
"lang": "python",
"repo": "sheriffbarrow/Troubleshoot-management-system",
"path": "/bootstrap_modal_forms/examples/forms.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: sheriffbarrow/Troubleshoot-management-system path: /bootstrap_modal_forms/examples/forms.py
from django import forms
from django.contrib.auth.forms import UserCreationForm, AuthenticationForm
from django.contrib.auth.models import User
from bootstrap_modal_forms.mixins import PopRequestMixin, Cr... | code_fim | medium | {
"lang": "python",
"repo": "sheriffbarrow/Troubleshoot-management-system",
"path": "/bootstrap_modal_forms/examples/forms.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: pymedphys/pymedphys path: /lib/pymedphys/_dicom/rtplan/core.py
# Copyright (C) 2019 Cancer Care Associates
# 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://... | code_fim | hard | {
"lang": "python",
"repo": "pymedphys/pymedphys",
"path": "/lib/pymedphys/_dicom/rtplan/core.py",
"mode": "psm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_suffix|>
def get_leaf_jaw_positions_for_type(
beam_limiting_device_position_sequences, rt_beam_limiting_device_type
):
leaf_jaw_positions = []
for sequence in beam_limiting_device_position_sequences:
matching_type = [
item
for item in sequence
if item.RTBea... | code_fim | hard | {
"lang": "python",
"repo": "pymedphys/pymedphys",
"path": "/lib/pymedphys/_dicom/rtplan/core.py",
"mode": "spm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: pbs/django-atris path: /tests/migrations/0001_initial.py
# -*- coding: utf-8 -*-
# Generated by Django 1.11 on 2017-04-05 10:13
from __future__ import unicode_literals
import uuid
from django.db import migrations, models
import django.db.models.deletion
class Migration(migrations.Migration):
... | code_fim | hard | {
"lang": "python",
"repo": "pbs/django-atris",
"path": "/tests/migrations/0001_initial.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> name='author',
field=models.OneToOneField(on_delete=django.db.models.deletion.CASCADE, related_name='work', to='tests.Writer'),
),
migrations.AddField(
model_name='episode',
name='co_authors',
field=models.ManyToManyField(related_name='... | code_fim | hard | {
"lang": "python",
"repo": "pbs/django-atris",
"path": "/tests/migrations/0001_initial.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> transfer = And(
core_transfer,
If(Txn.group_index() == Int(1), receive_payment, transfer_asset)
)
contract = And(
core,
If(Global.group_size() == Int(2), transfer, opt_in),
)
return contract
if __name__ == "__main__":
owner = "OOOOOOOOOOOOOOOOOOO... | code_fim | hard | {
"lang": "python",
"repo": "iceal-lim/algorand-swap-contract-demo",
"path": "/src/main/resources/teal/asset_swap_v2.py",
"mode": "spm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: iceal-lim/algorand-swap-contract-demo path: /src/main/resources/teal/asset_swap_v2.py
from pyteal import *
def asset_swap_v2(owner, buyer, assetId, round, fee):
print('creating asset_swap_v2 contract')
# Use Cases
# 1. Opt-In Contract
opt_in = And(
Global.group_size() =... | code_fim | hard | {
"lang": "python",
"repo": "iceal-lim/algorand-swap-contract-demo",
"path": "/src/main/resources/teal/asset_swap_v2.py",
"mode": "psm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: adamcharnock/lightbus path: /lightbus_examples/ex03_worked_example/dashboard/web.py
"""
This web server does not access the bus at all. It simply
reads data from the .exampledb.json json file created by
bus.py
"""
import json
from flask import Flask
app = Flask(__name__)
<|fim_suffix|> wit... | code_fim | medium | {
"lang": "python",
"repo": "adamcharnock/lightbus",
"path": "/lightbus_examples/ex03_worked_example/dashboard/web.py",
"mode": "psm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_suffix|>@app.route("/")
def home():
html = "<h1>Dashboard</h1>\n"
html += "<p>Total store views</p>\n"
with open("/tmp/.dashboard.db.json", "r") as f:
page_views = json.load(f)
html += "<ul>"
for url, total_views in page_views.items():
html += f"<li>URL <code>{url}</code>: {t... | code_fim | medium | {
"lang": "python",
"repo": "adamcharnock/lightbus",
"path": "/lightbus_examples/ex03_worked_example/dashboard/web.py",
"mode": "spm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_suffix|> sub_dir_name = file_hash[:2]
return Path(sub_dir_name) / Path(file_hash)<|fim_prefix|># repo: Glooshak/file_storage path: /files_manager/utils.py
from pathlib import Path
<|fim_middle|>
def obtain_relative_file_path(file_hash: str) -> Path:
| code_fim | easy | {
"lang": "python",
"repo": "Glooshak/file_storage",
"path": "/files_manager/utils.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: Glooshak/file_storage path: /files_manager/utils.py
from pathlib import Path
<|fim_suffix|> sub_dir_name = file_hash[:2]
return Path(sub_dir_name) / Path(file_hash)<|fim_middle|>def obtain_relative_file_path(file_hash: str) -> Path:
| code_fim | easy | {
"lang": "python",
"repo": "Glooshak/file_storage",
"path": "/files_manager/utils.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: willypuzzle/flask-foundation path: /app/modules/auth/controllers.py
from flask import Blueprint, render_template, flash, request, redirect, url_for
from flask_login import login_user, logout_user, login_required
# Import module forms
from app.modules.auth.forms import LoginForm
# Import module m... | code_fim | medium | {
"lang": "python",
"repo": "willypuzzle/flask-foundation",
"path": "/app/modules/auth/controllers.py",
"mode": "psm",
"license": "BSD-3-Clause",
"source": "the-stack-v2"
} |
<|fim_suffix|>@mod.route("/logout")
def logout():
logout_user()
flash("You have been logged out.", "success")
return redirect(url_for("home.home"))
@mod.route("/restricted")
@login_required
def restricted():
return "You can only see this if you are logged in!", 200<|fim_prefix|># repo: willypuzzle/fl... | code_fim | hard | {
"lang": "python",
"repo": "willypuzzle/flask-foundation",
"path": "/app/modules/auth/controllers.py",
"mode": "spm",
"license": "BSD-3-Clause",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: onicagroup/runway path: /runway/s3_utils.py
"""Utility functions for S3."""
from __future__ import annotations
import logging
import os
import tempfile
import zipfile
from typing import TYPE_CHECKING, Any, Dict, Iterator, Optional, Sequence, cast
import boto3
from botocore.exceptions import Cli... | code_fim | hard | {
"lang": "python",
"repo": "onicagroup/runway",
"path": "/runway/s3_utils.py",
"mode": "psm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_suffix|> bucket: str, key: str, filename: str, session: Optional[boto3.Session] = None
) -> None:
"""Upload file to S3 bucket."""
s3_client = _get_client(session)
LOGGER.info("uploading %s to s3://%s/%s...", filename, bucket, key)
s3_client.upload_file(Filename=filename, Bucket=bucket, Key=key)... | code_fim | hard | {
"lang": "python",
"repo": "onicagroup/runway",
"path": "/runway/s3_utils.py",
"mode": "spm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: maxfriedrich/deid-training-data path: /deid/model/representer.py
from keras import backend as K
from keras.layers import Dense, Lambda, LSTM, Bidirectional, TimeDistributed, Masking
from keras.models import Sequential
from .layers import Noise
def get(identifier):
if identifier == 'noisy':... | code_fim | hard | {
"lang": "python",
"repo": "maxfriedrich/deid-training-data",
"path": "/deid/model/representer.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> l2_normalize=False, noise_before=True, noise_after=True, single_stddev=False, **_):
""" Build an LSTM representer.
:param embedding_size: the embedding (input) size
:param representation_size: the representation (output) size
:param apply_noise: whether to apply... | code_fim | hard | {
"lang": "python",
"repo": "maxfriedrich/deid-training-data",
"path": "/deid/model/representer.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: kevinedison/vnpy_lab path: /cpp_api_binding/generator/autocxxpy/preprocessor.py
# encoding: utf-8
import ast
import re
from collections import defaultdict
from dataclasses import dataclass, field
from typing import Dict, List, Optional, Set
from .cxxparser import (
CXXFileParser,
CXXPar... | code_fim | hard | {
"lang": "python",
"repo": "kevinedison/vnpy_lab",
"path": "/cpp_api_binding/generator/autocxxpy/preprocessor.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> # array of basic type, such as int[], char[]
if (
is_array_type(basic_combination) and
array_base(basic_combination) in base_types
):
return True
print(basic_combination)
return False
def _can_convert_to_dict(self, c: Class)... | code_fim | hard | {
"lang": "python",
"repo": "kevinedison/vnpy_lab",
"path": "/cpp_api_binding/generator/autocxxpy/preprocessor.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> # sync S3 bucket to EBS volume
ec2_instance.go_sync_ebs_volume_to_s3_bucket(
args.buckets_to_sync,
ssh_tunnel,
ec2_instance.instance_username
)<|fim_prefix|># repo: petersontylerd/awsbrainworks path: /awsbrainworks/execute/script/ec2_sync_ebs_volume_to_s3_bucket.py
## ... | code_fim | hard | {
"lang": "python",
"repo": "petersontylerd/awsbrainworks",
"path": "/awsbrainworks/execute/script/ec2_sync_ebs_volume_to_s3_bucket.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> # get username
ec2_instance.instance_username = ec2_instance.get_instance_username()
# sync S3 bucket to EBS volume
ec2_instance.go_sync_ebs_volume_to_s3_bucket(
args.buckets_to_sync,
ssh_tunnel,
ec2_instance.instance_username
)<|fim_prefix|># repo: petersontyl... | code_fim | hard | {
"lang": "python",
"repo": "petersontylerd/awsbrainworks",
"path": "/awsbrainworks/execute/script/ec2_sync_ebs_volume_to_s3_bucket.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: petersontylerd/awsbrainworks path: /awsbrainworks/execute/script/ec2_sync_ebs_volume_to_s3_bucket.py
## libraries
import argparse
import boto3
import os
import subprocess
import sys
import time
# custom imports
sys.path.append(os.path.join(os.environ["HOME"], ".aws_attributes"))
sys.path.append(... | code_fim | medium | {
"lang": "python",
"repo": "petersontylerd/awsbrainworks",
"path": "/awsbrainworks/execute/script/ec2_sync_ebs_volume_to_s3_bucket.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> self.deployment.module.exit_json.assert_called_once_with(changed=True, deployment='I am called')
def test_process_request_calls_fail_json_when_create_deployment_raises_exception(self):
self.deployment.module.params = {
'name': 'tested_thing',
'rest_api_id': '12345',
'cache_clu... | code_fim | hard | {
"lang": "python",
"repo": "mestudd/api-gateway-ansible",
"path": "/tests/test_apigw_deployment.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: mestudd/api-gateway-ansible path: /tests/test_apigw_deployment.py
#!/usr/bin/python
# TODO: License goes here
import library.apigw_deployment as apigw_deployment
from library.apigw_deployment import ApiGwDeployment
import mock
from mock import patch
from mock import create_autospec
from mock imp... | code_fim | hard | {
"lang": "python",
"repo": "mestudd/api-gateway-ansible",
"path": "/tests/test_apigw_deployment.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: suyash/char-rnn path: /trainer/input.py
import tensorflow as tf
def create_iterator(pattern, batch_size, sequence_length, vocab_size, repeat=False):
"""
Parameters
----------
pattern : string
glob pattern with files to read
batch_size : integer
batch size for... | code_fim | hard | {
"lang": "python",
"repo": "suyash/char-rnn",
"path": "/trainer/input.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> return tf.case({
tf.equal(c, 9): lambda: 1,
tf.equal(c, 10): lambda: 127 - 30,
tf.logical_and(tf.greater_equal(c, 32), tf.less_equal(c, 126)): lambda: c - 30,
}, default=lambda: 0, exclusive=True)
def split(row):
row = tf.decode_raw(row, out... | code_fim | medium | {
"lang": "python",
"repo": "suyash/char-rnn",
"path": "/trainer/input.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: MrYanMYN/DirEnum path: /dir-enum.py
import requests
import click
import time
import threading
def banner():
click.echo("""
___ _ ___
| \(_)_ _ | __|_ _ _ _ _ __
| |) | | '_| | _|| ' \ || | ' \
|___/|_|_| |___|_||_\_,_|_|_|_|
... | code_fim | hard | {
"lang": "python",
"repo": "MrYanMYN/DirEnum",
"path": "/dir-enum.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> def get_domain(self):
return self.__target
@click.command()
@click.option('--domain','-d', prompt="Enter the domain: " ,help='Enter a valid domain (without a subdomain)')
@click.option('--wordlist' ,'-w',prompt='Wordlist locaion: ' , help='enter the location of your preferred worlist')
@click... | code_fim | medium | {
"lang": "python",
"repo": "MrYanMYN/DirEnum",
"path": "/dir-enum.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> drive_model = drive_model.lower()
for mfg, signature in self.DRIVE_NAME_MANUFAC_MAP.iteritems():
if drive_model.startswith(signature):
return mfg
return self.UNIDENTIFIED_MANUFACTURER
def __get_smart_attr_headers_params(self, href_parsed):
"""Gets the raw SMART attribute elements along... | code_fim | hard | {
"lang": "python",
"repo": "love-xx/DiskDriveDaysPredictor",
"path": "/Code/utility/GetDriveAttributes.py",
"mode": "spm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_suffix|> manufacturer_reported_attributes[mfg] = {
'same_attributes': mfg_reports_same_attrs,
'uncommon_attributes': uncommon_attributes
}
return drive_attributes, manufacturer_reported_attributes
def main(self):
""" Main function that loads and parses the webpage and returns the
SMART at... | code_fim | hard | {
"lang": "python",
"repo": "love-xx/DiskDriveDaysPredictor",
"path": "/Code/utility/GetDriveAttributes.py",
"mode": "spm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: love-xx/DiskDriveDaysPredictor path: /Code/utility/GetDriveAttributes.py
#!/usr/bin/env python
# -*- coding: utf-8 -*-
import requests
from bs4 import BeautifulSoup as BS
import re
class GetDriveAttributes(object):
"""Loads and parses the BackBlaze's drive attribute webpage and returns the dri... | code_fim | hard | {
"lang": "python",
"repo": "love-xx/DiskDriveDaysPredictor",
"path": "/Code/utility/GetDriveAttributes.py",
"mode": "psm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_suffix|> ShazamKit.SHMatch
def test_methods(self):
# XXX
# unavailable: -init, +new
pass<|fim_prefix|># repo: ronaldoussoren/pyobjc path: /pyobjc-framework-ShazamKit/PyObjCTest/test_shmatch.py
from PyObjCTools.TestSupport import TestCase
import ShazamKit
<|fim_middle|>
class ... | code_fim | easy | {
"lang": "python",
"repo": "ronaldoussoren/pyobjc",
"path": "/pyobjc-framework-ShazamKit/PyObjCTest/test_shmatch.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: ronaldoussoren/pyobjc path: /pyobjc-framework-ShazamKit/PyObjCTest/test_shmatch.py
from PyObjCTools.TestSupport import TestCase
import ShazamKit
<|fim_suffix|> def test_methods(self):
# XXX
# unavailable: -init, +new
pass<|fim_middle|>
class TestSHMatch(TestCase):
... | code_fim | medium | {
"lang": "python",
"repo": "ronaldoussoren/pyobjc",
"path": "/pyobjc-framework-ShazamKit/PyObjCTest/test_shmatch.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: tanhongze/pyvmodule path: /pyvmodule/tools/memorization.py
__all__ = ['memorized']
def memorized(f):
<|fim_suffix|> if args in result_cache:return result_cache[args]
val = f(*args)
result_cache[args] = val
return val
return g<|fim_middle|> result_cache = {}
... | code_fim | easy | {
"lang": "python",
"repo": "tanhongze/pyvmodule",
"path": "/pyvmodule/tools/memorization.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> if args in result_cache:return result_cache[args]
val = f(*args)
result_cache[args] = val
return val
return g<|fim_prefix|># repo: tanhongze/pyvmodule path: /pyvmodule/tools/memorization.py
__all__ = ['memorized']
def memorized(f):
<|fim_middle|> result_cache = {}
... | code_fim | easy | {
"lang": "python",
"repo": "tanhongze/pyvmodule",
"path": "/pyvmodule/tools/memorization.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|>@app.template_filter('date')
def date_filter(s):
return s.split('T')[0] if s is not None else s
@app.template_filter('md')
def markdown(s):
return Markup(re.sub(r'\*(.+?)\*', r'<b>\1</b>', s)) if s is not None else s
api.add_resource(Users, '/api/users')
api.add_resource(Sessions, '/api/sessions... | code_fim | medium | {
"lang": "python",
"repo": "skazi0/yaia",
"path": "/app/__init__.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: skazi0/yaia path: /app/__init__.py
from flask import Flask, Markup, render_template
from flask_bower import Bower
from flask_bcrypt import Bcrypt
from flask_sqlalchemy import SQLAlchemy as SQLAlchemyBase
from flask_login import LoginManager
from flask_restful import Api
import re
from app.config... | code_fim | hard | {
"lang": "python",
"repo": "skazi0/yaia",
"path": "/app/__init__.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: jdb78/pytorch-forecasting path: /pytorch_forecasting/models/nn/__init__.py
from re import S
from typing import Dict
import torch
from torch import embedding, nn
<|fim_suffix|>__all__ = ["MultiEmbedding", "get_rnn", "LSTM", "GRU", "HiddenState", "TupleOutputMixIn"]<|fim_middle|>from pytorch_fore... | code_fim | hard | {
"lang": "python",
"repo": "jdb78/pytorch-forecasting",
"path": "/pytorch_forecasting/models/nn/__init__.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|>__all__ = ["MultiEmbedding", "get_rnn", "LSTM", "GRU", "HiddenState", "TupleOutputMixIn"]<|fim_prefix|># repo: jdb78/pytorch-forecasting path: /pytorch_forecasting/models/nn/__init__.py
from re import S
from typing import Dict
import torch
from torch import embedding, nn
<|fim_middle|>from pytorch_fore... | code_fim | hard | {
"lang": "python",
"repo": "jdb78/pytorch-forecasting",
"path": "/pytorch_forecasting/models/nn/__init__.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: aghure/trial path: /sms_scheduler/sms_scheduler/ap_scheduler.py
from pytz import utc
from apscheduler.schedulers.background import BackgroundScheduler
from apscheduler.jobstores.sqlalchemy import SQLAlchemyJobStore
from apscheduler.executors.pool import ProcessPoolExecutor
<|fim_suffix|> def ... | code_fim | hard | {
"lang": "python",
"repo": "aghure/trial",
"path": "/sms_scheduler/sms_scheduler/ap_scheduler.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> jobstores = {
'default': SQLAlchemyJobStore(url='sqlite:///jobs.sqlite')
}
executors = {
'processpool': ProcessPoolExecutor(max_workers=5)
}
job_defaults = {
'coalesce': False,
'max_instances': 3
}
scheduler = BackgroundScheduler()
scheduler.configure(jobstores=jobs... | code_fim | medium | {
"lang": "python",
"repo": "aghure/trial",
"path": "/sms_scheduler/sms_scheduler/ap_scheduler.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> Note that modifying the namespace will modify the actual namespace
of the Space instance.
Returns:
dict: Namespace.
"""
return self._execution_namespace.maps[0]
def execute(self, source):
"""Execute source code inside the space namespace an... | code_fim | hard | {
"lang": "python",
"repo": "davidesarra/jupyter_spaces",
"path": "/src/jupyter_spaces/space.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: davidesarra/jupyter_spaces path: /src/jupyter_spaces/space.py
import ast
import sys
from collections import ChainMap
from jupyter_spaces.errors import RegistryError
class SpaceRegister:
__slots__ = ["_register"]
def __init__(self):
"""Instantiate SpaceRegister."""
self... | code_fim | hard | {
"lang": "python",
"repo": "davidesarra/jupyter_spaces",
"path": "/src/jupyter_spaces/space.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> Returns:
str: Name.
"""
return self._name
@property
def namespace(self):
"""Namespace of the Space instance.
Note that modifying the namespace will modify the actual namespace
of the Space instance.
Returns:
dict: N... | code_fim | hard | {
"lang": "python",
"repo": "davidesarra/jupyter_spaces",
"path": "/src/jupyter_spaces/space.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: Undiscovered-Data/progress_bars path: /python_bar.py
#!/usr/bin/python3
import sys
from time import sleep
print(" *** Percent Complete ***")
print(" | |")
print(" 0% ################## 50% ############<|fim_suffix|>ush(... | code_fim | medium | {
"lang": "python",
"repo": "Undiscovered-Data/progress_bars",
"path": "/python_bar.py",
"mode": "psm",
"license": "BSD-2-Clause",
"source": "the-stack-v2"
} |
<|fim_suffix|>####### 100%")
print(" | |")
sys.stdout.write(" ")
sys.stdout.flush()
for a in range(50):
sys.stdout.write("@")
sys.stdout.flush()
sleep(0.3)
sys.stdout.write('\n')<|fim_prefix|># repo: Undiscovered-Data/progress_bars path: /python_bar.py
#!/u... | code_fim | medium | {
"lang": "python",
"repo": "Undiscovered-Data/progress_bars",
"path": "/python_bar.py",
"mode": "spm",
"license": "BSD-2-Clause",
"source": "the-stack-v2"
} |
<|fim_suffix|>에 등록한다.
admin.site.register(Automated_Query)<|fim_prefix|># repo: d0r6y/CloudKloud path: /test/myproject/blog/admin.py
from django.contrib import admin
from blog.models import * # models.py로부터 Post 모델을 가져온다<|fim_middle|>.
admin.site.register(Log) # Post를 관리자 페이지 | code_fim | easy | {
"lang": "python",
"repo": "d0r6y/CloudKloud",
"path": "/test/myproject/blog/admin.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: d0r6y/CloudKloud path: /test/myproject/blog/admin.py
from django.contrib import admin
from blog.m<|fim_suffix|>.
admin.site.register(Log) # Post를 관리자 페이지에 등록한다.
admin.site.register(Automated_Query)<|fim_middle|>odels import * # models.py로부터 Post 모델을 가져온다 | code_fim | easy | {
"lang": "python",
"repo": "d0r6y/CloudKloud",
"path": "/test/myproject/blog/admin.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: anomie31/music-dl path: /tests/test_utils.py
#!/usr/bin/env python
# -*- coding:utf-8 -*-
"""
@author: HJK
@file: test_utils.py
@time: 2019-01-30
"""
import platform
from music_dl import utils
<|fim_suffix|> if platform.system() == "Windows":
assert utils.colorize("music-dl", "qq") ... | code_fim | medium | {
"lang": "python",
"repo": "anomie31/music-dl",
"path": "/tests/test_utils.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> if platform.system() == "Windows":
assert utils.colorize("music-dl", "qq") == "music-dl"
assert utils.colorize(1234, "qq") == "1234"
else:
assert utils.colorize("music-dl", "qq") == "\033[92mmusic-dl\033[0m"
assert utils.colorize(1234, "xiami") == "\033[93m1234\033[... | code_fim | medium | {
"lang": "python",
"repo": "anomie31/music-dl",
"path": "/tests/test_utils.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: tensorflow/tfx path: /tfx/experimental/pipeline_testing/examples/chicago_taxi_pipeline/taxi_pipeline_regression_e2e_test.py
# Copyright 2020 Google LLC. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with t... | code_fim | hard | {
"lang": "python",
"repo": "tensorflow/tfx",
"path": "/tfx/experimental/pipeline_testing/examples/chicago_taxi_pipeline/taxi_pipeline_regression_e2e_test.py",
"mode": "psm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_suffix|> metadata_config = metadata.sqlite_metadata_connection_config(
self._metadata_path)
# Verify that recorded files are successfully copied to the output uris.
with metadata.Metadata(metadata_config) as m:
artifacts = m.store.get_artifacts()
artifact_count = len(artifacts)
... | code_fim | hard | {
"lang": "python",
"repo": "tensorflow/tfx",
"path": "/tfx/experimental/pipeline_testing/examples/chicago_taxi_pipeline/taxi_pipeline_regression_e2e_test.py",
"mode": "spm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.