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 |
|---|---|---|---|---|
django_mail_admin/transports/babyl.py | jayvdb/django_mail_admin | 179 | 11166196 | <gh_stars>100-1000
from mailbox import Babyl
from django_mail_admin.transports.generic import GenericFileMailbox
class BabylTransport(GenericFileMailbox):
_variant = Babyl
|
aat/core/handler/handler.py | mthomascarcamo/aat | 305 | 11166217 | from abc import ABCMeta, abstractmethod
from inspect import isabstract
from typing import TYPE_CHECKING, Callable, Optional, Tuple
from ..data import Event
from ...config import EventType
if TYPE_CHECKING:
# Circular import
from aat.engine import StrategyManager
class EventHandler(metaclass=ABCMeta):
_ma... |
src/warp/yul/SwitchToIfVisitor.py | sambarnes/warp | 414 | 11166249 | from __future__ import annotations
from typing import Optional
import warp.yul.ast as ast
from warp.yul.AstMapper import AstMapper
class SwitchToIfVisitor(AstMapper):
def visit_switch(self, node: ast.Switch) -> ast.Block:
return self.visit(
ast.Block(
(
as... |
alipay/aop/api/domain/AlipayFundTaxbillSignUnsignModel.py | antopen/alipay-sdk-python-all | 213 | 11166275 | <reponame>antopen/alipay-sdk-python-all
#!/usr/bin/env python
# -*- coding: utf-8 -*-
import json
from alipay.aop.api.constant.ParamConstants import *
class AlipayFundTaxbillSignUnsignModel(object):
def __init__(self):
self._biz_scene = None
self._contractor_code = None
self._employer_co... |
data/masif_site/nn_models/hbond_only/custom_params.py | NBDsoftware/masif | 309 | 11166292 | custom_params = {}
custom_params['model_dir'] = 'nn_models/hbond_only/model_data/'
custom_params['out_dir'] = 'output/hbond_only/'
custom_params['feat_mask'] = [0.0, 0.0, 1.0, 0.0, 0.0]
|
scripts/scoring/score.py | Diffblue-benchmarks/Microsoft-malmo | 3,570 | 11166310 | <filename>scripts/scoring/score.py
# ------------------------------------------------------------------------------------------------
# Copyright (c) 2016 Microsoft Corporation
#
# Permission is hereby granted, free of charge, to any person obtaining a copy of this software and
# associated documentation files (the "So... |
src/genie/libs/parser/iosxr/tests/ShowBgpInstanceNeighborsDetail/cli/equal/golden_output1_expected.py | balmasea/genieparser | 204 | 11166331 | expected_output = {
"instance": {
"all": {
"vrf": {
"default": {
"neighbor": {
"10.4.1.1": {
"remote_as": 65000,
"link_state": "internal link",
"local_a... |
PhysicsTools/PatAlgos/python/recoLayer0/muonPFIsolationValuesPAT_cff.py | ckamtsikis/cmssw | 852 | 11166345 | <gh_stars>100-1000
import FWCore.ParameterSet.Config as cms
import CommonTools.ParticleFlow.Isolation.muonPFIsolationValuesPFBRECO_cff as _m
muPFIsoValueCharged03PAT = _m.muPFIsoValueCharged03PFBRECO.clone()
muPFIsoValueCharged03PAT.deposits[0].src = 'muPFIsoDepositChargedPAT'
muPFMeanDRIsoValueCharged03PAT = _m.muPF... |
tests/test_reason/test_relativedifference.py | dumpmemory/doubtlab | 300 | 11166353 | import pytest
import numpy as np
from doubtlab.reason import RelativeDifferenceReason
@pytest.mark.parametrize("t, s", [(0.05, 4), (0.2, 3), (0.4, 2), (0.6, 1)])
def test_from_predict(t, s):
"""Test `from_predict` on an obvious examples"""
y = np.array([1.0, 1.0, 1.0, 1.0, 1.0])
preds = np.array([1.0, 1.... |
cli/scripts/addr.py | niclashedam/liblightnvm | 126 | 11166368 | #!/usr/bin/env python
from subprocess import Popen, PIPE
NSECTORS = 4
NPLANES = 4
def main():
ppas = []
for i in xrange(0, 16):
ch = 0
lun = 0
blk = 3
pg = 0
sec = i % NSECTORS
pl = (i / NSECTORS) % NPLANES
cmd = [str(x) for x in [
"nvm_ad... |
adb/systrace/catapult/common/py_utils/py_utils/tempfile_ext.py | mohanedmoh/TBS | 2,151 | 11166408 | <reponame>mohanedmoh/TBS<gh_stars>1000+
# Copyright 2016 The Chromium Authors. All rights reserved.
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
import contextlib
import shutil
import tempfile
@contextlib.contextmanager
def NamedTemporaryDirectory(suffix='', ... |
tests/primitives/test_strategybase.py | fakegit/DEXBot | 249 | 11166420 | <reponame>fakegit/DEXBot
import logging
import pytest
log = logging.getLogger("dexbot")
log.setLevel(logging.DEBUG)
@pytest.fixture()
def worker(strategybase):
return strategybase
@pytest.mark.mandatory
def test_init(worker):
pass
@pytest.mark.parametrize('asset', ['base', 'quote'])
def test_get_operati... |
tests/test_config.py | tyrylu/todoman | 318 | 11166421 | from unittest.mock import patch
import pytest
from click.testing import CliRunner
from todoman.cli import cli
from todoman.configuration import ConfigurationException
from todoman.configuration import load_config
def test_explicit_nonexistant(runner):
result = CliRunner().invoke(
cli,
env={"TODO... |
test/pytest/test_search_sms.py | bitigchi/MuditaOS | 369 | 11166426 | # Copyright (c) 2017-2021, Mudita Sp. z.o.o. All rights reserved.
# For licensing, see https://github.com/mudita/MuditaOS/LICENSE.md
import time
import pytest
from harness.interface.defs import key_codes
@pytest.mark.rt1051
@pytest.mark.usefixtures("phone_unlocked")
def test_search_sms(harness, sms_text, phone_numbe... |
tests/storage/test_dict_storage.py | FrostByte266/neupy | 801 | 11166476 | <gh_stars>100-1000
import copy
import numpy as np
from neupy.utils import asfloat
from neupy import layers, storage
from neupy.storage import (
validate_data_structure, InvalidFormat,
ParameterLoaderError, load_layer_parameter,
)
from base import BaseTestCase
class DictStorageTestCase(BaseTestCase):
ma... |
tests/roots/test-ext-autodoc/target/pep570.py | samdoran/sphinx | 4,973 | 11166478 | def foo(*, a, b):
pass
def bar(a, b, /, c, d):
pass
def baz(a, /, *, b):
pass
def qux(a, b, /):
pass
|
arbitrage/public_markets/huobicny.py | abaoj/bitcoin-arbitrage | 126 | 11166547 | <gh_stars>100-1000
# Copyright (C) 2017, JackYao <<EMAIL>>
from ._huobi import Huobi
class HuobiCNY(Huobi):
def __init__(self):
super().__init__("CNY", "btc")
|
clize/__init__.py | scholer/clize | 390 | 11166591 | # clize -- A command-line argument parser for Python
# Copyright (C) 2011-2016 by <NAME> and contributors. See AUTHORS and
# COPYING for details.
"""procedurally generate command-line interfaces from callables"""
from clize.parser import Parameter
from clize.runner import Clize, SubcommandDispatcher, run
from clize.l... |
backend/classifier/classifier/commands/build.py | pdehaan/facebook-political-ads | 228 | 11166596 | """
Builds our classifiers
"""
import click
import dill
from classifier.utilities import (get_classifier, confs, get_vectorizer,
classifier_path, train_classifier)
@click.option("--lang", help="Limit to language")
@click.command("build")
@click.pass_context
def build(ctx, lang):
... |
examples/avro-cli.py | woodlee/confluent-kafka-python | 2,838 | 11166598 | #!/usr/bin/env python
#
# Copyright 2018 Confluent 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 by applicable law or... |
utils/model_compression.py | cwwang15/neural_network_cracking | 196 | 11166601 | #!/usr/bin/env python
import h5py
import numpy as np
import struct
import sys
import argparse
import json
import itertools
class CompressActor(object):
RECORD_FMT = '>f'
def __init__(self, fname, ofile, weight_file):
self.fname = fname
self.ofile = ofile
self.weight_file = weight_fil... |
experiment_impact_tracker/operating_system/common.py | ANarayan/experiment-impact-tracker | 202 | 11166605 | <reponame>ANarayan/experiment-impact-tracker
from sys import platform
def is_linux(*args, **kwargs):
return platform == "linux" or platform == "linux2"
|
python/general-python/create-drive-times/create-drive-times.py | NagarjunaManupati/ESRI | 272 | 11166626 | <filename>python/general-python/create-drive-times/create-drive-times.py
"""
Importing concepts found at:
GitHub Developer Support
https://github.com/Esri/developer-support/tree/master/python/general-python/update-webmap-json
https://developers.arcgis.com/rest/analysis/api-reference/programmatically-accessing-analysis-... |
openfda/covid19serology/tests/pipeline_test.py | FDA/openfda | 388 | 11166661 | #!/usr/bin/env python
# coding=utf-8
import shutil
import tempfile
import unittest
from pickle import *
import leveldb
import openfda.ndc.pipeline
from openfda.ndc.pipeline import *
from openfda.covid19serology.pipeline import SerologyCSV2JSON
from openfda.tests.api_test_helpers import *
class SerologyPipelineTests(... |
app/oauth_office365/helper.py | larrycameron80/PwnAuth | 304 | 11166663 | <filename>app/oauth_office365/helper.py
from .models import Victim, Application
from datetime import datetime
from requests_oauthlib import OAuth2Session
from django.utils.timezone import make_aware
from django.db.utils import IntegrityError
import copy
from collections import OrderedDict
import logging
logger = loggi... |
tests/test_data/test_languages.py | ishine/wikipron | 111 | 11166673 | <gh_stars>100-1000
import json
import os
_REPO_DIR = os.path.dirname(
os.path.dirname(os.path.dirname(os.path.realpath(__file__)))
)
_LANGUAGES = os.path.join(_REPO_DIR, "data/scrape/lib/languages.json")
def test_casefold_value():
"""Check if each language in data/scrape/lib/languages.json
has a value fo... |
Scripts/dump-classes.py | kolinkrewinkel/Multiplex | 314 | 11166683 | #!/usr/bin/python
from subprocess import call
import glob
import os
import sys
import fileinput
import re
destination_path = 'Multiplex/Modules/IDEHeaders/IDEHeaders/'
def dump_all_frameworks():
# 3 different directories contain all of the frameworks a plugin may interface with.
# They're located at {APP_DIR}/Conte... |
chainer_chemistry/dataset/preprocessors/gwm_preprocessor.py | pfnet/chainerchem | 184 | 11166694 | from chainer_chemistry.dataset.preprocessors.common import construct_supernode_feature # NOQA
from chainer_chemistry.dataset.preprocessors.ggnn_preprocessor import GGNNPreprocessor # NOQA
from chainer_chemistry.dataset.preprocessors.gin_preprocessor import GINPreprocessor # NOQA
from chainer_chemistry.dataset.prepro... |
control_and_ai/function_approximation_rl/train_function_approximation_rl.py | julianxu/Rockets | 275 | 11166700 | """
Author: <NAME>
Date: 10/05/2017
Description: Scripts that train the Function Approximation RL networks.
"""
import _pickle
import logging
from control_and_ai.helpers import *
from control_and_ai.function_approximation_q_learning import *
from main_simulation import *
verbose = True
logger = logging.getLogger(__... |
bagel-data/config/tfclassif.py | AnneBeyer/tgen | 222 | 11166714 | #!/usr/bin/env python
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
config = {'language': 'en',
'selector': '',
'use_tokens': True,
#'nn': '1-hot',
'nn': 'emb',
#'nn_shape': 'ff1',
'nn_shape': 'rnn',
'num_hidden_units': 128,
... |
train/datamodules/touch_detect.py | Pandinosaurus/PyTouch | 149 | 11166722 | # Copyright (c) Facebook, Inc. and its affiliates. All rights reserved.
import logging
import numpy as np
from pytorch_lightning import LightningDataModule
from torch.utils.data import DataLoader, Subset
from pytouch.datasets import DigitFolder
from pytouch.tasks import TouchDetect
_log = logging.getLogger(__name__... |
Chapter18/hw/libhw/servo.py | haohaoxiao/Deep-Reinforcement-Learning-Hands-On-Second-Edition | 621 | 11166741 | import pyb
class ServoBrain:
FREQ = 50 # 20ms -- standard pulse interval for servos
MIN_PERCENT = 2.3
MAX_PERCENT = 12.7
MIN_POS = 0
MAX_POS = 1
def __init__(self):
"""
Construct servo brain
"""
self._timer_channels = None
self._inversions... |
deprecated/benchmark/ps/ctr/infer_args.py | hutuxian/FleetX | 170 | 11166748 | <reponame>hutuxian/FleetX
import argparse
import logging
def parse_args():
parser = argparse.ArgumentParser(description="PaddlePaddle DeepFM example")
parser.add_argument(
'--model_path',
type=str,
required=True,
help="The path of model parameters gz file")
parser.add_argume... |
kaldi/patch/steps/nnet3/train_cvector_dnn.py | ishine/asv-subtools | 370 | 11166750 | #!/usr/bin/env python
# Copyright 2016 <NAME>.
# 2016 <NAME>
# 2017 Johns Hopkins University (author: <NAME>)
# 2018 <NAME>
# Apache 2.0.
""" This script is based on steps/nnet3/tdnn/train.sh
"""
from __future__ import print_function
import argparse
import logging
import os
import... |
scripts/ltr_msmarco-passage/convert_common.py | keleog/pyserini | 451 | 11166755 | <reponame>keleog/pyserini<filename>scripts/ltr_msmarco-passage/convert_common.py
#
# Pyserini: Reproducible IR research with sparse and dense representations
#
# 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 ... |
py_zipkin/exception.py | arthurlogilab/py_zipkin | 225 | 11166756 | <reponame>arthurlogilab/py_zipkin
# -*- coding: utf-8 -*-
class ZipkinError(Exception):
"""Custom error to be raised on Zipkin exceptions."""
|
Testing/dataloader.py | dani3l125/TDNet | 195 | 11166765 | import os
import torch
import numpy as np
import imageio
import cv2
import pdb
def recursive_glob(rootdir=".", suffix=""):
return [
os.path.join(looproot, filename)
for looproot, _, filenames in os.walk(rootdir)
for filename in filenames
if filename.endswith(suffix)]
class citysc... |
src/pretalx/common/management/commands/makemessages.py | lili668668/pretalx | 418 | 11166775 | <reponame>lili668668/pretalx
"""This command supersedes the Django-inbuilt makemessages command.
We do this to allow the easy management of translations by way of plugins.
The way GNU gettext handles path precedence, it will always create new
translation files for given languages in the pretalx root locales directory
... |
fastseq/optimizer/fairseq/generate.py | nttcs-ds/fastseq | 346 | 11166790 | <filename>fastseq/optimizer/fairseq/generate.py
# Copyright (c) Microsoft Corporation.
# Licensed under the MIT License.
"""Optimize fairseq-generate (v0.10.2)"""
import ast
import logging
import math
import os
import sys
from itertools import chain
from multiprocessing import Queue, JoinableQueue
from torch.multipro... |
examples/seismic/test_seismic_utils.py | kristiantorres/devito | 204 | 11166802 | import pytest
import numpy as np
from devito import norm
from examples.seismic import Model, setup_geometry, AcquisitionGeometry
def not_bcs(bc):
return ("mask", 1) if bc == "damp" else ("damp", 0)
@pytest.mark.parametrize('nbl, bcs', [
(20, ("mask", 1)), (0, ("mask", 1)),
(20, ("damp", 0)), (0, ("damp... |
test/stress_tests/hid_usb_test.py | Intellinium/DAPLink | 1,354 | 11166807 | <filename>test/stress_tests/hid_usb_test.py
#
# DAPLink Interface Firmware
# Copyright (c) 2016-2017, ARM Limited, All Rights Reserved
# SPDX-License-Identifier: Apache-2.0
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the License.
# You may ob... |
leetcode.com/python/1268_Search_Suggestions_System.py | its-sushant/coding-interview-gym | 713 | 11166816 | <filename>leetcode.com/python/1268_Search_Suggestions_System.py
import bisect
# Usig binary search
class Solution(object):
def suggestedProducts(self, products, searchWord):
"""
:type products: List[str]
:type searchWord: str
:rtype: List[List[str]]
"""
products.sort... |
rsbook_code/planning/plotting.py | patricknaughton01/RoboticSystemsBook | 116 | 11166845 | def mpl_plot_graph(ax,G,vertex_options={},edge_options={},dims=[0,1],directed=False):
"""Plots a graph G=(V,E) using matplotlib.
ax is a matplotlib Axes object.
If states have more than 2 dimensions, you can control the x-y axes
using the dims argument.
"""
import numpy as np
V,E = G
i... |
experiments/annual_reviews/figure8/mpsc_experiment.py | catgloss/safe-control-gym | 120 | 11166847 | """This script runs the MPSC experiment in our Annual Reviews article.
See Figure 8 in https://arxiv.org/pdf/2108.06266.pdf.
"""
import os
import sys
import shutil
import matplotlib.pyplot as plt
from munch import munchify
from functools import partial
from safe_control_gym.utils.utils import read_file
from safe_con... |
qt__pyqt__pyside__pyqode/pyqt5_simple_check_password.py | gil9red/SimplePyScripts | 117 | 11166905 | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
__author__ = 'ipetrash'
import sys
from PyQt5.QtWidgets import QMainWindow, QApplication, QInputDialog, QMessageBox, QLabel, QLineEdit
class Example(QMainWindow):
def __init__(self):
super().__init__()
self.setWindowTitle('Example')
self.s... |
test/hlt/pytest/python/com/huawei/iotplatform/client/dto/NotifyNBCommandStatusChangedDTO.py | yuanyi-thu/AIOT- | 128 | 11166908 | <filename>test/hlt/pytest/python/com/huawei/iotplatform/client/dto/NotifyNBCommandStatusChangedDTO.py<gh_stars>100-1000
from com.huawei.iotplatform.client.dto.NBCommandResult import NBCommandResult
class NotifyNBCommandStatusChangedDTO(object):
result = NBCommandResult()
def __init__(self):
self.devi... |
ML/confusion-matrix/split_two.py | saneravi/ML_Stuff | 209 | 11166915 | #!/usr/bin/env python
"""Split the classes into two equal-sized groups to maximize accuracy."""
import json
import os
import random
import numpy as np
random.seed(0)
import logging
import sys
from visualize import apply_permutation, plot_cm, read_symbols, swap, swap_1d
logging.basicConfig(format='%(asctime)s %(le... |
alipay/aop/api/response/AlipayOverseasTravelPoiQueryResponse.py | antopen/alipay-sdk-python-all | 213 | 11166968 | #!/usr/bin/env python
# -*- coding: utf-8 -*-
import json
from alipay.aop.api.response.AlipayResponse import AlipayResponse
from alipay.aop.api.domain.PoiQueryResult import PoiQueryResult
class AlipayOverseasTravelPoiQueryResponse(AlipayResponse):
def __init__(self):
super(AlipayOverseasTravelPoiQueryRe... |
configs/new_baselines/mask_rcnn_R_101_FPN_100ep_LSJ.py | mmabrouk/detectron2 | 21,274 | 11167011 | <gh_stars>1000+
from .mask_rcnn_R_50_FPN_100ep_LSJ import (
dataloader,
lr_multiplier,
model,
optimizer,
train,
)
model.backbone.bottom_up.stages.depth = 101
|
aztk/core/models/validators.py | Geims83/aztk | 161 | 11167017 | <filename>aztk/core/models/validators.py
import collections
from aztk.error import InvalidModelFieldError
class Validator:
"""
Base class for a validator.
To write your validator extend this class and implement the validate method.
To raise an error raise InvalidModelFieldError
"""
def __ca... |
src_joint/utils_io.py | msc42/HPSG-Neural-Parser | 119 | 11167031 | __author__ = 'max'
import re
MAX_CHAR_LENGTH = 45
NUM_CHAR_PAD = 2
# Regular expressions used to normalize digits.
DIGIT_RE = re.compile(br"\d")
|
tests/test_client.py | Aliemeka/supabase-py | 181 | 11167105 | from __future__ import annotations
from typing import Any
import pytest
@pytest.mark.xfail(
reason="None of these values should be able to instanciate a client object"
)
@pytest.mark.parametrize("url", ["", None, "valeefgpoqwjgpj", 139, -1, {}, []])
@pytest.mark.parametrize("key", ["", None, "<KEY>", 139, -1, {... |
alipay/aop/api/domain/MyBkAccountVO.py | snowxmas/alipay-sdk-python-all | 213 | 11167136 | #!/usr/bin/env python
# -*- coding: utf-8 -*-
import json
from alipay.aop.api.constant.ParamConstants import *
class MyBkAccountVO(object):
def __init__(self):
self._account_ext_no = None
self._account_fip_branch_code = None
self._account_fip_code = None
self._account_fip_name = ... |
docs/examples/python/scomparator_test_client.py | radetsky/themis | 1,561 | 11167138 | <reponame>radetsky/themis
#
# Copyright (c) 2015 Cossack Labs 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
#
# Unless required by appl... |
code_examples/popart/block_sparse/examples/conftest.py | payoto/graphcore_examples | 260 | 11167144 | <reponame>payoto/graphcore_examples
# Copyright (c) 2020 Graphcore Ltd. All rights reserved.
import pathlib
from utils import build_custom_ops
from mnist.common import download_mnist
import pytest
import ctypes
import os
def pytest_sessionstart(session):
# Builds the custom ops
so_path = pathlib.Path(__file_... |
examples/basic_geometries.py | ConnectionMaster/qgis-earthengine-plugin | 307 | 11167153 | import ee
from ee_plugin import Map
point = ee.Geometry.Point([1.5, 1.5])
Map.addLayer(point, {'color': '1eff05'}, 'point')
lineString = ee.Geometry.LineString(
[[-35, -10], [35, -10], [35, 10], [-35, 10]])
Map.addLayer(lineString, {'color': 'FF0000'}, 'lineString')
linearRing = ee.Geometry.LinearRing(
[[-35, -1... |
manila/api/views/share_instance.py | kpawar89/manila | 159 | 11167160 | <reponame>kpawar89/manila
# 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 i... |
scripts/pendulum_data_collect.py | SaminYeasar/inverse_rl | 220 | 11167164 | from sandbox.rocky.tf.algos.trpo import TRPO
from sandbox.rocky.tf.envs.base import TfEnv
from sandbox.rocky.tf.policies.gaussian_mlp_policy import GaussianMLPPolicy
from rllab.baselines.linear_feature_baseline import LinearFeatureBaseline
from rllab.envs.gym_env import GymEnv
from inverse_rl.utils.log_utils import rl... |
self_driving/ml_training/test/TestTrainer.py | cclauss/self_driving_pi_car | 724 | 11167182 | #!/usr/bin/env python
# -*- coding: utf-8 -*-
import unittest
import os
import sys
import inspect
import numpy as np
import tensorflow as tf
import itertools
import shutil
almost_current = os.path.abspath(inspect.getfile(inspect.currentframe()))
currentdir = os.path.dirname(almost_current)
parentdir = os.path.dirname... |
tools/azure-sdk-tools/packaging_tools/__main__.py | rsdoherty/azure-sdk-for-python | 2,728 | 11167206 | import argparse
import logging
import os
import sys
from . import build_packaging
_LOGGER = logging.getLogger(__name__)
_epilog = """This script will automatically build the TOML configuration file with default value if it doesn't exist.
"""
parser = argparse.ArgumentParser(
description="Packaging tools for Azu... |
mayan/apps/lock_manager/apps.py | nattangwiwat/Mayan-EDMS-recitation | 343 | 11167209 | import logging
import sys
from django.utils.translation import ugettext_lazy as _
from mayan.apps.common.apps import MayanAppConfig
from .backends.base import LockingBackend
from .literals import PURGE_LOCKS_COMMAND, TEST_LOCK_NAME
from .settings import setting_backend
logger = logging.getLogger(name=__name__)
cl... |
dart_fss/api/filings/document.py | dveamer/dart-fss | 243 | 11167221 | <filename>dart_fss/api/filings/document.py<gh_stars>100-1000
# -*- coding: utf-8 -*-
from dart_fss.auth import get_api_key
from dart_fss.utils import request
def download_document(path: str, rcept_no: str) -> str:
""" 공시서류원본파일 다운로드
Parameters
----------
path: str
download path
rcept_no: s... |
tests/r/test_rdtelec.py | hajime9652/observations | 199 | 11167234 | from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
import shutil
import sys
import tempfile
from observations.r.rdtelec import rdtelec
def test_rdtelec():
"""Test module rdtelec.py by downloading
rdtelec.csv and testing shape of
extracted data has 29... |
tests/utils_tests/autoload/__init__.py | fy0/mapi | 219 | 11167268 | <reponame>fy0/mapi
FLAG = 1
|
lldb/test/API/lang/cpp/enum_types/TestCPP11EnumTypes.py | LaudateCorpus1/llvm-project | 605 | 11167283 | <reponame>LaudateCorpus1/llvm-project<gh_stars>100-1000
"""Look up enum type information and check for correct display."""
import lldb
from lldbsuite.test.decorators import *
from lldbsuite.test.lldbtest import *
import lldbsuite.test.lldbutil as lldbutil
class CPP11EnumTypesTestCase(TestBase):
mydir = TestBase... |
questionary/form.py | qualichat/questionary | 851 | 11167292 | <filename>questionary/form.py
from typing import Any, Dict, NamedTuple, Sequence
from questionary.constants import DEFAULT_KBI_MESSAGE
from questionary.question import Question
class FormField(NamedTuple):
key: str
question: Question
def form(**kwargs: Question) -> "Form":
"""Create a form with multipl... |
recipes/Python/576477_Yet_another_signalslot/recipe-576477.py | tdiprima/code | 2,023 | 11167326 | <filename>recipes/Python/576477_Yet_another_signalslot/recipe-576477.py
"""
File: signal.py
Author: <NAME>
Created: August 28, 2008
Purpose: A signal/slot implementation
"""
from weakref import WeakValueDictionary
class Signal(object):
def __init__(self):
self.__slots = WeakValueDictionary()
de... |
tests/popmon/spark/test_spark.py | Sharath302/popmon | 265 | 11167334 | <reponame>Sharath302/popmon<gh_stars>100-1000
from os.path import abspath, dirname, join
import pandas as pd
import pytest
from popmon.hist.filling import make_histograms
from popmon.pipeline.metrics import df_stability_metrics
try:
from pyspark import __version__ as pyspark_version
from pyspark.sql import S... |
code/deep/CSG/a-mnist/makedata.py | jiaruonan/transferlearning | 9,657 | 11167361 | #!/usr/bin/env python3.6
'''For generating MNIST-01 and its shifted interventional datasets.
'''
import torch as tc
import torchvision as tv
import torchvision.transforms.functional as tvtf
import argparse
__author__ = "<NAME>"
__email__ = "<EMAIL>"
def select_xy(dataset, selected_y = (0,1), piltransf = None, ytransf... |
custom_components/reolink_dev/device_action.py | gasecki/Home-Assistant_Config | 163 | 11167364 | """ custom helper actions """
import logging
from typing import List, Optional
import voluptuous as vol
from homeassistant.const import (
ATTR_ENTITY_ID,
CONF_DEVICE_ID,
CONF_DOMAIN,
CONF_ENTITY_ID,
CONF_TYPE,
DEVICE_CLASS_TIMESTAMP,
)
from homeassistant.core import Context, HomeAssistant
fro... |
depth_upsampling/sampler.py | Levintsky/ARKitScenes | 237 | 11167367 | import numpy as np
import torch.utils.data
class MultiEpochSampler(torch.utils.data.Sampler):
r"""Samples elements randomly over multiple epochs
Arguments:
data_source (Dataset): dataset to sample from
num_iter (int) : Number of times to loop over the dataset
start_itr (int) : which i... |
homeassistant/components/humidifier/const.py | mtarjoianu/core | 30,023 | 11167401 | """Provides the constants needed for component."""
from enum import IntEnum
MODE_NORMAL = "normal"
MODE_ECO = "eco"
MODE_AWAY = "away"
MODE_BOOST = "boost"
MODE_COMFORT = "comfort"
MODE_HOME = "home"
MODE_SLEEP = "sleep"
MODE_AUTO = "auto"
MODE_BABY = "baby"
ATTR_AVAILABLE_MODES = "available_modes"
ATTR_HUMIDITY = "h... |
run_gradient_descent_2d.py | Gautam-J/ML-Sklearn | 415 | 11167422 | import os
import time
import argparse
import numpy as np
import seaborn as sns
import matplotlib.pyplot as plt
from matplotlib import animation
from algorithms.gradient_descent_2d import GradientDescent2D
from algorithms.momentum_2d import Momentum2D
plt.style.use('seaborn')
def getArguments():
parser = argpars... |
src/admin/widgets/polygon.py | aimanow/sft | 280 | 11167440 | <reponame>aimanow/sft
import wtforms
from flask import render_template
from godmode.widgets.base import BaseWidget
class PolygonWidget(BaseWidget):
filterable = False
field = wtforms.TextAreaField()
def render_list(self, item):
value = getattr(item, self.name, None) if item else None
val... |
examples/postgres-alembic/app.py | psy-repos-rust/vagga | 1,974 | 11167451 | import os
from flask import Flask
from flask.ext.sqlalchemy import SQLAlchemy
app = Flask(__name__)
app.config['SQLALCHEMY_DATABASE_URI'] = os.environ.get('DATABASE_URL')
db = SQLAlchemy(app)
@app.route('/')
def hello_world():
return '; '.join(db.engine.table_names())
if __name__ == '__main__':
app.run(host=... |
tools/perf/benchmarks/jitter.py | google-ar/chromium | 777 | 11167468 | <reponame>google-ar/chromium
# Copyright 2015 The Chromium Authors. All rights reserved.
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
from core import perf_benchmark
from telemetry.timeline import chrome_trace_category_filter
from telemetry.web_perf import time... |
notebook/pandas_error_ambiguous.py | vhn0912/python-snippets | 174 | 11167477 | import pandas as pd
df = pd.DataFrame(pd.np.arange(12).reshape(3, 4), columns=['a', 'b', 'c', 'd'], index=['x', 'y', 'z'])
print(df)
# a b c d
# x 0 1 2 3
# y 4 5 6 7
# z 8 9 10 11
print((df > 3) & (df % 2 == 0))
# a b c d
# x False False False False
# y True False... |
configs/repvgg/deploy/repvgg-A0_deploy_4xb64-coslr-120e_in1k.py | YuxinZou/mmclassification | 1,190 | 11167478 | <gh_stars>1000+
_base_ = '../repvgg-A0_4xb64-coslr-120e_in1k.py'
model = dict(backbone=dict(deploy=True))
|
alipay/aop/api/domain/LiveInfo.py | antopen/alipay-sdk-python-all | 213 | 11167486 | #!/usr/bin/env python
# -*- coding: utf-8 -*-
import json
from alipay.aop.api.constant.ParamConstants import *
from alipay.aop.api.domain.LiveContentInfo import LiveContentInfo
class LiveInfo(object):
def __init__(self):
self._content_info_list = None
self._live_end_time = None
self._liv... |
futu/common/pb/Qot_GetUserSecurityGroup_pb2.py | Hason-Cheung/py-futu-api | 858 | 11167487 | <gh_stars>100-1000
# Generated by the protocol buffer compiler. DO NOT EDIT!
# source: Qot_GetUserSecurityGroup.proto
import sys
_b=sys.version_info[0]<3 and (lambda x:x) or (lambda x:x.encode('latin1'))
from google.protobuf.internal import enum_type_wrapper
from google.protobuf import descriptor as _descriptor
from ... |
etc/pending_ugens/Formant.py | butayama/supriya | 191 | 11167490 | import collections
from supriya.enums import CalculationRate
from supriya.synthdefs import PureUGen
class Formant(PureUGen):
"""
::
>>> formant = supriya.ugens.Formant.ar(
... bwfrequency=880,
... formfrequency=1760,
... fundfrequency=440,
... )
... |
test/py/TestRenderedDoubleConstants.py | Jimexist/thrift | 8,514 | 11167503 | #
# Licensed to the Apache Software Foundation (ASF) under one
# or more contributor license agreements. See the NOTICE file
# distributed with this work for additional information
# regarding copyright ownership. The ASF licenses this file
# to you under the Apache License, Version 2.0 (the
# "License"); you may not u... |
api/v2/tests/tools.py | nathandarnell/sal | 215 | 11167529 | <reponame>nathandarnell/sal
"""Tools used in testing the Sal API app."""
import contextlib
import io
import sys
from django.urls import reverse
from rest_framework import status
from rest_framework.test import APITestCase
from server.models import (ApiKey, BusinessUnit, MachineGroup, Machine)
# Get rid of pylint... |
src/common/config.py | THUKElab/Video2Description | 152 | 11167552 | """
Configuration Parser for V2D
"""
import json
import threading
import os
lock = threading.Lock()
def get_config():
with lock:
if hasattr(get_config, "config"):
return get_config.config
fname = os.environ.get("V2D_CONFIG_FILE", "config.json")
with open(fname, "r") as fin:
... |
utils.py | VishnuAvNair/ICIAR2018 | 185 | 11167566 | #!/usr/bin/env python3
"""Utilities for cross-validation.
Notice data/folds-10.pkl we use in 10-fold cross-val. Keep it to replicate our results"""
import numpy as np
import glob
from os.path import basename, join
from sklearn.model_selection import StratifiedKFold
import pickle
def load_data(in_dir, folds=None, spl... |
infra/scripts/legacy/scripts/common/chromium_utils.py | google-ar/chromium | 2,151 | 11167576 | <reponame>google-ar/chromium<filename>infra/scripts/legacy/scripts/common/chromium_utils.py
# Copyright (c) 2012 The Chromium Authors. All rights reserved.
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
""" Set of basic operations/utilities that are used by the bu... |
neurst_pt/models/model_utils.py | ishine/neurst | 208 | 11167595 | # Copyright 2020 ByteDance 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 by applicable law or agreed to in writin... |
tests/test_db.py | witold-gren/django-health-check | 739 | 11167606 | from django.db import DatabaseError, IntegrityError
from django.db.models import Model
from django.test import TestCase
from mock import patch
from health_check.db.backends import DatabaseBackend
class MockDBModel(Model):
"""
A Mock database used for testing.
error_thrown - The Exception to be raised whe... |
intro/numpy/examples/plot_polyfit.py | zmoon/scipy-lecture-notes | 2,538 | 11167617 | <filename>intro/numpy/examples/plot_polyfit.py
"""
Fitting to polynomial
=====================
Plot noisy data and their polynomial fit
"""
import numpy as np
import matplotlib.pyplot as plt
np.random.seed(12)
x = np.linspace(0, 1, 20)
y = np.cos(x) + 0.3*np.random.rand(20)
p = np.poly1d(np.polyfit(x, y, 3))
t = n... |
EXAMPLES/Python/DHT11_SENSOR/dht11.py | CodeRancher/pigpio | 654 | 11167629 | #!/usr/bin/env python
# -*- coding: utf-8 -*-
from __future__ import absolute_import, division, print_function, unicode_literals
import time
import pigpio
class DHT11(object):
"""
The DHT11 class is a stripped version of the DHT22 sensor code by joan2937.
You can find the initial implementation here:
... |
help_utils/head_op.py | loceyi/CSL_RetinaNet_Tensorflow | 187 | 11167640 | <reponame>loceyi/CSL_RetinaNet_Tensorflow
# -*- coding: utf-8 -*-
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
import cv2
import numpy as np
import tensorflow as tf
def get_head_quadrant(head, gtbox):
"""
:param head: [head_x, head_y]
:para... |
tests/micropython/const.py | LabAixBidouille/micropython | 303 | 11167644 | <reponame>LabAixBidouille/micropython
# test constant optimisation
X = const(123)
Y = const(X + 456)
print(X, Y + 1)
def f():
print(X, Y + 1)
f()
|
RecoEgamma/Examples/python/photonsWithConversionsAnalyzer_cfi.py | ckamtsikis/cmssw | 852 | 11167647 | <gh_stars>100-1000
import FWCore.ParameterSet.Config as cms
#
# Author: <NAME>, U. of Notre Dame, US
#
photonsWithConversionsAnalyzer = cms.EDAnalyzer("PhotonsWithConversionsAnalyzer",
phoProducer = cms.string('correctedPhotons'),
HistOutFile = cms.untracked.string('analyzer.root'),
moduleLabelMC = cms.un... |
samples/python/49.qnamaker-all-features/bots/__init__.py | Aliacf21/BotBuilder-Samples | 1,998 | 11167650 | # Copyright (c) Microsoft Corporation. All rights reserved.
# Licensed under the MIT License.
from .qna_bot import QnABot
__all__ = ["QnABot"]
|
bernoulli.py | susan120433/distribution-is-all-you-need | 1,390 | 11167697 | """
Code by <NAME>(@graykode)
https://en.wikipedia.org/wiki/Bernoulli_distribution
"""
import random
import numpy as np
from matplotlib import pyplot as plt
def bernoulli(p, k):
return p if k else 1 - p
n_experiment = 100
p = 0.6
x = np.arange(n_experiment)
y = []
for _ in range(n_experiment):
pick = ... |
s5_r2/local/prepare_dir_structure.py | protofy/kaldi-tuda-de | 125 | 11167747 | # This script builds the folder structure needed to train the model. It also asks where bigger files (mfcc, lm, exp)
# Copyright 2015 Language Technology, Technische Universitaet Darmstadt (author: <NAME>)
# Copyright 2018 Language Technology, Universitaet Hamburg (author: <NAME>)
#
# Licensed under the Apache License... |
aicsimageio/tests/utils/test_io_utils.py | brisvag/aicsimageio | 110 | 11167786 | #!/usr/bin/env python
# -*- coding: utf-8 -*-
import pytest
from aicsimageio.utils.io_utils import pathlike_to_fs
from ..conftest import LOCAL, REMOTE, get_resource_full_path
@pytest.mark.parametrize("host", [LOCAL, REMOTE])
@pytest.mark.parametrize(
"filename, enforce_exists",
[
("example.txt", Fa... |
tests/import/import-from.test/kitchen/__init__.py | nanolikeyou/pysonar2 | 2,574 | 11167794 | # knife is not exported
__all__ = ["spoon", "fork"]
def spoon(x):
return x
def fork(x):
return [x,x]
# knife is not exported
def knife(x):
return x+1
|
tests/context.py | chatzich/python-bitcoin-utils | 104 | 11167804 | <gh_stars>100-1000
# Copyright (C) 2018-2020 The python-bitcoin-utils developers
#
# This file is part of python-bitcoin-utils
#
# It is subject to the license terms in the LICENSE file found in the top-level
# directory of this distribution.
#
# No part of python-bitcoin-utils, including this file, may be copied,
# mo... |
tests/api/endpoints/admin/test_sys_notifications.py | weimens/seahub | 420 | 11167811 | import json
from django.utils.crypto import get_random_string
from seahub.test_utils import BaseTestCase
from seahub.notifications.models import Notification
class AdminSysNotificationsTest(BaseTestCase):
def setUp(self):
self.url = '/api/v2.1/admin/sys-notifications/'
self.notification = Notifi... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.