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
manim/utils/unit.py
PhotonSpheres/manim
9,497
34325
"""Implement the Unit class.""" import numpy as np from .. import config, constants __all__ = ["Pixels", "Degrees", "Munits", "Percent"] class _PixelUnits: def __mul__(self, val): return val * config.frame_width / config.pixel_width def __rmul__(self, val): return val * config.frame_width ...
package/awesome_panel/express/bootstrap/modal.py
slamer59/awesome-panel
179
34341
<gh_stars>100-1000 """In this module we provide the functionality of a Modal. The Modal can be used to focus some kind of information like text, images, chart or an interactive dashboard. The implementation is inspired by - https://css-tricks.com/considerations-styling-modal/ - https://codepen.io/henchme...
python/paddle/distributed/fleet/meta_optimizers/fp16_allreduce_optimizer.py
zmxdream/Paddle
17,085
34342
# 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 app...
CondTools/Geometry/python/HGCalParametersWriter_cff.py
ckamtsikis/cmssw
852
34369
<gh_stars>100-1000 import FWCore.ParameterSet.Config as cms from CondTools.Geometry.HGCalEEParametersWriter_cfi import * from Configuration.ProcessModifiers.dd4hep_cff import dd4hep dd4hep.toModify(HGCalEEParametersWriter, fromDD4Hep = cms.bool(True) ) HGCalHESiParametersWriter = HGCalEEParametersWr...
examples/python/src/authors/models.py
ShivamSarodia/sqlc
5,153
34443
# Code generated by sqlc. DO NOT EDIT. import dataclasses from typing import Optional @dataclasses.dataclass() class Author: id: int name: str bio: Optional[str]
RecoMuon/MuonIsolationProducers/test/isoTest_cfg.py
ckamtsikis/cmssw
852
34469
<gh_stars>100-1000 # The following comments couldn't be translated into the new config version: # # keep only muon-related info here # import FWCore.ParameterSet.Config as cms process = cms.Process("MISO") process.load("Configuration.EventContent.EventContent_cff") # service = MessageLogger { # untracked ...
tests/bench/test_yahoo_nyse_VRS.py
jmabry/pyaf
377
34475
import pyaf.Bench.TS_datasets as tsds import pyaf.Bench.YahooStocks as ys import warnings symbol_lists = tsds.get_yahoo_symbol_lists(); y_keys = sorted(symbol_lists.keys()) print(y_keys) k = "nysecomp" tester = ys.cYahoo_Tester(tsds.load_yahoo_stock_prices(k) , "YAHOO_STOCKS_" + k); with warnings.catch_warnings(): ...
events/migrations/0040_event_team_size.py
horacexd/clist
166
34482
<reponame>horacexd/clist # Generated by Django 2.2.10 on 2020-04-03 19:10 from django.db import migrations, models class Migration(migrations.Migration): dependencies = [ ('events', '0039_event_limits'), ] operations = [ migrations.AddField( model_name='event', n...
rllib/contrib/bandits/envs/__init__.py
firebolt55439/ray
21,382
34492
from ray.rllib.contrib.bandits.envs.discrete import LinearDiscreteEnv, \ WheelBanditEnv from ray.rllib.contrib.bandits.envs.parametric import ParametricItemRecoEnv __all__ = ["LinearDiscreteEnv", "WheelBanditEnv", "ParametricItemRecoEnv"]
tests/k8s/k8s_test_utilities.py
shubav/sonic-mgmt
132
34500
import logging import time from tests.common.helpers.assertions import pytest_assert logger = logging.getLogger(__name__) def join_master(duthost, master_vip): """ Joins DUT to Kubernetes master Args: duthost: DUT host object master_vip: VIP of high availability Kubernetes master If...
common/py_vulcanize/third_party/rjsmin/_setup/py2/data.py
tingshao/catapult
2,151
34508
# -*- coding: ascii -*- # # Copyright 2007, 2008, 2009, 2010, 2011 # <NAME> or his licensors, as applicable # # 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/licen...
keyboard/mechanical-button/single-button/keyboard.py
ELE-Clouds/mpy-lib
116
34516
<filename>keyboard/mechanical-button/single-button/keyboard.py # -*- coding:UTF-8 -*- ''' MIT License 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 restr...
sionna/channel/tr38901/__init__.py
NVlabs/sionna
163
34527
# # SPDX-FileCopyrightText: Copyright (c) 2021-2022 NVIDIA CORPORATION & AFFILIATES. All rights reserved. # SPDX-License-Identifier: Apache-2.0 # """ Channel sub-package of the Sionna library implementing 3GPP TR39.801 models. """ # pylint: disable=line-too-long from .antenna import AntennaElement, AntennaPanel, Pane...
skin_detector/scripts.py
version0chiro/xilinx_Code
154
34537
#!/usr/bin/env python # -*- coding: utf-8 -*- __author__ = '<NAME>' import os import cv2 import numpy def find_images(path, recursive=False, ignore=True): if os.path.isfile(path): yield path elif os.path.isdir(path): assert os.path.isdir(path), 'FileIO - get_images: Directory does not exist'...
oslo_config/_list_opts.py
CyrilRoelandteNovance/oslo.config
110
34542
<gh_stars>100-1000 # 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...
src/gam/gapi/reports.py
GAM-team/GAM
102
34599
import calendar import datetime import re import sys from dateutil.relativedelta import relativedelta import gam from gam.var import * from gam import controlflow from gam import display from gam import gapi from gam import utils from gam.gapi.directory import orgunits as gapi_directory_orgunits def build(): re...
src/mcedit2/widgets/infopanel.py
elcarrion06/mcedit2
673
34617
""" ${NAME} """ from __future__ import absolute_import, division, print_function, unicode_literals import logging import time import weakref from PySide import QtGui from mcedit2.widgets.layout import Column log = logging.getLogger(__name__) class InfoPanel(QtGui.QWidget): def __init__(self, attrs, signals...
tests/test_packages/test_skills/test_tac_negotiation/test_helpers.py
bryanchriswhite/agents-aea
126
34625
# -*- coding: utf-8 -*- # ------------------------------------------------------------------------------ # # Copyright 2018-2019 Fetch.AI Limited # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the ...
examples/xlnet/utils/processor.py
qinzzz/texar-pytorch
746
34680
<filename>examples/xlnet/utils/processor.py # Copyright 2019 The Texar 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/LI...
modules/text/text_generation/plato2_en_base/module.py
AK391/PaddleHub
8,360
34703
# coding:utf-8 # 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 requ...
labs-code/python/standard-product-track/get_followers.py
aod2004/getting-started-with-the-twitter-api-v2-for-academic-research
282
34749
from twarc import Twarc2, expansions import json # Replace your bearer token below client = Twarc2(bearer_token="<PASSWORD>") def main(): # The followers function gets followers for specified user followers = client.followers(user="twitterdev") for page in followers: result = expansions.flatten(p...
saleor/product/migrations/0168_fulfil_digitalcontenturl_orderline_token.py
eanknd/saleor
1,392
34773
# Generated by Django 3.2.12 on 2022-04-12 14:00 from django.db import migrations class Migration(migrations.Migration): dependencies = [ ("product", "0167_digitalcontenturl_order_line_token"), ("order", "0140_alter_orderline_old_id_and_created_at"), ] operations = [ migrations....
tests/greedy/test_oblate_system.py
rodluger/starry
116
34794
import starry import numpy as np import matplotlib.pyplot as plt import pytest @pytest.mark.parametrize("ydeg,nw", [[0, None], [0, 10], [1, None], [1, 10]]) def test_system(ydeg, nw): # Oblate map map = starry.Map(udeg=2, ydeg=ydeg, oblate=True, nw=nw) map[1] = 0.5 map[2] = 0.25 map.omega = 0.5 ...
torchpq/transform/PCA.py
mhamilton723/TorchPQ
103
34800
<filename>torchpq/transform/PCA.py import torch import numpy as np from ..CustomModule import CustomModule class PCA(CustomModule): def __init__(self, n_components): """ Principle Component Analysis (PCA) n_components: int number of principle components """ super(PCA, self).__init__() ...
tests/batch/base_parse_replication_stream_test.py
ywlianghang/mysql_streamer
419
34853
<gh_stars>100-1000 # -*- coding: utf-8 -*- # Copyright 2016 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 a...
tests/pup/sensors/ultrasonic_lights.py
cschlack/pybricks-micropython
115
34862
# SPDX-License-Identifier: MIT # Copyright (c) 2020 The Pybricks Authors """ Hardware Module: 1 Description: This tests the lights on the Ultrasonic Sensor. No external sensors are used to verify that it works. """ from pybricks.pupdevices import UltrasonicSensor from pybricks.parameters import Port from pybricks.to...
test/test_nn/test_distribution/test_gaussian.py
brunomaga/PRML
11,017
34896
import unittest import numpy as np import prml.nn as nn class TestGaussian(unittest.TestCase): def test_gaussian_draw_forward(self): mu = nn.array(0) sigma = nn.softplus(nn.array(-1)) gaussian = nn.Gaussian(mu, sigma) sample = [] for _ in range(1000): sample.ap...
examples/qp2q/preprocessing/session_data_processing.py
xeisberg/pecos
288
34931
"""The module contains functions to preprocess input datasets into usable format.""" import gc import gzip import json import logging import multiprocessing as mp import pathlib import sys from itertools import repeat import numpy as np import scipy.sparse as smat logging.basicConfig( stream=sys.stdout, format...
SymbolExtractorAndRenamer/lldb/packages/Python/lldbsuite/test/expression_command/options/TestExprOptions.py
Polidea/SiriusObfuscator
427
34939
<reponame>Polidea/SiriusObfuscator """ Test expression command options. Test cases: o test_expr_options: Test expression command options. """ from __future__ import print_function import os import time import lldb import lldbsuite.test.lldbutil as lldbutil from lldbsuite.test.lldbtest import * class ExprOption...
src/permission/backends.py
dkopitsa/django-permission
234
34941
# coding=utf-8 """ Logical permission backends module """ from permission.conf import settings from permission.utils.handlers import registry from permission.utils.permissions import perm_to_permission __all__ = ('PermissionBackend',) class PermissionBackend(object): """ A handler based permission backen...
algorithms/Python/sorting/selection_sort.py
Tanmoy07tech/DSA
247
34975
''' Find the largest element and place that element at the bottom of the list. Repeat for each sub-array. O(n^2) time complexity. ''' from string import ascii_letters arrays = ( [12, 3, 7, 22, -12, 100, 1], [10, 9, 8, 7, 6, 5, 4, 3, 2, 1, 0], [4, 1, 3, 9, 7], [0, -1.5, 1.5, 1.3, -1.3, -1.01, 1.01], list(revers...
infra/utils.py
BrandoZhang/alis
176
35030
<filename>infra/utils.py<gh_stars>100-1000 import os import shutil import subprocess from distutils.dir_util import copy_tree from shutil import copyfile from typing import List, Optional import click import git from omegaconf import DictConfig def copy_objects(target_dir: os.PathLike, objects_to_copy: List[os.PathL...
library/source1/mdl/structs/__init__.py
anderlli0053/SourceIO
199
35047
from ....utils.byte_io_mdl import ByteIO from ....shared.base import Base
Calibration/EcalAlCaRecoProducers/python/alcastreamEcalPhiSym_cff.py
ckamtsikis/cmssw
852
35067
# The following comments couldn't be translated into the new config version: #------------------------------------------------ #AlCaReco filtering for phi symmetry calibration: #------------------------------------------------ # # Passes events that are coming from the online phi-symmetry stream # # import FWCore.P...
frameworks/Python/spyne/gen_benchmark_config.py
xsoheilalizadeh/FrameworkBenchmarks
5,300
35076
<filename>frameworks/Python/spyne/gen_benchmark_config.py #!/usr/bin/env python from __future__ import print_function import json from spyne import AnyUri, Unicode, ComplexModel, M, UnsignedInteger16, Array from spyne.protocol.json import JsonDocument from spyne.util.dictdoc import get_object_as_dict class Benchma...
slack_bolt/response/__init__.py
korymath/bolt-python
160
35078
<filename>slack_bolt/response/__init__.py<gh_stars>100-1000 from .response import BoltResponse
simtbx/diffBragg/attr_list.py
dperl-sol/cctbx_project
155
35094
from __future__ import division """ critical properties of diffBragg objects which should be logged for reproducibility """ # TODO : implement a savestate and getstate for these objects # attrs of diffBragg() instances DIFFBRAGG_ATTRS = [ 'Amatrix', 'Bmatrix', 'Ncells_abc', 'Ncells_abc_aniso', 'Ncells_def', 'N...
tests/data/fields/field_test.py
MSLars/allennlp
11,433
35095
from allennlp.data.fields import Field def test_eq_with_inheritance(): class SubField(Field): __slots__ = ["a"] def __init__(self, a): self.a = a class SubSubField(SubField): __slots__ = ["b"] def __init__(self, a, b): super().__init__(a) ...
leo/modes/kivy.py
ATikhonov2/leo-editor
1,550
35098
<gh_stars>1000+ # Leo colorizer control file for kivy mode. # This file is in the public domain. # Properties for kivy mode. properties = { "ignoreWhitespace": "false", "lineComment": "#", } # Attributes dict for kivy_main ruleset. kivy_main_attributes_dict = { "default": "null", "digit_re...
tools/cr/cr/commands/info.py
zealoussnow/chromium
14,668
35127
<filename>tools/cr/cr/commands/info.py # Copyright 2013 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. """A module for the info implementation of Command.""" from __future__ import print_function import cr class InfoC...
gsheetsdb/types.py
tim-werner/gsheets-db-api
176
35160
from __future__ import absolute_import from __future__ import division from __future__ import print_function from __future__ import unicode_literals from enum import Enum class Type(Enum): STRING = 'string' NUMBER = 'number' BOOLEAN = 'boolean' DATE = 'date' DATETIME = 'datetime' TIMEOFDAY = ...
env/Lib/site-packages/OpenGL/GL/ARB/shader_clock.py
5gconnectedbike/Navio2
210
35218
'''OpenGL extension ARB.shader_clock This module customises the behaviour of the OpenGL.raw.GL.ARB.shader_clock to provide a more Python-friendly API Overview (from the spec) This extension exposes a 64-bit monotonically incrementing shader counter which may be used to derive local timing information within a ...
learning/pytorch/models/rnn_models.py
thomasehuang/Ithemal-Extension
105
35232
#this file contains models that I have tried out for different tasks, which are reusable #plus it has the training framework for those models given data - each model has its own data requirements import numpy as np import common_libs.utilities as ut import random import torch.nn as nn import torch.autograd as autograd...
fewshot/models/refine_model.py
ashok-arjun/few-shot-ssl-public
497
35259
<reponame>ashok-arjun/few-shot-ssl-public # Copyright (c) 2018 <NAME>, <NAME>, <NAME>, <NAME>, # <NAME>, <NAME>, <NAME>, <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 rest...
migrations/versions/6245d75fa12_exceptions_table.py
boladmin/security_monkey
4,258
35281
"""Exceptions Table Revision ID: 6245d75fa12 Revises: <PASSWORD> Create Date: 2016-08-16 11:35:38.575026 """ # revision identifiers, used by Alembic. revision = '6245d75fa12' down_revision = 'e0a6af364a3f' from alembic import op import sqlalchemy as sa def upgrade(): ### commands auto generated by Alembic - p...
ml/gan_test.py
Ryoich/python_zero
203
35336
<reponame>Ryoich/python_zero import matplotlib.pyplot as plt import numpy as np import tensorflow as tf tf.logging.set_verbosity(tf.logging.ERROR) def generator_fn(noise, weight_decay=2.5e-5, is_training=True): layers = tf.contrib.layers framework = tf.contrib.framework f1 = framework.arg_scope( ...
code/src/main.py
ChaofWang/AWSRN
162
35359
<filename>code/src/main.py<gh_stars>100-1000 import torch import utility import data import model import loss from option import args from trainer import Trainer def print_network(net): num_params = 0 for param in net.parameters(): num_params += param.numel() print(net) print('Total number of ...
maskrcnn_benchmark/utils/big_model_loading.py
microsoft/GLIP
295
35377
import numpy as np import torch import torch.nn as nn from collections import OrderedDict def tf2th(conv_weights): """Possibly convert HWIO to OIHW.""" if conv_weights.ndim == 4: conv_weights = conv_weights.transpose([3, 2, 0, 1]) return torch.from_numpy(conv_weights) def _rename_...
tests/simple_test.py
leoauri/auraloss
272
35390
<gh_stars>100-1000 import torch import auraloss input = torch.rand(8, 2, 44100) target = torch.rand(8, 2, 44100) loss = auraloss.freq.SumAndDifferenceSTFTLoss() print(loss(input, target))
challenges/Sorter/poller/for-release/machine.py
pingjuiliao/cb-multios
473
35421
from generator.actions import Actions import random import string import struct import numpy as np import math import datetime as dt import ctypes def kaprica_mixin(self): if hasattr(self, 'xlat_seed'): return def xlat_seed(seed): def hash_string(seed): H = 0x314abc86 f...
data_util.py
imalikshake/StyleNet
202
35426
<filename>data_util.py<gh_stars>100-1000 import numpy as np class BatchGenerator(object): '''Generator for returning shuffled batches. data_x -- list of input matrices data_y -- list of output matrices batch_size -- size of batch input_size -- input width output_size -- output width mini -...
python/helpers/pydev/third_party/wrapped_for_pydev/ctypes/wintypes.py
truthiswill/intellij-community
695
35439
<gh_stars>100-1000 #@PydevCodeAnalysisIgnore # XXX This module needs cleanup. from ctypes import * DWORD = c_ulong WORD = c_ushort BYTE = c_byte ULONG = c_ulong LONG = c_long LARGE_INTEGER = c_longlong ULARGE_INTEGER = c_ulonglong HANDLE = c_ulong # in the header files: void * HWND = HANDLE HDC = HANDLE HMODULE ...
test/visualization/test_visualize.py
wukathryn/axondeepseg
115
35473
<filename>test/visualization/test_visualize.py<gh_stars>100-1000 # coding: utf-8 from pathlib import Path import pytest from AxonDeepSeg.visualization.visualize import visualize_training class TestCore(object): def setup(self): # Get the directory where this current file is saved self.fullPath ...
src/trusted/validator_ragel/trie_test.py
cohortfsllc/cohort-cocl2-sandbox
2,151
35497
#!/usr/bin/python # Copyright (c) 2014 The Native Client 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 unittest import trie class TrieTest(unittest.TestCase): def MakeUncompressedTrie(self): uncompressed = trie.Node(...
analysis/log_analysis/check_util.py
leozz37/makani
1,178
35554
# Copyright 2020 Makani Technologies 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...
bcbio/picard/metrics.py
a113n/bcbio-nextgen
418
35583
<reponame>a113n/bcbio-nextgen # Back compatibility -- use broad subdirectory for new code from bcbio.broad.metrics import *
examples/nlp/entity_linking/query_index.py
hamjam/NeMo
4,145
35633
# Copyright (c) 2021, NVIDIA 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.apache.org/licenses/LICENSE-2.0 # # Unless required by appli...
cvat/apps/iam/schema.py
ACHultman/cvat
4,197
35635
<reponame>ACHultman/cvat # Copyright (C) 2022 Intel Corporation # # SPDX-License-Identifier: MIT from drf_spectacular.extensions import OpenApiFilterExtension, OpenApiAuthenticationExtension from drf_spectacular.plumbing import build_parameter_type from drf_spectacular.utils import OpenApiParameter # https://drf-spec...
forex_python/bitcoin.py
Otisey/forex-python
505
35647
from decimal import Decimal import simplejson as json import requests from .converter import RatesNotAvailableError, DecimalFloatMismatchError class BtcConverter(object): """ Get bit coin rates and convertion """ def __init__(self, force_decimal=False): self._force_decimal = force_decimal ...
mayan/apps/user_management/links.py
bonitobonita24/Mayan-EDMS
343
35670
from django.utils.translation import ugettext_lazy as _ from mayan.apps.authentication.link_conditions import condition_user_is_authenticated from mayan.apps.navigation.classes import Link, Separator, Text from mayan.apps.navigation.utils import factory_condition_queryset_access from .icons import ( icon_current_...
utils/asyncTable.py
jiafangjun/DD_KaoRou
108
35673
<reponame>jiafangjun/DD_KaoRou #!/usr/bin/python3 # -*- coding: utf-8 -*- import time from PySide2.QtWidgets import QWidget, QMainWindow, QGridLayout, QFileDialog, QToolBar,\ QAction, QDialog, QStyle, QSlider, QLabel, QPushButton, QStackedWidget, QHBoxLayout,\ QLineEdit, QTableWidget, QAbstractIt...
maigret/__main__.py
noi4eg/maigret
1,156
35680
<gh_stars>1000+ #! /usr/bin/env python3 """ Maigret entrypoint """ import asyncio from .maigret import main if __name__ == "__main__": asyncio.run(main())
feapder/network/user_pool/__init__.py
ibryang/feapder
876
35711
__all__ = [ "GuestUserPool", "GuestUser", "NormalUserPool", "NormalUser", "GoldUserPool", "GoldUser", "GoldUserStatus", ] from .gold_user_pool import GoldUserPool, GoldUser, GoldUserStatus from .guest_user_pool import GuestUserPool, GuestUser from .normal_user_pool import NormalUserPool, No...
scripts/run_burner_bench.py
joye1503/cocrawler
166
35730
<reponame>joye1503/cocrawler<filename>scripts/run_burner_bench.py import sys import logging import functools import asyncio import cocrawler.burner as burner import cocrawler.parse as parse import cocrawler.stats as stats test_threadcount = 2 loop = asyncio.get_event_loop() b = burner.Burner(test_threadcount, loop, ...
examples/crankd/sample-of-events/generate-event-plist.py
timgates42/pymacadmin
112
35731
#!/usr/bin/env python """ Generates a list of OS X system events into a plist for crankd. This is designed to create a large (but probably not comprehensive) sample of the events generated by Mac OS X that crankd can tap into. The generated file will call the 'tunnel.sh' as the command for each event; said fail can ...
sightpy/geometry/sphere.py
ulises1229/Python-Raytracer
326
35737
<reponame>ulises1229/Python-Raytracer import numpy as np from ..utils.constants import * from ..utils.vector3 import vec3 from ..geometry import Primitive, Collider class Sphere(Primitive): def __init__(self,center, material, radius, max_ray_depth = 5, shadow = True): super().__init__(center, mat...
tests/test_download.py
HeavyTony2/downloader-cli
301
35743
<gh_stars>100-1000 """Tests various methods of the Download class. All the methods that start with test are used to test a certain function. The test method will have the name of the method being tested seperated by an underscore. If the method to be tested is extract_content, the test method name will be test_extrac...
terraform/stacks/analytics/cloud_sniper_beaconing_detection/cloud_sniper_beaconing_detection.py
houey/cloud-sniper
160
35771
import os import ipaddress import numpy as np import pandas as pd import datetime import boto3 import gzip import json from signal_processing import signalProcess BUCKET_NAME = os.environ.get("BUCKET_NAME", None) VPC_FLOW_LOGS_PATH = os.environ.get("VPC_FLOW_LOGS_PATH", None) FINDINGS_PATH = os.environ.get("FINDINGS_...
web/cache.py
therealplato/vim-awesome
1,379
35790
<reponame>therealplato/vim-awesome """Module to hold the instance of the cache""" from flask.ext.cache import Cache cache = Cache()
stores/apps/preferences/forms.py
diassor/CollectorCity-Market-Place
135
35806
import re, logging from django import forms from django.forms import ModelForm from django.utils.translation import ugettext as _ from django.contrib.localflavor.us.forms import USStateSelect,\ USPhoneNumberField from models import Preference, ShippingWeight, ShippingPrice, ShippingItem, TaxState, DnsShop, EmailNo...
web/datasets/tasks.py
andressadotpy/maria-quiteria
151
35835
<filename>web/datasets/tasks.py from datetime import datetime from logging import info from pathlib import Path from typing import List import requests from celery import shared_task from django.conf import settings from django.contrib.admin.options import get_content_type_for_model from requests import HTTPError from...
src/testMultiRootWkspc/workspace5/remoteDebugger-start.py
ChaseKnowlden/vscode-jupyter
2,461
35841
<reponame>ChaseKnowlden/vscode-jupyter<filename>src/testMultiRootWkspc/workspace5/remoteDebugger-start.py import sys import time def main(): sys.stdout.write('this is stdout') sys.stdout.flush() sys.stderr.write('this is stderr') sys.stderr.flush() # Give the debugger some time to add a breakpoint....
archived-stock-trading-bot-v1/yf_extender.py
Allcallofduty10/stock-trading-bot
101
35857
<reponame>Allcallofduty10/stock-trading-bot import sys from datetime import datetime import yfinance as yf def get_ticker_symbol(ticker: yf.Ticker) -> str: try: return ticker.get_info()['symbol'] except ImportError: return "" def get_stock_state(ticker: yf.Ticker) -> {}: stock_info = ti...
tests/test_debianpkg.py
trathborne/nvchecker
320
35873
# MIT licensed # Copyright (c) 2020 lilydjwg <<EMAIL>>, et al. # Copyright (c) 2017 <NAME> <<EMAIL>>, et al. from flaky import flaky import pytest pytestmark = [pytest.mark.asyncio, pytest.mark.needs_net] @flaky(max_runs=10) async def test_debianpkg(get_version): assert await get_version("sigrok-firmware-fx2lafw"...
data_collection/gazette/spiders/sc_chapeco.py
kaiocp/querido-diario
454
35895
from gazette.spiders.base.fecam import FecamGazetteSpider class ScChapecoSpider(FecamGazetteSpider): name = "sc_chapeco" FECAM_QUERY = "cod_entidade:71" TERRITORY_ID = "4204202"
saleor/graphql/account/dataloaders.py
fairhopeweb/saleor
15,337
35926
from collections import defaultdict from ...account.models import Address, CustomerEvent, User from ..core.dataloaders import DataLoader class AddressByIdLoader(DataLoader): context_key = "address_by_id" def batch_load(self, keys): address_map = Address.objects.in_bulk(keys) return [address_...
Algo and DSA/LeetCode-Solutions-master/Python/maximize-the-confusion-of-an-exam.py
Sourav692/FAANG-Interview-Preparation
3,269
35930
<reponame>Sourav692/FAANG-Interview-Preparation # Time: O(n) # Space: O(1) import collections class Solution(object): def maxConsecutiveAnswers(self, answerKey, k): """ :type answerKey: str :type k: int :rtype: int """ result = max_count = 0 count = collec...
homeassistant/components/eliqonline/__init__.py
domwillcode/home-assistant
30,023
35931
"""The eliqonline component."""
search_for_similar_images__perceptual_hash__phash/ui/SearchForSimilarSettingsWidget.py
DazEB2/SimplePyScripts
117
35960
#!/usr/bin/env python3 # -*- coding: utf-8 -*- __author__ = 'ipetrash' from PyQt5.QtWidgets import QWidget, QFormLayout, QComboBox, QSpinBox, QCheckBox from PyQt5.QtCore import QSettings, pyqtSignal from common import IMAGE_HASH_ALGO, DEFAULT_IMAGE_HASH_ALGO, DEFAULT_IMAGE_HASH_MAX_SCORE class SearchForSimilarSet...
backpack/extensions/secondorder/diag_ggn/conv1d.py
jabader97/backpack
395
35971
<filename>backpack/extensions/secondorder/diag_ggn/conv1d.py from backpack.core.derivatives.conv1d import Conv1DDerivatives from backpack.extensions.secondorder.diag_ggn.convnd import ( BatchDiagGGNConvND, DiagGGNConvND, ) class DiagGGNConv1d(DiagGGNConvND): def __init__(self): super().__init__(de...
scripts/rpc/cmd_parser.py
5cs/spdk
2,107
35991
<filename>scripts/rpc/cmd_parser.py<gh_stars>1000+ args_global = ['server_addr', 'port', 'timeout', 'verbose', 'dry_run', 'conn_retries', 'is_server', 'rpc_plugin', 'called_rpc_name', 'func', 'client'] def strip_globals(kwargs): for arg in args_global: kwargs.pop(arg, None) def remove_nul...
djangular/tests/utils.py
jianglb-alibaba/djangular-0.2.7
145
36002
import os from djangular import utils from django.test import SimpleTestCase class SiteAndPathUtilsTest(SimpleTestCase): site_utils = utils.SiteAndPathUtils() def test_djangular_root(self): current_dir = os.path.dirname(os.path.abspath(__file__)) djangular_dir = os.path.dirname(current_dir)...
src/encoded/searches/responses.py
procha2/encoded
102
36005
from encoded.searches.mixins import CartAggsToFacetsMixin from snosearch.responses import BasicQueryResponseWithFacets from snosearch.responses import BasicMatrixResponseWithFacets class CartQueryResponseWithFacets(CartAggsToFacetsMixin, BasicQueryResponseWithFacets): ''' Like BasicQueryResponseWithFacets but...
unit-tests/live/frames/test-t2ff-sensor.py
ksvbka/librealsense
6,457
36006
# License: Apache 2.0. See LICENSE file in root directory. # Copyright(c) 2021 Intel Corporation. All Rights Reserved. # test:device L500* # test:device D400* import pyrealsense2 as rs from rspy.stopwatch import Stopwatch from rspy import test, log import time import platform # Start depth + color streams and measur...
gmacpyutil/gmacpyutil/profiles_test.py
rgayon/macops
758
36043
<gh_stars>100-1000 """Tests for profiles module.""" import mock from google.apputils import basetest import profiles class ProfilesModuleTest(basetest.TestCase): def testGenerateUUID(self): self.assertIsInstance(profiles.GenerateUUID('a'), str) self.assertTrue(profiles.GenerateUUID('a').isupper()) s...
test/test_regularization.py
rentainhe/glasses
271
36057
<filename>test/test_regularization.py import torch from glasses.nn.regularization import DropBlock, StochasticDepth def test_drop_block(): drop = DropBlock() x = torch.ones((1, 3, 28, 28)) x_drop = drop(x) assert not torch.equal(x, x_drop) assert drop.training drop = drop.eval() x_drop =...
c_comp/nodes.py
Commodoreprime/Command-Block-Assembly
223
36105
<gh_stars>100-1000 class Node: props = () def __init__(self, **kwargs): for prop in kwargs: if prop not in self.props: raise Exception('Invalid property %r, allowed only: %s' % (prop, self.props)) self.__dict__[prop] = kwargs[pro...
mp_sort/virtenv/lib/python3.6/site-packages/transcrypt/demos/pysteroids_demo/org/theodox/__init__.py
ang-jason/fip_powerx_mini_projects-foxtrot
2,200
36131
import math import itertools class Vector: """ Generic vector operations. """ def _apply(self,op, other): pairwise = None if type(other) is Vector: pairwise = zip(self.vals, other.vals) else: pairwise = zip(self.vals, [other for _ ...
atlas/foundations_sdk/src/foundations/helpers/queued.py
DeepLearnI/atlas
296
36162
<gh_stars>100-1000 _QUEUED_JOBS_KEY = 'projects:global:jobs:queued' _ARCHIVED_JOBS_KEY = 'projects:global:jobs:archived' def list_jobs(redis): return {job_id.decode() for job_id in redis.smembers(_QUEUED_JOBS_KEY)} def remove_jobs(redis, job_id_project_mapping): for job_id, project_name in job_id_project_map...
15-more-types/mysum.py
SeirousLee/example-code-2e
990
36170
import functools import operator from collections.abc import Iterable from typing import overload, Union, TypeVar T = TypeVar('T') S = TypeVar('S') # <1> @overload def sum(it: Iterable[T]) -> Union[T, int]: ... # <2> @overload def sum(it: Iterable[T], /, start: S) -> Union[T, S]: ... # <3> def sum(it, /, start=0):...
docs/conf.py
guillaume-wisniewski/elpis
118
36210
<filename>docs/conf.py # Configuration file for the Sphinx documentation builder. # # This file only contains a selection of the most common options. For a full # list see the documentation: # https://www.sphinx-doc.org/en/master/usage/configuration.html # -- Path setup ------------------------------------------------...
packages/core/minos-microservice-networks/tests/test_networks/test_brokers/test_messages/test_models/test_v1.py
sorasful/minos-python
247
36261
<reponame>sorasful/minos-python import unittest import warnings from unittest.mock import ( patch, ) from uuid import ( UUID, uuid4, ) from minos.common import ( Model, ) from minos.networks import ( BrokerMessageV1, BrokerMessageV1Payload, BrokerMessageV1Status, BrokerMessageV1Strategy...
microraiden/proxy/resources/paywall_decorator.py
andrevmatos/microraiden
417
36265
import logging from flask import Response, make_response, request from microraiden import HTTPHeaders as header from flask_restful.utils import unpack from microraiden.channel_manager import ( ChannelManager, ) from microraiden.exceptions import ( NoOpenChannel, InvalidBalanceProof, InvalidBalanceAmoun...
keepercommander/plugins/windows/windows.py
Mkn-yskz/Commandy
151
36346
# -*- coding: utf-8 -*- # _ __ # | |/ /___ ___ _ __ ___ _ _ ® # | ' </ -_) -_) '_ \/ -_) '_| # |_|\_\___\___| .__/\___|_| # |_| # # <NAME> # Copyright 2015 Keeper Security Inc. # Contact: <EMAIL> # import logging import subprocess import re def rotate(record, newpassword): """ Grab...
corehq/ex-submodules/casexml/apps/stock/tests/mock_consumption.py
akashkj/commcare-hq
471
36356
<gh_stars>100-1000 from datetime import datetime, timedelta from dimagi.utils import parsing as dateparse from casexml.apps.stock.consumption import ( ConsumptionConfiguration, compute_daily_consumption_from_transactions, ) to_ts = dateparse.json_format_datetime now = datetime.utcnow() def ago(days): r...
script/run_WOA.py
cyy111/metaheuristics
104
36416
<gh_stars>100-1000 from models.multiple_solution.swarm_based.WOA import BaseWOA, BaoWOA from utils.FunctionUtil import square_function ## Setting parameters root_paras = { "problem_size": 30, "domain_range": [-1, 1], "print_train": True, "objective_func": square_function } woa_paras = { "epoch": 10...
setup.py
CentryPlan/dataclassframe
321
36418
#!/usr/bin/env python3 """ Based on template: https://github.com/FedericoStra/cython-package-example """ from setuptools import setup with open("requirements.txt") as fp: install_requires = fp.read().strip().split("\n") with open("requirements_dev.txt") as fp: dev_requires = fp.read().strip().split("\n") s...
apps/events/views.py
seanlefevre/openduty
145
36422
from django.views.generic import DeleteView from django.contrib.auth.mixins import LoginRequiredMixin from django.contrib import messages from django.urls import reverse from django.http import HttpResponseRedirect from django.shortcuts import get_object_or_404 from schedule.models import Calendar from schedule.views i...
scale/product/apps.py
kaydoh/scale
121
36429
"""Defines the application configuration for the product application""" from __future__ import unicode_literals from django.apps import AppConfig class ProductConfig(AppConfig): """Configuration for the product application""" name = 'product' label = 'product' verbose_name = 'Product' def ready(...
tests/integrations/java/test_JDK__verify.py
pybee/briefcase
522
36464
<reponame>pybee/briefcase import os import shutil import subprocess import sys from pathlib import Path from unittest import mock import pytest from requests import exceptions as requests_exceptions from briefcase.console import Log from briefcase.exceptions import BriefcaseCommandError, MissingToolError, NetworkFail...