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
package_settings.py
edwardmjackson/cape-frontend
164
11141279
# Copyright 2018 BLEMUNDSBURY AI 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/LICENSE-2.0 # # Unless required by applicable law or agreed to ...
env/lib/python3.8/site-packages/faker/providers/person/tr_TR/__init__.py
avdhari/enigma
258
11141284
<gh_stars>100-1000 # coding=utf-8 from __future__ import unicode_literals from .. import Provider as PersonProvider class Provider(PersonProvider): formats_female = ( '{{first_name_female}} {{last_name}}', '{{first_name_female}} {{first_name_female}} {{last_name}}', '{{first_name_female}} ...
spokestack/io/sound_device.py
spokestack/spokestack-python
139
11141285
"""Audio input component based on the sounddevice library.""" from typing import Any import numpy as np import sounddevice as sd class SoundDeviceInput: """ Audio input source using sounddevice. Parameters ---------- sample_rate (Hz): int, optional audio sample rate, by default 16000 ...
torchshard/__init__.py
KaiyuYue/torchshard
265
11141298
# TorchShard Version __version__ = "0.1.0" # Python Version import sys if sys.version_info < (3,): raise Exception("Python 2 has reached end-of-life and is NOT supported by TorchShard.") # PyTorch Version import torch TORCH_VERSION = tuple(int(x) for x in torch.__version__.split(".")[:2]) from torch import Tenso...
tests/entities/test_view_type.py
freefrag/mlflow
10,351
11141302
from mlflow.protos import service_pb2 from mlflow.entities import ViewType def test_to_proto(): assert ViewType.to_proto(ViewType.ACTIVE_ONLY) == service_pb2.ACTIVE_ONLY assert ViewType.to_proto(ViewType.DELETED_ONLY) == service_pb2.DELETED_ONLY assert ViewType.to_proto(ViewType.ALL) == service_pb2.ALL ...
tests/test_basics.py
sonvt1710/bigjson
153
11141319
from io import BytesIO from unittest import TestCase import bigjson JSON_FILE = b""" { "string": "blah", "number": 123, "true": true, "false": false, "null": null, "array": [1, 2, 3], "object": { "x": "y" } } """ class TestBasics(TestCase): def test_basics(self): ...
tests/data/expected/main/all_of_ref/output.py
adaamz/datamodel-code-generator
891
11141324
<reponame>adaamz/datamodel-code-generator # generated by datamodel-codegen: # filename: test.json # timestamp: 2019-07-26T00:00:00+00:00 from __future__ import annotations from pydantic import BaseModel, Field class First(BaseModel): second: str = Field(..., description='Second', examples=['second']) cla...
pyswarms/backend/topology/pyramid.py
goncalogteixeira/pyswarns
959
11141351
<reponame>goncalogteixeira/pyswarns # -*- coding: utf-8 -*- """ A Pyramid Network Topology This class implements a pyramid topology. In this topology, the particles are connected by N-dimensional simplices. """ # Import standard library import logging # Import modules import numpy as np from scipy.spatial import De...
examples/fragments/server_upgrade_fragment.py
python-hyper/h2
102
11141382
<reponame>python-hyper/h2 # -*- coding: utf-8 -*- """ Server Plaintext Upgrade ~~~~~~~~~~~~~~~~~~~~~~~~ This example code fragment demonstrates how to set up a HTTP/2 server that uses the plaintext HTTP Upgrade mechanism to negotiate HTTP/2 connectivity. For maximum explanatory value it uses the synchronous socket API...
pymc4/mcmc/tf_support.py
mailology/pymc4
789
11141389
<filename>pymc4/mcmc/tf_support.py<gh_stars>100-1000 import functools import collections import numpy as np import tensorflow as tf from tensorflow_probability.python.mcmc import kernel as kernel_base from tensorflow_probability.python.mcmc.internal import util as mcmc_util CompoundGibbsStepResults = collections.name...
examples/sandbox/sandbox/particles.py
salt-die/nurses_2
171
11141404
from abc import ABC, abstractmethod import asyncio from enum import Enum from itertools import cycle import numpy as np from nurses_2.colors import Color random = np.random.default_rng().random class State(Enum): """ Element states. """ GAS = "GAS" LIQUID = "LIQUID" SOLID = "SOLID" class ...
src/opendr/simulation/human_model_generation/pifu_generator_learner.py
ad-daniel/opendr
217
11141435
# Copyright 2020-2022 OpenDR European Project # # 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 agree...
projects/Python/proto/__init__.py
Corfucinas/FastBinaryEncoding
563
11141442
# Automatically generated by the Fast Binary Encoding compiler, do not modify! # https://github.com/chronoxor/FastBinaryEncoding # Source: FBE # Version: 1.8.0.0
sonarqube/community/auth.py
ckho-wkcda/python-sonarqube-api
113
11141447
<gh_stars>100-1000 #!/usr/bin/env python # -*- coding:utf-8 -*- # @Author: <NAME> from sonarqube.utils.rest_client import RestClient from sonarqube.utils.config import ( API_AUTH_LOGIN_ENDPOINT, API_AUTH_LOGOUT_ENDPOINT, API_AUTH_VALIDATE_ENDPOINT, ) from sonarqube.utils.common import GET, POST class Sona...
bin/opensfm_main.py
ricklentz/OpenSfM
2,535
11141453
<gh_stars>1000+ import sys from os.path import abspath, join, dirname sys.path.insert(0, abspath(join(dirname(__file__), ".."))) import contextlib from typing import Generator from opensfm import commands from opensfm.dataset import DataSet @contextlib.contextmanager def create_default_dataset_context( dataset...
demo_embeddings_pca.py
shettyprithvi/scattertext
1,823
11141463
<gh_stars>1000+ import scattertext as st import pandas as pd from sklearn.feature_extraction.text import TfidfTransformer from scipy.sparse.linalg import svds convention_df = st.SampleCorpora.ConventionData2012.get_data() convention_df['parse'] = convention_df['text'].apply(st.whitespace_nlp_with_sentences) corpus = (...
pytorch_neat/multi_env_eval.py
GPittia/PyTorch-NEAT
486
11141468
# Copyright (c) 2018 Uber Technologies, 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 ag...
parlai/mturk/tasks/personachat/personachat_rephrase/task_config.py
mohan-chinnappan-n/ParlAI
163
11141493
#!/usr/bin/env python3 # Copyright (c) Facebook, Inc. and its affiliates. # This source code is licensed under the MIT license found in the # LICENSE file in the root directory of this source tree. task_config = {} """A short and descriptive title about the kind of task the HIT contains. On the Amazon Mechanical Tur...
pythran/tests/openmp.legacy/omp_for_lastprivate.py
davidbrochart/pythran
1,647
11141501
def omp_for_lastprivate(): sum = 0 i0 = -1 LOOPCOUNT = 1000 if 'omp parallel': sum0 = 0 'omp for schedule(static,7) lastprivate(i0)' for i in range(1, LOOPCOUNT + 1): sum0 += i i0 = i 'omp critical' sum+=sum0 known_sum = (LOOPCOUNT * (L...
test/import_test.py
jjcbsn/mbed-cli
351
11141511
<filename>test/import_test.py # Copyright (c) 2016 ARM Limited, All Rights Reserved # SPDX-License-Identifier: Apache-2.0 # 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.or...
tests/waves_test.py
fakegit/DEXBot
249
11141541
from dexbot.strategies.external_feeds.process_pair import filter_bit_symbol, filter_prefix_symbol, split_pair from dexbot.strategies.external_feeds.waves_feed import get_waves_price """ This is the unit test for getting external feed data from waves DEX. """ if __name__ == '__main__': symbol = 'BTC/USD' # quote...
tushe.py
hebi123/tupianpubuliu
137
11141556
<gh_stars>100-1000 # -*- coding:utf-8 -*- from app import app, login_manager from flask.ext.admin import Admin from flask.ext.admin.contrib.fileadmin import FileAdmin from views import light_cms from wc import wc from admin_views import UserView, IndexView, GeneralView from models import User, Image, Gallery import set...
rpython/jit/backend/llsupport/test/test_gc_integration.py
nanjekyejoannah/pypy
333
11141575
<filename>rpython/jit/backend/llsupport/test/test_gc_integration.py<gh_stars>100-1000 """ Tests for register allocation for common constructs """ import py import re, sys, struct from rpython.jit.metainterp.history import TargetToken, BasicFinalDescr,\ JitCellToken, BasicFailDescr, AbstractDescr from rpython.jit...
bokeh/server/django/__init__.py
mabo-msf/bokeh
445
11141577
import six if six.PY2: raise ImportError("bokeh.server.django requires Python 3.x") from bokeh.util.dependencies import import_required import_required("django", "django is required by bokeh.server.django") import_required("channels", "The package channels is required by bokeh.server.django. " ...
examples/detection_file_conversions/scripts/json_to_kw18.py
Kitware/VAIME
127
11141584
import json import sys if len( sys.argv ) < 3 or len( sys.argv ) > 4: print "json_to_kw18.py [input_file] [output_file]" sys.exit(0) data = json.load( open( sys.argv[1] ) ) f = open( sys.argv[2], 'w' ) id_counter = 0; for frame in data["frames"]: print "Processing frame ID " + str( frame["frame_id"] ) for...
modules/nltk_contrib/classifier_tests/confusionmatrixtests.py
h4ck3rm1k3/NLP-project
123
11141594
# Natural Language Toolkit # # Author: <NAME> <<EMAIL> dot gh<EMAIL> at g<EMAIL> dot <EMAIL>> # # URL: <http://www.nltk.org/> # This software is distributed under GPL, for license information see LICENSE.TXT from nltk_contrib.classifier import confusionmatrix as cm from nltk_contrib.classifier.exceptions import system...
paas-ce/paas/paas/app_env/tests.py
renmcc/bk-PaaS
767
11141615
# -*- coding: utf-8 -*- """ Tencent is pleased to support the open source community by making 蓝鲸智云PaaS平台社区版 (BlueKing PaaS Community Edition) available. Copyright (C) 2017-2018 THL A29 Limited, a Tencent company. All rights reserved. Licensed under the MIT License (the "License"); you may not use this file except in co...
python/kwiver/sprokit/tests/sprokit/pipeline/test-run.py
mwoehlke-kitware/kwiver
176
11141619
#!/usr/bin/env python #ckwg +28 # Copyright 2011-2020 by Kitware, Inc. # 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 copyright notice,...
telegram__telethon__examples/print_dialogs.py
DazEB2/SimplePyScripts
117
11141653
#!/usr/bin/env python3 # -*- coding: utf-8 -*- __author__ = 'ipetrash' # SOURCE: https://github.com/LonamiWebs/Telethon # SOURCE: https://my.telegram.org/apps # pip install telethon from telethon.sync import TelegramClient from config import API_ID, API_HASH with TelegramClient('my', API_ID, API_HASH) as client...
konoha/word_tokenizer.py
altescy/konoha
149
11141702
<reponame>altescy/konoha<gh_stars>100-1000 """Word Level Tokenizer.""" import warnings from typing import Dict from typing import List from typing import Optional import requests from konoha import word_tokenizers from konoha.data.resource import Resource from konoha.data.token import Token from konoha.word_tokenizer...
ch10/chart_3.py
ysy8971/book-cryptocurrency
121
11141719
<reponame>ysy8971/book-cryptocurrency import sys from PyQt5 import uic from PyQt5.QtWidgets import QWidget from PyQt5.QtGui import QPainter # ----------------- 추 가 ------------------ from PyQt5.QtChart import QLineSeries, QChart, QValueAxis, QDateTimeAxis from PyQt5.QtCore import Qt, QDateTime # -----------------------...
tests/unit/manage/test_tasks.py
fairhopeweb/warehouse
3,103
11141746
# 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, software # distributed under the Li...
vimfiles/bundle/vim-python/submodules/pylint/tests/functional/e/e1101_9588_base_attr_aug_assign.py
ciskoinch8/vimrc
463
11141749
<gh_stars>100-1000 # pylint: disable=too-few-public-methods, useless-object-inheritance """ False positive case of E1101: The error is triggered when the attribute set in the base class is modified with augmented assignment in a derived class. https://www.logilab.org/ticket/9588 """ __revision__ = 0 class BaseClass(...
10_pipeline/airflow/wip/src/dag_ml_pipeline_amazon_video_reviews.py
dpai/workshop
2,327
11141779
from __future__ import print_function import json import requests from datetime import datetime # airflow operators import airflow from airflow.models import DAG from airflow.utils.trigger_rule import TriggerRule from airflow.operators.python_operator import BranchPythonOperator from airflow.operators.dummy_operator i...
SymbolExtractorAndRenamer/lldb/packages/Python/lldbsuite/test/python_api/lldbutil/process/TestPrintStackTraces.py
Polidea/SiriusObfuscator
427
11141825
<reponame>Polidea/SiriusObfuscator """ Test SBprocess and SBThread APIs with printing of the stack traces using lldbutil. """ from __future__ import print_function import os import time import re import lldb from lldbsuite.test.decorators import * from lldbsuite.test.lldbtest import * from lldbsuite.test import lldb...
lib/twisted/plugins/carbon_cache_plugin.py
hessu/carbon
961
11141855
<reponame>hessu/carbon from zope.interface import implementer from twisted.plugin import IPlugin from twisted.application.service import IServiceMaker from carbon import conf @implementer(IServiceMaker, IPlugin) class CarbonCacheServiceMaker(object): tapname = "carbon-cache" description = "Collect stats fo...
scripts/squash_typos.py
uga-rosa/neovim
48,021
11141878
#!/usr/bin/env python """ This script squashes a PR tagged with the "typo" label into a single, dedicated "squash PR". """ import subprocess import sys import os def get_authors_and_emails_from_pr(): """ Return all contributing authors and their emails for the PR on current branch. This includes co-au...
cantoolz/modules/vircar/ecu_switch.py
The-Cracker-Technology/CANToolz
194
11141892
import copy from cantoolz.module import CANModule class ecu_switch(CANModule): name = "CAN Switch" help = """ This module emulating CAN Switch. Init params (example): { 'Cabin': { # From Cabin interface 'OBD2':[ # To OBD2 allowed next ID 0x...
networkx/algorithms/tests/test_threshold.py
armando1793/networkx
184
11141907
<gh_stars>100-1000 #!/usr/bin/env python """ Threshold Graphs ================ """ from nose.tools import assert_true, assert_false, assert_equal, assert_almost_equal, assert_raises from nose import SkipTest from nose.plugins.attrib import attr import networkx as nx import networkx.algorithms.threshold as nxt from net...
policy_v_network.py
VickeeX/D3RL-Learner
216
11141928
<gh_stars>100-1000 from networks import * class PolicyVNetwork(Network): def __init__(self, conf): """ Set up remaining layers, objective and loss functions, gradient compute and apply ops, network parameter synchronization ops, and summary ops. """ super(PolicyVNetwork, self).__...
homophonous_logography/hebrew/make_training.py
DionysisChristopoulos/google-research
23,901
11141933
<reponame>DionysisChristopoulos/google-research<filename>homophonous_logography/hebrew/make_training.py<gh_stars>1000+ # coding=utf-8 # Copyright 2021 The Google Research Authors. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You...
recipes/Python/576870_Creating_fake_data_using_numpy/recipe-576870.py
tdiprima/code
2,023
11141937
<gh_stars>1000+ from numpy.random import normal from scipy.stats import norm as normStat CRAZINESS = 0.1 MIN = 50 MAX = 300 STEP = 5 AVG = 180 DEV = 40 p = normStat(AVG, DEV).pdf def noise(): return 1 + CRAZINESS * normal(1) for x in range(MIN, MAX, STEP): print str(x), "\t", p(x) * noise()
tests/linter/impl.py
chadell/yangify
109
11141949
from typing import Any, Optional from yangify.parser import Parser, ParserData, RootParser from yangify.translator import RootTranslator, Translator class InterfaceConfigWarnings(Parser): class Yangify(ParserData): path = "/openconfig-interfaces:interfaces/interface/config" metadata = {"a": 1, "b...
tests/test_check.py
willemt/pearldb
120
11141951
<gh_stars>100-1000 import os import requests import signal import subprocess import unittest import time pearl_exe = 'build/pearl' pearl_url = 'http://127.0.0.1:8888' class TestDatabase(unittest.TestCase): def drop_db(self, name): drop = subprocess.Popen('{0} drop -P {1}'.format(pearl_exe, name), shell...
tutorials/W2D3_BiologicalNeuronModels/solutions/W2D3_Tutorial2_Solution_313f41e4.py
eduardojdiniz/CompNeuro
2,294
11141959
<reponame>eduardojdiniz/CompNeuro def my_CC(i, j): """ Args: i, j : two time series with the same length Returns: rij : correlation coefficient """ # Calculate the covariance of i and j cov = ((i - i.mean()) * (j - j.mean())).sum() # Calculate the variance of i var_i = ((i - i.mean()) * (i...
tests/test_utils.py
huihuilong/lyrebird
737
11141962
<filename>tests/test_utils.py<gh_stars>100-1000 from lyrebird import utils def test_case_insenstive_dict(): test_dict = utils.CaseInsensitiveDict({'Content-Type':'LBTests'}) assert test_dict.get('Content-Type') == 'LBTests' assert test_dict.get('content-type') == 'LBTests' test_dict = utils.CaseInsensi...
applications/tensorflow2/image_classification/test/test_model_editor.py
payoto/graphcore_examples
260
11141984
# Copyright (c) 2021 Graphcore Ltd. All rights reserved. import unittest from pathlib import Path import sys from tensorflow import keras import tensorflow as tf import numpy as np sys.path.append(str(Path(__file__).absolute().parent.parent)) from model.model_editor import ModelEditor class CopyModelWeightsTest(unit...
pytorch_toolkit/action_recognition/tests/test_video_reader.py
morkovka1337/openvino_training_extensions
256
11141990
<reponame>morkovka1337/openvino_training_extensions<filename>pytorch_toolkit/action_recognition/tests/test_video_reader.py from action_recognition.video_reader import make_video_reader, ImageDirReader, opencv_read_image, pil_read_image, \ accimage_read_image, VideoFileReader import numpy as np class TestMakeVideo...
venv/Lib/site-packages/~ybliometrics/scopus/utils/startup.py
arnoyu-hub/COMP0016miemie
186
11142016
<reponame>arnoyu-hub/COMP0016miemie<filename>venv/Lib/site-packages/~ybliometrics/scopus/utils/startup.py import configparser from collections import deque from os import environ from pathlib import Path from pybliometrics.scopus.utils.constants import RATELIMITS if 'PYB_CONFIG_FILE' in environ: CONFIG_FILE = env...
cubes/sql/store.py
digitalsatori/cubes
1,020
11142019
# -*- encoding=utf -*- from __future__ import absolute_import try: import sqlalchemy as sa import sqlalchemy.sql as sql from sqlalchemy.engine import reflection from sqlalchemy.orm.query import QueryContext from sqlalchemy.schema import Index except ImportError: from ..common import MissingPac...
python/backtracking/subset_sum.py
banerjeesoumya15/AlgoBook
191
11142031
def SubsetSum(set, n, sum) : # these are the base cases/corner cases which we need to handle explicitly if (sum == 0) : return True if (n == 0 and sum != 0) : return False # if last number is greater than sum, than we need to ignore it. if (set[n - 1] > sum) : return Subs...
saleor/graphql/order/tests/test_homepage.py
fairhopeweb/saleor
15,337
11142035
<filename>saleor/graphql/order/tests/test_homepage.py from datetime import date, timedelta from prices import Money from ...core.enums import ReportingPeriod from ...tests.utils import assert_no_permission, get_graphql_content def test_homepage_events(order_events, staff_api_client, permission_manage_orders): q...
robomimic/utils/macros.py
akolobov/robomimic
107
11142057
<filename>robomimic/utils/macros.py """ Set of global variables shared across robomimic """ # Sets debugging mode. Should be set at top-level script so that internal # debugging functionalities are made active DEBUG = False
emails/testsuite/loader/test_rfc822_loader.py
MrTango/python-emails
348
11142061
# encoding: utf-8 from __future__ import unicode_literals, print_function import glob import email import datetime import os.path from emails.compat import to_native import emails.loader from emails.loader.local_store import MsgLoader ROOT = os.path.dirname(__file__) def _get_message(): m = emails.loader.from_zip...
apps/base/models/file.py
youssriaboelseod/pyerp
115
11142072
# Django Library from django.db import models from django.urls import reverse from django.utils.translation import ugettext_lazy as _ # Localfolder Library from .father import PyFather class PyFile(PyFather): name = models.CharField(_("Name"), max_length=255) note = models.TextField(_("Note")) user_id = ...
python/frontend/cirrus/cirrus/resources.py
FTWH/cirrus
116
11142085
"""Caches AWS resources. """ import threading import logging import boto3 import botocore from . import configuration class ResourceManager(object): """A manager of cached AWS resources. """ def __init__(self, region): """Create a resource manager. Resources will be initialized asynchr...
psdaq/psdaq/pyxpm/surf/devices/ti/_Tmp461.py
ZhenghengLi/lcls2
134
11142087
#----------------------------------------------------------------------------- # This file is part of the 'SLAC Firmware Standard Library'. It is subject to # the license terms in the LICENSE.txt file found in the top-level directory # of this distribution and at: # https://confluence.slac.stanford.edu/display/ppare...
src/python/twitter/common/resourcepool/resourcepool.py
zhouyijiaren/commons
1,143
11142111
# ================================================================================================== # Copyright 2011 Twitter, Inc. # -------------------------------------------------------------------------------------------------- # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use thi...
locations/spiders/chicos_offtherack.py
nbeecher/alltheplaces
297
11142117
<filename>locations/spiders/chicos_offtherack.py # -*- coding: utf-8 -*- import json import scrapy from locations.items import GeojsonPointItem class ChicosOffTheRackSpider(scrapy.Spider): name = "chicosofftherack" item_attributes = {'brand': "Chico's Off The Rack"} allowed_domains = ["stores.chicosoffth...
paypalrestsdk/config.py
RobSand161/PayPal-Python-SDK
653
11142124
__version__ = "1.13.1" __pypi_username__ = "paypal" __pypi_packagename__ = "paypalrestsdk" __github_username__ = "paypal" __github_reponame__ = "PayPal-Python-SDK" __endpoint_map__ = { "live": "https://api.paypal.com", "sandbox": "https://api.sandbox.paypal.com" }
sample models/Bank, 1 clerk.py
akharitonov/salabim
151
11142132
# Bank, 1 clerk.py import salabim as sim class CustomerGenerator(sim.Component): def process(self): while True: Customer() yield self.hold(sim.Uniform(5, 15).sample()) class Customer(sim.Component): def process(self): self.enter(waitingline) if clerk.ispassive...
applications/SwimmingDEMApplication/python_scripts/t_junction/plot_trap_probabilities.py
lkusch/Kratos
778
11142139
# This code is designed to reproduce Fig. S7 from 2014 Vigolo import numpy as np import h5py import matplotlib.pyplot as plt L = 0.0048 z_plane_of_symmetry = -0.0024 n_intervals = 30 max_creation_time = 1.0 fluid_run_name = 'mesh_38288_nodes' fluid_run_name = 'mesh_66576_nodes' fluid_run_name = 'mesh_126189_nodes' # ...
notebook/list_normalization.py
vhn0912/python-snippets
174
11142141
<reponame>vhn0912/python-snippets<gh_stars>100-1000 import statistics import pprint l = [0, 1, 2, 3, 4] print(l) # [0, 1, 2, 3, 4] def min_max(l): l_min = min(l) l_max = max(l) return [(i - l_min) / (l_max - l_min) for i in l] print(min_max(l)) # [0.0, 0.25, 0.5, 0.75, 1.0] def standardization(l): ...
src/clusto/drivers/devices/common/ipmixin.py
thekad/clusto
216
11142154
<filename>src/clusto/drivers/devices/common/ipmixin.py """ IPMixin is a basic mixin to be used by devices that can be assigned IPs """ import clusto from clusto.drivers.resourcemanagers import IPManager from clusto.exceptions import ResourceException class IPMixin: def add_ip(self, ip=None, ipman=None): ...
vilya/models/badge.py
mubashshirjamal/code
1,582
11142156
# -*- coding: utf-8 -*- from datetime import datetime from vilya.libs.store import store, mc KIND_USER = 1001 MC_NEW_BADGE = 'newbadge:%s:%s' class BadgeItem(object): def __init__(self, badge_id, item_id, reason=None, date=None): self.badge_id = badge_id self.item_id = item_id self.reas...
src/python/nimbusml/examples/PcaTransformer.py
michaelgsharp/NimbusML
134
11142160
############################################################################### # PcaTransformer import numpy from nimbusml import FileDataStream from nimbusml.datasets import get_dataset from nimbusml.decomposition import PcaTransformer # data input (as a FileDataStream) path = get_dataset('infert').as_filepath() da...
pogom/pgoapi/protos/POGOProtos/Settings/Master/Item/PotionAttributes_pb2.py
tier4fusion/pogom-updated
2,557
11142167
# Generated by the protocol buffer compiler. DO NOT EDIT! # source: POGOProtos/Settings/Master/Item/PotionAttributes.proto import sys _b=sys.version_info[0]<3 and (lambda x:x) or (lambda x:x.encode('latin1')) from google.protobuf import descriptor as _descriptor from google.protobuf import message as _message from go...
corus/sources/rudrec.py
natasha/corus
205
11142178
<gh_stars>100-1000 from corus.record import Record from corus.io import ( parse_jsonl, load_lines ) class RuDReCRecord(Record): __attributes__ = ['file_name', 'text', 'sentence_id', 'entities'] def __init__(self, file_name, text, sentence_id, entities): self.file_name = file_name sel...
tests/test_tutorial/test_additional_status_codes/test_tutorial001.py
Aryabhata-Rootspring/fastapi
53,007
11142191
from fastapi.testclient import TestClient from docs_src.additional_status_codes.tutorial001 import app client = TestClient(app) def test_update(): response = client.put("/items/foo", json={"name": "Wrestlers"}) assert response.status_code == 200, response.text assert response.json() == {"name": "Wrestle...
third_party/gsutil/gslib/tests/test_storage_url.py
tingshao/catapult
2,151
11142199
# -*- coding: utf-8 -*- # Copyright 2014 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 requir...
ciphers/subdomain_randomizer_scripts/log_optimizely_prefixes.py
DrKeineLust/PacketWhisper
534
11142204
<reponame>DrKeineLust/PacketWhisper #!/usr/bin/python # # Filename: log_optimizely_prefixes.py # # Version: 1.0.0 # # Author: <NAME> (TryCatchHCF) # # Summary: Appends or removes random 8-digit string plus ".log.optimizely.com" # to each line of a file that's been Cloakified using log_optimizely_prefixes cipher. #...
demo/python/seasons.py
ebraminio/astronomy-fork
138
11142232
<reponame>ebraminio/astronomy-fork #!/usr/bin/env python3 # # seasons.py - <NAME> - 2019-08-10 # # Example C program for Astronomy Engine: # https://github.com/cosinekitty/astronomy # # This program demonstrates how to calculate the # equinoxes and solstices for a year. # import sys from astronomy import ...
Python/graphs/SCC_Kosaraju.py
zhcet19/NeoAlgo-1
897
11142289
""" Strongly Connected Components : A directed graph is strongly connected if there is a path between all pairs of vertices. A strongly connected component (SCC) of a directed graph is a maximal strongly connected subgraph. Purpose: To find all the Strongly Connected Components (SCC) in the ...
benchmarking/download_benchmarks/file_downloader_base.py
virtan/FAI-PEP
359
11142292
from __future__ import absolute_import, division, print_function, unicode_literals download_handles = {} class FileDownloaderBase(object): def __init__(self): pass def download_file(self, location, path): pass def registerFileDownloader(name, obj): global download_handles download_...
CondTools/Hcal/test/HcalInterpolatedPulseDBWriter_cfg.py
ckamtsikis/cmssw
852
11142323
<filename>CondTools/Hcal/test/HcalInterpolatedPulseDBWriter_cfg.py<gh_stars>100-1000 database = "sqlite_file:hcalPulse.db" tag = "test" inputfile = "hcalPulse.bbin" import FWCore.ParameterSet.Config as cms process = cms.Process('HcalInterpolatedPulseDBWrite') process.source = cms.Source('EmptyIOVSource', lastVa...
cli/streamingphish/tests/test_trainer.py
chinkitp/streamingphish-cp
278
11142325
<reponame>chinkitp/streamingphish-cp """ Test cases targeting streamingphish/trainer.py. """ import pytest from unittest.mock import MagicMock from collections import OrderedDict def test_model_generation(trainer, monkeypatch): def sample_training(): result = {} for x in range(0, 20): r...
example/django_example_compat/polls/views.py
rroden12/dynaconf
2,293
11142417
from django.conf import settings from django.http import HttpResponse def index(request): tests = [] tests.append("<b>.env</b>") tests.append( """<pre>DYNACONF_SERVER='prod_server_fromenv.com' DEV_SERVER='dev_server_fromenv.com' # switch envs or omit to default to DYNACONF ENV_FOR_DYNACONF=dev </p...
tiny_nerf.py
Depersonalizc/nerf-pytorch
598
11142418
import os from typing import Optional import matplotlib.pyplot as plt import numpy as np import torch from tqdm import tqdm, trange from nerf import cumprod_exclusive, get_minibatches, get_ray_bundle, positional_encoding def compute_query_points_from_rays( ray_origins: torch.Tensor, ray_directions: torch.Te...
omaha/site_scons/site_tools/windows_vc12_0.py
r3yn0ld4/omaha
1,975
11142437
<filename>omaha/site_scons/site_tools/windows_vc12_0.py #!/usr/bin/python2.4 # # Copyright 2015 Google 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/licen...
blk.py
pzread/unstrip
103
11142447
from idaapi import * from idautils import * from idc import * import sys import json import base64 def main(): funclist = list() for segea in Segments(): seg = getseg(segea) func = get_next_func(seg.startEA) while func is not None and func.startEA < seg.endEA: name = GetFunc...
homeassistant/components/gpslogger/const.py
domwillcode/home-assistant
30,023
11142460
<reponame>domwillcode/home-assistant """Const for GPSLogger.""" DOMAIN = "gpslogger" ATTR_ALTITUDE = "altitude" ATTR_ACCURACY = "accuracy" ATTR_ACTIVITY = "activity" ATTR_DEVICE = "device" ATTR_DIRECTION = "direction" ATTR_PROVIDER = "provider" ATTR_SPEED = "speed"
ttskit/resource/__init__.py
Jesse3692/ttskit
151
11142461
# author: kuangdd # date: 2021/4/25 """ ### resource 模型数据等资源。 audio model reference_audio + 内置发音人映射表 ```python _speaker_dict = { 1: 'Aibao', 2: 'Aicheng', 3: 'Aida', 4: 'Aijia', 5: 'Aijing', 6: 'Aimei', 7: 'Aina', 8: 'Aiqi', 9: 'Aitong', 10: 'Aiwei', 11: 'Aixia', 12: 'Aiya', 13: 'Aiyu', 14: 'Aiyue', 15: ...
sigopt-beats-vegas/predictor/history_player.py
meghanaravikumar/sigopt-examples
213
11142504
import datetime from bet_reader import fix_game def build_history(bst, bet_info_s15): history = {} missing = [] num_games = 0 for day, games in bet_info_s15.iteritems(): real_day = (datetime.datetime.strptime(day, '%Y-%m-%d') - datetime.timedelta(days=1)).strftime('%Y-%m-%d') history[day] = {} for ...
eventsourcing/dispatch.py
h11r/eventsourcing
972
11142506
try: from functools import singledispatchmethod except ImportError: from functools import singledispatch, update_wrapper # noinspection SpellCheckingInspection def singledispatchmethod(func): dispatcher = singledispatch(func) def wrapper(*args, **kwargs): return dispatcher....
elliot/evaluation/metrics/diversity/gini_index/gini_index.py
gategill/elliot
175
11142529
<filename>elliot/evaluation/metrics/diversity/gini_index/gini_index.py """ This is the implementation of the Gini Index metric. It proceeds from a user-wise computation, and average the values over the users. """ __version__ = '0.3.1' __author__ = '<NAME>, <NAME>' __email__ = '<EMAIL>, <EMAIL>' import numpy as np fro...
tableauserverclient/models/datasource_item.py
zuarbase/server-client-python
470
11142558
import xml.etree.ElementTree as ET from .exceptions import UnpopulatedPropertyError from .property_decorators import ( property_not_nullable, property_is_boolean, property_is_enum, ) from .tag_item import TagItem from ..datetime_helpers import parse_datetime import copy class DatasourceItem(object): c...
tests/test_observable/test_bufferwithcount.py
mmpio/RxPY
4,342
11142565
<reponame>mmpio/RxPY import unittest from rx import operators as ops from rx.testing import TestScheduler, ReactiveTest on_next = ReactiveTest.on_next on_completed = ReactiveTest.on_completed on_error = ReactiveTest.on_error subscribe = ReactiveTest.subscribe subscribed = ReactiveTest.subscribed disposed = ReactiveTe...
plugins/cluster_view_styling.py
fjflores/phy
118
11142579
"""Show how to customize the styling of the cluster view with CSS.""" from phy import IPlugin from phy.cluster.supervisor import ClusterView class ExampleClusterViewStylingPlugin(IPlugin): def attach_to_controller(self, controller): # We add a custom CSS style to the ClusterView. ClusterView._sty...
tests/test_rel_bias_tf.py
shar999/mead-baseline
241
11142617
from collections import namedtuple import numpy as np import pytest tf = pytest.importorskip("tensorflow") from eight_mile.tf.layers import ( SeqDotProductAttentionT5, SeqScaledDotProductAttentionT5, ) NH = 4 NQ = 7 NK = 6 NB = 32 @pytest.fixture def generate_buckets_values(): REL_BUCKETS = np.array([[...
datamodel_code_generator/http.py
adaamz/datamodel-code-generator
891
11142620
<gh_stars>100-1000 from typing import Optional, Sequence, Tuple try: import httpx except ImportError: # pragma: no cover raise Exception( 'Please run $pip install datamodel-code-generator[http] to resolve URL Reference' ) def get_body(url: str, headers: Optional[Sequence[Tuple[str, str]]] = None...
src/Icourse.py
jordanbull23/Icourses-Videos-and-PPTs-Download
204
11142626
# -*- coding: utf-8 -*- """程序主体""" import requests from bs4 import BeautifulSoup import re import json import lxml import os from src.change_name import change_name from src.write_txt import write_txt from src.get_res_old import getRess1, getRess2, get_source_link, get_homework_and_exampaper_link, get_download_link fr...
hail/python/hailtop/cleanup_gcr/__main__.py
tdeboer-ilmn/hail
789
11142627
<gh_stars>100-1000 import sys import time import logging import asyncio import aiohttp from hailtop import aiotools from hailtop.aiocloud import aiogoogle log = logging.getLogger(__name__) class AsyncIOExecutor: def __init__(self, parallelism): self._semaphore = asyncio.Semaphore(parallelism) sel...
manila/db/migrations/alembic/versions/30cb96d995fa_add_is_public_column_for_share.py
gouthampacha/manila
159
11142629
# Copyright 2015 mirantis 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 a...
src/wormhole/test/dilate/test_manager.py
dmgolembiowski/magic-wormhole
2,801
11142641
from __future__ import print_function, unicode_literals from zope.interface import alsoProvides from twisted.trial import unittest from twisted.internet.task import Clock, Cooperator from twisted.internet.interfaces import IStreamServerEndpoint import mock from ...eventual import EventualQueue from ..._interfaces impor...
codesamples/managers.py
buketkonuk/pythondotorg
911
11142656
from django.db.models.query import QuerySet class CodeSampleQuerySet(QuerySet): def draft(self): return self.filter(is_published=False) def published(self): return self.filter(is_published=True)
tests_obsolete/extension/dataflow_/counter/dataflow_counter.py
akmaru/veriloggen
232
11142668
from __future__ import absolute_import from __future__ import print_function import sys import os import math # the next line can be removed after installation sys.path.insert(0, os.path.dirname(os.path.dirname(os.path.dirname( os.path.dirname(os.path.dirname(os.path.abspath(__file__))))))) from veriloggen import...
scale/diagnostic/exceptions.py
kaydoh/scale
121
11142675
"""Defines the exceptions related to diagnostics""" from __future__ import unicode_literals from error.exceptions import ScaleError class TestException(ScaleError): """Error class indicating that a test error occurred """ def __init__(self): """Constructor """ super(TestExceptio...
CLUE_Dice_Roller/clue_dice_roller.py
joewalk102/Adafruit_Learning_System_Guides
665
11142686
""" Dice roller for CLUE Set the number of dice with button A (1-2-3-4-5-6) and the type with button B (d4-d6-d8-d10-d12-d20-d100). Roll by shaking. Pressing either button returns to the dice selection mode. """ import time from random import randint import board from adafruit_clue import clue from adafruit_debouncer...
Alignment/CommonAlignmentAlgorithm/python/SiStripBackplaneCalibration_cff.py
ckamtsikis/cmssw
852
11142701
<filename>Alignment/CommonAlignmentAlgorithm/python/SiStripBackplaneCalibration_cff.py import FWCore.ParameterSet.Config as cms SiStripBackplaneCalibration = cms.PSet( # Name that is bound to the SiStripBackplaneCalibration, defined by # the DEFINE_EDM_PLUGIN macro in SiStripBackplaneCalibration.cc: calib...
megatron/indexer.py
zhisbug/Megatron-LM
2,869
11142704
<reponame>zhisbug/Megatron-LM import sys import time import torch import torch.distributed as dist from megatron import get_args, print_rank_0 from megatron import mpu from megatron.checkpointing import load_biencoder_checkpoint from megatron.data.orqa_wiki_dataset import get_open_retrieval_wiki_dataset from megatron....