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
test/likelihoods/test_multitask_gaussian_likelihood.py
llguo95/gpytorch
2,673
32983
<filename>test/likelihoods/test_multitask_gaussian_likelihood.py #!/usr/bin/env python3 import unittest import torch from gpytorch.distributions import MultitaskMultivariateNormal from gpytorch.lazy import KroneckerProductLazyTensor, RootLazyTensor from gpytorch.likelihoods import MultitaskGaussianLikelihood from gp...
modules/dbnd-airflow/src/dbnd_airflow/web/airflow_app.py
dmytrostriletskyi/dbnd
224
33004
import logging def create_app(config=None, testing=False): from airflow.www_rbac import app as airflow_app app, appbuilder = airflow_app.create_app(config=config, testing=testing) # only now we can load view.. # this import might causes circular dependency if placed above from dbnd_airflow.airfl...
runway/lookups/handlers/random_string.py
onicagroup/runway
134
33005
<gh_stars>100-1000 """Generate a random string.""" # pyright: reportIncompatibleMethodOverride=none from __future__ import annotations import logging import secrets import string from typing import TYPE_CHECKING, Any, Callable, List, Sequence, Union from typing_extensions import Final, Literal from ...utils import B...
venv/Lib/site-packages/win32comext/directsound/test/ds_record.py
ajayiagbebaku/NFL-Model
150
33007
<filename>venv/Lib/site-packages/win32comext/directsound/test/ds_record.py import pywintypes import struct import win32event, win32api import os import win32com.directsound.directsound as ds def wav_header_pack(wfx, datasize): return struct.pack( "<4sl4s4slhhllhh4sl", "RIFF", 36 + datasize...
indy_node/test/rich_schema/test_rich_schemas_disabled_by_default.py
Rob-S/indy-node
627
33020
<reponame>Rob-S/indy-node import json import pytest from indy_common.constants import JSON_LD_CONTEXT, RS_CONTEXT_TYPE_VALUE, RS_ID, GET_RICH_SCHEMA_OBJECT_BY_ID, \ GET_RICH_SCHEMA_OBJECT_BY_METADATA, RS_NAME, RS_VERSION, RS_TYPE from indy_node.test.api.helper import sdk_build_rich_schema_request, sdk_write_rich_...
pycwr/__init__.py
1271756664/study
144
33029
from . import configure, core, draw, io, interp, retrieve, qc __all__ = ["configure", "core", "draw", "io", "interp", "qc", "retrieve"]
amplify/ext/phpfpm/util/version.py
dp92987/nginx-amplify-agent
308
33050
<gh_stars>100-1000 # -*- coding: utf-8 -*- from amplify.agent.common.context import context from amplify.agent.common.util import subp __author__ = "<NAME>" __copyright__ = "Copyright (C) Nginx, Inc. All rights reserved." __license__ = "" __maintainer__ = "<NAME>" __email__ = "<EMAIL>" VERSION_CMD = "%s --version" ...
open/core/scripts/writeup_profile_prompt_generate_view.py
awesome-archive/open
105
33063
# flake8: noqa import json import time import requests from django.conf import settings from websocket import create_connection from open.core.scripts.swarm_ml_services import get_random_prompt from open.core.writeup.constants import TEXT_GENERATION_URL """ this script's design was to compare performance behind djan...
utils/make_package.py
j123123/llilc
1,712
33068
<filename>utils/make_package.py<gh_stars>1000+ #!/usr/bin/env python import sys import argparse import os import subprocess import platform import io import string try: # For Python >= 3.0 from urllib.request import urlopen except ImportError: # For Python < 3.0 from urllib2 import urlopen import shut...
tests/inception/test_inception_hardware_perf.py
ispras/avatar2
415
33074
from avatar2 import * import sys import os import logging import serial import time import argparse import pyudev import struct import ctypes from random import randint # For profiling import pstats logging.basicConfig(filename='/tmp/inception-tests.log', level=logging.INFO) # ************************************...
paura_lite.py
777AVY777/Clone_paura
191
33082
<filename>paura_lite.py # paura_lite: # An ultra-simple command-line audio recorder with real-time # spectrogram visualization import numpy as np import pyaudio import struct import scipy.fftpack as scp import termplotlib as tpl import os # get window's dimensions rows, columns = os.popen('stty size', 'r').read().sp...
dataviva/apps/map/views.py
joelvisroman/dataviva-site
126
33083
<gh_stars>100-1000 # -*- coding: utf-8 -*- from flask import Blueprint, render_template, g, request, make_response from dataviva.apps.general.views import get_locale from dataviva.translations.dictionary import dictionary from dataviva import datavivadir from config import GZIP_DATA from dataviva.utils.cached_que...
services/core/DNP3Agent/tests/unit_test_point_definitions.py
rmay-intwine/volttron
406
33127
<reponame>rmay-intwine/volttron<filename>services/core/DNP3Agent/tests/unit_test_point_definitions.py # -*- coding: utf-8 -*- {{{ # vim: set fenc=utf-8 ft=python sw=4 ts=4 sts=4 et: # # Copyright 2018, 8minutenergy / Kisensum. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this fi...
tests/test_helper.py
swills/pykwalify
275
33133
<reponame>swills/pykwalify<filename>tests/test_helper.py # -*- coding: utf-8 -*- # python std lib import logging import logging.config log = logging.getLogger() # Set the root logger to be silent so all code that uses the python logger # will not print anything unless we want it to, then it should be specified # in...
hanlp/utils/__init__.py
antfootAlex/HanLP
27,208
33156
# -*- coding:utf-8 -*- # Author: hankcs # Date: 2019-08-24 22:12 from . import rules def ls_resource_in_module(root) -> dict: res = dict() for k, v in root.__dict__.items(): if k.startswith('_') or v == root: continue if isinstance(v, str): if v.startswith('http') and n...
nonconformist/base.py
smazzanti/nonconformist
301
33169
<gh_stars>100-1000 #!/usr/bin/env python """ docstring """ # Authors: <NAME> import abc import numpy as np from sklearn.base import BaseEstimator class RegressorMixin(object): def __init__(self): super(RegressorMixin, self).__init__() @classmethod def get_problem_type(cls): return 'regression' class Cla...
ivi/agilent/agilent34410A.py
sacherjj/python-ivi
161
33174
""" Python Interchangeable Virtual Instrument Library Copyright (c) 2012-2017 <NAME> Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights ...
hummingbot/connector/exchange/bittrex/bittrex_utils.py
joedomino874/hummingbot
3,027
33185
<filename>hummingbot/connector/exchange/bittrex/bittrex_utils.py from hummingbot.client.config.config_var import ConfigVar from hummingbot.client.config.config_methods import using_exchange CENTRALIZED = True EXAMPLE_PAIR = "ZRX-ETH" DEFAULT_FEES = [0.25, 0.25] KEYS = { "bittrex_api_key": ConfigVar(key...
Algo and DSA/LeetCode-Solutions-master/Python/maximum-difference-between-node-and-ancestor.py
Sourav692/FAANG-Interview-Preparation
3,269
33235
<filename>Algo and DSA/LeetCode-Solutions-master/Python/maximum-difference-between-node-and-ancestor.py # Time: O(n) # Space: O(h) # Definition for a binary tree node. class TreeNode(object): def __init__(self, x): self.val = x self.left = None self.right = None # iterative stack solutio...
blogs/migrations/0012_auto_20200601_1247.py
daaawx/bearblog
657
33236
<reponame>daaawx/bearblog<filename>blogs/migrations/0012_auto_20200601_1247.py # Generated by Django 3.0.6 on 2020-06-01 12:47 from django.db import migrations, models class Migration(migrations.Migration): dependencies = [ ('blogs', '0011_auto_20200531_0915'), ] operations = [ migratio...
util/mach/mig.py
rovarma/crashpad
2,151
33239
#!/usr/bin/env python # coding: utf-8 # Copyright 2014 The Crashpad 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/LICEN...
marketplaces/cron_report_daily_activity.py
diassor/CollectorCity-Market-Place
135
33256
<gh_stars>100-1000 #!/usr/bin/env python # -*- coding: utf-8 -*- import os import logging import datetime os.environ['DJANGO_SETTINGS_MODULE'] = 'settings' from django.core.management import setup_environ from django.core.mail import send_mail #from django.db import transaction import settings setup_environ(settings...
utils/usergrid-util-python/usergrid_tools/general/queue_monitor.py
snoopdave/incubator-usergrid
788
33257
# */ # * Licensed to the Apache Software Foundation (ASF) under one # * or more contributor license agreements. See the NOTICE file # * distributed with this work for additional information # * regarding copyright ownership. The ASF licenses this file # * to you under the Apache License, Version 2.0 (the # * "License...
tests/transformer/test_assert.py
rahulbahal7/restricted-python
236
33269
<reponame>rahulbahal7/restricted-python from tests.helper import restricted_exec def test_RestrictingNodeTransformer__visit_Assert__1(): """It allows assert statements.""" restricted_exec('assert 1')
cli/src/pcluster/cli/middleware.py
enrico-usai/cfncluster
415
33328
# Copyright 2021 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.txt" file acc...
tests/test_losses/test_mesh_losses.py
nightfuryyy/mmpose
1,775
33331
# Copyright (c) OpenMMLab. All rights reserved. import pytest import torch from numpy.testing import assert_almost_equal from mmpose.models import build_loss from mmpose.models.utils.geometry import batch_rodrigues def test_mesh_loss(): """test mesh loss.""" loss_cfg = dict( type='MeshLoss', ...
terraform/stacks/threat-intelligence/lambdas/python/cloud-sniper-threat-intelligence/cloud_sniper_threat_intelligence.py
houey/cloud-sniper
160
33354
<gh_stars>100-1000 import boto3 import json import datetime import logging import os import ipaddress import requests log = logging.getLogger() log.setLevel(logging.INFO) QUEUE_URL = os.environ['SQS_QUEUE_CLOUD_SNIPER'] DYNAMO_TABLE = os.environ['DYNAMO_TABLE_CLOUD_SNIPER'] WEBHOOK_URL = os.environ['WEBHOOK_URL_CLOUD...
pymoo/util/ref_dirs/energy_layer.py
jarreguit/pymoo
762
33379
import autograd.numpy as anp import numpy as np from autograd import value_and_grad from pymoo.factory import normalize from pymoo.util.ref_dirs.energy import squared_dist from pymoo.util.ref_dirs.optimizer import Adam from pymoo.util.reference_direction import ReferenceDirectionFactory, scale_reference_directions c...
semseg/datasets/celebamaskhq.py
Genevievekim/semantic-segmentation-1
196
33406
import torch from torch import Tensor from torch.utils.data import Dataset from torchvision import io from pathlib import Path from typing import Tuple from torchvision import transforms as T class CelebAMaskHQ(Dataset): CLASSES = [ 'background', 'skin', 'nose', 'eye_g', 'l_eye', 'r_eye', 'l_brow', 'r_br...
bleach__examples__remove_tags__clear_html/escape_protocols.py
DazEB2/SimplePyScripts
117
33414
#!/usr/bin/env python3 # -*- coding: utf-8 -*- __author__ = 'ipetrash' # SOURCE: https://github.com/mozilla/bleach # SOURCE: https://bleach.readthedocs.io/en/latest/clean.html#allowed-protocols-protocols # pip install bleach import bleach # List of allowed protocols print('List of allowed protocols:', bleach.san...
mushroom_rl/utils/eligibility_trace.py
PuzeLiu/mushroom-rl
344
33422
<gh_stars>100-1000 from mushroom_rl.utils.table import Table def EligibilityTrace(shape, name='replacing'): """ Factory method to create an eligibility trace of the provided type. Args: shape (list): shape of the eligibility trace table; name (str, 'replacing'): type of the eligibility tr...
RaspberryPi/appMasterKey.py
colindembovsky/iot-central-firmware
136
33448
# Copyright (c) Microsoft. All rights reserved. # Licensed under the MIT license. import sys import iotc from iotc import IOTConnectType, IOTLogLevel from random import randint import base64 import hmac import hashlib gIsMicroPython = ('implementation' in dir(sys)) and ('name' in dir(sys.implementation)) and (sys.imp...
attic/operator/dispatch.py
matteoshen/example-code
5,651
33484
""" Experiments with infix operator dispatch >>> kadd = KnowsAdd() >>> kadd + 1 (<KnowsAdd object>, 1) >>> kadd * 1 """ class KnowsAdd: def __add__(self, other): return self, other def __repr__(self): return '<{} object>'.format(type(self).__name__)
utest/resources/robotdata/datagenerator.py
guojiajiaok/RIDE
775
33493
#!/usr/bin/env python # Copyright 2008-2015 Nokia Networks # Copyright 2016- Robot Framework Foundation # # 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...
sahara/service/edp/oozie/engine.py
ksshanam/sahara
161
33497
<gh_stars>100-1000 # Copyright (c) 2014 OpenStack Foundation # # 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 applicabl...
source/Tutorials/Actions/client_0.py
dsauval/ros2_documentation
291
33503
import rclpy from rclpy.action import ActionClient from rclpy.node import Node from action_tutorials_interfaces.action import Fibonacci class FibonacciActionClient(Node): def __init__(self): super().__init__('fibonacci_action_client') self._action_client = ActionClient(self, Fibonacci, 'fibonacc...
qcfractal/tests/test_server.py
MolSSI/dqm_server
113
33512
""" Tests the DQM Server class """ import json import os import threading import pytest import requests import qcfractal.interface as ptl from qcfractal import FractalServer, FractalSnowflake, FractalSnowflakeHandler from qcfractal.testing import ( await_true, find_open_port, pristine_loop, test_serv...
demo/python/horizon.py
ebraminio/astronomy-fork
138
33562
#!/usr/bin/env python3 # # horizon.py - by <NAME> - 2019-12-18 # # Example Python program for Astronomy Engine: # https://github.com/cosinekitty/astronomy # # This is a more advanced example. It shows how to use coordinate # transforms and a binary search to find the two azimuths where the # eclipti...
backup/socketbackend.py
bit0fun/plugins
173
33564
from collections import namedtuple import json, logging, socket, re, struct, time from typing import Tuple, Iterator from urllib.parse import urlparse, parse_qs from backend import Backend, Change from protocol import PacketType, recvall, PKT_CHANGE_TYPES, change_from_packet, packet_from_change, send_packet, recv_pack...
recipes/onedpl/all/conanfile.py
dvirtz/conan-center-index
562
33587
<gh_stars>100-1000 import os from conans import ConanFile, CMake, tools required_conan_version = ">=1.28.0" class OneDplConan(ConanFile): name = "onedpl" description = ("OneDPL (Formerly Parallel STL) is an implementation of " "the C++ standard library algorithms" "with ...
python/GafferTest/ExtensionAlgoTest.py
ddesmond/gaffer
561
33598
########################################################################## # # Copyright (c) 2019, <NAME>. All rights reserved. # # Redistribution and use in source and binary forms, with or without # modification, are permitted provided that the following conditions are # met: # # * Redistributions of source ...
kuwala/common/python_utils/src/time_utils.py
bmahmoudyan/kuwala
381
33602
import time from time import sleep def print_elapsed_time(exit_event): start_time = time.time() while True: if exit_event.is_set(): break print(f'Running for {round(time.time() - start_time)} s', end='\r') sleep(1)
test/priors/test_half_cauchy_prior.py
noamsgl/gpytorch
188
33611
#!/usr/bin/env python3 import unittest import torch from torch.distributions import HalfCauchy from gpytorch.priors import HalfCauchyPrior from gpytorch.test.utils import least_used_cuda_device class TestHalfCauchyPrior(unittest.TestCase): def test_half_cauchy_prior_to_gpu(self): if torch.cuda.is_avail...
Tools/decrypt_ulog.py
lgarciaos/Firmware
4,224
33612
#!/usr/bin/env python3 from Crypto.PublicKey import RSA from Crypto.Cipher import PKCS1_OAEP from Crypto.Cipher import ChaCha20 from Crypto.Hash import SHA256 import binascii import argparse #from pathlib import Path import sys if __name__ == "__main__": parser = argparse.ArgumentParser(description="""CLI tool t...
alipay/aop/api/domain/ArInvoiceReceiptQueryOpenApiDTO.py
antopen/alipay-sdk-python-all
213
33632
<gh_stars>100-1000 #!/usr/bin/env python # -*- coding: utf-8 -*- import json from alipay.aop.api.constant.ParamConstants import * from alipay.aop.api.domain.MultiCurrencyMoneyOpenApi import MultiCurrencyMoneyOpenApi from alipay.aop.api.domain.MultiCurrencyMoneyOpenApi import MultiCurrencyMoneyOpenApi from alipay.aop.a...
train_hg_seqnet.py
middleprince/fashionAi
316
33649
<filename>train_hg_seqnet.py # Copyright 2018 <NAME> # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # http://www.apache.org/licenses/LICENSE-2.0 # Unless required by applicable law or a...
tests/unit/utils/test_instantiate.py
schiotz/nequip
153
33658
import pytest import yaml from nequip.utils import instantiate simple_default = {"b": 1, "d": 31} class SimpleExample: def __init__(self, a, b=simple_default["b"], d=simple_default["d"]): self.a = a self.b = b self.d = d nested_default = {"d": 37} class NestedExample: def __init...
querybook/server/datasources_socketio/connect.py
shivammmmm/querybook
1,144
33664
<filename>querybook/server/datasources_socketio/connect.py from flask_login import current_user from flask_socketio import ConnectionRefusedError from app.flask_app import socketio from const.data_doc import DATA_DOC_NAMESPACE from const.query_execution import QUERY_EXECUTION_NAMESPACE def connect(): if not curr...
Chapter 12/ch12_r03.py
PacktPublishing/Modern-Python-Cookbook
107
33672
<gh_stars>100-1000 """ { "swagger": "2.0", "info": { "title": "Python Cookbook\\nChapter 12, recipe 3.", "version": "1.0" }, "schemes": "http", "host": "127.0.0.1:5000", "basePath": "/dealer", "consumes": "application/json", "produces": "application/json", "paths": { ...
thespian/test/__init__.py
dendron2000/Thespian
210
33704
"""Defines various classes and definitions that provide assistance for unit testing Actors in an ActorSystem.""" import unittest import pytest import logging import time from thespian.actors import ActorSystem def simpleActorTestLogging(): """This function returns a logging dictionary that can be passed as ...
alipay/aop/api/domain/AlipayUserApplepayMerchantauthtokenGetModel.py
antopen/alipay-sdk-python-all
213
33725
<reponame>antopen/alipay-sdk-python-all<gh_stars>100-1000 #!/usr/bin/env python # -*- coding: utf-8 -*- import json from alipay.aop.api.constant.ParamConstants import * from alipay.aop.api.domain.OpenApiAppleRequestHeader import OpenApiAppleRequestHeader class AlipayUserApplepayMerchantauthtokenGetModel(object): ...
test/hlt/pytest/python/com/huawei/iotplatform/client/dto/QueryDeviceCmdCancelTaskOutDTO.py
yuanyi-thu/AIOT-
128
33727
from com.huawei.iotplatform.client.dto.DeviceCommandCancelTaskRespV4 import DeviceCommandCancelTaskRespV4 from com.huawei.iotplatform.client.dto.Pagination import Pagination class QueryDeviceCmdCancelTaskOutDTO(object): pagination = Pagination() data = DeviceCommandCancelTaskRespV4() def __init__(self): ...
exec/tests/unit/runners/test_evaluators.py
AndersonReyes/klio
705
33735
<filename>exec/tests/unit/runners/test_evaluators.py # Copyright 2021 Spotify 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 r...
tests/components/geofency/__init__.py
domwillcode/home-assistant
30,023
33757
<filename>tests/components/geofency/__init__.py """Tests for the Geofency component."""
dialogue-engine/test/programytest/mappings/test_properties.py
cotobadesign/cotoba-agent-oss
104
33761
<reponame>cotobadesign/cotoba-agent-oss """ Copyright (c) 2020 COTOBA DESIGN, Inc. Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to u...
attic/concurrency/timer2.py
matteoshen/example-code
5,651
33778
<gh_stars>1000+ import asyncio import sys import contextlib @asyncio.coroutine def show_remaining(dots_task): remaining = 5 while remaining: print('Remaining: ', remaining) sys.stdout.flush() yield from asyncio.sleep(1) remaining -= 1 dots_task.cancel() print() @asyncio...
tests/i18n/patterns/urls/path_unused.py
webjunkie/django
790
33785
from django.conf.urls import url from django.conf.urls import patterns from django.views.generic import TemplateView view = TemplateView.as_view(template_name='dummy.html') urlpatterns = patterns('', url(r'^nl/foo/', view, name='not-translated'), )
backend/profiles/serializers.py
stevethompsonstar/django-react-blog
592
33786
from rest_framework import serializers from .models import Subscriber class SubscriberSerializer(serializers.ModelSerializer): class Meta: model = Subscriber fields = ( 'email', )
generate_imagery.py
AnthonyLapadula/pytorch-GANs
278
33795
import os import shutil import argparse import torch from torch import nn from torchvision.utils import save_image, make_grid import matplotlib.pyplot as plt import numpy as np import cv2 as cv import utils.utils as utils from utils.constants import * class GenerationMode(enum.Enum): SINGLE_IMAGE = 0, INT...
create_swag/lm/load_data.py
gauravkmr/swagaf
182
33813
<reponame>gauravkmr/swagaf<gh_stars>100-1000 # First make the vocabulary, etc. import os import pickle as pkl import random import simplejson as json from allennlp.common.util import get_spacy_model from allennlp.data import Instance from allennlp.data import Token from allennlp.data import Vocabulary from allennlp.d...
sound_play/scripts/test/test_sound_client.py
iory/audio_common
742
33819
<filename>sound_play/scripts/test/test_sound_client.py #!/usr/bin/env python import unittest import rospy import rostest from sound_play.libsoundplay import SoundClient class TestCase(unittest.TestCase): def test_soundclient_constructor(self): s = SoundClient() self.assertIsNotNone(s) if __name_...
rdkit/DataStructs/UnitTestBitEnsemble.py
kazuyaujihara/rdkit
1,609
33837
<gh_stars>1000+ # $Id$ # # Copyright (C) 2003-2006 <NAME> and Rational Discovery LLC # # @@ All Rights Reserved @@ # This file is part of the RDKit. # The contents are covered by the terms of the BSD license # which is included in the file license.txt, found at the root # of the RDKit source tree. # """ unit test...
survae/tests/transforms/bijections/conditional/coupling/coupling_mixtures.py
alisiahkoohi/survae_flows
262
33857
<filename>survae/tests/transforms/bijections/conditional/coupling/coupling_mixtures.py import numpy as np import torch import torch.nn as nn import torchtestcase import unittest from survae.transforms.bijections.conditional.coupling import * from survae.nn.layers import ElementwiseParams, ElementwiseParams2d, scale_fn ...
utils/generate-sha256.py
dskrvk/anteater
177
33869
############################################################################## # Copyright (c) 2017 <NAME> <<EMAIL>>, Red Hat # # All rights reserved. This program and the accompanying materials # are made available under the terms of the Apache License, Version 2.0 # which accompanies this distribution, and is availab...
cli4/__main__.py
pygrigori/python-cloudflare
465
33875
#!/usr/bin/env python """Cloudflare API via command line""" from __future__ import absolute_import import sys from .cli4 import cli4 def main(args=None): """Cloudflare API via command line""" if args is None: args = sys.argv[1:] cli4(args) if __name__ == '__main__': main()
uq360/algorithms/blackbox_metamodel/metamodel_regression.py
Sclare87/UQ360
148
33877
import inspect from collections import namedtuple import numpy as np from sklearn.ensemble import GradientBoostingRegressor from sklearn.model_selection import train_test_split from sklearn.exceptions import NotFittedError from uq360.algorithms.posthocuq import PostHocUQ class MetamodelRegression(PostHocUQ): """...
es_sink/es_sink/flushing_buffer.py
avmi/community
305
33884
<reponame>avmi/community<gh_stars>100-1000 ''' Copyright 2020, Amazon Web Services Inc. This code is licensed under MIT license (see LICENSE.txt for details) Python 3 Provides a buffer object that holds log lines in Elasticsearch _bulk format. As each line is added, the buffer stores the control line as well as the l...
matchzoo/utils/early_stopping.py
ChrisRBXiong/MatchZoo-py
468
33888
<gh_stars>100-1000 """Early stopping.""" import typing import torch import numpy as np class EarlyStopping: """ EarlyStopping stops training if no improvement after a given patience. :param patience: Number fo events to wait if no improvement and then stop the training. :param should_decrea...
moderngl_window/timers/base.py
DavideRuzza/moderngl-window
142
33900
from typing import Tuple class BaseTimer: """ A timer controls the time passed into the the render function. This can be used in creative ways to control the current time such as basing it on current location in an audio file. All methods must be implemented. """ @property ...
alipay/aop/api/domain/AlipayOverseasRemitFundInitializeModel.py
antopen/alipay-sdk-python-all
213
33904
#!/usr/bin/env python # -*- coding: utf-8 -*- import json from alipay.aop.api.constant.ParamConstants import * class AlipayOverseasRemitFundInitializeModel(object): def __init__(self): self._bc_remit_id = None self._compliance_mid = None self._extend_info = None self._quote_route...
problems/41/problem_41.py
r1cc4rdo/daily_coding_problem
158
33920
def coding_problem_41(flights_db, starting_airport): """ Given an unordered list of flights taken by someone, each represented as (origin, destination) pairs, and a starting airport, compute the person's itinerary. If no such itinerary exists, return null. If there are multiple possible itineraries, ret...
paddlepalm/reader/match.py
baajur/PALM
136
33922
<filename>paddlepalm/reader/match.py # -*- coding: UTF-8 -*- # Copyright (c) 2019 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://w...
tfx/tools/cli/commands/pipeline.py
avelez93/tfx
1,813
33962
<filename>tfx/tools/cli/commands/pipeline.py # Copyright 2019 Google LLC. 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...
alipay/aop/api/domain/ReduceInfo.py
snowxmas/alipay-sdk-python-all
213
33975
<gh_stars>100-1000 #!/usr/bin/env python # -*- coding: utf-8 -*- import json from alipay.aop.api.constant.ParamConstants import * class ReduceInfo(object): def __init__(self): self._brand_name = None self._consume_amt = None self._consume_store_name = None self._payment_time = No...
tests/scripts/negative_linenumber_offsets.py
andyfcx/py-spy
8,112
33979
import time def f(): [ # Must be split over multiple lines to see the error. # https://github.com/benfred/py-spy/pull/208 time.sleep(1) for _ in range(1000) ] f()
starfish/core/imagestack/parser/crop.py
haoxusci/starfish
164
33980
<filename>starfish/core/imagestack/parser/crop.py<gh_stars>100-1000 from collections import OrderedDict from typing import Collection, List, Mapping, MutableSequence, Optional, Set, Tuple, Union import numpy as np from slicedimage import Tile, TileSet from starfish.core.imagestack.parser import TileCollectionData, Ti...
mpc_ros/script/teleop_keyboard.py
NaokiTakahashi12/mpc_ros
335
33981
#!/usr/bin/python # This is a modified verison of turtlebot_teleop.py # to fullfill the needs of HyphaROS MiniCar use case # Copyright (c) 2018, HyphaROS Workshop # # The original license info are as below: # Copyright (c) 2011, <NAME>, Inc. # All rights reserved. # # Redistribution and use in source and binary forms...
etl/parsers/etw/Microsoft_Windows_UAC_FileVirtualization.py
IMULMUL/etl-parser
104
33984
# -*- coding: utf-8 -*- """ Microsoft-Windows-UAC-FileVirtualization GUID : c02afc2b-e24e-4449-ad76-bcc2c2575ead """ 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 S...
simple/game_loop_process.py
loyalgarlic/snakepit-game
124
34007
import asyncio from aiohttp import web from concurrent.futures import ThreadPoolExecutor, ProcessPoolExecutor from multiprocessing import Queue, Process import os from time import sleep async def handle(request): index = open("index.html", 'rb') content = index.read() return web.Response(body=content, co...
python/eggroll/core/datastructure/__init__.py
liszekei/eggroll
209
34016
<gh_stars>100-1000 # Copyright (c) 2019 - now, Eggroll 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 # ...
lib/dataset/utils.py
decisionforce/mmTransformer
199
34057
<reponame>decisionforce/mmTransformer<filename>lib/dataset/utils.py import math import numpy as np from sklearn.linear_model import LinearRegression def get_heading_angle(traj: np.ndarray): """ get the heading angle traj: [N,2] N>=6 """ # length == 6 # sort position _traj = traj.c...
corehq/apps/translations/integrations/transifex/project_migrator.py
dimagilg/commcare-hq
471
34079
<filename>corehq/apps/translations/integrations/transifex/project_migrator.py<gh_stars>100-1000 import copy import datetime import tempfile from collections import OrderedDict from django.utils.functional import cached_property from django.utils.translation import ugettext as _ import polib from memoized import memoi...
notebook/str_compare_re.py
vhn0912/python-snippets
174
34101
<filename>notebook/str_compare_re.py import re s = 'aaa-AAA-123' print(re.search('aaa', s)) # <re.Match object; span=(0, 3), match='aaa'> print(re.search('xxx', s)) # None print(re.search('^aaa', s)) # <re.Match object; span=(0, 3), match='aaa'> print(re.search('^123', s)) # None print(re.search('aaa$', s)) # Non...
model-optimizer/unit_tests/extensions/ops/sparse_reshape_test.py
monroid/openvino
2,406
34110
<reponame>monroid/openvino # Copyright (C) 2018-2021 Intel Corporation # SPDX-License-Identifier: Apache-2.0 import unittest import numpy as np from extensions.ops.sparse_reshape import SparseReshape from mo.front.common.partial_infer.utils import int64_array from mo.graph.graph import Node from unit_tests.utils.gra...
scripts/get_article.py
theblueskies/prose
2,906
34135
<reponame>theblueskies/prose import os from newspaper import Article url = 'http://fox13now.com/2013/12/30/new-year-new-laws-obamacare-pot-guns-and-drones/' article = Article(url) article.download() article.parse() with open(os.path.join('testdata', 'article.txt'), 'w') as f: f.write(article.text)
test/test_server.py
gndu91/wsproto
179
34146
<gh_stars>100-1000 from typing import cast, List, Optional, Tuple import h11 import pytest from wsproto import WSConnection from wsproto.connection import SERVER from wsproto.events import ( AcceptConnection, Event, RejectConnection, RejectData, Request, ) from wsproto.extensions import Extension ...
toolchain/riscv/MSYS/python/Lib/test/encoded_modules/__init__.py
zhiqiang-hu/bl_iot_sdk
207
34160
# -*- encoding: utf-8 -*- # This is a package that contains a number of modules that are used to # test import from the source files that have different encodings. # This file (the __init__ module of the package), is encoded in utf-8 # and contains a list of strings from various unicode planes that are # encoded...
python/ambassador/compile.py
Asher-Wang/ambassador
3,438
34168
<reponame>Asher-Wang/ambassador<filename>python/ambassador/compile.py # Copyright 2020 Datawire. 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...
examples/color4.py
yang69can/pyngl
125
34174
# # File: # color4.py # # Synopsis: # Draws sixteen sample color boxs with RGB labels. # # Category: # Colors # # Author: # <NAME> # # Date of initial publication: # January, 2006 # # Description: # This example draws sixteen color boxes using the RGB # values for named colors. The boxes are...
tools/code_coverage/package/oss/cov_json.py
deltabravozulu/pytorch
206
34193
<reponame>deltabravozulu/pytorch<filename>tools/code_coverage/package/oss/cov_json.py from ..tool import clang_coverage from ..util.setting import CompilerType, Option, TestList, TestPlatform from ..util.utils import check_compiler_type from .init import detect_compiler_type from .run import clang_run, gcc_run def ge...
src/visualize/visualize_checkpoint.py
Immocat/ACTOR
164
34214
<reponame>Immocat/ACTOR import os import matplotlib.pyplot as plt import torch from src.utils.get_model_and_data import get_model_and_data from src.parser.visualize import parser from .visualize import viz_epoch import src.utils.fixseed # noqa plt.switch_backend('agg') def main(): # parse options paramete...
src/newt/db/_ook.py
bmjjr/db
153
34221
import relstorage.storage import ZODB.Connection # Monkey patches, ook def _ex_cursor(self, name=None): if self._stale_error is not None: raise self._stale_error with self._lock: self._before_load() return self._load_conn.cursor(name) relstorage.storage.RelStorage.ex_cursor = _ex_curs...
stream/migrations/0001_init_models.py
freejooo/vigilio
137
34233
<filename>stream/migrations/0001_init_models.py # Generated by Django 3.1.5 on 2021-03-17 21:30 from django.conf import settings from django.db import migrations, models import django.db.models.deletion class Migration(migrations.Migration): initial = True dependencies = [ migrations.swappable_depe...
Javatar.py
evandrocoan/Javatar
142
34247
<reponame>evandrocoan/Javatar from .commands import * from .core.event_handler import * from .utils import ( Constant ) def plugin_loaded(): Constant.startup()
General Questions/Longest_Common_Prefix.py
siddhi-244/CompetitiveProgrammingQuestionBank
931
34254
#Longest Common Prefix in python #Implementation of python program to find the longest common prefix amongst the given list of strings. #If there is no common prefix then returning 0. #define the function to evaluate the longest common prefix def longestCommonPrefix(s): p = '' #declare an empty s...
netbox/extras/migrations/0061_extras_change_logging.py
TheFlyingCorpse/netbox
4,994
34256
from django.db import migrations, models class Migration(migrations.Migration): dependencies = [ ('extras', '0060_customlink_button_class'), ] operations = [ migrations.AddField( model_name='customfield', name='created', field=models.DateField(auto_now...
testing/examples/import_error.py
dry-python/dependencies
175
34270
from astral import Vision # noqa: F401
nydus/db/base.py
Elec/nydus
102
34282
<reponame>Elec/nydus<gh_stars>100-1000 """ nydus.db.base ~~~~~~~~~~~~~ :copyright: (c) 2011-2012 DISQUS. :license: Apache License 2.0, see LICENSE for more details. """ __all__ = ('LazyConnectionHandler', 'BaseCluster') import collections from nydus.db.map import DistributedContextManager from nydus.db.routers impor...
sprocket/util/extfrm.py
zhouming-hfut/sprocket
500
34290
<reponame>zhouming-hfut/sprocket<gh_stars>100-1000 # -*- coding: utf-8 -*- from __future__ import division, print_function, absolute_import import numpy as np def extfrm(data, npow, power_threshold=-20): """Extract frame over the power threshold Parameters ---------- data: array, shape (`T`, `dim`)...
rj_gameplay/stp/coordinator.py
RoboJackets/robocup-software
200
34321
<gh_stars>100-1000 """This module contains the implementation of the coordinator.""" from typing import Any, Dict, Optional, Type, List, Callable import stp.play import stp.rc as rc import stp.role.assignment as assignment import stp.situation import stp.skill from rj_msgs import msg NUM_ROBOTS = 16 class Coordinat...