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
pe_tree/__main__.py
lybtongji/pe_tree
1,271
11124947
# # Copyright (c) 2020 BlackBerry Limited. 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 requ...
model_to_onnx.py
David-zaiwang/RGBD_segmentation
128
11124953
# -*- coding: utf-8 -*- """ .. codeauthor:: <NAME> <<EMAIL>> .. codeauthor:: <NAME> <<EMAIL>> """ import argparse import os import numpy as np import torch from src.args import ArgumentParserRGBDSegmentation from src.build_model import build_model from src.prepare_data import prepare_data if __name__ == '__main__': ...
gym_collision_avoidance/envs/policies/CADRL/scripts/multi/global_var.py
echtesmikkelbeer21/gym-collision-avoidance
128
11124986
<reponame>echtesmikkelbeer21/gym-collision-avoidance<filename>gym_collision_avoidance/envs/policies/CADRL/scripts/multi/global_var.py #!/usr/bin/env python # global varibles import numpy as np COLLISION_COST = -0.25 DIST_2_GOAL_THRES = 0.05 GETTING_CLOSE_PENALTY = -0.05 GETTING_CLOSE_RANGE = 0.2 EPS = 1e-5 SMOOTH_COST...
PyGithub_examples/get_rate_limit_info.py
DazEB2/SimplePyScripts
117
11125018
<reponame>DazEB2/SimplePyScripts<gh_stars>100-1000 #!/usr/bin/env python3 # -*- coding: utf-8 -*- __author__ = 'ipetrash' # pip install pygithub from github import Github from config import LOGIN, PASSWORD gh = Github(LOGIN, PASSWORD) print('With auth:') print(' rate_limiting:', gh.rate_limiting) print(' rate_lim...
torchmultimodal/modules/encoders/clip_resnet_encoder.py
facebookresearch/multimodal
128
11125036
<filename>torchmultimodal/modules/encoders/clip_resnet_encoder.py # Copyright (c) Meta Platforms, Inc. and affiliates. # All rights reserved. # # This source code is licensed under the BSD-style license found in the # LICENSE file in the root directory of this source tree. # This code is based on https://github.com/op...
survae/transforms/bijections/permute_axes.py
alisiahkoohi/survae_flows
262
11125083
import torch from collections.abc import Iterable from survae.transforms.bijections import Bijection class PermuteAxes(Bijection): def __init__(self, permutation): super(PermuteAxes, self).__init__() assert isinstance(permutation, Iterable), 'permutation must be an Iterable' assert permut...
tests/util_test.py
ale180192/googleads-python-lib
601
11125086
# Copyright 2016 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 applicable law or ...
tests/nnapi/specs/skip/V1_2/bidirectional_sequence_lstm_norm_fw_output.mod.py
juitem/ONE
255
11125090
<reponame>juitem/ONE # # Copyright (C) 2019 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 requ...
visual_inspector/figure_custom/cloud_figures_custom.py
m4ta1l/deep-neuroevolution
883
11125094
<reponame>m4ta1l/deep-neuroevolution<gh_stars>100-1000 """Customerized Cloud Figures""" from figure_base.cloud_figures import CloudPlot class CloudPlotHDBC(CloudPlot): """Cloud plot to show trajectory as Hi Dim BCs""" def __init__(self, *args, **kwargs): CloudPlot.__init__(self, *args, **kwargs) ...
tacker/tests/unit/sol_refactored/objects/test_base.py
h1r0mu/tacker
116
11125107
<gh_stars>100-1000 # Copyright (C) 2021 Nippon Telegraph and Telephone Corporation # 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.apach...
functions/FillRaster.py
mmfink/raster-functions
173
11125109
import numpy as np class FillRaster(): def __init__(self): self.name = "Fill Raster Function" self.description = ("") self.fillValue = 0. def getParameterInfo(self): return [ { 'name': 'raster', 'dataType': 'raster', ...
tests/test_issues.py
cstoltze/fhir.resources
144
11125148
<gh_stars>100-1000 # _*_ coding: utf-8 _*_ from pydantic import ValidationError from fhir.resources.patient import Patient __author__ = "<NAME><<EMAIL>>" def test_issue_74(): """When are Falsy values evaluated as None?""" patient = Patient(active=True, address=[]) assert "address" not in patient.dict() ...
lib/bindings/samples/server/utils/cpp_callback.py
tlalexander/stitchEm
182
11125162
import utils.async import vs class CppCallback(vs.CppCallback): def __init__(self, to_call): super(CppCallback, self).__init__() self.to_call = to_call def __call__(self, payload): #defer to avoid deadlock utils.async.defer(self.to_call, payload)
tests/test_static_graph.py
zbmain/PGL
1,389
11125183
# Copyright (c) 2020 PaddlePaddle Authors. All Rights Reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by appli...
tests/system/test__helpers.py
Arushi201296/python-firestore
140
11125201
import os import re from google.cloud.firestore_v1.base_client import _FIRESTORE_EMULATOR_HOST from test_utils.system import unique_resource_id from test_utils.system import EmulatorCreds FIRESTORE_CREDS = os.environ.get("FIRESTORE_APPLICATION_CREDENTIALS") FIRESTORE_PROJECT = os.environ.get("GCLOUD_PROJECT") RANDOM_I...
RecoBTag/Combined/python/candidateChargeBTagComputer_cfi.py
ckamtsikis/cmssw
852
11125230
import FWCore.ParameterSet.Config as cms candidateChargeBTagComputer = cms.ESProducer("CandidateChargeBTagESProducer", useCondDB = cms.bool(False), gbrForestLabel = cms.string(""), weightFile = cms.FileInPath('RecoBTag/Combined/data/ChargeBTag_4sep_2016.weights.xml.gz'), useAdaBoost = cms.bool(True), ...
bcs-ui/backend/bcs_web/apis/authentication.py
laodiu/bk-bcs
599
11125231
# -*- coding: utf-8 -*- """ Tencent is pleased to support the open source community by making 蓝鲸智云PaaS平台社区版 (BlueKing PaaS Community Edition) available. Copyright (C) 2017-2021 THL A29 Limited, a Tencent company. All rights reserved. Licensed under the MIT License (the "License"); you may not use this file except in co...
tests/unit/output/test_row_formatter.py
tttgm/basketball_reference_web_scraper
325
11125232
<reponame>tttgm/basketball_reference_web_scraper<filename>tests/unit/output/test_row_formatter.py from unittest import TestCase from basketball_reference_web_scraper.data import Team, Location, Outcome, Position from basketball_reference_web_scraper.output.fields import format_value class TestRowFormatter(TestCase):...
lib/pare/pare/models/backbone/utils.py
YuliangXiu/ICON
486
11125248
<reponame>YuliangXiu/ICON # -*- coding: utf-8 -*- # Max-Planck-Gesellschaft zur Förderung der Wissenschaften e.V. (MPG) is # holder of all proprietary rights on this computer program. # You can only use this computer program if you have closed # a license agreement with MPG or you get the right to use the computer # p...
checkov/terraform/checks/data/__init__.py
cclauss/checkov
4,013
11125306
from checkov.terraform.checks.data.aws import *
itchatmp/views/crypto.py
yf-ftd/itchatmp
1,504
11125340
import os, logging, traceback import hashlib, struct from base64 import b64decode, b64encode try: from Crypto.Cipher import AES except ImportError: from cryptography.hazmat.primitives.ciphers import Cipher, algorithms, modes from cryptography.hazmat.backends import default_backend def aes_enco...
pythonFiles/tests/unittestadapter/conftest.py
Kelvin-Gamer/vscode-python
1,476
11125376
<reponame>Kelvin-Gamer/vscode-python # Copyright (c) Microsoft Corporation. All rights reserved. # Licensed under the MIT License. import sys # Ignore the contents of this folder for Python 2 tests. if sys.version_info[0] < 3: collect_ignore_glob = ["*.py"]
.test-infra/jenkins/metrics_report/dashboards_parser.py
eyal0/beam
5,279
11125382
#!/usr/bin/env python # Licensed to the Apache Software Foundation (ASF) under one or more # contributor license agreements. See the NOTICE file distributed with # this work for additional information regarding copyright ownership. # The ASF licenses this file to You under the Apache License, Version 2.0 # (the "Licen...
qmlt/numerical/plot.py
stjordanis/QMLT
117
11125413
#!/usr/bin/env python3 # -*- coding: utf-8 -*- # Copyright 2018 Xanadu Quantum Technologies 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...
lldb/test/API/tools/lldb-server/TestGdbRemoteSingleStep.py
mkinsner/llvm
2,338
11125430
import gdbremote_testcase from lldbsuite.test.decorators import * from lldbsuite.test.lldbtest import * from lldbsuite.test import lldbutil class TestGdbRemoteSingleStep(gdbremote_testcase.GdbRemoteTestCaseBase): mydir = TestBase.compute_mydir(__file__) @skipIfWindows # No pty support to test any inferior s...
utilities/diskimage_unittesting/tests/empty_directory_test.py
timgates42/pymacadmin
112
11125493
<filename>utilities/diskimage_unittesting/tests/empty_directory_test.py #!/usr/bin/python2.4 # # Copyright 2008 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...
myia/operations/prim_partial.py
strint/myia
222
11125500
<reponame>strint/myia """Definitions for the primitive `partial`.""" from ..lib import ( AbstractFunction, PartialApplication, Possibilities, standard_prim, ) from . import primitives as P def pyimpl_partial(f, *args): """Implement `partial`.""" def res(*others): return f(*(args + ot...
tests/param/string_to_boolean_test.py
Timothyyung/bravado-core
122
11125590
# -*- coding: utf-8 -*- import pytest from bravado_core.param import string_to_boolean def test_boolean_true_is_true_or_1(): assert string_to_boolean('true') assert string_to_boolean('tRUe') assert string_to_boolean('1') def test_boolean_false_is_false_or_0(): assert not string_to_boolean('false') ...
DiffAugment-biggan-imagenet/compare_gan/metrics/fid_score_test.py
Rian-T/data-efficient-gans
1,902
11125610
<reponame>Rian-T/data-efficient-gans # coding=utf-8 # Copyright 2018 Google LLC & <NAME>. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # ...
test/manualAreplTests/envVarTest.py
manuth/LiveCode
203
11125619
<gh_stars>100-1000 from arepl_dump import dump import os path=os.environ['Path'] test = os.environ['test'] try: shouldFail = os.environ['aofijaef'] except KeyError: print('bad key failed as expected')
apps/point_cloud/image_common/camera_calibration_parsers/src/camera_calibration_parsers/__init__.py
ramonidea/prl_wireless_perception
742
11125628
from camera_calibration_parsers.camera_calibration_parsers_wrapper import __readCalibrationWrapper from sensor_msgs.msg import CameraInfo def readCalibration(file_name): """Read .ini or .yaml calibration file and return (camera name and cameraInfo message). @param file_name: camera calibration file name ...
vscode/wsclient.py
TTitcombe/vscode-ext
140
11125648
import json import uuid import socket import asyncio import websockets class WSClient: """ This class manages the websocket connection. """ BASE_URI = "ws://localhost:" def __init__(self, extension, port: int = None) -> None: self.extension = extension self.port =...
scout/commands/update/genes.py
Clinical-Genomics/scout
111
11125684
<reponame>Clinical-Genomics/scout #!/usr/bin/env python # encoding: utf-8 """ update/genes.py Build a file with genes that are based on hgnc format. Parses ftp://ftp.ebi.ac.uk/pub/databases/genenames/new/tsv/hgnc_complete_set.txt, ftp.broadinstitute.org/pub/ExAC_release/release0.3/functional_gene_constraint/ and a bio...
test/run/t310.py
timmartin/skulpt
2,671
11125743
<filename>test/run/t310.py s = set([2,3,4]) t = set([3,4,5]) u = set([1,3,5]) a = s.intersection(t) b = u.intersection(s) c = u.intersection(t) print a print b print c print a == set([3, 4]) print b == set([3]) print c == set([3, 5]) d = s.intersection(t, u) print d print d == set([3])
tests/test_static.py
mblack20/flintrock
615
11125751
<filename>tests/test_static.py import compileall import os import subprocess # External modules import yaml FLINTROCK_ROOT_DIR = ( os.path.dirname( os.path.dirname( os.path.realpath(__file__)))) TEST_TARGETS = [ 'setup.py', 'flintrock/', 'tests/'] TEST_PATHS = [ os.path.join(...
examples/tensorboard/text.py
dwolfschlaeger/guildai
694
11125786
"""Ref: https://www.tensorflow.org/api_docs/python/tf/summary/text """ import argparse import tensorflow as tf p = argparse.ArgumentParser() p.add_argument("--logdir", default="/tmp/text_demo") args = p.parse_args() print("Writing logs to %s" % args.logdir) writer = tf.summary.create_file_writer(args.logdir) with ...
examples/detection_file_conversions/scripts/correct_frame_ids_in_viame_csv.py
Kitware/VAIME
127
11125844
<filename>examples/detection_file_conversions/scripts/correct_frame_ids_in_viame_csv.py #!/usr/bin/env python import argparse import csv import os import sys F_IMAGE_NAME = 1 F_FRAME_NUMBER = 2 field_types = [ int, str, int, float, float, float, float, float, fl...
vilya/models/actions/__init__.py
mubashshirjamal/code
1,582
11125862
<reponame>mubashshirjamal/code # -*- coding: utf-8 -*- migrate_type_name = { 'code_review': 'pull_comment', # 'commit': 'pull_commit', } # 迁移数据 def migrate_notif_data(data, receiver): from vilya.models.notification import Notification from vilya.models.actions.commit_comment import migrate_commit_com...
examples/torch/common/models/__init__.py
MaximProshin/nncf
310
11125867
<gh_stars>100-1000 from examples.torch.common.models.segmentation import * from examples.torch.common.models.classification import *
python/examples/z_dual_numbers.py
sgillen/tiny-differentiable-simulator
862
11125912
<filename>python/examples/z_dual_numbers.py import pytinydiffsim_dual as pd def auto_diff(f, x): return f(pd.TinyDualDouble(x, 1.)).dual() x = pd.TinyDualDouble(2,1) y = pd.TinyDualDouble(3,0) print(x) print(y) f = (x*x)*x print(f) print("pytinydiffsim.TinyDualDouble") print(auto_diff(lambda x:pd.TinyDualDoubl...
tests/components/guardian/__init__.py
domwillcode/home-assistant
30,023
11125986
"""Tests for the Elexa Guardian integration."""
api/environments/identities/traits/constants.py
mevinbabuc/flagsmith
1,259
11126055
<filename>api/environments/identities/traits/constants.py<gh_stars>1000+ from features.value_types import BOOLEAN, FLOAT, INTEGER, STRING ACCEPTED_TRAIT_VALUE_TYPES = [INTEGER, STRING, BOOLEAN, FLOAT] TRAIT_STRING_VALUE_MAX_LENGTH = 2000
msticpy/vis/matrix_plot.py
kubajir/msticpy
820
11126066
<reponame>kubajir/msticpy<gh_stars>100-1000 # ------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. # Licensed under the MIT License. See License.txt in the project root for # license information. # -----------------------------------------...
modules/rfblock.py
ZAKAUDD/LightNet
737
11126110
<reponame>ZAKAUDD/LightNet<gh_stars>100-1000 import time import torch import torch.nn as nn from modules import InPlaceABN from collections import OrderedDict from torch.autograd import Variable class RFBlock(nn.Module): def __init__(self, in_chs, out_chs, scale=0.1, feat_res=(56, 112), aspp_sec=(12, 24, 36), ...
pingo/arduino/test_util_firmata.py
pingo-io/pingo-py
116
11126142
import unittest from util_firmata import pin_list_to_board_dict class FirmataCapabilityDetect(unittest.TestCase): def test_capability_response(self): test_layout = { 'digital': (0, 1), 'analog': (0,), # Analog are numbered from zero 'pwm': (1,), 'i2c': (2...
netpyne/tutorials/netpyne_tut0.py
adamjhn/netpyne
120
11126144
<reponame>adamjhn/netpyne """ Install NetPyNE tutorials """ import os os.system("mkdir netpyne_tuts && cd netpyne_tuts && export PATH=/bin:/usr/bin && python3 -m venv env && source env/bin/activate && python3 -m pip install --upgrade pip && python3 -m pip install --upgrade ipython && python3 -m pip install --upgrade ...
src/algorithms/__init__.py
LaudateCorpus1/hermes-5
135
11126162
import cf import content_based import content_based_kmeans import performance_metrics import recommender_helpers import simple_hybrid
tests/test_pandas.py
python-pipe/hellp
123
11126194
import pandas as pd from sspipe import p, px def test_px_slice(): df = pd.DataFrame(dict(x=[1, 2, 0], y=[3, 4, 5])) assert (df | px[(px.x > 1) & (px.x < px.y)].y.sum()) == 4 def test_dataframe(): df = {'x': [0, 1, 2], 'y': [3, 4, 5]} | p(pd.DataFrame) assert df.shape == (3, 2) df = [{'x': 0, 'y...
applications/CoSimulationApplication/python_scripts/factories/convergence_criterion_factory.py
lkusch/Kratos
778
11126200
<gh_stars>100-1000 from KratosMultiphysics.CoSimulationApplication.factories import base_factory def CreateConvergenceCriterion(convergence_criterion_settings, *args): """This function creates and returns the Convergence Criterion used for CoSimulation""" return base_factory.Create(convergence_criterion_settin...
Python/control/system_id.py
hpbader42/Klampt
238
11126208
<reponame>hpbader42/Klampt from online_leastsq import OnlineLeastSquares import numpy as np import math class LinearSystemID: """System identification for a system y = Ax + Bu + C with m state variables and n inputs.""" def __init__(self,m,n): self.m,self.n = m,n self.coeffPattern = [None,N...
conans/server/rest/controller/v2/conan.py
matthiasng/conan
6,205
11126211
<reponame>matthiasng/conan<filename>conans/server/rest/controller/v2/conan.py from bottle import request from conans.errors import NotFoundException from conans.model.ref import ConanFileReference from conans.server.rest.bottle_routes import BottleRoutes from conans.server.rest.controller.v2 import get_package_ref fro...
toyplot/style.py
eaton-lab/toyplot
438
11126239
<gh_stars>100-1000 # Copyright 2014, Sandia Corporation. Under the terms of Contract # DE-AC04-94AL85000 with Sandia Corporation, the U.S. Government retains certain # rights in this software. """Functionality for working with CSS style information.""" import numbers import numpy import toyplot.color def require(...
cacreader/swig-4.0.2/Examples/test-suite/python/python_extranative_runme.py
kyletanyag/LL-Smartcard
1,031
11126316
import python_extranative vs = python_extranative.make_vector_string() if not isinstance(vs, python_extranative.VectorString): # will be of type tuple if extranative not working raise RuntimeError("Not of type VectorString") for s1, s2 in zip(vs, ["one", "two"]): if s1 != s2: raise RuntimeError("M...
depricated/smoothline.py
ksachdeva/distfit
126
11126352
# ---------------------------------------------------- # Name : smoothline.py # Author : E.Taskesen # Contact : <EMAIL> # Licence : MIT # ---------------------------------------------------- import numpy as np from scipy.interpolate import make_interp_spline def smoothline(xs, ys=None, interpol=3,...
lisa/core/__init__.py
jrespeto/LiSa
244
11126409
""" Core package. """
GPy/examples/__init__.py
ekalosak/GPy
1,685
11126410
# Copyright (c) 2012-2014, GPy authors (see AUTHORS.txt). # Licensed under the BSD 3-clause license (see LICENSE.txt) """ Introduction ^^^^^^^^^^^^ The examples in this package usually depend on `pods <https://github.com/sods/ods>`_ so make sure you have that installed before running examples. The easiest way to do t...
community-content/tf_agents_bandits_movie_recommendation_with_kfp_and_vertex_sdk/step_by_step_sdk_tf_agents_bandits_movie_recommendation/src/tests/test_policy_util.py
gogasca/vertex-ai-samples
213
11126417
# 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, ...
libheap/frontend/commands/gdb/mstats.py
saidelike/libheap
498
11126420
<filename>libheap/frontend/commands/gdb/mstats.py<gh_stars>100-1000 from __future__ import print_function import sys try: import gdb except ImportError: print("Not running inside of GDB, exiting...") sys.exit() from libheap.frontend.printutils import print_error from libheap.frontend.printutils import pr...
stats/models/Game.py
twist3dimages/nba-sql
113
11126421
from peewee import ( ForeignKeyField, IntegerField, DateField, Model ) from . import Team class Game(Model): # Primary Key game_id = IntegerField(primary_key=True) # Foreign Keys team_id_home = ForeignKeyField(Team, index=True, null=False, column_name='team_id_home') team_id_away...
strawberry/utils/mixins.py
otakuy/strawberry
2,062
11126442
<reponame>otakuy/strawberry from typing import Optional from strawberry.utils.str_converters import to_camel_case class GraphQLNameMixin: python_name: str graphql_name: Optional[str] def get_graphql_name(self, auto_camel_case: bool) -> str: if self.graphql_name is not None: return se...
sqlbeautifier.py
V-Darr/SqlBeautifier
179
11126452
<reponame>V-Darr/SqlBeautifier import sublime, sublime_plugin import sys import os sys.path.append(os.path.dirname(__file__)) if sys.version_info >= (3, 0): import sqlparse3 as sqlparse else: import sqlparse2 as sqlparse # for ST2 settings = sublime.load_settings('SQL Beautifier.sublime-settings') # for S...
exercises/all-your-base/all_your_base.py
kishankj/python
1,177
11126454
def rebase(input_base, digits, output_base): pass
web/webViews/dashboard.py
anbo225/docklet
273
11126474
from flask import session,render_template from webViews.view import normalView from webViews.dockletrequest import dockletRequest class dashboardView(normalView): template_path = "dashboard.html" @classmethod def get(self): result = dockletRequest.post_to_all('/cluster/list/') desc = dock...
src/models/model_config.py
zju-3dv/multi-person3dpose
391
11126477
from __future__ import absolute_import from __future__ import division from __future__ import print_function import sys import os class ModelConfig ( object ): model_dir = os.path.abspath ( os.path.join ( os.path.dirname ( __file__ ) ) ) root_dir = os.path.abspath ( os.path.join ( model_dir, '..', '..' ) ) ...
corehq/apps/sso/utils/session_helpers.py
akashkj/commcare-hq
471
11126505
<reponame>akashkj/commcare-hq import logging log = logging.getLogger(__name__) def store_saml_data_in_session(request): """ This stores SAML-related authentication data in the request's session :param request: HttpRequest """ request.session['samlUserdata'] = request.saml2_auth.get_attributes() ...
tests/activeBlock.py
apple314159/urweb
837
11126520
import unittest import base import time class Suite(base.Base): def test_1(self): """Test case 1""" self.start() alert = self.driver.switch_to.alert self.assertEqual("Error: May not 'sleep' in main thread of 'code' for <active>", alert.text) alert.accept() time.slee...
inceptor/engine/Filter.py
whitefi/inceptor
743
11126545
class Filter: def __init__(self, include: list = None, exclude: list = None, imode="or", emode="and"): self.include = include if include else [] self.exclude = exclude if exclude else [] self.imode = imode.lower() self.emode = emode.lower() def match(self, target): match...
tests/convert_gl2pt_dense.py
naviocean/imgclsmob
2,649
11126608
<filename>tests/convert_gl2pt_dense.py import numpy as np import mxnet as mx import torch from torch.autograd import Variable class GluonModel(mx.gluon.HybridBlock): def __init__(self, **kwargs): super(GluonModel, self).__init__(**kwargs) with self.name_scope(): self...
322 Coin Change.py
ChiFire/legend_LeetCode
872
11126698
""" You are given coins of different denominations and a total amount of money amount. Write a function to compute the fewest number of coins that you need to make up that amount. If that amount of money cannot be made up by any combination of the coins, return -1. Example 1: coins = [1, 2, 5], amount = 11 return 3 (1...
src/genie/libs/parser/iosxe/tests/ShowL2fibBdPort/cli/equal/golden_output2_expected.py
balmasea/genieparser
204
11126735
expected_output = { 'Et0/1:11': { 'type': 'BD_PORT', 'is_path_list': False, 'port': 'Et0/1:11' }, '[IR]20011:2.2.2.2': { 'type':'VXLAN_REP', 'is_path_list': True, 'path_list': { 'id': 1190, 'path_count': 1, 'type': 'VXLAN_RE...
tests/test_node_set/test_bitcoind/test_bitcoind_node.py
ryan-lingle/node-launcher
249
11126755
import pytest from node_launcher.node_set.lib.node_status import NodeStatus from node_launcher.node_set.bitcoind.bitcoind_node import BitcoindNode from node_launcher.node_set.tor.tor_node import TorNode @pytest.fixture def tor_node(): return TorNode() @pytest.fixture def bitcoind_node(): return BitcoindNod...
dpc/run/eval_camera_pose.py
kyuhyoung/differentiable-point-clouds
153
11126761
<reponame>kyuhyoung/differentiable-point-clouds import startup import os import numpy as np import scipy.io import tensorflow as tf from util.simple_dataset import Dataset3D from util.app_config import config as app_config from util.quaternion import quaternion_multiply, quaternion_conjugate from util.camera import ...
pypika/tests/test_drop.py
YiuRULE/pypika
1,616
11126796
<filename>pypika/tests/test_drop.py<gh_stars>1000+ import unittest from pypika import ( Columns, Database, Query, Tables, ) class DropTableTests(unittest.TestCase): database_xyz = Database("mydb") new_table, existing_table = Tables("abc", "efg") foo, bar = Columns(("a", "INT"), ("b", "VAR...
pydebloatx/gui_main.py
space9bug/PyDebloatX
730
11126863
<filename>pydebloatx/gui_main.py # -*- coding: utf-8 -*- from PySide6.QtWidgets import QFrame, QPushButton, QMainWindow, QWidget, QLabel, QVBoxLayout, QCheckBox, QHBoxLayout, \ QProgressBar, QToolTip from PySide6.QtCore import Qt, QRect, QCoreApplication, QMetaObject, QSize from PySide6.QtGui import QIcon, QKeySequ...
neural-networks-intro/SimpleNeuralNetwork.py
mervatkheir/kite-python-blog-post-code
238
11126868
#!/usr/bin/env python # coding: utf-8 from numpy import exp, dot, random, array """Python code for simple Artificial Neural Network with one hidden layer""" def initialize_weights(): # Generate random numbers random.seed(1) # Assign random weights to a 3 x 1 matrix synaptic_weights = random.uniform...
lightreid/models/heads/__init__.py
nataliamiccini/light-reid
296
11126884
""" Author: <NAME> E-mail: <EMAIL> """ from .build import HEADs_REGISTRY, build_head # import heads, so they will be registered from .bn_head import BNHead from .code_pyramid import CodePyramid from .pcb_head import PCBHead
vae/flax/utils.py
vipavlovic/pyprobml
4,895
11126893
<filename>vae/flax/utils.py import jax import math import jax.numpy as jnp import matplotlib.pyplot as plt def save_image(ndarray, fp, nrow=8, padding=2, pad_value=0.0, format=None): """Make a grid of images and Save it into an image file. Args: ndarray (array_like): 4D mini-batch images of shape (B x H x W...
pyrival/graphs/centroid_decomposition.py
MattJDavidson/aoc2021
748
11126903
<filename>pyrival/graphs/centroid_decomposition.py def centroid_decomposition(graph): """ Given a tree, this function is a generator that 1. Roots the tree at its centroid (modifying graph) 2. Yields centroid 3. Removes centroid from the graph 4. Recurses on the forest left after the removal ...
test/test_web.py
complexdb/zincbase
174
11126905
<gh_stars>100-1000 def test_index(server_and_args): app, server, args = server_and_args response = app.test_client().get('/') assert response.status_code == 200 data = response.data.decode('utf-8') assert '<title>Zincbase Graph Server</title>' in data assert 'src="bundle.js"' in data
libweasyl/libweasyl/alembic/versions/c1f8375b5805_split_login_charsettings_to_columns.py
akash143143/weasyl
111
11126923
<reponame>akash143143/weasyl<gh_stars>100-1000 """Split login charsettings to columns, removing birthday reset Removes login.settings, replacing with a distinct column (login.force_password_reset) for forced password resets. Drops forced resets of birthdays entirely, and opts to leverage existing permaban/suspension t...
bin/config.py
hhcho/ample
176
11126936
<gh_stars>100-1000 import fileinput import sys data_names = None if data_names is None: if len(sys.argv) == 1: print('Enter data names followed by EOF/Ctrl-D:') data_names = [] for line in fileinput.input(): fields = line.rstrip().split(',') for f in fields: if f.s...
src/arcrest/manageportal/administration.py
kevinsigwart/ArcREST
208
11126961
""" The ArcREST API allows you to perform administrative tasks not available in the Portal for ArcGIS website. The API is organized into resources and operations. Resources are entities within Portal for ArcGIS that hold some information and have a well-defined state. Operations act on these resources and update their ...
tests/pydbgen_test.py
alexwohletz/pydbgen
221
11126969
from fakedbclass import fakedb fdb = fakedb() for _ in range(10): print (fdb.ph())
src/genie/libs/parser/iosxe/tests/ShowDeviceTrackingFeatures/cli/equal/golden_output_expected.py
balmasea/genieparser
204
11127002
expected_output = { "features":{ "DHCP Guard":{ "feature":"DHCP Guard", "priority":200, "state":"READY" }, "RA guard":{ "feature":"RA guard", "priority":192, "state":"READY" } } }
examples.py/3D/Form/CubicGrid.py
timgates42/processing.py
1,224
11127064
""" Cubic Grid by <NAME>. 3D translucent colored grid uses nested pushMatrix() and popMatrix() functions. """ boxSize = 40 margin = boxSize*2 depth = 400 def setup(): size(640, 360, P3D) noStroke() def draw(): background(255) # Center and spin grid translate(width/2, height/...
datasets/chinese_bert_dataset.py
chinaliwenbo/ChineseBert
298
11127075
<gh_stars>100-1000 #!/usr/bin/env python # -*- coding: utf-8 -*- """ @file : chinese_bert_dataset.py @author: zijun @contact : <EMAIL> @date : 2021/6/29 17:35 @version: 1.0 @desc : Base Class for dataset """ import json import os from typing import List import tokenizers from pypinyin import pinyin, Style from toke...
lib/utils/video.py
wjbKimberly/DetectAndTrack-wjb
1,007
11127099
<gh_stars>1000+ ############################################################## # Copyright (c) 2018-present, Facebook, Inc. # All rights reserved. # # This source code is licensed under the license found in the # LICENSE file in the root directory of this source tree. ###################################################...
create_caffemodel.py
lFatality/tensorflow2caffe
115
11127103
from __future__ import print_function, division caffe_root = '/TUB/robo/caffe-master/' import sys sys.path.insert(0, caffe_root+'python') import caffe import numpy as np #load the data file data_file = np.load('vgg_net_19_112.npy') #get the weights and biases out of the array #the weights have to be transposed beca...
tests/test_backends.py
Zagrebelin/django_mail_admin
179
11127145
<gh_stars>100-1000 from django.core.mail import send_mail from django.core.mail.backends.base import BaseEmailBackend from django.test import TestCase from django.test.utils import override_settings from django_mail_admin.mail import send from django_mail_admin.settings import get_backend from django_mail_admin.backen...
Utils/Arguments.py
GingerNg/SDNet
112
11127149
<gh_stars>100-1000 # Copyright (c) Microsoft Corporation. # Licensed under the MIT license. import os class Arguments: def __init__(self, confFile): if not os.path.exists(confFile): raise Exception("The argument file does not exist: " + confFile) self.confFile = confFile def is_in...
sample_files/sample_CSV/verify.py
elihschiff/Submitty
411
11127150
def parse_assigned_zones(): allowed_str = 'ABCDEFGHJKLMNPUZ' assigned_zone_dict = {} with open('exam1_seating.txt', 'r') as assigned: for line in assigned: line = line.strip() line_list = line.split(' ') line_list = [ line_.strip() for line_ in line_list ] ...
lib/discoverlib/coords.py
Pandinosaurus/roadtracer
171
11127165
<filename>lib/discoverlib/coords.py import geom import math ORIGIN_SHIFT = 2 * math.pi * 6378137 / 2.0 def lonLatToMeters(p): mx = p.x * ORIGIN_SHIFT / 180.0 my = math.log(math.tan((90 + p.y) * math.pi / 360.0)) / (math.pi / 180.0) my = my * ORIGIN_SHIFT / 180.0 return geom.FPoint(mx, my) def metersToLonLat(p):...
plaso/formatters/winlnk.py
cugu-stars/plaso
1,253
11127216
<reponame>cugu-stars/plaso<filename>plaso/formatters/winlnk.py<gh_stars>1000+ # -*- coding: utf-8 -*- """Windows Shortcut (LNK) custom event formatter helpers.""" from plaso.formatters import interface from plaso.formatters import manager class WindowsShortcutLinkedPathFormatterHelper( interface.CustomEventForma...
tests/unit/operations/test_configops.py
myungseokang/aws-elastic-beanstalk-cli
110
11127227
# -*- coding: utf-8 -*- # Copyright 2017 Amazon.com, Inc. or its affiliates. All Rights Reserved. # # Licensed under the Apache License, Version 2.0 (the "License"). You # may not use this file except in compliance with the License. A copy of # the License is located at # # http://aws.amazon.com/apache2.0/ # # or in t...
interpreter.py
aluo-x/shape2prog
109
11127237
<reponame>aluo-x/shape2prog<gh_stars>100-1000 from __future__ import print_function import numpy as np class Interpreter(object): """interpreting program vectors into understandable program strings""" def __init__(self, translate, rotate, end): self.translate = translate self.rotate = rotate ...
nodes/2.x/python/View.Phase.py
andydandy74/ClockworkForDynamo
147
11127287
<filename>nodes/2.x/python/View.Phase.py import clr clr.AddReference('RevitAPI') from Autodesk.Revit.DB import * clr.AddReference("RevitNodes") import Revit clr.ImportExtensions(Revit.Elements) def GetViewPhase(view): try: return view.Document.GetElement(view.get_Parameter(BuiltInParameter.VIEW_PHASE).AsElementId())...
bark/python_wrapper/tests/py_renderer_tests.py
xmyqsh/bark
174
11127293
try: import debug_settings except: pass import unittest # BARK from bark.core.world.renderer import * from bark.core.geometry import * class RendererTests(unittest.TestCase): def test_renderer(self): renderer = Renderer() renderer.Clear() def test_line2d_primitive(self): renderer = Rende...
src/super_gradients/training/utils/export_utils.py
Deci-AI/super-gradients
308
11127309
import torch import torch.nn as nn import torch.nn.functional as F class ExportableHardswish(nn.Module): ''' Export-friendly version of nn.Hardswish() ''' @staticmethod def forward(x): return x * F.hardtanh(x + 3, 0., 6.) / 6. # for torchscript, CoreML and ONNX class ExportableSiLU(nn....
tests/models/siamese_bilstm/test_siamese_matching_bilstm.py
tjaffri/paraphrase-id-tensorflow
354
11127312
<reponame>tjaffri/paraphrase-id-tensorflow<filename>tests/models/siamese_bilstm/test_siamese_matching_bilstm.py from overrides import overrides import math import tensorflow as tf from duplicate_questions.data.data_manager import DataManager from duplicate_questions.data.embedding_manager import EmbeddingManager from ...
python/eet/transformers/modeling_bert.py
NetEase-FuXi/EET
174
11127333
# # Created by djz on 2021/01/21. # """EET transformers bert model. """ import math import time import torch import torch.nn as nn import numpy as np from torch import Tensor from typing import Any, Dict, List, Optional, Tuple from transformers import BertModel from EET import MetaDesc as meta_desc from EET import F...