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
xnmt/speech_features/__init__.py
mukund-v/xnmt
195
11134050
<gh_stars>100-1000 # this is copied from https://github.com/thomasZen/python_speech_features2, # which is itself based on https://github.com/jameslyons/python_speech_features # and https://github.com/ZitengWang/python_kaldi_features # # contains the following changes: # - made Python 3 compatible # - support for per-sp...
_solved/solutions/04-spatial-joins25.py
lleondia/geopandas-tutorial
341
11134060
# Visualize the land use of the Muette district land_use_muette.plot(column='class')
external/skia/third_party/externals/gyp/test/settings/gyptest-settings.py
gordonjohnpatrick/XobotOS
263
11134081
#!/usr/bin/env python # Copyright (c) 2011 Google Inc. All rights reserved. # Use of this source code is governed by a BSD-style license that can be # found in the LICENSE file. """ Smoke-tests 'settings' blocks. """ import TestGyp # 'settings' is only supported for make and scons (and will be removed there as # we...
Tests/Common/test_util.py
faz1993/InnerEye-DeepLearning
402
11134085
# ------------------------------------------------------------------------------------------ # Copyright (c) Microsoft Corporation. All rights reserved. # Licensed under the MIT License (MIT). See LICENSE in the repo root for license information. # -------------------------------------------------------------------...
tests/test_identity.py
757670303037/stable-baselines
3,681
11134100
<reponame>757670303037/stable-baselines import pytest import numpy as np from stable_baselines import A2C, ACER, ACKTR, DQN, DDPG, SAC, PPO1, PPO2, TD3, TRPO from stable_baselines.ddpg import NormalActionNoise from stable_baselines.common.identity_env import IdentityEnv, IdentityEnvBox from stable_baselines.common.vec...
rules/configuration/rule_laravel.py
TomasTorresB/nerve
365
11134130
<filename>rules/configuration/rule_laravel.py from core.redis import rds from core.triage import Triage from core.parser import ScanParser class Rule: def __init__(self): self.rule = 'CFG_823E' self.rule_severity = 3 self.rule_description = 'This rule checks for misconfigurations in Laravel' self...
Ch06_Heavyweight_Scraping_with_Scrapy/nobel_winners/spiders/nwinners_minibio_spider.py
Geege/dataviz-with-python-and-js
259
11134132
<reponame>Geege/dataviz-with-python-and-js<gh_stars>100-1000 import scrapy import re BASE_URL = 'http://en.wikipedia.org' class NWinnerItemBio(scrapy.Item): link = scrapy.Field() name = scrapy.Field() mini_bio = scrapy.Field() image_urls = scrapy.Field() bio_image = scrapy.Field() images = sc...
learning/katas/python/Triggers/Window Accumulation Mode/Window Accumulation Mode/task.py
chrisstockton/beam
5,279
11134151
<reponame>chrisstockton/beam # # 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 (...
src/storage-preview/azext_storage_preview/vendored_sdks/azure_storagev2/fileshare/v2020_02_10/_shared/__init__.py
Mannan2812/azure-cli-extensions
2,728
11134164
# ------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. # Licensed under the MIT License. See License.txt in the project root for # license information. # -------------------------------------------------------------------------- import ba...
code/models/py_utils/builder.py
360iQ/CPNDet
191
11134192
<gh_stars>100-1000 import sys import os from mmcv.runner import obj_from_dict from torch import nn import pdb from . import (roi_extractors) from . import (bbox_heads) __all__ = [ 'build_roi_extractor', 'build_bbox_head' ] def _build_module(cfg, parrent=None, default_args=None): return cfg if isinstance(cfg...
slack_sdk/socket_mode/__init__.py
priya1puresoftware/python-slack-sdk
2,486
11134253
"""Socket Mode is a method of connecting your app to Slack’s APIs using WebSockets instead of HTTP. You can use slack_sdk.socket_mode.SocketModeClient for managing Socket Mode connections and performing interactions with Slack. https://api.slack.com/apis/connections/socket """ from .builtin import SocketModeClient # ...
ghostwriter/rolodex/templatetags/determine_primary.py
bbhunter/Ghostwriter
601
11134263
<reponame>bbhunter/Ghostwriter """This contains the custom template tags used by he Rolodex application.""" # Standard Libraries from collections import defaultdict import datetime from django import template # Ghostwriter Libraries from ghostwriter.rolodex.models import ObjectivePriority from ghostwriter.shepherd....
bcbio/rnaseq/cpat.py
a113n/bcbio-nextgen
418
11134272
""" run the Coding Potential Assessment Tool (CPAT) http://nar.oxfordjournals.org/content/early/2013/01/17/nar.gkt006.full """ import numpy import shutil import tempfile import os from bcbio import utils from bcbio.rnaseq import gtf from bcbio.utils import file_exists, safe_makedir from bcbio.distributed.transaction i...
leetcode/algorithms/median-of-two-sorted-arrays/solution.py
palash24/algorithms
113
11134308
<gh_stars>100-1000 #!/usr/bin/env python class Solution(object): def findMedianSortedArrays(self, a, b): """ Returns the median of two sorted arrays a and b. """ n = len(a) + len(b) if n % 2 == 0: # If the total length is even, take the average of the two median...
kinto/core/authentication.py
taus-semmle/kinto
4,618
11134313
from pyramid import authentication as base_auth from kinto.core import utils from kinto.core.openapi import OpenAPI class BasicAuthAuthenticationPolicy(base_auth.BasicAuthAuthenticationPolicy): """Basic auth implementation. Allow any user with any credentials (e.g. there is no need to create an account)...
models/modules/unet.py
mauriliosalg/Seis_Shift-Net_pytorch
350
11134321
import torch import torch.nn as nn import torch.nn.functional as F from .modules import spectral_norm # Defines the Unet generator. # |num_downs|: number of downsamplings in UNet. For example, # if |num_downs| == 7, image of size 128x128 will become of size 1x1 # at the bottleneck class UnetGenerator(nn.Module): d...
mindinsight/datavisual/data_transform/loader_generators/data_loader_generator.py
mindspore-ai/mindinsight
216
11134339
# Copyright 2020 Huawei Technologies Co., Ltd # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to...
src/oci/compute_instance_agent/models/instance_agent_command_execution_summary.py
Manny27nyc/oci-python-sdk
249
11134340
<gh_stars>100-1000 # coding: utf-8 # Copyright (c) 2016, 2021, Oracle and/or its affiliates. All rights reserved. # This software is dual-licensed to you under the Universal Permissive License (UPL) 1.0 as shown at https://oss.oracle.com/licenses/upl or Apache License 2.0 as shown at http://www.apache.org/licenses/LIC...
examples/sugarscape_cg/sugarscape_cg/model.py
DoofCoder/mesa
1,704
11134342
<reponame>DoofCoder/mesa """ Sugarscape Constant Growback Model ================================ Replication of the model found in Netlogo: <NAME>. and <NAME>. (2009). NetLogo Sugarscape 2 Constant Growback model. http://ccl.northwestern.edu/netlogo/models/Sugarscape2ConstantGrowback. Center for Connected Learning and...
testing/tools/connector_sent_data_parser.py
pvmsikrsna/wallaroo
1,459
11134347
import struct import sys try: import wallaroo.experimental.connector_wire_messages as cwm except: print("Couldn't import wallaroo.experimental.connector_wire_messages. Please ensure that machida/lib/ is on your PYTHONPATH") filename = sys.argv[1] print("parsing file: {}".format(filename)) f = open(filename...
fpga/lib/pcie/tb/test_dma_if_pcie_us_wr_512.py
totuwei/corundum
544
11134351
<reponame>totuwei/corundum #!/usr/bin/env python """ Copyright (c) 2019 <NAME> Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use,...
parlai/tasks/interactive/worlds.py
twstewart42/ParlAI
9,228
11134369
#!/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. from copy import deepcopy from typing import Optional from parlai.core.opt import Opt from parlai.core.params import P...
CalibTracker/SiStripESProducers/python/fake/Phase2TrackerConfigurableCablingESSource_cfi.py
ckamtsikis/cmssw
852
11134375
import FWCore.ParameterSet.Config as cms Phase2TrackerCabling = cms.ESSource("Phase2TrackerCablingCfgESSource", modules = cms.VPSet( cms.PSet( # Phase2 tracker module connection moduleType=cms.string("2S"), detid=cms.uint32(50000), gbtid=cm...
fuzzers/026-bram-data/generate.py
rw1nkler/prjxray
583
11134379
#!/usr/bin/env python3 # -*- coding: utf-8 -*- # # Copyright (C) 2017-2020 The Project X-Ray Authors. # # Use of this source code is governed by a ISC-style # license that can be found in the LICENSE file or at # https://opensource.org/licenses/ISC # # SPDX-License-Identifier: ISC import json from prjxray.segmaker im...
nidaqmx/_task_modules/channels/do_channel.py
stafak/nidaqmx-python
252
11134384
from __future__ import absolute_import from __future__ import division from __future__ import print_function from __future__ import unicode_literals import ctypes import numpy from nidaqmx._lib import lib_importer, ctypes_byte_str, c_bool32 from nidaqmx.errors import ( check_for_error, is_string_buffer_too_small,...
flows/ablations/abl_noattn.py
evanlohn/flowpp
131
11134419
<reponame>evanlohn/flowpp """ Ablation: no attention (replaced with a pointwise MLP, with the same number of parameters) Params: 31,443,440 Dropout 0.2 """ import tensorflow as tf from flows.flow_training import train, evaluate from flows.flows import ( conv2d, gated_conv, gaussian_sample_logp, VarConfig, get_v...
anytree/walker.py
odidev/anytree
700
11134433
# -*- coding: utf-8 -*- class Walker(object): def __init__(self): """Walk from one node to another.""" super(Walker, self).__init__() def walk(self, start, end): """ Walk from `start` node to `end` node. Returns: (upwards, common, downwards): `upwards` is...
tests/tools/assigner/actions/test_base_class.py
akashvacher/kafka-tools
578
11134434
<gh_stars>100-1000 import unittest from argparse import Namespace from .fixtures import set_up_cluster from kafka.tools.assigner.actions import ActionModule, ActionBalanceModule class ActionModuleTests(unittest.TestCase): def setUp(self): self.cluster = set_up_cluster() self.args = Namespace(exc...
elftools/construct/lib/py3compat.py
mebeim/pyelftools
1,358
11134455
#------------------------------------------------------------------------------- # py3compat.py # # Some Python2&3 compatibility code #------------------------------------------------------------------------------- import sys PY3 = sys.version_info[0] == 3 try: from collections.abc import MutableMapping # python ...
corehq/apps/api/tests/lookup_table_resources.py
dimagilg/commcare-hq
471
11134458
<filename>corehq/apps/api/tests/lookup_table_resources.py import json from corehq.apps.api.tests.utils import APIResourceTest from corehq.apps.fixtures.models import ( FieldList, FixtureDataItem, FixtureDataType, FixtureTypeField, ) from corehq.apps.fixtures.resources.v0_1 import ( LookupTableItemR...
examples/pong.py
papagiannakis/py-sdl2
222
11134460
"""The Pong Game.""" import sys import sdl2 import sdl2.ext BLACK = sdl2.ext.Color(0, 0, 0) WHITE = sdl2.ext.Color(255, 255, 255) PADDLE_SPEED = 3 BALL_SPEED = 3 class CollisionSystem(sdl2.ext.Applicator): def __init__(self, minx, miny, maxx, maxy): super(CollisionSystem, self).__init__() self.co...
protonfixes/gamefixes/15700.py
Sirmentio/protonfixes
213
11134488
<gh_stars>100-1000 """ Game fix for Oddworld: Abe's Oddysee TODO: Fix steam controller input, it is stuck in lizard mode without overlay """ #pylint: disable=C0103 from protonfixes import util def main(): """ Adds the -interline argument to the game """ # Adding -interline fixes slow videos but adds scan...
train.py
yangheng95/LCF-ATEPC
137
11134495
# -*- coding: utf-8 -*- # file: train.py # author: yangheng <<EMAIL>> # Copyright (C) 2019. All Rights Reserved. import argparse import json import logging import os, sys import random from sklearn.metrics import f1_score from time import strftime, localtime import numpy as np import torch import torch.nn.functional ...
src/lib/datasets/dataset/nusceneshp.py
morrolinux/RTM3D
393
11134503
from __future__ import absolute_import from __future__ import division from __future__ import print_function import pycocotools.coco as coco from pycocotools.cocoeval import COCOeval import numpy as np import json import os import torch.utils.data as data class NUSCENESHP(data.Dataset): num_classes = 10 num_jo...
recogym/agents/bayesian_poly_vb.py
philomenec/reco-gym
413
11134509
import numpy as np from scipy.special import expit from ..envs.configuration import Configuration from . import ( AbstractFeatureProvider, Model, ModelBasedAgent, ViewsFeaturesProvider ) from .organic_count import to_categorical bayesian_poly_args = { 'num_products': 10, 'random_seed': np.rand...
surreal/session/default_configs.py
PeihongYu/surreal
471
11134510
<filename>surreal/session/default_configs.py from .config import extend_config # ======================== Agent-Learner side ======================== BASE_LEARNER_CONFIG = { 'model': '_dict_', 'algo': { # Agent class to instantiate # Learner class to instantiate 'n_step': 1, 'ga...
optimization/fed_avg_client_opt.py
garyxcheng/federated
330
11134514
# Copyright 2021, 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 # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing...
conf/opt/graphite/webapp/graphite/app_settings.py
turbosquid/docker-graphite-statsd
845
11134522
"""Copyright 2008 Orbitz WorldWide 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, software...
resume_parser/parser_app/apps.py
kailaspathi/ResumeParser
215
11134525
from django.apps import AppConfig class ParserAppConfig(AppConfig): name = 'parser_app'
holocron/trainer/utils.py
MateoLostanlen/Holocron
181
11134529
# Copyright (C) 2019-2021, <NAME>. # This program is licensed under the Apache License version 2. # See LICENSE or go to <https://www.apache.org/licenses/LICENSE-2.0.txt> for full license details. from torch.nn import Module from torch.nn.modules.batchnorm import _BatchNorm from typing import Optional __all__ = ['f...
demos/wireworld_xor_demo.py
lantunes/cellpylib
124
11134546
import cellpylib as cpl import numpy as np from matplotlib.colors import ListedColormap def wireworld_rule(n, c, t): current_activity = n[1][1] if current_activity == 0: # empty return 0 if current_activity == 1: # electron head return 2 if current_activity == 2: # electron tail ...
examples/simulation/simulate_ucsf/make_ucsf.py
genematx/nmrglue
150
11134564
<gh_stars>100-1000 #! /usr/bin/env python import nmrglue as ng import numpy as np # create a sparky dictionary # A dictionary from a existing Sparky ucsf file can be found using: # ng.sparky.guess_udic(*ng.sparky.read('filename.ucsf')) udic = { 'ndim': 2, 0: {'car': 7329.0, 'complex': False, '...
src/rpdk/core/generate.py
wbingli/cloudformation-cli
200
11134605
"""This sub command generates code from the project and resource schema. Projects can be created via the 'init' sub command. """ import logging from .project import Project LOG = logging.getLogger(__name__) def generate(_args): project = Project() project.load() project.generate() project.generate_...
trakt/interfaces/sync/ratings.py
milokmet/trakt.py
147
11134615
from __future__ import absolute_import, division, print_function from trakt.interfaces.base import authenticated from trakt.interfaces.sync.core.mixins import Get, Add, Remove class SyncRatingsInterface(Get, Add, Remove): path = 'sync/ratings' @authenticated def get(self, media=None, rating=None, store=...
tools/generate_fill_mask.py
ankane/informers
340
11134627
<gh_stars>100-1000 from pathlib import Path import tempfile from transformers.convert_graph_to_onnx import convert, quantize dest = Path(tempfile.mkdtemp(), "fill-mask.onnx") convert( pipeline_name="fill-mask", model="distilroberta-base", output=dest, framework="pt", opset=11 ) print(dest)
pymatgen/command_line/enumlib_caller.py
wangyusu/pymatgen
921
11134635
# coding: utf-8 # Copyright (c) Pymatgen Development Team. # Distributed under the terms of the MIT License. """ This module implements an interface to enumlib, <NAME>"s excellent Fortran code for enumerating derivative structures. This module depends on a compiled enumlib with the executables enum.x and makestr.x av...
resotocore/tests/resotocore/model/__init__.py
someengineering/resoto
126
11134654
<reponame>someengineering/resoto from typing import Optional, List from resotocore.model.model import Model, Kind from resotocore.model.model_handler import ModelHandler class ModelHandlerStatic(ModelHandler): def __init__(self, model: Model): self.model = model async def load_model(self) -> Model: ...
ast/testdata/decorator.py
MaxTurchin/pycopy-lib
126
11134662
@decor def foo(): pass @decor() def foo(): pass @decor(1, 2) def foo(): pass @clsdecor(1) class Foo(Bar): pass
cfonts/consts.py
AdamMusa/python-cfonts
174
11134663
""" Python cFonts ============= Sexy fonts for the console. :license: GNU GPLv2 :author: <NAME><<EMAIL>> """ import enum from shutil import get_terminal_size from typing import Mapping, Tuple SIZE = get_terminal_size((80, 24)) CHARS = "ABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789|!?.+-_=@#$%&()/:;,' \"" ...
api/http.py
wkma/bk-sops
881
11134679
<reponame>wkma/bk-sops<filename>api/http.py<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> Limited, a Tencent company. All rights reserved. Licensed under the MIT ...
doxygen/siphon/process_syscfg.py
amithbraj/vpp
751
11134686
<filename>doxygen/siphon/process_syscfg.py # Copyright (c) 2016 Comcast Cable Communications Management, 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: # # http://www.apache.org/li...
applications/StructuralMechanicsApplication/tests/test_distribute_load_on_surface_process.py
lkusch/Kratos
778
11134717
<gh_stars>100-1000 import KratosMultiphysics as KM import KratosMultiphysics.StructuralMechanicsApplication as KSM from KratosMultiphysics.StructuralMechanicsApplication.distribute_load_on_surface_process import Factory import KratosMultiphysics.KratosUnittest as KratosUnittest class TestDistributeLoadOnSurfaceProce...
rpython/tool/test/test_sourcetools.py
jptomo/pypy-lang-scheme
381
11134723
<reponame>jptomo/pypy-lang-scheme<filename>rpython/tool/test/test_sourcetools.py from rpython.tool.sourcetools import ( func_renamer, func_with_new_name, rpython_wrapper) def test_rename(): def f(x, y=5): return x + y f.prop = int g = func_with_new_name(f, "g") assert g(4, 5) == 9 asse...
fpga/lib/pcie/tb/test_pcie_us_axi_master_wr_128.py
totuwei/corundum
544
11134736
<filename>fpga/lib/pcie/tb/test_pcie_us_axi_master_wr_128.py #!/usr/bin/env python """ Copyright (c) 2018 <NAME> Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including wit...
tokumx/datadog_checks/tokumx/vendor/pymongo/common.py
remicalixte/integrations-core
663
11134745
# Copyright 2011-2015 MongoDB, 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 writi...
py_stringmatching/similarity_measure/generalized_jaccard.py
kevalii/py_stringmatching
115
11134747
"""Generalized jaccard similarity measure""" from py_stringmatching import utils from py_stringmatching.similarity_measure.jaro import Jaro from py_stringmatching.similarity_measure.hybrid_similarity_measure import \ HybridSimilarityMeasure class GeneralizedJaccard...
refinery/bnpy/bnpy-dev/tests/init/TestFromSaved.py
csa0001/Refinery
103
11134770
<filename>refinery/bnpy/bnpy-dev/tests/init/TestFromSaved.py ''' Unit tests for FromScratchGauss.py ''' import unittest import numpy as np from bnpy.data import XData from bnpy import HModel from bnpy.ioutil import ModelWriter, ModelReader class TestFromScratchGauss(unittest.TestCase): def shortDescription(self): ...
photoshop/api/application.py
MrTeferi/photoshop-python-api
270
11134774
<filename>photoshop/api/application.py """The Adobe Adobe Photoshop CC application object. Which is the root of the object model and provides access to all other objects. This object provides application-wide information, such as application defaults and available fonts. It provides many important methods, such as tho...
scripts/nasbench101/sample_pkl.py
microsoft/archai
344
11134791
import pickle from archai.common import utils def main(): in_dataset_file = utils.full_path('~/dataroot/nasbench_ds/nasbench_full.tfrecord.pkl') out_dataset_file = utils.full_path('~/dataroot/nasbench_ds/nasbench101_sample.tfrecord.pkl') with open(in_dataset_file, 'rb') as f: records = pickle.load(...
applications/ConstitutiveModelsApplication/tests/examples/cam_clay_example/example_constitutive_model_call.py
lkusch/Kratos
778
11134796
from KratosMultiphysics import * import KratosMultiphysics.ConstitutiveModelsApplication as KratosMaterialModels ######################### general parameters nnodes = 3 dim = 3 #define a model part and create new nodes model = Model() model_part = model.ModelPart("test") node1 = model_part.CreateNewNode(1,0.0,0.0,0.0...
ammmerzougui/0001/test.py
saurabh896/python-1
3,976
11134797
<reponame>saurabh896/python-1<filename>ammmerzougui/0001/test.py<gh_stars>1000+ ''' Generating a random code By @ammmerzougui ''' import random def genCode(length): s = "abcdefghijklmnopqrstuvwxyz01234567890ABCDEFGHIJKLMNOPQRSTUVWXYZ!@#$%^&*()?" return "".join(random.sample(s,length)) l=input("Enter the length of t...
examples/cloudml-collaborative-filtering/trainer/inputs.py
ruchirjain86/professional-services
2,116
11134803
<gh_stars>1000+ # Copyright 2019 Google Inc. All Rights Reserved. # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by appl...
tina/pars/trans.py
xuhao1/taichi_three
152
11134813
<reponame>xuhao1/taichi_three from ..common import * from .base import ParsEditBase class ParsTransform(ParsEditBase): def __init__(self, pars): super().__init__(pars) self.trans = ti.Matrix.field(4, 4, float, ()) self.scale = ti.field(float, ()) @ti.materialize_callback ...
mmdet/cv_core/utils/__init__.py
Karybdis/mmdetection-mini
834
11134827
# flake8: noqa # Copyright (c) Open-MMLab. All rights reserved. from .config import Config, ConfigDict, DictAction from .misc import (check_prerequisites, concat_list, deprecated_api_warning, import_modules_from_strings, is_list_of, is_seq_of, is_str, is_tuple_of, iter_cast, list_c...
core/Streamlines.py
nmwsharp/DDGSpring2016
110
11134829
<reponame>nmwsharp/DDGSpring2016<gh_stars>100-1000 """ Generate a set of streamlines on the surface of a mesh corresponding to a vector field defined in the tangent space of that mesh """ import random, cmath from math import cos, sin, pi from Utilities import * def generateStreamlines(mesh, nLines, lineLength, vec...
ai_safety_gridworlds/environments/shared/rl/array_spec_test.py
AicyDC/ai-safety-gridworlds
532
11134848
# Copyright 2018 The AI Safety Gridworlds Authors. All Rights Reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required b...
iexfinance/tests/test_account.py
jto-d/iexfinance
653
11134859
import pandas as pd import pytest from iexfinance.account import get_metadata, get_usage @pytest.mark.skip class TestAccount(object): def test_usage_json_default(self): # This function is defaulting to "messages" type due to bug # in provider platform data = get_usage() assert isi...
tests/test_pexels.py
korymath/talk-generator
110
11134882
<filename>tests/test_pexels.py import unittest from talkgenerator.sources import pexels class PexelsTest(unittest.TestCase): def test_pexels_access(self): images = pexels.search_photos("office") self.assertTrue(len(images) > 0) sources = [ image.get_source() for image in image...
src/python/turicreate/data_structures/sframe.py
cookingcodewithme/turicreate
11,356
11134902
# -*- coding: utf-8 -*- # Copyright © 2017 Apple Inc. All rights reserved. # # Use of this source code is governed by a BSD-3-clause license that can # be found in the LICENSE.txt file or at https://opensource.org/licenses/BSD-3-Clause """ This module defines the SFrame class which provides the ability to create, acces...
edb/tools/gen_test_dumps.py
aaronbrighton/edgedb
7,302
11134914
# # This source file is part of the EdgeDB open source project. # # Copyright 2020-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 copy of the License at # # http...
test/functional/test_key.py
Eternity-labs/py-ipfs-http-client
186
11134925
def test_add_list_rename_rm(client): # Remove keys if they already exist key_list = list(map(lambda k: k["Name"], client.key.list()["Keys"])) if "ipfshttpclient-test-rsa" in key_list: client.key.rm("ipfshttpclient-test-rsa") if "ipfshttpclient-test-ed" in key_list: client.key.rm("ipfshttpclient-test-ed") # Ad...
bit_tf2/normalization.py
ZTH-NEU/big_transfer
1,377
11134956
<reponame>ZTH-NEU/big_transfer<filename>bit_tf2/normalization.py # Copyright 2020 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 # # http://www.apache.org/licenses/LICENSE-2....
test.py
Kamu1403/BBAVectors-Oriented-Object-Detection
356
11134959
<gh_stars>100-1000 import torch import numpy as np import cv2 import time import os import matplotlib.pyplot as plt import func_utils def apply_mask(image, mask, alpha=0.5): """Apply the given mask to the image. """ color = np.random.rand(3) for c in range(3): image[:, :, c] = np.where(mask == ...
backend/database/lisence.py
uwer/coco-annotator
1,584
11134982
<gh_stars>1000+ from mongoengine import * class LicenseModel(DynamicDocument): id = SequenceField(primary_key=True) name = StringField() url = StringField() __all__ = ["LicenseModel"]
alipay/aop/api/domain/AlipayOpenMiniInnerclientinfoCreateModel.py
antopen/alipay-sdk-python-all
213
11134984
#!/usr/bin/env python # -*- coding: utf-8 -*- import json from alipay.aop.api.constant.ParamConstants import * class AlipayOpenMiniInnerclientinfoCreateModel(object): def __init__(self): self._bundle_id = None self._bundle_name = None self._bundle_prefix = None self._inst_code = ...
pyhindsight/utils.py
kumavis/hindsight
730
11134991
<gh_stars>100-1000 import datetime import json import logging import os import pytz import shutil import sqlite3 import struct from pyhindsight import __version__ from pathlib import Path log = logging.getLogger(__name__) def dict_factory(cursor, row): d = {} for idx, col in enumerate(cursor.description): ...
cctbx/maptbx/tst_interpolation_2.py
dperl-sol/cctbx_project
155
11134997
<gh_stars>100-1000 from __future__ import absolute_import, division, print_function from cctbx.development import random_structure from cctbx.sgtbx import space_group_info import boost_adaptbx.boost.python as bp from six.moves import range ext = bp.import_ext("cctbx_asymmetric_map_ext") from cctbx_asymmetric_map_ext im...
mmdet/models/registry.py
Pandinosaurus/Grid-R-CNN
272
11135035
import torch.nn as nn class Registry(object): def __init__(self, name): self._name = name self._module_dict = dict() @property def name(self): return self._name @property def module_dict(self): return self._module_dict def _register_module(self, module_class...
examples/ccxt.pro/py/binance-watch-many-orderbooks.py
DavidFelsen/ccxt
24,910
11135049
<gh_stars>1000+ import ccxtpro import asyncio orderbooks = {} def when_orderbook_changed(exchange_spot, symbol, orderbook): # this is a common handler function # it is called when any of the orderbook is updated # it has access to both the orderbook that was updated # as well as the rest of the orderb...
tests/test_inbuf_overflow.py
MaayanLab/aiohttp-wsgi
244
11135077
<filename>tests/test_inbuf_overflow.py from tests.base import AsyncTestCase, streaming_request_body, echo_application class InbufOverflowTest(AsyncTestCase): def testInbufOverflow(self) -> None: with self.run_server(echo_application, inbuf_overflow=3) as client: response = client.request(data...
tests/monitoring/test_check_mesos_outdated_tasks.py
sobolevn/paasta
1,711
11135079
# Copyright 2015-2017 Yelp 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...
haartrainingformat.py
nagyistoce/JoakimSoderberg-imageclipper
131
11135081
#!/usr/bin/python import os import re import argparse def main(): parser = argparse.ArgumentParser() parser.add_argument("--clipdir", metavar = "CLIPDIR", help = "Path to a directory containing the clipped images " "in the format default imageclipper output format: " "<imgout_format = %%d/image...
tool/check_link_references.py
salihgueler/website
2,260
11135091
<gh_stars>1000+ import re import sys from pathlib import Path from typing import Dict, List def find_invalid_link_references(folder: str) -> Dict[str, List[str]]: """ Search for invalid link references in all HTML files within the given directory path. """ invalid_links = {} # Iterate all `.htm...
examples/riscv/RVC_misaligned_force.py
noahsherrill/force-riscv
111
11135094
# # Copyright (C) [2020] Futurewei Technologies, Inc. # # FORCE-RISCV is licensed under the Apache License, Version 2.0 # (the "License"); you may not use this file except in compliance # with the License. You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # THIS SOFTWARE IS PR...
lib/clx/settings.py
pooya/disco
786
11135104
<filename>lib/clx/settings.py import os class Settings(dict): """ A dictionary for storing settings. Provides special mechanisms for setting and overriding default values. Defaults can be overridden by a settings file and/or the environment. """ defaults = {} globals = globals() setti...
visual_mpc/policy/cem_controllers/variants/nce_cost_controller.py
thomasweng15/visual_foresight
108
11135109
<filename>visual_mpc/policy/cem_controllers/variants/nce_cost_controller.py from visual_mpc.policy.cem_controllers import CEMBaseController import imp import control_embedding import numpy as np from visual_mpc.video_prediction.pred_util import get_context, rollout_predictions from ..visualizer.construct_html import sa...
graphdash/__init__.py
NunoEdgarGFlowHub/GraphDash
306
11135115
<reponame>NunoEdgarGFlowHub/GraphDash<gh_stars>100-1000 # -*- coding: utf-8 -*- from .routes import app, CONF __all__ = ['app', 'CONF']
powerfulseal/k8s/pod.py
fahedouch/powerfulseal
1,362
11135136
# Copyright 2017 Bloomberg Finance L.P. # # 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 ...
scripts/experimental/abelian_log_parser_analysis.py
bigwater/Galois
230
11135145
########################################## # To parse log files generated by abelian. # Author: <NAME> # Email: <EMAIL> ######################################### import re import os import sys, getopt import csv import numpy ######## NOTES: # All time values are in sec by default. def sd_iterations(inputFile, outpu...
locust/test/test_parser.py
KevinHoi128/locust
18,336
11135163
import unittest import os import tempfile import mock from io import StringIO import locust from locust.argument_parser import parse_options, get_parser, parse_locustfile_option, ui_extra_args_dict from .mock_locustfile import mock_locustfile from .testcases import LocustTestCase class TestParser(unittest.TestCase):...
Demo/tkinter/matt/animation-w-velocity-ctrl.py
cemeyer/tauthon
2,293
11135165
from Tkinter import * # this is the same as simple-demo-1.py, but uses # subclassing. # note that there is no explicit call to start Tk. # Tkinter is smart enough to start the system if it's not already going. class Test(Frame): def printit(self): print "hi" def createWidgets(self): self.QUI...
aicsimageio/readers/czi_reader.py
brisvag/aicsimageio
110
11135181
<gh_stars>100-1000 #!/usr/bin/env python # -*- coding: utf-8 -*- import warnings import xml.etree.ElementTree as ET from copy import copy from pathlib import Path from typing import Any, Dict, Hashable, List, Optional, Tuple, Union import dask.array as da import numpy as np import xarray as xr from dask import delaye...
tests/store/tracking/test_sqlalchemy_store_schema.py
PeterSulcs/mlflow
10,351
11135194
"""Tests verifying that the SQLAlchemyStore generates the expected database schema""" import os import pytest from alembic import command from alembic.script import ScriptDirectory from alembic.migration import MigrationContext # pylint: disable=import-error from alembic.autogenerate import compare_metadata import sq...
manim/utils/scale.py
PhotonSpheres/manim
9,497
11135202
import math from typing import TYPE_CHECKING, Any, Dict, Iterable, List __all__ = ["LogBase", "LinearBase"] from ..mobject.numbers import Integer if TYPE_CHECKING: from manim.mobject.mobject import Mobject class _ScaleBase: """Scale baseclass for graphing/functions.""" def __init__(self, custom_labels...
test/system/tools/fds/tests.py
timmylinux/Fast-DDS
575
11135239
# Copyright 2020 Proyectos y Sistemas de Mantenimiento SL (eProsima). # # 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...
rotkehlchen/accounting/pot.py
rotkehlchenio/rotkehlchen
137
11135247
import logging from typing import TYPE_CHECKING, Any, Dict, List, Literal, Optional, Tuple from rotkehlchen.accounting.cost_basis import CostBasisCalculator from rotkehlchen.accounting.cost_basis.prefork import ( handle_prefork_asset_acquisitions, handle_prefork_asset_spends, ) from rotkehlchen.accounting.mixi...
climpred/tests/test_logging.py
rom-py/climpred
104
11135251
<filename>climpred/tests/test_logging.py<gh_stars>100-1000 import logging from climpred.prediction import compute_hindcast def test_log_compute_hindcast( hind_ds_initialized_1d_cftime, reconstruction_ds_1d_cftime, caplog ): """Tests that logging works for compute_hindcast.""" LOG_STRINGS = ["lead", "init...
Co-Simulation/PTV-Vissim/vissim_integration/constants.py
adelbennaceur/carla
7,883
11135282
#!/usr/bin/env python # Copyright (c) 2020 Computer Vision Center (CVC) at the Universitat Autonoma de # Barcelona (UAB). # # This work is licensed under the terms of the MIT license. # For a copy, see <https://opensource.org/licenses/MIT>. """ This module defines constants used for the vissim-carla co-simulation. """...
bumblebee_status/modules/contrib/caffeine.py
rosalogia/bumblebee-status
1,089
11135296
# pylint: disable=C0111,R0903,W0212 """Enable/disable automatic screen locking. Requires the following executables: * xdg-screensaver * xdotool * xprop (as dependency for xdotool) * notify-send contributed by `TheEdgeOfRage <https://github.com/TheEdgeOfRage>`_ - many thanks! """ import logging impor...
Python/Algorithms/Dijkstra-Algorithm/dijkstra_algorithm.py
sjsneha/Data-Structures-and-Algorithms
245
11135297
<reponame>sjsneha/Data-Structures-and-Algorithms<filename>Python/Algorithms/Dijkstra-Algorithm/dijkstra_algorithm.py """Python 3 implementation of Djikstra's algorithm for finding the shortest path between nodes in a graph. Written as a learning exercise, so lots of comments and no error handling. """ from collections ...