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
flax/optim/rmsprop.py
navjotts/flax
2,249
11067586
# Copyright 2021 The Flax Authors. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in wri...
detect.py
zeroc00I/pyfiscan
496
11067590
<reponame>zeroc00I/pyfiscan import os import logging import re import chardet yaml_fn_dict = {} def yaml_visible(fn): """Decorator, which allows us to point to function names in YAML-files. Example: fingerprint: detect_general """ yaml_fn_dict[fn.__name__] = fn return fn def grep_from_file(ver...
tests/test_unix.py
PyO3/tokio
239
11067601
<filename>tests/test_unix.py<gh_stars>100-1000 # Copied from the uvloop project. If you add a new unittest here, # please consider contributing it to the uvloop project. # # Portions copyright (c) 2015-present MagicStack Inc. http://magic.io import asyncio import os import socket import tempfile import pytest impo...
calvinextras/calvinsys/media/webcam/opencv/Webcam.py
gabrielcercel/calvin-base
334
11067609
# -*- coding: utf-8 -*- # Copyright (c) 2017 Ericsson AB # # 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 ...
training/transnet.py
uygnef/TransNetV2
155
11067666
import gin import h5py import numpy as np import tensorflow as tf from models import ResNet18, ResNetBlock @gin.configurable(blacklist=["name"]) class TransNetV2(tf.keras.Model): def __init__(self, F=16, L=3, S=2, D=256, use_resnet_features=False, use_many_hot_targets=False, ...
homeassistant/components/buienradar/const.py
MrDelik/core
30,023
11067679
"""Constants for buienradar component.""" DOMAIN = "buienradar" DEFAULT_TIMEFRAME = 60 DEFAULT_DIMENSION = 700 DEFAULT_DELTA = 600 CONF_DELTA = "delta" CONF_COUNTRY = "country_code" CONF_TIMEFRAME = "timeframe" SUPPORTED_COUNTRY_CODES = ["NL", "BE"] DEFAULT_COUNTRY = "NL" """Schedule next call after (minutes)."""...
services/fuse/tests/test_exec.py
chlige/arvados
222
11067680
# Copyright (C) The Arvados Authors. All rights reserved. # # SPDX-License-Identifier: AGPL-3.0 from __future__ import absolute_import from six import assertRegex import arvados_fuse.command import json import multiprocessing import os from . import run_test_server import tempfile import unittest from .integration_te...
models/plot_spam_scores.py
chihyunsong/oc-nn
203
11067683
<reponame>chihyunsong/oc-nn import numpy as np import pandas as pd from sklearn import utils import matplotlib.pyplot as plt dataPath = './data/' activations = ["Linear","Sigmoid"] methods = ["Linear","RBF"] def plot_decision_scores_SPAM(dataset,df_spam_scores): # Four axes, returned as a 2-d array # f...
napkin_ml/examples/logistic_regression.py
manasbedmutha98/NapkinML
548
11067709
<reponame>manasbedmutha98/NapkinML from __future__ import print_function import numpy as np import matplotlib.pyplot as plt import pandas as pd from napkin_ml import LogisticRegression, PCA from napkin_ml.utils import Plot, load_iris, train_test_split def main(): # Load dataset data = load_iris() X = da...
tests/test_function_basis.py
vaishnavtv/neurodiffeq
202
11067716
import pytest import torch import numpy as np import torch.nn as nn from numpy import isclose from neurodiffeq.function_basis import LegendrePolynomial from neurodiffeq.function_basis import LegendreBasis from neurodiffeq.function_basis import ZonalSphericalHarmonics from neurodiffeq.function_basis import ZonalSpherica...
scripts/conda/make-m2-proxy.py
Pahandrovich/omniscidb
868
11067723
#!/usr/bin/env python ''' Generate ~/.m2/settings.xml specifying proxies if such environment variables are set. ''' import os import sys import re import errno def simple_xml(name, sections): ''' very simple xml generator for one-level depth items ''' result = ['<%s>' % name] for sec_name, sec_value in s...
tests/test_cpan.py
trathborne/nvchecker
320
11067733
<filename>tests/test_cpan.py<gh_stars>100-1000 # MIT licensed # Copyright (c) 2013-2020 lilydjwg <<EMAIL>>, et al. import pytest pytestmark = [pytest.mark.asyncio, pytest.mark.needs_net] async def test_cpan(get_version): assert await get_version("POE-Component-Server-HTTPServer", { "source": "cpan", }...
office-plugin/windows-office/share/Scripts/python/HelloWorld.py
jerrykcode/kkFileView
6,660
11067736
<reponame>jerrykcode/kkFileView # HelloWorld python script for the scripting framework # # This file is part of the LibreOffice project. # # This Source Code Form is subject to the terms of the Mozilla Public # License, v. 2.0. If a copy of the MPL was not distributed with this # file, You can obtain one at http://moz...
atp-auto-core-open/atp/views/project.py
rebecca1202/testAuto
130
11067749
# -*- coding:utf-8 -*- """ File Name: `project`.py Version: Description: 增加接口:/project/add 入参格式: { "projectName":"XXX", "simpleDec:"xxx"(非必填) } 修改接口:/project/edit 入参格式: { "id":xx, "projectName":"xxx", "simpleDec:"xxx"(非必填) } 删除接口:/project/delete 入参格式: { ...
python/tvm/contrib/ethosu/cascader/plan_generator.py
shengxinhu/tvm
4,640
11067751
<reponame>shengxinhu/tvm<gh_stars>1000+ # 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, Vers...
utest/resources/robotdata/libs/TestLib.py
guojiajiaok/RIDE
775
11067767
def testlib_keyword(): """ """ return True def testlib_keyword_with_args(arg1, arg2='default value', *args): """This keyword requires one argument, has one optional argument and varargs. This is some more documentation """ pass def testlib_keyword_with_kwonlyargs(arg1, *args, namedarg1, ...
kitsune/kbadge/migrations/0004_auto_20200629_0826.py
AndrewDVXI/kitsune
929
11067778
<gh_stars>100-1000 # Generated by Django 2.2.13 on 2020-06-29 08:26 from django.db import migrations, models class Migration(migrations.Migration): dependencies = [ ('kbadge', '0003_auto_20190816_1824'), ] operations = [ migrations.AlterField( model_name='award', ...
ceph/tests/test_e2e.py
vbarbaresi/integrations-core
663
11067780
# (C) Datadog, Inc. 2019-present # All rights reserved # Licensed under a 3-clause BSD style license (see LICENSE) import pytest from datadog_checks.ceph import Ceph from .common import BASIC_CONFIG, EXPECTED_METRICS, EXPECTED_SERVICE_CHECKS, EXPECTED_SERVICE_TAGS @pytest.mark.e2e def test_check(dd_agent_check): ...
pandapower/control/controller/trafo/ContinuousTapControl.py
yougnen/pandapower
104
11067811
<gh_stars>100-1000 # -*- coding: utf-8 -*- # Copyright (c) 2016-2021 by University of Kassel and Fraunhofer Institute for Energy Economics # and Energy System Technology (IEE), Kassel. All rights reserved. import numpy as np from pandapower.control.controller.trafo_control import TrafoController class ContinuousTap...
cifar/network-slimming/models/channel_selection.py
dukebw/rethinking-network-pruning
1,410
11067826
import numpy as np import torch import torch.nn as nn class channel_selection(nn.Module): """ Select channels from the output of BatchNorm2d layer. It should be put directly after BatchNorm2d layer. The output shape of this layer is determined by the number of 1 in `self.indexes`. """ def __init_...
jacweb/session/session.py
dapatil211/Jacinle
114
11067867
#! /usr/bin/env python3 # -*- coding: utf-8 -*- # File : session.py # Author : <NAME> # Email : <EMAIL> # Date : 10/23/2018 # # This file is part of Jacinle. # Distributed under terms of the MIT license. import hmac import uuid import hashlib __all__ = ['Session', 'SessionManagerBase'] class Session(dict): ...
core/utils.py
Alberdi/babybuddy
922
11067888
# -*- coding: utf-8 -*- import random from django.utils import timezone from django.utils.translation import ngettext random.seed() COLORS = [ "#ff0000", "#00ff00", "#0000ff", "#ff00ff", "#ffff00", "#00ffff", "#ff7f7f", "#7fff7f", "#7f7fff", "#ff7fff", "#ffff7f", "#7ff...
packs/webpagetest/actions/random_test.py
jonico/st2contrib
164
11067893
from lib.webpagetest import WebPageTestAction __all__ = ['RandomTest'] class RandomTest(WebPageTestAction): def run(self, domain): return self.test_random_location(domain)
library/goldsrc/mdl_v4/mdl_file.py
anderlli0053/SourceIO
199
11067916
from typing import List from ...shared.base import Base from ...utils.byte_io_mdl import ByteIO from .structs.bone import StudioBone from .structs.model import StudioModel from .structs.sequence import StudioSequence from .structs.studioheader import StudioHeader from .structs.bodypart import StudioBodypart class M...
setup_app/installers/passport.py
duttarnab/community-edition-setup
178
11067921
<reponame>duttarnab/community-edition-setup import os import glob import json from setup_app import paths from setup_app.static import AppType, InstallOption from setup_app.config import Config from setup_app.utils import base from setup_app.installers.node import NodeInstaller class PassportInstaller(NodeInstaller)...
zella-graphics/draw-lines/main.py
whitmans-max/python-examples
140
11067927
#!/usr/bin/env python3 from graphics import * STEP = 10 win = GraphWin('Example', 300, 300) for x1 in range(0, 301, STEP): x2 = x1 + STEP Line(Point(x1, 0), Point(300, x2)).draw(win) Line(Point(300-x1, 0), Point(0, x2)).draw(win) Line(Point(0, x2), Point(x1, 300)).draw(win) Line(Point(300, x2), ...
autobahn/wamp/test/test_protocol_peer.py
rapyuta-robotics/autobahn-python
1,670
11067931
############################################################################### # # The MIT License (MIT) # # Copyright (c) Crossbar.io Technologies GmbH # # 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 ...
tests/basic/kwargs2.py
MoonStarCZW/py2rb
124
11067933
def myfunc(a, b, *c, fuga='hoge', **d): print(a) print(b) for i in c: print(i) print(fuga) keys = list(d.keys()) keys.sort() for i in keys: print(i) print(d[i]) myfunc(1, 2, bar='a', foo='c') print() myfunc(1, 2, 3, 4, bar='a', foo='c') myfunc(1, 2, 3, 4, bar='a', fu...
src/model_fns_tf.py
TheodoreGalanos/DALLE-mtf
385
11067941
import tensorflow.compat.v1 as tf import tensorflow.compat.v2 as tf2 from tensorflow.python.tpu import tpu_estimator from .optimizers import get_optimizer from .vae_tf import DiscreteVAE from .utils import scalar_summary, mode_to_str, create_host_call def vae_model_fn(features, labels, mode, params): # Build mtf_...
preprocess/ljspeech_wavenet.py
ishine/self-attention-tacotron
111
11067946
# ============================================================================== # Copyright (c) 2018, Yamagishi Laboratory, National Institute of Informatics # Author: <NAME> (<EMAIL>) # All rights reserved. # ============================================================================== """ Preprocess for LJSpeech da...
lib/python2.7/site-packages/jwt/algorithms.py
ervinpepic/E-commerce
674
11067947
<filename>lib/python2.7/site-packages/jwt/algorithms.py import hashlib import hmac from .compat import constant_time_compare, string_types, text_type from .exceptions import InvalidKeyError from .utils import der_to_raw_signature, raw_to_der_signature try: from cryptography.hazmat.primitives import hashes fro...
Unbias_LightGBM/examples/python-guide/simple_example.py
atul2804/Unbiased_LambdaMart
212
11067950
# coding: utf-8 # pylint: disable = invalid-name, C0111 import json import lightgbm as lgb import pandas as pd from sklearn.metrics import mean_squared_error # load or create your dataset print('Load data...') df_train = pd.read_csv('../regression/regression.train', header=None, sep='\t') df_test = pd.read_csv('../re...
third_party/blink/tools/blinkpy/w3c/import_notifier.py
zealoussnow/chromium
14,668
11067955
# Copyright 2017 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. """Sends notifications after automatic imports from web-platform-tests (WPT). Automatically file bugs for new failures caused by WPT imports for opted-in dir...
tests/utils.py
Patil2099/tangent
2,379
11067960
# Copyright 2017 Google Inc. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in wri...
tests/test_record.py
fshart/aesara
111
11067966
from io import StringIO from aesara import function from aesara.tensor.type import iscalar from tests.record import MismatchError, Record, RecordMode def test_record_good(): # Tests that when we record a sequence of events, then # repeat it exactly, the Record class: # 1) Records it correctly # ...
LogKeyModel_predict.py
HankKung/DeepLog
268
11067968
import torch import torch.nn as nn import time import argparse # Device configuration device = torch.device("cpu") def generate(name): # If you what to replicate the DeepLog paper results(Actually, I have a better result than DeepLog paper results), # you should use the 'list' not 'set' to obtain the full da...
src/test/pythonFiles/folding/attach_server.py
ChaseKnowlden/vscode-jupyter
615
11067982
<reponame>ChaseKnowlden/vscode-jupyter # Python Tools for Visual Studio # Copyright(c) Microsoft 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.ap...
test/demo_bindings.py
hujiawei-sjtu/sdf_tools
159
11067991
<reponame>hujiawei-sjtu/sdf_tools<filename>test/demo_bindings.py #! /usr/bin/env python import numpy as np from time import time import matplotlib.pyplot as plt from sdf_tools import utils_2d def main(): res = 0.01 x_width = 100 y_height = 100 grid_world = np.zeros([y_height, x_width], dtype=np.uint8...
src/products/admin.py
pv45412/Try-Django
1,110
11067993
<reponame>pv45412/Try-Django from django.contrib import admin from .models import Product admin.site.register(Product)
braintree/address_gateway.py
futureironman/braintree_python
182
11068009
import re import braintree from braintree.address import Address from braintree.error_result import ErrorResult from braintree.exceptions.not_found_error import NotFoundError from braintree.resource import Resource from braintree.successful_result import SuccessfulResult class AddressGateway(object): def __init__(...
onnxruntime/test/testdata/transform/fusion/bias_softmax_gen.py
jamill/onnxruntime
669
11068017
import onnx from onnx import OperatorSetIdProto, TensorProto, helper add = helper.make_node("Add", ["input", "bias"], ["add_out"], "add") reverseadd = helper.make_node("Add", ["bias", "input"], ["add_out"], "add") softmax1 = helper.make_node("Softmax", ["add_out"], ["output"], "softmax", axis=1) softmax3 = helper.make...
main.py
rossning92/rpi-robot
106
11068029
<reponame>rossning92/rpi-robot<gh_stars>100-1000 from flask import Flask, request, jsonify from flask_socketio import SocketIO, join_room, emit, send from test_twowheel import test_controller from twowheel import TwoWheelController import signal import sys app = Flask(__name__, static_url_path="") socketio =...
tests/tello_qt/wifi.py
aaaaronlin/TelloPy
591
11068045
<reponame>aaaaronlin/TelloPy<gh_stars>100-1000 #!/usr/bin/env python import subprocess import time def get_device_name(): proc = subprocess.Popen(['networksetup','-listallhardwareports'], stdout=subprocess.PIPE) wifi = False device_name = None while True: line = proc.stdout.readline() ...
venv/lib/python3.8/site-packages/textblob/sentiments.py
avrumnoor/NewsSummarizer
6,608
11068068
<reponame>avrumnoor/NewsSummarizer # -*- coding: utf-8 -*- '''Default sentiment analyzers are English for backwards compatibility, so you can still do >>> from textblob.sentiments import PatternAnalyzer which is equivalent to >>> from textblob.en.sentiments import PatternAnalyzer ''' from __future__ import absolute_...
lib/matplotlib/testing/image_util.py
jbbrokaw/matplotlib
113
11068082
# This module contains some functionality from the Python Imaging # Library, that has been ported to use Numpy arrays rather than PIL # Image objects. # The Python Imaging Library is # Copyright (c) 1997-2009 by Secret Labs AB # Copyright (c) 1995-2009 by <NAME> # By obtaining, using, and/or copying this software a...
tests/schema/test_interface.py
otakuy/strawberry
2,062
11068085
<gh_stars>1000+ from dataclasses import dataclass from typing import List import pytest import strawberry def test_query_interface(): @strawberry.interface class Cheese: name: str @strawberry.type class Swiss(Cheese): canton: str @strawberry.type class Italian(Cheese): ...
ppci/arch/arm/arch.py
kl4w3i/ppci
161
11068091
""" ARM architecture definition. """ import io from ... import ir from ...binutils.assembler import BaseAssembler from ..arch import Architecture from ..arch_info import ArchInfo, TypeInfo from ..generic_instructions import Label, Alignment, RegisterUseDef from ..data_instructions import Db, Dd, Dcd2, data_isa from ..r...
stanza/server/ud_enhancer.py
asears/stanza
3,633
11068118
import stanza from stanza.protobuf import DependencyEnhancerRequest, Document, Language from stanza.server.java_protobuf_requests import send_request, add_sentence, JavaProtobufContext ENHANCER_JAVA = "edu.stanford.nlp.trees.ud.ProcessUniversalEnhancerRequest" def build_enhancer_request(doc, language, pronouns_patt...
plugins/gcalc.py
daviddever/skybot
114
11068121
from __future__ import unicode_literals from util import hook, http @hook.command def calc(inp): """.calc <term> -- returns Google Calculator result""" h = http.get_html("http://www.google.com/search", q=inp) m = h.xpath('//h2[@class="r"]/text()') if not m: return "could not calculate " + ...
imagenet_nv/multiproc.py
sanjeevm0/imagenet-fast
298
11068122
import argparse import torch import sys import subprocess from pathlib import Path argslist = list(sys.argv)[1:] world_size = torch.cuda.device_count() if '--world-size' in argslist: argslist[argslist.index('--world-size')+1] = str(world_size) else: argslist.append('--world-size') argslist.append(str(worl...
mmaction/core/post_processing/__init__.py
arpanmangal/coinaction
1,929
11068136
from .bbox_nms import multiclass_nms, singleclass_nms from .merge_augs import (merge_aug_proposals, merge_aug_bboxes, merge_aug_scores) __all__ = [ 'multiclass_nms', 'singleclass_nms', 'merge_aug_proposals', 'merge_aug_bboxes', 'merge_aug_scores' ]
pyston/test/external/test_sqlalchemy.py
mananpal1997/pyston
2,441
11068188
<gh_stars>1000+ import os import shutil import subprocess import sys import tempfile if __name__ == "__main__": with tempfile.TemporaryDirectory() as tempdir: # The log seems somewhat non-deterministic: print("PYSTONTEST: no-log-check") def rel(path): return os.path.join(os.pat...
tests/unit/lib/test_aws.py
senstb/aws-elastic-beanstalk-cli
110
11068227
# 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 the "license" file accompa...
tests/unittests/resources/worker_deps_path/common_module/__init__.py
anandagopal6/azure-functions-python-worker
277
11068245
# Copyright (c) Microsoft Corporation. All rights reserved. # Licensed under the MIT License. __version__: str = 'worker' import os # ./tests/unittests/resources/worker_deps_path/common_module package_location: str = os.path.dirname(__file__)
davarocr/davarocr/davar_common/datasets/davar_multi_dataset.py
icedream2/DAVAR-Lab-OCR
387
11068247
<gh_stars>100-1000 """ ################################################################################################## # Copyright Info : Copyright (c) Davar Lab @ Hikvision Research Institute. All rights reserved. # Filename : davar_multi_dataset.py # Abstract : Implementation of the multiple d...
src/multiclass/KNNParameter.py
ocatak/malware_api_class
172
11068267
class KNNParameter: def __init__(self, n_neighbors, p, algorithm): #Embedding self.n_neighbors = n_neighbors self.p = p self.algorithm = algorithm class KNNParameters: def __init__(self): # model self.parameters = [] # 2019-07-06 09_0...
helper.py
C00reNUT/Watermark-Removal-Pytorch
189
11068278
<gh_stars>100-1000 import numpy as np from PIL import Image import matplotlib.pyplot as plt import torch from torchvision.utils import make_grid def pil_to_np_array(pil_image): ar = np.array(pil_image) if len(ar.shape) == 3: ar = ar.transpose(2,0,1) else: ar = ar[None, ...] return ar.a...
src/gimelstudio/utils/drawing.py
iwoithe/GimelStudio
134
11068280
# ---------------------------------------------------------------------------- # Gimel Studio Copyright 2019-2022 by <NAME> and contributors # # 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 # ...
src/genie/libs/parser/iosxe/tests/ShowPlatformSoftwareYangManagementProcessMonitor/cli/equal/golden_output_expected.py
balmasea/genieparser
204
11068284
<filename>src/genie/libs/parser/iosxe/tests/ShowPlatformSoftwareYangManagementProcessMonitor/cli/equal/golden_output_expected.py expected_output = { 'pid': { 2357: { 'cpu': 0.4, 'elapsed': '21:44:31', 'mem': 2.8, 'command': 'confd', 'rss': 224620, 'state': 'S', 'vsz': 196...
lulujianjie/0001/0001.py
saurabh896/python-1
3,976
11068300
<gh_stars>1000+ import uuid uuids = [] for i in range(200):#0-199 uuids.append(uuid.uuid1())#append把value当作一个整体插入list i = 0; for i in range(200): print uuids[i]
alipay/aop/api/domain/AlipayCommerceLogisticsWaybillInstantdeliverySettleModel.py
antopen/alipay-sdk-python-all
213
11068308
<reponame>antopen/alipay-sdk-python-all #!/usr/bin/env python # -*- coding: utf-8 -*- import json from alipay.aop.api.constant.ParamConstants import * class AlipayCommerceLogisticsWaybillInstantdeliverySettleModel(object): def __init__(self): self._logistics_code = None self._order_no = None ...
packages/pytea/pylib/torch/utils/data/__init__.py
Sehun0819/pytea
241
11068320
from .sampler import Sampler from .dataset import Dataset, Subset, TensorDataset, random_split from .dataloader import DataLoader from . import distributed as distributed
lib/soup.py
ismisepaul/InSpy
267
11068326
<filename>lib/soup.py import BeautifulSoup, json def soupify(response): try: soupd = BeautifulSoup.BeautifulSoup(response) return soupd except (AttributeError, TypeError) as e: pass except Exception as e: print "Error: {}".format(e) def get_employees(soup): try: ...
tests/conftest.py
simik13/tfs
106
11068340
<reponame>simik13/tfs # -*- coding: utf-8 -*- import os import re from urllib.parse import urlparse import httpretty import pytest from tfs import TFSAPI def request_callback_get(request, uri, headers): # Map path from url to a file path = urlparse(uri).path.split('DefaultCollection/')[1] response_file ...
tests/server/middleware/test_ui.py
monosidev/monosi
156
11068348
import pytest import server.middleware.ui def test__build_path(): pass def test__serve_ui(): pass def test_init_ui_with_serve_ui_config_true(): pass def test_init_ui_with_serve_ui_config_false(): pass
Src/StdLib/Lib/site-packages/win32comext/axscript/client/pyscript.py
cwensley/ironpython2
1,078
11068354
"""Python ActiveX Scripting Implementation This module implements the Python ActiveX Scripting client. To register the implementation, simply "run" this Python program - ie either double-click on it, or run "python.exe pyscript.py" from the command line. """ import winerror import win32com import win32api import pyt...
d3pm/images/utils.py
xxdreck/google-research
23,901
11068357
# coding=utf-8 # Copyright 2021 The Google Research Authors. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicab...
scripts/flattening_thresh.py
clairechingching/ScaffCC
158
11068365
<reponame>clairechingching/ScaffCC #!/usr/bin/env python import math import argparse def genFlattenModules(benchName): fn = benchName+'.out' f = open(fn,'r') r = f.read().split('\n') f.close() l = filter(lambda x: (len(x)>1), r) #print l m = map(lambda x: x.replace(':',''), l) m = m...
projects/UniDet/unidet/data/datasets/mapillary.py
Othinus099/interior
349
11068372
<reponame>Othinus099/interior from detectron2.data.datasets.register_coco import register_coco_instances import os ''' categories = [ {'id': 28, 'name': 'animal--bird'} , {'id': 29, 'name': 'animal--ground-animal'} , {'id': 30, 'name': 'construction--flat--crosswalk-plain'} , {'id': 31, 'name': 'human-...
holoviews/tests/core/test_prettyprint.py
TheoMathurin/holoviews
864
11068405
<gh_stars>100-1000 """ Test cases for the pretty printing system. """ from holoviews.element.comparison import ComparisonTestCase from holoviews import Store, Element, Curve, Overlay, Layout from holoviews.core.pprint import PrettyPrinter from .test_dimensioned import CustomBackendTestCase, ExampleElement class Pr...
setup.py
mindspore-ai/serving
157
11068416
<reponame>mindspore-ai/serving #!/usr/bin/env python3 # encoding: utf-8 # Copyright 2020 Huawei Technologies Co., Ltd # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org...
sdk/python/tests/unit/test_usage.py
MuhammadZeeshan34/feast
2,258
11068427
<reponame>MuhammadZeeshan34/feast<filename>sdk/python/tests/unit/test_usage.py import datetime import json import time from unittest.mock import patch import pytest from feast.usage import ( RatioSampler, log_exceptions, log_exceptions_and_usage, set_usage_attribute, tracing_span, ) @pytest.fixt...
scripts/dump-cli-help.py
paternal/lektor-website
184
11068435
<filename>scripts/dump-cli-help.py import os import click from click.formatting import join_options from lektor.cli import cli as root_command OUT = os.path.abspath(os.path.join( os.path.dirname(__file__), '..', 'content', 'docs', 'cli')) def get_opts(param): any_prefix_is_slash = [] def _write(opts): ...
recipes/ncurses/_run_test.py
Frmissjing/berryconda
642
11068471
import curses import sys if __name__ == '__main__': if sys.stdout.isatty(): screen = curses.initscr() try: curses.cbreak() pad = curses.newpad(10, 10) size = screen.getmaxyx() pad.refresh(0, 0, 0, 0, size[0] - 1, size[1] - 1) finally: ...
Python/Tests/TestData/DjangoAnalysisTestApp/test_render/views.py
techkey/PTVS
404
11068472
from django.shortcuts import render, render_to_response from django import template register = template.Library() def test_render_view(request): return render(request, 'test_render.html', {'content': 'data'}) def test_render_to_response_view(request): return render_to_response('test_render_to_response.html',...
tests/syntax/simple_expression/test_attr_ref.py
PowerOlive/mindspore
3,200
11068490
<reponame>PowerOlive/mindspore # Copyright 2021 Huawei Technologies Co., Ltd # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required...
bert/macaron-scripts/test/generate_test_scripts.py
changhaowu/macaron-net
140
11068494
import os import sys import copy import itertools import inspect def task(name, n_sentences, task, criterion, symmetric, n_classes, data_path): return locals() def params(*args): keys = ["seed_list", "n_epoch_list", "batch_sz_list", "lr_list", "weight_decay_list"] assert len(args) == len(keys) values ...
pysparkling/samplers.py
ptallada/pysparkling
260
11068502
import math import random try: import numpy except ImportError: numpy = None def pysparkling_poisson(lambda_): if lambda_ == 0.0: return 0 n = 0 exp_neg_lambda = math.exp(-lambda_) prod = 1.0 while True: prod *= random.random() if prod > exp_neg_lambda: ...
coding_interviews/elements_of_programming_interview/longest_subarray_length_with_same_integers.py
LeandroTk/Algorithms
205
11068506
<filename>coding_interviews/elements_of_programming_interview/longest_subarray_length_with_same_integers.py ''' Write a program that takes an array of integers and finds the length of a longest subarray all of whose entries are equal. ''' def longest_subarray_length_with_same_integers(numbers): if not numbers: ...
src/python/nimbusml/cluster/__init__.py
michaelgsharp/NimbusML
134
11068510
from .kmeansplusplus import KMeansPlusPlus __all__ = [ 'KMeansPlusPlus' ]
sdk/resourcemanagerhybrid/update_root_pom.py
billwert/azure-sdk-for-java
1,350
11068548
<gh_stars>1000+ with open('pom.xml', 'r') as file: filedata = file.read() filedata = filedata.replace('<module>sdk/resourcemanager</module>', '<module>sdk/resourcemanagerhybrid</module>') with open('pom.xml', 'w') as file: file.write(filedata)
reinforcement_learning/rl_hvac_ray_energyplus/source/eplus/__init__.py
jerrypeng7773/amazon-sagemaker-examples
2,610
11068554
<reponame>jerrypeng7773/amazon-sagemaker-examples<gh_stars>1000+ from gym.envs.registration import register register( id="large-office-v0", entry_point="eplus.envs:LargeOfficeEnv", ) register(id="data-center-v0", entry_point="eplus.envs:DataCenterEnv")
blocks/model.py
KIKOcaoyue/blocks
1,067
11068566
"""Model - heavily annotated computation graph. A model in Blocks is simply an annotated computation graph. The class :class:`Model` extends :class:`blocks.graph.ComputationGraph` :class:, which is able to handle annotations and roles in general, but is deliberately made unaware of specific annotations that a Theano ...
PhysicsTools/PatAlgos/python/tools/heavyIonTools.py
ckamtsikis/cmssw
852
11068567
<reponame>ckamtsikis/cmssw from PhysicsTools.PatAlgos.tools.ConfigToolBase import * from PhysicsTools.PatAlgos.tools.helpers import * class ConfigureHeavyIons(ConfigToolBase): """ Configure all defaults for heavy ions """ _label='configureHeavyIons' _defaultParameters=dicttypes.SortedKeysDict() ...
nnutils/nmr_pytorch.py
NVlabs/UMR
184
11068573
<gh_stars>100-1000 # ----------------------------------------------------------------------------------- # Code adapted from: # https://github.com/akanazawa/cmr/blob/master/nnutils/nmr.py # # MIT License # # Copyright (c) 2018 akanazawa # # Permission is hereby granted, free of charge, to any person obtaining a cop...
turnOffBarAfterRestart/turnOffBarAfterRestart.py
eifinger/appdaemon-scripts
122
11068588
import appdaemon.plugins.hass.hassapi as hass from requests.exceptions import HTTPError # # Will turn the bar table green and then off when homeassistant restarts to indicate the restart went well # # # Args: # # light: light. example: light.bar_table # # Release Notes # # Version 1.0: # Initial Version class Turn...
gui/widgets/py_toggle/py_toggle.py
ZETOsfx/PyOneDark_Qt_Widgets_Modern_GUI
318
11068598
# /////////////////////////////////////////////////////////////// # # BY: <NAME> # PROJECT MADE WITH: Qt Designer and PySide6 # V: 1.0.0 # # This project can be used freely for all uses, as long as they maintain the # respective credits only in the Python scripts, any information in the visual # interface (GUI)...
froide/publicbody/migrations/0032_auto_20201221_1953.py
xenein/froide
198
11068600
# Generated by Django 3.1.4 on 2020-12-21 18:53 from django.db import migrations, models class Migration(migrations.Migration): dependencies = [ ("publicbody", "0031_publicbody_change_history"), ] operations = [ migrations.AlterField( model_name="category", name=...
tensornetwork/utils.py
khanhgithead/TensorNetwork
1,681
11068605
<filename>tensornetwork/utils.py # Copyright 2019 The TensorNetwork Authors # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless requ...
jitrebalance/test_jitrebalance.py
bit0fun/plugins
173
11068612
<filename>jitrebalance/test_jitrebalance.py from pyln.client import RpcError from pyln.testing.fixtures import * # noqa: F401, F403 from pyln.testing.utils import wait_for, DEVELOPER import os import time import pytest import unittest currdir = os.path.dirname(__file__) plugin = os.path.join(currdir, 'jitrebalance.p...
tests/ssg_test_suite/oscap.py
kmccarron-rh/content
1,138
11068613
<reponame>kmccarron-rh/content #!/usr/bin/env python from __future__ import print_function import logging import os.path import re import collections import xml.etree.ElementTree import json import datetime import socket import sys import time from ssg.constants import OSCAP_PROFILE_ALL_ID from ssg_test_suite.log im...
python/28_binary_heap/heap.py
shipan3452/algo
22,028
11068636
#!/usr/bin/python # -*- coding: UTF-8 -*- import math import random class Heap: def __init__(self, nums=None, capacity=100): self._data = [] self._capacity = capacity if type(nums) == list and len(nums) <= self._capacity: for n in nums: assert type(n) is int ...
Experimental/Cartpole_Highest_Reward_mem.py
ProGamerCode/FitML
171
11068654
''' CartPole solution by <NAME> https://github.com/FitMachineLearning/FitML/ https://www.youtube.com/channel/UCi7_WxajoowBl4_9P0DhzzA/featured Using Actor Critic Note that I prefe the terms Action Predictor Network and Q/Reward Predictor network better Update Cleaned up variables and more readable memory Improved hyp...
qiskit/transpiler/passes/layout/set_layout.py
Roshan-Thomas/qiskit-terra
1,599
11068684
# This code is part of Qiskit. # # (C) Copyright IBM 2019 # # This code is licensed under the Apache License, Version 2.0. You may # obtain a copy of this license in the LICENSE.txt file in the root directory # of this source tree or at http://www.apache.org/licenses/LICENSE-2.0. # # Any modifications or derivative wor...
tutel/parted/patterns.py
G-arj/tutel
156
11068692
<reponame>G-arj/tutel # Copyright (c) Microsoft Corporation. # Licensed under the MIT license. from .solver import register_primitive def is_replicas(dim): return dim == -1 def is_partition(dim): return dim >= 0 @register_primitive("BAR") def primitive_pass_through(sess, node, output_dim, group_size, rank): i...
lldb/test/API/functionalities/data-formatter/data-formatter-stl/generic/optional/TestDataFormatterGenericOptional.py
LaudateCorpus1/llvm-project
605
11068693
<reponame>LaudateCorpus1/llvm-project import lldb from lldbsuite.test.decorators import * from lldbsuite.test.lldbtest import * from lldbsuite.test import lldbutil USE_LIBSTDCPP = "USE_LIBSTDCPP" USE_LIBCPP = "USE_LIBCPP" class GenericOptionalDataFormatterTestCase(TestBase): mydir = TestBase.compute_mydir(__file...
tests/core/test_hook.py
tomekr/cement
826
11068702
"""Tests for cement.core.hook.""" from unittest.mock import Mock from pytest import raises from cement.core.exc import FrameworkError from cement.core.foundation import TestApp # module tests class TestHookManager(object): pass # app functionality and coverage tests def test_define(): with TestApp() as a...
posthog/migrations/0040_remove_event_ip.py
avoajaugochukwu/posthog
7,409
11068712
# Generated by Django 3.0.3 on 2020-04-04 11:45 from django.db import migrations class Migration(migrations.Migration): dependencies = [ ("posthog", "0039_populate_event_ip_property"), ] operations = [ migrations.RemoveField(model_name="event", name="ip",), ]
TestSuites/RDP/RDPSUTControlAgent/Python/RDPSUTControlAgent.py
microsoft/WindowsProtocolTestSuites
332
11068720
#!/usr/bin/env python import binascii import datetime import logging import socket import subprocess import sys import threading from struct import Struct, unpack try: from configparser import ConfigParser except ImportError: from ConfigParser import ConfigParser # ver. < 3.0 logging.basicConfig( format...
egs/yesno/ASR/transducer/beam_search.py
TIFOSI528/icefall
173
11068752
# Copyright 2021 Xiaomi Corp. (authors: <NAME>) # # See ../../../../LICENSE for clarification regarding multiple authors # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # htt...