max_stars_repo_path string | max_stars_repo_name string | max_stars_count int64 | id string | content string | add_param_types int64 | add_return_types int64 | add_class_field_types int64 | add_instance_field_types int64 | add_total int64 | add_error int64 |
|---|---|---|---|---|---|---|---|---|---|---|
tests/conftest.py | natpacket/curl-impersonate | 1,065 | 144299 | def pytest_addoption(parser):
# Where to find curl-impersonate's binaries
parser.addoption("--install-dir", action="store", default="/usr/local")
parser.addoption("--capture-interface", action="store", default="eth0")
| 0 | 0 | 0 | 0 | 0 | 0 |
utils/queuer.py | anoidgit/zero | 111 | 144339 | <reponame>anoidgit/zero
# coding: utf-8
"""
The Queue function mainly deals with reading and preparing dataset in a multi-processing manner.
We didnot use the built-in tensorflow function Dataset because it lacks of flexibility.
The function defined below is mainly inspired by https://github.com/ixlan/machine-learning... | 0 | 0 | 0 | 0 | 0 | 0 |
tests/builtins/test_callable.py | akubera/batavia | 1,256 | 144348 | <reponame>akubera/batavia
from .. utils import TranspileTestCase, BuiltinFunctionTestCase
class CallableTests(TranspileTestCase):
pass
class BuiltinCallableFunctionTests(BuiltinFunctionTestCase, TranspileTestCase):
function = "callable"
| 0 | 0 | 0 | 0 | 0 | 0 |
evosax/restarts/simple_restart.py | mahi97/evosax | 102 | 144376 | import chex
from .restarter import RestartWrapper
from .termination import spread_criterion
class Simple_Restarter(RestartWrapper):
def __init__(
self,
base_strategy,
stop_criteria: list[object]=[spread_criterion],
):
"""Simple Restart Strategy - Only reinitialize the state."""... | 4 | 2 | 0 | 0 | 6 | 0 |
cloudmarker/test/test_main.py | TinLe/cloudmarker | 208 | 144393 | """Tests for package execution."""
import importlib
import unittest
from unittest import mock
class MainTest(unittest.TestCase):
"""Tests for package execution."""
@mock.patch('sys.argv', ['cloudmarker', '-c', '-n'])
def test_main(self):
# Run cloudmarker package with only the default base
... | 0 | 0 | 0 | 0 | 0 | 0 |
jobtastic/tests/test_settings.py | Praseetha-KR/jobtastic | 467 | 144407 | <reponame>Praseetha-KR/jobtastic
from __future__ import print_function
import mock
import django
from unittest import skipIf
from celery import Celery, states
from celery.backends.cache import DummyClient
from django.conf import settings
from django.test import TestCase
from jobtastic.task import JobtasticTask
from wer... | 0 | 0 | 0 | 0 | 0 | 0 |
ChatBot/chatbot_search/chatbot_tfserving/indexAnnoy.py | yongzhuo/nlp_xiaojiang | 1,379 | 144409 | <reponame>yongzhuo/nlp_xiaojiang<filename>ChatBot/chatbot_search/chatbot_tfserving/indexAnnoy.py
# !/usr/bin/python
# -*- coding: utf-8 -*-
# @time : 2021/4/18 21:04
# @author : Mo
# @function: annoy search
from annoy import AnnoyIndex
import numpy as np
import os
class AnnoySearch:
def __init__(self, dim=7... | 0 | 0 | 0 | 0 | 0 | 0 |
source/paraphrase.py | xl8-ai/LASER | 2,941 | 144419 | #!/usr/bin/python
# Copyright (c) Facebook, Inc. and its affiliates.
# All rights reserved.
#
# This source code is licensed under the BSD-style license found in the
# LICENSE file in the root directory of this source tree.
#
# LASER Language-Agnostic SEntence Representations
# is a toolkit to calculate multilingual s... | 2 | 1 | 0 | 0 | 3 | 0 |
autoelective/client.py | lhydave/PKUAutoElective | 566 | 144424 | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
# filename: client.py
# modified: 2019-09-09
from __future__ import annotations
from requests.models import Request
from requests.sessions import Session
from requests.cookies import extract_cookies_to_jar
class BaseClient(object):
default_headers: dict[object,objec... | 17 | 4 | 2 | 0 | 23 | 0 |
042_centernet/20_tensorflow_models/openvino_load_test.py | IgiArdiyanto/PINTO_model_zoo | 1,529 | 144427 | <reponame>IgiArdiyanto/PINTO_model_zoo<gh_stars>1000+
from openvino.inference_engine import IENetwork, IECore
import cv2
import numpy as np
import pprint
ie = IECore()
vino_model_path = f'saved_model/openvino/FP16'
vino_model = 'saved_model'
net = ie.read_network(model=f'{vino_model_path}/{vino_model}.xml', weights=f'... | 0 | 0 | 0 | 0 | 0 | 0 |
lightreid/losses/focal_loss.py | nataliamiccini/light-reid | 296 | 144439 | """
@author: <NAME>
@contact: <EMAIL>
"""
import torch
import torch.nn as nn
from torch.autograd import Variable
from .build import LOSSes_REGISTRY
@LOSSes_REGISTRY.register()
class FocalLoss(nn.Module):
"""
reference: https://github.com/clcarwin/focal_loss_pytorch
"""
def __init__(self, gamma: ... | 2 | 1 | 0 | 0 | 3 | 0 |
recipes/tinyalsa/all/conanfile.py | dvirtz/conan-center-index | 562 | 144444 | <gh_stars>100-1000
from conans import ConanFile, tools, AutoToolsBuildEnvironment
from conans.errors import ConanInvalidConfiguration
import os
class TinyAlsaConan(ConanFile):
name = "tinyalsa"
license = "BSD-3-Clause"
url = "https://github.com/conan-io/conan-center-index"
homepage = "https://github.co... | 0 | 0 | 0 | 0 | 0 | 0 |
graphgym/custom_graphgym/optimizer/example.py | Kenneth-Schroeder/pytorch_geometric | 12,651 | 144447 | <filename>graphgym/custom_graphgym/optimizer/example.py
import torch.optim as optim
from torch_geometric.graphgym.register import register_optimizer, \
register_scheduler
from torch_geometric.graphgym.optimizer import OptimizerConfig, SchedulerConfig
def optimizer_example(params, optimizer_config: OptimizerConf... | 0 | 0 | 0 | 0 | 0 | 0 |
tools/accuracy_checker/openvino/tools/accuracy_checker/annotation_converters/common_object_detection.py | TolyaTalamanov/open_model_zoo | 2,201 | 144465 | <reponame>TolyaTalamanov/open_model_zoo<filename>tools/accuracy_checker/openvino/tools/accuracy_checker/annotation_converters/common_object_detection.py
"""
Copyright (c) 2018-2022 Intel Corporation
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the ... | 0 | 0 | 0 | 0 | 0 | 0 |
tests/dataset_tests/preprocessors_tests/test_wle_util.py | pfnet/chainerchem | 184 | 144484 | import numpy as np
import pytest
from chainer_chemistry.dataset.preprocessors import wle_util
def test_to_index():
values = ['foo', 'bar', 'buz', 'non-exist']
mols = [['foo', 'bar', 'buz'], ['foo', 'foo'], ['buz', 'bar']]
actual = wle_util.to_index(mols, values)
expect = np.array([np.array([0, 1, 2]... | 0 | 1 | 0 | 0 | 1 | 0 |
tda/client/__init__.py | zhangted/tda-api | 986 | 144504 | from .synchronous import Client
from .asynchronous import AsyncClient
| 0 | 0 | 0 | 0 | 0 | 0 |
compressible/problems/hse.py | SebastianoF/pyro2 | 151 | 144507 | from __future__ import print_function
import numpy as np
import sys
import mesh.patch as patch
from util import msg
def init_data(my_data, rp):
""" initialize the HSE problem """
msg.bold("initializing the HSE problem...")
# make sure that we are passed a valid patch object
if not isinstance(my_da... | 0 | 0 | 0 | 0 | 0 | 0 |
sdk/storage/azure-storage-file-datalake/azure/storage/filedatalake/_list_paths_helper.py | rsdoherty/azure-sdk-for-python | 207 | 144509 | <gh_stars>100-1000
# -------------------------------------------------------------------------
# Copyright (c) Microsoft Corporation. All rights reserved.
# Licensed under the MIT License. See License.txt in the project root for
# license information.
# ------------------------------------------------------------------... | 0 | 0 | 0 | 0 | 0 | 0 |
tests/cli/tap.py | joshuataylor/great_expectations | 6,451 | 144525 | """
A basic generated Great Expectations tap that validates a single batch of data.
Data that is validated is controlled by BatchKwargs, which can be adjusted in
this script.
Data are validated by use of the `ActionListValidationOperator` which is
configured by default. The default configuration of this Validation Op... | 0 | 0 | 0 | 0 | 0 | 0 |
venv/Lib/site-packages/numpy/typing/tests/data/fail/flatiter.py | EkremBayar/bayar | 603 | 144527 | <reponame>EkremBayar/bayar<gh_stars>100-1000
from typing import Any
import numpy as np
from numpy.typing import _SupportsArray
class Index:
def __index__(self) -> int:
...
a: "np.flatiter[np.ndarray]"
supports_array: _SupportsArray
a.base = Any # E: Property "base" defined in "flatiter" is read-only
... | 0 | 0 | 0 | 0 | 0 | 0 |
tests/Unit/Elliptic/Systems/Elasticity/BoundaryConditions/LaserBeam.py | nilsvu/spectre | 117 | 144559 | # Distributed under the MIT License.
# See LICENSE.txt for details.
import numpy as np
from numpy import sqrt, exp, pi
def normal_dot_minus_stress(x, n, beam_width) -> object:
n /= np.linalg.norm(n)
r = sqrt(np.linalg.norm(x)**2 - np.dot(x, n)**2)
beam_profile = exp(-(r / beam_width)**2) / pi / beam_widt... | 0 | 2 | 0 | 0 | 2 | 0 |
tests/test_sorted_list.py | mrsndmn/PyGM | 169 | 144563 | <reponame>mrsndmn/PyGM<filename>tests/test_sorted_list.py
import bisect
import random
from array import array
import pytest
from pygm import SortedList
def test_len():
assert len(SortedList([1, 2, 3])) == 3
assert len(SortedList([3, 1, 4, 3])) == 4
assert len(SortedList([1] * 10)) == 10
def test_init()... | 0 | 0 | 0 | 0 | 0 | 0 |
AppDB/appscale/datastore/fdb/stats/buffer.py | loftwah/appscale | 790 | 144570 | <filename>AppDB/appscale/datastore/fdb/stats/buffer.py
import datetime
import logging
import monotonic
import random
import time
from collections import defaultdict
import six
from tornado import gen
from tornado.ioloop import IOLoop
from tornado.locks import Lock as AsyncLock
from appscale.datastore.fdb.polling_lock... | 0 | 0 | 0 | 0 | 0 | 0 |
pytorch_ipynb/helper_plotting.py | XiaoshengLin/deeplearning-models | 16,182 | 144612 | <filename>pytorch_ipynb/helper_plotting.py
# imports from installed libraries
import os
import matplotlib.pyplot as plt
import numpy as np
import torch
def plot_training_loss(minibatch_loss_list, num_epochs, iter_per_epoch,
results_dir=None, averaging_iterations=100):
plt.figure()
ax1 ... | 0 | 0 | 0 | 0 | 0 | 0 |
Tests/test_class.py | psydox/Pyjion | 1,137 | 144634 | <reponame>psydox/Pyjion<filename>Tests/test_class.py
def test_add():
class Number:
def __add__(self, other):
return 4 + other
def __radd__(self, other):
return other + 4
a = Number()
assert 3 + a == 7
assert a + 3 == 7
def test_inheritance():
class Node(... | 0 | 0 | 0 | 0 | 0 | 0 |
mne/utils/tests/test_testing.py | rylaw/mne-python | 1,953 | 144641 | <reponame>rylaw/mne-python
import os.path as op
import numpy as np
import pytest
from mne.datasets import testing
from mne.utils import (_TempDir, _url_to_local_path, buggy_mkl_svd)
def test_buggy_mkl():
"""Test decorator for buggy MKL issues."""
from unittest import SkipTest
@buggy_mkl_svd
def foo... | 0 | 0 | 0 | 0 | 0 | 0 |
nsf/nde/transforms/conv_test.py | davidreiman/nsf | 231 | 144642 | <filename>nsf/nde/transforms/conv_test.py<gh_stars>100-1000
import torch
import unittest
from nde import transforms
from nde.transforms.transform_test import TransformTest
class OneByOneConvolutionTest(TransformTest):
def test_forward_and_inverse_are_consistent(self):
batch_size = 10
c, h, w = 3,... | 0 | 0 | 0 | 0 | 0 | 0 |
bplustree/memory.py | EdwardWooCN/bplustree | 760 | 144655 | <filename>bplustree/memory.py<gh_stars>100-1000
import enum
import io
from logging import getLogger
import os
import platform
from typing import Union, Tuple, Optional
import cachetools
import rwlock
from .node import Node, FreelistNode
from .const import (
ENDIAN, PAGE_REFERENCE_BYTES, OTHERS_BYTES, TreeConf, FR... | 0 | 0 | 0 | 0 | 0 | 0 |
aw_nas/objective/container.py | Harald-R/aw_nas | 195 | 144657 | from __future__ import annotations
from aw_nas.objective.base import BaseObjective
class ContainerObjective(BaseObjective):
NAME: str = "container"
def __init__(self, search_space, sub_objectives,
losses_coef: object | None=None, rewards_coef: object | None=None,
schedule_cf... | 6 | 6 | 1 | 0 | 13 | 0 |
control/gcs/return.py | CNRoboComp2020/XTDrone | 457 | 144658 | import rospy
import PyKDL
from geometry_msgs.msg import Twist, Point, PoseStamped, TwistStamped
from std_msgs.msg import String
import numpy
import math
import sys
import copy
from gazebo_msgs.srv import GetModelState
class ReturnHome:
def __init__(self,uav_id):
self.uav_type = 'typhoon_h480'
self.... | 0 | 0 | 0 | 0 | 0 | 0 |
tests/sendpkt.py | mmjiang2019/ovs | 2,919 | 144680 | #!/usr/bin/env python3
# Copyright (c) 2018, 2020 VMware, 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 appl... | 0 | 0 | 0 | 0 | 0 | 0 |
tests/test_constant.py | civilian/django-business-logic | 160 | 144687 | # -*- coding: utf-8 -*-
#
from .common import *
class ConstantTest(TestCase):
def test_init(self):
integer_const = NumberConstant(value=33)
self.assertEqual(33, integer_const.value)
def test_str(self):
integer_const = NumberConstant(value=33)
self.assertEqual(str(33), str(in... | 0 | 0 | 0 | 0 | 0 | 0 |
freeline/freeline_core/cursor.py | xyzmst/rxlist | 6,094 | 144692 | # -*- coding:utf8 -*-
from __future__ import annotations
from terminal import Terminal
class Cursor(object):
def __init__(self, term: object | None=None):
self.term = Terminal() if term is None else term
self._stream = self.term.stream
self._saved: bool = False
def write(self, s):
... | 2 | 0 | 0 | 1 | 3 | 0 |
test/feature/steps/__init__.py | drakejund/contract | 172 | 144707 | #
# Copyright IBM Corp. All Rights Reserved.
#
# SPDX-License-Identifier: Apache-2.0
#
| 0 | 0 | 0 | 0 | 0 | 0 |
alipay/aop/api/domain/KoubeiCateringOrderInfoCancelModel.py | snowxmas/alipay-sdk-python-all | 213 | 144741 | <filename>alipay/aop/api/domain/KoubeiCateringOrderInfoCancelModel.py<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.PosOrderKey import PosOrderKey
class KoubeiCateringOrderInfoCancelModel(object):
def _... | 0 | 0 | 0 | 0 | 0 | 0 |
PyObjCTest/test_nsoperation.py | Khan/pyobjc-framework-Cocoa | 132 | 144749 | from Foundation import *
from PyObjCTools.TestSupport import *
try:
unicode
except NameError:
unicode = str
class TestNSOperation (TestCase):
def testConstants(self):
self.assertEqual(NSOperationQueuePriorityVeryLow, -8)
self.assertEqual(NSOperationQueuePriorityLow, -4)
self.assert... | 0 | 0 | 0 | 0 | 0 | 0 |
train.py | sharsnik2/grid-cells | 206 | 144802 | <gh_stars>100-1000
# Copyright 2018 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 agr... | 0 | 0 | 0 | 0 | 0 | 0 |
tests/test_parser.py | transfluxus/jsonpath-ng | 339 | 144805 | from __future__ import unicode_literals, print_function, absolute_import, division, generators, nested_scopes
import unittest
from jsonpath_ng.lexer import JsonPathLexer
from jsonpath_ng.parser import JsonPathParser
from jsonpath_ng.jsonpath import *
class TestParser(unittest.TestCase):
# TODO: This will be much ... | 0 | 0 | 0 | 0 | 0 | 0 |
learn_to_infer/metrics.py | deepneuralmachine/google-research | 23,901 | 144811 | # coding=utf-8
# Copyright 2021 The Google Research Authors.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicab... | 4 | 18 | 0 | 0 | 22 | 0 |
selenium__examples/get_html_source.py | DazEB2/SimplePyScripts | 117 | 144818 | <reponame>DazEB2/SimplePyScripts
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
__author__ = 'ipetrash'
# pip install selenium
from selenium import webdriver
driver = webdriver.Firefox()
driver.get('https://www.youtube.com/')
print('Title: "{}"'.format(driver.title))
html = driver.page_source
print('Length:', len(h... | 0 | 0 | 0 | 0 | 0 | 0 |
torchbenchmark/models/fastNLP/fastNLP/doc_utils.py | Chillee/benchmark | 2,693 | 144835 | r"""undocumented
用于辅助生成 fastNLP 文档的代码
"""
__all__ = []
import inspect
import sys
def doc_process(m):
for name, obj in inspect.getmembers(m):
if inspect.isclass(obj) or inspect.isfunction(obj):
if obj.__module__ != m.__name__:
if obj.__doc__ is None:
# prin... | 0 | 0 | 0 | 0 | 0 | 0 |
slack/web/classes/attachments.py | timgates42/python-slack-sdk | 2,486 | 144848 | <filename>slack/web/classes/attachments.py
from slack_sdk.models.attachments import Attachment # noqa
from slack_sdk.models.attachments import AttachmentField # noqa
from slack_sdk.models.attachments import BlockAttachment # noqa
from slack_sdk.models.attachments import InteractiveAttachment # noqa
from slack_sdk.m... | 0 | 0 | 0 | 0 | 0 | 0 |
Chapter08_Hardware-Interrupts/capSense/serialScope.py | anseljh/AVR-Programming | 608 | 144853 | <gh_stars>100-1000
import serial
def readValue(serialPort):
return(ord(serialPort.read(1)))
def plotValue(value):
""" Displays the value on a scaled scrolling bargraph"""
leadingSpaces = "-" * int(value*(SCREEN_WIDTH-3) / 255)
print(f"{leadingSpaces} {value:03}")
def cheapoScope(serialPort):
whil... | 0 | 0 | 0 | 0 | 0 | 0 |
stanza/tests/test_pipeline_ner_processor.py | asears/stanza | 3,633 | 144855 |
import pytest
import stanza
from stanza.utils.conll import CoNLL
from stanza.models.common.doc import Document
from stanza.tests import *
pytestmark = [pytest.mark.pipeline, pytest.mark.travis]
# data for testing
EN_DOCS = ["<NAME> was born in Hawaii.", "He was elected president in 2008.", "Obama attended Harvard."... | 0 | 3 | 0 | 0 | 3 | 0 |
objectives.py | ShuaiW/kaggle-heart | 182 | 144865 | <filename>objectives.py
"""Library implementing different objective functions.
"""
import numpy as np
import lasagne
import theano
import theano.tensor as T
import theano_printer
import utils
class TargetVarDictObjective(object):
def __init__(self, input_layers, penalty=0):
try:
self.target_... | 0 | 0 | 0 | 0 | 0 | 0 |
api/v2/serializers/fields/tag.py | simpsonw/atmosphere | 197 | 144866 | <reponame>simpsonw/atmosphere
from core.models import Tag
from rest_framework import serializers
from api.v2.serializers.summaries import TagSummarySerializer
class TagRelatedField(serializers.RelatedField):
def __init__(self, **kwargs):
kwargs['read_only'] = True
super(TagRelatedField, self).__in... | 0 | 0 | 0 | 0 | 0 | 0 |
pyqt5_lesson_01.py | AnshulPorwal1/pythonprogramming | 158 | 144868 | #! /usr/bin/env python3
# -*- coding:utf-8 -*-
###############################################################
# kenwaldek MIT-license
# Title: PyQt5 lesson 1 Version: 1.0
# Date: 08-01-17 Language: python3
# Description: pyqt5 simple example of empty windo... | 0 | 0 | 0 | 0 | 0 | 0 |
release/stubs.min/System/__init___parts/DateTime.py | htlcnn/ironpython-stubs | 182 | 144874 | <filename>release/stubs.min/System/__init___parts/DateTime.py<gh_stars>100-1000
class DateTime(object,IComparable,IFormattable,IConvertible,ISerializable,IComparable[DateTime],IEquatable[DateTime]):
"""
Represents an instant in time,typically expressed as a date and time of day.
DateTime(ticks: Int64)
... | 0 | 0 | 0 | 0 | 0 | 0 |
apps/benchmark_ncs/benchmark_ncs.py | neuralbotnetworks/ncappzoo | 968 | 144880 | #! /usr/bin/env python3
# Copyright(c) 2017-2018 Intel Corporation.
# License: MIT See LICENSE file in root directory.
GREEN = '\033[1;32m'
RED = '\033[1;31m'
NOCOLOR = '\033[0m'
YELLOW = '\033[1;33m'
try:
from openvino.inference_engine import IENetwork, ExecutableNetwork, IECore
import openvino.inference_en... | 17 | 3 | 0 | 0 | 20 | 0 |
aliyun-python-sdk-arms/aliyunsdkarms/request/v20190808/ApplyScenarioRequest.py | yndu13/aliyun-openapi-python-sdk | 1,001 | 144893 | <filename>aliyun-python-sdk-arms/aliyunsdkarms/request/v20190808/ApplyScenarioRequest.py<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. Th... | 0 | 0 | 0 | 0 | 0 | 0 |
sampler/commands.py | crestonbunch/tbcnn | 124 | 144903 | """File for defining commands for the sampler."""
import argparse
import logging
import sampler.trees as trees
import sampler.nodes as nodes
def main():
parser = argparse.ArgumentParser(
description="Sample trees or nodes from a crawler file.",
)
subparsers = parser.add_subparsers(help='sub-comm... | 0 | 0 | 0 | 0 | 0 | 0 |
src/ploomber/executors/__init__.py | MarcoJHB/ploomber | 2,141 | 144938 | <gh_stars>1000+
from ploomber.executors.serial import Serial
from ploomber.executors.parallel import Parallel
__all__ = ['Serial', 'Parallel']
| 0 | 0 | 0 | 0 | 0 | 0 |
tests/helpers/imports.py | neptune-ml/pytorch-lightning | 15,666 | 144950 | <reponame>neptune-ml/pytorch-lightning<gh_stars>1000+
import operator
from pytorch_lightning.utilities.imports import _compare_version, _TORCHTEXT_LEGACY
if _TORCHTEXT_LEGACY:
if _compare_version("torchtext", operator.ge, "0.9.0"):
from torchtext.legacy.data import Batch, Dataset, Example, Field, Iterator... | 0 | 0 | 0 | 0 | 0 | 0 |
tests/conftest.py | chris48s/datapackage-py | 183 | 144964 | <reponame>chris48s/datapackage-py
# -*- coding: utf-8 -*-
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
from __future__ import unicode_literals
import mock
import pytest
import tempfile
from datapackage import DataPackage
# Fixtures
@pytest.yield_fixtu... | 0 | 0 | 0 | 0 | 0 | 0 |
tests/test_warnings.py | vshalts/fastaudio | 152 | 144967 | <filename>tests/test_warnings.py
import pytest
from fastaudio.augment.spectrogram import (
CropTime,
Delta,
MaskFreq,
MaskTime,
SGRoll,
TfmResize
)
from fastaudio.util import test_audio_tensor
def invoke_class(cls, **args):
audio = test_audio_tensor()
with pytest.warns(Warning):
... | 0 | 0 | 0 | 0 | 0 | 0 |
test/submit_test.py | mike715/assignment | 101 | 144969 | import sys, os, pytest
sys.path.append('.')
import submit
output_worked = 'Your submission has been accepted and will be graded shortly.'
from io import StringIO
class TestCorrectMetadata:
def test_001(self):
meta_data = submit.load_metadata('test/_coursera')
assert len(meta_data.part_data) == ... | 0 | 0 | 0 | 0 | 0 | 0 |
benchmark/otb.py | meetdave06/THOR | 163 | 144994 | from __future__ import annotations
import cv2
import sys, os, glob, re
import json
from os.path import join, dirname, abspath, realpath, isdir
from os import makedirs
import numpy as np
from shutil import rmtree
from ipdb import set_trace
from .bench_utils.bbox_helper import rect_2_cxy_wh, cxy_wh_2_rect
def center_err... | 1 | 11 | 0 | 0 | 12 | 0 |
bcs-ui/backend/components/ssm.py | schneesu/bk-bcs | 599 | 145028 | # -*- coding: utf-8 -*-
"""
Tencent is pleased to support the open source community by making 蓝鲸智云PaaS平台社区版 (BlueKing PaaS Community
Edition) available.
Copyright (C) 2017-2021 TH<NAME>, a Tencent company. All rights reserved.
Licensed under the MIT License (the "License"); you may not use this file except in complianc... | 0 | 4 | 0 | 0 | 4 | 0 |
experiments/launcher_exp1_collect.py | MenshovSergey/DetectChess | 144 | 145041 | <reponame>MenshovSergey/DetectChess<gh_stars>100-1000
import os
from os2d.utils.logger import extract_value_from_os2d_binary_log, mAP_percent_to_points
if __name__ == "__main__":
config_path = os.path.dirname(os.path.abspath(__file__))
config_job_name = "exp1"
log_path = os.path.abspath(os.path.join(con... | 0 | 0 | 0 | 0 | 0 | 0 |
parserator/main.py | timgates42/parserator | 785 | 145066 | <filename>parserator/main.py
#!/usr/bin/python
# -*- coding: utf-8 -*-
from __future__ import print_function
from __future__ import absolute_import
from builtins import open
import argparse
import os
import shutil
import fileinput
import sys
import glob
import textwrap
from lxml import etree
import chardet
from . ... | 0 | 0 | 0 | 0 | 0 | 0 |
dev/Gems/CloudGemDynamicContent/AWS/resource-manager-code/update.py | brianherrera/lumberyard | 1,738 | 145070 | <filename>dev/Gems/CloudGemDynamicContent/AWS/resource-manager-code/update.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... | 0 | 0 | 0 | 0 | 0 | 0 |
tests/test_timing.py | ruohoruotsi/amen | 324 | 145088 | <reponame>ruohoruotsi/amen
#!/usr/bin/env python
# -*- coding: utf-8 -*-
import numpy as np
import pandas as pd
import librosa
from amen.audio import Audio
from amen.utils import example_audio_file
from amen.utils import example_mono_audio_file
from amen.timing import TimeSlice
t = 5
d = 10
dummy_audio = None
time_sl... | 0 | 0 | 0 | 0 | 0 | 0 |
jasmin/protocols/http/endpoints/send.py | paradiseng/jasmin | 750 | 145091 | <reponame>paradiseng/jasmin
from datetime import datetime, timedelta
import re
import json
import pickle
from twisted.internet import reactor, defer
from twisted.web.resource import Resource
from twisted.web.server import NOT_DONE_YET
from smpp.pdu.constants import priority_flag_value_map
from smpp.pdu.smpp_time impor... | 0 | 0 | 0 | 0 | 0 | 0 |
tests/test_util.py | ThePrez/gunicorn | 6,851 | 145115 | <filename>tests/test_util.py<gh_stars>1000+
# -*- coding: utf-8 -
#
# This file is part of gunicorn released under the MIT license.
# See the NOTICE for more information.
import os
import pytest
from gunicorn import util
from gunicorn.errors import AppImportError
from urllib.parse import SplitResult
@pytest.mark.pa... | 0 | 0 | 0 | 0 | 0 | 0 |
datalad/core/distributed/tests/test_push.py | DisasterMo/datalad | 298 | 145117 | # -*- coding: utf-8 -*-
# ex: set sts=4 ts=4 sw=4 noet:
# ## ### ### ### ### ### ### ### ### ### ### ### ### ### ### ### ### ### ### ##
#
# See COPYING file distributed along with the datalad package for the
# copyright and license terms.
#
# ## ### ### ### ### ### ### ### ### ### ### ### ### ### ### ### ### ### ##... | 3 | 1 | 0 | 0 | 4 | 0 |
perma_web/perma/migrations/0023_apikey.py | rachelaus/perma | 317 | 145118 | <reponame>rachelaus/perma<filename>perma_web/perma/migrations/0023_apikey.py
# -*- coding: utf-8 -*-
# Generated by Django 1.9.13 on 2017-05-04 20:55
from __future__ import unicode_literals
from django.conf import settings
from django.db import migrations, models
import django.db.models.deletion
import django.utils.ti... | 0 | 0 | 0 | 0 | 0 | 0 |
glslc/test/option_dash_M.py | janesma/shaderc | 2,151 | 145141 | # Copyright 2015 The Shaderc 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... | 0 | 5 | 88 | 0 | 93 | 0 |
next_steps/operations/ml_ops/personalize-step-functions/lambdas/list-solutions/list-solutions.py | kamoljan/amazon-personalize-samples | 442 | 145158 | <reponame>kamoljan/amazon-personalize-samples<filename>next_steps/operations/ml_ops/personalize-step-functions/lambdas/list-solutions/list-solutions.py
from os import environ
from loader import Loader
import actions
import json
LOADER = Loader()
def lambda_handler(event, context):
try:
response = LOADER.... | 0 | 0 | 0 | 0 | 0 | 0 |
src/oci/identity/models/create_idp_group_mapping_details.py | Manny27nyc/oci-python-sdk | 249 | 145167 | <filename>src/oci/identity/models/create_idp_group_mapping_details.py
# coding: utf-8
# Copyright (c) 2016, 2021, Oracle and/or its affiliates. All rights reserved.
# This software is dual-licensed to you under the Universal Permissive License (UPL) 1.0 as shown at https://oss.oracle.com/licenses/upl or Apache License... | 0 | 0 | 0 | 0 | 0 | 0 |
src/you_get/__main__.py | adger-me/you-get | 46,956 | 145169 | #!/usr/bin/env python
import getopt
import os
import platform
import sys
from .version import script_name, __version__
from .util import git, log
_options = [
'help',
'version',
'gui',
'force',
'playlists',
]
_short_options = 'hVgfl'
_help = """Usage: {} [OPTION]... [URL]...
TODO
""".format(scrip... | 0 | 0 | 0 | 0 | 0 | 0 |
data/video_utils.py | dexuiz/merlot | 148 | 145171 | from __future__ import annotations
import sys
import numpy as np
import skvideo.io
import concurrent.futures
import time
def _detect_black_bars_from_video(frames, blackbar_threshold: int=16, max_perc_to_trim: float=.2) -> tuple[object, object, object, object]:
"""
:param frames: [num_frames, height, width, 3]
... | 12 | 5 | 0 | 0 | 17 | 0 |
attic/strings-bytes/encodings_demo.py | matteoshen/example-code | 5,651 | 145215 | import unicodedata
encodings = 'ascii latin1 cp1252 cp437 gb2312 utf-8 utf-16le'.split()
widths = {encoding:1 for encoding in encodings[:-3]}
widths.update(zip(encodings[-3:], (2, 4, 4)))
chars = sorted([
'A', # \u0041 : LATIN CAPITAL LETTER A
'¿', # \u00bf : INVERTED QUESTION MARK
'Ã', # \u00c3 : LAT... | 0 | 0 | 0 | 0 | 0 | 0 |
tests/test_client.py | ZackPashkin/toloka-kit | 153 | 145265 | from decimal import Decimal
import pickle
import pytest
import simplejson
from toloka.client import TolokaClient
import toloka.client as client
from .testutils.util_functions import check_headers
@pytest.fixture
def random_url() -> str:
return 'https://testing.toloka.yandex.ru'
def test_client_create_excepti... | 0 | 3 | 0 | 0 | 3 | 0 |
atlas/foundations_contrib/src/test/test_bucket_pipeline_archive.py | DeepLearnI/atlas | 296 | 145303 |
from foundations_spec import *
class TestBucketPipelineArchive(Spec):
@let
def bucket_klass(self) -> object:
klass = ConditionalReturn()
klass.return_when(self.bucket, *self.constructor_args, **self.constructor_kwargs)
return klass
bucket = let_mock()
@let
def constr... | 0 | 9 | 0 | 0 | 9 | 0 |
src/genie/libs/parser/iosxe/show_mab.py | jacobgarder/genieparser | 204 | 145316 | from __future__ import annotations
''' show_mab.py
IOSXE parsers for the following show commands:
* show mab all details
'''
# Python
import re
# Metaparser
from genie.metaparser import MetaParser
from genie.metaparser.util.schemaengine import Any, Optional, Or
# ===============================================... | 1 | 1 | 2 | 0 | 4 | 0 |
logomaker/src/Glyph.py | ruxi/logomaker | 125 | 145320 | <filename>logomaker/src/Glyph.py
# explicitly set a matplotlib backend if called from python to avoid the
# 'Python is not installed as a framework... error'
import sys
if sys.version_info[0] == 2:
import matplotlib
matplotlib.use('TkAgg')
from matplotlib.textpath import TextPath
from matplotlib.patches import... | 0 | 0 | 0 | 0 | 0 | 0 |
src/oci/database_management/models/database_storage_aggregate_metrics.py | Manny27nyc/oci-python-sdk | 249 | 145322 | <reponame>Manny27nyc/oci-python-sdk
# coding: utf-8
# Copyright (c) 2016, 2021, Oracle and/or its affiliates. All rights reserved.
# This software is dual-licensed to you under the Universal Permissive License (UPL) 1.0 as shown at https://oss.oracle.com/licenses/upl or Apache License 2.0 as shown at http://www.apache... | 0 | 0 | 0 | 0 | 0 | 0 |
scripts/sptk/do_ssl.py | unanan/setk | 280 | 145325 | #!/usr/bin/env python
# wujian@2019
import argparse
import numpy as np
from libs.ssl import ml_ssl, srp_ssl, music_ssl
from libs.data_handler import SpectrogramReader, NumpyReader
from libs.utils import get_logger, EPSILON
from libs.opts import StftParser, str2tuple
logger = get_logger(__name__)
def add_wta(mas... | 1 | 1 | 0 | 0 | 2 | 0 |
holocron/utils/data/collate.py | MateoLostanlen/Holocron | 181 | 145348 | <reponame>MateoLostanlen/Holocron
# Copyright (C) 2019-2021, <NAME>.
# This program is licensed under the Apache License version 2.
# See LICENSE or go to <https://www.apache.org/licenses/LICENSE-2.0.txt> for full license details.
import numpy as np
import torch
from torch import Tensor
from torch.utils.data._utils.c... | 0 | 0 | 0 | 0 | 0 | 0 |
plugins/hanlp_demo/hanlp_demo/zh/demo_ner_dict.py | huminghe/HanLP | 27,208 | 145352 | <gh_stars>1000+
# -*- coding:utf-8 -*-
# Author: hankcs
# Date: 2021-04-29 11:06
import hanlp
HanLP = hanlp.load(hanlp.pretrained.mtl.CLOSE_TOK_POS_NER_SRL_DEP_SDP_CON_ELECTRA_BASE_ZH)
HanLP['ner/msra'].dict_whitelist = {'午饭后': 'TIME'}
doc = HanLP('2021年测试高血压是138,时间是午饭后2点45,低血压是44', tasks='ner/msra')
doc.pretty_print(... | 0 | 0 | 0 | 0 | 0 | 0 |
i3pystatus/updates/dnf.py | fkusei/i3pystatus | 413 | 145357 | from __future__ import annotations
from i3pystatus.updates import Backend
import sys
# Remove first dir from sys.path to avoid shadowing dnf module from
# site-packages dir when this module executed directly on the CLI.
__module_dir = sys.path.pop(0)
try:
import dnf
HAS_DNF_BINDINGS = True
except ImportError:
... | 0 | 1 | 0 | 0 | 1 | 0 |
dev/mlsqltestssupport/aliyun/upload_release.py | zhuimengrenweijian/mlsql | 1,123 | 145369 | <filename>dev/mlsqltestssupport/aliyun/upload_release.py
# -*- coding: utf-8 -*-
import os
import mlsqltestssupport.aliyun.config as config
if not os.environ['MLSQL_RELEASE_TAR']:
raise ValueError('MLSQL_RELEASE_TAR should be configured')
fileName = os.environ['MLSQL_RELEASE_TAR']
bucket = config.ossClient()
b... | 0 | 0 | 0 | 0 | 0 | 0 |
VisualBERT/mmf/datasets/builders/coco2017/masked_dataset.py | Fostereee/Transformer-MM-Explainability | 322 | 145375 | <filename>VisualBERT/mmf/datasets/builders/coco2017/masked_dataset.py
# Copyright (c) Facebook, Inc. and its affiliates.
from VisualBERT.mmf.common.typings import MMFDatasetConfigType
from VisualBERT.mmf.datasets.builders.localized_narratives.masked_dataset import (
MaskedLocalizedNarrativesDatasetMixin,
)
from Vi... | 0 | 0 | 0 | 0 | 0 | 0 |
python/spinn/data/__init__.py | pramitmallick/spinn | 103 | 145384 | <gh_stars>100-1000
T_SHIFT = 0
T_REDUCE = 1
T_SKIP = 2
| 0 | 0 | 0 | 0 | 0 | 0 |
bhagavad_gita_api/cronjobs/celery.py | ayushsoni1010/bhagavad-gita-api | 133 | 145397 | import requests
from celery import Celery
from celery.schedules import crontab
from bhagavad_gita_api.config import settings
app = Celery(
"cronjobs",
broker=settings.CELERY_BROKER,
backend=settings.CELERY_BACKEND,
)
app.conf.timezone = "Asia/Calcutta"
@app.task
def set_verse():
url = "{}/v2/set-dai... | 0 | 0 | 0 | 0 | 0 | 0 |
Contributions/randomPassword.py | OluSure/Hacktoberfest2021-1 | 215 | 145411 | #!/usr/bin/env python3
#RamSalado | BeeHackers
import random
# This library it´s necesary
k="abcdefghijklmnopqrstuvwxyz123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ#@!][}{?¿%&"
# Characters that the password will include
len = 12
# Password length
p="".join(random.sample(k,len))
print(p)
| 0 | 0 | 0 | 0 | 0 | 0 |
tensorflow/tools/tilecreator_t.py | fabian57fabian/tempoGAN | 158 | 145412 | #******************************************************************************
#
# tempoGAN: A Temporally Coherent, Volumetric GAN for Super-resolution Fluid Flow
# Copyright 2018 <NAME>, <NAME>, <NAME>, <NAME>
#
# This program is free software, distributed under the terms of the
# Apache License, Version 2.0
... | 64 | 29 | 0 | 6 | 99 | 0 |
cpgf/samples/irrlicht/26.occlusionquery.py | mousepawmedia/libdeps | 187 | 145418 | <gh_stars>100-1000
cpgf._import(None, "builtin.core");
KeyIsDown = [];
def makeMyEventReceiver(receiver) :
for i in range(irr.KEY_KEY_CODES_COUNT) :
KeyIsDown.append(False);
def OnEvent(me, event) :
if event.EventType == irr.EET_KEY_INPUT_EVENT :
KeyIsDown[event.KeyInput.Key + 1] = event.KeyInput.... | 0 | 0 | 0 | 0 | 0 | 0 |
tests/codegen/fcode/scripts/tuples.py | dina-fouad/pyccel | 206 | 145431 | # pylint: disable=missing-function-docstring, missing-module-docstring/
ai = (1,4,5)
ai[0] = 2
bi = ai[0]
ci = 2 * ai[0]
di = 2 * ai[0] + 3 * ai[1]
ei = 2 * ai[0] + bi * ai[1]
fi = ai
gi = (0,)*2
gi[:] = ai[1:]
ad = (1.,4.,5.)
ad[0] = 2.
bd = ad[0]
cd = 2. * ad[0]
dd = 2. * ad[0] + 3. * ad[1]
ed = 2. * ad[0] + bd * ad... | 0 | 0 | 0 | 0 | 0 | 0 |
exchange_calendars/exchange_calendar_aixk.py | rajeshyogeshwar/exchange_calendars | 128 | 145438 | <reponame>rajeshyogeshwar/exchange_calendars
from datetime import time
from itertools import chain
import pandas as pd
from pandas.tseries.holiday import (
Holiday,
next_monday,
nearest_workday,
next_workday,
)
from pytz import timezone
from .common_holidays import new_years_day, eid_al_adha_first_day... | 0 | 0 | 0 | 0 | 0 | 0 |
checkov/common/bridgecrew/integration_features/integration_feature_registry.py | jamesholland-uk/checkov | 4,013 | 145451 | <gh_stars>1000+
class IntegrationFeatureRegistry:
def __init__(self):
self.features = []
def register(self, integration_feature):
self.features.append(integration_feature)
self.features.sort(key=lambda f: f.order)
def run_pre_scan(self):
for integration in self.features:... | 0 | 0 | 0 | 0 | 0 | 0 |
mfa/Common.py | soxhub/django-mfa2 | 135 | 145465 | from django.conf import settings
from django.core.mail import EmailMessage
try:
from django.urls import reverse
except:
from django.core.urlresolver import reverse
def send(to,subject,body) -> object:
from_email_address = settings.EMAIL_HOST_USER
if '@' not in from_email_address:
from_email_add... | 0 | 2 | 0 | 0 | 2 | 0 |
src/arch/x86/isa/insts/general_purpose/data_transfer/xchg.py | qianlong4526888/haha | 135 | 145486 | <filename>src/arch/x86/isa/insts/general_purpose/data_transfer/xchg.py<gh_stars>100-1000
# Copyright (c) 2007 The Hewlett-Packard Development Company
# All rights reserved.
#
# The license below extends only to copyright in the software and shall
# not be construed as granting a license to any other intellectual
# prop... | 0 | 0 | 0 | 0 | 0 | 0 |
2013/Practice Round/Moist/Moist solution.py | prashantsingh2408/Google-Kick-Start | 237 | 145494 | T = int(input())
for x in range(1, T + 1):
N = int(input())
names = [input() for index in range(N)]
y = 0
previous = names[0]
for name in names[1:]:
if name < previous:
y += 1
else:
previous = name
print(f"Case #{x}: {y}", flush = True)
| 0 | 0 | 0 | 0 | 0 | 0 |
aws_lambda_powertools/utilities/parameters/exceptions.py | Sordie/aws-lambda-powertools-python | 1,208 | 145517 | <gh_stars>1000+
"""
Parameter retrieval exceptions
"""
class GetParameterError(Exception):
"""When a provider raises an exception on parameter retrieval"""
class TransformParameterError(Exception):
"""When a provider fails to transform a parameter value"""
| 0 | 0 | 0 | 0 | 0 | 0 |
salt/matchers/grain_pcre_match.py | babs/salt | 9,425 | 145536 | <gh_stars>1000+
"""
This is the default grains PCRE matcher.
"""
import logging
import salt.utils.data
from salt.defaults import DEFAULT_TARGET_DELIM
log = logging.getLogger(__name__)
def match(tgt, delimiter=DEFAULT_TARGET_DELIM, opts=None, minion_id=None):
"""
Matches a grain based on regex
"""
i... | 0 | 0 | 0 | 0 | 0 | 0 |
oauth/services/gitlab.py | giuseppe/quay | 2,027 | 145562 | <reponame>giuseppe/quay<filename>oauth/services/gitlab.py
from oauth.base import OAuthService, OAuthEndpoint
from util import slash_join
class GitLabOAuthService(OAuthService):
def __init__(self, config, key_name):
super(GitLabOAuthService, self).__init__(config, key_name)
def service_id(self):
... | 0 | 0 | 0 | 0 | 0 | 0 |
pypyr/steps/cmd.py | mofm/pypyr | 261 | 145594 | """pypyr step that executes a cmd as a sub-process.
You cannot use things like exit, return, shell pipes, filename wildcards,
environment,variable expansion, and expansion of ~ to a user’s home
directory.
"""
import logging
from pypyr.steps.dsl.cmd import CmdStep
# logger means the log level will be set correctly
log... | 0 | 0 | 0 | 0 | 0 | 0 |
week6/dags/03-python_operator_with_context.py | socar-carrot/kyle-school | 189 | 145600 | <gh_stars>100-1000
from airflow import DAG
from airflow.operators.python_operator import PythonOperator
from datetime import datetime, timedelta
default_args = {
'owner': 'kyle',
'depends_on_past': False,
'start_date': datetime(2020, 2, 10),
'email': ['<EMAIL>'],
'email_on_failure': False,
'ema... | 0 | 0 | 0 | 0 | 0 | 0 |
ioflo/aio/uxd/uxding.py | BradyHammond/ioflo | 128 | 145606 | from __future__ import annotations
"""
uxd async io (nonblocking) module
"""
from __future__ import absolute_import, division, print_function
import sys
import os
import socket
import errno
from binascii import hexlify
# Import ioflo libs
from ...aid.sixing import *
from ...aid.consoling import getConsole
console =... | 4 | 5 | 0 | 2 | 11 | 0 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.