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
src/blade/inclusion_check.py
Madision-Jack/blade-build
842
12607653
# Copyright (c) 2021 Tencent Inc. # All rights reserved. # # Author: chen3feng <<EMAIL>> # Date: Feb 14, 2021 """C/C++ header file inclusion dependency declaration check.""" import os from blade import console from blade import util from blade.util import pickle def find_libs_by_header(hdr, hdr_targets_map, hdr_...
cli/gotypes.py
rizalgowandy/nice
186
12607672
<reponame>rizalgowandy/nice #!/usr/bin/env python types = [ ("bool", "Bool", "strconv.FormatBool(bool(*%s))", "*%s == false"), ("uint8", "Uint8", "strconv.FormatUint(uint64(*%s), 10)", "*%s == 0"), ("uint16", "Uint16", "strconv.FormatUint(uint64(*%s), 10)", "*%s == 0"), ("uint32", "Uint32", "strconv.Fo...
util/network_utils.py
giuseppefutia/GraphTSNE
120
12607677
<gh_stars>100-1000 import torch import numpy as np from util.graph_utils import neighbor_sampling from core.GraphDataBlock import GraphDataBlock def save_checkpoint(state, filename): torch.save(state, filename) def get_net_projection(net, dataset, n_batches=1, n_components=2): """ Get visualization of d...
alipay/aop/api/domain/UserInfomation.py
antopen/alipay-sdk-python-all
213
12607688
#!/usr/bin/env python # -*- coding: utf-8 -*- import json from alipay.aop.api.constant.ParamConstants import * from alipay.aop.api.domain.OrderExtInfo import OrderExtInfo class UserInfomation(object): def __init__(self): self._cert_no = None self._cert_type = None self._ext_info = None ...
social/apps/flask_app/utils.py
raccoongang/python-social-auth
1,987
12607728
<filename>social/apps/flask_app/utils.py from social_flask.utils import get_helper, load_strategy, load_backend, psa, strategy
Problem040/Python/solution_1.py
drocha87/ProjectEuler
167
12607743
#!/usr/bin/env python # coding=utf-8 # Python Script # # Copyleft © <NAME> # # from functools import reduce from itertools import count def frac_series_generator(): '''each n after 0.1 from 0.12345678910111213...''' for w in count(start=1, step=1): for s in str(w): yield s def searc...
backend/fastapi/build_dsApp/Authentication/api_key_header.py
spideynolove/Other-repo
107
12607749
from fastapi import Depends, FastAPI, HTTPException, status from fastapi.security import APIKeyHeader API_TOKEN = "SECRET_API_TOKEN" app = FastAPI() api_key_header = APIKeyHeader(name="Token") @app.get("/protected-route") async def protected_route(token: str = Depends(api_key_header)): if token != API_TOKEN: ...
tools/reval.py
xctspring/iter-reason
275
12607754
#!/usr/bin/env python # Reval = re-eval. Re-evaluate saved detections. from __future__ import absolute_import from __future__ import division from __future__ import print_function import _init_paths from model.config import cfg from datasets.factory import get_imdb try: import cPickle as pickle except ImportError: ...
Trakttv.bundle/Contents/Libraries/Shared/exception_wrappers/database/apsw/base.py
disrupted/Trakttv.bundle
1,346
12607763
from __future__ import absolute_import from exception_wrappers.exceptions import DatabaseDisabledError from exception_wrappers.libraries import apsw from exception_wrappers.manager import ExceptionWrapper import logging log = logging.getLogger(__name__) disabled_databases = {} class APSWBaseWrapper(object): nam...
2018/03/15/How to Use Django REST Framework Permissions/api_example/api_example/languages/views.py
kenjitagawa/youtube_video_code
492
12607786
from django.shortcuts import render from rest_framework import viewsets, permissions from .models import Language, Programmer, Paradigm from .serializers import LanguageSerializer, ParadigmSerializer, ProgrammerSerializer class LanguageView(viewsets.ModelViewSet): queryset = Language.objects.all() serializer_c...
esphome/components/tuya/cover/__init__.py
OttoWinter/esphomeyaml
249
12607830
from esphome.components import cover import esphome.config_validation as cv import esphome.codegen as cg from esphome.const import ( CONF_OUTPUT_ID, CONF_MIN_VALUE, CONF_MAX_VALUE, CONF_RESTORE_MODE, ) from .. import tuya_ns, CONF_TUYA_ID, Tuya DEPENDENCIES = ["tuya"] CONF_CONTROL_DATAPOINT = "control...
test/cluster_test/setup.py
viyadb/viyadb
109
12607834
#!/usr/bin/env python3 import http.server import json import kafka import requests import socketserver import time consul_url = 'http://consul:8500/v1/kv' def wait_for_consul(): while True: try: requests.head(consul_url) break except requests.exceptions.ConnectionError: ...
Python/rabbit_group problem.py
shruti8301/Algorithms-Cheatsheet-Resources
199
12607844
''' There are some colored rabbits in a forest. Given an array arr[] of size N, such that arr[i] denotes the number of rabbits having same color as the ith rabbit, the task is to find the minimum number of rabbits that could be in the forest. ''' import math def rabbits(A): d={} for i in A: ...
utils/utils.py
Ynjxsjmh/mtl
385
12607897
<filename>utils/utils.py<gh_stars>100-1000 from src.models import MiniAutoencoder, SegNetAutoencoder, SegNetArgmaxAE, SegNetTest, ResNetAutoencoder import config import tensorflow as tf from functools import reduce import os import utils.data_handler as dh import numpy as np import matplotlib.pyplot as plt import src.O...
src/genie/libs/parser/iosxe/tests/ShowMacAddressTable/cli/equal/golden_output_expected.py
balmasea/genieparser
204
12607936
expected_output = { "mac_table": { "vlans": { "100": { "mac_addresses": { "ecbd.1dff.5f92": { "drop": {"drop": True, "entry_type": "dynamic"}, "mac_address": "ecbd.1dff.5f92", }, ...
src/face_detection/startq.py
mykiscool/DeepCamera
914
12607953
<filename>src/face_detection/startq.py import subprocess, shlex, os if __name__ == "__main__": command = '' env = os.environ.copy() env['WORKER_BROKER'] = 'amqp://rabbitmq/' env['WORKER_TYPE'] = 'od' command = 'celery worker --loglevel INFO -E -n od -c 1 --autoscale=1,1 -Q od' od = subprocess...
stocklook/crypto/gdax/__init__.py
zbarge/stocklook
149
12607976
<filename>stocklook/crypto/gdax/__init__.py from stocklook.crypto.gdax.feeds.book_feed import GdaxBookFeed from stocklook.crypto.gdax.feeds import GdaxTradeFeed from stocklook.crypto.gdax.feeds.websocket_client import GdaxWebsocketClient from .account import GdaxAccount from .api import Gdax, GdaxAPIError from .book im...
fastapi/openapi/constants.py
Aryabhata-Rootspring/fastapi
53,007
12607979
<reponame>Aryabhata-Rootspring/fastapi<filename>fastapi/openapi/constants.py<gh_stars>1000+ METHODS_WITH_BODY = {"GET", "HEAD", "POST", "PUT", "DELETE", "PATCH"} STATUS_CODES_WITH_NO_BODY = {100, 101, 102, 103, 204, 304} REF_PREFIX = "#/components/schemas/"
tests/test_codebase/test_mmocr/data/dbnet.py
zhiqwang/mmdeploy
746
12608002
<gh_stars>100-1000 # Copyright (c) OpenMMLab. All rights reserved. model = dict( type='DBNet', backbone=dict( type='mmdet.ResNet', depth=18, num_stages=4, out_indices=(0, 1, 2, 3), frozen_stages=-1, norm_cfg=dict(type='BN', requires_grad=True), init_cfg=di...
src/super_gradients/training/utils/sg_model_utils.py
Deci-AI/super-gradients
308
12608011
<filename>src/super_gradients/training/utils/sg_model_utils.py import os import sys import socket import time from multiprocessing import Process from pathlib import Path from typing import Tuple, Union import torch from torch.utils.tensorboard import SummaryWriter from super_gradients.training.exceptions.dataset_exc...
jenkins/test/validators/common.py
fahlmant/openshift-tools
164
12608036
''' Provide common utils to validators ''' import subprocess import sys # Run cli command. By default, exit when an error occurs def run_cli_cmd(cmd, exit_on_fail=True): '''Run a command and return its output''' print "> " + " ".join(cmd) proc = subprocess.Popen(cmd, bufsize=-1, stderr=subprocess.PIPE, std...
pokemongo_bot/test/polyline_generator_test.py
timgates42/PokemonGo-Bot
5,362
12608106
<reponame>timgates42/PokemonGo-Bot import os import pickle import unittest import requests_mock from pokemongo_bot.walkers.polyline_generator import Polyline ex_orig = (47.1706378, 8.5167405) ex_dest = (47.1700271, 8.518072999999998) ex_speed = 2.5 ex_total_distance = 194 ex_resp_directions = 'example_directions.pickl...
solutions/dna_sequence_classification/quick_deploy/server/src/operations/load.py
kilianovski/bootcamp
789
12608115
<reponame>kilianovski/bootcamp import sys import pandas as pd sys.path.append("..") from config import DEFAULT_TABLE, KMER_K from utils import build_kmers,train_vec def seq_to_kmers(df_table): # Function to replace sequence column with kmers in df_table df_table['kmers'] = df_table.apply(lambda x: build_kmer...
maro/rl/exploration/__init__.py
yangboz/maro
598
12608139
<filename>maro/rl/exploration/__init__.py # Copyright (c) Microsoft Corporation. # Licensed under the MIT license. from .abs_explorer import AbsExplorer from .epsilon_greedy_explorer import EpsilonGreedyExplorer from .noise_explorer import GaussianNoiseExplorer, NoiseExplorer, UniformNoiseExplorer __all__ = ["AbsExpl...
tools/merge_checkpoints.py
Woffee/deformer
114
12608145
#!/usr/bin/env python3 # -*- coding: utf-8 -*- import argparse import re import tensorflow as tf def gen_variable_from_checkpoint(checkpoint): for var_name, var_shape in tf.train.list_variables(checkpoint): var = tf.train.load_variable(checkpoint, var_name) if var_name.endswith('adam_m') or var_n...
demo/explore_data.py
ashika6/keras-text-summarization
296
12608171
<reponame>ashika6/keras-text-summarization import pandas as pd from sklearn.model_selection import train_test_split from keras_text_summarization.library.applications.fake_news_loader import fit_text def main(): data_dir_path = './data' # Import `fake_or_real_news.csv` df = pd.read_csv(data_dir_path + "/...
fredapi/__init__.py
fadhilmch/fredapi
492
12608183
<filename>fredapi/__init__.py from fredapi.version import version as __version__ from fredapi.fred import Fred
tests/test_pairwise_preference.py
mpkato/interleaving
107
12608201
import interleaving as il from interleaving import PairwisePreferenceRanking import json from .test_methods import TestMethods class TestPairwisePreference(TestMethods): def test_interleave(self): # Method Rankings Max length # Possible interlea...
playbooks/internal_host_winrm_investigate.py
arjunkhunti-crest/security_content
348
12608216
""" Published in response to CVE-2021-44228, this playbook performs a general investigation on key aspects of a windows device using windows remote management. Important files related to the endpoint are generated, bundled into a zip, and copied to the container vault. """ import phantom.rules as phantom import json ...
claf/modules/encoder/lstm_cell_with_projection.py
GMDennis/claf
225
12608224
<reponame>GMDennis/claf """ This code is from allenai/allennlp (https://github.com/allenai/allennlp/blob/master/allennlp/modules/lstm_cell_with_projection.py) """ import itertools from typing import Callable, List, Tuple, Union, Optional import torch from torch.nn.utils.rnn import pack_padded_sequence, PackedSequence...
dev-ops/locust/locustfile.py
zj85/shopwarePluginSelectoer
203
12608229
<filename>dev-ops/locust/locustfile.py<gh_stars>100-1000 import requests import time import csv import os import random import uuid import json from locust import HttpUser, task, between, constant class Purchaser(HttpUser): weight = 10 wait_time = constant(15) countryId = 1 salutationId = 1 def on...
yinyang/src/parsing/SMTLIBv2Listener.py
rainoftime/yinyang
143
12608260
<filename>yinyang/src/parsing/SMTLIBv2Listener.py # Generated from SMTLIBv2.g4 by ANTLR 4.9.2 from antlr4 import * if __name__ is not None and "." in __name__: from .SMTLIBv2Parser import SMTLIBv2Parser else: from SMTLIBv2Parser import SMTLIBv2Parser # This class defines a complete listener for a parse tree p...
supriya/assets/__init__.py
butayama/supriya
191
12608277
<reponame>butayama/supriya from . import synthdefs # noqa
NLP_classification/download_wikitext.py
ngduyanhece/outlier-exposure
442
12608297
# -*- coding: utf-8 -*- """ Trains a MNIST classifier. """ import numpy as np import sys import os import pickle import argparse import math import time from bisect import bisect_left import torch import torch.nn as nn import torch.backends.cudnn as cudnn import torchvision.transforms as trn import torchvision.dataset...
examples/authenticated_relayer/make_user_db.py
kasimov-maxim/aiosmtpd
257
12608317
<filename>examples/authenticated_relayer/make_user_db.py # Copyright 2014-2021 The aiosmtpd Developers # SPDX-License-Identifier: Apache-2.0 import sqlite3 from argon2 import PasswordHasher from pathlib import Path from typing import Dict DB_FILE = "mail.db~" USER_AND_PASSWORD: Dict[str, str] = { "user1": "<PASS...
workshop_material/022_find_galaxies2.py
nrupatunga/pyimageconf2018
106
12608327
from dlib import * from math import sqrt img = load_grayscale_image('images/find_galaxies/nasa_crop.jpg') win = image_window(img) # instead of thresholding we can use a watershed, which is much more appropriate in this case img = gaussian_blur(img, 0.5); labels,num_blobs = label_connected_blobs_watershed(img, ...
catboost/R-package/mk_package.py
HeyLey/catboost
6,989
12608355
<reponame>HeyLey/catboost from __future__ import print_function import argparse import os import re import shutil import subprocess as sp import sys import tempfile def _execute(cmd, **kwargs): print('{}> {}'.format(os.getcwd(), ' '.join(cmd))) if kwargs: assert 0 == sp.check_call(cmd, **kwargs) e...
RecoLocalTracker/SiStripRecHitConverter/python/customiseNewStripCPE.py
ckamtsikis/cmssw
852
12608389
<filename>RecoLocalTracker/SiStripRecHitConverter/python/customiseNewStripCPE.py import FWCore.ParameterSet.Config as cms def customiseNewStripCPE(process): process.StripCPEfromTrackAngleESProducer.parameters.useLegacyError = True process.StripCPEfromTrackAngleESProducer.parameters.maxChgOneMIP = -6000. r...
scripts/log-stats/bound-sessions.py
refraction-networking/tapdance
106
12608417
<filename>scripts/log-stats/bound-sessions.py<gh_stars>100-1000 #!/usr/bin/python import sys import time START_TIME = time.mktime(time.strptime('Sun May 14 00:00:00 2017')) END_TIME = time.mktime(time.strptime('Sun May 21 00:00:00 2017')) ADJUST_TIME = 0 for line in sys.stdin: sp = line.split(' ', 1) ts = s...
tag_for_NER/convert_tag.py
bamtercelboo/corpus_process_script
170
12608439
# @Author : bamtercelboo # @Datetime : 2018/8/11 14:20 # @File : convert_tag.py # @Last Modify Time : 2018/8/11 14:20 # @Contact : <EMAIL>, <EMAIL>} """ FILE : convert_tag.py BIO2BMESO : BIO ---> BMESO 0 I B-ARG1 1 just B-ARGM-TMP 2 got B-V-* 3 back B-ARGM-DIR 4 from I-...
core/cube/cube-builder/tool/kvtool.py
hysunflower/Serving
789
12608462
<reponame>hysunflower/Serving # 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://www.apache.org/licenses/LICENSE-2.0 # ...
lookatme/ascii_art.py
alanxoc3/lookatme
1,179
12608499
""" Misc ASCII art """ WARNING = r""" _mBma sQf "QL jW( -$g. jW' -$m, .y@' _aa. 4m, .mD` ]QQWQ. 4Q, _mP` ]QQQQ ?Q/ _QF )WQQ@ ?Qc <QF QQQF )Qa jW( QQQf "QL jW' ]H...
h2o-docs/src/booklets/v2_2015/source/Python_Vignette_code_examples/python_show_column_types.py
ahmedengu/h2o-3
6,098
12608501
df12.types # {u'A': u'enum', u'C': u'real', u'B': u'enum', u'D': u'real'}
examples/core/idapythonrc.py
fengjixuchui/src
1,160
12608510
""" summary: code to be run right after IDAPython initialization description: The `idapythonrc.py` file: * %APPDATA%\Hex-Rays\IDA Pro\idapythonrc.py (on Windows) * ~/.idapro/idapythonrc.py (on Linux & Mac) can contain any IDAPython code that will be run as soon as IDAPython is done successfully initial...
smartsheet/models/home.py
bromic007/smartsheet-python-sdk
106
12608512
# pylint: disable=C0111,R0902,R0904,R0912,R0913,R0915,E1101 # Smartsheet Python SDK. # # Copyright 2018 Smartsheet.com, 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....
poet/modules/template.py
packetgeek/poet
189
12608521
<reponame>packetgeek/poet # template, example module # # required # import module # # your imports # # import blah # # global vars # MODNAME = 'template' USAGE = """Brief description of module. usage: template [-h] args go here etc \noptions: -h\t\tshow help""" # # handlers # @module.server_handler(MODNAME) def...
utils.py
SeitaroShinagawa/chainer-partial_convolution_image_inpainting
116
12608534
<reponame>SeitaroShinagawa/chainer-partial_convolution_image_inpainting<gh_stars>100-1000 import numpy as np def batch_postprocess_images(img, batch_w, batch_h): b, ch, w, h = img.shape img = img.reshape((batch_w, batch_h, ch, w, h)) img = img.transpose(0,1,3,4,2) img = (img + 1) *127.5 img = np.cl...
scripts/31_Model_Parse_T5/12_Generate.py
plandes/amrlib
103
12608552
<filename>scripts/31_Model_Parse_T5/12_Generate.py #!/usr/bin/python3 import setup_run_dir # this import tricks script to run from 2 levels up import warnings warnings.simplefilter('ignore') import os from amrlib.utils.logging import silence_penman, setup_logging, WARN, ERROR from amrlib.models.parse_t5.inferenc...
firefly/views/post.py
matrixorz/firefly
247
12608576
# coding=utf-8 from __future__ import absolute_import from flask.views import MethodView from flask.blueprints import Blueprint from flask_mongoengine.wtf import model_form from firefly.models.topic import Post, Comment from firefly.libs.template import render_template from firefly.libs.markdown import Markdown from f...
stores/apps/store_admin/urls.py
diassor/CollectorCity-Market-Place
135
12608609
<gh_stars>100-1000 from django.conf.urls.defaults import * urlpatterns = patterns('', url(r'^$', 'store_admin.views.home_admin', name='home_admin'), url(r'^change_qty/$', 'store_admin.views.ajax_change_qty', name='ajax_change_qty'), url(r'^change_price/$', 'store_admin.views.ajax_change_price', name='...
recipes/Python/499336_Summarizing_XHTML/recipe-499336.py
tdiprima/code
2,023
12608700
<reponame>tdiprima/code<filename>recipes/Python/499336_Summarizing_XHTML/recipe-499336.py # -*- encoding: utf-8 -*- import re _tagopenre = re.compile(r'(?P<starws>\s?)<(?P<tagname>[^/][^> /]*)(?P<tagcontents>[^>]*)>(?P<endws>\s?)',re.MULTILINE) _tagclosere = re.compile(r'(?P<startws>\s?)</(?P<tagname>[^>]+)>(?P<endws>...
notebook/opencv_face_detection.py
vhn0912/python-snippets
174
12608736
<filename>notebook/opencv_face_detection.py import cv2 img = cv2.imread('data/src/lena_square.png') img_gray = cv2.cvtColor(img, cv2.COLOR_BGR2GRAY) print(type(img), img.shape) print(type(img_gray), img_gray.shape) # <class 'numpy.ndarray'> (512, 512, 3) # <class 'numpy.ndarray'> (512, 512) cascade_path = '/usr/loca...
tkinter/combobox-update-another-combobox/main.py
whitmans-max/python-examples
140
12608793
<filename>tkinter/combobox-update-another-combobox/main.py # date: 2019.04.23 from tkinter import * from tkinter.ttk import Combobox data = { "EMEA": [1105,1106], "ASIA": [3565,2445, 126464, 1145454], "AMERICA": [56464 ,5679, 55346], } def on_select(event): print(event) selecte_value = event.wi...
src/salt/base/ext/_utils/lsm6dsl_conn.py
autopi-io/autopi-core
133
12608798
import ctypes import logging import RPi.GPIO as gpio import time import yaml from common_util import dict_key_by_value from i2c_conn import I2CConn log = logging.getLogger(__name__) DEBUG = log.isEnabledFor(logging.DEBUG) ### Registers ### FIFO_CTRL1 = 0x06 # FIFO configuration registers FIFO_CTRL2 = 0x07 FIFO_CT...
backend/comment/notifications.py
restato/bunnybook
131
12608849
from uuid import UUID from injector import singleton, inject from comment.repo import CommentRepo from notification.manager import NewNotification, NotificationManager from post.repo import PostRepo class NewCommentOnPost(NewNotification): def __init__(self, comment_author_id: UUID, ...
booknlp/english/name_coref.py
ishine/booknlp
539
12608866
<gh_stars>100-1000 """ This code performs name clustering on PROP PER mentions, grouping together different proper names only that refer to the same individual e.g., Tom, <NAME>, Mr. <NAME>, Mr. Sawyer -> TOM SAYWER """ from collections import Counter import sys import itertools import pkg_resources class NameCoref:...
autotest/pyscripts/gdal2tiles/test_add_alpha_band_to_string_vrt.py
FeU-aKlos/gdal
3,100
12608892
#!/usr/bin/env pytest # -*- coding: utf-8 -*- ############################################################################### # $Id$ # # Project: GDAL/OGR Test Suite # Purpose: gdal2tiles.py testing # Author: <NAME> <<EMAIL>> # ############################################################################### # Copyri...
primitives/tf_encrypted/primitives/__init__.py
wqruan/tf-encrypted
825
12608933
from . import paillier from . import sodium __all__ = [ "paillier", "sodium", ]
tests/components/debugpy/__init__.py
tbarbette/core
30,023
12608934
"""Tests for the Remote Python Debugger integration."""
factory-ai-vision/EdgeSolution/modules/WebModule/backend/vision_on_edge/azure_part_detections/migrations/0008_auto_20200907_0933.py
kaka-lin/azure-intelligent-edge-patterns
176
12608956
# Generated by Django 3.0.8 on 2020-09-07 09:33 from django.db import migrations, models class Migration(migrations.Migration): dependencies = [ ("cameras", "0002_camera_location"), ("azure_part_detections", "0007_auto_20200907_0740"), ] operations = [ migrations.RemoveField(mod...
plenum/test/req_handler/test_get_txn_author_agreement_handler.py
andkononykhin/plenum
148
12608981
<reponame>andkononykhin/plenum import pytest as pytest from plenum.common.constants import TXN_TYPE, GET_TXN_AUTHOR_AGREEMENT, \ GET_TXN_AUTHOR_AGREEMENT_VERSION, GET_TXN_AUTHOR_AGREEMENT_DIGEST, GET_TXN_AUTHOR_AGREEMENT_TIMESTAMP from plenum.common.exceptions import InvalidClientRequest from plenum.common.request...
Anaconda-files/Program_09c.py
arvidl/dynamical-systems-with-applications-using-python
106
12608990
# Program 09c: Phase portrait and Poincare section of a nonautonomous ODE. # See Figure 9.11(b). import matplotlib.pyplot as plt import numpy as np from scipy.integrate import odeint xmin, xmax = -2, 2 ymin, ymax = -2, 2 k = 0.3 omega = 1.25 gamma = 0.5 def dx_dt(x, t): return [x[1], x[0] - k*x[1] - x[0]**3 + g...
utils/helpers.py
sadjadasghari/EfficientPose
182
12609005
from tensorflow.keras.applications.imagenet_utils import preprocess_input as efficientnet_preprocess_input from tensorflow.keras.layers import Activation from tensorflow.keras.backend import sigmoid, constant from tensorflow.keras.initializers import Initializer from torch.nn import ConvTranspose2d, init from torch im...
tools/fasta_stats/fasta-stats.py
ErasmusMC-Bioinformatics/tools-iuc
142
12609043
<gh_stars>100-1000 #!/usr/bin/env python # python version of fasta-stats with some extra features # written by <EMAIL> # git: @codemeleon # date: 10/11/2021 import argparse import re from os import path import numpy as np from Bio import SeqIO def calculate_NG50(estimated_genome, total_length, sequence_lengths): ...
tests/bytecode/mp-tests/tuple3.py
LabAixBidouille/micropython
303
12609054
def f(x): return x, x + 1 for a in b, c: f(a)
doc/sphinxext/__init__.py
nno/PyMVPA
227
12609069
<filename>doc/sphinxext/__init__.py """Dummy module groupping our collection of 3rd party extensions"""
tests/test_input_laplace_1d.py
clazaro/sfepy
510
12609149
<reponame>clazaro/sfepy<gh_stars>100-1000 from __future__ import absolute_import input_name = '../examples/diffusion/laplace_1d.py' output_name = 'test_laplace_1d.vtk' from tests_basic import TestInput class Test(TestInput): pass
tests/profiling/test_recorder.py
p7g/dd-trace-py
308
12609152
# -*- encoding: utf-8 -*- import os import pytest from ddtrace.profiling import event from ddtrace.profiling import recorder from ddtrace.profiling.collector import stack_event from tests.utils import call_program def test_defaultdictkey(): d = recorder._defaultdictkey(lambda k: [str(k) + "k"]) assert isins...
ignite/metrics/ssim.py
Eunjnnn/ignite
4,119
12609178
<filename>ignite/metrics/ssim.py from typing import Callable, Sequence, Union import torch import torch.nn.functional as F from ignite.exceptions import NotComputableError from ignite.metrics.metric import Metric, reinit__is_reduced, sync_all_reduce __all__ = ["SSIM"] class SSIM(Metric): """ Computes Struc...
app/pylibs/osx64/Cryptodome/Protocol/KDF.py
skylex77/PokeMapGT
2,557
12609194
<gh_stars>1000+ # # KDF.py : a collection of Key Derivation Functions # # Part of the Python Cryptography Toolkit # # =================================================================== # The contents of this file are dedicated to the public domain. To # the extent that dedication to the public domain is not availabl...
torchbearer/callbacks/checkpointers.py
NunoEdgarGFlowHub/torchbearer
358
12609220
import torchbearer import torch from torchbearer.callbacks.callbacks import Callback import os import warnings from torchbearer.bases import get_metric class _Checkpointer(Callback): def __init__(self, fileformat, save_model_params_only=False, pickle_module=torch.serialization.pickle, pickle_protocol=torch.seri...
09_deploy/common/sagemaker_rl/orchestrator/utils/cloudwatch_logger.py
ichen20/oreilly_book
2,327
12609226
import time import json class CloudWatchLogger: def __init__(self, cw_client, region_name): self.region_name = region_name self.cw_client = cw_client def get_cloudwatch_dashboard_details(self, experiment_id): # update for non-commercial region cw_dashboard_url = f"https://{sel...
crabageprediction/venv/Lib/site-packages/pandas/tests/series/methods/test_update.py
13rianlucero/CrabAgePrediction
28,899
12609227
<filename>crabageprediction/venv/Lib/site-packages/pandas/tests/series/methods/test_update.py import numpy as np import pytest import pandas.util._test_decorators as td from pandas import ( CategoricalDtype, DataFrame, NaT, Series, Timestamp, ) import pandas._testing as tm class TestUpdate: ...
app/iclass/models/editor.py
edisonlz/fastor
285
12609256
# coding=utf-8 from django.db import models from wi_cache import function_cache from django.conf import settings from app.iclass.utils.short_id import ShortID class Editor(models.Model): """ 编辑内容转URL """ STATUS_NORMAL = 0 STATUS_CLOSE = 1 title = models.CharField(max_length=255, verbose_name...
PhysicsTools/PatAlgos/python/patTestJEC_cfi.py
ckamtsikis/cmssw
852
12609268
<reponame>ckamtsikis/cmssw import FWCore.ParameterSet.Config as cms # Be sure to change the "V5" to whatever is in your payloads. from CondCore.DBCommon.CondDBSetup_cfi import * jec = cms.ESSource("PoolDBESSource",CondDBSetup, connect = cms.string("frontier://FrontierPrep/CMS_COND_PHYSICSTOOLS"), ...
testcases/common.py
daxlab/pyalgotrade
1,000
12609330
<filename>testcases/common.py # 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...
feed/utils.py
nonomal/oh-my-rss
270
12609349
# -*- coding: utf-8 -*- import os from ohmyrss.settings import CRAWL_FLAG_DIR import time import urllib import hashlib def mkdir(directory): return os.makedirs(directory, exist_ok=True) def get_hash_name(s): return hashlib.md5(s.encode('utf8')).hexdigest() def is_crawled_url(url): url_hash = get_hash...
menpo/feature/features.py
apapaion/menpo
311
12609350
import itertools import warnings import numpy as np from .base import imgfeature, ndfeature @ndfeature def gradient(pixels): r""" Calculates the gradient of an input image. The image is assumed to have channel information on the first axis. In the case of multiple channels, it returns the gradient o...
app-testing/src/resources/__init__.py
anuwrag/opentrons
235
12609358
"""Definitions of resources needed in tests."""
keras/examples/reuters_mlp.py
molingbo/crcn
167
12609380
<gh_stars>100-1000 from __future__ import absolute_import from __future__ import print_function import numpy as np from keras.datasets import reuters from keras.models import Sequential from keras.layers.core import Dense, Dropout, Activation from keras.layers.normalization import BatchNormalization from keras.utils i...
test/feature/test_affine_shape_estimator.py
saurabhya/kornia
418
12609405
import pytest import torch from torch.autograd import gradcheck import kornia.testing as utils # test utils from kornia.feature.affine_shape import LAFAffineShapeEstimator, LAFAffNetShapeEstimator, PatchAffineShapeEstimator from kornia.testing import assert_close class TestPatchAffineShapeEstimator: def test_sh...
tests/test_codecs.py
matchup-ir/whooshy
270
12609410
from __future__ import with_statement import random from array import array import pytest from whoosh import analysis, fields, formats, query from whoosh.compat import u, b, text_type from whoosh.compat import array_tobytes, xrange from whoosh.codec import default_codec from whoosh.filedb.filestore import RamStorage ...
QuickPotato/database/schemas.py
afparsons/QuickPotato
130
12609412
from sqlalchemy import MetaData, Table, Column, Integer, Float, String, Boolean class RawStatisticsSchemas(object): @staticmethod def performance_statistics_schema(): meta = MetaData() table = Table( "performance_statistics", meta, Column('id', Integer, primary_key=Tru...
ipyleaflet/_version.py
vishalbelsare/ipyleaflet
903
12609446
<filename>ipyleaflet/_version.py # Copyright (c) Jupyter Development Team. # Distributed under the terms of the Modified BSD License. # version_info = (0, 15, 0) __version__ = '%s.%s.%s' % (version_info[0], version_info[1], version_info[2]) EXTENSION_VERSION = '^0.15.0'
samples/test/lightweight_python_functions_v2_with_outputs_test.py
rahulsmehta/pipelines
2,860
12609454
<reponame>rahulsmehta/pipelines # Copyright 2021 The Kubeflow Authors # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required b...
api/tests/opentrons/drivers/mag_deck/test_driver.py
anuwrag/opentrons
235
12609456
from mock import AsyncMock import pytest from opentrons.drivers.asyncio.communication.serial_connection import SerialConnection from opentrons.drivers.mag_deck.driver import ( MagDeckDriver, MAG_DECK_COMMAND_TERMINATOR, GCODE_ROUNDING_PRECISION, ) from opentrons.drivers.command_builder import CommandBuilde...
struct/read-write-file/main.py
whitmans-max/python-examples
140
12609467
<filename>struct/read-write-file/main.py<gh_stars>100-1000 #!/usr/bin/env python3 # date: 2019.11.27 # import struct struct_format = 'i20s' struct_length = struct.calcsize(struct_format) def main(): print('--- OPEN ---') stream = open("test.bin", 'rb+'); # --- print('--- READ ---') buffer = strea...
modal/node_modules/accessibility-developer-tools/scripts/parse_aria_schemas.py
maze-runnar/modal-component
2,158
12609472
<filename>modal/node_modules/accessibility-developer-tools/scripts/parse_aria_schemas.py import json import re import urllib import xml.etree.ElementTree as ET def parse_attributes(): schema = urllib.urlopen('http://www.w3.org/MarkUp/SCHEMA/aria-attributes-1.xsd') tree = ET.parse(schema) for node in tree....
tests/nlu_core_tests/training_tests/classifiers/classifier_dl_tests.py
milyiyo/nlu
480
12609481
<gh_stars>100-1000 from sklearn.metrics import classification_report import unittest from nlu import * import tests.test_utils as t import pandas as pd class ClassifierDlTests(unittest.TestCase): def test_classifier_dl_training_labse(self): test_df = self.load_classifier_dl_dataset() train_df ...
piwheels/master/cloud_gazer.py
jgillis/piwheels
120
12609518
<reponame>jgillis/piwheels # The piwheels project # Copyright (c) 2017 <NAME> <https://github.com/bennuttall> # Copyright (c) 2017 <NAME> <<EMAIL>> # # Redistribution and use in source and binary forms, with or without # modification, are permitted provided that the following conditions are met: # # * Redistrib...
completions/properties.py
y0ssar1an/CSS3
192
12609522
<reponame>y0ssar1an/CSS3 from CSS3.completions import types as t import sublime # PROPERTIES names = [ ("align-content", "align-content: ${1};"), ("align-items", "align-items: ${1};"), ("align-self", "align-self: ${1};"), ("alignment-baseline", "alignment-baseline: ${1};"), ("all", "all: ${1};"), ...
sympy/stats/tests/test_compound_rv.py
shilpiprd/sympy
8,323
12609528
<gh_stars>1000+ from sympy import (symbols, S, erf, sqrt, pi, exp, gamma, Interval, oo, beta, Eq, Piecewise, Integral, Abs, arg, Dummy, Sum, factorial) from sympy.stats import (Normal, P, E, density, Gamma, Poisson, Rayleigh, variance, Bernoulli, Beta, Uniform, cdf) from symp...
iot_hunter/import_data_to_es.py
byamao1/HaboMalHunter
727
12609562
<gh_stars>100-1000 #!/usr/bin/env python # Tencent is pleased to support the open source community by making IoTHunter available. # Copyright (C) 2017 THL A29 Limited, a Tencent company. All rights reserved. # Licensed under the MIT License (the "License"); you may not use this file except in # compliance with the Lic...
cli.py
fakegit/DEXBot
249
12609565
<filename>cli.py #!/usr/bin/env python3 from dexbot import cli if __name__ == '__main__': cli.main()
tests/blockchain/MockedBlockchain.py
fungibly/QRL
441
12609589
<reponame>fungibly/QRL import contextlib from math import ceil, log from mock import mock, MagicMock, Mock from pyqryptonight.pyqryptonight import StringToUInt256 from qrl.core import config from qrl.core.Block import Block from qrl.core.ChainManager import ChainManager from qrl.core.DifficultyTracker import Difficul...
tests/token_classification.py
Oaklight/parallelformers
454
12609591
# Copyright 2021 TUNiB inc. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, softw...
SoftLayer/CLI/file/detail.py
dvzrv/softlayer-python
126
12609596
<reponame>dvzrv/softlayer-python<gh_stars>100-1000 """Display details for a specified volume.""" # :license: MIT, see LICENSE for more details. import click import SoftLayer from SoftLayer.CLI import environment from SoftLayer.CLI import formatting from SoftLayer.CLI import helpers from SoftLayer import utils @click...
tests/test_version.py
JerryX1110/VFS
549
12609597
import mmaction def test_version(): version = mmaction.__version__ assert isinstance(version, str) assert isinstance(mmaction.short_version, str) assert mmaction.short_version in version and '+' in version
gdal/swig/python/gdal-utils/osgeo_utils/samples/gdal_rm.py
freespace/gdal
3,100
12609629
#!/usr/bin/env python3 ############################################################################### # $Id$ # # Project: GDAL samples # Purpose: Delete a virtual file # Author: <NAME> <even.rouault at spatialys.com> # ############################################################################### # Copyright ...
aiida/storage/psql_dos/orm/convert.py
mkrack/aiida-core
153
12609646
<gh_stars>100-1000 # -*- coding: utf-8 -*- ########################################################################### # Copyright (c), The AiiDA team. All rights reserved. # # This file is part of the AiiDA code. # # ...