max_stars_repo_path
string
max_stars_repo_name
string
max_stars_count
int64
id
string
content
string
add_param_types
int64
add_return_types
int64
add_class_field_types
int64
add_instance_field_types
int64
add_total
int64
add_error
int64
evaluator.py
sublatelog/https-github.com-pfnet-research-contextual_augmentation
192
1600472
import collections import copy import six import chainer from chainer import configuration from chainer.dataset import convert from chainer.dataset import iterator as iterator_module from chainer import function from chainer import link from chainer import reporter as reporter_module from chainer.training import exte...
0
1
0
0
1
0
tests/GNN/BERT-TextGCN/build_graph.py
ojipadeson/NLPGNN
263
1600521
<reponame>ojipadeson/NLPGNN import numpy as np import tensorflow as tf import matplotlib.pyplot as plt import seaborn as sns from bert import BERT import tqdm from nlpgnn.datas.checkpoint import LoadCheckpoint from nlpgnn.datas.dataloader import TFWriter from nlpgnn.tools import bert_init_weights_from_checkpoint import...
0
0
0
0
0
0
keras_unet_collection/_backbone_zoo.py
mrtucar/keras-unet-collection
259
1600524
from __future__ import absolute_import from tensorflow.keras.applications import * from tensorflow.keras.models import Model from keras_unet_collection.utils import freeze_model import warnings layer_cadidates = { 'VGG16': ('block1_conv2', 'block2_conv2', 'block3_conv3', 'block4_conv3', 'block5_conv3'), 'V...
0
1
0
0
1
0
tools/assembly_graph/assembly_graph.py
AutodeskAILab/Fusion360GalleryDataset
193
1600562
<filename>tools/assembly_graph/assembly_graph.py import sys import json import argparse import time from pathlib import Path import numpy as np class AssemblyGraph(): """ Construct a graph representing an assembly with connectivity between visible B-Rep bodies with joints and contact surfaces """ ...
0
0
0
0
0
0
parse_args_dkf.py
clinicalml/structuredinference
273
1600586
<reponame>clinicalml/structuredinference """ Parse command line and store result in params Model : DKF """ import argparse,copy from collections import OrderedDict p = argparse.ArgumentParser(description="Arguments for variational autoencoder") parser = argparse.ArgumentParser() parser.add_argument('-dset','--dataset',...
0
0
0
0
0
0
Codeforces/GCD Sum/solution.py
rsrahul1000/Hack-CP-DSA
205
1600590
import math # Input number of test cases. t = int(input()) for _ in range(t): # Input integer value. n = int(input()) # Iterate until the GCD Sum became greater than 1. while True: s = 0 val = n # Loop to calculate the sum of digits. It removes last digit in one iteration. ...
0
0
0
0
0
0
armada_backend/api_ssh.py
firesoft/armada
281
1600612
import socket from armada_backend import api_base from armada_backend.hermes_init import HERMES_DIRECTORY from armada_backend.utils import get_container_ssh_address class SshAddress(api_base.ApiCommand): def on_get(self, req, resp) -> object: container_id, error = self.get_get_parameter(req, 'container_i...
0
2
0
0
2
0
setup.py
laggingreflex/swiggy-analytics
204
1600689
#!/usr/bin/env python from os import path from setuptools import find_packages, setup # read the contents of your README file def read_readme() -> object: this_directory = path.abspath(path.dirname(__file__)) with open(path.join(this_directory, 'README.md'), encoding='utf-8') as f: return f.read() ...
0
2
0
0
2
0
tests/request_methods/test_subscriptions.py
1Blackdiamondsc/python-amazon-mws
370
1600702
"""Tests for the Subscriptions API class.""" import unittest import mws from .utils import CommonAPIRequestTools class SubscriptionsTestCase(CommonAPIRequestTools, unittest.TestCase): """Test cases for Subscriptions.""" api_class = mws.Subscriptions # TODO: Add remaining methods for Subscriptions
0
0
0
0
0
0
cpmpy/diet1.py
tias/hakank
279
1600712
<gh_stars>100-1000 """ Diet problem in cpmpy. Standard Operations Research example. Minimize the cost for the products: Type of Calories Chocolate Sugar Fat Food (ounces) (ounces) (ounces) Chocolate Cake (1 slice) 400 3 ...
0
0
0
0
0
0
test_files/event_file.py
KinSai1975/Menira.py
118
1600740
from pylons.events import NewRequest, NewResponse, subscriber @subscriber(NewRequest) def add_reggy(event): event.request.reg = True @subscriber(NewResponse) def add_respy(event): event.response.reg = True
0
0
0
0
0
0
TexSoup/tokens.py
pablo-angulo/TexSoup
190
1600751
<reponame>pablo-angulo/TexSoup<gh_stars>100-1000 """Tokenization for all input. Translates string into iterable `TexSoup.utils.Buffer`, yielding one token at a time. """ from TexSoup.utils import to_buffer, Buffer, Token, CC from TexSoup.data import arg_type from TexSoup.category import categorize # used for tests f...
0
0
0
0
0
0
lamvery/clients/apigateway.py
rdtr/lamvery
101
1600764
<filename>lamvery/clients/apigateway.py<gh_stars>100-1000 # -*- coding: utf-8 -*- import botocore import json from lamvery.clients.base import BaseClient class ApiGatewayClient(BaseClient): def __init__(self, *args, **kwargs): super(ApiGatewayClient, self).__init__(*args, **kwargs) self._api = ...
0
0
0
0
0
0
tests/components/todoist/test_calendar.py
MrDelik/core
30,023
1600796
<reponame>MrDelik/core """Unit tests for the Todoist calendar platform.""" from datetime import datetime from homeassistant.components.todoist.calendar import _parse_due_date from homeassistant.components.todoist.types import DueDate from homeassistant.util import dt def test_parse_due_date_invalid(): """Test No...
0
0
0
0
0
0
electrumsv/tests/test_wallet_database_async.py
electrumsv/electrumsv
136
1600818
<gh_stars>100-1000 """ Test: * :class:`electrumsv.wallet_database.sqlite_support.SqliteExecutor`. * . . . """ import os try: # Linux expects the latest package version of 3.35.4 (as of pysqlite-binary 0.4.6) import pysqlite3 as sqlite3 except ModuleNotFoundError: # MacOS has latest brew version of 3.3...
0
0
0
0
0
0
index/forms.py
judexzhu/dzhops
202
1600837
<reponame>judexzhu/dzhops<filename>index/forms.py # -*- coding: utf-8 -*- from django import forms class UploadFileForm(forms.Form): ''' Upload user picture for profile web. ''' file = forms.FileField(required=False) class ChangePasswordForms(forms.Form): ''' change password for user; '''...
0
0
0
0
0
0
orttraining/orttraining/python/training/ortmodule/experimental/json_config/__init__.py
lchang20/onnxruntime
6,036
1600869
<reponame>lchang20/onnxruntime # Copyright (c) Microsoft Corporation. All rights reserved. # Licensed under the MIT License. # __init__.py # JSON global constants goes here JSON_PATH_ENVIRONMENT_KEY = "ORTMODULE_JSON_CONFIG_PATH" from ._load_config_from_json import load_from_json
0
0
0
0
0
0
hanlp/datasets/parsing/ptb.py
antfootAlex/HanLP
27,208
1600871
<reponame>antfootAlex/HanLP # -*- coding:utf-8 -*- # Author: hankcs # Date: 2020-02-17 15:46 _PTB_HOME = 'https://github.com/KhalilMrini/LAL-Parser/archive/master.zip#data/' PTB_TRAIN = _PTB_HOME + '02-21.10way.clean' '''Training set of PTB without empty categories. PoS tags are automatically predicted using 10-fold ...
0
0
0
0
0
0
recipes/Python/360649_Remote_Shutdown_on_Windows/recipe-360649.py
tdiprima/code
2,023
1600880
<reponame>tdiprima/code #!/usr/bin/env python # win32shutdown.py import win32api import win32con import win32netcon import win32security import win32wnet def shutdown(host=None, user=None, passwrd=None, msg=None, timeout=0, force=1, reboot=0): """ Shuts down a remote computer, requires NT-BASED OS. ...
0
0
0
0
0
0
oscarapi/tests/__init__.py
dhaker-ramnivas/ecomAPI
311
1600946
<reponame>dhaker-ramnivas/ecomAPI """ These tests should pass nomatter in which application the oscarapi app is being used. """
0
0
0
0
0
0
chapter12-segmentation/utils/generate_gt_segmentation.py
gabrielmahia/obamAI
1,291
1601021
''' Pretty print: python3 -m json.tool < some.json ''' import json import argparse import os import numpy as np import cv2 import matplotlib.pyplot as plt def load_json(data_path, jsfile) -> object: with open(os.path.join(data_path, jsfile), 'r') as f: js = json.load(f) return js def generate_d...
0
1
0
0
1
0
Packs/RegexReplace/Scripts/RegexReplace/RegexReplace.py
diCagri/content
799
1601037
import re import demistomock as demisto from CommonServerPython import * # noqa: F401 args = demisto.args() flags = 0 if argToBoolean(args.get('ignore_case', False)): flags |= re.IGNORECASE input_text = args['value'] pattern = re.compile(r'{}'.format(args['regex']), flags=flags) output_text = pattern.sub(args...
0
0
0
0
0
0
SI.py
chenxli/GA-SA-TSP
201
1601043
import random import numpy as np import math location=np.loadtxt('city_location.txt') num_ant=200 #蚂蚁个数 num_city=30 #城市个数 alpha=1 #信息素影响因子 beta=1 #期望影响因子 info=0.1 #信息素的挥发率 Q=1 #常数 count_iter = 0 iter_max = 500 #dis_new=1000 #========================================== #对称矩阵,两个城市之间的距离 def distance_p...
0
2
0
0
2
0
scene_flow_kitti/camera_params.py
HarmoniaLeo/meteornet
127
1601050
<filename>scene_flow_kitti/camera_params.py<gh_stars>100-1000 ''' Camera params of KITTI Author: <NAME> Date: Dec 2019 ''' import numpy as np R_rect_00 = {} P_rect_00 = {} P_rect_01 = {} P_rect_02 = {} P_rect_03 = {} Tr_velo_to_cam = {} R_cam_to_rect = {} P_velo_to_img = {} baseline = {} focal_length = {} # 2011...
0
0
0
0
0
0
scripts/symcryptasm_processor.py
microsoft/SymCrypt
170
1601054
<reponame>microsoft/SymCrypt<filename>scripts/symcryptasm_processor.py #!/usr/bin/env python3 """ This script enables processing of symcryptasm files so that they can be assembled in a variety of environments without requiring forking or duplication of source files - symcryptasm files phrase assembly in an assembler an...
0
0
0
0
0
0
humor/fitting/viz_fitting_rgb.py
ZhengyiLuo/humor
143
1601070
''' Visualization for RGB results. ''' import sys, os cur_file_path = os.path.dirname(os.path.realpath(__file__)) sys.path.append(os.path.join(cur_file_path, '..')) import importlib, time, math, shutil, csv, random import numpy as np import cv2 import torch import torch.nn as nn from torch.utils.data import Dataset...
0
1
0
0
1
0
docs/user_guide/examples/write_manifest.py
siliconcompiler/siliconcompiler
424
1601082
import siliconcompiler chip = siliconcompiler.Chip('hello_world') chip.write_manifest('hello_world.json')
0
0
0
0
0
0
english/probabilistic_machine_learning/em_multivariate_gmm.py
bartdavids/machine-learning-and-simulation
110
1601085
import tensorflow as tf import tensorflow_probability as tfp from tqdm import tqdm import matplotlib.pyplot as plt def em(dataset, n_clusters, n_iter: int=100) -> tuple[object, object, object]: # Infer from the dataset n_samples, n_dims = dataset.shape # Draw initial guesses cluster_probs = tfp.distri...
1
1
0
0
2
0
nbgrader/tests/preprocessors/test_deduplicateids.py
FrattisUC/nbgrader
1,116
1601132
<filename>nbgrader/tests/preprocessors/test_deduplicateids.py import pytest from nbformat.v4 import new_notebook from ...preprocessors import DeduplicateIds from .base import BaseTestPreprocessor from .. import ( create_grade_cell, create_solution_cell, create_locked_cell) @pytest.fixture def preprocessor(): ...
0
0
0
0
0
0
poet/repositories/pypi_repository.py
sdispater/poet
367
1601157
# -*- coding: utf-8 -*- from __future__ import annotations import requests from pip.models import PyPI try: from xmlrpc.client import ServerProxy except ImportError: from xmlrpclib import ServerProxy from semantic_version import Version from ..version_parser import VersionParser from ..package import Packag...
2
3
2
0
7
0
capstone/capdb/migrations/0034_auto_20180413_1855.py
rachelaus/capstone
134
1601169
# Generated by Django 2.0.2 on 2018-04-13 18:55 from django.db import migrations, models class Migration(migrations.Migration): dependencies: list[tuple[str, str]] = [ ('capdb', '0033_auto_20180409_2117'), ] operations: list[object] = [ migrations.AddIndex( model_name='casem...
0
0
2
0
2
0
segmentation/evaluation/coco_instance.py
RajasekharChowdary9/panoptic-deeplab
506
1601224
<reponame>RajasekharChowdary9/panoptic-deeplab<gh_stars>100-1000 # ------------------------------------------------------------------------------ # Reference: https://github.com/facebookresearch/detectron2/blob/master/detectron2/evaluation/coco_evaluation.py # Modified by <NAME> (<EMAIL>) # ----------------------------...
0
0
0
0
0
0
load_data.py
weihangzhang/EAkit
102
1601235
#!/usr/bin/env python3 # -*- coding: utf-8 -*- """ File name: load_data.py Author: locke Date created: 2020/3/25 下午7:00 """ import time import numpy as np class AlignmentData: def __init__(self, data_dir="data/DBP15K/ja_en", rate=0.3, share=False, swap=False, val=0.0, with_r=False): t_ =...
0
0
0
0
0
1
tests/utils.py
sasasasasas2/seasnake
156
1601247
<filename>tests/utils.py<gh_stars>100-1000 from __future__ import unicode_literals import contextlib from io import StringIO import sys import traceback from unittest import TestCase from seasnake.parser import CodeConverter @contextlib.contextmanager def capture_output(redirect_stdout=True, redirect_stderr=True): ...
0
0
0
0
0
0
examples/miniapps/asyncio-daemon/monitoringdaemon/http.py
whysage/python-dependency-injector
1,997
1601275
<reponame>whysage/python-dependency-injector<gh_stars>1000+ """Http client module.""" from aiohttp import ClientSession, ClientTimeout, ClientResponse class HttpClient: async def request(self, method: str, url: str, timeout: int) -> ClientResponse: async with ClientSession(timeout=ClientTimeout(timeout)...
0
0
0
0
0
0
audio_nets/ds_cnn.py
manipopopo/TC-ResNet
185
1601278
from collections import namedtuple from functools import partial import tensorflow as tf slim = tf.contrib.slim _DEFAULT = { "type": None, # ["conv", "separable"] "kernel": [3, 3], "stride": [1, 1], "depth": None, "scope": None, } _Block = namedtuple("Block", _DEFAULT.keys()) Block = partial(_...
1
4
0
0
5
0
beginning/update.py
Rod-O/Deviot
327
1601282
#!/usr/bin/env python # -*- coding: utf-8 -*- from __future__ import annotations from __future__ import absolute_import from re import sub import sublime_plugin from ..api import deviot from ..libraries.messages import Messages from ..libraries.thread_progress import ThreadProgress class DeviotCheckPioUpdatesComma...
0
2
0
2
4
0
mnist/DecoyMNIST/01_train_all.py
laura-rieger/deep-explanation-penalization
105
1601309
<gh_stars>100-1000 import itertools from slurmpy import Slurm import os #partition = 'low' # sweep different ways to initialize weights params_to_vary = { 'seed': [x for x in range(5)], 'regularizer_rate': [1, 10, 100, 1000, 10000], 'grad_method': [0,1,2] } ks = [x for x in ...
0
0
0
0
0
0
Intro_to_Recommendation_Systems/DeepRecommender/run.py
NunoEdgarGFlowHub/sciblog_support
668
1601311
# Copyright (c) 2017 NVIDIA Corporation # NOTE from Miguel: The code is the same as in https://github.com/NVIDIA/DeepRecommender/blob/master/run.py # but I removed the logger import os import torch import argparse from reco_encoder.data import input_layer from reco_encoder.model import model import torch.optim as opti...
0
1
0
0
1
0
tests/r/test_nlschools.py
hajime9652/observations
199
1601314
from __future__ import absolute_import from __future__ import division from __future__ import print_function import shutil import sys import tempfile from observations.r.nlschools import nlschools def test_nlschools(): """Test module nlschools.py by downloading nlschools.csv and testing shape of extracted d...
0
0
0
0
0
0
python/mesh/generic/command.py
MinesJA/meshNetwork
133
1601389
from struct import pack from mesh.generic.nodeHeader import headers, createHeader, packHeader from mesh.generic.cmdDict import CmdDict from mesh.generic.customExceptions import CommandIdNotFound class Command(object): def __init__(self, cmdId, cmdData, header: list[object]=[], txInterval: list[object]=[], lastTxTi...
5
3
0
1
9
0
examples/property_prediction/pretrain_gnns/chem/utils.py
mufeili/dgl-lifesci
390
1601407
<filename>examples/property_prediction/pretrain_gnns/chem/utils.py # -*- coding: utf-8 -*- import torch import dgl from dgllife.utils import ScaffoldSplitter, RandomSplitter def find_neighbor_edges(g, node_id): """Given a node with its graph, return all the edges connected to that node.""" predecessors = g.pr...
0
0
0
0
0
0
tests/plugins/test_hooks.py
wongearl/kube-hunter
3,521
1601427
from kube_hunter.plugins import hookimpl return_string = "return_string" @hookimpl def parser_add_arguments(parser) -> object: return return_string @hookimpl def load_plugin(args) -> object: return return_string
0
2
0
0
2
0
10-Embedding/embedding.py
SafinaM/boost-python-examples
794
1601441
<gh_stars>100-1000 print ("Object was %s."%precreated_object)
0
0
0
0
0
0
koalixcrm/crm/product/price.py
Cataldir/koalixcrm
290
1601466
<filename>koalixcrm/crm/product/price.py # -*- coding: utf-8 -*- from django.db import models from django.utils.translation import ugettext as _ from koalixcrm.crm.product.currency import Currency from koalixcrm.crm.product.unit import Unit from koalixcrm.crm.contact.customer_group import CustomerGroup from koalixcrm....
0
0
0
0
0
0
recipes/Python/579089_PythGpCgpCalculator_Annuniversity__forked/recipe-579089.py
tdiprima/code
2,023
1601472
<reponame>tdiprima/code class gpa_cgpa(object): arg1 = None arg2 = None subdata = None credits = None init_course = 0 init_credit =0 total_credit =0 temp = 0 def getcourse(self): self.arg1 = input("No of course you have registered:") pas...
0
0
0
0
0
0
src/alfred_google/__init__.py
zct/Google-Alfred3-Workflow
274
1601475
from gsearch import search
0
0
0
0
0
0
application/models/order/logistic.py
mutalisk999/bibi
1,037
1601495
# -*- coding: utf-8 -*- from __future__ import annotations import math import random import datetime import hashlib from flask_login import current_user from configs.enum import LOG_STATS from configs.order_status import SHIPPING_HISTORY import configs.signals as Signals from configs.enum import PAYMENT_TYPE from appli...
1
17
3
0
21
0
tests/combined/test_connections.py
billboggs/elasticsearch-HQ
2,026
1601510
__author__ = 'royrusso' import pytest pytest_plugins = ["docker_compose"] @pytest.mark.hq_ops def test_get_clusters(fixture): fixture.clear_all_clusters() response = fixture.app.get('/api/clusters') assert 200 == response.status_code res = fixture.get_response_data(response) assert res['data']...
0
0
0
0
0
0
test/regexp/fregexp1.py
kylebarron/MagicPython
1,482
1601525
<filename>test/regexp/fregexp1.py<gh_stars>1000+ a = fr'[a-z]' a = Fr'[a-z]' a = rf'[a-z]' a = rF'[a-z]' a : source.python : source.python = : keyword.operator.assignment.python, source.python : source.python fr : source.python, storage.type.string.pyth...
0
0
0
0
0
0
setup.py
jam467/pyoo
105
1601526
<reponame>jam467/pyoo<filename>setup.py """ PyOO - Pythonic interface to Apache OpenOffice API (UNO) Copyright (c) 2016 Seznam.cz, a.s. """ from distutils.core import setup setup( name='pyoo', version='1.3.dev', description='Pythonic interface to Apache OpenOffice API (UNO)', long_description = ope...
0
0
0
0
0
0
CommonTools/ParticleFlow/python/ParticleSelectors/pfElectronsPtGt5_cfi.py
ckamtsikis/cmssw
852
1601527
<filename>CommonTools/ParticleFlow/python/ParticleSelectors/pfElectronsPtGt5_cfi.py import FWCore.ParameterSet.Config as cms pfElectronsPtGt5 = cms.EDFilter("PtMinPFCandidateSelector", src = cms.InputTag("pfAllElectrons"), ptMin = cms.double(5.0) )
0
0
0
0
0
0
notebooks/utils/metropolis_hastings.py
fabriquant/bayesian-model-evaluation
108
1601564
""" Metropolis Hastings example with simple model Inspired by <NAME>'s blog post https://twiecki.io/blog/2015/11/10/mcmc-sampling/ """ import numpy as np import scipy.stats as stats np.random.seed(0) N_mu_30_sd_1_data = stats.norm.rvs(loc=30, scale=1, size=1000).flatten() def mh_sampler(data, samples: int=4, mu_...
6
1
0
0
7
0
tests/ages_utils.py
calebwin/pipelines
353
1601589
def ages(): # read lines of data lines = [] with open('ages_data.csv') as f: lines = f.read().splitlines() # get numbers from strings ages = [int(age) for age in lines] for age in ages: yield age def age_segment(age) -> int: if age < 12: return 0 elif age < 18: return 1 elif age < 28: return 2 ...
0
2
0
0
2
0
voctocore/tests/videomix/test_videomixer_set_sources.py
0xflotus/voctomix
521
1601602
from tests.helper.voctomix_test import VoctomixTest from lib.videomix import VideoMix class VideomixerSetSources(VoctomixTest): def setUp(self): super().setUp() self.videomixer = VideoMix() def test_can_set_source_a(self): self.videomixer.setVideoSourceA(42) self.assertEqual(s...
0
0
0
0
0
0
server/shapes/management/commands/retriangulate_material_shapes.py
paulu/opensurfaces
137
1601608
<filename>server/shapes/management/commands/retriangulate_material_shapes.py from clint.textui import progress from django.core.management.base import BaseCommand from photos.models import Photo from shapes.models import MaterialShape from shapes.tasks import retriangulate_material_shapes_task class Command(BaseCom...
0
0
0
0
0
0
homeassistant/components/volvooncall/binary_sensor.py
MrDelik/core
30,023
1601784
"""Support for VOC.""" from __future__ import annotations from homeassistant.components.binary_sensor import DEVICE_CLASSES, BinarySensorEntity from homeassistant.core import HomeAssistant from homeassistant.helpers.entity_platform import AddEntitiesCallback from homeassistant.helpers.typing import ConfigType, Discove...
4
3
0
0
7
0
packages/pegasus-common/test/test_braindump.py
ahnitz/pegasus
127
1601804
import io from typing import Dict import attr import pytest from Pegasus.braindump import Braindump, dump, dumps, load, loads fields = attr.fields_dict(Braindump) @pytest.mark.parametrize( "s, obj", ( ("user: a", {"user": "a"}), ('user: "a"', {"user": "a"}), ('{"user": "a"}', {"user...
2
0
0
0
2
0
tests/conftest.py
riddopic/opta
595
1601814
<reponame>riddopic/opta from pytest import fixture from pytest_mock import MockFixture # Most commands require terraform init. Mock it here. @fixture(autouse=True) def mock_terraform_init(mocker: MockFixture) -> None: mocker.patch("opta.core.terraform.Terraform.init")
0
0
0
0
0
0
tests/__init__.py
nickatnight/praw
2,360
1601834
<filename>tests/__init__.py """PRAW Test Suite."""
0
0
0
0
0
0
modules/reportgen.py
nkrios/AutOSINT
168
1601842
<gh_stars>100-1000 #!/usr/bin/env python """module to generate a docx report based on osint findings""" #https://python-docx.readthedocs.io/en/latest/user/text.html #https://python-docx.readthedocs.io/en/latest/user/quickstart.html import time import docx from docx.shared import Pt from docx.shared import RGBColor fro...
0
0
0
0
0
0
example/flask/main.py
Ax1an/uptrace
627
1601843
#!/usr/bin/env python3 from flask import Flask from flask_sqlalchemy import SQLAlchemy from sqlalchemy import text from opentelemetry import trace from opentelemetry.instrumentation.flask import FlaskInstrumentor from opentelemetry.instrumentation.sqlalchemy import SQLAlchemyInstrumentor import uptrace uptrace.config...
0
2
0
0
2
0
recipes/Python/440657_Determine_functiexecutitime_Pythonic/recipe-440657.py
tdiprima/code
2,023
1601855
""" Determine function execution time. >>> def f(): ... return sum(range(10)) ... >>> pytime(f) (Time to execute function f, including function call overhead). >>> 1.0/pytime(f) (Function calls/sec, including function call overhead). >>> 1.0/pytime_statement('sum(range(10))') (Statements/sec, does not include...
0
0
0
0
0
0
test_chopsticks.py
gitter-badger/chopsticks
171
1601876
"""Exercise chopsticks serial APIs.""" from __future__ import print_function from chopsticks.tunnel import Tunnel, Local from chopsticks.facts import ip, python_version import time hosts = [ Tunnel('byzantium'), # Tunnel('office'), Local() ] for t in hosts: print('Time on %s:' % t.host, t.call(time.time...
0
0
0
0
0
0
dmb/data/datasets/utils/load_flow.py
jiaw-z/DenseMatchingBenchmark
160
1601942
<reponame>jiaw-z/DenseMatchingBenchmark import re import numpy as np import png def load_pfm(file_path): """ load image in PFM type. Args: file_path string: file path(absolute) Returns: data (numpy.array): data of image in (Height, Width[, 3]) layout scale (float): scale of ima...
0
0
0
0
0
0
rlcard/utils/__init__.py
randombenj/rlcard
1,735
1601957
<gh_stars>1000+ from rlcard.utils.logger import Logger from rlcard.utils import seeding from rlcard.utils.utils import *
0
0
0
0
0
0
ui/pypesvds/lib/extras/pdflib/arcfour.py
onfire73/pypeskg
117
1601966
#!/usr/bin/env python # # Arcfour implementation in Python # * public domain * # ## Arcfour ## class Arcfour(object): def __init__(self, key): s = range(256) j = 0 klen = len(key) for i in xrange(256): j = (j + s[i] + ord(key[i % klen])) % 256 (s[i], s[j]) = (s[j], s[i]) self.s...
0
0
0
0
0
0
hs_odm2/management/commands/odm2-query.py
tommac7/hydroshare
178
1601969
"""This prints all variable names matching a specific prefix * By default, prints errors on stdout. """ from django.core.management.base import BaseCommand from hs_odm2.models import ODM2Variable class Command(BaseCommand): help: str = "query ODM2 variable name database." def add_arguments(self, parser): ...
0
0
1
0
1
0
WebMirror/management/rss_parser_funcs/feed_parse_extractBlueSilverTranslations.py
fake-name/ReadableWebProxy
193
1601971
from __future__ import annotations def extractBlueSilverTranslations(item) -> bool | object | None: """ # Blue Silver Translations """ vol, chp, frag, postfix = extractVolChapterFragmentPostfix(item['title']) if not (chp or vol or frag) or 'preview' in item['title'].lower(): return None if 'Douluo Dalu' in ite...
0
1
0
0
1
0
modules/templates/historic/RLPPTM/tools/role_contacts.py
himansu1997/eden
205
1601997
<filename>modules/templates/historic/RLPPTM/tools/role_contacts.py<gh_stars>100-1000 # -*- coding: utf-8 -*- # # Helper Script to get a list of organisation contacts (email addresses) # with a certain user role # # RLPPTM Template Version 1.5 # # Execute in web2py folder after code upgrade like: # python web2py.py -S e...
0
0
0
0
0
0
aurora/nn/__init__.py
upul/Aurora
111
1602031
<gh_stars>100-1000 from .activations import relu from .activations import sigmoid from .activations import softmax from .loss_functions import softmax_cross_entropy_with_logits from .utils import softmax_func from .conv import conv2d from .pooling import maxPool __all__ = ['relu', 'sigmoid', 'softmax', 'softmax_cross_...
0
0
0
0
0
0
proxypool/exceptions/__init__.py
lixinjiang/ProxyPool
3,584
1602050
<reponame>lixinjiang/ProxyPool from .empty import PoolEmptyException
0
0
0
0
0
0
4_trainSVM.py
cubean/ImageSimilarityUsingCntk
130
1602051
# -*- coding: utf-8 -*- from helpers import * locals().update(importlib.import_module("PARAMETERS").__dict__) #################################### # Main #################################### random.seed(0) ImageInfo.allFeatures = loadFromPickle(featuresPath) # Load all DNN image features into memory # Load training...
0
0
0
0
0
0
tests/unit/test_blueprints.py
michaszcz/procrastinate
215
1602052
<reponame>michaszcz/procrastinate import pytest from procrastinate import blueprints, exceptions, retry def test_blueprint_task_aliases(blueprint, mocker): @blueprint.task(name="b", aliases=["c", "d"]) def my_task(): pass assert "b" == blueprint.tasks["b"].name assert ["c", "d"] == blueprint...
0
0
0
0
0
0
models/ffn_lae.py
MilesQLi/Theano-Lights
313
1602055
import theano import theano.tensor as T from theano.sandbox.rng_mrg import MRG_RandomStreams from theano.tensor.nnet.conv import conv2d from theano.tensor.signal.downsample import max_pool_2d from theano.tensor.shared_randomstreams import RandomStreams import numpy as np from toolbox import * from modelbase import * ...
0
0
0
0
0
0
respeaker/player.py
MaoHasan/respeaker_python_library
144
1602093
<filename>respeaker/player.py """ ReSpeaker Python Library Copyright (c) 2016 Seeed Technology Limited. 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/LICE...
0
0
0
0
0
0
src/anyconfig/common/__init__.py
ssato/python-anyconfig
213
1602118
<reponame>ssato/python-anyconfig # # Copyright (C) 2021 <NAME> <<EMAIL>> # SPDX-License-Identifier: MIT # r"""misc global constants, variables, classes and so on. """ from .datatypes import ( InDataT, InDataExT, PrimitiveT ) from .errors import ( UnknownParserTypeError, UnknownProcessorTypeError, UnknownFileTyp...
0
0
0
0
0
0
test/test_languages/testES6.py
jackhj000/lizard
1,255
1602120
import unittest from lizard import analyze_file, FileAnalyzer, get_extensions from lizard_languages import JavaScriptReader def get_js_function_list(source_code) -> object: return analyze_file.analyze_source_code("a.js", source_code).function_list class Test_tokenizing_ES6(unittest.TestCase): def check_tok...
0
1
0
0
1
0
vibora/client/retries.py
brettcannon/vibora
6,238
1602136
<filename>vibora/client/retries.py class RetryStrategy: __slots__ = ('network_failures', 'responses') def __init__(self, network_failures: dict = None, responses: dict = None): """ :param network_failures: :param responses: """ # Although retry an operation after an ...
0
0
0
0
0
0
plenum/test/test_node_reg.py
andkononykhin/plenum
148
1602144
<filename>plenum/test/test_node_reg.py from unittest import TestCase from plenum.test.test_node import genNodeReg class TestNodeReg(TestCase): def test_genNodeReg(self): l = 10 nr = genNodeReg(count=l) cli = nr.extractCliNodeReg() # lengths are correct assert len(cli) == ...
0
0
0
0
0
0
source/hackertarget_api.py
RSecxxx/hackertarget
191
1602171
#!/usr/bin/env python # -*- coding: utf-8 -*- import requests def hackertarget_api(choice, target) -> object: request_urls = [ "https://api.hackertarget.com/mtr/?q=", "https://api.hackertarget.com/nping/?q=", "https://api.hackertarget.com/dnslookup/?q=", "https://api.hackertarget.c...
0
1
0
0
1
0
tests/urls.py
dv321/django-field-history
346
1602182
<filename>tests/urls.py from django.conf.urls import url from django.contrib import admin from . import views urlpatterns = [ url(r"^$", views.test_view, name="index"), url(r"^admin/", admin.site.urls), ]
0
0
0
0
0
0
cartoframes/viz/styles/color_category_style.py
CartoDB/cartoframes
236
1602220
<reponame>CartoDB/cartoframes from .utils import serialize_palette, get_value, prop from ..style import Style from ..legends import color_category_legend from ..widgets import category_widget from ..popups import popup_element def color_category_style(value, top=11, cat=None, palette=None, size=None, opacity=None, ...
0
0
0
0
0
0
dependencies/quex-0.34.1/quex/core_engine/state_machine/dumpster.py
lavrod/grit-engine
109
1602259
<gh_stars>100-1000 class CachedValue: def __init__(self): self.__value = None self.__valid_f = False def __call__(self): return __value def set(self, Value): self.__value = Value self.__valid_f = True def invalid(self): self.__valid_f = False de...
0
0
0
0
0
0
examples/pybullet/gym/pybullet_envs/minitaur/envs_v2/scenes/random_stepstone_scene.py
felipeek/bullet3
107
1602269
<gh_stars>100-1000 # Lint as: python3 """Scene with randomly spaced stepstones.""" from typing import Optional, Sequence import gin import numpy as np from pybullet_envs.minitaur.envs_v2.scenes import scene_base from pybullet_envs.minitaur.envs_v2.scenes.terrain import stepstones @gin.configurable class RandomStep...
0
0
0
0
0
0
unique_by_attr.py
serhii73/PyTricks
3,271
1602298
<gh_stars>1000+ #! /usr/bin/env python3 """ If we have some sequence of objects and want to remove items with the same attribute value Python creates a dict, where keys are value if attribute (bar in our case), values are object of the sequence. After that the dict is transformed back to list Note: in r...
0
0
0
0
0
0
src/python/grapl_analyzerlib/grapl_analyzerlib/view_from_proto.py
msilvey/grapl
313
1602304
from grapl_analyzerlib.grapl_client import GraphClient from grapl_analyzerlib.prelude import ( BaseView, ) from graplinc.grapl.api.graph.v1beta1.types_pb2 import MergedNode def view_from_proto(graph_client: GraphClient, node: MergedNode) -> BaseView: return BaseView( node.uid, node.node_key, ...
2
1
0
0
3
0
social/exceptions.py
raccoongang/python-social-auth
1,987
1602306
<gh_stars>1000+ from social_core.exceptions import SocialAuthBaseException, WrongBackend, \ MissingBackend, NotAllowedToDisconnect, AuthException, AuthFailed, \ AuthCanceled, AuthUnknownError, AuthTokenError, AuthMissingParameter, \ AuthStateMissing, AuthStateForbidden, AuthAlreadyAssociated, \ AuthToke...
0
0
0
0
0
0
mmtbx/command_line/real_space_diff_map.py
dperl-sol/cctbx_project
155
1602321
from __future__ import annotations from __future__ import absolute_import, division, print_function # LIBTBX_SET_DISPATCHER_NAME phenix.real_space_diff_map from scitbx.array_family import flex import sys import iotbx.pdb from libtbx.utils import Sorry import mmtbx.utils from cctbx import maptbx from cctbx import mille...
2
4
0
0
6
0
mtgjson5/classes/mtgjson_game_formats.py
0az/mtgjson
512
1602332
<filename>mtgjson5/classes/mtgjson_game_formats.py """ MTGJSON Singular Card.GameFormats Object """ from typing import List from mtgjson5.utils import to_camel_case class MtgjsonGameFormatsObject: """ MTGJSON Singular Card.GameFormats Object """ paper: bool mtgo: bool arena: bool shandal...
0
0
0
0
0
0
fastapi_admin/file_upload.py
myWorkshop123/fastapi-admin
636
1602349
import os from typing import Callable, List, Optional import aiofiles from starlette.datastructures import UploadFile from fastapi_admin.exceptions import FileExtNotAllowed, FileMaxSizeLimit class FileUpload: def __init__( self, uploads_dir: str, allow_extensions: Optional[List[str]] = N...
8
2
0
0
10
0
sympy/functions/combinatorial/__init__.py
ovolve/sympy
319
1602406
from . import factorials from . import numbers
0
0
0
0
0
0
unitest/test_chunk_data.py
HyeongminMoon/PatrickStar
494
1602438
# BSD 3-Clause License # # Copyright (C) 2021 THL A29 Limited, a Tencent company. All rights reserved. # # Redistribution and use in source and binary forms, with or without modification, # are permitted provided that the following conditions are met: # # * Redistributions of source code must retain the above copyrig...
0
0
0
0
0
0
aliyun-python-sdk-servicemesh/aliyunsdkservicemesh/request/v20200111/UpdateMeshFeatureRequest.py
yndu13/aliyun-openapi-python-sdk
1,001
1602478
<filename>aliyun-python-sdk-servicemesh/aliyunsdkservicemesh/request/v20200111/UpdateMeshFeatureRequest.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. ...
0
0
0
0
0
0
EmotionDetection/EmotionDetectorUtils.py
shekkizh/TensorflowProjects
204
1602516
<gh_stars>100-1000 __author__ = 'Charlie' import pandas as pd import numpy as np import os, sys, inspect from six.moves import cPickle as pickle import scipy.misc as misc IMAGE_SIZE = 48 NUM_LABELS = 7 VALIDATION_PERCENT = 0.1 # use 10 percent of training images for validation IMAGE_LOCATION_NORM = IMAGE_SIZE / 2 n...
0
0
0
0
0
0
prody/tests/utilities/test_checkers.py
grandevelia/ProDy
210
1602525
<reponame>grandevelia/ProDy from prody.tests import TestCase from numpy.random import random from numpy.testing import assert_equal from prody.utilities import checkCoords, checkTypes COORDS = random((10, 3))*10 COORDSET = random((2, 10, 3))*10 class TestCheckCoords(TestCase): def testInvalidCoords(self): ...
0
0
0
0
0
0
elfi/examples/bdm.py
diadochos/elfi
166
1602531
<reponame>diadochos/elfi """The model used in Lintusaari et al. 2016 with summary statistic T1. References ---------- - <NAME>, <NAME>, <NAME>, <NAME>, <NAME>; Fundamentals and Recent Developments in Approximate Bayesian Computation. Syst Biol 2017; 66 (1): e66-e82. doi: 10.1093/sysbio/syw077 """ import os impor...
0
0
0
0
0
0
tests/cli/test_job.py
qixiang/atomic-reactor
113
1602532
""" Copyright (c) 2021 Red Hat, Inc All rights reserved. This software may be modified and distributed under the terms of the BSD license. See the LICENSE file for details. """ from flexmock import flexmock from textwrap import dedent from atomic_reactor.cli import job from atomic_reactor.utils.remote_host import Re...
0
0
0
0
0
0
homeassistant/components/gitlab_ci/__init__.py
domwillcode/home-assistant
30,023
1602589
"""The gitlab_ci component."""
0
0
0
0
0
0
examples/other/morphomatics_tube.py
evanphilip/vedo
836
1602629
<filename>examples/other/morphomatics_tube.py # Git repo at : https://morphomatics.github.io/tutorial_ssm/ # Install with: # pip install git+https://github.com/morphomatics/morphomatics.git#egg=morphomatics # from morphomatics.geom import Surface from morphomatics.stats import StatisticalShapeModel from morphomatics.m...
0
0
0
0
0
0