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
mc-sema/protobuf-2.5.0/python/google/protobuf/internal/test_util.py
randolphwong/mcsema
252
11073043
<gh_stars>100-1000 # Protocol Buffers - Google's data interchange format # Copyright 2008 Google Inc. All rights reserved. # http://code.google.com/p/protobuf/ # # Redistribution and use in source and binary forms, with or without # modification, are permitted provided that the following conditions are # met: # # ...
examples/example.py
RonenTRA/faster-than-requests
857
11073057
<reponame>RonenTRA/faster-than-requests import faster_than_requests as requests requests.init_client() print(requests.get("http://httpbin.org/get")) # HTTP GET. print(requests.post("http://httpbin.org/post", """{"foo": "bar", "baz": true}""")) # HTTP POST. print(requests.put("http://httpbin.org/pu...
learn2learn-master/learn2learn/nn/misc.py
hikmatkhan/Higher
1,774
11073063
<filename>learn2learn-master/learn2learn/nn/misc.py #!/usr/bin/env python3 import torch class Lambda(torch.nn.Module): """ [[Source]](https://github.com/learnables/learn2learn/blob/master/learn2learn/nn/misc.py) **Description** Utility class to create a wrapper based on a lambda function. **Ar...
tests/python/relay/test_pass_partial_eval.py
shengxinhu/tvm
4,640
11073123
<reponame>shengxinhu/tvm<filename>tests/python/relay/test_pass_partial_eval.py # 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 ...
tests/components/mqtt/test_light_template.py
learn-home-automation/core
22,481
11073137
"""The tests for the MQTT Template light platform. Configuration example with all features: light: platform: mqtt_template name: mqtt_template_light_1 state_topic: 'home/rgb1' command_topic: 'home/rgb1/set' command_on_template: > on,{{ brightness|d }},{{ red|d }}-{{ green|d }}-{{ blue|d }} command_off...
koku/koku/test_presto_delete_wrapper_trigger.py
cgoodfred/koku
157
11073139
import uuid from datetime import datetime from django.db import connection as conn from pytz import UTC from . import database as kdb from api.iam.test.iam_test_case import IamTestCase class TestPrestoDeleteLogTrigger(IamTestCase): def test_presto_delete_log_table_exists(self): """ Ensure that t...
paginator.py
Rongaming7777/PoketwoAuto
183
11073146
<filename>paginator.py import asyncio import discord class Paginator: def __init__(self, message, base, embeds, obj): self.message = message self.base = base self.pointers = ['👈','👉','❌'] self.embeds = embeds self.cursor = 0 self.obj = obj async def _add_handl...
pyalgotrade/barfeed/dbfeed.py
cdyfng/pyalgotrade
1,000
11073152
# PyAlgoTrade # # Copyright 2011-2015 <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 agreed t...
tests/routing/test_Routables.py
paradiseng/jasmin
750
11073177
from datetime import datetime from twisted.trial.unittest import TestCase from jasmin.routing.Routables import (SimpleRoutablePDU, RoutableSubmitSm, RoutableDeliverSm, InvalidRoutableParameterError, InvalidTagError, TagNotFoundError, ...
Algo and DSA/LeetCode-Solutions-master/Python/number-of-ways-to-split-a-string.py
Sourav692/FAANG-Interview-Preparation
3,269
11073183
# Time: O(n) # Space: O(1) class Solution(object): def numWays(self, s): """ :type s: str :rtype: int """ MOD = 10**9+7 ones = s.count('1') if ones % 3: return 0 ones //= 3 if ones == 0: return (len(s)-1)*(len(s)-2)//...
Python/cointoss.py
kennethsequeira/Hello-world
1,428
11073194
from bokeh.plotting import figure, output_file, show import random import math initial_invesment = 100 y = [] for oo in range(0, 365): if random.randint(0,1) % 2 == 0: initial_invesment = initial_invesment + 0.5 y.append(initial_invesment) else: initial_invesment = initial_invesment -...
src/borg/crypto/nonces.py
alfredo08154711/borg
8,680
11073205
<reponame>alfredo08154711/borg<gh_stars>1000+ import os import sys from binascii import unhexlify from ..helpers import get_security_dir from ..helpers import bin_to_hex from ..platform import SaveFile from ..remote import InvalidRPCMethod from .low_level import bytes_to_long, long_to_bytes MAX_REPRESENTABLE_NONCE =...
packages/markdown-link-classes/setup.py
nicoleiocana/lektor-website
184
11073228
<filename>packages/markdown-link-classes/setup.py from setuptools import setup setup( name='lektor-markdown-link-classes', version='0.1', author='<NAME>', author_email='<EMAIL>', license='MIT', py_modules=['lektor_markdown_link_classes'], url='http://github.com/lektor/lektor', entry_poi...
libs/box_utils/iou.py
rickyHong/NAS_FPN_repl
224
11073270
# -*- coding: utf-8 -*- from __future__ import absolute_import from __future__ import division from __future__ import print_function import tensorflow as tf import numpy as np def iou_calculate(boxes_1, boxes_2): with tf.name_scope('iou_caculate'): xmin_1, ymin_1, xmax_1, ymax_1 = boxes_...
river/checks/reco.py
michaelchiucw/river
2,184
11073278
<gh_stars>1000+ import random def check_reco_routine(recommender): users = ["Tom", "Anna"] items = {"politics", "sports", "music", "food", "finance", "health", "camping"} def get_reward(user, item) -> bool: if user == "Tom": return item in {"music", "politics"} if user == "An...
jesse/indicators/ift_rsi.py
slipperlobster/flipper
3,999
11073287
from typing import Union import talib import numpy as np from jesse.helpers import get_candle_source, slice_candles, same_length def ift_rsi(candles: np.ndarray, rsi_period: int = 5, wma_period: int =9, source_type: str = "close", sequential: bool = False) -> Union[ float, np.ndarray]: """ Modified Inve...
examples/plot_model_selection1.py
time-series-tools/seglearn
509
11073299
""" ========================== Hyperparameter Selection 1 ========================== This example demonstrates how to do model selection in a feature representation pipeline using a grid search """ # Author: <NAME> # License: BSD import matplotlib.pyplot as plt import numpy as np from sklearn.ensemble import RandomF...
tests/samplers_tests/tpe_tests/test_multi_objective_sampler.py
knshnb/optuna
1,300
11073306
<reponame>knshnb/optuna<gh_stars>1000+ import itertools import random from typing import Callable from typing import Dict from typing import List from typing import Optional from typing import Tuple from typing import Union from unittest.mock import patch from unittest.mock import PropertyMock import numpy as np impor...
nglview/stage.py
tovrstra/nglview
161
11073321
from .utils.py_utils import _camelize_dict class Stage: """ Try to mimic NGL.Stage """ def __init__(self, view): self._view = view def set_parameters(self, **kwargs): self._view._remote_call('setParameters', target='Stage', ...
pyproj/crs/__init__.py
psydox/pyproj
467
11073340
""" This module interfaces with PROJ to produce a pythonic interface to the coordinate reference system (CRS) information through the CRS class. """ from pyproj._crs import ( # noqa: F401 pylint: disable=unused-import CoordinateOperation, CoordinateSystem, Datum, Ellipsoid, PrimeMeridian, is_...
rotypes/Windows/Graphics/Imaging/__init__.py
Sait0Yuuki/ArknightsAutoHelper
1,035
11073349
<reponame>Sait0Yuuki/ArknightsAutoHelper from ctypes import c_int, c_int32 from rotypes.Windows.Foundation import IClosable from rotypes.inspectable import IInspectable from rotypes.idldsl import define_winrt_com_method, _static_method, runtimeclass import rotypes.Windows.Storage.Streams class ISoftwareBitmap(IClosa...
plaso/cli/helpers/output_modules.py
pyllyukko/plaso
1,253
11073372
<gh_stars>1000+ # -*- coding: utf-8 -*- """The output modules CLI arguments helper.""" import sys from plaso.cli import tools from plaso.cli.helpers import interface from plaso.cli.helpers import manager from plaso.lib import errors from plaso.output import manager as output_manager class OutputModulesArgumentsHelp...
paasta_tools/cli/cmds/validate.py
sobolevn/paasta
1,711
11073375
<reponame>sobolevn/paasta<filename>paasta_tools/cli/cmds/validate.py<gh_stars>1000+ #!/usr/bin/env python # Copyright 2015-2016 Yelp Inc. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # ...
ci/scripts/python/nrf5_cmake/library_operations.py
perfectco/cmake-nRF5x
111
11073390
from __future__ import annotations import json from unittest import TestCase from nrf5_cmake.library import Library, LibraryProperty, Property from nrf5_cmake.library_description import LibraryDescription, LibraryVariant, LibraryPatch, LibraryOperation, LibraryVersion from nrf5_cmake.version import Version from typin...
fhirclient/server_tests.py
carolinarsm/client-py
418
11073398
# -*- coding: utf-8 -*- import os import io import json import shutil import server import unittest import models.fhirabstractbase as fabst class TestServer(unittest.TestCase): def tearDown(self): if os.path.exists('metadata'): os.remove('metadata') def testValidCapabilityState...
web/py-collaborator/Database.py
H1d3r/Penetration-Testing-Tools-1
1,139
11073406
#!/usr/bin/python3 import pymysql import pymysql.cursors import pymysql.converters from Logger import * import datetime DATABASE_LOGGING = False class Logger: @staticmethod def _out(x): if DATABASE_LOGGING: sys.stderr.write(str(x) + u'\n') @staticmethod def dbg(x): if DA...
sourced/ml/tests/tfidf_data.py
vmarkovtsev/ml
122
11073464
from pyspark import Row def readonly(_dict: dict): return frozenset(_dict.items()) dataset = [ {"d": "1", "t": "1", "v": 3}, {"d": "1", "t": "2", "v": 2}, {"d": "1", "t": "3", "v": 1}, {"d": "2", "t": "1", "v": 4}, {"d": "2", "t": "2", "v": 5}, {"d": "3", "t": "1", "v": 6}, {"d": "4"...
caffe-grid/src/main/python/com/yahoo/ml/caffe/ReflectionUtil.py
jenniew/IntelCaffeOnSpark_mirror
1,436
11073482
''' Copyright 2016 Yahoo Inc. Licensed under the terms of the Apache 2.0 license. Please see LICENSE file in the project root for terms. This module contains various routines involving Java's class objects for convenience. ''' import string ''' There is a distinction between py4j's "Java Classes" and Java's "Class O...
src/cryptography/hazmat/primitives/keywrap.py
gorgiaxx/cryptography
4,492
11073488
<gh_stars>1000+ # This file is dual licensed under the terms of the Apache License, Version # 2.0, and the BSD License. See the LICENSE file in the root of this repository # for complete details. import struct import typing from cryptography.hazmat.primitives.ciphers import Cipher from cryptography.hazmat.primitives...
tests/pup/motors/busy.py
NStrijbosch/pybricks-micropython
115
11073489
# SPDX-License-Identifier: MIT # Copyright (c) 2020 The Pybricks Authors """ Hardware Module: 1 Description: Checks that EBUSY is raised when changing settings while holding. """ from pybricks.pupdevices import Motor from pybricks.parameters import Port from uerrno import EBUSY # Initialize the motor. motor = Motor...
InvenTree/company/migrations/0020_auto_20200413_0839.py
ArakniD/InvenTree
656
11073536
<reponame>ArakniD/InvenTree<gh_stars>100-1000 # Generated by Django 2.2.10 on 2020-04-13 08:39 from django.db import migrations, models import django.db.models.deletion class Migration(migrations.Migration): dependencies = [ ('company', '0019_auto_20200413_0642'), ] operations = [ migra...
alex/applications/wsrouter/run.py
cifkao/alex
184
11073559
if __name__ == '__main__': import autopath from wsrouter import WSRouter def main(addr, port, entry_timeout): router = WSRouter(addr, port, entry_timeout) router.run() if __name__ == '__main__': import argparse parser = argparse.ArgumentParser() parser.add_argument('addr') parser.add_a...
lib/models/simple_convnet.py
unluckydan/deep_metric_learning
169
11073560
<filename>lib/models/simple_convnet.py # -*- coding: utf-8 -*- """ Created on Fri Apr 21 19:44:37 2017 @author: sakurai """ import chainer import chainer.functions as F import chainer.links as L class SimpleConvnet(chainer.Chain): def __init__(self, out_dim): super(SimpleConvnet, self).__init__( ...
scripts/worker.py
varshar16/teuthology
117
11073562
import argparse import teuthology.worker def main(): teuthology.worker.main(parse_args()) def parse_args(): parser = argparse.ArgumentParser(description=""" Grab jobs from a beanstalk queue and run the teuthology tests they describe. One job is run at a time. """) parser.add_argument( '-v', '--...
tests/modules/span_extractors/endpoint_span_extractor_test.py
MSLars/allennlp
11,433
11073568
import numpy import torch from allennlp.modules.span_extractors import SpanExtractor, EndpointSpanExtractor from allennlp.common.params import Params from allennlp.nn.util import batched_index_select class TestEndpointSpanExtractor: def test_endpoint_span_extractor_can_build_from_params(self): params = P...
models/nndistance/functions/nnd.py
GuillaumeDufau/3D-point-capsule-networks
283
11073603
# functions/add.py import torch from torch.autograd import Function #from _ext import my_lib import my_lib_cuda as my_lib class NNDFunction(Function): def forward(self, xyz1, xyz2): batchsize, n, _ = xyz1.size() _, m, _ = xyz2.size() # self.xyz1 = xyz1[...] # self.xyz2 = ...
airsenal/__init__.py
Abelarm/AIrsenal
144
11073607
<reponame>Abelarm/AIrsenal """ ___init__.py for airsenal """ import os import tempfile # AIrsenal package version. __version__ = "1.2.0" # Cross-platform temporary directory TMPDIR = "/tmp/" if os.name == "posix" else tempfile.gettempdir()
torchsat_imc/models/utils.py
Exdenta/torchsat
316
11073615
from .classification.vgg import vgg11, vgg11_bn, vgg13, vgg13_bn, vgg16, vgg16_bn, vgg19_bn, vgg19 from .classification.resnet import resnet18, resnet34, resnet50, resnet101, resnet152, resnext50_32x4d, resnext101_32x8d, wide_resnet50_2, wide_resnet101_2 from .classification.densenet import densenet121, densenet169, d...
app/tornado_handlers/browse.py
magate/flight_review
128
11073640
<reponame>magate/flight_review<filename>app/tornado_handlers/browse.py """ Tornado handler for the browse page """ from __future__ import print_function import collections import sys import os from datetime import datetime import json import sqlite3 import tornado.web # this is needed for the following imports sys.pat...
tos/lib/ppp/tests/Lcp/test-startup.py
mtaghiza/tinyos-main-1
1,053
11073649
<filename>tos/lib/ppp/tests/Lcp/test-startup.py import surf import sys import binascii import struct import ppp4py.hdlc import ppp4py.protocol.base surf = surf.Device() framer = ppp4py.hdlc.HDLCforPPP() pppd = ppp4py.PPP(framer=framer) import pppprint pppprint.PppPrintProtocol(pppd) lcp = pppd._lcp lcp._configureReq...
src/ui/LPC_uidef.py
ufo2011/NXP-MCUBootUtility
174
11073652
<filename>src/ui/LPC_uidef.py import wx import sys, os kConnectStep_Normal = 1 kBootDevice_InternalNor = 'On-chip NOR' #'C040HD NOR' kBootDevice_QuadspiNor = 'QUADSPI NOR' kBootDevice_v3_0_0 = [kBootDevice_InternalNor] kBootDevice_Latest = kBootDevice_v3_0_0 kSecureBootType_PlainUnsigned = 'Plain Unsi...
dash/_callback.py
emilhe/dash
17,143
11073692
import collections from functools import wraps from .dependencies import ( handle_callback_args, handle_grouped_callback_args, Output, ) from .exceptions import PreventUpdate from ._grouping import ( flatten_grouping, make_grouping_by_index, grouping_len, ) from ._utils import ( create_cal...
vega/trainer/trainer_ms.py
This-50m/vega
724
11073708
# -*- coding: utf-8 -*- # Copyright (C) 2020. Huawei Technologies Co., Ltd. All rights reserved. # This program is free software; you can redistribute it and/or modify # it under the terms of the MIT License. # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the...
modules/webshells/wso.py
decidedlygray/ptf
4,391
11073714
<reponame>decidedlygray/ptf<gh_stars>1000+ #!/usr/bin/env python ##################################### # Installation module for WSO webshell from a backup source. ##################################### # AUTHOR OF MODULE NAME AUTHOR="<NAME> (Josexv1)" # DESCRIPTION OF THE MODULE DESCRIPTION="This module will install/...
WebMirror/management/rss_parser_funcs/feed_parse_extractSubudai11.py
fake-name/ReadableWebProxy
193
11073728
def extractSubudai11(item): """ """ vol, chp, frag, postfix = extractVolChapterFragmentPostfix(item['title']) if not (chp or vol) or 'preview' in item['title'].lower(): return None if 'Mai Kitsune Waifu Chapter' in item['title']: return buildReleaseMessageWithType(item, 'My Fox Immortal Wife', vol, chp, frag=...
databuilder/databuilder/models/schema/schema.py
jdavidheiser/amundsen
139
11073732
<reponame>jdavidheiser/amundsen<filename>databuilder/databuilder/models/schema/schema.py # Copyright Contributors to the Amundsen project. # SPDX-License-Identifier: Apache-2.0 import re from typing import ( Any, Iterator, Union, ) from amundsen_rds.models import RDSModel from amundsen_rds.models.schema import ( ...
tests/unit/domain/test_helpers.py
expobrain/import-linter
171
11073760
<reponame>expobrain/import-linter<gh_stars>100-1000 import re from typing import Dict, List, Union, cast import pytest from grimp.adaptors.graph import ImportGraph # type: ignore from importlinter.domain.helpers import ( MissingImport, add_imports, import_expressions_to_imports, pop_import_expression...
romp/exports/convert_fbx.py
Saafke/ROMP
385
11073771
<gh_stars>100-1000 # -*- coding: utf-8 -*- # Max-Planck-Gesellschaft zur Förderung der Wissenschaften e.V. (MPG) is # holder of all proprietary rights on this computer program. # You can only use this computer program if you have closed # a license agreement with MPG or you get the right to use the computer # program ...
doubanfm/API/netease_api.py
fakegit/douban.fm
783
11073775
#!/usr/bin/env python2 # -*- coding: utf-8 -*- """ 网易云音乐API 根据歌名提供320k音乐url地址 reference: https://github.com/yanunon/NeteaseCloudMusic/wiki/%E7%BD%91%E6%98%93%E4%BA%91%E9%9F%B3%E4%B9%90API%E5%88%86%E6%9E%90 TODO: 有可能歌曲匹配不准确 """ from __future__ import print_function import requests import json import hashlib import logg...
scripts/sentiment/process_arguana_xml.py
de9uch1/stanza
3,633
11073800
<reponame>de9uch1/stanza<gh_stars>1000+ from collections import namedtuple import glob import os import sys import tempfile import xml.etree.ElementTree as ET Fragment = namedtuple('Fragment', ['begin', 'end', 'rating']) """ Extracts positive, neutral, and negative phrases from the ArguAna hotel review corpus Run as...
test/wdt_port_block_test.py
davide125/wdt
2,894
11073809
#!/usr/bin/env python3 import re import subprocess import time from threading import Thread from common_utils import * # Todo: refactor using more of common_utils receiver_end_time = 0 receiver_status = 0 def wait_for_receiver_finish(receiver_process): global receiver_end_time global receiver_status re...
docarray/array/mixins/evaluation.py
fastflair/docarray
591
11073819
<filename>docarray/array/mixins/evaluation.py import warnings from typing import Optional, Union, TYPE_CHECKING, Callable import numpy as np from ...score import NamedScore if TYPE_CHECKING: from ... import Document, DocumentArray class EvaluationMixin: """A mixin that provides ranking evaluation functiona...
etl/parsers/etw/Microsoft_Windows_Security_Audit_Configuration_Client.py
IMULMUL/etl-parser
104
11073831
# -*- coding: utf-8 -*- """ Microsoft-Windows-Security-Audit-Configuration-Client GUID : 08466062-aed4-4834-8b04-cddb414504e5 """ 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....
setup.py
rmallof/pysymemu
271
11073860
<gh_stars>100-1000 import os from setuptools import setup def read(fname): return open(os.path.join(os.path.dirname(__file__), fname)).read() setup( name = "pysymemu", version = "0.0.1-alpha", author = "<NAME>", author_email = "<EMAIL>", description = ("A tool for symbolic execution of Intel 6...
dev_test_cex_subscribe.py
hth945/unicorn-binance-websocket-api
404
11073900
<gh_stars>100-1000 #!/usr/bin/env python3 # -*- coding: utf-8 -*- # # File: dev_test_cex_subscribe.py # # Part of ‘UNICORN Binance WebSocket API’ # Project website: https://github.com/oliver-zehentleitner/unicorn-binance-websocket-api # Documentation: https://oliver-zehentleitner.github.io/unicorn-binance-websocket-api...
Algorithms/Search_Algorithms/Binary_Search/Rotated-Sorted-Array-Search.py
arslantalib3/algo_ds_101
182
11073902
<gh_stars>100-1000 def pivotedBinarySearch(arr, n, key): pivot = findPivot(arr, 0, n-1); # If we didn't find a pivot, # then array is not rotated at all if pivot == -1: return binarySearch(arr, 0, n-1, key); # If we found a pivot, then first # compare with pivot and then # search...
deepsnap/graph.py
ruth-ann/deepsnap
412
11073910
import re import types import random import copy import math import pdb import numpy as np import torch from torch_geometric.utils import to_undirected from typing import ( Dict, List, Union ) import warnings import deepsnap class Graph(object): r""" A plain python object modeling a single graph w...
python/floor-ceil-and-rint.py
gajubadge11/HackerRank-1
340
11073916
<reponame>gajubadge11/HackerRank-1 import numpy as np array = np.array(list(input().strip().split()), dtype = float) print(np.floor(array)) print(np.ceil(array)) print(np.rint(array))
tests/test_utils.py
gaurav17467/free-python-games
2,478
11073929
<filename>tests/test_utils.py from pytest import raises import freegames.utils as utils def test_change_after_hash(): v = utils.vector(0, 0) hash(v) with raises(ValueError): v.x = 1 with raises(ValueError): v.y = 1 with raises(ValueError): v += 1 with raises(ValueError...
demos/feature_demo.py
cuongptnk/imutils
3,984
11073994
<filename>demos/feature_demo.py # author: <NAME> # website: http://www.pyimagesearch.com # USAGE # python feature_demo.py # import the necessary packages from imutils.feature import DescriptorExtractor_create from imutils.feature import FeatureDetector_create from imutils.feature import corners_to_keypoints # e...
tests/components/plant/__init__.py
domwillcode/home-assistant
30,023
11074008
"""Tests for the plant component."""
optimus/engines/base/dask/functions.py
ironmussa/Optimus
1,045
11074014
<reponame>ironmussa/Optimus<filename>optimus/engines/base/dask/functions.py<gh_stars>1000+ from abc import abstractmethod import dask import dask.dataframe as dd import hiurlparser import numpy as np from dask.delayed import delayed from dask_ml.preprocessing import MinMaxScaler, StandardScaler from sklearn.preprocess...
python/paddle/optimizer/lamb.py
wwqgtxx/Paddle
17,085
11074080
# Copyright (c) 2020 PaddlePaddle Authors. All Rights Reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by appli...
tests/validate/validate_object_test.py
nickgaya/bravado-core
122
11074088
<reponame>nickgaya/bravado-core # -*- coding: utf-8 -*- import pytest from jsonschema.exceptions import ValidationError from six import iteritems from bravado_core.spec import Spec from bravado_core.validate import validate_object from tests.conftest import get_url from tests.validate.conftest import email_address_for...
chrome/common/extensions/docs/server2/api_data_source_test.py
kjthegod/chromium
2,151
11074095
<filename>chrome/common/extensions/docs/server2/api_data_source_test.py #!/usr/bin/env python # Copyright (c) 2012 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. import unittest from api_data_source import APIDataSource ...
utils/network/arrange_network_detection_results.py
claraeyoon/FAST
126
11074099
<filename>utils/network/arrange_network_detection_results.py import numpy as np # ---------------------------------------------------INPUTS -------------------------------------------- det_dir = '../../data/network_detection/' network_file = '7sta_2stathresh_detlist_rank_by_peaksum.txt' nsta = 7 #det_dir = '/lfs/1/ce...
azure-iot-device/tests/provisioning/shared_client_tests.py
dominicbetts/azure-iot-sdk-python
366
11074104
<reponame>dominicbetts/azure-iot-sdk-python # ------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. # Licensed under the MIT License. See License.txt in the project root for # license information. # -----------------------------------------...
dfvfs/vfs/ext_file_entry.py
dfjxs/dfvfs
176
11074113
<gh_stars>100-1000 # -*- coding: utf-8 -*- """The EXT file entry implementation.""" from dfdatetime import posix_time as dfdatetime_posix_time from dfvfs.lib import definitions from dfvfs.lib import errors from dfvfs.path import ext_path_spec from dfvfs.vfs import attribute from dfvfs.vfs import ext_attribute from df...
var/spack/repos/builtin/packages/py-pyjnius/package.py
kkauder/spack
2,360
11074132
<filename>var/spack/repos/builtin/packages/py-pyjnius/package.py # Copyright 2013-2021 Lawrence Livermore National Security, LLC and other # Spack Project Developers. See the top-level COPYRIGHT file for details. # # SPDX-License-Identifier: (Apache-2.0 OR MIT) from spack import * class PyPyjnius(PythonPackage): ...
spacy_lookup/__init__.py
mpuig/spacy-lookup
243
11074138
<reponame>mpuig/spacy-lookup # coding: utf8 from __future__ import unicode_literals from flashtext import KeywordProcessor from spacy.tokens import Doc, Span, Token from .about import __version__ class Entity(object): name = 'entity' def __init__(self, keywords_list=[], keywords_dict={}, keywords_file=None...
docs/examples/use_cases/paddle/ssd/train.py
cyyever/DALI
3,967
11074145
# Copyright (c) 2019 PaddlePaddle Authors. All Rights Reserved. # Copyright (c) 2017-2021, NVIDIA CORPORATION & 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. # You may obtain a copy of the License a...
tests/python/twitter/common/dirutil/size_test.py
zhouyijiaren/commons
1,143
11074158
<reponame>zhouyijiaren/commons<filename>tests/python/twitter/common/dirutil/size_test.py # ================================================================================================== # Copyright 2012 Twitter, Inc. # -------------------------------------------------------------------------------------------------...
samples/invoice/remind.py
Hey-Marvelous/PayPal-Python-SDK
653
11074186
from paypalrestsdk import Invoice import logging logging.basicConfig(level=logging.INFO) invoice = Invoice.find("INV2-9CAH-K5G7-2JPL-G4B4") options = { "subject": "Past due", "note": "Please pay soon", "send_to_merchant": True } if invoice.remind(options): # return True or False print("Invoice[%s] re...
test/mitmproxy/proxy/conftest.py
KarlParkinson/mitmproxy
24,939
11074208
import os import pytest from hypothesis import settings from mitmproxy import connection, options from mitmproxy.addons.proxyserver import Proxyserver from mitmproxy.addons.termlog import TermLog from mitmproxy.proxy import context @pytest.fixture def tctx() -> context.Context: opts = options.Options() Prox...
Python-3/ordered_dict_example.py
ghiloufibelgacem/jornaldev
1,139
11074215
from collections import OrderedDict # creating a simple dict my_dict = {'kiwi': 4, 'apple': 5, 'cat': 3} # creating empty ordered dict ordered_dict = OrderedDict() print(ordered_dict) # creating ordered dict from dict ordered_dict = OrderedDict(my_dict) print(ordered_dict) # adding elements to dict ordered_dict['do...
yt/fields/xray_emission_fields.py
Xarthisius/yt
360
11074236
<gh_stars>100-1000 import os import numpy as np from yt.config import ytcfg from yt.fields.derived_field import DerivedField from yt.funcs import mylog, only_on_root, parse_h5_attr from yt.units.yt_array import YTArray, YTQuantity from yt.utilities.cosmology import Cosmology from yt.utilities.exceptions import YTExce...
docs/tutorial/helpers/filternet_images_helpers.py
aaberbach/bmtk
216
11074247
import matplotlib.pyplot as plt from bmtk.simulator.filternet.lgnmodel.temporalfilter import TemporalFilterCosineBump, TemporalFilter from bmtk.simulator.filternet.lgnmodel.spatialfilter import GaussianSpatialFilter from bmtk.simulator.filternet.lgnmodel import movie ##################################################...
config.py
sgarbirodrigo/ml-sound-classifier
118
11074251
# Freesound Dataset Kaggle 2018 # Application configurations from easydict import EasyDict conf = EasyDict() # Basic configurations conf.sampling_rate = 44100 conf.duration = 1 conf.hop_length = 347 # to make time steps 128 conf.fmin = 20 conf.fmax = conf.sampling_rate // 2 conf.n_mels = 128 conf.n_fft = conf.n_mels...
random_bonus/gan_n_cgan_2d_example/sampler.py
wang420349864/dlcv_for_beginners
1,424
11074260
from functools import partial import numpy from skimage import transform EPS = 1e-66 RESOLUTION = 0.001 num_grids = int(1/RESOLUTION+0.5) def generate_lut(img): """ linear approximation of CDF & marginal :param density_img: :return: lut_y, lut_x """ density_img = transform.resize(img, (num_gri...
tests/test_link_options.py
rubensmau/splink
176
11074265
import pytest from pyspark.sql import Row from splink.blocking import block_using_rules from splink.default_settings import complete_settings_dict from splink.vertically_concat import vertically_concatenate_datasets @pytest.fixture(scope="module") def link_dedupe_data(spark): # fmt: off data_l = [ { ...
img/facilityLocationGIF.py
wfondrie/apricot
389
11074278
<reponame>wfondrie/apricot<filename>img/facilityLocationGIF.py import matplotlib matplotlib.use('Agg') import matplotlib.pyplot as plt from matplotlib.animation import FuncAnimation import numpy numpy.random.seed(0) import seaborn; seaborn.set_style('whitegrid') from apricot import FacilityLocationSelection numpy.r...
classic_heuristics/gaskell_savings.py
juicetinliu/VeRyPy
156
11074287
#!/usr/bin/env python # -*- coding: utf-8 -*- ############################################################################### """ This file is a part of the VeRyPy classical vehicle routing problem heuristic library and provides implementations of the Gaskell (1967) \pi and \lambda savings functions for parallel (as in...
autoaugment/policies.py
msf235/sam
362
11074297
<filename>autoaugment/policies.py<gh_stars>100-1000 # Copyright 2020 The 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 # # Unles...
minpy/dispatch/rule.py
yuhonghong66/minpy
1,271
11074311
<gh_stars>1000+ """Rules for rule based policy""" from __future__ import absolute_import from __future__ import print_function import os import atexit import yaml import numpy from minpy.array_variants import ArrayType from minpy.array import Array from minpy.array import Number from minpy.utils import log _logger = ...
mmdeploy/codebase/mmpose/models/backbones/litehrnet.py
xizi/mmdeploy
746
11074317
# Copyright (c) OpenMMLab. All rights reserved. import torch import torch.nn.functional as F from mmdeploy.core import FUNCTION_REWRITER @FUNCTION_REWRITER.register_rewriter( 'mmpose.models.backbones.litehrnet.CrossResolutionWeighting.forward') def cross_resolution_weighting__forward(ctx, self, x): """Rewrit...
examples/visualization/eeg_on_scalp.py
stevemats/mne-python
1,953
11074343
<gh_stars>1000+ """ .. _ex-eeg-on-scalp: ================================= Plotting EEG sensors on the scalp ================================= In this example, digitized EEG sensor locations are shown on the scalp. """ # Author: <NAME> <<EMAIL>> # # License: BSD-3-Clause # %% import mne from mne.viz import plot_ali...
Algo and DSA/LeetCode-Solutions-master/Python/remove-interval.py
Sourav692/FAANG-Interview-Preparation
3,269
11074347
# Time: O(n) # Space: O(1) class Solution(object): def removeInterval(self, intervals, toBeRemoved): """ :type intervals: List[List[int]] :type toBeRemoved: List[int] :rtype: List[List[int]] """ A, B = toBeRemoved return [[x, y] for a, b in intervals ...
dash_leaflet/express.py
RenaudLN/dash-leaflet
125
11074349
<gh_stars>100-1000 import geobuf import dash_leaflet as dl import base64 def categorical_colorbar(*args, categories, colorscale, **kwargs): indices = list(range(len(categories) + 1)) return dl.Colorbar(*args, min=0, max=len(categories), classes=indices, colorscale=colorscale, tooltip=False, ...
testcases/elichika_tests/node/BatchNorm.py
vermashresth/chainer-compiler
116
11074370
# coding: utf-8 import numpy as np from chainer_compiler.elichika import testtools import chainer import chainer.links as L class A(chainer.Chain): def __init__(self): super(A, self).__init__() with self.init_scope(): self.l1 = L.BatchNormalization(3) def forward(self, x): ...
python/paddle/fluid/tests/unittests/test_network_with_dtype.py
zmxdream/Paddle
17,085
11074381
# Copyright (c) 2018 PaddlePaddle Authors. All Rights Reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by app...
estimator/iris_classifier.py
manailin/tensorflow___examples
156
11074402
<filename>estimator/iris_classifier.py #!/usr/bin/env python from __future__ import absolute_import from __future__ import division from __future__ import print_function import os import urllib import tensorflow as tf # Data sets IRIS_TRAINING = 'iris_training.csv' IRIS_TRAINING_URL = 'http://download.tensorflow.or...
aries_cloudagent/multitenant/tests/test_manager.py
SNU-Blockchain-2021-Fall-Group-H/aries-cloudagent-python
247
11074404
<gh_stars>100-1000 from asynctest import TestCase as AsyncTestCase from asynctest import mock as async_mock from ...core.in_memory import InMemoryProfile from ...messaging.responder import BaseResponder from ...wallet.models.wallet_record import WalletRecord from ..manager import MultitenantManager class TestMultite...
samples/mgmt_driver/kubespray/kubespray_mgmt.py
h1r0mu/tacker
116
11074416
# Copyright (C) 2021 FUJITSU # 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 a...
statsmodels/examples/tut_ols_ancova.py
madhushree14/statsmodels
6,931
11074418
<gh_stars>1000+ '''Examples OLS Note: uncomment plt.show() to display graphs Summary: ======== Relevant part of construction of design matrix xg includes group numbers/labels, x1 is continuous explanatory variable >>> dummy = (xg[:,None] == np.unique(xg)).astype(float) >>> X = np.c_[x1, dummy[:,1:], np.ones(nsample...
database/provisioning/create_teams.py
aprilsanchez/ictf-framework
110
11074429
import os import random import requests import sys import string import yaml import json rnd = random.SystemRandom() # THIS PATH ARE RELATIVE TO WHERE TERRAFORM WILL BE LAUNCHED BECAUSE # THEY ARE USED IN THE PROVISIONING SECTION. PROV_FOLDER = os.path.dirname(os.path.abspath(__file__)) SECRETS_FOLDER = os.path.join...
src/greynoise/cli/decorator.py
aaronsdevera/pygreynoise
127
11074433
"""CLI subcommand decorators. Decorators used to add common functionality to subcommands. """ import functools import click import structlog from requests.exceptions import RequestException from greynoise.api import GreyNoise from greynoise.cli.formatter import FORMATTERS from greynoise.cli.parameter import ip_addr...
model/__init__.py
leoriohope/RandWireNN
757
11074435
<reponame>leoriohope/RandWireNN # -*- coding: utf-8 -*- """ Created on Mon Apr 8 08:22:37 2019 @author: Michael """
setup.py
awaisbinadil/colour-checker-detection
116
11074438
# -*- coding: utf-8 -*- import codecs from setuptools import setup packages = \ ['colour_checker_detection', 'colour_checker_detection.detection', 'colour_checker_detection.detection.tests'] package_data = \ {'': ['*'], 'colour_checker_detection': ['examples/*', 'resources/colour-chec...
pose_trackers/lighttrack/graph/torchlight/torchlight/__init__.py
rcourivaud/video-to-pose3D
574
11074445
<filename>pose_trackers/lighttrack/graph/torchlight/torchlight/__init__.py from .gpu import ngpu from .gpu import occupy_gpu from .gpu import visible_gpu from .io import DictAction from .io import IO from .io import import_class from .io import str2bool from .io import str2dict
scrounger/utils/config.py
NORD-Function/IOS-tools
217
11074494
<reponame>NORD-Function/IOS-tools """ Module with scrounger configurations """ # get home directory from os import getenv # Logging import logging as _logging #_LOGGING_FORMAT = "%(asctime)17s - %(module)8s.%(funcName).10s : %(message)s" _LOGGING_FORMAT = "%(asctime)17s - %(module)30s : %(message)s" _LOGGING_TIME_FOR...