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
tests/dbshell/fake_client.py
jpmallarino/django
61,676
47688
import sys sys.exit(1)
pythonjs/runtime/builtins.py
bpmbank/PythonJS
319
47689
# PythonJS builtins # by <NAME> and <NAME> - copyright 2013 # License: "New BSD" pythonjs.configure( runtime_exceptions=False ) pythonjs.configure( direct_operator='+' ) pythonjs.configure( direct_operator='*' ) pythonjs.configure( direct_keys=True ) _PythonJS_UID = 0 inline('IndexError = function(msg) {this.message...
tools/perf/contrib/cluster_telemetry/rasterize_and_record_micro_ct.py
zealoussnow/chromium
14,668
47716
# Copyright 2013 The Chromium Authors. All rights reserved. # Use of this source code is governed by a BSD-style license that can be # found in the LICENSE file. from contrib.cluster_telemetry import ct_benchmarks_util from contrib.cluster_telemetry import page_set from contrib.cluster_telemetry import repaint_helpers...
tool/rst2html_pygments.py
Tonhoko/cmemo
138
47722
<reponame>Tonhoko/cmemo<filename>tool/rst2html_pygments.py #!/usr/bin/python # :Author: <NAME>, the Pygments team, <NAME> # :Date: $Date: $ # :Copyright: This module has been placed in the public domain. # This is a merge of the docutils_ `rst2html` front end with an extension # suggestion taken from the pygments_ do...
src/sites/nefilim.py
LAC-Japan/ransomwatch
244
47732
from datetime import datetime import logging from bs4 import BeautifulSoup from db.models import Victim from net.proxy import Proxy from .sitecrawler import SiteCrawler import time class Nefilim(SiteCrawler): actor = "Nefilim" def _handle_page(self, soup): victim_list = soup.find_all("header", ...
packages/pyright-internal/src/tests/samples/properties3.py
Jasha10/pyright
3,934
47744
# This sample tests the type checker's ability to handle # custom subclasses of property. from typing import Any, Callable class custom_property1(property): pass class Custom1(object): @custom_property1 def x(self) -> int: return 3 @custom_property1 def y(self) -> float: retur...
.modules/.recon-ng/modules/reporting/pushpin.py
termux-one/EasY_HaCk
1,103
47770
<gh_stars>1000+ from recon.core.module import BaseModule import codecs import os import re import time import webbrowser class Module(BaseModule): meta = { 'name': 'PushPin Report Generator', 'author': '<NAME> (@LaNMaSteR53)', 'description': 'Creates HTML media and map reports for all of t...
PyFunceble/checker/syntax/domain_base.py
Centaurioun/PyFunceble
213
47784
<reponame>Centaurioun/PyFunceble """ The tool to check the availability or syntax of domain, IP or URL. :: ██████╗ ██╗ ██╗███████╗██╗ ██╗███╗ ██╗ ██████╗███████╗██████╗ ██╗ ███████╗ ██╔══██╗╚██╗ ██╔╝██╔════╝██║ ██║████╗ ██║██╔════╝██╔════╝██╔══██╗██║ ██╔════╝ ██████╔╝ ╚████╔╝ █████╗ ██║...
envs/hns/mujoco-worldgen/mujoco_worldgen/util/path.py
jiayu-ch15/curriculum
424
47801
from os.path import abspath, dirname, join WORLDGEN_ROOT_PATH = abspath(join(dirname(__file__), '..', '..')) def worldgen_path(*args): """ Returns an absolute path from a path relative to the mujoco_worldgen repository root directory. """ return join(WORLDGEN_ROOT_PATH, *args)
tests/assets/sample_tasks/sample.py
MarcoJHB/ploomber
2,141
47815
<gh_stars>1000+ # + tags=["parameters"] 1 + 1
codesamples/apps.py
Manny27nyc/pythondotorg
911
47838
<reponame>Manny27nyc/pythondotorg<filename>codesamples/apps.py from django.apps import AppConfig class CodesamplesAppConfig(AppConfig): name = 'codesamples'
desktop/core/ext-py/nose-1.3.7/unit_tests/test_issue_786.py
kokosing/hue
5,079
47846
def test_evens(): yield check_even_cls class Test(object): def test_evens(self): yield check_even_cls class Check(object): def __call__(self): pass check_even_cls = Check()
botfw/bybit/order.py
lzpel/btc_bot_framework
115
47858
import time from ..base import order as od from .api import BybitApi class BybitOrderManager(od.OrderManagerBase): def __init__(self, api, ws=None, retention=60): super().__init__(api, ws, retention) self.ws.subscribe('execution', self.__on_events, True) self.ws.subscribe('position', self...
river/optim/base.py
online-ml/creme
1,105
47902
import abc import numbers from typing import Union import numpy as np from river import base, optim, utils VectorLike = Union[utils.VectorDict, np.ndarray] __all__ = ["Initializer", "Scheduler", "Optimizer", "Loss"] class Initializer(base.Base, abc.ABC): """An initializer is used to set initial weights in a ...
Voice Analysis/Python/SVM/AudioSignal.py
lokesh9460/Realtime-Interview-Emotion-Analysis
574
47920
import os import numpy from pydub import AudioSegment from scipy.fftpack import fft class AudioSignal(object): def __init__(self, sample_rate, signal=None, filename=None): # Set sample rate self._sample_rate = sample_rate if signal is None: # Get file name and file extensio...
bricks/ev3dev/modules/pybricks/tools.py
ZPhilo/pybricks-micropython
115
47922
# SPDX-License-Identifier: MIT # Copyright (c) 2018-2020 The Pybricks Authors # Expose method and class written in C from _pybricks.tools import wait, StopWatch # Imports for DataLog implementation from utime import localtime, ticks_us class DataLog: def __init__(self, *headers, name="log", timestamp=True, exte...
tree_math/integration_test.py
cgarciae/tree-math
108
47952
<reponame>cgarciae/tree-math # Copyright 2021 Google LLC # # 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 # # https://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable ...
tests/python/contrib/test_ethosu/test_remove_concatenates.py
jwfromm/relax
2,084
48009
# Licensed to the Apache Software Foundation (ASF) under one # or more contributor license agreements. See the NOTICE file # distributed with this work for additional information # regarding copyright ownership. The ASF licenses this file # to you under the Apache License, Version 2.0 (the # "License"); you may not u...
examples/simultaneous_translation/utils/monotonic_attention.py
Shiguang-Guo/fairseq
16,259
48021
<gh_stars>1000+ from typing import Optional import torch from torch import Tensor from examples.simultaneous_translation.utils.functions import ( exclusive_cumprod, prob_check, moving_sum, ) def expected_alignment_from_p_choose( p_choose: Tensor, padding_mask: Optional[Tensor] = None, eps: fl...
Tuchart3.0 -beta/main.py
Seedarchangel/TuChart
801
48038
#-*- coding:utf-8 -*- from __future__ import print_function import os,sys,sip,time from datetime import datetime,timedelta from qtpy.QtWidgets import QTreeWidgetItem,QMenu,QApplication,QAction,QMainWindow from qtpy import QtGui,QtWidgets from qtpy.QtCore import Qt,QUrl,QDate from Graph import graphpage from layout impo...
mmpose/models/necks/__init__.py
jlgzb/mmpose
367
48040
<filename>mmpose/models/necks/__init__.py from .gap_neck import GlobalAveragePooling __all__ = ['GlobalAveragePooling']
metrics/recall/recall.py
leondz/datasets
3,395
48042
# Copyright 2020 The HuggingFace Datasets Authors and the current dataset script contributor. # # 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....
configs/selfsup/simmim/simmim_swin-base_16xb128-coslr-100e_in1k-192.py
mitming/mmselfsup
355
48071
_base_ = [ '../_base_/models/simmim_swin-base.py', '../_base_/datasets/imagenet_simmim.py', '../_base_/schedules/adamw_coslr-200e_in1k.py', '../_base_/default_runtime.py', ] # data data = dict(samples_per_gpu=128) # optimizer optimizer = dict( lr=2e-4 * 2048 / 512, betas=(0.9, 0.999), eps=...
tests/cases/doc/test_parametrize_alt.py
broglep-work/python-pytest-cases
213
48112
# Authors: <NAME> <<EMAIL>> # + All contributors to <https://github.com/smarie/python-pytest-cases> # # License: 3-clause BSD, <https://github.com/smarie/python-pytest-cases/blob/master/LICENSE> import pytest from pytest_cases import parametrize_with_cases def case_sum_one_plus_two(): a = 1 b = 2 ...
pytest-verbose-parametrize/tests/integration/parametrize_ids/tests/unit/test_duplicates.py
RaiVaibhav/pytest-plugins
282
48117
import pytest @pytest.mark.parametrize(('x', 'y', ), [(0, [1]), (0, [1]), (str(0), str([1]))]) def test_foo(x, y): assert str([int(x) + 1]) == y
recipes/Python/580741_ctypes_CDLL_automatic_errno/recipe-580741.py
tdiprima/code
2,023
48134
import ctypes class CDLL_errno(ctypes.CDLL): class _FuncPtr(ctypes._CFuncPtr): _flags_ = ctypes._FUNCFLAG_CDECL | ctypes._FUNCFLAG_USE_ERRNO _restype_ = ctypes.c_int def __call__(self, *args): ctypes.set_errno(0) try: return ctypes._CFuncPtr.__call_...
mixly_arduino/sample/mixpy/人工智能Py/09词法分析-2.py
wecake/Mixly_Arduino
118
48137
<filename>mixly_arduino/sample/mixpy/人工智能Py/09词法分析-2.py<gh_stars>100-1000 import aip client = aip.AipNlp("Enter Your APP_ID", "Enter Your API_KEY", "Enter Your SECRET_KEY") word= {"r":"代词", "v":"动词", "nr":"名词"} s = "" for i in client.lexer("我爱米思齐", options={})["items"]: s = s + i["item"] s = s + "【" s = s...
tests/h/services/flag_test.py
pombredanne/h
2,103
48146
<reponame>pombredanne/h import pytest from h import models from h.services import flag class TestFlagServiceFlagged: def test_it_returns_true_when_flag_exists(self, svc, flag): assert svc.flagged(flag.user, flag.annotation) is True def test_it_returns_false_when_flag_does_not_exist(self, svc, user, ...
PhysicsTools/RecoAlgos/python/allSuperClusterCandidates_cfi.py
ckamtsikis/cmssw
852
48158
import FWCore.ParameterSet.Config as cms allSuperClusterCandidates = cms.EDProducer("ConcreteEcalCandidateProducer", src = cms.InputTag("hybridSuperClusters"), particleType = cms.string('gamma') )
src/Classes/Install.py
TheBossProSniper/electric-windows
210
48167
###################################################################### # INSTALL # ###################################################################### from Classes.Metadata import Metadata class Install: """ Stores data about an installation for us...
lib/subdomains.py
bbhunter/ODIN
533
48168
<reponame>bbhunter/ODIN #!/usr/bin/python3 # -*- coding: utf-8 -*- """ This module contains everything needed to hunt for subdomains, including collecting certificate data from Censys.io and crt.sh for a given domain name. The original crt.sh code is from PaulSec's unofficial crt.sh API. That project can be found her...
pyti/double_exponential_moving_average.py
dibyajyotidash/https-github.com-kylejusticemagnuson-pyti
635
48173
from __future__ import absolute_import from pyti import catch_errors from pyti.exponential_moving_average import ( exponential_moving_average as ema ) def double_exponential_moving_average(data, period): """ Double Exponential Moving Average. Formula: DEMA = 2*EMA - EMA(EMA) """ catch...
prml/nn/math/product.py
brunomaga/PRML
11,017
48233
import numpy as np from prml.nn.function import Function class Product(Function): def __init__(self, axis=None, keepdims=False): if isinstance(axis, int): axis = (axis,) elif isinstance(axis, tuple): axis = tuple(sorted(axis)) self.axis = axis self.keepdims...
src/api/comment.py
piwaniuk/critic
216
48251
# -*- mode: python; encoding: utf-8 -*- # # Copyright 2017 the Critic contributors, Opera Software ASA # # 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/LI...
server/www/teleport/webroot/app/controller/rpc.py
zhoulhb/teleport
640
48299
# -*- coding: utf-8 -*- import json import urllib.parse import tornado.gen from app.const import * from app.base.configs import tp_cfg from app.base.session import tp_session from app.base.core_server import core_service_async_post_http from app.model import record from app.base.stats import tp_stats from app.base.lo...
pysnmp/smi/mibs/instances/__SNMP-TARGET-MIB.py
RKinsey/pysnmp
492
48358
# # This file is part of pysnmp software. # # Copyright (c) 2005-2019, <NAME> <<EMAIL>> # License: http://snmplabs.com/pysnmp/license.html # # This file instantiates some of the MIB managed objects for SNMP engine use # if 'mibBuilder' not in globals(): import sys sys.stderr.write(__doc__) sys.exit(1) Mi...
calamari_ocr/test/test_data_pagexml.py
jacektl/calamari
922
48385
import os import unittest this_dir = os.path.dirname(os.path.realpath(__file__)) class TestPageXML(unittest.TestCase): def run_dataset_viewer(self, add_args): from calamari_ocr.scripts.dataset_viewer import main main(add_args + ["--no_plot"]) def test_cut_modes(self): images = os.pa...
interleaving/optimized.py
mpkato/interleaving
107
48427
from .ranking import CreditRanking from .interleaving_method import InterleavingMethod import numpy as np from scipy.optimize import linprog class Optimized(InterleavingMethod): ''' Optimized Interleaving Args: lists: lists of document IDs max_length: the maximum length of resultant inter...
amla/common/schedule.py
tremblerz/amla
118
48467
<filename>amla/common/schedule.py #Copyright 2018 Cisco Systems 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...
pygame/platform-moving-up-down/main-2-class.py
whitmans-max/python-examples
140
48471
<filename>pygame/platform-moving-up-down/main-2-class.py #!/usr/bin/env python3 # date: 2020.01.23 # https://stackoverflow.com/questions/59870590/collision-detection-ball-landing-on-platform # Press SPACE to change player_gravity when it falls import pygame # --- constants --- (UPPER_CASE_NAMES) SCREEN_WIDTH = 800...
system/dynamic_connection_creation.py
airflow-plugins/example_dags
297
48509
""" Dynamic Connection Creation from a Variable This file contains one ongoing DAG that executes every 15 minutes. This DAG makes use of one custom operator: - CreateConnectionsFromVariable https://github.com/airflow-plugins/variable_connection_plugin/blob/master/operator/variable_connection_operator.py#L36 ...
pyjswidgets/pyjamas/ui/DropWidget.py
takipsizad/pyjs
739
48529
# Copyright (C) 2010 <NAME> # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, s...
alipay/aop/api/response/AlipayPayAppSmartwearStatusQueryResponse.py
antopen/alipay-sdk-python-all
213
48532
<gh_stars>100-1000 #!/usr/bin/env python # -*- coding: utf-8 -*- import json from alipay.aop.api.response.AlipayResponse import AlipayResponse class AlipayPayAppSmartwearStatusQueryResponse(AlipayResponse): def __init__(self): super(AlipayPayAppSmartwearStatusQueryResponse, self).__init__() self...
saleor/graphql/payment/tests/queries/test_payments_filter.py
victor-abz/saleor
1,392
48535
<reponame>victor-abz/saleor import graphene from .....payment.models import Payment from ....tests.utils import get_graphql_content PAYMENT_QUERY = """ query Payments($filter: PaymentFilterInput){ payments(first: 20, filter: $filter) { edges { node { id gateway ...
alipay/aop/api/domain/MemberCardOperator.py
Anning01/alipay-sdk-python-all
213
48578
#!/usr/bin/env python # -*- coding: utf-8 -*- import json from alipay.aop.api.constant.ParamConstants import * class MemberCardOperator(object): def __init__(self): self._op_id = None self._op_type = None @property def op_id(self): return self._op_id @op_id.setter def o...
tests/catalyst/metrics/test_segmentation.py
tadejsv/catalyst
2,693
48596
<gh_stars>1000+ # flake8: noqa from typing import Dict, List, Union import pytest import torch from catalyst.metrics import DiceMetric, IOUMetric, TrevskyMetric base_outputs = torch.tensor([[0.8, 0.1, 0], [0, 0.4, 0.3], [0, 0, 1]]) base_targets = torch.tensor([[1.0, 0, 0], [0, 1, 0], [1, 1, 0]]) base_outputs = torc...
src/utils/encryption_utils.py
tomgilbertson/script-server-v1
833
48614
<reponame>tomgilbertson/script-server-v1<gh_stars>100-1000 import base64 import hashlib from utils.apr1 import hash_apr1 def md5_apr1(salt, text): return hash_apr1(salt, text) def sha1(text): result = hashlib.sha1(text.encode('utf8')) return base64.b64encode(result.digest()).decode('utf8')
tools/build_rules/test_rules_private.bzl
jobechoi/bazel
16,989
48640
# Copyright 2019 The Bazel Authors. All rights reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable la...
guillotina/db/strategies/simple.py
rboixaderg/guillotina
173
48654
<gh_stars>100-1000 from guillotina import configure from guillotina import glogging from guillotina.db.interfaces import IDBTransactionStrategy from guillotina.db.interfaces import ITransaction from guillotina.db.strategies.base import BaseStrategy logger = glogging.getLogger("guillotina") @configure.adapter(for_=I...
app/grandchallenge/products/migrations/0007_projectairfiles.py
nlessmann/grand-challenge.org
101
48656
# Generated by Django 3.1.11 on 2021-07-01 20:18 from django.db import migrations, models import grandchallenge.core.storage class Migration(migrations.Migration): dependencies = [ ("products", "0006_product_ce_under"), ] operations = [ migrations.CreateModel( name="Project...
archive/extras/cat_dog_estimator/main.py
Pandinosaurus/tensorflow-workshop
796
48675
""" A very simplified introduction to TensorFlow using Estimator API for training a cat vs. dog classifier from the CIFAR-10 dataset. This version is intentionally simplified and has a lot of room for improvment, in speed and accuracy. Usage: python main.py [train|predict] [predict file] """ import sys import nump...
homeassistant/components/fixer/__init__.py
domwillcode/home-assistant
30,023
48705
<filename>homeassistant/components/fixer/__init__.py """The fixer component."""
rlgraph/components/layers/preprocessing/image_crop.py
RLGraph/RLGraph
290
48732
<reponame>RLGraph/RLGraph # Copyright 2018/2019 The RLgraph 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 # ...
pythonforandroid/recipes/pydantic/__init__.py
syrykh/python-for-android
6,278
48739
<reponame>syrykh/python-for-android<gh_stars>1000+ from pythonforandroid.recipe import PythonRecipe class PydanticRecipe(PythonRecipe): version = '1.8.2' url = 'https://github.com/samuelcolvin/pydantic/archive/refs/tags/v{version}.zip' depends = ['setuptools'] python_depends = ['Cython', 'devtools', '...
maskrcnn_benchmark/nas/rl/genotypes.py
DominickZhang/NAS-FCOS
187
48759
from collections import namedtuple Genotype = namedtuple('Genotype', 'backbone rpn') OP_NAMES = [ 'sep_conv_3x3', 'sep_conv_3x3_dil3', 'sep_conv_5x5_dil6', 'skip_connect', 'def_conv_3x3', ] AGG_NAMES = [ 'psum', 'cat' ] HEAD_OP_NAMES = [ 'conv1x1', 'conv3x3', 'sep_conv_3x3', ...
tests/test_json_schema.py
riddopic/opta
595
48773
<filename>tests/test_json_schema.py<gh_stars>100-1000 from opta.json_schema import check_schemas def test_returns_without_error() -> None: check_schemas()
tests/test_util.py
LivingTrades83/fast_arrow
143
48796
import vcr from fast_arrow import Client def gen_vcr(): return vcr.VCR( cassette_library_dir='tests/fixtures_vcr', record_mode='none', match_on=['method', 'scheme', 'host', 'port', 'path', 'query'], ) def gen_client(): auth_data = gen_auth_data() client = Client(auth_data) ...
example/aqi_curve_onecity.py
solider245/OpenData
1,179
48888
<reponame>solider245/OpenData<filename>example/aqi_curve_onecity.py<gh_stars>1000+ # encoding: utf-8 from opendatatools import aqi from pyecharts import Line import pandas as pd if __name__ == '__main__': df_aqi = aqi.get_daily_aqi_onecity('北京市') df_aqi.set_index('date', inplace=True) df_aqi.sort_index(a...
src/guestconfig/azext_guestconfig/vendored_sdks/guestconfig/models/_models_py3.py
Mannan2812/azure-cli-extensions
207
48925
# coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. # Licensed under the MIT License. See License.txt in the project root for license information. # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may ...
tests/unitary/RewardStream/test_notify_reward_amount.py
AqualisDAO/curve-dao-contracts
217
48940
import math import brownie from brownie import chain def test_only_distributor_allowed(alice, stream): with brownie.reverts("dev: only distributor"): stream.notify_reward_amount(10 ** 18, {"from": alice}) def test_retrieves_reward_token(bob, stream, reward_token): stream.notify_reward_amount(10 ** ...
test/test_vehicle.py
pchevallier/bimmer_connected
141
48956
<gh_stars>100-1000 """Tests for ConnectedDriveVehicle.""" import unittest from unittest import mock from test import load_response_json, BackendMock, TEST_USERNAME, TEST_PASSWORD, TEST_REGION, \ G31_VIN, F48_VIN, I01_VIN, I01_NOREX_VIN, F15_VIN, F45_VIN, F31_VIN, TEST_VEHICLE_DATA, \ ATTRIBUTE_MAPPING, MISSING_...
forking_paths_dataset/code/batch_plot_traj_carla.py
ziyan0302/Multiverse
190
48959
# coding=utf-8 """Batch convert the world traj in actev to carla traj.""" import argparse import os from glob import glob from tqdm import tqdm import sys if sys.version_info > (3, 0): import subprocess as commands else: import commands parser = argparse.ArgumentParser() parser.add_argument("traj_world_path") pa...
desktop/core/ext-py/django-celery-beat-1.4.0/django_celery_beat/migrations/0005_add_solarschedule_events_choices_squashed_0009_merge_20181012_1416.py
maulikjs/hue
5,079
48973
# Generated by Django 2.1.2 on 2018-10-12 14:18 from __future__ import absolute_import, unicode_literals from django.db import migrations, models import django_celery_beat.validators import timezone_field.fields class Migration(migrations.Migration): replaces = [ ('django_celery_beat', '0005_add_solarsch...
InvenTree/stock/__init__.py
ArakniD/InvenTree
656
48992
<reponame>ArakniD/InvenTree """ The Stock module is responsible for Stock management. It includes models for: - StockLocation - StockItem - StockItemTracking """
ansible/plugins/action/hashivault_write_from_file.py
ayav09/ansible-modules-hashivault
402
48993
######################################################################## # # Developed for AT&T by <NAME>, August 2017 # # Action plugin for hashivault_write_from_file module. # # Reads file from remote host using slurp module. (base64 encoded) # Stores file/secret to Vault using hashivault_read module on localhost. # ...
tests/validation/test_single_field_subscriptions.py
closeio/graphql-core
590
49074
<gh_stars>100-1000 from functools import partial from graphql.utilities import build_schema from graphql.validation import SingleFieldSubscriptionsRule from .harness import assert_validation_errors schema = build_schema( """ type Message { body: String sender: String } type SubscriptionR...
desktop/core/ext-py/chardet-3.0.4/setup.py
kokosing/hue
1,511
49080
<reponame>kokosing/hue<filename>desktop/core/ext-py/chardet-3.0.4/setup.py<gh_stars>1000+ #!/usr/bin/env python import re import sys from setuptools import find_packages, setup needs_pytest = set(['pytest', 'test', 'ptr']).intersection(sys.argv) pytest_runner = ['pytest-runner'] if needs_pytest else [] # Get versi...
draw fractal/Fern/Fern__PIL.py
DazEB2/SimplePyScripts
117
49114
<reponame>DazEB2/SimplePyScripts #!/usr/bin/env python3 # -*- coding: utf-8 -*- __author__ = 'ipetrash' """ Папоротник / Fern """ # Оригинал: http://www.cyberforum.ru/pascalabc/thread994987.html # uses GraphABC,Utils; # # const # n=255; # max=10; # # var # x,y,x1,y1,cx,cy: real; # i,ix,iy: integer; # // z...
saleor/core/migrations/0005_alter_eventdelivery_webhook.py
eanknd/saleor
1,392
49142
# Generated by Django 3.2.12 on 2022-04-08 12:37 from django.db import migrations, models import django.db.models.deletion class Migration(migrations.Migration): dependencies = [ ("webhook", "0008_webhook_subscription_query"), ("core", "0004_delete_delivery_without_webhook"), ] operatio...
22爬虫提高/day04/basic01.py
HaoZhang95/PythonAndMachineLearning
937
49150
<gh_stars>100-1000 import json import time import requests from PIL import Image from pytesseract import pytesseract from selenium import webdriver """ selenium和xpath的使用区别 selenium使用不需要自己写headers,只需要导入webdriver.Chrome().get(url)就会打开浏览器,使用find_xxx_by_xpath 写入自己的xpath语句即可 传统的xpath使用,需要导入etree.Html(...
office365/directory/applications/spa_application.py
rikeshtailor/Office365-REST-Python-Client
544
49152
from office365.runtime.client_value import ClientValue class SpaApplication(ClientValue): pass
Python/OsFileSystem/list_files.py
Gjacquenot/training-material
115
49161
#!/usr/bin/env python from argparse import ArgumentParser import os import sys if __name__ == '__main__': arg_parser = ArgumentParser(description='list all files with given ' 'extension in directory') arg_parser.add_argument('--dir', default='.', ...
spacenetutilities/labeltools/geojsonPrepTools.py
Pandinosaurus/utilities
251
49193
from spacenetutilities.labeltools import coreLabelTools import json import glob import argparse from datetime import datetime import os def modifyTimeField(geoJson, geoJsonNew, featureItemsToAdd=['ingest_tim', 'ingest_time', 'edit_date'], featureKeyListToRemove=[]): now = datetime.today() with open(geoJson) a...
playground/auto_sharding_solver/test_sharding_spec.py
yf225/alpa
114
49224
from hlo import ShardingSpec, ShardingSpecType from cluster_env import ClusterEnvironment from common import compute_bytes def test_tile(): cluster_env = ClusterEnvironment([[0, 1, 2], [3, 4, 5]], [1,1], [1,1], None) sharding = ShardingSpec.tile((12, 12), [0, 1], [0, 1], cluster_env) assert sharding.tile...
scripts/run_jobs.py
Darklanx/rl-baselines3-zoo
591
49241
<reponame>Darklanx/rl-baselines3-zoo """ Run multiple experiments on a single machine. """ import subprocess import numpy as np ALGOS = ["sac"] ENVS = ["MountainCarContinuous-v0"] N_SEEDS = 10 EVAL_FREQ = 5000 N_EVAL_EPISODES = 10 LOG_STD_INIT = [-6, -5, -4, -3, -2, -1, 0, 1] for algo in ALGOS: for env_id in ENV...
examples/miniapps/flask-blueprints/githubnavigator/blueprints/__init__.py
whysage/python-dependency-injector
1,997
49244
"""Blueprints package."""
ambiente_virtual/Lib/site-packages/alembic/util/editor.py
PI-UNIVESP-Penapolis/PRODEA
1,324
49276
import os from os.path import exists from os.path import join from os.path import splitext from subprocess import check_call from typing import Dict from typing import List from typing import Mapping from typing import Optional from .compat import is_posix from .exc import CommandError def open_in_editor( filena...
conftest.py
d34dm8/chime
149
49312
<filename>conftest.py<gh_stars>100-1000 import importlib import pathlib import tempfile import _pytest.monkeypatch import pytest import chime @pytest.fixture(scope='function', autouse=True) def reload_chime(): importlib.reload(chime) @pytest.fixture(scope='function', autouse=True) def mock_pathlib_home(monkey...
mode/examples/Basics/Data/VariableScope/VariableScope.pyde
timgates42/processing.py
1,224
49316
<filename>mode/examples/Basics/Data/VariableScope/VariableScope.pyde<gh_stars>1000+ """ Variable Scope. Variables have a global or local "scope". For example, variables declared within either the setup() or draw() functions may be only used in these functions. Global variables, variables declared outside of setup() ...
pipeline/Serverless/04_stream_processor/stream_processor.py
Rkauff/Klayers
1,096
49324
import json import os from datetime import datetime import boto3 from aws_lambda_powertools.logging import Logger logger = Logger() @logger.inject_lambda_context def main(event, context): records = event.get("Records", []) entries = [] stream_label = os.environ["STREAM_LABEL"] logger.info( ...
models/__init__.py
MilesQLi/Theano-Lights
313
49327
<filename>models/__init__.py __all__ = [ "ffn", "rbfn", "ffn_bn", "ffn_ace", "ffn_lae", "ffn_bn_vat", "ffn_vat", "cnn", "vae1", "cvae", "draw_at_lstm1", "draw_at_lstm2", "draw_lstm1", "draw_sgru1", "lm_lstm", "lm_lstm_bn", "lm_gru", "lm_draw"...
tools/third_party/importlib_metadata/prepare/example/example/__init__.py
meyerweb/wpt
2,479
49330
<gh_stars>1000+ def main(): return 'example'
plugins/modules/files_attributes.py
manala/ansible-roles
138
49333
<reponame>manala/ansible-roles #!/usr/bin/python # GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt) # This is a virtual module that is entirely implemented as an action plugin and runs on the controller from __future__ import absolute_import, division, print_function __metac...
tests/ui/menus/test_opmenu.py
Hengle/Houdini-Toolbox
136
49335
<gh_stars>100-1000 """Tests for ht.ui.menus.opmenu module.""" # ============================================================================= # IMPORTS # ============================================================================= # Houdini Toolbox import ht.ui.menus.opmenu # Houdini import hou # =================...
bgp/apps.py
maznu/peering-manager
127
49338
<reponame>maznu/peering-manager<filename>bgp/apps.py from django.apps import AppConfig class BgpConfig(AppConfig): name = "bgp" verbose_name = "BGP"
safe_control_gym/envs/env_wrappers/vectorized_env/subproc_vec_env.py
catgloss/safe-control-gym
120
49388
<reponame>catgloss/safe-control-gym """Subprocess vectorized environments. See also: * https://github.com/openai/baselines/blob/master/baselines/common/vec_env/subproc_vec_env.py * https://github.com/DLR-RM/stable-baselines3/blob/master/stable_baselines3/common/vec_env/subproc_vec_env.py """ import copy impor...
AdminServer/appscale/admin/stop_services.py
loftwah/appscale
790
49398
<gh_stars>100-1000 """ Tries to stop all services until they are stopped. """ import argparse import logging import time from appscale.common import service_helper from appscale.common.constants import LOG_FORMAT from appscale.common.retrying import retry logger = logging.getLogger(__name__) def start_service(): ...
repoxplorer/controllers/tags.py
Priya-100/repoxplorer
107
49426
# Copyright 2017, <NAME> # Copyright 2017, Red Hat # # 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 la...
unit6/spiders/p5_downloader_middleware_handson/p5_downloader_middleware_handson/settings.py
nulearn3296/scrapy-training
182
49440
BOT_NAME = 'p5_downloader_middleware_handson' SPIDER_MODULES = ['p5_downloader_middleware_handson.spiders'] NEWSPIDER_MODULE = 'p5_downloader_middleware_handson.spiders' ROBOTSTXT_OBEY = True DOWNLOADER_MIDDLEWARES = { 'p5_downloader_middleware_handson.middlewares.SeleniumDownloaderMiddleware': 543, } SELENIUM_E...
ws4py/_asyncio_compat.py
diveyez/WebSocket-for-Python
733
49453
"""Provide compatibility over different versions of asyncio.""" import asyncio if hasattr(asyncio, "async"): # Compatibility for Python 3.3 and older ensure_future = getattr(asyncio, "async") else: ensure_future = asyncio.ensure_future
pretrain.py
ku21fan/STR-Fewer-Labels
105
49470
<reponame>ku21fan/STR-Fewer-Labels<gh_stars>100-1000 import os import sys import time import random import string import argparse import torch import torch.backends.cudnn as cudnn import torch.nn.init as init import torch.optim as optim import torch.utils.data import numpy as np from tqdm import tqdm f...
sampyl/tests/test_samplers.py
wilsonify/sampyl
308
49494
<gh_stars>100-1000 from ..core import np from ..exceptions import * from .logps import * import sampyl as smp import pytest #TODO: Make tests to check correctness of samplers np_source = np.__package__ n_samples = 100 def test_logp_with_grad(): logp = poisson_with_grad start = {'lam1':1., 'lam2': 1.} nu...
tests/ut/python/dataset/test_flanger.py
PowerOlive/mindspore
3,200
49517
# Copyright 2021 Huawei Technologies Co., Ltd # # 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...
quant/state.py
vincent87lee/alphahunter
149
49534
# -*- coding:utf-8 -*- """ 状态信息 Project: alphahunter Author: HJQuant Description: Asynchronous driven quantitative trading framework """ class State: STATE_CODE_PARAM_MISS = 1 #交易接口初始化过程缺少参数 STATE_CODE_CONNECT_SUCCESS = 2 #交易接口连接成功 STATE_CODE_CONNECT_FAILED = 3 #交易接口连接失败 STATE_CODE_DISCONN...
docs/examples/tutorial/clibraries/queue3.py
johannes-mueller/cython
6,663
49574
<gh_stars>1000+ from cython.cimports import cqueue from cython import cast @cython.cclass class Queue: """A queue class for C integer values. >>> q = Queue() >>> q.append(5) >>> q.peek() 5 >>> q.pop() 5 """ _c_queue = cython.declare(cython.pointer(cqueue.Queue)) def __cinit__(s...
venv/Lib/site-packages/json_tricks/nonp.py
mintzer/pupillometry-rf-back
145
49597
<reponame>mintzer/pupillometry-rf-back import warnings from json import loads as json_loads from os import fsync from sys import exc_info from json_tricks.utils import is_py3, dict_default, gzip_compress, gzip_decompress, JsonTricksDeprecation from .utils import str_type, NoNumpyException # keep 'unused' imports from...
numba/misc/inspection.py
luk-f-a/numba
6,620
49625
"""Miscellaneous inspection tools """ from tempfile import NamedTemporaryFile def disassemble_elf_to_cfg(elf): """ Gets the CFG of the disassembly of an ELF object, elf, and renders it appropriately depending on the execution environment (terminal/notebook). """ try: import r2pipe exce...
crits/exploits/urls.py
dutrow/crits
738
49629
from django.conf.urls import url from . import views urlpatterns = [ url(r'^add/$', views.add_exploit, name='crits-exploits-views-add_exploit'), url(r'^edit/cve/$', views.edit_exploit_cve, name='crits-exploits-views-edit_exploit_cve'), url(r'^edit/name/(?P<id_>\S+)/$', views.edit_exploit_name, name='crits...
dglib/modules/sampler.py
billzhonggz/Transfer-Learning-Library
1,474
49634
""" @author: <NAME> @contact: <EMAIL> """ import random import copy import numpy as np from torch.utils.data.dataset import ConcatDataset from torch.utils.data.sampler import Sampler class DefaultSampler(Sampler): r"""Traverse all :math:`N` domains, randomly select :math:`K` samples in each domain to form a mini-...
alipay/aop/api/domain/AntMerchantExpandIndirectTiansuoBindModel.py
snowxmas/alipay-sdk-python-all
213
49654
<reponame>snowxmas/alipay-sdk-python-all<gh_stars>100-1000 #!/usr/bin/env python # -*- coding: utf-8 -*- import json from alipay.aop.api.constant.ParamConstants import * from alipay.aop.api.domain.TiansuoIsvBindVO import TiansuoIsvBindVO class AntMerchantExpandIndirectTiansuoBindModel(object): def __init__(self...