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 |
|---|---|---|---|---|
example_nodes/__init__.py | 996268132/NodeGraphQt | 582 | 40556 | <reponame>996268132/NodeGraphQt
#!/usr/bin/python
import os
import sys
import ast
VALID_NODE_TYPE = ['BaseNode', 'AutoNode']
def detectNodesFromText(filepath):
"""returns Node names from a python script"""
froms = []
with open(filepath, "r") as source:
tree = ast.parse(source.read())
f... |
33. Python Programs/FactorialOfNumbers.py | Ujjawalgupta42/Hacktoberfest2021-DSA | 225 | 40580 | <reponame>Ujjawalgupta42/Hacktoberfest2021-DSA
for i in range(int(input())):
fact=1
a=int(input())
for j in range(1,a+1,1):
fact=fact*j
print(fact)
def factorial(n):
return 1 if (n==1 or n==0) else n * factorial(n - 1);
num = int(input('Enter number'))
print("Factorial of",num,... |
legacy/models/resnet/tensorflow2/train_tf2_resnet.py | kevinyang8/deep-learning-models | 129 | 40624 | <reponame>kevinyang8/deep-learning-models<filename>legacy/models/resnet/tensorflow2/train_tf2_resnet.py
# Copyright 2018 Amazon.com, Inc. or its affiliates. All Rights Reserved.
#
# Permission is hereby granted, free of charge, to any person obtaining a copy of this
# software and associated documentation files (the "S... |
faketests/slowtests/test_3.py | Djailla/pytest-sugar | 418 | 40627 | import time
import pytest
@pytest.mark.parametrize("index", range(7))
def test_cat(index):
"""Perform several tests with varying execution times."""
time.sleep(0.2 + (index * 0.1))
assert True
|
recipes/Python/577462_A_Buttonbar_program_with_color_/recipe-577462.py | tdiprima/code | 2,023 | 40631 | '''
;#template` {-path} {-menu} {-s1} {-s2} {-s3}
;#option`-path`Path to controlling file`F`c:\source\python\projects\menu\buttonbar.py`
;#option`-menu`Path to menu file`F`c:\source\python\projects\menu\test.ini`
;#option`-s1`First section`X`info`
;#option`-s2`Second section`X`help`
;#option`-s3`Third section`X`data`
;... |
osp/graphs/osp_graph.py | davidmcclure/open-syllabus-project | 220 | 40657 | <reponame>davidmcclure/open-syllabus-project
import networkx as nx
import random
from osp.common.utils import query_bar
from osp.graphs.graph import Graph
from osp.citations.models import Text, Citation, Text_Index
from osp.corpus.models import Document
from itertools import combinations
from peewee import fn
from ... |
RecoJets/JetProducers/python/ak4PFClusterJets_cfi.py | ckamtsikis/cmssw | 852 | 40706 | import FWCore.ParameterSet.Config as cms
from RecoJets.JetProducers.PFClusterJetParameters_cfi import *
from RecoJets.JetProducers.AnomalousCellParameters_cfi import *
ak4PFClusterJets = cms.EDProducer(
"FastjetJetProducer",
PFClusterJetParameters,
AnomalousCellParameters,
jetAlgorithm = cms.string("A... |
template/python/base-class.py | hiroebe/sonictemplate-vim | 130 | 40710 | <gh_stars>100-1000
"""
{{_name_}}
"""
class {{_expr_:substitute('{{_input_:name}}', '\w\+', '\u\0', '')}}(object):
def __init__(self{{_cursor_}}):
def __repr__(self):
return
|
atlas/foundations_contrib/src/foundations_contrib/models/project_listing.py | DeepLearnI/atlas | 296 | 40745 |
class ProjectListing(object):
@staticmethod
def list_projects(redis_connection):
"""Returns a list of projects store in redis with their
creation timestamps
Arguments:
redis_connection {RedisConnection} -- Redis connection to use as a provider for data
Returns:
... |
quantsbin/derivativepricing/namesnmapper.py | quantsbin/Quantsbin | 132 | 40746 | """
developed by Quantsbin - Jun'18
"""
from enum import Enum
class AssetClass(Enum):
EQOPTION = 'EqOption'
FXOPTION = 'FXOption'
FUTOPTION = 'FutOption'
COMOPTION = 'ComOption'
class DerivativeType(Enum):
VANILLA_OPTION = 'Vanilla Option'
class PricingModel(Enum):
BLACKSCHOLESMERTON... |
tests/test_jwt.py | kschu91/pyoidc | 373 | 40779 | import os
from oic.utils.jwt import JWT
from oic.utils.keyio import build_keyjar
from oic.utils.keyio import keybundle_from_local_file
__author__ = "roland"
BASE_PATH = os.path.abspath(os.path.join(os.path.dirname(__file__), "data/keys"))
keys = [
{"type": "RSA", "key": os.path.join(BASE_PATH, "cert.key"), "us... |
kili/queries/issue/queries.py | ASonay/kili-playground | 214 | 40799 | <gh_stars>100-1000
"""
Queries of issue queries
"""
def gql_issues(fragment):
"""
Return the GraphQL issues query
"""
return f'''
query ($where: IssueWhere!, $first: PageSize!, $skip: Int!) {{
data: issues(where: $where, first: $first, skip: $skip) {{
{fragment}
}}
}}
'''
GQL_ISSUES_COUNT = ... |
server/bench-wrk/hge_wrk_bench.py | gh-oss-contributor/graphql-engine-1 | 27,416 | 40812 | from sportsdb_setup import HGETestSetup, HGETestSetupArgs
from run_hge import HGE
import graphql
import multiprocessing
import json
import os
import docker
import ruamel.yaml as yaml
import cpuinfo
import subprocess
import threading
import time
import datetime
from colorama import Fore, Style
from plot import run_dash_... |
warp/tests/test_import.py | NVIDIA/warp | 306 | 40816 | <filename>warp/tests/test_import.py
# Copyright (c) 2022 NVIDIA CORPORATION. All rights reserved.
# NVIDIA CORPORATION and its licensors retain all intellectual property
# and proprietary rights in and to this software, related documentation
# and any modifications thereto. Any use, reproduction, disclosure or
# dist... |
genetic_algorithm/mutation.py | mig029/SnakeAI | 181 | 40822 | <filename>genetic_algorithm/mutation.py
# 9.3.2
# 11.2.1
# 12.4.3
import numpy as np
from typing import List, Union, Optional
from .individual import Individual
def gaussian_mutation(chromosome: np.ndarray, prob_mutation: float,
mu: List[float] = None, sigma: List[float] = None,
... |
src/backend/common/models/tests/team_test.py | guineawheek/ftc-data-take-2 | 266 | 40828 | import pytest
from backend.common.models.team import Team
from backend.common.models.tests.util import (
CITY_STATE_COUNTRY_PARAMETERS,
LOCATION_PARAMETERS,
)
@pytest.mark.parametrize("key", ["frc177", "frc1"])
def test_valid_key_names(key: str) -> None:
assert Team.validate_key_name(key) is True
@pyte... |
pymtl3/datatypes/bitstructs.py | kevinyuan/pymtl3 | 152 | 40842 | """
==========================================================================
bitstruct.py
==========================================================================
APIs to generate a bitstruct type. Using decorators and type annotations
to create bit struct is much inspired by python3 dataclass implementation.
Note ... |
utils/surface.py | fsanges/glTools | 165 | 40848 | <filename>utils/surface.py<gh_stars>100-1000
import maya.cmds as mc
import maya.OpenMaya as OpenMaya
import glTools.utils.base
import glTools.utils.curve
import glTools.utils.component
import glTools.utils.mathUtils
import glTools.utils.matrix
import glTools.utils.shape
import glTools.utils.stringUtils
import math
d... |
menpo3d/base.py | apapaion/menpo3d | 134 | 40854 | import os
from pathlib import Path
def menpo3d_src_dir_path():
r"""The path to the top of the menpo3d Python package.
Useful for locating where the data folder is stored.
Returns
-------
path : str
The full path to the top of the Menpo3d package
"""
return Path(os.path.abspath(__... |
language/orqa/ops/orqa_ops_test.py | Xtuden-com/language | 1,199 | 40863 | # coding=utf-8
# Copyright 2018 The Google AI Language Team Authors.
#
# 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 ... |
Firmware/adctest.py | sanielfishawy/ODrive | 1,068 | 40867 | <reponame>sanielfishawy/ODrive<gh_stars>1000+
import numpy as np
import matplotlib.pyplot as plt
adchist = [(0, 137477),
(1, 98524),
(2, 71744),
(3, 60967),
(4, 44372),
(5, 46348),
(6, 19944),
(7, 10092),
(8, 13713),
(9, 11182),
(10, 6903),
(11, 4072),
(12, 2642),
(13, 968),
(14, 296),
(15, 166),
(16, 17),
(17, 2),
(... |
api/tests/integration/tests/todo/load_utf8.py | epam/Indigo | 204 | 40954 | <reponame>epam/Indigo
# coding=utf-8
import sys
sys.path.append('../../common')
from env_indigo import *
indigo = Indigo()
indigo.setOption("molfile-saving-skip-date", "1")
print("****** Load molfile with UTF-8 characters in Data S-group ********")
m = indigo.loadMoleculeFromFile(joinPathPy("molecules/sgroups_utf8.mo... |
Sorting/sort list strings with numbers.py | DazEB2/SimplePyScripts | 117 | 40967 | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
__author__ = 'ipetrash'
# Генерация списка
items = ['KMS1.kmch.pos.out_dE_%s.mx' % i for i in range(20)]
# Перемешивание элементов списка
import random
random.shuffle(items)
print(items)
# Обычная сортировка не работает
print(sorted(items))
print()
def get_number_1... |
SimCalorimetry/EcalSelectiveReadoutProducers/python/ecalDigis_cff.py | ckamtsikis/cmssw | 852 | 40977 | <reponame>ckamtsikis/cmssw<filename>SimCalorimetry/EcalSelectiveReadoutProducers/python/ecalDigis_cff.py
import FWCore.ParameterSet.Config as cms
# Define EcalSelectiveReadoutProducer module as "simEcalDigis" with default settings
from SimCalorimetry.EcalSelectiveReadoutProducers.ecalDigis_cfi import *
|
pythran/tests/cython/setup_tax.py | davidbrochart/pythran | 1,647 | 40978 | from distutils.core import setup
from Cython.Build import cythonize
setup(
name = "tax",
ext_modules = cythonize('tax.pyx'),
script_name = 'setup.py',
script_args = ['build_ext', '--inplace']
)
import tax
import numpy as np
print(tax.tax(np.ones(10)))
|
src/pretalx/api/permissions.py | lili668668/pretalx | 418 | 40984 | from rest_framework.permissions import SAFE_METHODS, BasePermission
class ApiPermission(BasePermission):
def _has_permission(self, view, obj, request):
event = getattr(request, "event", None)
if not event: # Only true for root API view
return True
if request.method in SAFE_ME... |
odinw/download.py | microsoft/GLIP | 295 | 41002 | import argparse
import os
argparser = argparse.ArgumentParser()
argparser.add_argument("--dataset_names", default="all", type=str) # "all" or names joined by comma
argparser.add_argument("--dataset_path", default="DATASET/odinw", type=str)
args = argparser.parse_args()
root = "https://vlpdatasets.blob.core.windows.ne... |
tests/test_experiment.py | movermeyer/pyexperiment | 220 | 41026 | <reponame>movermeyer/pyexperiment
"""Tests the experiment module of pyexperiment
Written by <NAME>
"""
from __future__ import print_function
from __future__ import unicode_literals
from __future__ import division
from __future__ import absolute_import
import unittest
import argparse
import io
import mock
import temp... |
utils/general.py | bfortuner/VOCdetect | 336 | 41055 | <reponame>bfortuner/VOCdetect
import uuid
def gen_unique_id(prefix='', length=5):
return prefix + str(uuid.uuid4()).upper().replace('-','')[:length]
def get_class_name(obj):
invalid_class_names = ['function']
classname = obj.__class__.__name__
if classname is None or classname in invalid_class_names:... |
setup.py | KevinMusgrave/pytorch-adapt | 131 | 41092 | import sys
import setuptools
sys.path.insert(0, "src")
import pytorch_adapt
with open("README.md", "r") as fh:
long_description = fh.read()
extras_require_ignite = ["pytorch-ignite == 0.5.0.dev20220221"]
extras_require_lightning = ["pytorch-lightning"]
extras_require_record_keeper = ["record-keeper >= 0.9.31"]... |
bh_modules/erlangcase.py | jfcherng-sublime/ST-BracketHighlighter | 1,047 | 41093 | <gh_stars>1000+
"""
BracketHighlighter.
Copyright (c) 2013 - 2016 <NAME> <<EMAIL>>
License: MIT
"""
from BracketHighlighter.bh_plugin import import_module
lowercase = import_module("bh_modules.lowercase")
def validate(*args):
"""Check if bracket is lowercase."""
return lowercase.validate(*args)
|
codigo/Live171/exemplo_04.py | BrunoPontesLira/live-de-python | 572 | 41118 | <gh_stars>100-1000
d = {'a': 1, 'c': 3}
match d:
case {'a': chave_a, 'b': _}:
print(f'chave A {chave_a=} + chave B')
case {'a': _} | {'c': _}:
print('chave A ou C')
case {}:
print('vazio')
case _:
print('Não sei')
|
sionna/channel/apply_time_channel.py | NVlabs/sionna | 163 | 41129 | <filename>sionna/channel/apply_time_channel.py
#
# SPDX-FileCopyrightText: Copyright (c) 2021-2022 NVIDIA CORPORATION & AFFILIATES. All rights reserved.
# SPDX-License-Identifier: Apache-2.0
#
"""Layer for applying channel responses to channel inputs in the time domain"""
import tensorflow as tf
import numpy as np
i... |
fbssdc/ast.py | Eijebong/binjs-ref | 391 | 41143 | <reponame>Eijebong/binjs-ref<gh_stars>100-1000
#!/usr/bin/env python3
# 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 doctest
import json
import os
import subprocess
import idl
BIN... |
CountingGridsPy/tests/time_models/time_gpuvscpu.py | microsoft/browsecloud | 159 | 41149 | <filename>CountingGridsPy/tests/time_models/time_gpuvscpu.py
# Copyright (c) Microsoft Corporation. All rights reserved.
# Licensed under the MIT License.
import unittest
import numpy as np
import torch
import os
import cProfile
from CountingGridsPy.models import CountingGridModel, CountingGridModelWithGPU
class Tim... |
external/lemonade/dist/examples/calc/calc.py | almartin82/bayeslite | 964 | 41185 | <reponame>almartin82/bayeslite<filename>external/lemonade/dist/examples/calc/calc.py
import sys
def generateGrammar():
from lemonade.main import generate
from os.path import join, dirname
from StringIO import StringIO
inputFile = join(dirname(__file__), "gram.y")
outputStream = StringIO()
ge... |
examples/pybullet/gym/pybullet_envs/minitaur/agents/scripts/configs.py | felipeek/bullet3 | 9,136 | 41203 | <reponame>felipeek/bullet3
# Copyright 2017 The TensorFlow Agents Authors.
#
# 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 requi... |
test/test_util.py | jeffw-github/autoprotocol-python | 113 | 41233 | <reponame>jeffw-github/autoprotocol-python
import json
class TestUtils:
@staticmethod
def read_json_file(file_path: str):
file = open("./test/data/{0}".format(file_path))
data = json.load(file)
return json.dumps(data, indent=2, sort_keys=True)
|
code/get_ordinals.py | lebronlambert/Information_Extraction_DeepRL | 251 | 41244 | <gh_stars>100-1000
import pickle
import inflect
p = inflect.engine()
words = set(['first','second','third','fourth','fifth','sixth','seventh','eighth','ninth','tenth','eleventh','twelfth','thirteenth','fourteenth','fifteenth',
'sixteenth','seventeenth','eighteenth','nineteenth','twentieth','twenty-first','twenty-secon... |
plenum/test/pool_transactions/test_change_ha_persists_post_nodes_restart.py | andkononykhin/plenum | 148 | 41257 | <reponame>andkononykhin/plenum
from plenum.common.util import hexToFriendly, randomString
from stp_core.common.log import getlogger
from plenum.test.node_catchup.helper import waitNodeDataEquality
from plenum.test.node_request.helper import sdk_ensure_pool_functional
from plenum.test.pool_transactions.helper import sdk... |
setup.py | tgsmith61591/smite | 113 | 41261 | # -*- coding: utf-8 -*-
#
# Author: <NAME> <<EMAIL>>
#
# Setup the SMRT module
from __future__ import print_function, absolute_import, division
from distutils.command.clean import clean
# from setuptools import setup # DO NOT use setuptools!!!!!!
import shutil
import os
import sys
if sys.version_info[0] < 3:
imp... |
applications/CableNetApplication/python_scripts/edge_cable_element_process.py | lkusch/Kratos | 778 | 41268 | <reponame>lkusch/Kratos<gh_stars>100-1000
import KratosMultiphysics as KratosMultiphysics
import KratosMultiphysics.CableNetApplication as CableNetApplication
from KratosMultiphysics import Logger
def Factory(settings, Model):
if(type(settings) != KratosMultiphysics.Parameters):
raise Exception("expected ... |
tf_verify/spatial/t_2_norm_transformer.py | Neelanjana314/eran | 254 | 41271 | <reponame>Neelanjana314/eran<filename>tf_verify/spatial/t_2_norm_transformer.py
"""
Copyright 2020 ETH Zurich, Secure, Reliable, and Intelligent Systems Lab
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 ... |
landlab/components/species_evolution/zone_controller.py | amanaster2/landlab | 257 | 41274 | #!/usr/bin/env python
# -*- coding: utf-8 -*-
"""ZoneController of SpeciesEvolver."""
import numpy as np
from scipy.ndimage.measurements import label
from .record import Record
from .zone import Zone, _update_zones
from .zone_taxon import ZoneTaxon
class ZoneController(object):
"""Controls zones and populates th... |
torchbenchmark/models/fastNLP/fastNLP/core/batch.py | Chillee/benchmark | 2,693 | 41275 | <gh_stars>1000+
r"""
batch 模块实现了 fastNLP 所需的 :class:`~fastNLP.core.batch.DataSetIter` 类。
"""
__all__ = [
"BatchIter",
"DataSetIter",
"TorchLoaderIter",
]
import atexit
import abc
from numbers import Number
import numpy as np
import torch
import torch.utils.data
from collections import defaultdict
from .... |
hungarian_tf_tests.py | shaolinkhoa/rec-attend-public | 118 | 41277 | import numpy as np
import tensorflow as tf
import unittest
hungarian_module = tf.load_op_library("hungarian.so")
class HungarianTests(unittest.TestCase):
def test_min_weighted_bp_cover_1(self):
W = np.array([[3, 2, 2], [1, 2, 0], [2, 2, 1]])
M, c_0, c_1 = hungarian_module.hungarian(W)
with tf.Session()... |
bcs-ui/backend/templatesets/legacy_apps/configuration/k8s/constants.py | laodiu/bk-bcs | 599 | 41278 | <gh_stars>100-1000
# -*- coding: utf-8 -*-
"""
Tencent is pleased to support the open source community by making 蓝鲸智云PaaS平台社区版 (BlueKing PaaS Community
Edition) available.
Copyright (C) 2017-2021 TH<NAME>, a Tencent company. All rights reserved.
Licensed under the MIT License (the "License"); you may not use this file ... |
modules/dbnd-airflow/test_dbnd_airflow/test_logging.py | ipattarapong/dbnd | 224 | 41299 | import logging
from logging.config import dictConfig
import dbnd
from dbnd.testing.helpers import run_dbnd_subprocess__with_home
from dbnd_airflow_contrib.dbnd_airflow_default_logger import DEFAULT_LOGGING_CONFIG
class TestDbndAirflowLogging(object):
def test_dbnd_airflow_logging_conifg(self):
# we imp... |
scrounger/modules/analysis/ios/app_transport_security.py | noraj/scrounger | 217 | 41316 | <filename>scrounger/modules/analysis/ios/app_transport_security.py
from scrounger.core.module import BaseModule
#helper functions
from scrounger.utils.ios import plist_dict_to_xml, plist
from scrounger.utils.config import Log
class Module(BaseModule):
meta = {
"author": "RDC",
"description": "Chec... |
test/test_parsetron.py | clinc/parsetron | 123 | 41323 | <gh_stars>100-1000
from parsetron import * # NOQA
import re
import pytest
__author__ = '<NAME>'
class TestMul(object):
def test_mul(self):
s = String("t")('t')
# valid grammar:
class G(Grammar):
GOAL = s * 1
s_1 = RobustParser(G())
assert s_1.print_parse("t"... |
combo/blm/basis/__init__.py | zhangkunliang/BayesOptimization | 139 | 41334 | <reponame>zhangkunliang/BayesOptimization
from fourier import fourier
|
Chapter 06/code/prime.py | shivampotdar/Artificial-Intelligence-with-Python | 387 | 41352 | <gh_stars>100-1000
import itertools as it
import logpy.core as lc
from sympy.ntheory.generate import prime, isprime
# Check if the elements of x are prime
def check_prime(x):
if lc.isvar(x):
return lc.condeseq([(lc.eq, x, p)] for p in map(prime, it.count(1)))
else:
return lc.success if isprime... |
transpyle/general/misc.py | EraYaN/transpyle | 107 | 41361 | <gh_stars>100-1000
"""Various utility functions."""
import ast
import collections.abc
import typing as t
import typed_ast.ast3 as typed_ast3
def dict_mirror(dict_: dict):
return {value: key for key, value in dict_.items() if value is not None}
def flatten_sequence(sequence: t.MutableSequence[t.Any]) -> None:
... |
alipay/aop/api/domain/EntityBasicInfo.py | antopen/alipay-sdk-python-all | 213 | 41366 | #!/usr/bin/env python
# -*- coding: utf-8 -*-
import json
from alipay.aop.api.constant.ParamConstants import *
class EntityBasicInfo(object):
def __init__(self):
self._address_desc = None
self._category_code = None
self._city = None
self._contact_number = None
self._entit... |
old/eval_scripts/evaluate_model.py | konatasick/face-of-art | 220 | 41385 | <filename>old/eval_scripts/evaluate_model.py
from evaluation_functions import *
flags = tf.app.flags
data_dir = '/Users/arik/Dropbox/a_mac_thesis/face_heatmap_networks/conventional_landmark_detection_dataset/'
model_path = '/Users/arik/Dropbox/a_mac_thesis/face_heatmap_networks/tests/primary/old/no_flip/basic/' \
... |
pywick/models/segmentation/testnets/drnet/__init__.py | achaiah/pywick | 408 | 41402 | from .drnet import DRNet |
src/logos.py | NitikaGupta16/logohunter | 128 | 41415 | <filename>src/logos.py
import cv2
import numpy as np
import os
from PIL import Image
from timeit import default_timer as timer
import utils
from utils import contents_of_bbox, features_from_image
from similarity import load_brands_compute_cutoffs, similar_matches, similarity_cutoff, draw_matches
def detect_logo(yolo... |
RecoLocalCalo/Configuration/python/ecalLocalRecoSequenceCosmics_cff.py | Purva-Chaudhari/cmssw | 852 | 41439 | <reponame>Purva-Chaudhari/cmssw
import FWCore.ParameterSet.Config as cms
# Calo geometry service model
#
# removed by tommaso
#
#ECAL conditions
# include "CalibCalorimetry/EcalTrivialCondModules/data/EcalTrivialCondRetriever.cfi"
#
#TPG condition needed by ecalRecHit producer if TT recovery is ON
from RecoLocalCalo.... |
onnxruntime/test/python/quantization/test_op_relu.py | jamill/onnxruntime | 669 | 41446 | #!/usr/bin/env python
# coding: utf-8
# -------------------------------------------------------------------------
# Copyright (c) Microsoft Corporation. All rights reserved.
# Licensed under the MIT License. See License.txt in the project root for
# license information.
# -----------------------------------------------... |
tests/config/test_structure.py | gcollard/lightbus | 178 | 41452 | <filename>tests/config/test_structure.py
import pytest
from lightbus.config.structure import make_transport_selector_structure, ApiConfig, RootConfig
pytestmark = pytest.mark.unit
def test_make_transport_config_structure():
EventTransportSelector = make_transport_selector_structure("event")
assert "redis" i... |
mathics/builtin/files_io/__init__.py | skirpichev/Mathics | 1,920 | 41454 | <filename>mathics/builtin/files_io/__init__.py
"""
Input/Output, Files, and Filesystem
"""
from mathics.version import __version__ # noqa used in loading to check consistency.
|
SimGeneral/MixingModule/python/pileupVtxDigitizer_cfi.py | ckamtsikis/cmssw | 852 | 41459 | import FWCore.ParameterSet.Config as cms
pileupVtxDigitizer = cms.PSet(
accumulatorType = cms.string("PileupVertexAccumulator"),
hitsProducer = cms.string('generator'),
vtxTag = cms.InputTag("generatorSmeared"),
vtxFallbackTag = cms.InputTag("generator"),
makeDigiSimLinks = cms.untracked.bool(False... |
basisnet/personalization/centralized_so_nwp/stackoverflow_basis_models.py | xxdreck/google-research | 23,901 | 41461 | <reponame>xxdreck/google-research<filename>basisnet/personalization/centralized_so_nwp/stackoverflow_basis_models.py<gh_stars>1000+
# coding=utf-8
# Copyright 2021 The Google Research Authors.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the L... |
tests/test_node_symlink.py | odidev/anytree | 700 | 41502 | <gh_stars>100-1000
# -*- coding: utf-8 -*-
from nose.tools import eq_
from anytree import AnyNode
from anytree import Node
from anytree import NodeMixin
from anytree import PostOrderIter
from anytree import PreOrderIter
from anytree import SymlinkNode
def test_symlink():
root = Node("root")
s0 = Node("sub0"... |
python/akg/ops/array/tile.py | tianjiashuo/akg | 286 | 41503 | # Copyright 2020-2021 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
#
# Unless required by applicable law or agre... |
test_bot/cogs/misc.py | Enegg/disnake | 290 | 41508 | <filename>test_bot/cogs/misc.py
import io
from base64 import b64decode
import disnake
from disnake.ext import commands
class Misc(commands.Cog):
def __init__(self, bot):
self.bot: commands.Bot = bot
def _get_file(self, description: str) -> disnake.File:
# just a white 100x100 png
dat... |
tests/test_config.py | DuXiao1997/lyrebird | 223 | 41525 | <gh_stars>100-1000
from lyrebird import config
from pathlib import Path
import json
import codecs
def test_create(tmpdir):
custom_config = {"myconf":"myval"}
conf_path = Path(tmpdir)/'conf.json'
with codecs.open(conf_path, 'w', 'utf-8') as f:
f.write(json.dumps(custom_config, indent=4, ensure_asci... |
scvi/external/__init__.py | njbernstein/scvi-tools | 398 | 41533 | <gh_stars>100-1000
from .cellassign import CellAssign
from .gimvi import GIMVI
from .solo import SOLO
from .stereoscope import RNAStereoscope, SpatialStereoscope
__all__ = ["SOLO", "GIMVI", "RNAStereoscope", "SpatialStereoscope", "CellAssign"]
|
edb/common/binwrapper.py | aaronbrighton/edgedb | 7,302 | 41552 | <filename>edb/common/binwrapper.py
#
# This source file is part of the EdgeDB open source project.
#
# Copyright 2019-present MagicStack Inc. and the EdgeDB authors.
#
# 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 ... |
tests/test_resource_library_parser.py | tervay/the-blue-alliance | 266 | 41553 | import unittest2
import json
from datafeeds.resource_library_parser import ResourceLibraryParser
class TestResourceLibraryParser(unittest2.TestCase):
def test_parse_hall_of_fame(self):
with open('test_data/hall_of_fame.html', 'r') as f:
teams, _ = ResourceLibraryParser.parse(f.read())
... |
atlas-aapt/external/libcxx/run-tests.py | MaTriXy/atlas | 8,865 | 41578 | #
# Copyright (C) 2015 The Android Open Source Project
#
# 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 la... |
opennre/tokenization/basic_tokenizer.py | WinterSoHot/OpenNRE | 3,284 | 41592 | # coding=utf-8
# Copyright 2018 The Google AI Language Team Authors.
#
# 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 ... |
djangae/models.py | bocribbz/djangae | 467 | 41612 | from django.db import models
from djangae import patches # noqa
class DeferIterationMarker(models.Model):
"""
Marker to keep track of sharded defer
iteration tasks
"""
# Set to True when all shards have been deferred
is_ready = models.BooleanField(default=False)
shard_count = m... |
aws-blog-campanile/bin/objectcopy.py | securityscorecard/aws-big-data-blog | 305 | 41629 | #!/usr/bin/python2.7
import sys
import os
import fileinput
import argparse
import random
import tempfile
import ConfigParser
# -----------------------------------------------------------------------------
# Support for Hadoop Streaming Sandbox Env
# -------------------------------------------------------------------... |
smart_open/tests/test_package.py | sivchand/smart_open | 2,047 | 41635 | <reponame>sivchand/smart_open<filename>smart_open/tests/test_package.py
# -*- coding: utf-8 -*-
import os
import unittest
import pytest
from smart_open import open
skip_tests = "SMART_OPEN_TEST_MISSING_DEPS" not in os.environ
class PackageTests(unittest.TestCase):
@pytest.mark.skipif(skip_tests, reason="requir... |
src/commands/jsdoc/generate_jsdoc.py | PranjalPansuriya/JavaScriptEnhancements | 690 | 41661 | import sublime, sublime_plugin
import os
from ...libs import util
from ...libs import JavascriptEnhancementsExecuteOnTerminalCommand
class JavascriptEnhancementsGenerateJsdocCommand(JavascriptEnhancementsExecuteOnTerminalCommand, sublime_plugin.WindowCommand):
is_node = True
is_bin_path = True
def prepare_comm... |
src/architectures/transformer_encoder.py | francismontalbo/attention-is-all-you-need-paper | 167 | 41665 | import torch.nn as nn
from architectures.position_wise_feed_forward_net import PositionWiseFeedForwardNet
from architectures.multi_head_attention import MultiHeadAttention
from architectures.add_and_norm import AddAndNorm
class TransformerEncoderBlock(nn.Module):
def __init__(self, d_model, n_heads, d_ff, dropout... |
Payloads/Zip-Traversal/make.py | 5tr1x/SecLists | 39,901 | 41668 | #!/usr/bin/env python3
import zipfile
# The file to USE inside the zip, before compression
filein = "index.php"
print("[i] FileIn: %s\n" % filein)
# How deep are we going?
depth = ""
# Loop 11 times (00-10)
for i in range(11):
# The .zip file to use
zipname = "depth-%02d.zip" % i
print("[i] ZipName: %s" % zip... |
addons/Sprytile-6b68d00/rx/linq/observable/transduce.py | trisadmeslek/V-Sekai-Blender-tools | 733 | 41679 | """Transducers for RxPY.
There are several different implementations of transducers in Python.
This implementation is currently targeted for:
- http://code.sixty-north.com/python-transducers
You should also read the excellent article series "Understanding
Transducers through Python" at:
- http://sixty-north.com/bl... |
tests/api/endpoints/admin/test_institution_users.py | weimens/seahub | 420 | 41706 | import json
import logging
from django.urls import reverse
from seahub.test_utils import BaseTestCase
from tests.common.utils import randstring
from seahub.institutions.models import Institution, InstitutionAdmin
from seahub.profile.models import Profile
logger = logging.getLogger(__name__)
class AdminInstitutionUs... |
sdk/python/pulumi_azure/appservice/public_certificate.py | henriktao/pulumi-azure | 109 | 41716 | <reponame>henriktao/pulumi-azure<filename>sdk/python/pulumi_azure/appservice/public_certificate.py
# coding=utf-8
# *** WARNING: this file was generated by the Pulumi Terraform Bridge (tfgen) Tool. ***
# *** Do not edit by hand unless you're certain you know what you are doing! ***
import warnings
import pulumi
import... |
stackoverflow/spiders/items.py | Janeho454199/stackoverflow-spider | 131 | 41725 | <filename>stackoverflow/spiders/items.py
#!/usr/bin/env python
# -*- coding: utf-8 -*-
import scrapy
class StackoverflowItem(scrapy.Item):
links = scrapy.Field()
views = scrapy.Field()
votes = scrapy.Field()
answers = scrapy.Field()
tags = scrapy.Field()
questions = scrapy.Field()
|
entity/query_item.py | will4906/PatentCrawler | 136 | 41735 | <reponame>will4906/PatentCrawler<gh_stars>100-1000
# -*- coding: utf-8 -*-
"""
Created on 2017/3/19
@author: will4906
"""
import re
def handle_item_group(item_group):
"""
处理item_group函数
:param item_group:
:return:
"""
AND = ' AND '
OR = ' OR '
NOT = ' NOT '
exp_str = ""
keyand... |
feature_engine/imputation/drop_missing_data.py | kylegilde/feature_engine | 196 | 41746 | # Authors: <NAME> <<EMAIL>>
# License: BSD 3 clause
from typing import List, Optional, Union
import pandas as pd
from feature_engine.dataframe_checks import _is_dataframe
from feature_engine.imputation.base_imputer import BaseImputer
from feature_engine.variable_manipulation import _check_input_parameter_variables
... |
dev/examples/tungraph.py | Cam2337/snap-python | 242 | 41768 | <gh_stars>100-1000
import random
import sys
sys.path.append("../swig-r")
import snap
def PrintGStats(s, Graph):
'''
Print graph statistics
'''
print "graph %s, nodes %d, edges %d, empty %s" % (
s, Graph.GetNodes(), Graph.GetEdges(),
"yes" if Graph.Empty() else "no")
def DefaultConst... |
doc/source/conf.py | Steap/glance | 309 | 41775 | # Copyright (c) 2010 OpenStack Foundation.
#
# 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... |
test_frame/test_redis_ack_able/test_redis_ack_able_consumer.py | DJMIN/funboost | 120 | 41829 | """
这个是用来测试,以redis为中间件,随意关闭代码会不会造成任务丢失的。
"""
import time
from funboost import boost,BrokerEnum
@boost('test_cost_long_time_fun_queue2', broker_kind=BrokerEnum.REDIS_ACK_ABLE, concurrent_num=5)
def cost_long_time_fun(x):
print(f'正在消费 {x} 中 。。。。')
time.sleep(3)
print(f'消费完成 {x} ')
if __name__ == '__main__'... |
observations/r/edc_t.py | hajime9652/observations | 199 | 41839 | # -*- 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 edc_t(path):
"""EPICA Dome C Ice Core 800KYr Temperature Estimates
... |
exercises/es/test_01_02_02.py | Jette16/spacy-course | 2,085 | 41851 | <filename>exercises/es/test_01_02_02.py<gh_stars>1000+
def test():
import spacy.tokens
import spacy.lang.de
assert isinstance(
nlp, spacy.lang.de.German
), "El objeto nlp debería ser un instance de la clase de alemán."
assert isinstance(
doc, spacy.tokens.Doc
), "¿Procesaste el ... |
modules/core/dbshell/dbshell.py | petabyteboy/nixcloud-webservices | 121 | 41905 | <filename>modules/core/dbshell/dbshell.py<gh_stars>100-1000
#!@interpreter@
import os
from pwd import getpwnam
from argparse import ArgumentParser
DBSHELL_CONFIG = @dbshellConfig@ # noqa
WEBSERVICES_PREFIX = "/var/lib/nixcloud/webservices"
def run_shell(dbname, user, command):
os.setuid(getpwnam(user).pw_uid)
... |
wxpusher/tests/test_send_message.py | hnauto/wxpusher-sdk-python | 124 | 41914 | <filename>wxpusher/tests/test_send_message.py
#!/usr/bin/env python
# -*- coding: utf-8 -*-
"""
Unittest for sending message.
File: test_send_message.py
Author: huxuan
Email: <EMAIL>
"""
import unittest
from wxpusher import WxPusher
from . import config
class TestSendMessage(unittest.TestCase):
"""Unittest for... |
apps/jobs/migrations/0014_rename_job_id_field_in_submission_model_to_job_name.py | kaustubh-s1/EvalAI | 1,470 | 41937 | # -*- coding: utf-8 -*-
# Generated by Django 1.11.23 on 2020-01-20 05:23
from __future__ import unicode_literals
from django.db import migrations
class Migration(migrations.Migration):
dependencies = [("jobs", "0013_add_job_id_field_in_submission_model")]
operations = [
migrations.RenameField(
... |
rotkehlchen/tests/exchanges/test_independentreserve.py | rotkehlchenio/rotkehlchen | 137 | 41963 | <reponame>rotkehlchenio/rotkehlchen<gh_stars>100-1000
import warnings as test_warnings
from unittest.mock import patch
import pytest
from rotkehlchen.accounting.structures.balance import Balance
from rotkehlchen.constants.assets import A_AUD, A_ETC, A_ETH
from rotkehlchen.errors.asset import UnknownAsset
from rotkehl... |
ctpbee/interface/ctp_mini/lib.py | mcFore/ctpbee | 461 | 41967 | <reponame>mcFore/ctpbee<filename>ctpbee/interface/ctp_mini/lib.py<gh_stars>100-1000
import pytz
from ctpbee_api.ctp_mini import *
from ctpbee.constant import *
STATUS_MINI2VT = {
THOST_FTDC_OAS_Submitted: Status.SUBMITTING,
THOST_FTDC_OAS_Accepted: Status.SUBMITTING,
THOST_FTDC_OAS_Rejected: Status.REJECT... |
app/update_logs_test.py | limshengli/tinypilot | 1,334 | 41977 | import unittest
import update_logs
class UpdateLogsTest(unittest.TestCase):
def test_get_new_logs_with_more_next_logs(self):
self.assertEqual(
"56789",
update_logs.get_new_logs(prev_logs="01234", next_logs="0123456789"))
def test_get_new_logs_with_more_prev_logs(self):
... |
sdk/python/pulumi_gcp/compute/region_instance_group_manager.py | sisisin/pulumi-gcp | 121 | 42004 | <filename>sdk/python/pulumi_gcp/compute/region_instance_group_manager.py<gh_stars>100-1000
# coding=utf-8
# *** WARNING: this file was generated by the Pulumi Terraform Bridge (tfgen) Tool. ***
# *** Do not edit by hand unless you're certain you know what you are doing! ***
import warnings
import pulumi
import pulumi.... |
webapp/models/mnist_model.py | dushik/AdversarialDNN-Playground | 125 | 42013 | <filename>webapp/models/mnist_model.py<gh_stars>100-1000
import tensorflow as tf
from tensorflow.examples.tutorials.mnist import input_data
def weight_variable(shape):
initial = tf.truncated_normal(shape, stddev=0.1)
return tf.Variable(initial)
def bias_variable(shape):
initial=tf.constant(0.1, shape=shape)
r... |
eosfactory/core/vscode.py | tuan-tl/eosfactory | 255 | 42091 | '''
.. module:: eosfactory.core.vscode
:platform: Unix, Darwin
:synopsis: Default configuration items of a contract project.
.. moduleauthor:: Tokenika
'''
import json
import argparse
import eosfactory.core.config as config
INCLUDE_PATH = "includePath"
LIBS = "libs"
CODE_OPTIONS = "codeOptions"
TEST_OPTIONS ... |
tests/functional/services/policy_engine/utils/api/query_vulnerabilities.py | rbrady/anchore-engine | 1,484 | 42092 | from tests.functional.services.policy_engine.utils.api.conf import (
policy_engine_api_conf,
)
from tests.functional.services.utils import http_utils
def get_vulnerabilities(
vulnerability_ids=[],
affected_package=None,
affected_package_version=None,
namespace=None,
):
if not vulnerability_ids... |
admin_tools/theming/apps.py | asherf/django-admin-tools | 711 | 42093 | <gh_stars>100-1000
# coding: utf-8
from django.apps import AppConfig
class ThemingConfig(AppConfig):
name = 'admin_tools.theming'
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.