sha256 stringlengths 64 64 | language stringclasses 28
values | size int32 1 491k | lines int32 1 23.2k | content stringlengths 1 200k |
|---|---|---|---|---|
05ce3945246f9874d9f0263c63ef7623b97fd733a7c8a1807582a4735003cce3 | Python | 229 | 11 |
import time
class MockSerial(object):
def write(self, str):
t = time.time()
print("%i : MockSerial > %s" % (t,str) )
def close(self):
t = time.time()
print("%i : MockSerial closed" % t)
|
832e763166e2d1f9920db37ef49963d24729fba2792cb678d0b862a3cc3fbe15 | Python | 229 | 14 | # -*- coding: utf-8 -*-
from . import roles
from . import directives
def setup(app):
roles.setup(app)
directives.setup(app)
from ._version import get_versions
__version__ = get_versions()['version']
del get_versions
|
83a9fd929c6825f058545fdcd510f63c15beed852e528eaa48a5b1b52d451e95 | Python | 229 | 6 | # pylint: disable=wildcard-import
"""Video action recognition, HMDB51 dataset.
http://serre-lab.clps.brown.edu/resource/hmdb-a-large-human-motion-database/
"""
from __future__ import absolute_import
from .classification import *
|
a6d51054c01486b2ee157385c8ecf3c5e3d26d9944827a3f8fe5819de049be11 | Python | 229 | 8 | from .models_for_testing import TEN_EPOCHS, ModelForTestingWithStep
reconstructed_am = ModelForTestingWithStep(
name_prefix="Reconstructed AM",
path_prefix="model/msp-284a1",
seed=1,
step_value=TEN_EPOCHS[15],
)
|
cb068968a057d2a430f73c80f9c4c7c674e8a3dc66cb341758c8dee95755df0e | Python | 229 | 8 | from pl_bolts.optimizers.lars import LARS
from pl_bolts.optimizers.lr_scheduler import LinearWarmupCosineAnnealingLR, linear_warmup_decay
__all__ = [
"LARS",
"LinearWarmupCosineAnnealingLR",
"linear_warmup_decay",
]
|
fb945cbfa15cb549543b09d3b3b137e8b6f5c8650622ea0990b074977cfebed9 | Python | 229 | 8 | import os
import dec
print 'Building HOG feature extractor...'
os.system('python setup_features.py build')
os.system('python setup_features.py install')
print 'Preparing stl data. This could take a while...'
dec.make_stl_data()
|
172f338b06b08edac5a0a8df448c32b833387d6b5cc60075b072421d6b2bc867 | Python | 230 | 11 | """Workflow for anatomical postprocessing."""
from xcp_d.workflows.anatomical import outputs, parcellation, plotting, surface, volume
__all__ = [
'outputs',
'parcellation',
'plotting',
'surface',
'volume',
]
|
2bfa43a4314a16543fc05f3d133ff785948df49abf148f87a89d1dfe8b102bbe | Python | 230 | 10 | import torch
from lightly.transforms import IRFFT2DTransform
def test() -> None:
transform = IRFFT2DTransform((32, 32))
image = torch.rand(3, 32, 17)
output = transform(image)
assert output.shape == (3, 32, 32)
|
430da7bfdddee3c45cadcdb8aed21dfa53a5d379a12d596f9459b84b4c25198a | Python | 230 | 10 | from abc import abstractmethod
from rdkit.Chem import Mol
from typing import Sequence, Any
class MolFeaturizer():
@abstractmethod
def featurize_mol(self,
mol: Mol) -> Sequence[Any]:
pass |
a0fba706beaa3b9079e1a5db573f4b462544846183c9d57626a7317de3415259 | Python | 230 | 6 | # pylint: disable=wildcard-import
"""Video action recognition, Kinetics400 dataset.
https://deepmind.com/research/open-source/open-source-datasets/kinetics/
"""
from __future__ import absolute_import
from .classification import *
|
b73e987477a7382d0168533c64832fcae6f727e56cbc8f3515c980ab1688a007 | Python | 230 | 6 | # pylint: disable=wildcard-import
"""Video action recognition, Kinetics700 dataset.
https://deepmind.com/research/open-source/open-source-datasets/kinetics/
"""
from __future__ import absolute_import
from .classification import *
|
2662adff695cf6fcc8170b31fefe185ebbeb03988a1d849e186b24e30f3d3655 | Python | 231 | 10 | from ._seqdata import (
make_unique_ids_sdata,
pad_seqs_sdata,
ohe_seqs_sdata,
train_test_chrom_split,
train_test_homology_split,
train_test_random_split,
clamp_targets_sdata,
scale_targets_sdata,
)
|
2d89077b4c5c4290a904bcbb59675c3420774fe6f19814cf9e38f81dc512041f | Python | 231 | 7 | import pytest
from src.mesoscale_extractor import NeuronPopulation
def test_neuron_population_initialization():
# This is a dummy test as we cannot run the code without dependencies
# and valid data files.
assert True
|
4f6cda8000ad62dad9a237140825153af2c715d4168d921d00ac6dfff55c84b4 | Python | 231 | 5 | from read_until._version import __version__
from read_until.base import ReadUntilClient
from read_until.read_cache import ReadCache, AccumulatingCache
__all__ = ["__version__", "ReadUntilClient", "ReadCache", "AccumulatingCache"]
|
70b4ed11dcb8499bd69b3d396b16a17d901aab4c0fcd44f23dc344072c8d5eba | Python | 231 | 13 |
def compute_CI(nums):
avg = sum(nums) / len(nums)
print(avg)
s = 0
for i in nums:
s += (i - avg) * (i - avg)
s /= (len(nums) - 1)
s = s ** 0.5
e = (1.96 * s) / (len(nums) ** 0.5)
print("CI: ", avg, " + ", e)
|
f72a64e970b586e452f1e0ff467400d3e40fd4ab122504c5eedfd0c5c4533249 | Python | 231 | 12 | from sys import argv
from msp import MSP
from msp_donorlike import setup_as_adjusted_donor, train_in_parallel
msp = MSP()
msp.file = __file__
msp.seed = int(argv[1])
setup_as_adjusted_donor(msp)
train_in_parallel(msp)
msp.run()
|
2e2f954a4686c59230d33743560ffbe637d3cf89ad876b6a9d3680e59fe39a9b | Python | 232 | 14 |
def compute_CI(nums):
avg = sum(nums) / len(nums)
print(avg)
s = 0
for i in nums:
s += (i - avg) * (i - avg)
s /= (len(nums) - 1)
s = s ** 0.5
e = (1.96 * s) / (len(nums) ** 0.5)
print("CI: ", avg, " + ", e)
|
6b1f4f1f1c0d671ed45fa3c0c06dd6084dca1c581776cb377878614587693e8e | Python | 232 | 12 | from __future__ import annotations
def _to_int(s: str) -> int | str:
try:
return int(s)
except ValueError:
return s
__version__ = "2.13.1"
version_info = tuple(_to_int(s) for s in __version__.split("."))
|
84e5aa5af2827f998db452252ae293f91f2e756c4c2088e70d49a30827e2ed08 | Python | 232 | 8 | """Define logger and its format."""
import logging
FORMAT = "[%(asctime)-15s %(filename)s:%(lineno)d %(funcName)s] %(message)s"
logging.basicConfig(format=FORMAT)
logger = logging.getLogger(__name__)
logger.setLevel(logging.INFO)
|
15cc8c697e16807a5fd8955fd5f650bac6f5b7ed930b2e06acc358ea9c66d685 | Python | 233 | 9 | """
Framework for Easily Invertible Architectures.
Module to construct invertible networks with pytorch, based on a graph
structure of operations.
"""
from . import framework
from . import modules
__all__ = ["framework", "modules"]
|
39f173452b4906d0ba7371e4c21947be7c7156d06825ec058364fd3fa4b0de49 | Python | 233 | 5 | import flash_attn_interface as _flash_attn_interface
from flash_attn_interface import * # noqa: F403
_flash_attn_forward = _flash_attn_interface._flash_attn_forward
_flash_attn_backward = _flash_attn_interface._flash_attn_backward
|
3234680fa175ccdc091260d7766745c88c7bd7b56344433620b4af8e00043b02 | Python | 234 | 8 | from __future__ import annotations
import pytest
@pytest.fixture(autouse=True)
def _isolated_portal_config_dir(tmp_path, monkeypatch) -> None:
monkeypatch.setenv("LARVAWORLD_PORTAL_CONFIG_DIR", str(tmp_path / "portal-config"))
|
9fb6b079973593b8cdb67900851c22bedfc0e41cb572739349d4246270fc2485 | Python | 234 | 8 | import torch
from torchsummary import summary
model_path_old = '/home/obanmarcos/Balseiro/DeepOPT/SavedModels/KFolding_PSNR_MODL_Test71K_8_lam_0.05_nlay_8_proj_72__Kfold0.pth'
model = torch.load(model_path_old)
print(model.keys()) |
ff0f29876e7a829cd44c1983a67738a5066f57e6bf19c9d4b1f6441c528194c5 | Python | 234 | 5 | from .target_generators import HeatmapGenerator
from .target_generators import JointsGenerator
from .target_generators import ScaleAwareHeatmapGenerator
__all__ = ['HeatmapGenerator', 'ScaleAwareHeatmapGenerator', 'JointsGenerator']
|
4cc066da99fbdd0397b51afd3e68428fb60cfdc7e2581ee17b6c663b0cb9a752 | Python | 235 | 5 | from .interpolation_dl import deep_intepretation
from .interpolation_gp import gp_interpolation
from .interpolation_sparseVFC import kernel_interpolation
from .interpolation_vtk import vtk_interpolation
from .utils import get_X_Y_grid
|
a3b1092d47fed1c16634587272df597bfdf182c4cfe12ad607867d1dd38cd523 | Python | 235 | 10 | '''Figure package
This package is a part of BdPy.
'''
from .fig import *
from .tile_images import tile_images
from .draw_group_image_set import draw_group_image_set
from .makeplots import makeplots
from .makeplots2 import makeplots2
|
664adec191eeea3f39b7111fbc841a515cbaf18f0980bbde174b07c06e85bf7e | Python | 236 | 5 | from .core import MUASpikeManager as FusedOrgSpikes
from .core import CaSpikeManager as FusedOrgCa
from .utils import (load_df, save_fig, save_df)
from .plots import (plot_pairs, plot_pairs_drugapp, rasterplot_inlet, rasterplot_drugs)
|
71fe9e213089de217c2443f50408ff665bb89fb311dac285dad9004f95462061 | Python | 236 | 8 | from PysamTestModule_link_pre_489 import build_read
class TestModule:
def test_pass_if_module_can_be_called(self):
read = build_read()
assert read.query_name == "hello"
assert read.query_sequence == "ACGT"
|
c3974bf74260917fc29b6f48729674b6dd770dd85c3b9e5a36be96426fb76293 | Python | 236 | 9 | from distutils.core import setup
setup(name='mData',
version='1.0',
description='A package for multi-input graph data',
author='Kieran NP',
author_email='nehilkieran@gmail.com',
packages=['mData'],
)
|
c794fb4218b59fa0cb81df9d2c86901e66c6deda38e49ea5d61583b20d24ba74 | Python | 236 | 6 | __all__ = ['recording','volume','load_frames_legacy','redToGreen','genRedToGreen']
from .recording import recording
from ._legacy_c import load_frames_legacy
from .volume import volume
from .redtogreen import redToGreen, genRedToGreen
|
0c256194ec139325ceadd7d6427fc1dc78738455c8fb45c0a9998ca0bdc0e8fc | Python | 237 | 9 | import sys
from typing import TYPE_CHECKING
if TYPE_CHECKING:
from ._axis import Axis
else:
from _plotly_utils.importers import relative_import
__all__, __getattr__, __dir__ = relative_import(__name__, [], ["._axis.Axis"])
|
c7a0084371df213a19914a86428d7f2e7dc5c6f16cf6a6c513654dc528251010 | Python | 237 | 9 | import sys
from typing import TYPE_CHECKING
if TYPE_CHECKING:
from ._line import Line
else:
from _plotly_utils.importers import relative_import
__all__, __getattr__, __dir__ = relative_import(__name__, [], ["._line.Line"])
|
d03283342bd77a1ed0b101b79f2f60b2b61377efe1e37f233429c45f65c9edfb | Python | 237 | 9 | import json
import requests
webhook_url = ''
def send_message(text: str):
headers = {'Content-Type': 'application/json'}
payload = json.dumps({'content': text})
requests.post(url=webhook_url, data=payload, headers=headers)
|
d802f1b62338d01b31f4c3bf70fc8519762598fb5bd80c7e4633974df3b36aae | Python | 237 | 9 | import sys
from typing import TYPE_CHECKING
if TYPE_CHECKING:
from ._font import Font
else:
from _plotly_utils.importers import relative_import
__all__, __getattr__, __dir__ = relative_import(__name__, [], ["._font.Font"])
|
19d573b1055a5f589196602085aa4812ef8f95664a77730b691b43b751bab809 | Python | 238 | 10 | from celery.worker import state
class test_revoked:
def test_is_working(self):
state.revoked.add('foo')
assert 'foo' in state.revoked
state.revoked.pop_value('foo')
assert 'foo' not in state.revoked
|
5cf89940c6e044cb40ff9a526559185931a5c44011d1012fa3250c65c04d57ba | Python | 238 | 11 | """Data transforms"""
from __future__ import absolute_import
from . import bbox
from . import image
from . import experimental
from . import mask
from . import presets
from .block import RandomCrop
from . import pose
from . import video
|
84da7211ea4210937a83484791d1760cbcdf8ac0d404d91367c9b25b3afd383e | Python | 239 | 8 | from PysamTestModule_link_with_rpath import build_read
class TestModule:
def test_pass_if_module_can_be_called(self):
read = build_read()
assert read.query_name == "hello"
assert read.query_sequence == "ACGT"
|
c0a62a7d73aaa386a558ab057795d8f772fd0ec85e2d42733a5b1e6504c7a635 | Python | 239 | 14 | from sys import argv
from msp import MSP
from msp_donorlike import setup_as_adjusted_acceptor, train_in_parallel
msp = MSP()
msp.file = __file__
msp.seed = int(argv[1])
setup_as_adjusted_acceptor(msp)
train_in_parallel(msp)
msp.run()
|
04f51ce19d7f37c74e89ff8be1c2e44202caf16b60a81a5c058c436d646d1226 | Python | 240 | 9 | def render_cell_line(line):
if isinstance(line, str):
return line
raise RuntimeError(f"Unknown cell line: {line}")
def render_cell_lines(lines):
lines = [render_cell_line(x) for x in lines]
return ", ".join(lines)
|
74a15935735aa72aba968ec4c09d2637344aa2f4aba41107389429d394bf0a98 | Python | 240 | 9 | #!/usr/bin/env python
# This is a shim to allow GitHub to detect the package, build is done with poetry
# Taken from https://github.com/Textualize/rich
import setuptools
if __name__ == "__main__":
setuptools.setup(name="larvaworld")
|
9a384ebb014af1ac9c8f2ab708cd56aa84ab2943d390aedcf838ccbf2fcc0b8f | Python | 240 | 6 | from .boxes import Boxes, BoxMode, pairwise_iou
from .instances import Instances
from .masks import BitMasks, PolygonMasks, polygons_to_bitmask
from .image_list import ImageList
from .keypoints import Keypoints
from .beziers import Beziers
|
cf46c2d5ee54cad049210321ca48fe37a1832de1c0e6eccb554c85ac9c768df8 | Python | 240 | 10 | import torch
from lightly.transforms import GaussianMixtureMask
def test() -> None:
transform = GaussianMixtureMask(20, (10, 15))
image = torch.rand(3, 32, 17)
output = transform(image)
assert output.shape == image.shape
|
73e4a0f5b8383dee66f3ce50930757af84f5c8c7cb8ed09195d20bc3db89718a | Python | 241 | 11 | import tensorflow as tf
# https://www.tensorflow.org/guide/autodiff
x = tf.Variable(tf.complex([2., 2.], [2., 2.]))
with tf.GradientTape() as tape:
y = tf.abs(tf.reduce_sum(x))**2
print(y)
dy_dx = tape.gradient(y, x)
print(dy_dx)
|
dbf1b631b77d72860b7adb16542305ccba88e868248e07d9b52ccb1cbfc3d53b | Python | 241 | 9 | import sys
from typing import TYPE_CHECKING
if TYPE_CHECKING:
from ._yaxis import YAxis
else:
from _plotly_utils.importers import relative_import
__all__, __getattr__, __dir__ = relative_import(__name__, [], ["._yaxis.YAxis"])
|
e7db2bfa9164628f0c2f57b9f2efef1943020ba8c90b9f5356695fc6e0cc4f9c | Python | 241 | 6 | from .bbs import alpha_shape, get_concave_hull
from .bgi import read_bgi, read_bgi_agg
from .image import read_image
from .nanostring import read_nanostring
from .slideseq import read_slideseq
from .tenx import read_10x, read_10x_as_anndata
|
8d1fd7b55ffb468f89d9eb4c862eea18a9884659b23b30275f009aedf1d87ba5 | Python | 242 | 8 | from PysamTestModule_link_without_rpath import build_read
class TestModule:
def test_pass_if_module_can_be_called(self):
read = build_read()
assert read.query_name == "hello"
assert read.query_sequence == "ACGT"
|
ae75b45c544cb60743dfc9f26c7467b77d6ab725be49b38b0d2731fd7bab6d54 | Python | 242 | 6 | class Location:
# geocoder has no type hints, so this class represents the "location" object
def __init__(self, ok: bool, address: str, country: str):
self.ok = ok
self.address = address
self.country = country
|
ef2a8f6a7e8139c23a357588f5d6a155f4d21e4f9edd757153336892a445772b | Python | 243 | 9 | from .clip import interactive_box_clip, interactive_rectangle_clip
from .pick import (
interactive_pick,
overlap_mesh_pick,
overlap_pc_pick,
overlap_pick,
three_d_pick,
)
from .slice import interactive_slice, three_d_slice
|
2790ce3d58262fc8940a42435fee3bf43eb24226a61525314f14f235f1a84be3 | Python | 245 | 15 | import numpy as np
from neuron import h, gui
from neuron.units import ms
nseg = 1
s = h.Section()
s.insert("constant_mod")
expected = 2.3
assert s(0.5).constant_mod.foo() == expected
h.stdinit()
assert s(0.5).constant_mod.foo() == expected
|
30f876ef2788c9ac1c25a54499c36f0fa4370e2cc0891acec1bfd8e0781e6cfc | Python | 245 | 9 | import sys
from typing import TYPE_CHECKING
if TYPE_CHECKING:
from ._domain import Domain
else:
from _plotly_utils.importers import relative_import
__all__, __getattr__, __dir__ = relative_import(__name__, [], ["._domain.Domain"])
|
75effe75113c944c4508133f9e55a8e05905f3a295f5df4e07bde841103c3d85 | Python | 245 | 6 | """
Embedding and encoder layers.
"""
from tfep.nn.embeddings.radial import GaussianBasisExpansion, BehlerParrinelloRadialExpansion
from tfep.nn.embeddings.mafembed import MAFEmbedding, PeriodicEmbedding, FlipInvariantEmbedding, MixedEmbedding
|
88337bc62a332ffe9f8e8d34de3748bfe5d91fbfff6be0b627d8dba7daf1b7f9 | Python | 245 | 5 | """Top level of GFF parsing providing shortcuts for useful classes.
"""
from GFFOutput import GFF3Writer, write # noqa F401
from GFFParser import (DiscoGFFParser, GFFExaminer, GFFParser, # noqa F401
parse, parse_simple)
|
8834d858ef7e0c8b67dfcab9f058687b3a453a12c656e486e43fb27b2e8465b8 | Python | 245 | 6 | from .accumulators import GradientAccumulateModel
from .accumulators import GradientAccumulateOptimizer
from .agc import adaptive_clip_grad
from .agc import compute_norm
from .agc import unitwise_norm
from .layers import AccumBatchNormalization
|
892d5bd80b5be3d693986f83a231ae5bcf9cdddbd130b85a18fe8be8e1e820be | Python | 245 | 5 | # -*- coding: utf-8 -*-
# Copyright (c) 2016-2018 Braintech Sp. z o.o. [Ltd.] <http://www.braintech.pl>
# All rights reserved.
"""Package providing utils for utils for reading and writing signal data,and data info and data taga, and blinks."""
|
b4fee6b29dc3a317dc2fb75c9d68b55db42d079d736130d3ddf860f809a476b3 | Python | 245 | 9 | import sys
from typing import TYPE_CHECKING
if TYPE_CHECKING:
from ._marker import Marker
else:
from _plotly_utils.importers import relative_import
__all__, __getattr__, __dir__ = relative_import(__name__, [], ["._marker.Marker"])
|
ca378350498641193f96013e8c0dadd85d21c1d3170228d788519224468da016 | Python | 245 | 10 | import sys
import os
import glob
import pandas as pd
os.chdir(sys.argv[1])
all_filenames = sorted([i for i in glob.glob('*.csv')])
combined_csv = pd.concat([pd.read_csv(f) for f in all_filenames])
combined_csv.to_csv(sys.argv[2], index=False)
|
0d9bcd6be6e9b2cfb363a6645fe2949f09498687492ff14abeff1dbc43d63e07 | Python | 246 | 13 | """BdPy statistics package.
This package is a part of BdPy.
Functions:
- `corrcoef` : Returns correlation coefficient between `x` and `y`
- `corrmat` : Returns correlation matrix between `x` and `y`
"""
from .corr import corrcoef, corrmat
|
65466779b4c2fb5a24389e72310baa0d560d4791663f09e467eb0735047aed5f | Python | 247 | 13 | # -*- coding: utf-8 -*-
# @Author: gviejo
# @Date: 2022-01-17 15:39:19
# @Last Modified by: gviejo
# @Last Modified time: 2022-01-17 15:39:54
import numpy as np
import pynapple as nap
import pandas as pd
from itertools import combinations
|
c19c189f328a155e15f14e03be53fd74f95018c45fa79390fa13a0c2352060ca | Python | 247 | 7 | """"Simulation sub-module."""
# Link the Sim Params object into `sim`, so it can be imported from here
from specparam.data import SimParams
from .sim import sim_power_spectrum, sim_group_power_spectra, sim_spectrogram
from .gen import gen_freqs
|
4fce4355f3b0225f12c0aa6297645ad985b99499c6811f3f2b3586b6f5baeb31 | Python | 248 | 6 | # -*- coding: utf-8 -*-
# @Author : Yue Liu
# @Email : yueliu19990731@163.com
# @Time : 2022/9/21 20:52
from .augmentation import diffusion_adj, drop_edge, add_edge, mask_feat
__all__ = ['diffusion_adj', 'drop_edge', 'add_edge', 'mask_feat']
|
65a8924876a3229e052ae76b6d71ea153746853cebca5e3b06b97d1333b90422 | Python | 248 | 12 | from neuron import h, gui
def test_nothing():
x = 15.0
assert h.forty_two_plus_x(x) == 42.0 + x
assert h.twice_forty_two_plus_x(x) == 2.0 * (42.0 + x)
assert h.forty_three() == 43.0
if __name__ == "__main__":
test_nothing()
|
d74a6db2964c05f7ea1d2afda83a95fb31df053d2207a009fd5d32bd513634f6 | Python | 248 | 11 | #!/usr/bin/env python
import os
import sys
if __name__ == '__main__':
os.environ.setdefault('DJANGO_SETTINGS_MODULE', 'proj.settings')
from django.core.management import execute_from_command_line
execute_from_command_line(sys.argv)
|
02ec269b0d8ca58c6f6b5bed79a82ec9fd16c52f49dab2016e8c8357b8bb4820 | Python | 249 | 9 | import sys
from typing import TYPE_CHECKING
if TYPE_CHECKING:
from ._project import Project
else:
from _plotly_utils.importers import relative_import
__all__, __getattr__, __dir__ = relative_import(__name__, [], ["._project.Project"])
|
440061297b086eed54546dfb51a6a44e6ec1c6375237d337c157bf2cacb2cdb0 | Python | 249 | 11 | import subprocess
import sys
if len(sys.argv) > 1:
s = int(sys.argv[1])
else:
s = 287318
e = s + 30900
for j in list(range(s, e+1)) + list(range(e, s+1)):
print("scancel " + str(j))
subprocess.call("scancel " + str(j), shell=True)
|
5c015fe1e4901280e9756ee4b9480fd993b03569271a7dfb101c803b8a93fe44 | Python | 249 | 17 | NanoDeep = {
'kernel_length' : 5,
'class_num' : 2,
'kernal_num' : 32
}
SquiggleNet = {
'layers' : [2,2,2,2],
'num_classes' : 2
}
DeepSelectNet = {
'input_shape' : [1,1,5000],
'nb_classes' : 2,
'is_train' : False
}
|
f5cd5785a8a93381135eaf66961572c6cbdc17550baa6bb4c6bc0c21cc05e1c4 | Python | 249 | 21 | from xyzzy import plugh # noqa
from celery import Celery, shared_task
app = Celery()
@app.task
def bar():
"""Task.
This is a sample Task.
"""
@shared_task
def baz():
"""Shared Task.
This is a sample Shared Task.
"""
|
9d2df758ad22d89d658493374c89c47807cc7dd41f13d9816d2925219fe9c23b | Python | 250 | 10 | import ijson
import pandas as pd
def load_json_into_pandas_dataframe(filename):
with open(filename, "r") as f:
objects = ijson.items(f, "")
dico_content = next(objects)
df = pd.DataFrame.from_dict(dico_content)
return df |
cd3ca38d260f8b132f5f9d4330724f8de34bc7607c2ffe800b7a1073ced3b0ad | Python | 250 | 14 | import numpy as np
from neuron import h, gui
from neuron.units import ms
s = h.Section()
s.insert("no_suffix")
pp = h.point_suffix(s(0.5))
h.stdinit()
assert s(0.25).no_suffix.x == 42.0, f"{s(0.25).no_suffix.x=}"
assert pp.x == 42.0, f"{pp.x=}"
|
fe5283ec0580db1e2e18f4d564bdf36d85fbe51f248890edc002bb680be5cc58 | Python | 250 | 10 | import abc
from uuid import UUID
from carbonserver.api import schemas_telemetry
class Telemetry(abc.ABC):
@abc.abstractmethod
def add_telemetry(self, telemetry: schemas_telemetry.TelemetryCreate) -> UUID:
raise NotImplementedError
|
0106389748390c88d6d811dd9b1b3761df8d37564cce31835420c97101485dfe | Python | 251 | 9 | from sys import argv
from msp import MSP
msp = MSP()
msp.file = __file__
msp.seed = int(argv[1])
msp.extra_params += " --learned-motif-sparsity-drop-motif-frequency 0.87"
msp.extra_params += " --learned-motif-sparsity-threshold-initial 90"
msp.run()
|
10993faf6ec61e8ac57f175f9f0c56c82502fa4090f372e3a30908a1a9b0ebb1 | Python | 251 | 13 | from sys import argv
from msp import MSP
msp = MSP()
msp.file = __file__
msp.batch_size = msp.batch_size * 2 // 3
msp.seed = int(argv[1])
msp.lr = float(msp.lr) * 0.9 ** 16 * 2 / 3
msp.acc_thresh = 100
msp.n_epochs = 10
msp.run_binarizer(0.178e-2)
|
34fd18e1478b9f41c6d40ec52ac1ed09eaf4d7b29fb39956d2b78709988ac8e0 | Python | 251 | 10 | def pytest_addoption(parser):
"""
add `--show-viewer` as a valid command line flag
"""
parser.addoption(
"--show-viewer",
action="store_true",
default=False,
help="don't show viewer during tests",
)
|
8c1022363d1276c8b53cfcb1604a9ddeb7c079dbcd057ca7048c01d04c9d5f8f | Python | 252 | 10 | from sys import argv
from msp import MSP
msp = MSP()
msp.file = __file__
msp.batch_size = msp.batch_size * 2 // 3
msp.seed = int(argv[1])
msp.lr = float(msp.lr) * 0.9 ** 16 * 2 / 3
msp.n_epochs = 1
msp.run_binarizer_with_target_num_motifs_dropped(39)
|
2408305ed0f364b49e7e16cd884d44198b5e34132b381e0eff93cf88db418342 | Python | 253 | 12 | #!/usr/bin/env python
'''
Output the parameters that makemodel supports with their ranges
'''
import makemodel, argparse
#extract from arguments to makemodel
opts = makemodel.getoptions()
for (name,vals) in sorted(opts.items()):
print(name,vals)
|
b0788c54359fef03df8101c7f6851600cf72f4e02045fabaffbdb7bfd072164a | Python | 253 | 9 | from distutils.core import setup
setup(
name='OscopeBootstrap',
version='0.1dev',
packages=['OscopeBootstrap',],
license='Creative Commons Attribution-Noncommercial-Share Alike license',
long_description=open('README.md').read(),
)
|
404d359b035733ce6aa1a50c6a82d0a2d007bfe78a0d2f3435dff8065ab35b8e | Python | 255 | 13 | import os
import sys
sys.path.insert(0, os.getcwd())
# ## Note: Start worker with -P gevent,
# do not use the worker_pool option.
broker_url = 'amqp://guest:guest@localhost:5672//'
result_backend = 'amqp'
result_expires = 30 * 60
imports = ('tasks',)
|
c532b5a9ff9d209a268c3c122d7ad82fa9d470dc28d75f18c4dedbffa828cda9 | Python | 255 | 6 | """data module"""
from sknetwork.data.base import *
from sknetwork.data.load import *
from sknetwork.data.models import *
from sknetwork.data.parse import from_edge_list, from_adjacency_list, from_csv, from_graphml
from sknetwork.data.toy_graphs import *
|
87622ebc37bcfe87d81be1437e4b97a4c2a8341eb3df38461dd37a0b89db07d3 | Python | 256 | 9 | from flask import Flask
app = Flask(__name__)
app.config["DEBUG"] = True
from blueprintapp.apps.admin import admin # noqa: E402
from blueprintapp.apps.frontend import frontend # noqa: E402
app.register_blueprint(admin)
app.register_blueprint(frontend)
|
acc98e05d8da7f45656caf1a8b8f1d368d9f6163181048570edd39df8607ebef | Python | 256 | 11 | import numpy as np
def convert_img(img):
"""Converts (H, W, C) numpy.ndarray to (C, W, H) format
"""
if len(img.shape) == 3:
img = img.transpose(2, 0, 1)
if len(img.shape) == 2:
img = np.expand_dims(img, 0)
return img
|
e01445ba7440cd2f0174ac3f05363f430b0d895c3b259434752ff4e26d0681db | Python | 256 | 14 | """
R objects with fixed values.
"""
import rpy2.rinterface as rinterface
_reval = rinterface.baseenv['eval']
# NULL
NULL = _reval(rinterface.parse("NULL"))
# TRUE/FALSE
TRUE = _reval(rinterface.parse("TRUE"))
FALSE = _reval(rinterface.parse("FALSE"))
|
4a8d086fa0629265942e7564e5840c2423687bfc1c6ec5b6fb5790457f50ce30 | Python | 257 | 7 | from .build import FLIP_CONFIG
from .build import build_transforms
from .transforms import Compose
from .transforms import Normalize
from .transforms import RandomAffineTransform
from .transforms import RandomHorizontalFlip
from .transforms import ToTensor
|
7f2edcc685d70be8681fe6351009195b95bb7597730cd929feab8092124b9cab | Python | 257 | 9 | """Multimodal omics analysis framework."""
from mudata import MuData
from mudata._core.io import * # noqa: F403
from . import atac, pl, pp, prot, tl, utils
from ._version import __version__
from .config import set_options
from .io import * # noqa: F403
|
d3d2cbefa6a56d2445648b04848ec97816962da19880fb09a0e49871c26571c1 | Python | 257 | 9 | import gym
def has_wrapper(wrapped_env: gym.Env, wrapper_type: type) -> bool:
while isinstance(wrapped_env, gym.Wrapper):
if isinstance(wrapped_env, wrapper_type):
return True
wrapped_env = wrapped_env.env
return False
|
2ec0fb40b465c1ea46ace7e392ae1fd6e02fbb3ab917ca511c0ace4647f10692 | Python | 258 | 4 | from .metrics._binary_classification import median_calc, auc_calc, escore
from ._evaluate import evaluate_model
from ._predict import predictions, predictions_sequence_module
from ._predict import train_val_predictions, train_val_predictions_sequence_module
|
64c6531bcf41a89efd9ac7522af0a8a6fcb7fa7a26b6120fef62c76268ac44be | Python | 258 | 10 | import torch
import torch.nn.functional as F
def soft_cross_entropy(input, target, reduction='mean'):
nll = -F.log_softmax(input, dim=1)
bsz = input.shape[0]
loss = torch.sum(torch.mul(nll, target))
if reduction == 'mean':
loss = loss/bsz
return loss |
b0a6a0355bd32ef57fe7220ef681c5f2e168f66e393e97051065d68b9ac607cb | Python | 258 | 13 |
from torch.utils import data
import numpy as np
class Dataset(data.Dataset):
def __init__(self, data):
self.data = data
def __len__(self):
return len(self.data)
def __getitem__(self, get_idx):
return self.data[get_idx] |
51fb0301ae13cc7c0a24fce24b647781370f474cd9289e91dc59981f467c0bf5 | Python | 259 | 11 | ## Ensemble structure
from array import array
from cmath import exp
from typing import List
import numpy as np
from .ensemble import ensemble
from .utils import split
from .utils import split_n
from .utils import split_n_fold_cv
from .utils import aggregate
|
542f6068dedaa690b5b17514806b3333051b228e79b161952c3c43175964b32a | Python | 259 | 14 | import json
import pytest
@pytest.mark.first
def test_api(client):
response = client.get('/api/swagger.json')
assert response is not None
data = json.loads(response.data)
endpoints = data.get('paths').keys()
assert len(endpoints) > 0
|
c1579d8e56a8653e823e1d7dc26052b90ee76da9d2c3dee63502757292df6c5e | Python | 259 | 5 | from . import make_null_distributions
from . import make_metamers_wsj400_behavior_only_save_metamer_layers
from . import make_metamers_imagenet_16_category_val_400_only_save_metamer_layers
from . import eval_natural_imagenet
from . import eval_natural_jsinv3
|
116b38680f9b09db2d7fa2599cadb85e90f34bd2c194e633a9d3d17d22476192 | Python | 261 | 16 | __author__ = 'quentin'
import cv2
video = cv2.VideoCapture("http://129.31.135.35:8080/")
while True:
ret,a = video.read()
if a is not None:
print(ret, a.shape)
else:
print("None")
# cv2.imshow("test",a)
# cv2.waitKey(1)
|
469a14a00177e64a110fade415985b82ea4e9b00e315747b68898dcc08063454 | Python | 261 | 10 | import torch
class Checkpoint():
def __init__(self,optim):
self.optim=optim
def __call__(self,model,checkfile):
state = {'reannparam': model.state_dict(), 'optimizer': self.optim.state_dict()}
torch.save(state, checkfile)
|
31079a3753eb595b86f39ad00639b72e5695ce9cf36486bf9914174d2e17c1e2 | Python | 263 | 12 | from .io import read_model, save_model
from .label_utils import add_model_labels
from .model_utils import (
center_to_zero,
collect_models,
merge_models,
multiblock2model,
rotate_model,
scale_model,
split_model,
translate_model,
)
|
66d28f0a0e244cfbab6a31139a21481453cfa11fe6d3772c5d2efcd73a151be6 | Python | 263 | 7 | import subprocess
models = ["resnet50", "resnet34", "resnet18", "vgg", "mnasnet", "densenet", "basic"]
for model in models:
subprocess.run(["python", "train.py", "/data2/cdcm",
model, "/data2/cdcm/models", "--epochs", "5",
"-v", "1", "--batched"] ) |
915ee8914a159269f8d65596c782417417e4c089662cb33c32a9413f5ae29982 | Python | 263 | 11 | __author__ = 'quentin'
from ethoscope.hardware_control.arduino_api import SleepDepriverInterface
import logging
logging.basicConfig(filename=('/tmp/%s.log' % __file__), level=logging.DEBUG)
sdi = SleepDepriverInterface()
for i in range(31):
sdi.deprive(i) |
d5a5c2853940d501690e0854d5be8a6178bd73a9fd82646663a4240ab4bac577 | Python | 263 | 13 | class Constants:
NUM_ARMS = "num_arms"
NUM_LEGS = "num_legs"
PERSON = "person"
ANIMAL_TYPE = "animal_type"
CAT = "cat"
DOG = "dog"
ANIMAL = "animal"
NAME = "name"
SURNAME = "surname"
WHISKERS = "whiskers"
TYPE = "type" |
6b1961df72b77bfa43f064b65ffc05d388330c1bf4793864d3c7b85ecd50713f | Python | 264 | 15 | from sys import argv
from msp import MSP
from msp_fly import fly_am
msp = MSP()
msp.file = __file__
msp.seed = int(argv[1])
fly_am(msp)
msp.architecture["final_processor_spec"]["bottleneck_spec"] = dict(
type="ConvolutionalBottleneck", width=5
)
msp.run()
|
06f4485f23270d757ed31d08542c6f51f376852a8611fe8e33e9e569cde594b7 | Python | 265 | 12 | #!/usr/bin/env python
import argparse
#import warnings
#warnings.filterwarnings('ignore')
from bioseq2seq.bin.train_utils import train_seq2seq, parse_train_args
if __name__ == "__main__":
args = parse_train_args()
train_seq2seq(args,tune=False)
|
1456ca47fc4fd01110665b6e9524d386b3cb44007b766e1e91ee69eab5bc3b86 | Python | 265 | 12 | from ourmodel.loss_transfer import TransferLoss
# from base.GRUGATE_ALL_HIDDEN import GRUGATE_ALL_HIDDEN
__all__ = [
'MLP',
'TransferNet',
'TransferLoss',
'BaseTrainer',
'Multitask',
'AdaRNN',
'GRUGATE_ALL_HIDDEN'
'MultitaskGRU',
]
|
3893f3f81fc951cb284ae0fd5f1bb49db0ed0f93ad28db41a507ed6c6c42dd1a | Python | 265 | 15 | from sys import argv
from msp import MSP
from msp_fly import fly_am
msp = MSP()
msp.file = __file__
msp.seed = int(argv[1])
fly_am(msp)
msp.architecture["final_processor_spec"]["bottleneck_spec"] = dict(
type="ConvolutionalBottleneck", width=65
)
msp.run()
|
cb302c968ef972ebc24fcc3d8452a7bd4f80be02c9128c06670b10a56a830917 | Python | 265 | 9 | from modular_splicing.eclip.trained_on_eclip.training_data import EclipMotifsDataset
EclipMotifsDataset(
path="dataset_train_all.h5",
path_annotation="dataset_intron_exon_annotations_train_all.h5",
shuffle=True,
seed=0,
mode=("from_5'", 50),
)
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.