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 |
|---|---|---|---|---|
testing/MLDB-1703_null_char_import.py | kstepanmpmg/mldb | 665 | 11190996 | <gh_stars>100-1000
#
# MLDB-1703 null char import
# 2 juin 2016
# This file is part of MLDB. Copyright 2016 mldb.ai inc. All rights reserved.
#
import unittest
from mldb import mldb, MldbUnitTest, ResponseException
class Mldb1703(MldbUnitTest):
@classmethod
def setUpClass(self):
# this file include... |
utils/dbpedia.py | Tijana37/chimera | 125 | 11191009 | <reponame>Tijana37/chimera
import json
from collections import Counter
from functools import lru_cache
from itertools import chain
from os.path import isfile
import requests
from utils.file_system import makedir
cache = "/tmp/dbpedia/"
makedir(cache)
DBPEDIA = "http://dbpedia.org/"
@lru_cache(maxsize=None)
def nor... |
examples/article_examples/E_cartoon_plot.py | ATayls/DnaFeaturesViewer | 391 | 11191054 | from matplotlib import rc_context
from A_linear_plot import CustomTranslator
rc_context({"path.sketch": (1.5, 300, 1)}) # scale, length, randomness
class CustomTranslatorVariant(CustomTranslator):
def compute_feature_fontdict(self, feature):
return {"family": "<NAME>"}
translator = CustomTranslatorVar... |
projects/perception/slam/full_map_posterior_gmapping/src/map_simulator/src/map_simulator/map_obstacles/__init__.py | makistsantekidis/opendr | 217 | 11191070 | <filename>projects/perception/slam/full_map_posterior_gmapping/src/map_simulator/src/map_simulator/map_obstacles/__init__.py
from .polygonal_obstacle import PolygonalObstacle
__all__ = ['PolygonalObstacle', ]
|
bindings/python/cntk/ops/tests/evaluation_test.py | shyamalschandra/CNTK | 17,702 | 11191107 | <reponame>shyamalschandra/CNTK
# Copyright (c) Microsoft. All rights reserved.
# Licensed under the MIT license. See LICENSE.md file in the project root
# for full license information.
# ==============================================================================
"""
Unit tests for evaluation operations (grad and e... |
desktop/core/ext-py/nose-1.3.7/functional_tests/test_isolate_plugin.py | kokosing/hue | 5,079 | 11191122 | import os
import sys
import unittest
from nose.plugins.isolate import IsolationPlugin
from nose.plugins import PluginTester
support = os.path.join(os.path.dirname(__file__), 'support')
class TestDiscovery(PluginTester, unittest.TestCase):
activate = '--with-isolation'
args = ['-v']
plugins = [IsolationPlu... |
toad/tadpole/base.py | Padfoot-ted/toad | 325 | 11191176 | import seaborn as sns
from .utils import (
get_axes,
tadpole_axes,
FIG_SIZE,
)
class Tadpole:
def __getattr__(self, name):
t = getattr(sns, name)
if callable(t):
return self.wrapsns(t)
return t
def wrapsns(self, f):
@tadpole_axes
def wrapper(*ar... |
tests/unit/filters/test_xyz_filters.py | bernssolg/pyntcloud-master | 1,142 | 11191182 | <reponame>bernssolg/pyntcloud-master<filename>tests/unit/filters/test_xyz_filters.py
import pytest
from numpy.testing import assert_array_equal
from pyntcloud.filters.xyz import BoundingBoxFilter
@pytest.mark.usefixtures("simple_pyntcloud")
def test_BoundingBoxFilter_default_values(simple_pyntcloud):
"""
De... |
DevOps/resources/Jenkins/scripts/notification/notifier/main.py | jaswinder9051998/Resources | 101 | 11191185 | # Copyright 2018 <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 i... |
qt__pyqt__pyside__pyqode/pyqt__custom_title_bar__FramelessWindow/FramelessWindow.py | DazEB2/SimplePyScripts | 117 | 11191205 | <filename>qt__pyqt__pyside__pyqode/pyqt__custom_title_bar__FramelessWindow/FramelessWindow.py
#!/usr/bin/env python
# -*- coding: utf-8 -*-
# Created on 2018年4月30日
# author: Irony
# site: https://github.com/892768447
# email: <EMAIL>
# file: FramelessWindow
# description:
__Author__ = """By: Irony
QQ: 892768447
Email... |
Packs/PerceptionPoint/Integrations/PerceptionPoint/PerceptionPoint.py | diCagri/content | 799 | 11191211 | <filename>Packs/PerceptionPoint/Integrations/PerceptionPoint/PerceptionPoint.py
import demistomock as demisto
from CommonServerPython import *
''' IMPORTS'''
import requests
import json
from collections import defaultdict
''' INTEGRATION PARAMS '''
URL = 'http://api.perception-point.io/api/v1/{endpoint}' # disable-s... |
exoplanet-ml/beam/astrowavenet/prediction_fns.py | ritwik12/exoplanet-ml | 286 | 11191243 | <reponame>ritwik12/exoplanet-ml
# Copyright 2018 The Exoplanet ML Authors.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless requir... |
codigo/Live15/determinante_0.py | cassiasamp/live-de-python | 572 | 11191247 | from threading import Thread
from queue import Queue
from time import sleep
q = Queue()
matriz = [[2, 9],
[-1, 6]]
def principal(mat):
sleep(10)
q.put(mat[0][0] * mat[1][1])
def secundaria(mat):
count = 0
while q.empty():
count += 1
print(count)
q.put(mat[1][0] * mat[0][... |
distribution/bin/web-console-dep-lister.py | RomaKoks/druid | 5,813 | 11191294 | <reponame>RomaKoks/druid
#!/usr/bin/env python3
# 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... |
presidio-image-redactor/presidio_image_redactor/image_pii_verify_engine.py | vtols/presidio | 1,408 | 11191316 | from PIL import Image, ImageChops
from presidio_image_redactor.image_analyzer_engine import ImageAnalyzerEngine
import matplotlib
import io
from matplotlib import pyplot as plt
def fig2img(fig):
"""Convert a Matplotlib figure to a PIL Image and return it."""
buf = io.BytesIO()
fig.savefig(buf)
buf.se... |
maro/cli/process/utils/default_param.py | yangboz/maro | 598 | 11191319 | # Copyright (c) Microsoft Corporation.
# Licensed under the MIT license.
process_setting = {
"redis_info": {
"host": "localhost",
"port": 19999
},
"redis_mode": "MARO", # one of MARO, customized. customized Redis won't exit after maro process clear.
"parallel_level": 1,
"keep_ag... |
webs/bilibili/tasks/get_animations_full_data.py | billvsme/videoSpider | 216 | 11191381 | # -*- coding: utf-8 -*-
import requests
import models
from config import sqla
from helpers import random_str
from gevent.pool import Pool
from webs.bilibili import parsers
from sqlalchemy.exc import IntegrityError, InvalidRequestError
bilibili_animation_url = 'http://www.bilibili.com/bangumi/i/'
cookies = {
'sid... |
vumi/transports/vumi_bridge/__init__.py | seidu626/vumi | 199 | 11191404 | from vumi.transports.vumi_bridge.vumi_bridge import GoConversationTransport
__all__ = [
'GoConversationTransport',
]
|
neptune/new/internal/utils/generic_attribute_mapper.py | Raalsky/neptune-client | 254 | 11191426 | #
# Copyright (c) 2021, Neptune Labs Sp. z o.o.
#
# 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 agr... |
stethoscope/plugins/sources/jamf/utils.py | HoriaHorvat/stethoscope | 1,865 | 11191460 | <reponame>HoriaHorvat/stethoscope<gh_stars>1000+
# vim: set fileencoding=utf-8 :
from __future__ import absolute_import, print_function, unicode_literals
import pprint
import logbook
import six.moves
logger = logbook.Logger(__name__)
def _parse_parameter_dict(item_dict):
"""Convert a mapping with 'name' and 'v... |
pytorch_projects/integral_human_pose/_init_paths.py | KGMSFT/integral-human-pose | 472 | 11191498 | import os
import sys
def add_path(path):
if path not in sys.path:
sys.path.insert(0, path)
this_dir = os.path.dirname(__file__)
add_path(os.path.join(this_dir, '..', '..', 'common'))
add_path(os.path.join(this_dir, '..', 'common_pytorch'))
add_path(os.path.join(this_dir, '..', '..'))
add_path(os.path.join... |
unittest/scripts/py_dev_api_examples/concepts/Setting_the_Current_Schema.py | mueller/mysql-shell | 119 | 11191510 | from mysqlsh import mysqlx
# Direct connect with no client side default schema defined
mySession = mysqlx.get_session('mike:paSSw0rd@localhost')
mySession.set_current_schema("test")
|
tests/test_lang/test_spacy_language.py | nth-attempt/whatlies | 325 | 11191514 | <gh_stars>100-1000
import pytest
import numpy as np
from spacy.vocab import Vocab
from spacy.language import Language
from whatlies.language import SpacyLanguage
@pytest.fixture()
def color_lang():
vector_data = {
"red": np.array([1.0, 0.0]),
"green": np.array([0.5, 0.5]),
"blue": np.arra... |
packages/pyright-internal/src/tests/samples/typeNarrowingLocalConst1.py | Jasha10/pyright | 3,934 | 11191575 | <gh_stars>1000+
# This sample tests the case where a local (constant) variable that
# is assigned a narrowing expression can be used in a type guard condition.
# These are sometimes referred to as "aliased conditional expressions".
from typing import Optional, Union
import random
class A:
a: int
class B:
... |
pwncat/modules/linux/enumerate/system/aslr.py | Mitul16/pwncat | 1,454 | 11191606 | <reponame>Mitul16/pwncat<filename>pwncat/modules/linux/enumerate/system/aslr.py
#!/usr/bin/env python3
from pwncat.db import Fact
from pwncat.platform.linux import Linux
from pwncat.modules.enumerate import EnumerateModule
class ASLRStateData(Fact):
def __init__(self, source, state):
super().__init__(sou... |
conans/test/functional/cross_building/build_helper_test.py | matthiasng/conan | 6,205 | 11191633 | <reponame>matthiasng/conan
import textwrap
import unittest
from conans.test.utils.tools import TestClient
class BuildHelperTest(unittest.TestCase):
def test_autotools_helper(self):
client = TestClient()
conanfile = textwrap.dedent("""
from conans import ConanFile, AutoToolsBuildEnviro... |
tests/unit/viz/test_basemaps.py | manmorjim/cartoframes | 236 | 11191692 | from cartoframes.viz import basemaps
class TestBasemaps(object):
def test_is_defined(self):
"basemaps"
assert basemaps is not None
def test_has_defined_basemaps(self):
"basemaps content"
assert basemaps.positron == 'Positron'
assert basemaps.darkmatter == 'DarkMatter'
... |
notebook/pandas_tz_convert_tz_localize.py | vhn0912/python-snippets | 174 | 11191697 | <filename>notebook/pandas_tz_convert_tz_localize.py
import pandas as pd
s = '2018-01-01T12:00+09:00'
print(s)
# 2018-01-01T12:00+09:00
print(type(s))
# <class 'str'>
ts = pd.to_datetime(s)
print(ts)
# 2018-01-01 12:00:00+09:00
print(type(ts))
# <class 'pandas._libs.tslibs.timestamps.Timestamp'>
print(ts.tz)
# pytz... |
bookwyrm/views/imports/manually_review.py | mouse-reeve/fedireads | 270 | 11191720 | """ verify books we're unsure about """
from django.contrib.auth.decorators import login_required
from django.core.exceptions import PermissionDenied
from django.core.paginator import Paginator
from django.shortcuts import get_object_or_404, redirect
from django.template.response import TemplateResponse
from django.uti... |
scripts/result_mdtable_generator.py | Spaskich/NLP-Cube | 488 | 11191724 | # This script reads the results.json file and converts it to a results.md file
import json, collections
def extract_language_from_test_file(file):
# ex: "/home/ubuntu/ud-treebanks-v2.2/UD_Afrikaans-AfriBooms/af_afribooms-ud-test.txt"
parts = file.split("/")
dir = parts[-2].replace("UD_","")
dir = dir[... |
neon/data/aeon_shim.py | rsketine/neon | 4,415 | 11191733 | <reponame>rsketine/neon
# ******************************************************************************
# Copyright 2017-2018 Intel Corporation
#
# 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 a... |
IQA_pytorch/VIF.py | dingkeyan93/IQA-pytorch | 203 | 11191744 | <filename>IQA_pytorch/VIF.py<gh_stars>100-1000
import torch
from torch import nn
from torch.nn import functional as F
import numpy as np
from torchvision import transforms
from .utils import fspecial_gauss
from .SteerPyrSpace import SteerablePyramidSpace
import math
class VIF(torch.nn.Module):
# Refer to https:... |
tests/test_apis/test_utils.py | hongxuenong/mmocr | 2,261 | 11191795 | # Copyright (c) OpenMMLab. All rights reserved.
import copy
import os
import pytest
from mmcv import Config
from mmocr.apis.utils import (disable_text_recog_aug_test,
replace_image_to_tensor)
@pytest.mark.parametrize('cfg_file', [
'../configs/textrecog/sar/sar_r31_parallel_decoder_... |
testcases/ch2o_tests/node/Concat.py | vermashresth/chainer-compiler | 116 | 11191796 | # coding: utf-8
import chainer
import chainer.functions as F
class ConcatTuple(chainer.Chain):
def forward(self, x, y):
return F.concat((x, y))
class ConcatList(chainer.Chain):
def forward(self, x, y):
return F.concat([x, y])
# ======================================
from chainer_compiler... |
ghidra_9.0/Ghidra/Features/Python/data/jython-2.7.1/Lib/_fsum.py | ChristopherMorrison/ghidra | 577 | 11191868 | #!/usr/bin/env python
from sys import float_info
import math
mant_dig = float_info.mant_dig
etiny = float_info.min_exp - mant_dig
def fsum(iterable):
"""Full precision summation. Compute sum(iterable) without any
intermediate accumulation of error. Based on the 'lsum' function
at http://code.activesta... |
src/genie/libs/parser/junos/tests/ShowInterfacesDescriptions/cli/equal/golden_output2_expected.py | balmasea/genieparser | 204 | 11191901 | expected_output = {
'interface-information':{
'physical-interface':[
{
'name':'ge-0/0/0',
'admin-status':'up',
'oper-status':'up',
'description':'none/100G/in/hktGCS002_ge-0/0/0 more description'
}
]
}
} |
scripts/timing/core_domain.py | wetgi/lagom | 109 | 11191931 | <gh_stars>100-1000
class SomeOtherThingAsAsingleton:
def work(self):
return 1
class SomeService:
def __init__(self, other: SomeOtherThingAsAsingleton):
self.other = other
def do_it(self):
return self.other.work()
class AThingIMightNeed:
service: SomeService
def __init__... |
tools/update_feed.py | mubashshirjamal/code | 1,582 | 11191949 | # -*- coding: utf-8 -*-
import json
from datetime import datetime
from vilya.libs.rdstore import rds
from vilya.models.utils import (
CJsonEncoder,
)
from vilya.models.feed import (
get_user_feed as get_user_feed_v2,
get_user_inbox as get_user_inbox_v2,
get_public_feed as get_public_feed_v2,
get_te... |
python/scrape_for_events.py | victorromeo/uTensor | 1,047 | 11191993 | <reponame>victorromeo/uTensor
import numpy as np
import glob
import re
from collections import defaultdict
from pprint import pprint
def mHash_fnv1a(mStr):
np.seterr(over='ignore')
val_32_const = np.uint32(0x811c9dc5)
prime_32_const = np.uint32(0x1000193)
value = val_32_const
for c in mStr:
value = (... |
5-minute-coding-interview-bootcamp-basic-algorithms/dfs.py | dapopov-st/python-youtube-code | 262 | 11191998 | <filename>5-minute-coding-interview-bootcamp-basic-algorithms/dfs.py
graph = {"A": set(["B", "C"]),
"B": set(["A", "D", "E"]),
"C": set(["A", "F", "G"]),
"D": set(["B"]),
"E": set(["B"]),
"F": set(["C"]),
'G': set(["C"])}
def dfs(graph, start_node):
expl... |
Py Apple Dynamics V6.5/Py Apple Dynamics V6.5 固件及程序/V6.5 源代码/config.py | ToanTech/py-apple-dynamics | 125 | 11192044 | #=============Wifi设置=============
#do_connect_STA('Toan','Toan123456') #WIFI账号密码
do_connect_AP()
#=============步态参数=============
Ts=1 #周期
faai=0.5 #占空比
pit_max_ang=20 #设定俯仰轴最大限制角度
rol_max_ang=20 #设定滚转轴最大限制角度
xs_max=80 #设定最大x轴移动角度
|
cookietemple/util/dict_util.py | e2jk/cookietemple | 117 | 11192049 | from collections.abc import MutableMapping
from contextlib import suppress
def delete_keys_from_dict(dictionary: MutableMapping, keys: list) -> None:
"""
Deletes all key instances in an arbitrarily nested dictionary inplace
:param dictionary: dictionary of which the keys are deleted
:param keys: list... |
docs/plasmapy_sphinx/utils.py | seanjunheng2/PlasmaPy | 429 | 11192062 | <reponame>seanjunheng2/PlasmaPy
"""
A utility package containing functions and variables to support development of
the core functionality in `plasmapy_sphinx`.
"""
__all__ = [
"default_grouping_info",
"find_mod_objs",
"get_custom_grouping_info",
"package_dir",
"templates_dir",
]
import inspect
impo... |
nalaf/learning/crfsuite.py | ashish-narwal/nalaf | 103 | 11192111 | <reponame>ashish-narwal/nalaf<filename>nalaf/learning/crfsuite.py<gh_stars>100-1000
import warnings
import pycrfsuite
from nalaf.structures.data import Label
class PyCRFSuite:
def __init__(self, model_file=None):
self.model_file = model_file
if self.model_file is None:
self.tagger ... |
zproc/state/server.py | pycampers/zproc | 106 | 11192116 | <gh_stars>100-1000
import os
import struct
import time
from bisect import bisect
from collections import defaultdict
from contextlib import contextmanager
from copy import deepcopy
from typing import Any, Dict, List, Tuple
import zmq
from zproc import serializer
from zproc.consts import Cmds, ServerMeta
from zproc.co... |
mmwave/tracking/__init__.py | gimac/OpenRadar | 275 | 11192122 | from .ekf import *
|
job_report/main.py | DazEB2/SimplePyScripts | 117 | 11192123 | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
__author__ = 'ipetrash'
# p12 to pem:
# C:\Users\ipetrash>openssl pkcs12 -in ipetrash.p12 -out ipetrash.pem -nodes -clcerts
# Enter Import Password:
# MAC verified OK
# OR:
# OpenSSL_example\p12_to_pem.py
PEM_FILE_NAME = 'ipetrash.pem'
if __name__ == ... |
tests/sparseml/tensorflow_v1/optim/test_manager.py | clementpoiret/sparseml | 922 | 11192151 | <reponame>clementpoiret/sparseml
# Copyright (c) 2021 - present / Neuralmagic, 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/... |
experiments/ekfloc.py | VladPodilnyk/Kalman-and-Bayesian-Filters-in-Python | 12,315 | 11192170 | <filename>experiments/ekfloc.py
# -*- coding: utf-8 -*-
"""
Created on Sun May 24 08:39:36 2015
@author: Roger
"""
#x = x x' y y' theta
from math import cos, sin, sqrt, atan2
import numpy as np
from numpy import array, dot
from numpy.linalg import pinv
def print_x(x):
print(x[0, 0], x[1, 0], np.degrees(x[2, 0]... |
adversarial_mnist.py | goodcq/zhihuzhuanlan | 101 | 11192180 | from __future__ import absolute_import
#from __future__ import print_function
import os
import struct
from array import array
from keras.models import Sequential
from keras.layers.core import Dense, Dropout, Activation, Flatten
from keras.layers.convolutional import Convolution2D, MaxPooling2D
from keras.regularizers ... |
tests/unit/cfngin/lookups/test_registry.py | avosper-intellaegis/runway | 134 | 11192185 | """Tests for runway.cfngin.lookups.registry."""
# pylint: disable=no-self-use
# pyright: basic
from __future__ import annotations
from typing import TYPE_CHECKING, Any
import pytest
from runway.cfngin.lookups.handlers.default import DefaultLookup
from runway.cfngin.lookups.registry import (
CFNGIN_LOOKUP_HANDLER... |
mobula/config.py | wkcn/MobulaOP | 161 | 11192193 | from .utils import with_metaclass
class DefaultConfig:
TARGET = 'mobula_op'
BUILD_PATH = './'
BUILD_IN_LOCAL_PATH = True
SHOW_BUILDING_COMMAND = False
MAX_BUILDING_WORKER_NUM = 8
DEBUG = False
USING_OPENMP = True
USING_CBLAS = False
HOST_NUM_THREADS = 0 # 0 : auto
USING_HIGH_... |
Chapter13/c13_99_get_finStatement_not_working.py | John-ye666/Python-for-Finance-Second-Edition | 236 | 11192208 | """
Name : c13_99_get_finStatement.py
Book : Python for Finance
Publisher: Packt Publishing Ltd.
Author : <NAME>
Date : 2/27/2017
email : <EMAIL>
<EMAIL>
"""
import urllib2
import pandas as pd
url='http://financials.morningstar.com/income-statement/is.html?t=IBM®ion=usa&c... |
examples/dummy_plugin/dummy_plugin/secrets.py | psmware-ltd/nautobot | 384 | 11192226 | <reponame>psmware-ltd/nautobot
from django import forms
from nautobot.utilities.forms import BootstrapMixin
from nautobot.extras.secrets import SecretsProvider
class ConstantValueSecretsProvider(SecretsProvider):
"""
Example of a plugin-provided SecretsProvider - this one just uses a user-specified constant ... |
pymtl/tools/translation/verilator_sim_test.py | belang/pymtl | 206 | 11192318 | #=======================================================================
# verilator_sim_test.py
#=======================================================================
from pymtl import SimulationTool
from verilator_sim import TranslationTool
from pymtl import requires_verilator
from pclib.rtl ... |
onnx/bin/__init__.py | pchandrasekaran1595/onnx | 12,820 | 11192324 | # SPDX-License-Identifier: Apache-2.0
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
from __future__ import unicode_literals
|
tests/blob/test_blob_storage_account.py | Ross1503/azure-storage-python | 348 | 11192330 | # 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.
# --------------------------------------------------------------------... |
esmvaltool/cmorizers/obs/cmorize_obs_cowtanway.py | cffbots/ESMValTool | 148 | 11192355 | <reponame>cffbots/ESMValTool
"""ESMValTool CMORizer for CowtanWay.
Tier
Tier 2: other freely-available dataset.
Source
https://www-users.york.ac.uk/~kdc3/papers/coverage2013/series.html
Last access
20200226
Download and processing instructions
Download the following files:
'had4_krig_v1_0_0.... |
aws_lambda_powertools/utilities/data_classes/s3_event.py | Sordie/aws-lambda-powertools-python | 1,208 | 11192389 | <gh_stars>1000+
from typing import Dict, Iterator, Optional
from urllib.parse import unquote_plus
from aws_lambda_powertools.utilities.data_classes.common import DictWrapper
class S3Identity(DictWrapper):
@property
def principal_id(self) -> str:
return self["principalId"]
class S3RequestParameters(... |
tests/m3u/__init__.py | grdorin/mopidy | 6,700 | 11192434 | <reponame>grdorin/mopidy<filename>tests/m3u/__init__.py
def generate_song(i):
return f"dummy:track:song{i}"
|
tests/lib/test_take.py | bogdanvuk/pygears | 120 | 11192436 | <reponame>bogdanvuk/pygears
import pytest
from pygears import Intf, gear
from pygears.lib import decouple
from pygears.lib import take
from pygears.lib.delay import delay_rng
from pygears.lib.verif import directed, drv, verif
from pygears.sim import sim
from pygears.typing import Queue, Tuple, Uint
from pygears.util.t... |
mangum/backends/base.py | tasn/mangum | 661 | 11192442 | <reponame>tasn/mangum
from dataclasses import dataclass
from typing import Any
@dataclass
class WebSocketBackend: # pragma: no cover
"""
Base class for implementing WebSocket backends to store API Gateway connections.
Data source backends are required to implement configuration using the `dsn`
conne... |
polymorphic_tree/tests/models.py | avaddon/django-polymorphic-tree | 105 | 11192496 | <reponame>avaddon/django-polymorphic-tree<filename>polymorphic_tree/tests/models.py<gh_stars>100-1000
from django.core.exceptions import ValidationError
from django.db import models
from mptt.exceptions import InvalidMove
from polymorphic.showfields import ShowFieldContent
from polymorphic_tree.models import Polymorphi... |
GuiBuilder/PROJECTS/Demo/__main__.py | lon3wolf/MyPyBuilder | 237 | 11192501 | from GuiBuilder.PROJECTS.Demo.MainGui import Gui
class Main(object):
def __init__(self):
self.app = Gui()
self.app.run()
if __name__ == '__main__':
Main()
|
test/python/tests/test_loop.py | bh107/bohrium | 236 | 11192516 | import util
np_dw_loop_src = """
def do_while(func, niters, *args, **kwargs):
import sys
i = 0
if niters is None:
niters = sys.maxsize
while i < niters:
cond = func(*args, **kwargs)
if cond is not None and not cond:
break
i += 1
"""
class test_loop_fixed:
... |
tests/loading/schema/test_host_validation.py | maroux/flex | 160 | 11192526 | import itertools
import pytest
from flex.loading.schema import (
swagger_schema_validator,
)
from flex.loading.schema.host import decompose_hostname
from flex.exceptions import ValidationError
from flex.error_messages import MESSAGES
from tests.utils import (
assert_message_in_errors,
assert_path_not_in_e... |
unicorn/tests/regress/deadlock_1.py | clayne/unicorn_pe | 491 | 11192551 | <reponame>clayne/unicorn_pe
#!/usr/bin/python
# From issue #1 of <NAME>
from unicorn import *
import regress
CODE = b"\x90\x91\x92"
class DeadLock(regress.RegressTest):
def runTest(self):
mu = Uc(UC_ARCH_X86, UC_MODE_64)
mu.mem_map(0x100000, 4 * 1024)
mu.mem_write(0x100000, CODE)
... |
mudpi/extensions/t9602/__init__.py | icyspace/mudpi-core | 163 | 11192563 | """
T9602 Extension
Includes sensor interface for T9602.
Works on i2c over linux boards (typically
on a raspberry pi.)
"""
from mudpi.extensions import BaseExtension
class Extension(BaseExtension):
namespace = 't9602'
update_interval = 30
|
federated_learning/nvflare/nvflare_example_docker/expr_files/download_dataset.py | tommydino93/tutorials | 535 | 11192602 | <reponame>tommydino93/tutorials<filename>federated_learning/nvflare/nvflare_example_docker/expr_files/download_dataset.py
import os
from argparse import ArgumentDefaultsHelpFormatter, ArgumentParser
from monai.apps.utils import download_and_extract
def download_spleen_dataset(root_dir: str):
"""
This functio... |
dirigible/fts/tests/test_2712_ImportCSV.py | EnoX1/dirigible-spreadsheet | 168 | 11192629 | <filename>dirigible/fts/tests/test_2712_ImportCSV.py<gh_stars>100-1000
# Copyright (c) 2010 Resolver Systems Ltd.
# All Rights Reserved
#
from functionaltest import FunctionalTest, PAGE_LOAD_TIMEOUT
import os
class Test_2712_ImportCSV(FunctionalTest):
def test_can_import_excel_generated_csv_to_cursor_position(... |
arsdk-xml/ARSDKBuildUtils/Utils/Python/Common_GenAutotoolsLibraryDoc.py | 2016-Capstone/PythonController | 114 | 11192643 | '''
Copyright (C) 2014 <NAME>
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, this list of conditions and the following discl... |
deployment/setup.py | ruxi/logomaker | 125 | 11192652 | from setuptools import setup
def readme():
with open('README.rst') as f:
return f.read()
setup(name='logomaker',
version='0.8.0',
description='Package for making Sequence Logos',
long_description=readme(),
classifiers=[
'Development Status :: 3 - Alpha',
'License ::... |
dnsgate/help.py | jakeogh/dnsgate | 121 | 11192654 | #!/usr/bin/env python3
# tab-width:4
# pylint: disable=missing-docstring
import os
import sys
import time
from pathlib import Path
from .config import dnsmasq_config_file_line
from .global_vars import CACHE_EXPIRE
from .global_vars import CONFIG_FILE
from .global_vars import CUSTOM_BLACKLIST
from .global_vars import ... |
cherry/debug.py | acse-yl27218/cherry | 160 | 11192661 | <filename>cherry/debug.py<gh_stars>100-1000
#!/usr/bin/env python3
"""
General debugging utilities.
"""
import os
import sys
import logging
import traceback
import pdb
import queue
from logging import handlers
from datetime import datetime
IS_DEBUGGING = False
# Sets up general debugger
logger = logging.getLogger... |
third_party/graphy/graphy/backends/google_chart_api/line_chart_test.py | tingshao/catapult | 2,151 | 11192682 | <filename>third_party/graphy/graphy/backends/google_chart_api/line_chart_test.py
#!/usr/bin/python2.4
#
# Copyright 2008 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
#
# h... |
mmdet/datasets/pipelines/pixel_aug_pil.py | Qianna00/InstanceLoc | 120 | 11192687 | <gh_stars>100-1000
import random
import cv2
import mmcv
import numpy as np
import torchvision.transforms as transforms
from PIL import Image, ImageFilter
from ..builder import PIPELINES
class GaussianBlur(object):
"""Gaussian blur augmentation in SimCLR https://arxiv.org/abs/2002.05709"""
def __init__(self... |
plato/agent/component/dialogue_policy/dialogue_policy.py | avmi/plato-research-dialogue-system | 899 | 11192688 | <reponame>avmi/plato-research-dialogue-system<filename>plato/agent/component/dialogue_policy/dialogue_policy.py
"""
Copyright (c) 2019-2020 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 t... |
dags/cm360_segmentology_dag.py | Ressmann/starthinker | 138 | 11192690 | ###########################################################################
#
# Copyright 2020 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/l... |
LeetCode/0437_Path_Sum_III.py | Achyut-sudo/PythonAlgorithms | 144 | 11192700 | # Definition for a binary tree node.
# class TreeNode:
# def __init__(self, val=0, left=None, right=None):
# self.val = val
# self.left = left
# self.right = right
class Solution:
count = 0
past_sums = {}
def pathSum(self, root: TreeNode, sum: int) -> int:
if root is not... |
insights/parsers/tests/test_ls_var_lib_nova_instances.py | lhuett/insights-core | 121 | 11192715 | import doctest
from insights.parsers import ls_var_lib_nova_instances as ls_instances
from insights.tests import context_wrap
LS_VAR_LIB_NOVA_INSTANCES = '''
/var/lib/nova/instances/:
drwxr-xr-x. nova nova system_u:object_r:nova_var_lib_t:s0 .
drwxr-xr-x. nova nova system_u:object_r:nova_var_lib_t:s0 ..
drwxr-xr-x. n... |
DQM/SiStripCommon/python/EventAnalyzer_cfi.py | ckamtsikis/cmssw | 852 | 11192750 | import FWCore.ParameterSet.Config as cms
EventAnalyzer = cms.EDAnalyzer("EventContentAnalyzer")
|
topicnet/embeddings/api.py | machine-intelligence-laboratory/topicnet | 123 | 11192753 | <reponame>machine-intelligence-laboratory/topicnet
import os
import shutil
import ssl
import sys
from tqdm import tqdm
from urllib.request import (
Request,
urlopen,
)
from ..cooking_machine.models import TopicModel
_SERVER_URL = 'http://172.16.31.10:8885'
_ARCHIVE_EXTENSION = '.tar.gz'
def load_model(mod... |
RecoMET/METFilters/python/HcalStripHaloFilter_cfi.py | ckamtsikis/cmssw | 852 | 11192756 | import FWCore.ParameterSet.Config as cms
HcalStripHaloFilter = cms.EDFilter(
"HcalStripHaloFilter",
taggingMode = cms.bool(False),
maxWeightedStripLength = cms.int32(7),
maxEnergyRatio = cms.double(0.15),
minHadEt = cms.double(100.0)
)
|
wbb/core/types/__init__.py | DopeBotz/WilliamButcherBot-1 | 175 | 11192758 | # flake8: noqa
from .InlineQueryResult import (InlineQueryResultAudio,
InlineQueryResultCachedDocument)
|
实践案例/B15-基于深度学习的代码搜索案例/src/3Model/args.py | microsoft/ai-edu | 11,094 | 11192767 | <filename>实践案例/B15-基于深度学习的代码搜索案例/src/3Model/args.py
# Copyright (c) Microsoft. All rights reserved.
# Licensed under the MIT license. See LICENSE file in the project root for full license information.
import argparse
def add_common_model_arguments(parser: argparse.ArgumentParser) -> None:
"""Add common arguments... |
setup.py | carloshanson/etlalchemy | 525 | 11192777 | import sys
from setuptools import setup
from setuptools.command.test import test as TestCommand
class PyTest(TestCommand):
user_options = [('pytest-args=', 'a', "Arguments to pass into pytest")]
def initialize_options(self):
TestCommand.initialize_options(self)
self.pytest_args = ""
def ... |
i3pystatus/group.py | fkusei/i3pystatus | 413 | 11192790 | from i3pystatus import IntervalModule, Status, Module
from i3pystatus.core import util
from i3pystatus.core.imputil import ClassFinder
class Group(Module, Status):
"""
Module for grouping modules together
Cycles trough groups by means of scrolling
.. code-block:: python
group = Group()
... |
setup.py | oscarpicas/loophole | 153 | 11192797 | import sys
from distutils.core import setup
setup(
name = 'loophole',
packages = ['loophole', 'loophole.polar', 'loophole.polar.pb'],
version = '0.5.2',
description = 'Polar devices Python API and CLI.',
author = '<NAME>',
author_email = '<EMAIL>',
url = 'https://github.com/rsc-dev/loophole',
download_... |
libs/fuel/tests/test_streams.py | dendisuhubdy/attention-lvcsr | 767 | 11192808 | <reponame>dendisuhubdy/attention-lvcsr
import numpy
from numpy.testing import assert_equal, assert_raises
from fuel.datasets import IterableDataset, IndexableDataset
from fuel.schemes import SequentialExampleScheme, SequentialScheme
from fuel.streams import AbstractDataStream, DataStream
class DummyDataStream(Abstra... |
src/homework/tests/api/tests_markdown_sanitization.py | denkasyanov/education-backend | 151 | 11192858 | import pytest
pytestmark = [
pytest.mark.django_db,
pytest.mark.usefixtures('purchase'),
]
@pytest.mark.parametrize(('text', 'expected'), [
('<script>Ev1l</script>', '<!-- raw HTML omitted -->'),
('*should be rendered*', '<p><em>should be rendered</em></p>'),
('', '<p><img ... |
mmflow/models/losses/__init__.py | ArlenCHEN/mmflow | 481 | 11192879 | # Copyright (c) OpenMMLab. All rights reserved.
from .census_loss import census_loss
from .multilevel_bce import (MultiLevelBCE, binary_cross_entropy,
multi_levels_binary_cross_entropy)
from .multilevel_charbonnier_loss import (MultiLevelCharbonnierLoss,
... |
tests/unit/resources/security/test_certificate_rabbitmq.py | doziya/hpeOneView | 107 | 11192898 | <reponame>doziya/hpeOneView<filename>tests/unit/resources/security/test_certificate_rabbitmq.py
# -*- coding: utf-8 -*-
###
# (C) Copyright (2012-2017) Hewlett Packard Enterprise Development LP
#
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentati... |
tests/apps/namespace_package_base/nsapp/apps.py | MikeAmy/django | 5,079 | 11192901 | import os
from django.apps import AppConfig
from django.utils._os import upath
class NSAppConfig(AppConfig):
name = 'nsapp'
path = upath(os.path.dirname(__file__))
|
mixly_arduino/sample/mixpy/海龟画图/py/海龟画图08猜一猜_01猜性别.py | wecake/Mixly_Arduino | 118 | 11192934 | import turtle
tina= turtle.Turtle()
mygender = "女"
guess = turtle.textinput("猜一猜","猜一猜我是男生还是女生?")
tina.pencolor("#ff0000")
tina.hideturtle()
if mygender == guess:
tina.write("你真棒,猜对了!",False,align="left",font=("黑体",20,"normal"))
else:
tina.write("很遗憾,猜错了!",False,align="left",font=("黑体",20,"normal"))
|
src/tests/file_upload_feature_test.py | tomgilbertson/script-server-v1 | 833 | 11192943 | import os
import time
import unittest
from features.file_upload_feature import FileUploadFeature
from files.user_file_storage import UserFileStorage
from tests import test_utils
from utils import file_utils
class TestUserFileStorage(unittest.TestCase):
def setUp(self):
test_utils.setup()
self.__s... |
tests/testing.py | WamboJambo/spur.py | 217 | 11192950 | import os
import spur
import spur.ssh
def _int_or_none(val):
return int(val) if val is not None else None
HOSTNAME = os.environ.get("TEST_SSH_HOSTNAME", "127.0.0.1")
USERNAME = os.environ["TEST_SSH_USERNAME"]
PASSWORD = os.environ["TEST_SSH_PASSWORD"]
PORT = _int_or_none(os.environ.get("TEST_SSH_PORT", 22))
... |
036-ircbot/bot.py | gynvael/stream | 152 | 11192988 | <reponame>gynvael/stream
#!/usr/bin/python3
import sys
import socket
import threading
import os
import time
import random
import string
import telnetlib
import queue
def recvuntil(sock, txt):
d = b""
while d.find(txt) == -1:
try:
dnow = sock.recv(1)
if len(dnow) == 0:
return False
exce... |
recipes/Python/578293_unicode_Command_line_histograms/recipe-578293.py | tdiprima/code | 2,023 | 11193027 | <gh_stars>1000+
import numpy as np
def cli_hist(data,bins=10):
bars = u' ▁▂▃▄▅▆▇█'
n,_ = np.histogram(data,bins=bins)
n2=n*(len(bars)-1)/(max(n))
res = u" ".join( bars[i] for i in n2 )
return res
data = np.random.random(100)
print cli_hist(data)
# ▆ ▄ ▃ ▅ █ ▄ ▅ ▁ ▅ ▇
print cli_hist(data,bins=... |
scripts/nextpnr-timing.py | keadwen/CFU-Playground | 240 | 11193040 | #!/usr/bin/env python3
import json
import argparse
arg = argparse.ArgumentParser()
arg.add_argument('file', help='JSON timing report')
arg.add_argument('--src', default='', help='Source name')
arg.add_argument('--dst', default='', help='Destination name')
arg.add_argument('--results', default=100, type=int, help='Nu... |
venv/Lib/site-packages/rivescript/regexp.py | Hazemcodes/GimmyBot | 154 | 11193057 | # RiveScript-Python
#
# This code is released under the MIT License.
# See the "LICENSE" file for more information.
#
# https://www.rivescript.com/
from __future__ import unicode_literals
import re
"""Common regular expressions used in RiveScript."""
# Common regular expressions.
class RE(object):
equals = ... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.