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
tests/integration/spm/test_install.py
babs/salt
9,425
11074516
""" Tests for the spm install utility """ import os import shutil import pytest import salt.utils.files import salt.utils.path import salt.utils.yaml from tests.support.case import SPMCase from tests.support.helpers import Webserver @pytest.mark.destructive_test @pytest.mark.windows_whitelisted class SPMInstallTest...
compiler/router/vector3d.py
im-world/OpenRAM
335
11074517
# See LICENSE for licensing information. # # Copyright (c) 2016-2021 Regents of the University of California and The Board # of Regents for the Oklahoma Agricultural and Mechanical College # (acting for and on behalf of Oklahoma State University) # All rights reserved. # import math class vector3d(): """ This...
v1/bench/counter.py
daota2/fffff
264
11074520
<gh_stars>100-1000 from bench import bench print(bench(10, ''' class Counter(): def __init__(self): self.n = 0 def inc(self, d = 1): self.n += d ''', ''' for _ in range(10000): c = Counter() c.inc() c.inc(-1) '''))
salt/modules/key.py
markgras/salt
9,425
11074522
""" Functions to view the minion's public key information """ import os import salt.utils.crypt def finger(hash_type=None): """ Return the minion's public key fingerprint hash_type The hash algorithm used to calculate the fingerprint CLI Example: .. code-block:: bash salt '*'...
test/onnx_converter_test/train_scripts/dlrm.py
x-y-z/HugeCTR
130
11074537
import hugectr from mpi4py import MPI solver = hugectr.CreateSolver(max_eval_batches = 300, batchsize_eval = 16384, batchsize = 16384, lr = 0.001, vvgpu = [[0]], repeat_d...
reaver/envs/base/abc.py
HatsuneMiku4/reaver
239
11074615
from abc import ABC, abstractmethod from reaver.utils.typing import * from .spec import Spec class Env(ABC): """ Abstract Base Class for all environments supported by Reaver Acts as a glue between the agents, models and envs modules Implementing class can be a simple wrapper (e.g. over openAI Gym) ...
ApiManager/__init__.py
like7887/Httptest
593
11074626
import platform separator = '\\' if platform.system() == 'Windows' else '/'
ldif/util/interpolate_util.py
trisct/ldif
242
11074627
<reponame>trisct/ldif<filename>ldif/util/interpolate_util.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 # # https://www.apache.org/licenses/LICENSE-2.0 # ...
mmgen/datasets/pipelines/loading.py
plutoyuxie/mmgeneration
718
11074649
# Copyright (c) OpenMMLab. All rights reserved. import mmcv import numpy as np from mmcv.fileio import FileClient from ..builder import PIPELINES @PIPELINES.register_module() class LoadImageFromFile: """Load image from file. Args: io_backend (str): io backend where images are store. Default: 'disk'....
viewer_examples/viewers/image_viewer.py
thewtex/scikit-image
453
11074668
from skimage import data from skimage.viewer import ImageViewer image = data.camera() viewer = ImageViewer(image) viewer.show()
autoPyTorch/pipeline/nodes/baseline_trainer.py
mens-artis/Auto-PyTorch
1,657
11074669
import torch import os as os import json import pickle import numpy as np import scipy.sparse import logging import collections import ConfigSpace import ConfigSpace.hyperparameters as CSH from autoPyTorch.pipeline.base.pipeline_node import PipelineNode from autoPyTorch.utils.config.config_option import Conf...
etl/parsers/etw/Microsoft_Windows_Crypto_RNG.py
IMULMUL/etl-parser
104
11074701
# -*- coding: utf-8 -*- """ Microsoft-Windows-Crypto-RNG GUID : 54d5ac20-e14f-4fda-92da-ebf7556ff176 """ from construct import Int8sl, Int8ul, Int16ul, Int16sl, Int32sl, Int32ul, Int64sl, Int64ul, Bytes, Double, Float32l, Struct from etl.utils import WString, CString, SystemTime, Guid from etl.dtyp import Sid from etl....
lib/galaxy/model/tool_shed_install/migrate/versions/0001_add_tool_shed_repository_table.py
rikeshi/galaxy
1,085
11074707
<reponame>rikeshi/galaxy """ Migration script to add the tool_shed_repository table. """ import datetime import logging from sqlalchemy import ( Boolean, Column, DateTime, Integer, MetaData, Table, TEXT ) from galaxy.model.custom_types import TrimmedString from galaxy.model.migrate.versio...
test/nn/norm/test_graph_norm.py
Kenneth-Schroeder/pytorch_geometric
12,651
11074710
import torch from torch_geometric.nn import GraphNorm def test_graph_norm(): x = torch.randn(200, 16) batch = torch.arange(4).view(-1, 1).repeat(1, 50).view(-1) norm = GraphNorm(16) assert norm.__repr__() == 'GraphNorm(16)' torch.jit.script(norm) out = norm(x) assert out.size() == (200, ...
examples/docs_snippets/docs_snippets/concepts/logging/custom_logger.py
rpatil524/dagster
4,606
11074712
"""isort:skip_file""" import json import logging from dagster import Field, logger, job, op # start_custom_logger_marker_0 @logger( { "log_level": Field(str, is_required=False, default_value="INFO"), "name": Field(str, is_required=False, default_value="dagster"), }, description="A JSON-f...
zcls/model/layers/repvgg_util.py
ZJCV/PyCls
110
11074726
# -*- coding: utf-8 -*- """ @date: 2021/2/2 下午8:51 @file: repvgg_util.py @author: zj @description: """ import torch import torch.nn as nn import numpy as np # This func derives the equivalent kernel and bias in a DIFFERENTIABLE way. # You can get the equivalent kernel and bias at any time and do whatever you w...
mayan/apps/sources/tests/test_models.py
eshbeata/open-paperless
2,743
11074746
<reponame>eshbeata/open-paperless from __future__ import unicode_literals import shutil from django.test import override_settings from common.utils import mkdtemp from common.tests import BaseTestCase from documents.models import Document, DocumentType from documents.tests import ( TEST_COMPRESSED_DOCUMENT_PATH,...
homeassistant/components/tradfri/switch.py
MrDelik/core
30,023
11074768
"""Support for IKEA Tradfri switches.""" from __future__ import annotations from collections.abc import Callable from typing import Any, cast from pytradfri.command import Command from homeassistant.components.switch import SwitchEntity from homeassistant.config_entries import ConfigEntry from homeassistant.core imp...
libbeat/tests/system/test_index_pattern.py
tetianakravchenko/beats
9,729
11074780
from base import BaseTest import os class Test(BaseTest): def test_export_index_pattern(self): """ Test export index pattern """ self.render_config_template("mockbeat", os.path.join(self.working_dir, ...
alipay/aop/api/domain/AlipayInsSceneTaskflowBatchFinishModel.py
antopen/alipay-sdk-python-all
213
11074791
#!/usr/bin/env python # -*- coding: utf-8 -*- import json from alipay.aop.api.constant.ParamConstants import * class AlipayInsSceneTaskflowBatchFinishModel(object): def __init__(self): self._extra_map = None self._out_biz_no = None self._task_flow_id_list = None self._user_id = N...
solutions/python/kruskals-algorithm/kruskal-two.py
lhayhurst/interview-with-python
201
11074801
<gh_stars>100-1000 #======================================================================= # Kruskal MST #======================================================================= def kruskal_mst(G): """Return a minimum spanning tree using kruskal's algorithm""" # sort the list of edges in G by their leng...
dynamicppd.py
elvinristi/CUPS-Cloud-Print
126
11074842
<reponame>elvinristi/CUPS-Cloud-Print #! /bin/sh "true" '''\' if command -v python2 > /dev/null; then exec python2 "$0" "$@" else exec python "$0" "$@" fi exit $? ''' # CUPS Cloudprint - Print via Google Cloud Print # Copyright (C) 2013 <NAME> # # This program is free software: you can redistribute it and...
zat/data_generator.py
SuperCowPowers/zat
146
11074864
"""Silly data generator (Faker (https://github.com/joke2k/faker) and others are much better, but we just need something simple""" import string # Third Party import pandas as pd import numpy as np def df_random(num_numeric=3, num_categorical=3, num_rows=100): """Generate a dataframe with random data. This is...
tutorial/imagenet.py
zhiiker/distribuuuu
160
11074880
""" (MNMC) Multiple Nodes Multi-GPU Cards Training Minimal ImageNet training code powered by DDP """ import os import subprocess import torch import torch.distributed as dist import torch.nn as nn import torchvision import torchvision.transforms as transforms from torch.nn.parallel import DistributedDataParallel as D...
tests/blessclient/bless_config_test.py
mwpeterson/python-blessclient
115
11074923
from __future__ import unicode_literals from io import StringIO import pytest from blessclient.bless_config import BlessConfig BLESS_CONFIG = """ [MAIN] ca_backend: bless """ VAULT_CONFIG = """ [MAIN] ca_backend: hashicorp-vault """ TEST_CONFIG = """ region_aliases: iad, SFO kms_service_name: bless-production bast...
openpoiservice/server/utils/decorators.py
larsrinn/openpoiservice
131
11074936
<gh_stars>100-1000 # openpoiservice/server/utils/decorators.py import time import logging import cProfile import functools import os import sys import inspect import traceback from functools import wraps from multiprocessing import Process, Queue logger = logging.getLogger(__name__) def processify(func): """Dec...
tests/net_inet/uasyncio_tcp_read_headers.py
sebastien-riou/micropython
13,648
11074943
<reponame>sebastien-riou/micropython # Test uasyncio.open_connection() and stream readline() try: import uasyncio as asyncio except ImportError: try: import asyncio except ImportError: print("SKIP") raise SystemExit async def http_get_headers(url): reader, writer = await async...
example/files/tests/test_views.py
PowerOlive/django-admin2
330
11074944
from os import path from django.contrib.auth import get_user_model from django.urls import reverse from django.test import TestCase, Client from django.utils.encoding import force_str from ..models import CaptionedFile fixture_dir = path.join(path.abspath(path.dirname(__file__)), 'fixtures') fixture_file = path.join...
examples/irevnet/CIFAR_main.py
xuanyuzhou98/higher
392
11074949
# Code for "i-RevNet: Deep Invertible Networks", ICLR 2018 # Author: <NAME>, 2018 # # Modified from Pytorch examples code. # Original license shown below. # ============================================================================= # BSD 3-Clause License # # Copyright (c) 2017, # All rights reserved. # # Redistrib...
align/schema/gen_dot.py
pretl/ALIGN-public
119
11074955
from .parser import SpiceParser from .types import set_context def gen_dot_file(nm, ifn, ofn): parser = SpiceParser() # Patch library to use different model name parser.library.append(parser.library.find('PMOS').copy(update={'name': 'P'})) parser.library.append(parser.library.find('NMOS').copy(update=...
gamestonk_terminal/common/behavioural_analysis/twitter_view.py
elan17/GamestonkTerminal
1,835
11074987
<reponame>elan17/GamestonkTerminal """Twitter view""" __docformat__ = "numpy" import os from datetime import datetime, timedelta import matplotlib.pyplot as plt import numpy as np import pandas as pd from dateutil import parser as dparse from gamestonk_terminal import feature_flags as gtff from gamestonk_terminal....
scripts/async/sand.py
edemaine/taichi_mpm
2,137
11075018
import taichi as tc from math import * from random import * from async_mpm import AsyncMPM r = 400 task_id = 'sand' Async = True if __name__ == '__main__': res = (r, r, r) if Async: mpm = AsyncMPM( res=res, particle_collision=False, optimized=True, verbose_bgeo=True, g...
coapthon/serializer.py
Dalanke/CoAPthon
237
11075019
<gh_stars>100-1000 import logging import struct import ctypes from coapthon.messages.request import Request from coapthon.messages.response import Response from coapthon.messages.option import Option from coapthon import defines from coapthon.messages.message import Message __author__ = '<NAME>' logger = logging.getL...
gui/ml/keras_processing_tf2.py
case547/acconeer-python-exploration
117
11075030
<reponame>case547/acconeer-python-exploration import os import traceback import numpy as np import tensorflow as tf from keras.utils.layer_utils import count_params from sklearn.model_selection import train_test_split from sklearn.utils import class_weight from tensorflow.keras import backend as K from tensorflow.kera...
lite/examples/pose_estimation/raspberry_pi/tracker/keypoint_tracker.py
duy-maimanh/examples
6,484
11075052
# Copyright 2021 The TensorFlow 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 applica...
test/trace_processor/chrome/modified_rail_modes_no_vsyncs.py
proton-vayu/android_external_perfetto
933
11075069
<reponame>proton-vayu/android_external_perfetto #!/usr/bin/env python3 # Copyright (C) 2020 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...
src/UQpy/__init__.py
marrov/UQpy
132
11075072
<reponame>marrov/UQpy """ Uncertainty Quantification with Python ======================================== """ import pkg_resources import UQpy.Distributions import UQpy.SampleMethods import UQpy.DimensionReduction import UQpy.Inference import UQpy.Reliability import UQpy.RunModel import UQpy.SampleMethods import UQpy...
vnpy/data/tdx/tdx_stock_data.py
liuying3013/vnpy
323
11075107
# encoding: UTF-8 # 从tdx下载股票数据. # 收盘后的数据基本正确, 但盘中实时拿数据时: # 1. 1Min的Bar可能不是最新的, 会缺几分钟. # 2. 当周期>1Min时, 最后一根Bar可能不是完整的, 强制修改后 # - 5min修改后freq基本正确 # - 1day在VNPY合成时不关心已经收到多少Bar, 所以影响也不大 # - 但其它分钟周期因为不好精确到每个品种, 修改后的freq可能有错 # https://rainx.gitbooks.io/pytdx/content/pytdx_hq.html # 华富资产 import sys import os impo...
automation/scripts/testnet-validation/check_logs.py
arjundashrath/mina
929
11075110
import click import json import sys import logging import collections from datetime import datetime, timedelta from google.cloud import logging as glogging from kubernetes import client, config from kubernetes.stream import stream @click.command() @click.option('--namespace', default="hangry-lobster", ...
scripts_hico/main.py
ASMIftekhar/VSGNet
111
11075120
from __future__ import print_function, division import torch import torch.nn as nn import argparse import json import os import numpy as np import matplotlib.pyplot as plt import torch.optim as optim import sys import warnings warnings.filterwarnings("ignore") from torch.utils.data import Dataset, DataLoader from t...
sklego/mixture/bayesian_gmm_detector.py
lahdjirayhan/scikit-lego
784
11075125
import numpy as np from scipy.optimize import minimize_scalar from sklearn.base import BaseEstimator, OutlierMixin from sklearn.mixture import BayesianGaussianMixture from sklearn.utils.validation import check_is_fitted, check_array, FLOAT_DTYPES from scipy.stats import gaussian_kde class BayesianGMMOutlierDetector(...
tensorflow/python/distribute/summary_op_util.py
abhaikollara/tensorflow
848
11075131
<filename>tensorflow/python/distribute/summary_op_util.py # Copyright 2017 The TensorFlow 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.apac...
clastic/cline.py
mahmoud/clastic
140
11075145
<reponame>mahmoud/clastic # -*- coding: utf-8 -*- """ Cline is a microframework that replicates bottle.py's interface, but built with Clastic primitives, enabling better state management and stronger type/argument checking. Etymologically, A cline is a continuum or threshold (related to "incline"/"decline"), and is of...
wemake_python_styleguide/visitors/ast/complexity/imports.py
cdhiraj40/wemake-python-styleguide
1,931
11075148
<reponame>cdhiraj40/wemake-python-styleguide import ast from typing_extensions import final from wemake_python_styleguide.types import AnyImport, ConfigurationOptions from wemake_python_styleguide.violations import complexity from wemake_python_styleguide.violations.base import ErrorCallback from wemake_python_styleg...
framework/CodeInterfaces/Utilities/dynamicEventTreeUtilities.py
rinelson456/raven
159
11075161
# Copyright 2017 Battelle Energy Alliance, 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 t...
x2paddle/project_convertor/pytorch/torch2paddle/tensor.py
usertianqin/X2Paddle
559
11075185
<reponame>usertianqin/X2Paddle # Copyright (c) 2021 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-...
samples/HostedFeatureServiceAdmin/addFieldToHostedFeatureService.py
kevinsigwart/ArcREST
208
11075202
""" Adds a field to any layer matching the name in all feature services without republishing """ import arcrest if __name__ == "__main__": url = "https://<url to spatial data store>/ArcGIS/rest/admin" username = "<user name>" password = "<password> " featureLayerNames = ["layerName1","layerName2"...
packages/core/minos-microservice-saga/tests/test_saga/test_services.py
minos-framework/minos-python
247
11075217
import unittest from unittest.mock import ( call, patch, ) from uuid import ( uuid4, ) from minos.common import ( Config, ) from minos.networks import ( BrokerCommandEnrouteDecorator, BrokerMessageV1, BrokerMessageV1Payload, BrokerRequest, ) from minos.saga import ( SagaManager, ...
models/diffusion.py
entc-17-fyp-05/diffusion-point-cloud
138
11075224
<reponame>entc-17-fyp-05/diffusion-point-cloud<filename>models/diffusion.py<gh_stars>100-1000 import torch import torch.nn.functional as F from torch.nn import Module, Parameter, ModuleList import numpy as np from .common import * class VarianceSchedule(Module): def __init__(self, num_steps, beta_1, beta_T, mod...
build_extensions/combine_jars.bzl
dayanruben/android-test
836
11075236
"""Combines multiple jars into one jar.""" def combine_jars(name, srcs, **genrule_kwargs): '''Combines multiple jars into one jar. Args: name: Name to be used for this rule. It produces name.jar srcs: List of jars to be combined. genrule_kwargs: Keyword arguments to pass through to the genrule. ''' ...
tools/generate_audio_file/generate_audio_file.py
wiltonlazary/esp-skainet
265
11075251
# -*- coding:utf-8 -*- from __future__ import print_function import os import struct def get_wave_array_str(filename, target_bits): with open(filename, "rb") as f: array_str = "" head = f.read(44) i = 0 while (1): data = f.read(1) if (data == ''): ...
test/test_googlespreadsheets.py
MidtownFellowship/libsaas
155
11075256
<filename>test/test_googlespreadsheets.py import unittest from libsaas import port, xml from libsaas.executors import test_executor from libsaas.services import googlespreadsheets from libsaas.services.base import MethodNotSupported class GoogleSpreadsheetsTestCase(unittest.TestCase): def expect(self, method=No...
python/FNC.py
snowdj/fnc-extras
109
11075279
from scipy import * from numpy import * from matplotlib.pyplot import * from scipy.linalg import * from numpy.linalg import * from scipy.optimize import root_scalar import scipy.sparse as sparse from scipy.sparse.linalg import splu from timeit import default_timer as timer from FNC01 import * from FNC02 import * from ...
tetherback/__main__.py
dlenski/tetherback
158
11075299
<filename>tetherback/__main__.py from .tetherback import main if __name__=='__main__': main()
hypergan/gans/needs_pytorch/aligned_ali_gan7.py
limberc/HyperGAN
889
11075303
<filename>hypergan/gans/needs_pytorch/aligned_ali_gan7.py import importlib import json import numpy as np import os import sys import time import uuid import copy from hypergan.discriminators import * from hypergan.distributions import * from hypergan.generators import * from hypergan.inputs import * from hypergan.sam...
pylayers/util/tests/test_SphericalBasis.py
usmanwardag/pylayers
143
11075306
# # Test SphericalBasis # BTB_tx # from pylayers.util.geomutil import * a_g = np.array([[np.pi/2,np.pi/2],[np.pi/2,np.pi/2],[np.pi/2,np.pi/2],[np.pi/2,np.pi/2]]) G = SphericalBasis(a_g) assert(len(G.shape)==3) assert(G.shape[0]==3) assert(G.shape[1]==3) # Identity test T = np.eye(3) a_l,R = BTB(a_g,T) assert np.a...
h2o-py/tests/testdir_misc/pyunit_expr_optimizations.py
ahmedengu/h2o-3
6,098
11075309
import h2o import sys sys.path.insert(1, "../../") from tests import pyunit_utils from h2o import H2OFrame from h2o.expr import ExprNode def _assert_expr_results_eq(expr_provider, skip_expr_assert=False): flag = h2o.is_expr_optimizations_enabled() try: # Get result of optimized expression h2...
src/azure-cli/azure/cli/command_modules/storage/operations/metrics.py
YuanyuanNi/azure-cli
3,287
11075315
# -------------------------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. # Licensed under the MIT License. See License.txt in the project root for license information. # --------------------------------------------------------------------...
impacket/examples/ntlmrelayx/servers/socksplugins/smb.py
milkdevil/impacket
109
11075317
#!/usr/bin/env python # Copyright (c) 2013-2017 CORE Security Technologies # # This software is provided under under a slightly modified version # of the Apache Software License. See the accompanying LICENSE file # for more information. # # A Socks Proxy for the SMB Protocol # # Author: # <NAME> (@agsolino) # # Descri...
examples/text_prediction/run_text_prediction.py
zhiqiangdon/autogluon
4,462
11075326
import os import json import argparse import numpy as np import random import pandas as pd import copy from autogluon.text import TextPredictor, ag_text_presets from autogluon.tabular import TabularPredictor from autogluon.core.utils.loaders import load_pd TASKS = \ {'cola': (['sentence'], 'label', 'mcc', ['mcc']...
src/spring-cloud/azext_spring_cloud/_util_enterprise.py
haroonf/azure-cli-extensions
207
11075354
<filename>src/spring-cloud/azext_spring_cloud/_util_enterprise.py # -------------------------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. # Licensed under the MIT License. See License.txt in the project root for license information. # --...
videos/077_metaclasses_in_python/abc_example.py
matthewstidham/VideosSampleCode
285
11075358
def abstractmethod(f): f.__isabstract__ = True return f def abstractmethods(cls): seen = set() abstract = [] while isinstance(cls, ABCMeta): for key, val in vars(cls).items(): if key in seen: continue seen.add(key) if getattr(val, '__isab...
paas-ce/paas/paas/esb/apps/bootstrapform/templatetags/bootstrap.py
canway-bk/bk-PaaS
767
11075366
<reponame>canway-bk/bk-PaaS # -*- coding: utf-8 -*- """ Tencent is pleased to support the open source community by making 蓝鲸智云PaaS平台社区版 (BlueKing PaaS Community Edition) available. Copyright (C) 2017-2018 THL A29 Limited, a Tencent company. All rights reserved. Licensed under the MIT License (the "License"); you may no...
dataflows/processors/update_stats.py
cschloer/dataflows
160
11075371
from .. import DataStreamProcessor class update_stats(DataStreamProcessor): def __init__(self, stats): self.stats = stats
accelerator/database.py
drougge/accelerator
143
11075428
<reponame>drougge/accelerator ############################################################################ # # # Copyright (c) 2017 eBay Inc. # # Modifications copyright (c) 2019-2021 <NAME> ...
examples/server.py
tasmail/pyModbusTCP
177
11075435
<reponame>tasmail/pyModbusTCP #!/usr/bin/env python3 # -*- coding: utf-8 -*- # Modbus/TCP server # # run this as root to listen on TCP priviliged ports (<= 1024) # default Modbus/TCP port is 502 so we prefix call with sudo # add "--host 0.0.0.0" to listen on all available IPv4 addresses of the host # # sudo ./server...
Intro_to_Machine_Learning/ENV/lib/python2.7/site-packages/sklearn/linear_model/tests/test_randomized_l1.py
workingyifei/DAND
115
11075443
# Authors: <NAME> <<EMAIL>> # License: BSD 3 clause from tempfile import mkdtemp import shutil import numpy as np from scipy import sparse from sklearn.utils.testing import assert_equal from sklearn.utils.testing import assert_array_equal from sklearn.utils.testing import assert_raises from sklearn.utils.testing impo...
pxr/usd/sdr/testenv/testSdrRegistry.py
stephenp24/USD
3,680
11075452
<gh_stars>1000+ #!/pxrpythonsubst # # Copyright 2018 Pixar # # Licensed under the Apache License, Version 2.0 (the "Apache License") # with the following modification; you may not use this file except in # compliance with the Apache License and the following modification to it: # Section 6. Trademarks. is deleted and r...
tests/all_tests_coverage.py
dorosh/gdata-python-client
483
11075468
<gh_stars>100-1000 #!/usr/bin/env python # # Copyright (C) 2009 Google Inc. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # ...
pyvacy/analysis/subsampled.py
ChrisWaites/privacy
155
11075469
<filename>pyvacy/analysis/subsampled.py import math from scipy.special import beta def binomial(x, y): return 1 / ((x + 1) * beta(x - y + 1, y + 1)) def epsilon(alpha, q, noise_multiplier): def _eps(_alpha): if _alpha == math.inf: return min(4 * (math.exp(_eps(2) - 1)), 2 * math.exp(_eps(2...
demos/dataset/dataset_sparsity.py
glhr/ip_basic
345
11075476
<filename>demos/dataset/dataset_sparsity.py import glob import os import sys import cv2 import matplotlib.pyplot as plt import numpy as np def main(): input_depth_dir = os.path.expanduser( '~/Kitti/depth/val_selection_cropped/velodyne_raw') images_to_use = sorted(glob.glob(input_depth_dir + '/*')) ...
scripts/instance.py
cloudcomputingabc/volttron
406
11075479
<gh_stars>100-1000 import argparse import logging import os import subprocess import sys logging.basicConfig(level=logging.WARN) log = logging.getLogger(os.path.basename(__file__)) if not hasattr(sys, 'real_prefix'): inenv = False else: inenv = True if not inenv: mypath = os.path.dirname(__file__) c...
第2章/program/IntFloatVariable.py
kingname/SourceCodeOfBook
274
11075485
print(123) print(3.14159) print(1 - 10) print(3 + 2 - 5 * 0) print((3 + 2 - 5) * 0) # 整数的除法和小数的加减乘除 # print(0.1 + 0.2) # print(1 / 3) # print(1 * 0.3) # print(0.1 + 0.2 - 0.3 * 0.4 / 0.5) #变量的使用 # 长 = 10 # 宽 = 5 # 高 = 2 # # 面积 = 长 * 宽 # 体积 = 面积 * 高 # print(面积) # print(体积)
web/index/migrations/0006_auto_20210723_1629.py
lavon321/Kunlun-M
1,059
11075498
# Generated by Django 3.0.7 on 2021-07-23 08:29 from django.db import migrations, models class Migration(migrations.Migration): dependencies = [ ('index', '0005_auto_20210721_1829'), ] operations = [ migrations.AlterField( model_name='rules', name='level', ...
PyObjCTest/test_nstextlist.py
Khan/pyobjc-framework-Cocoa
132
11075500
<gh_stars>100-1000 from PyObjCTools.TestSupport import * from AppKit import * class TestNSTextList (TestCase): def testConstants(self): self.assertEqual(NSTextListPrependEnclosingMarker, 1) if __name__ == "__main__": main()
jarbas/chamber_of_deputies/tests/test_searchvector_command.py
vbarceloscs/serenata-de-amor
3,001
11075512
<filename>jarbas/chamber_of_deputies/tests/test_searchvector_command.py from django.test import TestCase from mixer.backend.django import mixer from jarbas.chamber_of_deputies.management.commands.searchvector import Command from jarbas.chamber_of_deputies.models import Reimbursement class TestCommandHandler(TestCase...
vocab/__init__.py
datha88/kbqa-ar-smcnn
139
11075514
#!/usr/bin/env python #-*- coding: utf-8 -*- # Author: QuYingqi # mail: <EMAIL> # Created Time: 2017-11-06
pytorch/vision/model/data_loader.py
huang-xx/cs230-code-examples
1,860
11075532
import random import os from PIL import Image from torch.utils.data import Dataset, DataLoader import torchvision.transforms as transforms # borrowed from http://pytorch.org/tutorials/advanced/neural_style_tutorial.html # and http://pytorch.org/tutorials/beginner/data_loading_tutorial.html # define a training image l...
pythonx/lints/css.py
maralla/validator.vim
255
11075542
# -*- coding: utf-8 -*- from validator import Validator class Css(Validator): __filetype__ = 'css' checker = 'csslint' args = '--format=compact' regex = r''' .+: \s line\s(?P<lnum>\d+), \s col\s(?P<col>\d+), \s ( ...
faker/providers/credit_card/pt_PT/__init__.py
mgorny/faker
12,077
11075551
<filename>faker/providers/credit_card/pt_PT/__init__.py<gh_stars>1000+ from collections import OrderedDict from .. import CreditCard from .. import Provider as CreditCardProvider class Provider(CreditCardProvider): """Implementation of ``pt_PT`` locale credit card For all methods that take ``card_type`` as ...
graphql_compiler/typedefs.py
kensho-technologies/graphql-compiler
521
11075609
<gh_stars>100-1000 # Copyright 2020-present Kensho Technologies, LLC. import sys from typing import Union from graphql import GraphQLList, GraphQLNonNull, GraphQLScalarType from graphql.language.ast import ( BooleanValueNode, EnumValueNode, FloatValueNode, IntValueNode, StringValueNode, ) # The b...
cea/demand/electrical_loads.py
justinfmccarty/CityEnergyAnalyst_bigmacc
121
11075612
# -*- coding: utf-8 -*- """ Electrical loads """ import numpy as np from cea.constants import * from cea.constants import HOURS_IN_YEAR, P_WATER_KGPERM3 from cea.demand import control_heating_cooling_systems, constants from cea.utilities import physics __author__ = "<NAME>, <NAME>" __copyright__ = "Copyright 2016...
build/tests/test_multiline_string_utilities.py
swiesenhuetter/ApprovalTests.cpp
259
11075615
import unittest import textwrap import inspect from approvaltests.approvals import verify from scripts.multiline_string_utilities import remove_indentation, remove_indentation_from from tests.helpers import diff_merge_reporter class TestMultilineStringUtilities(unittest.TestCase): def test_remove_indentation_fr...
tools/protoxform/options.py
lopter-dbx/envoy
218
11075625
# Manage internal options on messages/enums/fields/enum values. from udpa.annotations import versioning_pb2 def AddHideOption(options): """Mark message/enum/field/enum value as hidden. Hidden messages are ignored when generating output. Args: options: MessageOptions/EnumOptions/FieldOptions/EnumValueOpti...
Utils/string_utils.py
DiceTechJobs/ConceptualSearch
265
11075629
<filename>Utils/string_utils.py<gh_stars>100-1000 import re __re_collapse_spaces__ = re.compile("\s+") __re_remove_special_chars__ = re.compile("[;:\'\"\*/\),\(\|\s]+") def collapse_spaces(s): return __re_collapse_spaces__.sub(" ", s).strip() def clean_str(s): s = str(s).replace("'s"," ") #doesn't work i...
test/integration/component/test_multiple_ip_ranges.py
ycyun/ablestack-cloud
1,131
11075633
<reponame>ycyun/ablestack-cloud # 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 ...
saleor/graphql/checkout/mutations/checkout_customer_detach.py
siyoola/saleor
1,392
11075638
<reponame>siyoola/saleor<filename>saleor/graphql/checkout/mutations/checkout_customer_detach.py import graphene from ....checkout.error_codes import CheckoutErrorCode from ....core.exceptions import PermissionDenied from ....core.permissions import AccountPermissions, AuthorizationFilters from ...core.descriptions imp...
f5/bigip/tm/ltm/test/functional/test_monitor.py
nghia-tran/f5-common-python
272
11075640
<gh_stars>100-1000 # Copyright 2015-2106 F5 Networks 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 l...
hyperglass/models/config/__init__.py
blkmajik/hyperglass
298
11075651
"""Define models for all config variables. Import config variables and overrides default class attributes. Validate input for overridden parameters. """
hydralit/__init__.py
rambam613/hydralit
148
11075666
from hydralit.hydra_app import HydraApp from hydralit.sessionstate import SessionState from hydralit.app_template import HydraHeadApp from streamlit import *
src/livestreamer/plugins/tvplayer.py
jaccarmac/livestreamer
3,614
11075670
#!/usr/bin/env python import re from livestreamer.plugin import Plugin from livestreamer.plugin.api import http, validate from livestreamer.stream import HLSStream USER_AGENT_STRING = ("Mozilla/5.0 (Macintosh; Intel Mac OS X 10_10_3) " "AppleWebKit/537.36 (KHTML, like Gecko) " ...
vyxal/__main__.py
kokonut27/Vyxal
123
11075693
<reponame>kokonut27/Vyxal from vyxal.main import cli cli()
presentations/scientific-logging/slow.py
thedrow/eliot
598
11075697
<reponame>thedrow/eliot from eliot import log_call, to_file import sys to_file(open("out.log", "w")) @log_call def double(a): if a == 0: import time time.sleep(10) return a * 2 @log_call def main(): double(13) double(0) double(4) main()
fw_tutorials/dynamic_wf/fibadd_task.py
tschaume/fireworks
251
11075702
<reponame>tschaume/fireworks #!/usr/bin/env python from fireworks.core.firework import FiretaskBase, Firework, FWAction __author__ = "<NAME>" __copyright__ = "Copyright 2013, The Materials Project" __version__ = "0.1" __maintainer__ = "<NAME>" __email__ = "<EMAIL>" __date__ = "Feb 25, 2013" class FibonacciAdderTask...
pylayers/gui/__init__.py
usmanwardag/pylayers
143
11075703
<reponame>usmanwardag/pylayers<filename>pylayers/gui/__init__.py """ pylayers ========= This file is adapted from scikit-learn package """ import sys __version__ = '0.12-git' try: # This variable is injected in the __builtins__ by the build # process. It used to enable importing subpackages of sklearn when ...
torch/fx/experimental/unification/__init__.py
Hacky-DH/pytorch
60,067
11075732
<gh_stars>1000+ # type: ignore[attr-defined] from .core import unify, reify # noqa: F403 from .more import unifiable # noqa: F403 from .variable import var, isvar, vars, variables, Var # noqa: F403
PaddleFSL/paddlefsl/datasets/cub_fs.py
tianxin1860/FSL-Mate
982
11075755
<filename>PaddleFSL/paddlefsl/datasets/cub_fs.py from . import CVDataset from paddlefsl.task_sampler import TaskSet import paddlefsl.utils as utils from PIL import Image import numpy as np import random import pickle as pkl __all__ = ['CubFS'] class CubFS(CVDataset): """ Implementation of `CUB-FS` dataset. ...
static/application/christmas/blazeface/module.py
leakyH/PaddleDetection
7,782
11075771
# 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...
scripts/ui/calibration.py
sparsebase/facebook360_dep
221
11075774
<gh_stars>100-1000 #!/usr/bin/env python3 # Copyright 2004-present Facebook. 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. """Calibration tab for the UI. Defines the interaction model for the background tab in th...
tests/test_extended_types.py
arssher/aiopg
1,307
11075795
import uuid from psycopg2.extras import Json async def test_uuid(make_connection): conn = await make_connection() _id = uuid.uuid1() cur = await conn.cursor() try: await cur.execute("DROP TABLE IF EXISTS tbl") await cur.execute("""CREATE TABLE tbl (id UUID)""") await cur.execu...