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
Graphs/cc.py
Prince23598/cs-algorithms
239
12640889
#!/usr/bin/env python3 # Reference: Rosalind (http://rosalind.info/problems/cc/) def cc(g): """ >>> graph = [[1, 4], [0], [3, 6, 7], [2, 7], [0, 8, 9], [], [2, 10], \ [2, 3, 10, 11], [4, 9], [4, 8], [6, 7, 11], [10, 7]] >>> cc(graph) 3 """ def dfs(g, t, seen): for v in...
model/carn.py
Gummary/denet
343
12640905
""" CutBlur Copyright 2020-present NAVER corp. MIT license Referenced from PCARN-pytorch, https://github.com/nmhkahn/PCARN-pytorch """ import torch import torch.nn as nn from model import ops class Group(nn.Module): def __init__(self, num_channels, num_blocks, res_scale=1.0): super().__init__() fo...
evennia/contrib/ingame_python/scripts.py
Jaykingamez/evennia
1,544
12640910
<gh_stars>1000+ """ Scripts for the in-game Python system. """ from datetime import datetime, timedelta from queue import Queue import re import sys import traceback from django.conf import settings from evennia import DefaultObject, DefaultScript, ChannelDB, ScriptDB from evennia import logger, ObjectDB from evennia...
alipay/aop/api/response/AlipayMarketingCdpRecommendQueryResponse.py
snowxmas/alipay-sdk-python-all
213
12640921
<reponame>snowxmas/alipay-sdk-python-all #!/usr/bin/env python # -*- coding: utf-8 -*- import json from alipay.aop.api.response.AlipayResponse import AlipayResponse class AlipayMarketingCdpRecommendQueryResponse(AlipayResponse): def __init__(self): super(AlipayMarketingCdpRecommendQueryResponse, self)._...
descarteslabs/scenes/tests/test_search.py
descarteslabs/descarteslabs-python
167
12640928
import unittest import datetime from descarteslabs.scenes import geocontext, search from shapely.geometry import shape import mock from .mock_data import _metadata_search, _cached_bands_by_product class TestScenesSearch(unittest.TestCase): geom = { "coordinates": ( ( (-95.836...
snips_nlu/slot_filler/crf_utils.py
CharlyBlavier/snips-nlu-Copy
3,764
12640930
<gh_stars>1000+ from __future__ import unicode_literals from builtins import range from enum import Enum, unique from snips_nlu.constants import END, SLOT_NAME, START, TEXT from snips_nlu.preprocessing import Token, tokenize from snips_nlu.result import unresolved_slot BEGINNING_PREFIX = "B-" INSIDE_PREFIX = "I-" LA...
tests/test_check_www_redirect.py
Prodject/yawast
200
12640973
# Copyright (c) 2013 - 2020 <NAME> and Contributors. # This file is part of YAWAST which is released under the MIT license. # See the LICENSE file or go to https://yawast.org/license/ for full license details. from unittest import TestCase from yawast.shared import network class TestCheckWwwRedirect(TestCase): ...
tests/buildah_test.py
msaladna/mitogen
1,526
12640990
import os import mitogen import unittest2 import testlib class ConstructorTest(testlib.RouterMixin, testlib.TestCase): def test_okay(self): buildah_path = testlib.data_path('stubs/stub-buildah.py') context = self.router.buildah( container='container_name', buildah_path=b...
auctioning_platform/shipping_infrastructure/shipping_infrastructure/repositories/__init__.py
nhdinh/smp-modulith
299
12640997
__all__ = ["FakeAddressRepository"] from shipping_infrastructure.repositories.address import FakeAddressRepository
scripts/androaxml.py
jamjven/ATX
1,132
12641015
<reponame>jamjven/ATX #!/usr/bin/env python # This file is part of Androguard. # # Copyright (C) 2012, <NAME> <desnos at t0t0.fr> # All rights reserved. # # Androguard is free software: you can redistribute it and/or modify # it under the terms of the GNU Lesser General Public License as published by # the Free Softwa...
python/veles/tests/schema/test_polymodel.py
pombredanne/veles
918
12641018
# Copyright 2017 CodiLime # # 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, softwar...
chrome/updater/run_updater_tests.py
Ron423c/chromium
575
12641025
# Copyright 2020 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 argparse import logging import os import shutil import sys from test.integration_tests.common import path_finder path_finder.add_typ_dir_to_sys_path(...
Packs/IntegrationsAndIncidentsHealthCheck/Scripts/GetFailedTasks/test_data/constants.py
diCagri/content
799
12641029
<reponame>diCagri/content INCIDENTS_RESULT = [ {'ModuleName': 'InnerServicesModule', 'Brand': 'Builtin', 'Category': 'Builtin', 'ID': '', 'Version': 0, 'Type': 1, 'Contents': { 'ErrorsPrivateDoNotUse': None, 'data': [ { 'CustomFields': {'dbotpredictionprobability': 0, ...
FWCore/Services/test/test_zombiekiller_fail_cfg.py
ckamtsikis/cmssw
852
12641035
<filename>FWCore/Services/test/test_zombiekiller_fail_cfg.py import FWCore.ParameterSet.Config as cms process = cms.Process("TEST") process.source = cms.Source("EmptySource") process.maxEvents = cms.untracked.PSet(input = cms.untracked.int32(-1)) process.stuck = cms.EDAnalyzer("StuckAnalyzer") process.p = cms.Path(...
code/utils/effective_loss_function.py
ricklentz/2dimageto3dmodel
150
12641037
# author: <NAME> import torch import torch.nn as nn from ..camera.coordinate_system_transformation import CameraUtilities from trilinear_interpolation import TrilinearInterpolation from smooth_voxels import VoxelsSmooth class EffectiveLossFunction(nn.Module): # Replaces need for differentiable point cloud projec...
add_gitutf16.py
mayl8822/CommandTrayHost
353
12641040
# /usr/bin/env python3 # -*- coding: utf-8 -*- import os import re import sys import codecs import traceback UTF16_GITCONFIG = '''[filter "utf16"] clean = iconv -f utf-16le -t utf-8 smudge = iconv -f utf-8 -t utf-16le required ''' def main(): git_config_path = os.path.expandvars(r'%USERPROFILE%\.git...
src/obfuscapk/obfuscators/method_overload/method_overload.py
Elyorbe/Obfuscapk
688
12641043
<gh_stars>100-1000 #!/usr/bin/env python3 import logging import random from typing import List, Set from obfuscapk import obfuscator_category from obfuscapk import util from obfuscapk.obfuscation import Obfuscation class MethodOverload(obfuscator_category.ICodeObfuscator): def __init__(self): self.logge...
test/unit/test_model_optimizer.py
Zhiyuan-w/DeepReg
379
12641046
<reponame>Zhiyuan-w/DeepReg # coding=utf-8 """ Tests for deepreg/model/optimizer.py pytest style """ import tensorflow as tf import deepreg.model.optimizer as optimizer class TestBuildOptimizer: def test_build_optimizer_adam(self): """Build an Adam optimizer""" opt_config = {"name": "Adam", "lea...
cleanerversion/settings/sqlite.py
DocTocToc/cleanerversion
121
12641077
""" Django settings for CleanerVersion project. """ from .base import * # Database # https://docs.djangoproject.com/en/dev/ref/settings/#databases DATABASES = { 'default': { 'ENGINE': 'django.db.backends.sqlite3', 'NAME': 'sqlite.db', 'USER': '', 'PASSWORD': '', 'HOST': '',...
base/models/base_module.py
CJWBW/TediGAN
219
12641127
<reponame>CJWBW/TediGAN<filename>base/models/base_module.py # python 3.7 """Contains the base class for modules in a GAN model. Commonly, GAN consists of two components, i.e., generator and discriminator. In practice, however, more modules can be added, such as encoder. """ import os.path import sys import logging im...
geoq/settings.py
kaydoh/geoq
471
12641154
<reponame>kaydoh/geoq # -*- coding: utf-8 -*- # This technical data was produced for the U. S. Government under Contract No. W15P7T-13-C-F600, and # is subject to the Rights in Technical Data-Noncommercial Items clause at DFARS 252.227-7013 (FEB 2012) import os SITE_ROOT = os.path.dirname(os.path.realpath(__file__)) ...
graphs/models/custom_layers/denseblock.py
algocompretto/template-deep-learning
696
12641182
<reponame>algocompretto/template-deep-learning """ Definitions for custom blocks for condensenet model """ import torch import torch.nn as nn from graphs.models.custom_layers.learnedgroupconv import LearnedGroupConv class DenseBlock(nn.Sequential): def __init__(self, num_layers, in_channels, growth_rate, config): ...
samples/vsphere/oauth/grant_types/list_vms_client_credentials.py
CypherLegacy/anamorphicBI
589
12641193
#!/usr/bin/env python """ * ******************************************************* * Copyright (c) VMware, Inc. 2020. All Rights Reserved. * SPDX-License-Identifier: MIT * ******************************************************* * * DISCLAIMER. THIS PROGRAM IS PROVIDED TO YOU "AS IS" WITHOUT * WARRANTIES OR CONDITIONS...
cli/tests/pcluster3_config_converter/test_pcluster3_config_converter.py
enrico-usai/cfncluster
415
12641217
<filename>cli/tests/pcluster3_config_converter/test_pcluster3_config_converter.py # Copyright 2021 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 l...
exp.voc/voc8.res50v3+.CCT/train.py
Yongjin-colin-choi/TorchSemiSeg
268
12641242
<filename>exp.voc/voc8.res50v3+.CCT/train.py from __future__ import division import os.path as osp import os import sys import time import argparse from tqdm import tqdm import torch import torch.nn as nn import torch.distributed as dist import torch.backends.cudnn as cudnn from config import config from dataloader i...
var/spack/repos/builtin/packages/tippecanoe/package.py
kkauder/spack
2,360
12641257
<filename>var/spack/repos/builtin/packages/tippecanoe/package.py<gh_stars>1000+ # Copyright 2013-2021 Lawrence Livermore National Security, LLC and other # Spack Project Developers. See the top-level COPYRIGHT file for details. # # SPDX-License-Identifier: (Apache-2.0 OR MIT) from spack import * class Tippecanoe(Ma...
tests/integration/pybaseball/datasources/test_fg_pitching_data.py
reddigari/pybaseball
650
12641271
<reponame>reddigari/pybaseball<filename>tests/integration/pybaseball/datasources/test_fg_pitching_data.py from typing import Callable import pandas as pd import pytest from pybaseball.datasources.fangraphs import fg_pitching_data from pybaseball.enums.fangraphs.pitching_data_enum import FangraphsPitchingStats from te...
tests/__init__.py
steve1aa/microdot
173
12641275
<reponame>steve1aa/microdot from tests.microdot.test_multidict import TestMultiDict from tests.microdot.test_request import TestRequest from tests.microdot.test_response import TestResponse from tests.microdot.test_url_pattern import TestURLPattern from tests.microdot.test_microdot import TestMicrodot from tests.micro...
tests/ae_example/models/autoencoder.py
agr17/pytorch-msssim
461
12641279
import torch import torch.nn as nn import torch.nn.functional as F import math from .gdn import GDN # https://arxiv.org/pdf/1611.01704.pdf # A simplfied version without quantization class AutoEncoder(nn.Module): def __init__(self, C=128, M=128, in_chan=3, out_chan=3): super(AutoEncoder, self).__init__() ...
stonesoup/types/tests/test_hypothesis.py
Red-Portal/Stone-Soup-1
157
12641280
# -*- coding: utf-8 -*- import numpy as np import pytest from ..prediction import StatePrediction, StateMeasurementPrediction from ..detection import Detection from ..track import Track from ..hypothesis import ( SingleHypothesis, SingleDistanceHypothesis, SingleProbabilityHypothesis, JointHypothesis, ...
bin/deepstate/executors/fuzz/libfuzzer.py
acpaquette/deepstate
684
12641325
#!/usr/bin/env python3.6 # Copyright (c) 2019 Trail of Bits, 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 app...
tests/resolution/evaluation/test_evaluate_resolved.py
mib1185/homeassistant-supervisor
597
12641372
<reponame>mib1185/homeassistant-supervisor<filename>tests/resolution/evaluation/test_evaluate_resolved.py """Test evaluate systemd-resolved.""" from unittest.mock import PropertyMock, patch from supervisor.const import CoreState from supervisor.coresys import CoreSys from supervisor.resolution.evaluations.resolved im...
wren/resources/constants.py
tzano/wren
245
12641374
<gh_stars>100-1000 # config files CONFIG_DIR = "config" # Link to DB Configuration DB_CONFIG_FILE = "db.yml" # Name of collection COLLECTION_NAME = 'collection_name' CONFIG_DIR = "config" CONFIG_FNAME = "rss_feeds.yml" PARAM_CONFIG_FILE = "services.yml" APP_KEYS_FILE = "keys.yml" NLU_CONFIG = "nlu_config.yml" MESSAGI...
utime/utils/scriptutils/predict.py
learning310/U-Time
138
12641400
""" A set of functions for running prediction in various settings """ import numpy as np def predict_on_generator(model, generator, argmax=False): """ Takes a tf.keras model and uses it to predict on all batches in a generator Stacks the predictions over all batches on axis 0 (vstack) Args: ...
api/accounts_api.py
liamnewmarch/chromium-dashboard
450
12641434
# -*- coding: utf-8 -*- # Copyright 2021 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/LICENSE-2.0 # # Unless required by applicable law or...
ckan/cli/dataset.py
gg2/ckan
2,805
12641453
# encoding: utf-8 import logging import pprint import click import ckan.logic as logic import ckan.model as model log = logging.getLogger(__name__) @click.group(short_help=u"Manage datasets") def dataset(): """Manage datasets. """ pass @dataset.command() @click.argument(u'package') def show(package...
hw3/plot_part1.py
whoiszyc/cs294-112_hws
102
12641464
import pandas as pd import os import matplotlib import matplotlib.pyplot as plt import seaborn as sns def read_result(exp_name): path = os.path.join('data', exp_name, 'log.txt') return pd.read_csv(path, sep='\t') def add_plot(data, var_name, label=''): sns.set(style="darkgrid", font_scale=1.5) plt.plo...
quantecon/optimize/pivoting.py
Smit-create/QuantEcon.py
1,462
12641469
<reponame>Smit-create/QuantEcon.py """ Contain pivoting routines commonly used in the Simplex Algorithm and Lemke-Howson Algorithm routines. """ import numpy as np from numba import jit TOL_PIV = 1e-10 TOL_RATIO_DIFF = 1e-15 @jit(nopython=True, cache=True) def _pivoting(tableau, pivot_col, pivot_row): """ ...
tests/tasks/twitter/test_twitter.py
concreted/prefect
8,633
12641470
import pytest import prefect from prefect.tasks.twitter import LoadTweetReplies from prefect.utilities.configuration import set_temporary_config class TestLoadTweetReplies: def test_initialize_with_nothing_sets_defaults(self): task = LoadTweetReplies() assert task.user is None assert task...
mpire/dashboard/__init__.py
synapticarbors/mpire
505
12641525
<reponame>synapticarbors/mpire<gh_stars>100-1000 try: from mpire.dashboard.dashboard import connect_to_dashboard, start_dashboard except (ImportError, ModuleNotFoundError): def connect_to_dashboard(*_, **__): raise NotImplementedError("Install the dashboard dependencies to enable the dashboard") de...
labs/03_neural_recsys/keras_fixes.py
soufiomario/labs-Deep-learning
1,398
12641535
"""Temporary workaround for keras bugs in merge modes. merge([...], mode='dot') and merge([...], mode='cos') do not return the correct output on 2D inputs. Those fixes only work with the TF backend. More details: https://github.com/fchollet/keras/issues/2626 """ import tensorflow as tf def dot_mode(inputs): ...
plugins/public/cinq-collector-dns/cinq_collector_dns/__init__.py
gibbsie/cloud-inquisitor
462
12641536
<reponame>gibbsie/cloud-inquisitor from collections import defaultdict import requests from cloud_inquisitor.config import dbconfig, ConfigOption from cloud_inquisitor.database import db from cloud_inquisitor.exceptions import CloudFlareError from cloud_inquisitor.plugins import BaseCollector, CollectorType from cloud...
src/holodeck/exceptions.py
LaudateCorpus1/holodeck
518
12641544
<gh_stars>100-1000 """Holodeck Exceptions""" class HolodeckException(Exception): """Base class for a generic exception in Holodeck.""" class HolodeckConfigurationException(HolodeckException): """The user provided an invalid configuration for Holodeck""" class TimeoutException(HolodeckException): """Ex...
tensorlayer/layers/convolution/quan_conv_bn.py
Howdy-Personally/tensorlayer-master
4,484
12641569
#! /usr/bin/python # -*- coding: utf-8 -*- import numpy as np import tensorflow as tf from tensorflow.python.training import moving_averages import tensorlayer as tl from tensorlayer import logging from tensorlayer.layers.core import Layer from tensorlayer.layers.utils import (quantize_active_overflow, quantize_weigh...
demos/common/python/openvino/model_zoo/model_api/models/model.py
kblaszczak-intel/open_model_zoo
2,201
12641596
<reponame>kblaszczak-intel/open_model_zoo """ Copyright (C) 2020-2022 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...
demos/text_to_speech_demo/python/utils/embeddings_processing.py
APrigarina/open_model_zoo
2,201
12641601
<filename>demos/text_to_speech_demo/python/utils/embeddings_processing.py import numpy as np class PCA: def __init__(self, n_components=1): self.mean = None self.eig_vectors = None self.n_components = n_components def build(self, x): m = np.mean(x, axis=0) xm = x - m ...
hypergbm/tests/experiment_test.py
oaksharks/HyperGBM
687
12641607
<reponame>oaksharks/HyperGBM # -*- coding:utf-8 -*- __author__ = 'yangjian' """ """ from datetime import datetime from sklearn.metrics import get_scorer from sklearn.model_selection import train_test_split from hypergbm import HyperGBM, CompeteExperiment, make_experiment from hypergbm.search_space import search_spac...
corehq/apps/notifications/urls.py
dimagilg/commcare-hq
471
12641632
from django.conf.urls import url from corehq.apps.notifications.views import ( ManageNotificationView, NotificationsServiceRMIView, ) urlpatterns = [ url(r"^service/$", NotificationsServiceRMIView.as_view(), name=NotificationsServiceRMIView.urlname), url(r"^manage/$", ManageNot...
tests/functional/python_tests/hived/replay_based_tests/vop_pagnation.py
drov0/hive
283
12641648
#!/usr/bin/python3 import sys import os import tempfile import argparse from threading import Thread sys.path.append("../../../") import hive_utils from hive_utils.resources.configini import config as configuration from hive_utils.resources.configini import validate_address # https://developers.hive.io/tutorials-r...
terrascript/vault/d.py
mjuenema/python-terrascript
507
12641710
<reponame>mjuenema/python-terrascript # terrascript/vault/d.py # Automatically generated by tools/makecode.py () import warnings warnings.warn( "using the 'legacy layout' is deprecated", DeprecationWarning, stacklevel=2 ) import terrascript class vault_approle_auth_backend_role_id(terrascript.Data): pass ...
demos/common/python/visualizers/instance_segmentation.py
alpkn/open_model_zoo
2,201
12641720
<reponame>alpkn/open_model_zoo """ Copyright (c) 2022 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 app...
codes/labs_lecture19/lab02_graph_clustering/util/graph_generator.py
sanjaysaha1311/Deep_Learning_CS7454_2018_NTU
221
12641722
<filename>codes/labs_lecture19/lab02_graph_clustering/util/graph_generator.py import numpy as np import block import torch import scipy.sparse as sp default_type='torch.cuda.FloatTensor' default_type='torch.FloatTensor' class variable_size_graph(): def __init__(self, task_parameters): # paramet...
pywick/datasets/MultiFolderDataset.py
achaiah/pywick
408
12641735
<gh_stars>100-1000 import itertools import os from PIL import Image from .FolderDataset import FolderDataset, npy_loader, pil_loader, rgb_image_loader, rgba_image_loader, _find_classes, _finds_inputs_and_targets class MultiFolderDataset(FolderDataset): """ This class extends the FolderDataset with abilty to ...
haskell/private/java.bzl
guibou/rules_haskell
222
12641752
"""Interop with Java.""" load("@bazel_skylib//lib:collections.bzl", "collections") JavaInteropInfo = provider( doc = "Information needed for interop with Java rules.", fields = { "inputs": "Files needed during build.", "env": "Dict with env variables that should be set during build.", }, )...
src/aptsources_cleanup/util/import_check.py
DazEB/aptsources-cleanup
461
12641774
# -*- coding: utf-8 __all__ = ('import_check',) from . import pkg from .gettext import _ from .terminal import termwrap from .filesystem import samefile import sys import os.path def import_check(module_name, apt_pkg_suffix, import_error=None, debug_fail=0): """Check for possible issues during the import of the gi...
autoimpute/imputations/series/ffill.py
gjdv/autoimpute
191
12641830
<reponame>gjdv/autoimpute<gh_stars>100-1000 """This module implements forward & backward imputation via two Imputers. The LOCFImputer carries the last observation forward (locf) to impute missing data in a time series. NOCBImputer carries the next observation backward (nocb) to impute missing data in a time series. Da...
panoptic_mapping_utils/src/detectron2/detectron_player.py
YuePanEdward/panoptic_mapping
101
12641831
#!/usr/bin/env python3 import os import json import csv import rospy from sensor_msgs.msg import Image from cv_bridge import CvBridge import cv2 from PIL import Image as PilImage import numpy as np import tf from panoptic_mapping_msgs.msg import DetectronLabel, DetectronLabels class DetectronPlayer(object): de...
test_project/select2_djhacker_formfield/urls.py
robertispas/django-autocomplete-light
1,368
12641852
<gh_stars>1000+ from dal import autocomplete from django.conf.urls import url from .models import TModel urlpatterns = [ url( 'test-autocomplete/$', autocomplete.Select2QuerySetView.as_view(model=TModel), name='select2_djhacker_formfield', ), ] import djhacker from django import fo...
examples/issues/issue138.py
tgolsson/appJar
666
12641866
import sys sys.path.append("../../") from appJar import gui def showDate(btn): print(app.getDatePicker("dp")) app=gui() app.startToggleFrame("Birthday") app.addDatePicker("dp") app.addButton("GET", showDate) app.stopToggleFrame() app.setDatePickerRange("dp", 1900, 2100) app.setDatePicker("dp") app.setDatePicke...
RecoEgamma/PhotonIdentification/python/egmPhotonIDs_cfi.py
ckamtsikis/cmssw
852
12641889
import FWCore.ParameterSet.Config as cms egmPhotonIDs = cms.EDProducer( "VersionedPhotonIdProducer", physicsObjectSrc = cms.InputTag('gedPhotons'), physicsObjectIDs = cms.VPSet( ) )
Clients/ParaView/Testing/XML/AnimatedExportSceneVerify.py
xj361685640/ParaView
815
12641893
import argparse import json import os import sys import zipfile parser = argparse.ArgumentParser(description='Verify AnimatedExportScene output.') parser.add_argument('-T', help='Test output directory') parser.add_argument('-N', help='Test name') args = parser.parse_args(sys.argv[1:]) # Open the vtkjs archive written...
tests/components/zha/test_logbook.py
mib1185/core
30,023
12641898
<gh_stars>1000+ """ZHA logbook describe events tests.""" from unittest.mock import patch import pytest import zigpy.profiles.zha import zigpy.zcl.clusters.general as general from homeassistant.components.zha.core.const import ZHA_EVENT from homeassistant.const import CONF_DEVICE_ID, CONF_UNIQUE_ID, Platform from hom...
demo_a3c_ale.py
wuyx/Asynchronous-Methods-for-Deep-Reinforcement-Learning
443
12641908
<reponame>wuyx/Asynchronous-Methods-for-Deep-Reinforcement-Learning<gh_stars>100-1000 import argparse import os import numpy as np import chainer from chainer import serializers import ale import random_seed from dqn_phi import dqn_phi from a3c_ale import A3CFF from a3c_ale import A3CLSTM def eval_performance(rom, ...
sampyl/tests/test_state.py
wilsonify/sampyl
308
12641912
from ..core import np from ..state import State state1 = State([('x', 1)]) state2 = State([('x', np.array([1, 2, 3]))]) state3 = State([('x', np.array([1,2,3])), ('y', 1)]) state4 = State([('x', np.array([2.]))]) state5 = State([('x', np.array([2,1,4])), ('y', 2)]) def test_add_states(): new = state3 + state5 ...
test_celluloid.py
maochongyuan/celluloid_animationPython
1,086
12641914
"""Test animations.""" # pylint: disable=wrong-import-position import numpy as np import matplotlib matplotlib.use('Agg') from matplotlib import pyplot as plt from celluloid import Camera def test_single(): """Test plt.figure()""" fig = plt.figure() camera = Camera(fig) for _ in range(10): p...
build/toolchain/gcc_compile_wrapper.py
fantasialin/cpp_sandbox
2,151
12641917
<reponame>fantasialin/cpp_sandbox<filename>build/toolchain/gcc_compile_wrapper.py<gh_stars>1000+ #!/usr/bin/env python # 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. """Runs a compilation command. This s...
usaspending_api/download/tests/unit/test_base_download_helpers.py
ststuck/usaspending-api
217
12641943
<reponame>ststuck/usaspending-api<filename>usaspending_api/download/tests/unit/test_base_download_helpers.py<gh_stars>100-1000 import json import pytest from datetime import datetime, timezone from model_mommy import mommy from unittest.mock import patch from usaspending_api.broker.lookups import EXTERNAL_DATA_TYPE_...
ocr/tess/mark_wide_boxes.py
susannahsoon/oldperth
302
12641969
<reponame>susannahsoon/oldperth #!/usr/bin/env python """Draw white lines where wide boxes would be split. This encourages Tesseract to split these letter itself, by forcing them into separate connected components. """ import os.path import sys from PIL import Image, ImageDraw import numpy as np from split_wide_box...
Backtracking/017. Letter Combinations of a Phone Number.py
beckswu/Leetcode
138
12642000
""" 17. Letter Combinations of a Phone Number Given a digit string, return all possible letter combinations that the number could represent. A mapping of digit to letters (just like on the telephone buttons) is given below. Input:Digit string "23" Output: ["ad", "ae", "af", "bd", "be", "bf", "cd", "ce", "cf"]. Not...
web/dbpatterns/terrain.py
fatiherikli/dbpatterns
133
12642058
<gh_stars>100-1000 import logging import os import sys from django.conf import settings from django.core.management import call_command from django.test.simple import DjangoTestSuiteRunner from lettuce import * from documents.models import Document from newsfeed.models import Entry from notifications.models import N...
tests/v2/stop.py
tombry/virlutils
133
12642086
from . import BaseCMLTest from click.testing import CliRunner import requests_mock import os class CMLStopTests(BaseCMLTest): def test_cml_stop(self): with requests_mock.Mocker() as m: m.put(self.get_api_path("labs/{}/nodes/n1/state/stop".format(self.get_test_id())), json=None) sel...
AutotestWebD/apps/common/model/ExcelRead.py
yangjourney/sosotest
422
12642093
import xlrd import os import sys,random import logging from copy import deepcopy rootpath = os.path.dirname(os.path.realpath(__file__)).replace("\\","/") rootpath = rootpath.split("/apps")[0] syspath=sys.path sys.path=[] sys.path.append(rootpath) #指定搜索路径绝对目录 sys.path.extend([rootpath+i for i in os.listdir( rootpath) if...
macropodus/summarize/feature_base/text_pronouns.py
leileixiao/Macropodus
485
12642125
# -*- coding: UTF-8 -*- # !/usr/bin/python # @time :2019/8/25 20:51 # @author :Mo # @paper :Sentence Extraction Based Single Document Summarization(2005) # @function :text summary of feature-base # @evaluate :bad, it is for english, and that's not clearly explain of formula from macropodus.preprocess.tools_m...
testing/test_setupplan.py
markshao/pytest
9,225
12642154
from _pytest.pytester import Pytester def test_show_fixtures_and_test( pytester: Pytester, dummy_yaml_custom_test: None ) -> None: """Verify that fixtures are not executed.""" pytester.makepyfile( """ import pytest @pytest.fixture def arg(): assert False ...
test/test_cli.py
KOLANICH-libs/hyper
831
12642201
# -*- coding: utf-8 -*- import json import pytest from hyper.cli import KeyValue from hyper.cli import get_content_type_and_charset, main, parse_argument from hyper.cli import set_request_data, set_url_info from hyper.common.headers import HTTPHeaderMap # mock for testing class DummyUrlInfo(object): def __init_...
tfx/orchestration/experimental/kubernetes/node_wrapper.py
avelez93/tfx
1,813
12642242
# Copyright 2019 Google LLC # # 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 # # https://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, ...
06d-tools-cnn-cv/google-ml/Google Cloud API/cio-connect-api-example/visionex/visionex.py
jugalh/data-x-plaksha
117
12642245
import io from PIL import Image from google.cloud import vision from google.cloud.vision import types # instantiante a client vision_client = vision.ImageAnnotatorClient() #name of image file to annotate file_name ='480w_s.jpg' #file_name = 'ikhlaq-sidhu-2015.png?itok=nMiTIQXV' #file_name = 'pupr.png' img = Image.op...
custom_components/ble_monitor/test/test_inode_parser.py
ManuelLR/ble_monitor
820
12642253
"""The tests for the iNode ble_parser.""" from ble_monitor.ble_parser import BleParser class TestInode: def test_inode_energy_meter(self): """Test inode parser for iNode Energy Monitor.""" data_string = "043E2102010000473A6D6F1200150201060EFF90820400CFE40000DC05B0ED10020A08A5" data = byte...
Pyto/Samples/Turtle/polygon.py
snazari/Pyto
701
12642319
<reponame>snazari/Pyto<filename>Pyto/Samples/Turtle/polygon.py # Taken from https://michael0x2a.com/blog/turtle-examples from turtle import * num_sides = 6 side_length = 70 angle = 360.0 / num_sides for i in range(num_sides): fd(side_length) rt(angle) done()
pyearth/test/test_knot_search.py
ktanishqk/py-earth
360
12642332
<filename>pyearth/test/test_knot_search.py from pyearth._knot_search import (MultipleOutcomeDependentData, KnotSearchWorkingData, PredictorDependentData, KnotSearchReadOnlyData, KnotSe...
tests/test_multiple_outputs.py
datagutt/brave
572
12642357
import time, pytest, inspect from utils import * def start_with_multiple_outputs(run_brave, create_config_file, output_image_location1, output_image_location2): config = { 'mixers': [ {'pattern': 4}, # 4 is red {'pattern': 5} # 5 is green ], 'outputs': [ {'type': 'image', 'sour...
content/test/gpu/run_gpu_integration_test.py
google-ar/chromium
777
12642360
<filename>content/test/gpu/run_gpu_integration_test.py #!/usr/bin/env python # 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 argparse import json import sys from gpu_tests import path_util import g...
vendor/node-semver/semver/tests/test_range.py
johnwen84/my-php-buildpack
133
12642397
# -*- coding:utf-8 -*- import pytest # node-semver/test/index.js # import logging # logging.basicConfig(level=logging.DEBUG, format="%(message)s") cands = [ ['1.0.0 - 2.0.0', '1.2.3', False], ['1.0.0', '1.0.0', False], ['>=*', '0.2.4', False], ['', '1.0.0', False], ['*', '1.2.3', False], ['*',...
tests/testapp/tests/test_modelcustompk.py
dralley/django-lifecycle
902
12642404
<filename>tests/testapp/tests/test_modelcustompk.py import datetime from django.test import TestCase from tests.testapp.models import ModelCustomPK class ModelCustomPKTestCase(TestCase): def test_update_created_at_before_create(self): instance = ModelCustomPK.objects.create() instance.refresh_from...
Plugins/Aspose_Words_Java_for_Jython/asposewords/programming_documents/SplitTables.py
freedomloveme/Aspose.Words-for-Java
274
12642470
from asposewords import Settings from com.aspose.words import Document from com.aspose.words import NodeType from com.aspose.words import Paragraph class SplitTables: def __init__(self): dataDir = Settings.dataDir + 'programming_documents/' # Load the document. doc = Document(data...
examples/callback_multiplexer_clientside.py
stlehmann/dash-extensions
250
12642484
import time import dash_html_components as html import dash_core_components as dcc from dash_extensions.enrich import Output, DashProxy, Input, MultiplexerTransform # Small example app. proxy_container = dcc.Loading() app = DashProxy(transforms=[MultiplexerTransform(proxy_location=proxy_container)]) app.layout = html....
torchmeta/utils/metrics.py
yusufraji/siren
1,704
12642499
import torch import torch.nn.functional as F from torchmeta.utils.prototype import get_prototypes __all__ = ['hardness_metric'] def _pad_images(inputs, size=(224, 224), **kwargs): height, width = inputs.shape[-2:] pad_height, pad_width = (size[0] - height) // 2, (size[1] - width) // 2 padding = (pad_wid...
pixiedust/apps/connectionWidget.py
elgalu/pixiedust
598
12642507
<filename>pixiedust/apps/connectionWidget.py # ------------------------------------------------------------------------------- # Copyright IBM Corp. 2017 # # 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...
weasyl/followuser.py
kfkitsune/weasyl
111
12642511
<reponame>kfkitsune/weasyl from libweasyl import ratings from weasyl import define as d from weasyl import ignoreuser from weasyl import macro as m from weasyl import media from weasyl.configuration_builder import create_configuration, BoolOption from weasyl.error import WeasylError WatchSettings = create_configurati...
wetectron/utils/__init__.py
akobiisr/wetectron
332
12642514
<reponame>akobiisr/wetectron # -------------------------------------------------------- # Copyright (C) 2020 NVIDIA Corporation. All rights reserved. # Nvidia Source Code License-NC # --------------------------------------------------------
cflearn/api/cv/models/dino.py
carefree0910/carefree-learn
400
12642526
<reponame>carefree0910/carefree-learn import torch from PIL import Image from tqdm import tqdm from torch import Tensor from typing import List from typing import Tuple from ..data import SSLTestTransform from ..data import InferenceImageFolderData from ..pipeline import SimplePipeline from ..interface import predict...
web-bundle/resources/check-cookie-and-return-bundle.py
meyerweb/wpt
14,668
12642566
import os def main(request, response): origin = request.headers.get(b"origin") if origin is not None: response.headers.set(b"Access-Control-Allow-Origin", origin) response.headers.set(b"Access-Control-Allow-Methods", b"GET") response.headers.set(b"Access-Control-Allow-Credentials", b"...
tools/virtuoso.py
datha88/kbqa-ar-smcnn
139
12642600
<reponame>datha88/kbqa-ar-smcnn<filename>tools/virtuoso.py #!/usr/bin/python import sys, json from urllib import parse, request # Setting global variables data_source = 'fb2m:' query_url = 'http://localhost:8890/sparql/' # HTTP URL is constructed accordingly with JSON query results format in mind. def sparql_query(...
python/example_code/rekognition/test/test_rekognition_image_detection.py
iconara/aws-doc-sdk-examples
5,166
12642613
<filename>python/example_code/rekognition/test/test_rekognition_image_detection.py # Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. # SPDX-License-Identifier: Apache-2.0 """ Purpose Unit tests for rekognition_image_detection.py. """ import boto3 from botocore.exceptions import ClientError import ...
eeauditor/auditors/aws/Amazon_EFS_Auditor.py
kbhagi/ElectricEye
442
12642637
<filename>eeauditor/auditors/aws/Amazon_EFS_Auditor.py #This file is part of ElectricEye. #SPDX-License-Identifier: Apache-2.0 #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 copy...
bfxapi/examples/ws/subscribe_tickers.py
uggel/bitfinex-api-py
162
12642641
<filename>bfxapi/examples/ws/subscribe_tickers.py import os import sys sys.path.append('../../../') from bfxapi import Client bfx = Client( logLevel='DEBUG' ) @bfx.ws.on('error') def log_error(err): print ("Error: {}".format(err)) @bfx.ws.on('new_funding_ticker') def log_ticker(ticker): print ("New ticker: {}...
prohmr/models/heads/fc_head.py
akashsengupta1997/ProHMR
120
12642643
import torch import torch.nn as nn import numpy as np from typing import Dict, Tuple from yacs.config import CfgNode class FCHead(nn.Module): def __init__(self, cfg: CfgNode): """ Fully connected head for camera and betas regression. Args: cfg (CfgNode): Model config as yacs Cf...
src/simian/mac/admin/groups.py
tristansgray/simian
326
12642650
#!/usr/bin/env python # # Copyright 2018 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 require...
test/issues/test_008.py
ajnelson-nist/pySHACL
167
12642664
<reponame>ajnelson-nist/pySHACL<filename>test/issues/test_008.py # -*- coding: utf-8 -*- # """ https://github.com/RDFLib/pySHACL/issues/8 """ from pyshacl import validate mixed_file_text = ''' # baseURI: http://semanticprocess.x10host.com/Ontology/Testsparql # imports: http://datashapes.org/dash # prefix: Testsparql ...
tests/test_data_utils/test_fastai_transforms.py
rajshah4/pytorch-widedeep
692
12642681
<reponame>rajshah4/pytorch-widedeep """ Given the fact that the module fastai_transforms is mostly a copy and paste from the fastai v1 text's transforms library, the tests here are also copied from that library to ensure adequate coverage Credit for the code here to <NAME> and the fastai team """ from pytorch_widedee...