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
guild/tests/samples/projects/remote-status/sleep.py
msarahan/guildai
694
51623
<reponame>msarahan/guildai import time seconds = 1 time.sleep(seconds)
python_toolbox/wx_tools/drawing_tools/pens.py
hboshnak/python_toolbox
119
51624
<gh_stars>100-1000 # Copyright 2009-2017 <NAME>. # This program is distributed under the MIT license. import wx from python_toolbox import caching is_mac = (wx.Platform == '__WXMAC__') is_gtk = (wx.Platform == '__WXGTK__') is_win = (wx.Platform == '__WXMSW__') @caching.cache(max_size=100) def get_focus_pen(color=...
tests/components/sensibo/test_update.py
liangleslie/core
30,023
51626
"""The test for the sensibo update platform.""" from __future__ import annotations from datetime import timedelta from unittest.mock import patch from pysensibo.model import SensiboData from pytest import MonkeyPatch from homeassistant.config_entries import ConfigEntry from homeassistant.const import STATE_OFF, STAT...
src/python/controller/controller_persist.py
AlekLT/seedsync
255
51695
# Copyright 2017, <NAME>, All rights reserved. import json from common import overrides, Constants, Persist, PersistError class ControllerPersist(Persist): """ Persisting state for controller """ # Keys __KEY_DOWNLOADED_FILE_NAMES = "downloaded" __KEY_EXTRACTED_FILE_NAMES = "extracted" ...
tests/web/classes/__init__.py
DavidCain/python-slackclient
2,486
51719
STRING_51_CHARS = "SFOTYFUZTMDSOULXMKVFDOBQWNBAVGANMVLXQQZZQZQHBLJRZNY" STRING_301_CHARS = ( "ZFOMVKXETILJKBZPVKOYAUPNYWWWUICNEVXVPWNAMGCNHDBRMATGPMUHUZHUJKFWWLXBQXVDNCGJHAPKEK" "DZCXKBXEHWCWBYDIGNYXTOFWWNLPBTVIGTNQKIQDHUAHZPWQDKKCHERBYKLAUOOKJXJJLGOPSCRVEHCOAD" "BFYKJTXHMPPYWQVXCVGNNSXLNIHVKTVMEOIRXQDPLHID...
deepfence_backend/utils/fim_config_utils.py
deepfence/ThreatMapper
1,281
51722
<filename>deepfence_backend/utils/fim_config_utils.py import yaml import json from jsonschema import validate from jsonschema.exceptions import ValidationError, SchemaError def validate_fim_config(fim_config): with open("/etc/df_sysmon/fim_config_schema.json", "r") as schemafile: fim_schema = schemafile.r...
numba/tests/test_overlap.py
auderson/numba
6,620
51753
import numpy as np from numba import jit from numba.core import types from numba.tests.support import TestCase, tag import unittest # Array overlaps involving a displacement def array_overlap1(src, dest, k=1): assert src.shape == dest.shape dest[k:] = src[:-k] def array_overlap2(src, dest, k=1): assert...
src/cpp/model_benchmark.bzl
SanggunLee/edgetpu
320
51804
"""Generate model benchmark source file using template. """ _TEMPLATE = "//src/cpp:models_benchmark.cc.template" def _generate_models_benchmark_src_impl(ctx): ctx.actions.expand_template( template = ctx.file._template, output = ctx.outputs.source_file, substitutions = { "{BENCH...
catboost/benchmarks/kaggle/rossmann-store-sales/lightgbm_early_stopping.py
HeyLey/catboost
6,989
51819
#!/usr/bin/env python import os.path import config import experiment_lib import lightgbm as lgb class LightGBMExperimentEarlyStopping(experiment_lib.ExperimentEarlyStopping): def __init__(self, **kwargs): super(LightGBMExperimentEarlyStopping, self).__init__(**kwargs) def get_estimator(self, cat_...
examples/simple.py
bytewax/bytewax
109
51861
from bytewax import Dataflow, run flow = Dataflow() flow.map(lambda x: x * x) flow.capture() if __name__ == "__main__": for epoch, y in sorted(run(flow, enumerate(range(10)))): print(y)
angr/procedures/posix/recv.py
Kyle-Kyle/angr
6,132
51867
import angr ###################################### # recv ###################################### class recv(angr.SimProcedure): #pylint:disable=arguments-differ,unused-argument def run(self, fd, dst, length, flags): simfd = self.state.posix.get_fd(fd) if simfd is None: return -1 ...
quantities/units/concentration.py
502E532E/python-quantities
105
51893
""" """ from ..unitquantity import UnitQuantity from .substance import mol from .volume import L M = molar = UnitQuantity( 'molar', mol / L, symbol='M', aliases=['Molar'] ) mM = millimolar = UnitQuantity( 'millimolar', molar / 1000, symbol='mM' ) uM = micromolar = UnitQuantity( 'micr...
test/package/package_b/subpackage_2.py
Hacky-DH/pytorch
60,067
51895
<filename>test/package/package_b/subpackage_2.py<gh_stars>1000+ __import__("math", fromlist=[]) __import__("xml.sax.xmlreader") result = "subpackage_2" class PackageBSubpackage2Object_0: pass def dynamic_import_test(name: str): __import__(name)
tests/test_logo.py
theosech/ec
290
51909
import unittest class TestLogoMain(unittest.TestCase): def test_imports(self): try: from dreamcoder.domains.logo.main import ( animateSolutions, dreamFromGrammar, list_options, outputDreams, enumerateDreams, ...
Packs/Ansible_Powered_Integrations/Integrations/Linux/Linux.py
diCagri/content
799
51925
<reponame>diCagri/content import json import traceback from typing import Dict, cast import ansible_runner import demistomock as demisto # noqa: F401 import ssh_agent_setup from CommonServerPython import * # noqa: F401 # Dict to Markdown Converter adapted from https://github.com/PolBaladas/torsimany/ def dict2md(j...
mmfewshot/classification/datasets/tiered_imagenet.py
BIGWangYuDong/mmfewshot
376
51929
<reponame>BIGWangYuDong/mmfewshot<gh_stars>100-1000 # Copyright (c) OpenMMLab. All rights reserved. import os.path as osp import pickle import warnings from typing import Dict, List, Optional, Sequence, Union import mmcv import numpy as np from mmcls.datasets.builder import DATASETS from typing_extensions import Liter...
petridish/utils/sessinit.py
Bhaskers-Blu-Org2/petridishnn
121
51932
<reponame>Bhaskers-Blu-Org2/petridishnn # Copyright (c) Microsoft Corporation. # Licensed under the MIT license. import os import numpy as np import tensorflow as tf import six from tensorpack.utils import logger from tensorpack.tfutils.common import ( get_op_tensor_name, get_global_step_var) from tensorpack.tfut...
pyston/tools/test_optimize.py
mananpal1997/pyston
2,441
51943
<filename>pyston/tools/test_optimize.py import ctypes import os import subprocess import sys if __name__ == "__main__": filename = os.path.abspath(sys.argv[1]) funcnames = sys.argv[2:] if not funcnames: print("Usage: python test_optimize.py FILENAME FUNCNAME+") sys.exit(1) os.chdir(os....
test/test-356-getei.py
Cam2337/snap-python
242
51956
import snap Graph = snap.GenFull(snap.PNEANet, 10) Src = 1 Dst = 2 EI = Graph.GetEI(Src,Dst) EId = EI.GetId() print(EId, Graph.GetEI(Src,Dst).GetId()) print(Graph.GetEI(Src,Dst).GetSrcNId(), Graph.GetEI(Src,Dst).GetDstNId()) print(Graph.GetEI(EId).GetSrcNId(), Graph.GetEI(EId).GetDstNId()) if EId != Graph.GetEI(Src,Ds...
endgame/exposure_via_resource_policies/common.py
vikrum/endgame
224
51998
from abc import ABCMeta, abstractmethod import json import logging import copy import boto3 import botocore from botocore.exceptions import ClientError from endgame.shared.response_message import ResponseMessage from endgame.shared.list_resources_response import ListResourcesResponse from endgame.shared.response_messag...
simdeblur/utils/registry.py
ljzycmd/SimDeblur
190
52044
<reponame>ljzycmd/SimDeblur # Registry Class # CMD # Refer this in Detectron2 class Registry: def __init__(self, name): self._name = name self._obj_map = {} def _do_register(self, name, obj): assert (name not in self._obj_map), "The object named: {} was already registered in {} re...
maskrcnn_benchmark/modeling/backbone/pan.py
Yuliang-Liu/bezier_curve_text_spotting
423
52050
<reponame>Yuliang-Liu/bezier_curve_text_spotting import torch.nn as nn import torch.nn.functional as F class FPA(nn.Module): def __init__(self, channels=2048): """ Feature Pyramid Attention :type channels: int """ super(FPA, self).__init__() channels_mid = int(chann...
recipes/Python/577069_Access_grep_from_python/recipe-577069.py
tdiprima/code
2,023
52064
<gh_stars>1000+ import subprocess def grep(filename, arg): process = subprocess.Popen(['grep', '-n', arg, filename], stdout=subprocess.PIPE) stdout, stderr = process.communicate() return stdout, stderr
PyFunceble/storage_facility.py
Centaurioun/PyFunceble
213
52067
<filename>PyFunceble/storage_facility.py """ The tool to check the availability or syntax of domain, IP or URL. :: ██████╗ ██╗ ██╗███████╗██╗ ██╗███╗ ██╗ ██████╗███████╗██████╗ ██╗ ███████╗ ██╔══██╗╚██╗ ██╔╝██╔════╝██║ ██║████╗ ██║██╔════╝██╔════╝██╔══██╗██║ ██╔════╝ ██████╔╝ ╚████╔╝ ███...
leo/core/leoTest2.py
thomasbuttler/leo-editor
1,550
52085
# -*- coding: utf-8 -*- #@+leo-ver=5-thin #@+node:ekr.20201129023817.1: * @file leoTest2.py #@@first """ Support for Leo's new unit tests, contained in leo/unittests/test_*.py. Run these tests using unittest or pytest from the command line. See g.run_unit_tests and g.run_coverage_tests. This file also contains classe...
xv_leak_tools/network/linux/network_services.py
UAEKondaya1/expressvpn_leak_testing
219
52100
<reponame>UAEKondaya1/expressvpn_leak_testing import ctypes import netifaces import NetworkManager # pylint: disable=import-error from xv_leak_tools.exception import XVEx from xv_leak_tools.log import L from xv_leak_tools.process import check_subprocess class _NetworkObject: def __init__(self, conn): sel...
tests/errors/semantic/non_blocking/PYCCEL_RESTRICTION_LIST_COMPREHENSION_LIMITS.py
dina-fouad/pyccel
206
52103
# pylint: disable=missing-function-docstring, missing-module-docstring/ a = [i*j for i in range(1,3) for j in range(1,4) for k in range(i,j)] n = 5 a = [i*j for i in range(1,n) for j in range(1,4) for k in range(i,j)]
pycon/schedule/tests/factories.py
azkarmoulana/pycon
154
52109
<reponame>azkarmoulana/pycon import factory import factory.django from pycon.schedule.models import Session, SessionRole from symposion.schedule.tests.factories import DayFactory class SessionFactory(factory.django.DjangoModelFactory): class Meta: model = Session day = factory.SubFactory(DayFactory)...
blender/arm/logicnode/animation/LN_get_tilesheet_state.py
onelsonic/armory
2,583
52179
<gh_stars>1000+ from arm.logicnode.arm_nodes import * class GetTilesheetStateNode(ArmLogicTreeNode): """Returns the information about the current tilesheet of the given object.""" bl_idname = 'LNGetTilesheetStateNode' bl_label = 'Get Tilesheet State' arm_version = 1 arm_section = 'tilesheet' d...
tests/st/probability/distribution/test_poisson.py
GuoSuiming/mindspore
3,200
52180
# Copyright 2020 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...
capstone/capdb/migrations/0101_auto_20200423_1714.py
rachelaus/capstone
134
52181
<reponame>rachelaus/capstone<gh_stars>100-1000 # Generated by Django 2.2.11 on 2020-04-23 17:14 from django.db import migrations, models import django.db.models.deletion class Migration(migrations.Migration): dependencies = [ ('capdb', '0100_auto_20200410_1755'), ] operations = [ migrat...
claf/learn/tensorboard.py
GMDennis/claf
225
52200
<gh_stars>100-1000 import os from tensorboardX import SummaryWriter from claf import nsml class TensorBoard: """ TensorBoard Wrapper for Pytorch """ def __init__(self, log_dir): if not os.path.exists(log_dir): os.makedirs(log_dir) self.writer = SummaryWriter(log_dir=log_dir) ...
matrixprofile/algorithms/regimes.py
MORE-EU/matrixprofile
262
52205
<gh_stars>100-1000 #!/usr/bin/env python # -*- coding: utf-8 -*- from __future__ import absolute_import from __future__ import division from __future__ import print_function from __future__ import unicode_literals range = getattr(__builtins__, 'xrange', range) # end of py2 compatability boilerplate import numpy as np...
src/you_get/cli_wrapper/player/__main__.py
adger-me/you-get
46,956
52234
<reponame>adger-me/you-get #!/usr/bin/env python ''' WIP def main(): script_main('you-get', any_download, any_download_playlist) if __name__ == "__main__": main() '''
main.py
stillmatic/plaitpy
438
52237
from __future__ import print_function from src import cli from os import environ as ENV PROFILE=False if PROFILE: print("PROFILING") import cProfile cProfile.run("cli.main()", "restats") import pstats p = pstats.Stats('restats') p.strip_dirs().sort_stats('cumulative').print_stats(50) else: ...
apps/forms-flow-ai/forms-flow-api/tests/conf/__init__.py
saravanpa-aot/SBC_DivApps
132
52239
"""Test-Suite for the configuration system."""
tests/test_openapi_schema.py
quaternionmedia/fastapi-crudrouter
686
52280
<reponame>quaternionmedia/fastapi-crudrouter from pytest import mark from tests import CUSTOM_TAGS POTATO_TAGS = ["Potato"] PATHS = ["/potato", "/carrot"] PATH_TAGS = { "/potato": POTATO_TAGS, "/potato/{item_id}": POTATO_TAGS, "/carrot": CUSTOM_TAGS, "/carrot/{item_id}": CUSTOM_TAGS, } class TestOpe...
Algo and DSA/LeetCode-Solutions-master/Python/intersection-of-two-linked-lists.py
Sourav692/FAANG-Interview-Preparation
3,269
52300
# Time: O(m + n) # Space: O(1) class ListNode(object): def __init__(self, x): self.val = x self.next = None class Solution(object): # @param two ListNodes # @return the intersected ListNode def getIntersectionNode(self, headA, headB): curA, curB = headA, headB while cu...
response/core/util.py
ojno/response
1,408
52305
import bleach import bleach_whitelist from django.conf import settings from rest_framework.pagination import PageNumberPagination def sanitize(string): # bleach doesn't handle None so let's not pass it if string and getattr(settings, "RESPONSE_SANITIZE_USER_INPUT", True): return bleach.clean( ...
tests/r/test_lost_letter.py
hajime9652/observations
199
52306
from __future__ import absolute_import from __future__ import division from __future__ import print_function import shutil import sys import tempfile from observations.r.lost_letter import lost_letter def test_lost_letter(): """Test module lost_letter.py by downloading lost_letter.csv and testing shape of e...
plugins/Operations/Encoding/unicode_format_dialog.py
nmantani/FileInsight-plugins
120
52313
# # Unicode escape format setting dialog for the following plugins: # Unicode escape # Unicode unescape # # Copyright (c) 2020, <NAME> # All rights reserved. # # Redistribution and use in source and binary forms, with or without # modification, are permitted provided that the following conditions are met: ...
.modules/.recon-ng/modules/recon/hosts-hosts/resolve.py
termux-one/EasY_HaCk
1,103
52314
<filename>.modules/.recon-ng/modules/recon/hosts-hosts/resolve.py from recon.core.module import BaseModule from recon.mixins.resolver import ResolverMixin import dns.resolver class Module(BaseModule, ResolverMixin): meta = { 'name': 'Hostname Resolver', 'author': '<NAME> (@LaNMaSteR53)', '...
aztk/spark/models/plugins/spark_ui_proxy/configuration.py
Geims83/aztk
161
52316
import os from aztk.models.plugins.plugin_configuration import PluginConfiguration, PluginPort, PluginTargetRole from aztk.models.plugins.plugin_file import PluginFile dir_path = os.path.dirname(os.path.realpath(__file__)) class SparkUIProxyPlugin(PluginConfiguration): def __init__(self): super().__init_...
flaml/tune/__init__.py
wuchihsu/FLAML
1,747
52317
<filename>flaml/tune/__init__.py try: from ray import __version__ as ray_version assert ray_version >= '1.0.0' from ray.tune import (uniform, quniform, choice, randint, qrandint, randn, qrandn, loguniform, qloguniform, lograndint, qlograndint) except (ImportError, AssertionErr...
cflearn/models/cv/gan/protocol.py
carefree0910/carefree-learn
400
52328
import torch import random import torch.nn as nn from abc import abstractmethod from abc import ABCMeta from torch import Tensor from typing import Any from typing import Dict from typing import List from typing import Tuple from typing import Optional from .losses import GANLoss from .losses import GANTarget from ....
scratchai/attacks/attacks/semantic.py
iArunava/scratchai
101
52354
""" Semantic adversarial Examples """ __all__ = ['semantic', 'Semantic'] def semantic(x, center:bool=True, max_val:float=1.): """ Semantic adversarial examples. https://arxiv.org/abs/1703.06857 Note: data must either be centered (so that the negative image can be made by simple negation) or must be in t...
blogger_cli/converter/md_to_html.py
Himanshu-singhal-creator/blogger-cli
427
52381
import os from shutil import SameFileError, copyfile from urllib.request import Request, urlopen import markdown from bs4 import BeautifulSoup as BS from blogger_cli.converter.extractor import ( extract_and_write_static, extract_main_and_meta_from_md, get_summary_limit, extract_topic, replace_ext,...
main.py
kindlehl/Py3NES
128
52450
<reponame>kindlehl/Py3NES import argparse from cpu import CPU from graphics.graphics import Window from nes_test import NesTestLog from ram import RAM from apu import APU from ppu import PPU from rom import ROM class Nes: def __init__(self, rom_bytes, testing): self.rom = ROM(rom_bytes) # create...
tests/Handlers/test_DictionaryDeserializer.py
TheBoringBakery/Riot-Watcher
489
52451
<gh_stars>100-1000 import json import pytest from riotwatcher.Handlers import DictionaryDeserializer @pytest.mark.unit class TestDictionaryDeserializer: def test_basic_json(self): deserializer = DictionaryDeserializer() expected = { "test": {"object": "type", "int": 1}, ...
setup.py
leomauro/pysptk
348
52462
<filename>setup.py import os import subprocess from distutils.version import LooseVersion from glob import glob from os.path import join import setuptools.command.build_py import setuptools.command.develop from setuptools import Extension, find_packages, setup from setuptools.command.build_ext import build_ext as _bui...
tests/unit/tuner/dataset/test_class_sampler.py
jina-ai/finetuner
270
52472
<filename>tests/unit/tuner/dataset/test_class_sampler.py from collections import Counter import pytest from finetuner.tuner.dataset.samplers import ClassSampler @pytest.mark.parametrize("batch_size", [-1, 0]) def test_wrong_batch_size(batch_size: int): with pytest.raises(ValueError, match="batch_size"): ...
PyFunceble/utils/profile.py
Centaurioun/PyFunceble
213
52476
<reponame>Centaurioun/PyFunceble # pylint: disable=invalid-name """ The tool to check the availability or syntax of domain, IP or URL. :: ██████╗ ██╗ ██╗███████╗██╗ ██╗███╗ ██╗ ██████╗███████╗██████╗ ██╗ ███████╗ ██╔══██╗╚██╗ ██╔╝██╔════╝██║ ██║████╗ ██║██╔════╝██╔════╝██╔══██╗██║ ██╔════╝ ...
pygithub3/requests/repos/hooks.py
teamorchard/python-github3
107
52580
#!/usr/bin/env python # -*- encoding: utf-8 -*- from . import Request from pygithub3.resources.repos import Hook class List(Request): uri = 'repos/{user}/{repo}/hooks' resource = Hook class Get(Request): uri = 'repos/{user}/{repo}/hooks/{id}' resource = Hook class Create(Request): uri = 'r...
pydis_site/constants.py
hannah-m-moore/site
700
52603
<filename>pydis_site/constants.py import os GIT_SHA = os.environ.get("GIT_SHA", "development") GITHUB_TOKEN = os.environ.get("GITHUB_TOKEN") # How long to wait for synchronous requests before timing out TIMEOUT_PERIOD = int(os.environ.get("TIMEOUT_PERIOD", 5))
sciencebeam/pipeline_runners/beam_pipeline_runner.py
elifesciences/sciencebeam
272
52608
<filename>sciencebeam/pipeline_runners/beam_pipeline_runner.py from __future__ import absolute_import import argparse import logging import mimetypes import apache_beam as beam from apache_beam.options.pipeline_options import PipelineOptions, SetupOptions from apache_beam.metrics.metric import Metrics from sciencebe...
tests/test_semantic_faster.py
flying-sheep/goatools
477
52613
#!/usr/bin/env python """Test faster version of sematic similarity""" from __future__ import print_function # Computing basic semantic similarities between GO terms # Adapted from book chapter written by _<NAME> and <NAME>_ # How to compute semantic similarity between GO terms. # First we need to write a function ...
artemis/general/profile.py
peteroconnor-bc/artemis
235
52624
from tempfile import mkstemp import cProfile import pstats from artemis.general.display import surround_with_header import os def what_are_we_waiting_for(command, sort_by ='time', max_len = 20, print_here = True): """ An easy way to show what is taking all the time when you run something. Taken from docs:...
research/carls/context.py
srihari-humbarwadi/neural-structured-learning
939
52638
# 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 law or agreed to in writing, ...
epf/src/pipelines/im_color_modifier.py
MLReef/mlreef
1,607
52653
<reponame>MLReef/mlreef # MLReef-2020: Color modifications for data augmentation. from PIL import Image, ImageEnhance import argparse import sys import os from pathlib import Path class ColorModifier: def __init__(self,params): self.input_dir = params['input_path'] self.output_dir = params['output...
tools/cp.py
onecoolx/picasso
269
52657
<filename>tools/cp.py<gh_stars>100-1000 #!/usr/bin/env python # Copyright (c) 2012 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. """Copy a file. This module works much like the cp posix command - it takes 2 arguments: (...
data_generation/nlp.py
haeseung81/PyTorchStepByStep
170
52667
import requests import zipfile import os import errno import nltk from nltk.tokenize import sent_tokenize ALICE_URL = 'https://ota.bodleian.ox.ac.uk/repository/xmlui/bitstream/handle/20.500.12024/1476/alice28-1476.txt' WIZARD_URL = 'https://ota.bodleian.ox.ac.uk/repository/xmlui/bitstream/handle/20.500.12024/1740/wizo...
leonardo/module/web/models/__init__.py
timgates42/django-leonardo
102
52672
from leonardo.module.web.models.page import * from leonardo.module.web.models.widget import * from leonardo.module.web.widget.icon.models import IconWidget from leonardo.module.web.widget.application.models import ApplicationWidget from leonardo.module.web.widget.markuptext.models import MarkupTextWidget from leonard...
tests/test_provider_MissionCriticalCloud_cosmic.py
mjuenema/python-terrascript
507
52675
# tests/test_provider_MissionCriticalCloud_cosmic.py # Automatically generated by tools/makecode.py (24-Sep-2021 15:14:40 UTC) def test_provider_import(): import terrascript.provider.MissionCriticalCloud.cosmic def test_resource_import(): from terrascript.resource.MissionCriticalCloud.cosmic import cosmic_a...
src/genie/libs/parser/ios/tests/ShowEthernetServiceInstanceStats/cli/equal/golden_output_expected.py
balmasea/genieparser
204
52694
<filename>src/genie/libs/parser/ios/tests/ShowEthernetServiceInstanceStats/cli/equal/golden_output_expected.py<gh_stars>100-1000 expected_output = { "max_num_of_service_instances": 32768, "service_instance": { 2051: { "pkts_out": 0, "pkts_in": 0, "interface": "Gigabit...
classification/tests/test_classifier.py
magesh-technovator/serverless-transformers-on-aws-lambda
103
52696
<gh_stars>100-1000 from src.classifier import Classifier pipeline = Classifier() def test_response(requests, response): assert response == pipeline(requests)
tools/wptrunner/wptrunner/executors/executoropera.py
meyerweb/wpt
14,668
52699
<gh_stars>1000+ from ..webdriver_server import OperaDriverServer from .base import WdspecExecutor, WdspecProtocol class OperaDriverProtocol(WdspecProtocol): server_cls = OperaDriverServer class OperaDriverWdspecExecutor(WdspecExecutor): protocol_cls = OperaDriverProtocol
util/test/tests/D3D11/D3D11_Untyped_Backbuffer_Descriptor.py
hbina/renderdoc
6,181
52716
<filename>util/test/tests/D3D11/D3D11_Untyped_Backbuffer_Descriptor.py import renderdoc as rd import rdtest class D3D11_Untyped_Backbuffer_Descriptor(rdtest.TestCase): demos_test_name = 'D3D11_Untyped_Backbuffer_Descriptor' def check_capture(self): # find the first action action = self.find_a...
t72pkl.py
kopetri/LayoutNetv2
166
52753
# load .t7 file and save as .pkl data import torchfile import cv2 import numpy as np import scipy.io as sio import pickle import time data_path = './data/test_PC/' # panoContext #img_tr = torchfile.load('./data/panoContext_img_train.t7') #print(img_tr.shape) #lne_tr = torchfile.load('./data/panoContext_line_train.t7...
nodes/2.x/python/ElevationMarker.Views.py
andydandy74/ClockworkForDynamo
147
52766
<gh_stars>100-1000 import clr clr.AddReference('RevitAPI') from Autodesk.Revit.DB import * clr.AddReference("RevitNodes") import Revit clr.ImportExtensions(Revit.Elements) def GetElevationMarkerView(item): val = [] if hasattr(item, "HasElevations"): if item.HasElevations(): for i in range(item.MaximumViewCount...
www/tests/test_print.py
raspberrypieman/brython
5,926
52771
<gh_stars>1000+ funcs = [ "abs", "all", "any", "ascii", "bin", "callable", "chr", "compile", "delattr", "dir", "divmod", "eval", "exec", "exit", "format", "getattr", "globals", "hasattr", "hash", "help", "hex", "id", "input", "isinstance", "issubclass", "iter", "len", "locals", "max", "min", "next", "oc...
L1Trigger/GlobalCaloTrigger/test/testElectrons_cfg.py
ckamtsikis/cmssw
852
52802
<reponame>ckamtsikis/cmssw<gh_stars>100-1000 import FWCore.ParameterSet.Config as cms process = cms.Process("TestGct") process.load("L1Trigger.GlobalCaloTrigger.test.gctTest_cff") process.load("L1Trigger.GlobalCaloTrigger.test.gctConfig_cff") process.source = cms.Source("EmptySource") process.maxEvents = cms.untrack...
tests/test_provider_vultr_vultr.py
mjuenema/python-terrascript
507
52819
<filename>tests/test_provider_vultr_vultr.py<gh_stars>100-1000 # tests/test_provider_vultr_vultr.py # Automatically generated by tools/makecode.py (24-Sep-2021 15:31:06 UTC) def test_provider_import(): import terrascript.provider.vultr.vultr def test_resource_import(): from terrascript.resource.vultr.vultr ...
stanza/pipeline/constituency_processor.py
asears/stanza
3,633
52825
<gh_stars>1000+ """Processor that attaches a constituency tree to a sentence The model used is a generally a model trained on the Stanford Sentiment Treebank or some similar dataset. When run, this processor attaches a score in the form of a string to each sentence in the document. TODO: a possible way to generalize...
python/test/eager_mode/annotate_args.py
rdadolf/torch-mlir
213
52827
<reponame>rdadolf/torch-mlir # Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. # See https://llvm.org/LICENSE.txt for license information. # SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception # Also available under a BSD-style license. See LICENSE. # RUN: %PYTHON %s | FileCheck %s ...
tests/providers/amazon/aws/operators/test_emr_system.py
ChaseKnowlden/airflow
15,947
52841
<gh_stars>1000+ # 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"...
park/envs/tf_placement_sim/tf_placement_sim.py
utkarsh5k/park
180
52898
<gh_stars>100-1000 import os import numpy as np import math from itertools import permutations import wget import pickle import networkx as nx import park from park import core, spaces, logger from park.utils.misc import create_folder_if_not_exists from park.spaces import Tuple, Box, Discrete, Graph, Null from park.pa...
docs/examples/required_note.py
JonathanGrant/marbles
109
52915
import marbles.core class ComplexTestCase(marbles.core.AnnotatedTestCase): def test_for_edge_case(self): self.assertTrue(False) if __name__ == '__main__': marbles.core.main()
plyer/platforms/android/vibrator.py
EdwardCoventry/plyer
1,184
52921
"""Implementation Vibrator for Android.""" from jnius import autoclass, cast from plyer.facades import Vibrator from plyer.platforms.android import activity from plyer.platforms.android import SDK_INT Context = autoclass("android.content.Context") vibrator_service = activity.getSystemService(Context.VIBRATOR_SERVICE)...
tests/test_config_pumpkin_proxy.py
oza6ut0ne/wifipumpkin3
911
52949
<gh_stars>100-1000 import unittest from wifipumpkin3.core.common.platforms import Linux import wifipumpkin3.core.utility.constants as C from wifipumpkin3.core.utility.collection import SettingsINI class TestConfigPumpkinProxy(unittest.TestCase): def test_config_key_set(self): self.config = SettingsINI(C.C...
f5/bigip/tm/auth/test/unit/test_ldap.py
nghia-tran/f5-common-python
272
52967
<gh_stars>100-1000 # Copyright 2017 F5 Networks 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...
crowd_anki/anki/adapters/anki_deck.py
ll-in-anki/CrowdAnki
391
53048
<filename>crowd_anki/anki/adapters/anki_deck.py from cached_property import cached_property from dataclasses import dataclass from typing import Callable @dataclass class AnkiDeck: _data: dict deck_name_separator = '::' @property def data(self): return self._data @property def is_d...
StockAnalysisSystem/porting/vnpy_chart/__init__.py
lifg2000/StockAnalysisSystem
138
53082
<gh_stars>100-1000 from .widget import ChartWidget from .item import CandleItem, VolumeItem, ChartItem, MemoItem from .data import BarData from .constant import *
dev/Gems/CloudGemPlayerAccount/AWS/resource-manager-code/command.py
brianherrera/lumberyard
1,738
53095
<filename>dev/Gems/CloudGemPlayerAccount/AWS/resource-manager-code/command.py # # All or portions of this file Copyright (c) Amazon.com, Inc. or its affiliates or # its licensors. # # For complete copyright and license terms please see the LICENSE at the root of this # distribution (the "License"). All use of this sof...
source/vsm/vsm/db/sqlalchemy/migrate_repo/versions/026_remove_foreign_key.py
ramkrsna/virtual-storage-manager
172
53113
# vim: tabstop=4 shiftwidth=4 softtabstop=4 # Copyright 2014 Intel 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/lice...
homeassistant/components/trafikverket_train/util.py
MrDelik/core
30,023
53136
<gh_stars>1000+ """Utils for trafikverket_train.""" from __future__ import annotations from datetime import time def create_unique_id( from_station: str, to_station: str, depart_time: time | str | None, weekdays: list ) -> str: """Create unique id.""" timestr = str(depart_time) if depart_time else "" ...
examples/cross_origin/web.py
benthomasson/gevent-socketio
625
53138
import os from bottle import Bottle, static_file, run HERE = os.path.abspath(os.path.dirname(__file__)) STATIC = os.path.join(HERE, 'static') app = Bottle() @app.route('/') @app.route('/<filename:path>') def serve(filename='index.html'): return static_file(filename, root=STATIC) if __name__ == '__main__': ...
docs/tutorial/python/sanic/users_if.py
mrpotes/go-raml
142
53369
<reponame>mrpotes/go-raml # DO NOT EDIT THIS FILE. This file will be overwritten when re-running go-raml. from sanic import Blueprint from sanic.views import HTTPMethodView from sanic.response import text from . import users_api from .oauth2_itsyouonline import oauth2_itsyouonline users_if = Blueprint('users_if') ...
aser/conceptualize/utils.py
ZfSangkuan/ASER
256
53377
from collections import defaultdict from copy import copy, deepcopy from tqdm import tqdm from ..eventuality import Eventuality from ..relation import Relation def conceptualize_eventualities(aser_conceptualizer, eventualities): """ Conceptualize eventualities by an ASER conceptualizer :param aser_conceptual...
api/utils/input/__init__.py
mmangione/alcali
306
53422
from shlex import split import json class RawCommand: def __init__(self, command, client="local", posix=True, inline=False): # TODO: check shlex.quote, raw string, etc.. if inline: self.command = split(command, posix=posix) else: self.command = split(command, posix=...
tests/test_ns.py
TheCuriousNerd/happy-transformer
277
53426
from happytransformer import HappyNextSentence def test_sp_true(): happy_ns = HappyNextSentence() result = happy_ns.predict_next_sentence( "Hi nice to meet you. How old are you?", "I am 21 years old." ) assert result > 0.5 def test_sp_false(): happy_ns = HappyNextSentence() r...
bagpy/__init__.py
jmscslgroup/rosbagpy
107
53435
<reponame>jmscslgroup/rosbagpy # Initial Date: March 2, 2020 # Author: <NAME> # Copyright (c) <NAME>, Arizona Board of Regents # All rights reserved. from .bagreader import bagreader from .bagreader import animate_timeseries from .bagreader import create_fig
robot-server/robot_server/robot/calibration/pipette_offset/constants.py
anuwrag/opentrons
235
53512
from __future__ import annotations from enum import Enum from typing import TYPE_CHECKING from robot_server.robot.calibration.constants import STATE_WILDCARD if TYPE_CHECKING: from typing_extensions import Final class PipetteOffsetCalibrationState(str, Enum): sessionStarted = "sessionStarted" labwareLoa...
python/paddle/fluid/tests/unittests/test_psroi_pool_op.py
zmxdream/Paddle
17,085
53535
# Copyright (c) 2018 PaddlePaddle Authors. All Rights Reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by app...
yolo/config.py
chemetc/maskcam
179
53561
################################################################################ # Copyright (c) 2020-2021, Berkeley Design Technology, Inc. All rights reserved. # # Permission is hereby granted, free of charge, to any person obtaining a # copy of this software and associated documentation files (the "Software"), # to ...
source/remediation_runbooks/scripts/CreateAccessLoggingBucket_createloggingbucket.py
j-erickson/aws-security-hub-automated-response-and-remediation
129
53562
#!/usr/bin/python ############################################################################### # Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. # # # # Licensed under the Apache License Version 2.0 (the "License"). Y...
talk/src/_1_decorators_bad.py
zangyuchen2008/Clean-Code-in-Python-Second-Edition
133
53580
<reponame>zangyuchen2008/Clean-Code-in-Python-Second-Edition """ Examples of the application of Python decorators in order to reduce code duplication. It presents first, the naïve approach, with duplicated code, and then, the improved solution using decorators. """ from base import logger def decorator(original_funct...
media/transcoder/create_job_template.py
BaljitSingh919/Project360
5,938
53594
<filename>media/transcoder/create_job_template.py #!/usr/bin/env python # Copyright 2020 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....
leet/stack/isValid.py
monishshah18/python-cp-cheatsheet
140
53610
<filename>leet/stack/isValid.py class Solution: def isValid(self, s: str) -> bool: while '[]' in s or '()' in s or '{}' in s: s = s.replace('[]','').replace('()','').replace('{}','') return len(s) == 0 """ time: 10 min time: O(n) space: O(n) errors: lower case values/keys Have to use s...
scripts/datasets/somethingsomethingv2.py
Kh4L/gluon-cv
5,447
53635
<filename>scripts/datasets/somethingsomethingv2.py<gh_stars>1000+ """This script is for preprocessing something-something-v2 dataset. The code is largely borrowed from https://github.com/MIT-HAN-LAB/temporal-shift-module and https://github.com/metalbubble/TRN-pytorch/blob/master/process_dataset.py """ import os import...
tests/benchmarks/tools/kmt.py
leroyjvargis/workflows
558
53671
# SPDX-License-Identifier: Apache-2.0 # # Copyright (C) 2021 Micron Technology, Inc. All rights reserved. from typing import List from tools import config from tools.base import BaseTest from tools.helpers import shlex_join class KmtTest(BaseTest): def __init__(self, name: str, args: List[str]): super()...