max_stars_repo_path
stringlengths
4
245
max_stars_repo_name
stringlengths
7
115
max_stars_count
int64
101
368k
id
stringlengths
2
8
content
stringlengths
6
1.03M
pycell/prologue/native/set_.py
andybalaam/cell
118
15568
<reponame>andybalaam/cell<filename>pycell/prologue/native/set_.py def _do_set(env, name, value): if env.contains(name): env.set(name, value) elif env.parent is not None: _do_set(env.parent, name, value) else: raise Exception( "Attempted to set name '%s' but it does not e...
onnxruntime/python/tools/quantization/operators/qdq_base_operator.py
mszhanyi/onnxruntime
669
15589
<gh_stars>100-1000 import itertools from ..quant_utils import QuantizedValue, QuantizedValueType, attribute_to_kwarg, quantize_nparray from .base_operator import QuantOperatorBase class QDQOperatorBase: def __init__(self, onnx_quantizer, onnx_node): self.quantizer = onnx_quantizer self.node = onn...
tests/integration/testdata/buildcmd/PyLayerMake/layer.py
renanmontebelo/aws-sam-cli
2,959
15615
import numpy def layer_method(): return {"pi": "{0:.2f}".format(numpy.pi)}
test/test_i18n.py
timgates42/uliweb
202
15636
<gh_stars>100-1000 from uliweb.i18n import ugettext_lazy as _ def test_1(): """ >>> x = _('Hello') >>> print repr(x) ugettext_lazy('Hello') """ def test_1(): """ >>> x = _('Hello {0}') >>> print x.format('name') Hello name """
f5/bigip/tm/vcmp/test/unit/test_virtual_disk.py
nghia-tran/f5-common-python
272
15646
<reponame>nghia-tran/f5-common-python # Copyright 2017 F5 Networks Inc. # # 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/licenses/LICENSE-2.0 # # Unless required b...
datatest/main.py
ajhynes7/datatest
277
15657
"""Datatest main program""" import sys as _sys from unittest import TestProgram as _TestProgram from unittest import defaultTestLoader as _defaultTestLoader try: from unittest.signals import installHandler except ImportError: installHandler = None from datatest import DataTestRunner __unittest = True __datat...
observations/r/chest_sizes.py
hajime9652/observations
199
15666
<reponame>hajime9652/observations # -*- coding: utf-8 -*- from __future__ import absolute_import from __future__ import division from __future__ import print_function import csv import numpy as np import os import sys from observations.util import maybe_download_and_extract def chest_sizes(path): """Chest measure...
examples/parser_example.py
pibico/beacontools
139
15676
<gh_stars>100-1000 # -*- coding: utf-8 -*- from beacontools import parse_packet # Eddystone UID packet uid_packet = b"\x02\x01\x06\x03\x03\xaa\xfe\x17\x16\xaa\xfe\x00\xe3\x12\x34\x56\x78\x90\x12" \ b"\x34\x67\x89\x01\x00\x00\x00\x00\x00\x01\x00\x00" uid_frame = parse_packet(uid_packet) print("Namespace: ...
classification/train_classifier_tf.py
dnarqq/WildHack
402
15715
r"""Train an EfficientNet classifier. Currently implementation of multi-label multi-class classification is non-functional. During training, start tensorboard from within the classification/ directory: tensorboard --logdir run --bind_all --samples_per_plugin scalars=0,images=0 Example usage: python train_cla...
pybo/inits/__init__.py
hfukada/pybo
115
15722
<gh_stars>100-1000 """ Initialization methods. """ # pylint: disable=wildcard-import from .methods import * from . import methods __all__ = [] __all__ += methods.__all__
setup.py
giampaolo/pysendfile
119
15731
#!/usr/bin/env python # ====================================================================== # This software is distributed under the MIT license reproduced below: # # Copyright (C) 2009-2014 <NAME>' <<EMAIL>> # # Permission to use, copy, modify, and distribute this software and # its documentation for any purp...
dynamic_rest/datastructures.py
reinert/dynamic-rest
690
15762
<gh_stars>100-1000 """This module contains custom data-structures.""" import six class TreeMap(dict): """Tree structure implemented with nested dictionaries.""" def get_paths(self): """Get all paths from the root to the leaves. For example, given a chain like `{'a':{'b':{'c':None}}}`, ...
lottery/branch/retrain.py
chenw23/open_lth
509
15764
# Copyright (c) Facebook, Inc. and its affiliates. # This source code is licensed under the MIT license found in the # LICENSE file in the root directory of this source tree. import datasets.registry from foundations import hparams from foundations.step import Step from lottery.branch import base import models.regist...
Algo and DSA/LeetCode-Solutions-master/Python/web-crawler.py
Sourav692/FAANG-Interview-Preparation
3,269
15769
# Time: O(|V| + |E|) # Space: O(|V|) # """ # This is HtmlParser's API interface. # You should not implement it, or speculate about its implementation # """ class HtmlParser(object): def getUrls(self, url): """ :type url: str :rtype List[str] """ pass class Solution(object): ...
settings.py
ArneBinder/Pytorch-LRP
117
15806
<gh_stars>100-1000 """ Settings for re-running the experiments from the paper "Layer-wise relevance propagation for explaining deep neural network decisions in MRI-based Alzheimer’s disease classification". Please note that you need to download the ADNI data from http://adni.loni.usc.edu/ and preprocess it using htt...
src/tools/nuscenes-devkit/prediction/tests/test_mtp_loss.py
jie311/TraDeS
475
15842
import math import unittest import torch from nuscenes.prediction.models import mtp class TestMTPLoss(unittest.TestCase): """ Test each component of MTPLoss as well as the __call__ method. """ def test_get_trajectories_and_modes(self): loss_n_modes_5 = mtp.MTPLoss(5, 0, 0) los...
Engine/Shaders/compile_all_shader.py
ValtoGameEngines/Fish-Engine
240
15845
<reponame>ValtoGameEngines/Fish-Engine import os import sys compiler = r'../Binary/RelWithDebInfo/ShaderCompiler' #compiler = r'../Binary/Debug/ShaderCompiler' shader_dirs = ['.', './Editor'] count = 0 for d in shader_dirs: for fn in os.listdir(d): print(fn) ext = fn.split('.')[-1] if ext in ['surf', 'shader'...
tf2onnx/optimizer/optimizer_base.py
gcunhase/tensorflow-onnx
1,473
15867
<reponame>gcunhase/tensorflow-onnx # SPDX-License-Identifier: Apache-2.0 """Graph Optimizer Base""" import copy from .. import logging, utils class GraphOptimizerBase(object): """optimizer graph to improve performance """ def __init__(self): self._logger = logging.getLogger('.'.join(__name__....
utils/builder/register_builder/riscv/BootPriority.py
noahsherrill/force-riscv
111
15887
# # Copyright (C) [2020] Futurewei Technologies, Inc. # # FORCE-RISCV is 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/licenses/LICENSE-2.0 # # THIS SOFTWARE IS PR...
tests/conftest.py
inducer/courseflow
284
15889
<filename>tests/conftest.py<gh_stars>100-1000 import pytest # from pytest_factoryboy import register def pytest_addoption(parser): parser.addoption( "--slow", action="store_true", default=False, help="run slow tests", ) parser.addoption( "--all", action="store_true", default=False, help="r...
examples/avatar_example.py
ZSD-tim/dayu_widgets
157
15897
#!/usr/bin/env python # -*- coding: utf-8 -*- ################################################################### # Author: <NAME> # Date : 2019.2 # Email : <EMAIL> ################################################################### from dayu_widgets.avatar import MAvatar from dayu_widgets.divider import MDivider fro...
Chapter02/Shuffle.py
Tanishadel/Mastering-Machine-Learning-for-Penetration-Testing
241
15906
<reponame>Tanishadel/Mastering-Machine-Learning-for-Penetration-Testing<filename>Chapter02/Shuffle.py import os import random #initiate a list called emails_list emails_list = [] Directory = '/home/azureuser/spam_filter/enron1/emails/' Dir_list = os.listdir(Directory) for file in Dir_list: f = open(Directory + file, 'r...
alipay/aop/api/domain/RequestExtShopItem.py
snowxmas/alipay-sdk-python-all
213
15918
<gh_stars>100-1000 #!/usr/bin/env python # -*- coding: utf-8 -*- import json from alipay.aop.api.constant.ParamConstants import * class RequestExtShopItem(object): def __init__(self): self._brand_code = None self._category_code = None self._description = None self._item_code = No...
rendering/viewer.py
MTKat/FloorplanTransformation
323
15932
from math import pi, sin, cos from panda3d.core import * from direct.showbase.ShowBase import ShowBase from direct.task import Task from floorplan import Floorplan import numpy as np import random import copy class Viewer(ShowBase): def __init__(self): ShowBase.__init__(self) #self.scene = self.loader.loadM...
common/kalman/simple_kalman_old.py
919bot/Tessa
114
15934
import numpy as np class KF1D: # this EKF assumes constant covariance matrix, so calculations are much simpler # the Kalman gain also needs to be precomputed using the control module def __init__(self, x0, A, C, K): self.x = x0 self.A = A self.C = C self.K = K self.A_K = self.A - np.dot(se...
boot/rpi/tools/patman/func_test.py
yodaos-project/yodaos
1,144
15936
<filename>boot/rpi/tools/patman/func_test.py # -*- coding: utf-8 -*- # SPDX-License-Identifier: GPL-2.0+ # # Copyright 2017 Google, Inc # import contextlib import os import re import shutil import sys import tempfile import unittest import gitutil import patchstream import settings @contextlib.contextmanager def ca...
checkov/common/comment/enum.py
antonblr/checkov
4,013
15941
import re COMMENT_REGEX = re.compile(r'(checkov:skip=|bridgecrew:skip=) *([A-Z_\d]+)(:[^\n]+)?')
moabb/analysis/__init__.py
plcrodrigues/moabb
321
15991
<filename>moabb/analysis/__init__.py import logging import os import platform from datetime import datetime from moabb.analysis import plotting as plt from moabb.analysis.meta_analysis import ( # noqa: E501 compute_dataset_statistics, find_significant_differences, ) from moabb.analysis.results import Results ...
tools/add_new_quantization_parameters.py
xiao1228/nncf
310
16000
""" Copyright (c) 2020 Intel Corporation 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/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writin...
examples/passage_ranking.py
skirdey/FARM
1,551
16018
# fmt: off import logging from pathlib import Path from farm.data_handler.data_silo import DataSilo from farm.data_handler.processor import RegressionProcessor, TextPairClassificationProcessor from farm.experiment import initialize_optimizer from farm.infer import Inferencer from farm.modeling.adaptive_model import Ad...
tests/ignite/distributed/comp_models/test_native.py
Eunjnnn/ignite
4,119
16022
import os import pytest import torch import torch.distributed as dist from ignite.distributed.comp_models import has_native_dist_support if not has_native_dist_support: pytest.skip("Skip if no native dist support", allow_module_level=True) else: from ignite.distributed.comp_models.native import _expand_hostl...
querybook/server/lib/query_executor/connection_string/hive.py
shivammmmm/querybook
1,144
16034
import re from typing import Dict, Tuple, List, NamedTuple, Optional from lib.utils.decorators import with_exception_retry from .helpers.common import ( split_hostport, get_parsed_variables, merge_hostport, random_choice, ) from .helpers.zookeeper import get_hostname_and_port_from_zk # TODO: make thes...
xmodaler/modeling/layers/attention_pooler.py
cclauss/xmodaler
830
16057
# Copyright 2021 JD.com, Inc., JD AI """ @author: <NAME> @contact: <EMAIL> """ import torch import torch.nn as nn __all__ = ["AttentionPooler"] class AttentionPooler(nn.Module): def __init__( self, *, hidden_size: int, output_size: int, dropout: float, use_bn: boo...
CalibTracker/SiStripCommon/python/theBigNtuple_cfi.py
ckamtsikis/cmssw
852
16093
<gh_stars>100-1000 import FWCore.ParameterSet.Config as cms from CalibTracker.SiStripCommon.ShallowEventDataProducer_cfi import * from CalibTracker.SiStripCommon.ShallowDigisProducer_cfi import * from CalibTracker.SiStripCommon.ShallowClustersProducer_cfi import * from CalibTracker.SiStripCommon.ShallowTrackClustersPr...
Chapter 07/hmac-md5.py
Prakshal2607/Effective-Python-Penetration-Testing
346
16148
import hmac hmac_md5 = hmac.new('secret-key') f = open('sample-file.txt', 'rb') try: while True: block = f.read(1024) if not block: break hmac_md5.update(block) finally: f.close() digest = hmac_md5.hexdigest() print digest
tests/strict/it_mod_double_fun.py
Euromance/pycopy
663
16166
import mod def foo(): return 1 try: mod.foo = foo except RuntimeError: print("RuntimeError1") print(mod.foo()) try: mod.foo = 1 except RuntimeError: print("RuntimeError2") print(mod.foo) try: mod.foo = 2 except RuntimeError: print("RuntimeError3") print(mod.foo) def __main__(): ...
src/pyforest/auto_import.py
tnwei/pyforest
1,002
16170
<gh_stars>1000+ from pathlib import Path IPYTHON_STARTUP_FOLDER = Path.home() / ".ipython" / "profile_default" / "startup" STARTUP_FILE = IPYTHON_STARTUP_FOLDER / "pyforest_autoimport.py" def _create_or_reset_startup_file(): if STARTUP_FILE.exists(): STARTUP_FILE.unlink() # deletes the old file ...
tests/future_division_eval.py
mayl8822/onelinerizer
1,062
16172
<filename>tests/future_division_eval.py from __future__ import division print eval('1/2') exec('print 1/2') eval(compile('print 1/2', 'wat.py', 'exec')) print eval(compile('1/2', 'wat.py', 'eval')) print eval(compile('1/2', 'wat.py', 'eval', 0, 0)) print eval(compile('1/2', 'wat.py', 'eval', 0, ~0))
BAMF_Detect/modules/dendroid.py
bwall/bamfdetect
152
16204
from common import Modules, data_strings, load_yara_rules, AndroidParseModule, ModuleMetadata from base64 import b64decode from string import printable class dendroid(AndroidParseModule): def __init__(self): md = ModuleMetadata( module_name="dendroid", bot_name="Dendroid", ...
examples/tensorboard/nested.py
dwolfschlaeger/guildai
694
16230
<filename>examples/tensorboard/nested.py import tensorboardX with tensorboardX.SummaryWriter("foo") as w: w.add_scalar("a", 1.0, 1) w.add_scalar("a", 2.0, 2) with tensorboardX.SummaryWriter("foo/bar") as w: w.add_scalar("a", 3.0, 3) w.add_scalar("a", 4.0, 4) with tensorboardX.SummaryWriter("foo/bar/b...
spaghetti/network.py
gegen07/spaghetti
182
16315
<gh_stars>100-1000 from collections import defaultdict, OrderedDict from itertools import islice import copy, os, pickle, warnings import esda import numpy from .analysis import GlobalAutoK from . import util from libpysal import cg, examples, weights from libpysal.common import requires try: from libpysal impor...
official/mnist/mnist.py
TuKJet/models
3,326
16319
<filename>official/mnist/mnist.py<gh_stars>1000+ # Copyright 2017 The TensorFlow Authors. All Rights Reserved. # # 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/...
test/test_tdodbc.py
Teradata/PyTd
133
16354
# The MIT License (MIT) # # Copyright (c) 2015 by Teradata # # Permission is hereby granted, free of charge, to any person obtaining a copy # of this software and associated documentation files (the "Software"), to deal # in the Software without restriction, including without limitation the rights # to use, copy, modif...
release/stubs.min/Autodesk/Revit/UI/Plumbing.py
htlcnn/ironpython-stubs
182
16357
<reponame>htlcnn/ironpython-stubs # encoding: utf-8 # module Autodesk.Revit.UI.Plumbing calls itself Plumbing # from RevitAPIUI,Version=172.16.58.3,Culture=neutral,PublicKeyToken=null # by generator 1.145 # no doc # no imports # no functions # classes class IPipeFittingAndAccessoryPressureDropUIServer(IExte...
package/kedro_viz/services/layers.py
pascalwhoop/kedro-viz
246
16368
<reponame>pascalwhoop/kedro-viz # Copyright 2021 QuantumBlack Visual Analytics Limited # # 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/licenses/LICENSE-2.0 # # T...
torchkit/head/localfc/curricularface.py
sarvex/TFace
764
16412
<gh_stars>100-1000 from __future__ import print_function from __future__ import division import torch import torch.nn as nn from torch.nn import Parameter import math from torchkit.util.utils import l2_norm from torchkit.head.localfc.common import calc_logits class CurricularFace(nn.Module): """ Implement of Curr...
test/functional/feature_uaclient.py
syedrizwanmy/bitcoin-abc
1,266
16421
#!/usr/bin/env python3 # Copyright (c) 2021 The Bitcoin developers # Distributed under the MIT software license, see the accompanying # file COPYING or http://www.opensource.org/licenses/mit-license.php. """Test the -uaclientname and -uaclientversion option.""" import re from test_framework.test_framework import Bitc...
apps/jobs/settings/config.py
rainydaygit/testtcloudserver
349
16439
<gh_stars>100-1000 try: from public_config import * except ImportError: pass HOST = '0.0.0.0' PORT = 9038 SERVICE_NAME = 'jobs' SERVER_ENV = 'prod' SQLALCHEMY_POOL_SIZE = 10 SQLALCHEMY_POOL_RECYCLE = 3600 JOBS = [ { # 任务 信用积分每日检查, 每周一到每周五 早上 10:30 分运行 # 检查每个设备的借用日期是否超时 :发送提醒邮件,扣除信用分 1分 ...
test/surrogate/test_sk_random_forest.py
Dee-Why/lite-bo
184
16528
<gh_stars>100-1000 from sklearn.ensemble import RandomForestRegressor from openbox.utils.config_space import ConfigurationSpace from openbox.utils.config_space import UniformFloatHyperparameter, \ CategoricalHyperparameter, Constant, UniformIntegerHyperparameter import numpy as np from openbox.utils.config_space.ut...
scripts/regression_tests.py
zhangxaochen/Opt
260
16534
from opt_utils import * import argparse parser = argparse.ArgumentParser() parser.add_argument("-s", "--skip_compilation", action='store_true', help="skip compilation") args = parser.parse_args() if not args.skip_compilation: compile_all_opt_examples() for example in all_examples: args = [] output = run_example(ex...
libs/blocks/tests/test_variable_filter.py
dendisuhubdy/attention-lvcsr
295
16570
<filename>libs/blocks/tests/test_variable_filter.py from nose.tools import raises from blocks.bricks import Bias, Linear, Logistic from blocks.bricks.parallel import Merge from blocks.filter import VariableFilter from blocks.graph import ComputationGraph from blocks.roles import BIAS, FILTER, PARAMETER, OUTPUT from t...
utils/models.py
miladalipour99/time_series_augmentation
140
16583
from tensorflow.keras.models import Model from tensorflow.keras.layers import Dense, Flatten, Dropout, Input from tensorflow.keras.layers import MaxPooling1D, Conv1D from tensorflow.keras.layers import LSTM, Bidirectional from tensorflow.keras.layers import BatchNormalization, GlobalAveragePooling1D, Permute, concatena...
lite/tests/unittest_py/pass/test_conv_elementwise_fuser_pass.py
714627034/Paddle-Lite
808
16600
<filename>lite/tests/unittest_py/pass/test_conv_elementwise_fuser_pass.py # Copyright (c) 2021 PaddlePaddle Authors. All Rights Reserved. # # 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 # # ...
.venv/lib/python3.8/site-packages/pandas/tests/indexes/timedeltas/test_shift.py
acrucetta/Chicago_COVI_WebApp
115
16627
import pytest from pandas.errors import NullFrequencyError import pandas as pd from pandas import TimedeltaIndex import pandas._testing as tm class TestTimedeltaIndexShift: # ------------------------------------------------------------- # TimedeltaIndex.shift is used by __add__/__sub__ def test_tdi_sh...
stolos/tests/test_bin.py
sailthru/stolos
121
16629
import os from subprocess import check_output, CalledProcessError from nose import tools as nt from stolos import queue_backend as qb from stolos.testing_tools import ( with_setup, validate_zero_queued_task, validate_one_queued_task, validate_n_queued_task ) def run(cmd, tasks_json_tmpfile, **kwargs): cm...
tests/test_api.py
bh-chaker/wetterdienst
155
16631
# -*- coding: utf-8 -*- # Copyright (c) 2018-2021, earthobservations developers. # Distributed under the MIT License. See LICENSE for more info. import pytest from wetterdienst import Wetterdienst @pytest.mark.remote @pytest.mark.parametrize( "provider,kind,kwargs", [ # German Weather Service (DWD) ...
crowd_anki/export/anki_exporter_wrapper.py
katrinleinweber/CrowdAnki
391
16633
from pathlib import Path from .anki_exporter import AnkiJsonExporter from ..anki.adapters.anki_deck import AnkiDeck from ..config.config_settings import ConfigSettings from ..utils import constants from ..utils.notifier import AnkiModalNotifier, Notifier from ..utils.disambiguate_uuids import disambiguate_note_model_u...
tests/bugs/test-200908181430.py
eLBati/pyxb
123
16684
# -*- coding: utf-8 -*- import logging if __name__ == '__main__': logging.basicConfig() _log = logging.getLogger(__name__) import pyxb.binding.generate import pyxb.binding.datatypes as xs import pyxb.binding.basis import pyxb.utils.domutils import os.path xsd='''<?xml version="1.0" encoding="UTF-8"?> <xs:schema xm...
utils/utils_fit.py
bubbliiiing/faster-rcnn-keras
282
16719
import numpy as np import tensorflow as tf from keras import backend as K from tqdm import tqdm def write_log(callback, names, logs, batch_no): for name, value in zip(names, logs): summary = tf.Summary() summary_value = summary.value.add() summary_value.simple_value = value ...
tools/pot/openvino/tools/pot/graph/gpu_patterns.py
ryanloney/openvino-1
1,127
16735
# Copyright (C) 2020-2022 Intel Corporation # SPDX-License-Identifier: Apache-2.0 from .pattern_utils import check_fused_scale_shift_patterns, get_fused_scale_shift_patterns, \ check_fused_op_const_patterns, get_fused_op_const_pattern, get_clamp_mult_const_pattern def get_gpu_ignored_patterns(): return { ...
genrl/environments/vec_env/utils.py
matrig/genrl
390
16756
from typing import Tuple import torch class RunningMeanStd: """ Utility Function to compute a running mean and variance calculator :param epsilon: Small number to prevent division by zero for calculations :param shape: Shape of the RMS object :type epsilon: float :type shape: Tuple """ ...
cointrader/config.py
3con/cointrader
103
16786
<gh_stars>100-1000 #!/usr/bin/env python # -*- coding: utf-8 -*- import sys import os import logging import logging.config if (sys.version_info > (3, 0)): # Python 3 code in this block import configparser else: # Python 2 code in this block import ConfigParser as configparser DEFAULT_CONFIG = ".cointra...
api-inference-community/docker_images/spacy/app/pipelines/text_classification.py
mlonaws/huggingface_hub
362
16792
<filename>api-inference-community/docker_images/spacy/app/pipelines/text_classification.py<gh_stars>100-1000 import os import subprocess import sys from typing import Dict, List from app.pipelines import Pipeline class TextClassificationPipeline(Pipeline): def __init__( self, model_id: str, )...
aws/logs_monitoring/tests/test_cloudtrail_s3.py
rkitron/datadog-serverless-functions
232
16793
<filename>aws/logs_monitoring/tests/test_cloudtrail_s3.py from unittest.mock import MagicMock, patch import os import sys import unittest import json import copy import io import gzip sys.modules["trace_forwarder.connection"] = MagicMock() sys.modules["datadog_lambda.wrapper"] = MagicMock() sys.modules["datadog_lambda...
symbols/block.py
zerofo/sdu-face-alignment
192
16796
from __future__ import absolute_import from __future__ import division from __future__ import print_function import mxnet as mx import numpy as np from config import config def Conv(**kwargs): body = mx.sym.Convolution(**kwargs) return body def Act(data, act_type, name): if act_type=='prelu': body...
metaflow/plugins/env_escape/configurations/test_lib_impl/test_lib.py
RobBlumberg/metaflow
5,821
16817
<filename>metaflow/plugins/env_escape/configurations/test_lib_impl/test_lib.py import functools class MyBaseException(Exception): pass class SomeException(MyBaseException): pass class TestClass1(object): cls_object = 25 def __init__(self, value): self._value = value self._value2 ...
src/saml2/extension/pefim.py
cnelson/pysaml2
5,079
16825
#!/usr/bin/env python import saml2 from saml2 import SamlBase from saml2.xmldsig import KeyInfo NAMESPACE = 'urn:net:eustix:names:tc:PEFIM:0.0:assertion' class SPCertEncType_(SamlBase): """The urn:net:eustix:names:tc:PEFIM:0.0:assertion:SPCertEncType element """ c_tag = 'SPCertEncType' c_namespace = NA...
scripts/tfloc_summary.py
lldelisle/bx-python
122
16827
<filename>scripts/tfloc_summary.py #!/usr/bin/env python """ Read TFLOC output from stdin and write out a summary in which the nth line contains the number of sites found in the nth alignment of the input. TODO: This is very special case, should it be here? """ import sys from collections import defaultdict counts ...
s3prl/upstream/example/hubconf.py
hhhaaahhhaa/s3prl
856
16833
from .expert import UpstreamExpert as _UpstreamExpert def customized_upstream(*args, **kwargs): """ To enable your customized pretrained model, you only need to implement upstream/example/expert.py and leave this file as is. This file is used to register the UpstreamExpert in upstream/example/expert.p...
pycsw/pycsw/plugins/profiles/profile.py
Geosoft2/Geosoftware-II-AALLH
118
16841
# -*- coding: utf-8 -*- # ================================================================= # # Authors: <NAME> <<EMAIL>> # <NAME> <<EMAIL>> # # Copyright (c) 2015 <NAME> # Copyright (c) 2015 <NAME> # # Permission is hereby granted, free of charge, to any person # obtaining a copy of this software and associat...
nngeometry/object/__init__.py
amyami187/nngeometry
103
16852
from .pspace import (PMatDense, PMatBlockDiag, PMatDiag, PMatLowRank, PMatImplicit, PMatKFAC, PMatEKFAC, PMatQuasiDiag) from .vector import (PVector, FVector) from .fspace import (FMatDense,) from .map import (PushForwardDense, PushForwardImplicit, PullBackDen...
endpoints/v2/errors.py
giuseppe/quay
2,027
16855
import bitmath class V2RegistryException(Exception): def __init__( self, error_code_str, message, detail, http_status_code=400, repository=None, scopes=None, is_read_only=False, ): super(V2RegistryException, self).__init__(message) ...
DeepBrainSeg/readers/nib.py
JasperHG90/DeepBrainSeg
130
16872
<reponame>JasperHG90/DeepBrainSeg #! /usr/bin/env python # -*- coding: utf-8 -*- # # author: <NAME> # contact: <EMAIL> # MIT License # Copyright (c) 2020 <NAME> # Permission is hereby granted, free of charge, to any person obtaining a copy # of this software and associated documentation files (the "Software"), to de...
terrascript/resource/ddelnano/mikrotik.py
mjuenema/python-terrascript
507
16884
<filename>terrascript/resource/ddelnano/mikrotik.py # terrascript/resource/ddelnano/mikrotik.py # Automatically generated by tools/makecode.py (24-Sep-2021 15:21:43 UTC) import terrascript class mikrotik_bgp_instance(terrascript.Resource): pass class mikrotik_bgp_peer(terrascript.Resource): pass class mik...
Codes/Liam/203_remove_linked_list_elements.py
liuxiaohui1221/algorithm
256
16886
<filename>Codes/Liam/203_remove_linked_list_elements.py # 执行用时 : 68 ms # 内存消耗 : 16.6 MB # 方案:哨兵结点 sentinel,插入在head结点之前 # Definition for singly-linked list. # class ListNode: # def __init__(self, x): # self.val = x # self.next = None class Solution: def removeElements(self, head: ListNode, va...
mopidy/audio/utils.py
grdorin/mopidy
6,700
16898
<filename>mopidy/audio/utils.py from mopidy import httpclient from mopidy.internal.gi import Gst def calculate_duration(num_samples, sample_rate): """Determine duration of samples using GStreamer helper for precise math.""" return Gst.util_uint64_scale(num_samples, Gst.SECOND, sample_rate) def create_bu...
turbinia/processors/archive_test.py
sa3eed3ed/turbinia
559
16903
<filename>turbinia/processors/archive_test.py # -*- coding: utf-8 -*- # Copyright 2019 Google Inc. # # 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/licenses/LICE...
app/pathfinding/finder/__init__.py
TheronHa/Spaghetti
208
16916
__all__ = ['a_star', 'best_first', 'bi_a_star', 'breadth_first', 'dijkstra', 'finder', 'ida_star']
tests/ut/python/nn/test_activation.py
PowerOlive/mindspore
3,200
16919
<filename>tests/ut/python/nn/test_activation.py # Copyright 2020 Huawei Technologies Co., Ltd # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # ...
leetcode/345.reverse-vowels-of-a-string.py
geemaple/algorithm
177
16947
class Solution(object): def reverseVowels(self, s): """ :type s: str :rtype: str """ vowels = set("aeiouAEIOU") s = list(s) i = 0 j = len(s) - 1 while i < j: while i < j and s[i] not in vowels: i +=...
nndet/evaluator/detection/__init__.py
joeranbosma/nnDetection
242
16958
<reponame>joeranbosma/nnDetection<gh_stars>100-1000 from nndet.evaluator.detection.froc import FROCMetric from nndet.evaluator.detection.coco import COCOMetric from nndet.evaluator.detection.hist import PredictionHistogram
tensorflow_transform/test_case_test.py
LaudateCorpus1/transform
970
16963
<gh_stars>100-1000 # Copyright 2017 Google Inc. All Rights Reserved. # # 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/licenses/LICENSE-2.0 # # Unless required by ...
test/hummingbot/core/utils/test_fixed_rate_source.py
BGTCapital/hummingbot
3,027
16966
<filename>test/hummingbot/core/utils/test_fixed_rate_source.py from decimal import Decimal from unittest import TestCase from hummingbot.core.utils.fixed_rate_source import FixedRateSource class FixedRateSourceTests(TestCase): def test_look_for_unconfigured_pair_rate(self): rate_source = FixedRateSource...
act_map/scripts/exp_compare_diff_maps.py
debugCVML/rpg_information_field
149
17019
<gh_stars>100-1000 #!/usr/bin/env python import os import argparse import yaml import numpy as np from colorama import init, Fore, Style from matplotlib import rc import matplotlib.pyplot as plt import plot_utils as pu init(autoreset=True) rc('font', **{'serif': ['Cardo'], 'size': 20}) rc('text', usetex=True) kMe...
poshc2/server/Tasks.py
slackr/PoshC2
1,504
17027
import datetime, hashlib, base64, traceback, os, re import poshc2.server.database.DB as DB from poshc2.Colours import Colours from poshc2.server.Config import ModulesDirectory, DownloadsDirectory, ReportsDirectory from poshc2.server.Implant import Implant from poshc2.server.Core import decrypt, encrypt, default_respon...
ryu/gui/views/topology.py
uiuc-srg/ryu
269
17033
# Copyright (C) 2013 Nippon Telegraph and Telephone Corporation. # # 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/licenses/LICENSE-2.0 # # Unless required by appli...
econml/solutions/causal_analysis/_causal_analysis.py
huigangchen/EconML
1,846
17041
<filename>econml/solutions/causal_analysis/_causal_analysis.py # Copyright (c) Microsoft Corporation. All rights reserved. # Licensed under the MIT License. """Module for assessing causal feature importance.""" import warnings from collections import OrderedDict, namedtuple import joblib import lightgbm as lgb from ...
examples/gan.py
maxferrari/Torchelie
117
17044
import argparse import copy import torch from torchvision.datasets import MNIST, CIFAR10 import torchvision.transforms as TF import torchelie as tch import torchelie.loss.gan.hinge as gan_loss from torchelie.recipes.gan import GANRecipe import torchelie.callbacks as tcb from torchelie.recipes import Recipe parser =...
manila/tests/api/views/test_quota_class_sets.py
openstack/manila
159
17092
<gh_stars>100-1000 # Copyright (c) 2017 Mirantis, Inc. # All Rights Reserved. # # 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/licenses/LICENSE-2.0 #...
phy/plot/interact.py
ycanerol/phy
118
17103
<filename>phy/plot/interact.py # -*- coding: utf-8 -*- """Common layouts.""" #------------------------------------------------------------------------------ # Imports #------------------------------------------------------------------------------ import logging import numpy as np from phylib.utils import emit from...
test/PySrc/tests/test_code_tracer_width.py
lifubang/live-py-plugin
224
17114
<gh_stars>100-1000 from space_tracer.main import replace_input, TraceRunner def test_source_width_positive(): code = """\ i = 1 + 1 """ expected_report = """\ i = 1 + | i = 2""" with replace_input(code): report = TraceRunner().trace_command(['space_tracer', ...
client.pyw
thatfuckingbird/hydrus-websocket-server
1,417
17135
<filename>client.pyw #!/usr/bin/env python3 # Hydrus is released under WTFPL # You just DO WHAT THE FUCK YOU WANT TO. # https://github.com/sirkris/WTFPL/blob/master/WTFPL.md from hydrus import hydrus_client if __name__ == '__main__': hydrus_client.boot()
pox/lib/interfaceio/__init__.py
korrigans84/pox_network
416
17157
# Copyright 2017 <NAME> # # 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/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, soft...
wxtbx/wx4_compatibility.py
dperl-sol/cctbx_project
155
17167
<filename>wxtbx/wx4_compatibility.py from __future__ import absolute_import, division, print_function ''' Author : Lyubimov, A.Y. Created : 04/14/2014 Last Changed: 11/05/2018 Description : wxPython 3-4 compatibility tools The context managers, classes, and other tools below can be used to make the GUI code ...
projects/TGS_salt/binary_classifier/model.py
liaopeiyuan/ml-arsenal-public
280
17178
<filename>projects/TGS_salt/binary_classifier/model.py import torch.nn as nn import pretrainedmodels class classifier(nn.Module): def __init__(self, model_name='resnet32'): super(classifier, self).__init__() # Load pretrained ImageNet model self.model = pretrainedmodels.__dict__[...
datasets/voc_dataset.py
ming71/DAL
206
17180
# -------------------------------------------------------- # Fast R-CNN # Copyright (c) 2015 Microsoft # Licensed under The MIT License [see LICENSE for details] # Written by <NAME> # Extended by <NAME> # -------------------------------------------------------- import os import cv2 import numpy as np import torch impor...
tests/test_fid_score.py
jwblangley/pytorch-fid
1,732
17226
<filename>tests/test_fid_score.py import numpy as np import pytest import torch from PIL import Image from pytorch_fid import fid_score, inception @pytest.fixture def device(): return torch.device('cpu') def test_calculate_fid_given_statistics(mocker, tmp_path, device): dim = 2048 m1, m2 = np.zeros((di...
test/unit/test_finalize.py
phated/binaryen
5,871
17235
<reponame>phated/binaryen<filename>test/unit/test_finalize.py from scripts.test import shared from . import utils class EmscriptenFinalizeTest(utils.BinaryenTestCase): def do_output_test(self, args): # without any output file specified, don't error, don't write the wasm, # but do emit metadata ...
3rd party/YOLO_network.py
isaiasfsilva/ROLO
962
17246
import os import numpy as np import tensorflow as tf import cv2 import time import sys import pickle import ROLO_utils as util class YOLO_TF: fromfile = None tofile_img = 'test/output.jpg' tofile_txt = 'test/output.txt' imshow = True filewrite_img = False filewrite_txt = False disp_console = True weights_file ...
ebcli/core/abstractcontroller.py
senstb/aws-elastic-beanstalk-cli
110
17250
# Copyright 2014 Amazon.com, Inc. or its affiliates. All Rights Reserved. # # Licensed under the Apache License, Version 2.0 (the "License"). You # may not use this file except in compliance with the License. A copy of # the License is located at # # http://aws.amazon.com/apache2.0/ # # or in the "license" file accompa...