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
gfwlist/gen.py
lipeijian/shadowsocks-android
137
8140
<reponame>lipeijian/shadowsocks-android #!/usr/bin/python # -*- encoding: utf8 -*- import itertools import math import sys import IPy def main(): china_list_set = IPy.IPSet() for line in sys.stdin: china_list_set.add(IPy.IP(line)) # 输出结果 for ip in china_list_set: print '<item>' + st...
examples/basics/visuals/line_prototype.py
3DAlgoLab/vispy
2,617
8174
# -*- coding: utf-8 -*- # vispy: gallery 10 # Copyright (c) Vispy Development Team. All Rights Reserved. # Distributed under the (new) BSD License. See LICENSE.txt for more info. import sys import numpy as np from vispy import app, gloo, visuals from vispy.visuals.filters import Clipper, ColorFilter from vispy.visual...
util/util.py
harshitAgr/vess2ret
111
8177
"""Auxiliary methods.""" import os import json from errno import EEXIST import numpy as np import seaborn as sns import cPickle as pickle import matplotlib.pyplot as plt sns.set() DEFAULT_LOG_DIR = 'log' ATOB_WEIGHTS_FILE = 'atob_weights.h5' D_WEIGHTS_FILE = 'd_weights.h5' class MyDict(dict): """ Dictionar...
demo/gpnas/CVPR2021_NAS_competition_gpnas_demo.py
ZichaoGuo/PaddleSlim
926
8203
<filename>demo/gpnas/CVPR2021_NAS_competition_gpnas_demo.py # Copyright (c) 2021 PaddlePaddle Authors. All Rights Reserved. # # Licensed under the Apache License, Version 2.0 (the "License" # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.a...
windows_packages_gpu/torch/nn/intrinsic/qat/modules/linear_relu.py
codeproject/DeepStack
353
8207
from __future__ import absolute_import, division, print_function, unicode_literals import torch.nn.qat as nnqat import torch.nn.intrinsic import torch.nn.functional as F class LinearReLU(nnqat.Linear): r""" A LinearReLU module fused from Linear and ReLU modules, attached with FakeQuantize modules f...
tests/basic/test_basic.py
kopp/python-astar
133
8219
import unittest import astar class BasicTests(unittest.TestCase): def test_bestpath(self): """ensure that we take the shortest path, and not the path with less elements. the path with less elements is A -> B with a distance of 100 the shortest path is A -> C -> D -> B with a distanc...
src/gluonts/nursery/autogluon_tabular/estimator.py
Xiaoxiong-Liu/gluon-ts
2,648
8239
# Copyright 2018 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://www.apache.org/licenses/LICENSE-2.0 # # or in the "license...
pre_embed.py
shelleyyyyu/few_shot
253
8251
import numpy as np from collections import defaultdict, Counter import random import json from tqdm import tqdm def transX(dataset): rel2id = json.load(open(dataset + '/relation2ids')) ent2id = json.load(open(dataset + '/ent2ids')) with open('../Fast-TransX/' + dataset + '_base/entity2id.txt', 'w') as...
amadeus/travel/trip_parser_jobs/_status.py
akshitsingla/amadeus-python
125
8279
<reponame>akshitsingla/amadeus-python<gh_stars>100-1000 from amadeus.client.decorator import Decorator class TripParserStatus(Decorator, object): def __init__(self, client, job_id): Decorator.__init__(self, client) self.job_id = job_id def get(self, **params): ''' Returns the ...
tools/third_party/iniconfig/testing/test_iniconfig.py
meyerweb/wpt
2,479
8280
<gh_stars>1000+ import py import pytest from iniconfig import IniConfig, ParseError, __all__ as ALL from iniconfig import iscommentline from textwrap import dedent check_tokens = { 'section': ( '[section]', [(0, 'section', None, None)] ), 'value': ( 'value = 1', [(0, None, ...
analysis/calculate_holding_amount.py
hao44le/ico_top_holder_analysis
538
8297
import sys sys.path.insert(0,'..') from data.whale_data import exchnage_accounts from data.html_helper import check_if_address_name_exists from data.whale_eth_tx_data import * from data.whale_token_tx_data import identify_investor_type_token holding_account = "holding_account" deposit_account = 'deposit_account' withd...
esmvaltool/diag_scripts/ensclus/ens_anom.py
yifatdzigan/ESMValTool
148
8321
"""Computation of ensemble anomalies based on a desired value.""" import os import numpy as np from scipy import stats # User-defined packages from read_netcdf import read_iris, save_n_2d_fields from sel_season_area import sel_area, sel_season def ens_anom(filenames, dir_output, name_outputs, varname, numens, seaso...
lib/spack/spack/test/cache_fetch.py
LiamBindle/spack
2,360
8325
# 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) import os import pytest from llnl.util.filesystem import mkdirp, touch import spack.config from spack.fetch_strategy im...
tfx/orchestration/experimental/core/service_jobs_test.py
BACtaki/tfx
1,813
8349
# Copyright 2021 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.0 # # Unless required by applicable law or a...
dragonn/models.py
kundajelab/dragonn
251
8350
<gh_stars>100-1000 from __future__ import absolute_import, division, print_function import matplotlib import numpy as np import os import subprocess import sys import tempfile matplotlib.use('pdf') import matplotlib.pyplot as plt from abc import abstractmethod, ABCMeta from dragonn.metrics import ClassificationResult f...
bdlb/diabetic_retinopathy_diagnosis/benchmark.py
Sairam954/bdl-benchmarks
666
8364
# Copyright 2019 BDL Benchmarks Authors. All Rights Reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applica...
setup.py
stjordanis/MONeT-1
161
8376
<filename>setup.py import setuptools setuptools.setup( name="monet_memory_optimized_training", version="0.0.1", description="Memory Optimized Network Training Framework", url="https://github.com/philkr/lowrank_conv", packages=setuptools.find_packages(include = ['monet', 'monet.*', 'models', 'checkm...
hoomd/communicator.py
EdwardZX/hoomd-blue
204
8400
# Copyright (c) 2009-2021 The Regents of the University of Michigan # This file is part of the HOOMD-blue project, released under the BSD 3-Clause # License. """MPI communicator.""" from hoomd import _hoomd import hoomd import contextlib class Communicator(object): """MPI communicator. Args: mpi_c...
pymclevel/test/__init__.py
bennettdc/MCEdit-Unified
673
8412
__author__ = 'Rio'
Python/other/merge_interval.py
TechSpiritSS/NeoAlgo
897
8424
''' Given an array of intervals, merge all overlapping intervals, and return an array of the non-overlapping intervals that cover all the intervals in the input. Input: intervals = [[1,3],[2,6],[8,10],[15,18]] Output: [[1,6],[8,10],[15,18]] Explanation: Since intervals [1,3] and [2,6] overlaps, merge them into [1,6]....
test/regression/features/arithmetic/mult.py
ppelleti/berp
137
8438
print(18 * 1234) print(18 * 1234 * 2) print(0 * 1) print(1 * 0) print(0.0 * 1.0) print(1.0 * 0.0)
src/nile/core/run.py
kootsZhin/nile
121
8469
"""Command to run Nile scripts.""" import logging from importlib.machinery import SourceFileLoader from nile.nre import NileRuntimeEnvironment def run(path, network): """Run nile scripts passing on the NRE object.""" logger = logging.getLogger() logger.disabled = True script = SourceFileLoader("scrip...
Python/Basic Data Types/Lists/Solution.py
PawarAditi/HackerRank
219
8470
<reponame>PawarAditi/HackerRank array = [] for _ in range(int(input())): command = input().strip().split(" ") cmd_type = command[0] if (cmd_type == "print"): print(array) elif (cmd_type == "sort"): array.sort() elif (cmd_type == "reverse"): array.reverse() elif (cmd_type ...
scribdl/test/test_download.py
fatshotty/scribd-downloader
182
8482
<filename>scribdl/test/test_download.py from ..downloader import Downloader import os import pytest @pytest.fixture def cwd_to_tmpdir(tmpdir): os.chdir(str(tmpdir)) def test_audiobook_download(cwd_to_tmpdir, monkeypatch): audiobook_url = "https://www.scribd.com/audiobook/237606860/100-Ways-to-Motivate-Your...
yasql/apps/sqlorders/views.py
Fanduzi/YaSQL
443
8485
# -*- coding:utf-8 -*- # edit by fuzongfei import base64 import datetime # Create your views here. import json from django.http import Http404, HttpResponse from django.utils import timezone from django_filters.rest_framework import DjangoFilterBackend from rest_framework import filters from rest_framework.exceptions ...
dino/validation/events/message/limit_msg_length.py
thenetcircle/dino
150
8490
<reponame>thenetcircle/dino # 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 writing, softwar...
testing/scripts/checklicenses.py
zealoussnow/chromium
14,668
8497
<reponame>zealoussnow/chromium #!/usr/bin/env python # Copyright 2015 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 json import os import sys import common def main_run(args): with common.temporary_file() as...
python/app/plugins/http/Struts2/S2_052.py
taomujian/linbing
351
8513
#!/usr/bin/env python3 from app.lib.utils.request import request from app.lib.utils.encode import base64encode from app.lib.utils.common import get_capta, get_useragent class S2_052_BaseVerify: def __init__(self, url): self.info = { 'name': 'S2-052漏洞,又名CVE-2017-9805漏洞', 'descriptio...
stores/apps/inventory/migrations/0001_initial.py
diassor/CollectorCity-Market-Place
135
8560
# encoding: utf-8 import datetime from south.db import db from south.v2 import SchemaMigration from django.db import models class Migration(SchemaMigration): def forwards(self, orm): # Adding model 'ProductType' db.create_table('inventory_producttype', ( ('id', self.gf('django...
src/oci/management_agent/models/management_agent_aggregation_dimensions.py
CentroidChef/oci-python-sdk
249
8563
# coding: utf-8 # Copyright (c) 2016, 2021, Oracle and/or its affiliates. All rights reserved. # This software is dual-licensed to you under the Universal Permissive License (UPL) 1.0 as shown at https://oss.oracle.com/licenses/upl or Apache License 2.0 as shown at http://www.apache.org/licenses/LICENSE-2.0. You may c...
cement/ext/ext_generate.py
tomekr/cement
826
8583
""" Cement generate extension module. """ import re import os import inspect import yaml import shutil from .. import Controller, minimal_logger, shell from ..utils.version import VERSION, get_version LOG = minimal_logger(__name__) class GenerateTemplateAbstractBase(Controller): class Meta: pass de...
neutron/agent/ovsdb/native/helpers.py
congnt95/neutron
1,080
8609
# Copyright (c) 2015 Red Hat, 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 ...
migrations/20220114_03_Heqaz-insert-default-serverinfo.py
lin483/Funny-Nations
126
8621
<gh_stars>100-1000 """ insert default serverInfo """ from yoyo import step __depends__ = {'20220114_02_lHBKM-new-table-serverinfo'} steps = [ step("INSERT INTO `serverInfo` (`onlineMinute`) VALUES (0);") ]
neutronclient/osc/v2/vpnaas/ipsec_site_connection.py
slawqo/python-neutronclient
120
8622
<gh_stars>100-1000 # Copyright 2017 FUJITSU LIMITED # 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....
endpoints/api/permission_models_interface.py
giuseppe/quay
2,027
8631
<gh_stars>1000+ import sys from abc import ABCMeta, abstractmethod from collections import namedtuple from six import add_metaclass class SaveException(Exception): def __init__(self, other): self.traceback = sys.exc_info() super(SaveException, self).__init__(str(other)) class DeleteException(Ex...
desktop/core/ext-py/pyu2f-0.1.4/pyu2f/convenience/customauthenticator.py
yetsun/hue
5,079
8643
# Copyright 2016 Google Inc. 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 applicable law or ag...
desktop/core/ext-py/pyasn1-0.4.6/tests/type/test_namedval.py
yetsun/hue
5,079
8694
<filename>desktop/core/ext-py/pyasn1-0.4.6/tests/type/test_namedval.py<gh_stars>1000+ # # This file is part of pyasn1 software. # # Copyright (c) 2005-2019, <NAME> <<EMAIL>> # License: http://snmplabs.com/pyasn1/license.html # import sys try: import unittest2 as unittest except ImportError: import unittest f...
apps/dash-port-analytics/app/ui/tab_map_controls.py
JeroenvdSande/dash-sample-apps
2,332
8721
<reponame>JeroenvdSande/dash-sample-apps import dash_core_components as dcc import dash_html_components as html from config import strings def make_tab_port_map_controls( port_arr: list, port_val: str, vessel_types_arr: list, vessel_type_val: str, year_arr: list, year_val: int, month_arr: ...
phy/gui/actions.py
ycanerol/phy
118
8738
<filename>phy/gui/actions.py # -*- coding: utf-8 -*- """Actions and snippets.""" # ----------------------------------------------------------------------------- # Imports # ----------------------------------------------------------------------------- import inspect from functools import partial, wraps import loggin...
discovery-provider/src/queries/get_plays_metrics.py
atticwip/audius-protocol
429
8761
<gh_stars>100-1000 import logging import time from sqlalchemy import func, desc from src.models import Play from src.utils import db_session logger = logging.getLogger(__name__) def get_plays_metrics(args): """ Returns metrics for play counts Args: args: dict The parsed args from the request ...
python/tests/extractor/refmt.py
kho/cdec
114
8765
#!/usr/bin/env python import collections, sys lines = [] f = collections.defaultdict(int) fe = collections.defaultdict(lambda: collections.defaultdict(int)) for line in sys.stdin: tok = [x.strip() for x in line.split('|||')] count = int(tok[4]) f[tok[1]] += count fe[tok[1]][tok[2]] += count lines...
Toolkits/CMake/hunter/packages/sugar/python/sugar/sugar_warnings_wiki_table_generator.py
roscopecoltran/SniperKit-Core
102
8773
<reponame>roscopecoltran/SniperKit-Core #!/usr/bin/env python3 # Copyright (c) 2014, <NAME> # All rights reserved. """ * Wiki table for `leathers` C++ project Expected format: ### Main table Name | Clang | GCC | MSVC | -----------------------------|----------|----------|------| sta...
open/users/serializers.py
lawrendran/open
105
8782
import pytz from rest_auth.serializers import TokenSerializer from rest_framework.authtoken.models import Token from rest_framework.exceptions import ValidationError from rest_framework.fields import ( CharField, CurrentUserDefault, HiddenField, UUIDField, ChoiceField, ) from rest_framework.serializ...
speech/melgan/model/multiscale.py
OthmaneJ/deep-tts
213
8784
import torch import torch.nn as nn import torch.nn.functional as F from .discriminator import Discriminator from .identity import Identity class MultiScaleDiscriminator(nn.Module): def __init__(self): super(MultiScaleDiscriminator, self).__init__() self.discriminators = nn.ModuleList( ...
allennlp/training/metric_tracker.py
MSLars/allennlp
11,433
8791
from typing import Optional, Dict, Any, List, Union from allennlp.common.checks import ConfigurationError class MetricTracker: """ This class tracks a metric during training for the dual purposes of early stopping and for knowing whether the current value is the best so far. It mimics the PyTorch `st...
DQM/L1TMonitor/python/L1TGCT_cfi.py
ckamtsikis/cmssw
852
8798
import FWCore.ParameterSet.Config as cms from DQMServices.Core.DQMEDAnalyzer import DQMEDAnalyzer l1tGct = DQMEDAnalyzer('L1TGCT', gctCentralJetsSource = cms.InputTag("gctDigis","cenJets"), gctForwardJetsSource = cms.InputTag("gctDigis","forJets"), gctTauJetsSource = cms.InputTag("gctDigis","tauJets"), ...
tests/integration/lambdas/lambda_python3.py
jorges119/localstack
31,928
8806
<reponame>jorges119/localstack # simple test function that uses python 3 features (e.g., f-strings) # see https://github.com/localstack/localstack/issues/264 def handler(event, context): # the following line is Python 3.6+ specific msg = f"Successfully processed {event}" # noqa This code is Python 3.6+ only ...
test/modules/md/md_env.py
icing/mod_md
320
8810
import copy import inspect import json import logging import pytest import re import os import shutil import subprocess import time from datetime import datetime, timedelta from configparser import ConfigParser, ExtendedInterpolation from typing import Dict, List, Optional from pyhttpd.certs import CertificateSpec f...
tests/performance/bottle/simple_server.py
Varriount/sanic
4,959
8817
# Run with: gunicorn --workers=1 --worker-class=meinheld.gmeinheld.MeinheldWorker -b :8000 simple_server:app import bottle import ujson from bottle import route, run @route("/") def index(): return ujson.dumps({"test": True}) app = bottle.default_app()
sdk/python/lib/test/langhost/future_input/__main__.py
pcen/pulumi
12,004
8827
# Copyright 2016-2018, Pulumi Corporation. # # 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...
AppPkg/Applications/Python/Python-2.7.2/Lib/lib2to3/fixes/fix_methodattrs.py
CEOALT1/RefindPlusUDK
2,757
8833
<reponame>CEOALT1/RefindPlusUDK<gh_stars>1000+ """Fix bound method attributes (method.im_? -> method.__?__). """ # Author: <NAME> # Local imports from .. import fixer_base from ..fixer_util import Name MAP = { "im_func" : "__func__", "im_self" : "__self__", "im_class" : "__self__.__class__" ...
tests/test_misc.py
lordmauve/chopsticks
171
8839
"""Tests for miscellaneous properties, such as debuggability.""" import time from chopsticks.tunnel import Docker from chopsticks.group import Group def test_tunnel_repr(): """Tunnels have a usable repr.""" tun = Docker('py36', image='python:3.6') assert repr(tun) == "Docker('py36')" def test_group_repr...
intro/matplotlib/examples/plot_good.py
zmoon/scipy-lecture-notes
2,538
8883
""" A simple, good-looking plot =========================== Demoing some simple features of matplotlib """ import numpy as np import matplotlib matplotlib.use('Agg') import matplotlib.pyplot as plt fig = plt.figure(figsize=(5, 4), dpi=72) axes = fig.add_axes([0.01, 0.01, .98, 0.98]) X = np.linspace(0, 2, 200) Y = np...
src/backend/common/models/favorite.py
ofekashery/the-blue-alliance
266
8901
from backend.common.models.mytba import MyTBAModel class Favorite(MyTBAModel): """ In order to make strongly consistent DB requests, instances of this class should be created with a parent that is the associated Account key. """ def __init__(self, *args, **kwargs): super(Favorite, self)._...
modules/pygsm/devicewrapper.py
whanderley/eden
205
8903
<gh_stars>100-1000 #!/usr/bin/env python # vim: ai ts=4 sts=4 et sw=4 encoding=utf-8 # arch: pacman -S python-pyserial # debian/ubuntu: apt-get install python-serial import serial import re import errors class DeviceWrapper(object): def __init__(self, logger, *args, **kwargs): self.device = serial.Se...
tests/cases/cls.py
div72/py2many
345
8907
<gh_stars>100-1000 class Foo: def bar(self): return "a" if __name__ == "__main__": f = Foo() b = f.bar() print(b)
idaes/generic_models/properties/core/examples/ASU_PR.py
carldlaird/idaes-pse
112
8911
<filename>idaes/generic_models/properties/core/examples/ASU_PR.py ################################################################################# # The Institute for the Design of Advanced Energy Systems Integrated Platform # Framework (IDAES IP) was produced under the DOE Institute for the # Design of Advanced Energ...
Python/longest-valid-parentheses.py
shreyventure/LeetCode-Solutions
388
8914
''' Speed: 95.97% Memory: 24.96% Time complexity: O(n) Space complexity: O(n) ''' class Solution(object): def longestValidParentheses(self, s): ans=0 stack=[-1] for i in range(len(s)): if(s[i]=='('): stack.append(i) else: stack.pop() ...
distdeepq/__init__.py
Silvicek/distributional-dqn
131
8957
from distdeepq import models # noqa from distdeepq.build_graph import build_act, build_train # noqa from distdeepq.simple import learn, load, make_session # noqa from distdeepq.replay_buffer import ReplayBuffer, PrioritizedReplayBuffer # noqa from distdeepq.static import * from distdeepq.plots import PlotMachine
LeetCode/python3/287.py
ZintrulCre/LeetCode_Archiver
279
9012
class Solution: def findDuplicate(self, nums: List[int]) -> int: p1, p2 = nums[0], nums[nums[0]] while nums[p1] != nums[p2]: p1 = nums[p1] p2 = nums[nums[p2]] p2 = 0 while nums[p1] != nums[p2]: p1 = nums[p1] p2 = nums[p2] return...
src/twisted/test/myrebuilder1.py
mathieui/twisted
9,953
9013
<reponame>mathieui/twisted<filename>src/twisted/test/myrebuilder1.py class A: def a(self): return 'a' class B(A, object): def b(self): return 'b' class Inherit(A): def a(self): return 'c'
modules/google-earth-engine/docker/src/sepalinternal/gee.py
BuddyVolly/sepal
153
9015
import json from threading import Semaphore import ee from flask import request from google.auth import crypt from google.oauth2 import service_account from google.oauth2.credentials import Credentials service_account_credentials = None import logging export_semaphore = Semaphore(5) get_info_semaphore = Semaphore(2)...
PyIK/src/litearm.py
AliShug/EvoArm
110
9018
<reponame>AliShug/EvoArm from __future__ import print_function import numpy as np import struct import solvers import pid from util import * MOTORSPEED = 0.9 MOTORMARGIN = 1 MOTORSLOPE = 30 ERRORLIM = 5.0 class ArmConfig: """Holds an arm's proportions, limits and other configuration data""" def __init__(se...
facerec-master/py/facerec/distance.py
ArianeFire/HaniCam
776
9029
<reponame>ArianeFire/HaniCam<filename>facerec-master/py/facerec/distance.py #!/usr/bin/env python # -*- coding: utf-8 -*- # Copyright (c) <NAME>. All rights reserved. # Licensed under the BSD license. See LICENSE file in the project root for full license information. import numpy as np class AbstractDistance(object)...
pgyer_uploader.py
elina8013/android_demo
666
9030
<filename>pgyer_uploader.py #!/usr/bin/python #coding=utf-8 import os import requests import time import re from datetime import datetime import urllib2 import json import mimetypes import smtplib from email.MIMEText import MIMEText from email.MIMEMultipart import MIMEMultipart # configuration for pgye...
fastseg/model/utils.py
SeockHwa/Segmentation_mobileV3
274
9052
<filename>fastseg/model/utils.py<gh_stars>100-1000 import torch.nn as nn from .efficientnet import EfficientNet_B4, EfficientNet_B0 from .mobilenetv3 import MobileNetV3_Large, MobileNetV3_Small def get_trunk(trunk_name): """Retrieve the pretrained network trunk and channel counts""" if trunk_name == 'efficien...
cmsplugin_cascade/migrations/0007_add_proxy_models.py
teklager/djangocms-cascade
139
9063
from django.db import migrations, models class Migration(migrations.Migration): dependencies = [ ('cmsplugin_cascade', '0006_bootstrapgallerypluginmodel'), ] operations = [ ]
theonionbox/tob/credits.py
ralphwetzel/theonionbox
120
9064
Credits = [ ('Bootstrap', 'https://getbootstrap.com', 'The Bootstrap team', 'MIT'), ('Bottle', 'http://bottlepy.org', '<NAME>', 'MIT'), ('Cheroot', 'https://github.com/cherrypy/cheroot', 'CherryPy Team', 'BSD 3-Clause "New" or "Revised" License'), ('Click', 'https://github.com/pallets/click', 'Pallets',...
pypeln/thread/api/to_iterable_thread_test.py
quarckster/pypeln
1,281
9111
<filename>pypeln/thread/api/to_iterable_thread_test.py import typing as tp from unittest import TestCase import hypothesis as hp from hypothesis import strategies as st import pypeln as pl import cytoolz as cz MAX_EXAMPLES = 10 T = tp.TypeVar("T") @hp.given(nums=st.lists(st.integers())) @hp.settings(max_examples=MA...
pulsar/datadog_checks/pulsar/check.py
divyamamgai/integrations-extras
158
9122
<filename>pulsar/datadog_checks/pulsar/check.py from datadog_checks.base import ConfigurationError, OpenMetricsBaseCheck EVENT_TYPE = SOURCE_TYPE_NAME = 'pulsar' class PulsarCheck(OpenMetricsBaseCheck): """ PulsarCheck derives from AgentCheck that provides the required check method """ def __init__(...
evaluation/datasets/build_dataset_images.py
hsiehkl/pdffigures2
296
9127
<filename>evaluation/datasets/build_dataset_images.py import argparse from os import listdir, mkdir from os.path import join, isdir from subprocess import call import sys import datasets from shutil import which """ Script to use pdftoppm to turn the pdfs into single images per page """ def get_images(pdf_dir, outp...
python_packages_static/flopy/mf6/__init__.py
usgs/neversink_workflow
351
9136
<gh_stars>100-1000 # imports from . import coordinates from . import data from .modflow import * from . import utils from .data import mfdatascalar, mfdatalist, mfdataarray from .mfmodel import MFModel from .mfbase import ExtFileAction
colbert/parameters.py
techthiyanes/ColBERT
421
9150
import torch DEVICE = torch.device("cuda") SAVED_CHECKPOINTS = [32*1000, 100*1000, 150*1000, 200*1000, 300*1000, 400*1000] SAVED_CHECKPOINTS += [10*1000, 20*1000, 30*1000, 40*1000, 50*1000, 60*1000, 70*1000, 80*1000, 90*1000] SAVED_CHECKPOINTS += [25*1000, 50*1000, 75*1000] SAVED_CHECKPOINTS = set(SAVED_CHECKPOINTS)...
venv/Lib/site-packages/rivescript/inheritance.py
Hazemcodes/GimmyBot
154
9174
# RiveScript-Python # # This code is released under the MIT License. # See the "LICENSE" file for more information. # # https://www.rivescript.com/ def get_topic_triggers(rs, topic, thats, depth=0, inheritance=0, inherited=False): """Recursively scan a topic and return a list of all triggers. Arguments: ...
training/horovod/base/horovod_wrapper.py
thehardikv/ai-platform-samples
418
9194
<reponame>thehardikv/ai-platform-samples import collections import datetime import json import multiprocessing import os import subprocess import sys import time _SSHD_BINARY_PATH = "/usr/sbin/sshd" EnvironmentConfig = collections.namedtuple( "EnvironmentConfig", ["hosts", "port", "is_chief", "pools", "job_id...
usr/callbacks/action/tools.py
uwitec/LEHome
151
9206
#!/usr/bin/env python # encoding: utf-8 from __future__ import division from decimal import Decimal import subprocess import threading import urllib2 import urllib import httplib import json import re import hashlib import base64 # import zlib from lib.command.runtime import UserInput from lib.helper.CameraHelper ...
torch_geometric/utils/negative_sampling.py
NucciTheBoss/pytorch_geometric
2,350
9212
import random from typing import Optional, Tuple, Union import numpy as np import torch from torch import Tensor from torch_geometric.utils import coalesce, degree, remove_self_loops from .num_nodes import maybe_num_nodes def negative_sampling(edge_index: Tensor, num_nodes: Optional[Union[int...
src/cowrie/telnet/userauth.py
uwacyber/cowrie
2,316
9214
<gh_stars>1000+ # Copyright (C) 2015, 2016 GoSecure Inc. """ Telnet Transport and Authentication for the Honeypot @author: <NAME> <<EMAIL>> """ from __future__ import annotations import struct from twisted.conch.telnet import ( ECHO, LINEMODE, NAWS, SGA, AuthenticatingTelnetProtocol, ITelnet...
authcheck/app/model/exception.py
flyr4nk/secscan-authcheck
572
9215
class WebException(Exception): pass class ParserException(Exception): """ 解析异常 """ pass class ApiException(Exception): """ api异常 """ pass class WsException(Exception): """ 轮询异常 """ pass class SsoException(Exception): """ sso异...
Solutions/TenableIO/Data Connectors/azure_sentinel.py
johnbilliris/Azure-Sentinel
2,227
9218
<reponame>johnbilliris/Azure-Sentinel import re import base64 import hmac import hashlib import logging import requests from datetime import datetime class AzureSentinel: def __init__(self, workspace_id, workspace_key, log_type, log_analytics_url=''): self._workspace_id = workspace_id self._works...
tests/transformation/streamline/test_move_identical_op_past_join_op.py
mmrahorovic/finn
109
9223
import pytest from onnx import TensorProto from onnx import helper as oh import finn.core.onnx_exec as oxe from finn.core.modelwrapper import ModelWrapper from finn.transformation.streamline.reorder import MoveTransposePastJoinAdd from finn.util.basic import gen_finn_dt_tensor def create_model(perm): if perm ==...
part19/test_interpreter.py
fazillatheef/lsbasi
1,682
9241
import unittest class LexerTestCase(unittest.TestCase): def makeLexer(self, text): from spi import Lexer lexer = Lexer(text) return lexer def test_tokens(self): from spi import TokenType records = ( ('234', TokenType.INTEGER_CONST, 234), ('3.14'...
src/PeerRead/data_cleaning/process_PeerRead_abstracts.py
dveni/causal-text-embeddings
114
9248
<filename>src/PeerRead/data_cleaning/process_PeerRead_abstracts.py """ Simple pre-processing for PeerRead papers. Takes in JSON formatted data from ScienceParse and outputs a tfrecord Reference example: https://github.com/tensorlayer/tensorlayer/blob/9528da50dfcaf9f0f81fba9453e488a1e6c8ee8f/examples/data_process/tuto...
vispy/io/datasets.py
hmaarrfk/vispy
2,617
9274
# -*- coding: utf-8 -*- # Copyright (c) Vispy Development Team. All Rights Reserved. # Distributed under the (new) BSD License. See LICENSE.txt for more info. import numpy as np from os import path as op from ..util import load_data_file # This is the package data dir, not the dir for config, etc. DATA_DIR = op.join...
plugin/DataExport/extend.py
konradotto/TS
125
9281
#!/usr/bin/python # Copyright (C) 2015 Ion Torrent Systems, Inc. All Rights Reserved import subprocess import re pluginName = 'DataExport' pluginDir = "" networkFS = ["nfs", "cifs"] localFS = ["ext4", "ext3", "xfs", "ntfs", "exfat", "vboxsf"] supportedFS = ",".join(localFS + networkFS) def test(bucket): return...
amlb/benchmarks/file.py
pplonski/automlbenchmark
282
9293
<filename>amlb/benchmarks/file.py<gh_stars>100-1000 import logging import os from typing import List, Tuple, Optional from amlb.utils import config_load, Namespace log = logging.getLogger(__name__) def _find_local_benchmark_definition(name: str, benchmark_definition_dirs: List[str]) -> str: # 'name' should be e...
test/manual/documents/test_iter_documents.py
membranepotential/mendeley-python-sdk
103
9305
<gh_stars>100-1000 from itertools import islice from test import get_user_session, cassette from test.resources.documents import delete_all_documents, create_document def test_should_iterate_through_documents(): session = get_user_session() delete_all_documents() with cassette('fixtures/resources/docume...
src/exabgp/bgp/message/update/attribute/bgpls/link/mplsmask.py
pierky/exabgp
1,560
9319
# encoding: utf-8 """ mplsmask.py Created by <NAME> on 2016-12-01. Copyright (c) 2014-2017 Exa Networks. All rights reserved. """ from exabgp.bgp.message.notification import Notify from exabgp.bgp.message.update.attribute.bgpls.linkstate import LinkState from exabgp.bgp.message.update.attribute.bgpls.linkstate import ...
image_analogy/losses/patch_matcher.py
kaldap/image-analogies
3,722
9327
import numpy as np import scipy.interpolate import scipy.ndimage from sklearn.feature_extraction.image import extract_patches_2d, reconstruct_from_patches_2d def _calc_patch_grid_dims(shape, patch_size, patch_stride): x_w, x_h, x_c = shape num_rows = 1 + (x_h - patch_size) // patch_stride num_cols = 1 + (...
vnpy/gateway/rohon/__init__.py
funrunskypalace/vnpy
323
9333
from .rohon_gateway import RohonGateway
tests/unit/sagemaker/tensorflow/test_estimator_init.py
LastRemote/sagemaker-python-sdk
1,690
9348
# Copyright 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 accompan...
util/canonicaljson.py
giuseppe/quay
2,027
9359
<reponame>giuseppe/quay import collections def canonicalize(json_obj, preserve_sequence_order=True): """ This function canonicalizes a Python object that will be serialized as JSON. Example usage: json.dumps(canonicalize(my_obj)) Args: json_obj (object): the Python object that will later be ser...
external/model-preparation-algorithm/tests/conftest.py
opencv/openvino_training_extensions
775
9370
<reponame>opencv/openvino_training_extensions<filename>external/model-preparation-algorithm/tests/conftest.py # Copyright (C) 2022 Intel Corporation # SPDX-License-Identifier: Apache-2.0 # try: import e2e.fixtures from e2e.conftest_utils import * # noqa from e2e.conftest_utils import pytest_addopt...
ibis/udf/validate.py
rtpsw/ibis
986
9371
"""Validation for UDFs. Warning: This is an experimental module and API here can change without notice. DO NOT USE DIRECTLY. """ from inspect import Parameter, Signature, signature from typing import Any, Callable, List import ibis.common.exceptions as com from ibis.expr.datatypes import DataType def _parameter_c...
summary/summary_avail.py
bit0fun/plugins
173
9395
from datetime import datetime # ensure an rpc peer is added def addpeer(p, rpcpeer): pid = rpcpeer['id'] if pid not in p.persist['peerstate']: p.persist['peerstate'][pid] = { 'connected': rpcpeer['connected'], 'last_seen': datetime.now() if rpcpeer['connected'] else None, ...
openskill/statistics.py
CalColson/openskill.py
120
9400
<gh_stars>100-1000 import sys import scipy.stats normal = scipy.stats.norm(0, 1) def phi_major(x): return normal.cdf(x) def phi_minor(x): return normal.pdf(x) def v(x, t): xt = x - t denom = phi_major(xt) return -xt if (denom < sys.float_info.epsilon) else phi_minor(xt) / denom def w(x, t)...
src/tools/pch.py
MaxSac/build
11,356
9445
# Status: Being ported by Steven Watanabe # Base revision: 47077 # # Copyright (c) 2005 <NAME>. # Copyright 2006 <NAME> # Copyright (c) 2008 <NAME> # # Use, modification and distribution is subject to the Boost Software # License Version 1.0. (See accompanying file LICENSE_1_0.txt or # http://www.boost.org/LICENSE_1_0....
tests/test_parse.py
vkleen/skidl
700
9451
<gh_stars>100-1000 # -*- coding: utf-8 -*- # The MIT License (MIT) - Copyright (c) 2016-2021 <NAME>. import pytest from skidl import netlist_to_skidl from .setup_teardown import get_filename, setup_function, teardown_function def test_parser_1(): netlist_to_skidl(get_filename("Arduino_Uno_R3_From_Scratch.net"...
jaxrl/agents/sac_v1/sac_v1_learner.py
anuragajay/jaxrl
157
9481
"""Implementations of algorithms for continuous control.""" import functools from typing import Optional, Sequence, Tuple import jax import jax.numpy as jnp import numpy as np import optax from jaxrl.agents.sac import temperature from jaxrl.agents.sac.actor import update as update_actor from jaxrl.agents.sac.critic ...
test_data/samples/alembic_template_output.py
goldstar611/ssort
238
9486
"""Example revision Revision ID: fdf0cf6487a3 Revises: Create Date: 2021-08-09 17:55:19.491713 """ from alembic import op import sqlalchemy as sa # revision identifiers, used by Alembic. revision = "<KEY>" down_revision = None branch_labels = None depends_on = None def upgrade(): # ### commands auto generated...