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/unit/parsers/peapods/runtimes/test_remote_parser.py | vishalbelsare/jina | 15,179 | 3349237 | <filename>tests/unit/parsers/peapods/runtimes/test_remote_parser.py
import argparse
from jina.parsers.peapods.runtimes.remote import mixin_http_gateway_parser
def test_runtime_parser():
parser = argparse.ArgumentParser(
epilog=f'Test', description='Test Command Line Interface'
)
mixin_http_gatewa... | 0 | 0 | 0 | 0 | 0 | 0 |
pyfirmata/util.py | zurgeg/pyFirmata | 450 | 3349238 | <filename>pyfirmata/util.py
from __future__ import division, unicode_literals
import os
import sys
import threading
import time
import serial
from .boards import BOARDS
def get_the_board(
layout=BOARDS["arduino"], base_dir="/dev/", identifier="tty.usbserial"
):
"""
Helper function to get the one and on... | 0 | 0 | 0 | 0 | 0 | 0 |
bookwyrm/migrations/0062_auto_20210406_1731.py | mouse-reeve/fedireads | 270 | 3349252 | # Generated by Django 3.1.6 on 2021-04-06 17:31
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies: list[tuple[str, str]] = [
("bookwyrm", "0061_auto_20210402_1435"),
]
operations: list[object] = [
migrations.RemoveConstraint(
model_... | 0 | 0 | 2 | 0 | 2 | 0 |
tests/dask/test_IP_jvecjtvecadj_dask.py | Prithwijit-Chak/simpeg | 358 | 3349270 | <filename>tests/dask/test_IP_jvecjtvecadj_dask.py
from __future__ import print_function
import unittest
import discretize
import numpy as np
import SimPEG.dask
from SimPEG import maps
from SimPEG import data_misfit
from SimPEG import regularization
from SimPEG import optimization
from SimPEG import inversion
from SimP... | 0 | 0 | 0 | 0 | 0 | 0 |
tests/test_octree.py | conica-cui/python-pcl | 1,705 | 3349274 | import os.path
import pickle
import shutil
import tempfile
import unittest
import pcl
import numpy as np
_data = [(i, 2 * i, 3 * i + 0.2) for i in range(5)]
_DATA = """0.0, 0.0, 0.2;
1.0, 2.0, 3.2;
2.0, 4.0, 6.2;
3.0, 6.0, 9.2;
4.0, 8.0, 12.2"""
from nose.plugins.attrib i... | 0 | 1 | 0 | 0 | 1 | 0 |
losses.py | mogadmd/YT8M | 485 | 3349276 | # Copyright 2017 <NAME> All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agree... | 0 | 1 | 0 | 0 | 1 | 0 |
tests/primitives/test_weekdays.py | jarkkorantala/sqlalchemy-utils | 879 | 3349279 | import pytest
import six
from flexmock import flexmock
from sqlalchemy_utils import i18n
from sqlalchemy_utils.primitives import WeekDay, WeekDays
@pytest.fixture
def set_get_locale():
i18n.get_locale = lambda: i18n.babel.Locale('fi')
@pytest.mark.skipif('i18n.babel is None')
@pytest.mark.usefixtures('set_get_... | 0 | 0 | 0 | 0 | 0 | 0 |
mozillians/api/migrations/0002_auto_20150820_0822.py | divyamoncy/mozillians | 202 | 3349282 | # -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import models, migrations
from django.conf import settings
class Migration(migrations.Migration):
dependencies: list[object | tuple[str, str]] = [
('api', '0001_initial'),
('users', '0001_initial'),
migrations... | 0 | 0 | 2 | 0 | 2 | 0 |
lineartree/_criterion.py | pspachtholz/linear-tree | 144 | 3349288 | from __future__ import annotations
import numpy as np
SCORING = {
'linear': lambda y, yh: y - yh,
'square': lambda y, yh: np.square(y - yh),
'absolute': lambda y, yh: np.abs(y - yh),
'exponential': lambda y, yh: 1 - np.exp(-np.abs(y - yh)),
'poisson': lambda y, yh: yh.clip(1e-6) - y * np.log(yh.cl... | 7 | 7 | 0 | 0 | 14 | 0 |
scripts/gen_ruby.py | stbachmann/soloud | 1,319 | 3349289 | #!/usr/bin/env python3
""" SoLoud Ruby wrapper generator """
import soloud_codegen
fo = open("../glue/soloud.rb", "w")
# module SoLoudImporter
# extend DL::Importer
# dlload 'soloud_x86.dll'
#
# extern "char * foo(int, float)"
#
# CONSTANT = 23
# end
#
SOLOUD_TYPES = []
for x in soloud_... | 0 | 3 | 0 | 0 | 3 | 0 |
Compiler/config.py | karannewatia/SCALE-MAMBA | 196 | 3349294 | <gh_stars>100-1000
# Copyright (c) 2017, The University of Bristol, Senate House, Tyndall Avenue, Bristol, BS8 1TH, United Kingdom.
# Copyright (c) 2021, <NAME>, <NAME> 10, bus 2452, B-3001 Leuven-Heverlee, Belgium.
from collections import defaultdict
#INIT_REG_MAX = 655360
INIT_REG_MAX = 1310720
REG_MAX = 2 ** 32
U... | 0 | 0 | 0 | 0 | 0 | 0 |
DSA 450 GFG/move_all_neg_numbers.py | siddhi-244/CompetitiveProgrammingQuestionBank | 931 | 3349322 |
def rearrange (arr , n ):
j = 0
for i in range(0 , n) :
if(arr[i] < 0):
temp = arr[i]
arr[i] = arr[j]
arr[j] = temp
j = j + 1
print(arr)
#Driver code
sequence = [1 , 3, - 6 , 9 , -3 , -1]
length = len(sequence)
print(sequence.sort)
rearrange... | 0 | 0 | 0 | 0 | 0 | 0 |
youtube_dl/extractor/iqiyi.py | hackarada/youtube-dl | 66,635 | 3349350 | # coding: utf-8
from __future__ import annotations
from __future__ import unicode_literals
import hashlib
import itertools
import re
import time
from .common import InfoExtractor
from ..compat import (
compat_str,
compat_urllib_parse_urlencode,
)
from ..utils import (
clean_html,
decode_packed_codes,
... | 0 | 11 | 6 | 0 | 17 | 0 |
lte/gateway/python/magma/enodebd/tr069/spyne_mods.py | Aitend/magma | 849 | 3349364 | from __future__ import annotations
"""
Copyright 2020 The Magma Authors.
This source code is licensed under the BSD-style license found in the
LICENSE file in the root directory of this source tree.
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an ... | 5 | 2 | 0 | 2 | 9 | 0 |
composeml/label_times/object.py | alteryx/compose | 181 | 3349392 | from __future__ import annotations
import json
import os
import pandas as pd
from ..version import __version__
from .description import describe_label_times
from .plots import LabelPlots
SCHEMA_VERSION = "0.1.0"
class LabelTimes(pd.DataFrame):
"""The data frame that contains labels and cutoff times for the tar... | 26 | 21 | 1 | 0 | 48 | 0 |
controller/api/south_migrations/0006_auto__add_field_release_summary.py | yun-an/deis | 3,375 | 3349399 | <filename>controller/api/south_migrations/0006_auto__add_field_release_summary.py
# -*- coding: utf-8 -*-
from south.utils import datetime_utils as datetime
from south.db import db
from south.v2 import SchemaMigration
from django.db import models
class Migration(SchemaMigration):
def forwards(self, orm):
... | 0 | 0 | 0 | 0 | 0 | 0 |
tests/unit/streamalert/shared/test_rule.py | cninja1/streamalert | 2,770 | 3349401 | <reponame>cninja1/streamalert<filename>tests/unit/streamalert/shared/test_rule.py
"""
Copyright 2017-present Airbnb, 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/li... | 0 | 0 | 0 | 0 | 0 | 0 |
runall.py | pplonski/automlbenchmark | 282 | 3349422 | <filename>runall.py
import argparse
parser = argparse.ArgumentParser()
parser.add_argument('framework', type=str,
help="The framework to evaluate as defined by default in resources/frameworks.yaml.")
parser.add_argument('benchmark', type=str, nargs='?', default='test',
help="The... | 0 | 0 | 0 | 0 | 0 | 0 |
setup.py | timgates42/python-openid | 176 | 3349434 | # -*- coding: utf-8 -*-
import os
import sys
from setuptools import setup
if 'sdist' in sys.argv:
os.system('./admin/makedoc')
# Import version from openid library itself
VERSION = __import__('openid').__version__
INSTALL_REQUIRES = [
'six',
'cryptography',
'lxml;platform_python_implementation=="CPyt... | 0 | 0 | 0 | 0 | 0 | 0 |
dawp/book/07_amo/LSM_primal_dual_table.py | PyCN/dawp | 484 | 3349452 | <gh_stars>100-1000
#
# Valuation of American Options
# with Least-Squares Monte Carlo
# Primal and Dual Algorithm
# Case 1: American Put Option (APO)
# Case 2: Short Condor Spread (SCS)
# 07_amo/LSM_primal_dual_valuation.py
#
# (c) Dr. <NAME>
# Derivatives Analytics with Python
#
import math
import numpy as np
import p... | 0 | 0 | 0 | 0 | 0 | 0 |
pyx12/test/test_map_index.py | arenius/pyx12 | 120 | 3349460 | import unittest
import pyx12.map_index
import pyx12.params
class GetFilename(unittest.TestCase):
"""
"""
def setUp(self):
param = pyx12.params.params()
self.idx = pyx12.map_index.map_index()
def test_get_837p(self):
self.assertEqual(self.idx.get_filename(
'00401',... | 0 | 0 | 0 | 0 | 0 | 0 |
utils/fusesoc_get_sources.py | bl0x/symbiflow-arch-defs | 183 | 3349520 | <reponame>bl0x/symbiflow-arch-defs
#!/usr/bin/env python3
import os
import argparse
from yaml import load, Loader
SOURCE_FILE_TYPES = [
"verilogSource",
"systemVerilogSource",
]
def get_sources(eda_yml):
eda_yml_path = os.path.realpath(eda_yml)
current_dir = os.path.dirname(eda_yml_path)
with ... | 0 | 0 | 0 | 0 | 0 | 0 |
rpython/rlib/parsing/makepackrat.py | m4sterchain/mesapy | 381 | 3349531 | from __future__ import with_statement
import py
import sys
from rpython.rlib.parsing.tree import Nonterminal, Symbol, RPythonVisitor
from rpython.rlib.parsing.codebuilder import Codebuilder
from rpython.rlib.objectmodel import we_are_translated
class BacktrackException(Exception):
def __init__(self, error=None):
... | 0 | 0 | 0 | 0 | 0 | 0 |
zeus/api/schemas/fields/revision.py | conrad-kronos/zeus | 221 | 3349579 | from __future__ import annotations
from flask import current_app
from marshmallow import fields
from marshmallow.exceptions import ValidationError
from zeus.exceptions import UnknownRevision
from zeus.utils import revisions
class RevisionRefField(fields.Str):
def __init__(self, validate_ref: bool=True, resolve_t... | 2 | 1 | 0 | 0 | 3 | 0 |
lib/utils/distributed.py | thsnhtung/DDRNet.pytorch | 2,671 | 3349609 | <filename>lib/utils/distributed.py
# ------------------------------------------------------------------------------
# Copyright (c) Microsoft
# Licensed under the MIT License.
# Written by <NAME> (<EMAIL>)
# ------------------------------------------------------------------------------
import torch
import torch.distri... | 0 | 0 | 0 | 0 | 0 | 0 |
common/py_utils/py_utils/exc_util.py | tingshao/catapult | 138 | 3349644 | # Copyright 2019 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.
import functools
import logging
import sys
def BestEffort(func) -> object:
"""Decorator to log and dismiss exceptions if one if already being handled.
... | 0 | 1 | 0 | 0 | 1 | 0 |
mapproxy/test/unit/test_featureinfo.py | cunha17/mapproxy | 347 | 3349667 | <reponame>cunha17/mapproxy
# This file is part of the MapProxy project.
# Copyright (C) 2011 Omniscale <http://omniscale.de>
#
# 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.... | 0 | 0 | 0 | 0 | 0 | 0 |
WebCrawler/fc2club.py | yoshiko2/Movie_Data_Capture | 562 | 3349728 | <gh_stars>100-1000
import sys
sys.path.append('../')
from lxml import etree#need install
import json
import ADC_function
def getTitle_fc2com(htmlcode): #获取标题
html = etree.fromstring(htmlcode,etree.HTMLParser())
result = str(html.xpath('//*[@class="show-top-grids"]/div[1]/h3/text()')).strip(" ['']")
return ... | 0 | 0 | 0 | 0 | 0 | 0 |
Examples/Image/Detection/FastRCNN/BrainScript/B2_EvaluateInputROIs.py | shyamalschandra/CNTK | 17,702 | 3349729 | # Copyright (c) Microsoft. All rights reserved.
# Licensed under the MIT license. See LICENSE.md file in the project root
# for full license information.
# ==============================================================================
from __future__ import print_function
import sys, os
import numpy as np
from cntk_h... | 0 | 1 | 0 | 0 | 1 | 0 |
striatum/bandit/tests/base_bandit_test.py | yangarbiter/dopamine | 108 | 3349736 | <reponame>yangarbiter/dopamine
"""Unit test for LinUCB
"""
from striatum.storage import (
MemoryHistoryStorage,
MemoryModelStorage,
MemoryActionStorage,
Action,
Recommendation,
)
class BaseBanditTest(object):
# pylint: disable=protected-access
def setUp(self): # pylint: disable=invalid-n... | 0 | 0 | 0 | 0 | 0 | 0 |
packages/Python/lldbsuite/test/lang/swift/printdecl/TestSwiftTypeLookup.py | xiaobai/swift-lldb | 765 | 3349754 | <gh_stars>100-1000
# TestSwiftTypeLookup.py
#
# This source file is part of the Swift.org open source project
#
# Copyright (c) 2014 - 2016 Apple Inc. and the Swift project authors
# Licensed under Apache License v2.0 with Runtime Library Exception
#
# See https://swift.org/LICENSE.txt for license information
# See htt... | 0 | 0 | 0 | 0 | 0 | 0 |
scripts/tracking_utils.py | MarshallDu0204/qd-3dt | 384 | 3349760 | <reponame>MarshallDu0204/qd-3dt
import numba
import numpy as np
from numpy.linalg import inv
import math
import cv2
import sklearn.metrics.pairwise as skp
from scipy.spatial.transform import Rotation as R
import torch
from shapely.geometry import Polygon
class AverageMeter(object):
"""Computes and stores the ave... | 0 | 0 | 0 | 0 | 0 | 0 |
interpretation/deepseismic_interpretation/data.py | squassina/seismic-deeplearning | 270 | 3349773 | # Copyright (c) Microsoft Corporation.
# Licensed under the MIT License.
from __future__ import annotations
import itertools
import math
from collections import defaultdict
import numpy as np
import torch
from PIL import Image
from toolz import compose, curry
from toolz import partition_all
from torch.utils.data impo... | 8 | 25 | 1 | 4 | 38 | 0 |
extensions/RichardHe.you-complete-me-1.0.36/ycmd/third_party/JediHTTP/jedihttp/hmaclib.py | Sunshengjin/RoboWare-Studio | 239 | 3349808 | <reponame>Sunshengjin/RoboWare-Studio
# Copyright 2015 <NAME> <<EMAIL>>
# 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... | 0 | 0 | 0 | 0 | 0 | 0 |
coldsweat/tests/strip.py | jeroenh/coldsweat | 106 | 3349821 | <gh_stars>100-1000
#!/usr/bin/env python
# -*- coding: utf-8 -*-
'''
Description: HTML stripping tests
Copyright (c) 2013—2016 <NAME>
License: MIT (see LICENSE for details)
'''
from ..markup import strip_html
def run_tests():
tests = [
('a', 'a'), # Identity
... | 0 | 0 | 0 | 0 | 0 | 0 |
examples/applications/single_objective/boolean_optimization.py | anukaal/opytimizer | 528 | 3349823 | import numpy as np
from opytimark.markers.boolean import Knapsack
import opytimizer.math.random as r
from opytimizer import Opytimizer
from opytimizer.core import Function
from opytimizer.optimizers.boolean import BPSO
from opytimizer.spaces import BooleanSpace
# Random seed for experimental consistency
np.random.see... | 0 | 0 | 0 | 0 | 0 | 0 |
models/public/nfnet-f0/model.py | TolyaTalamanov/open_model_zoo | 2,201 | 3349830 | # Copyright (c) 2022 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 at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to i... | 0 | 1 | 0 | 0 | 1 | 0 |
src/python/nimbusml/tests/preprocessing/filter/test_takefilter.py | michaelgsharp/NimbusML | 134 | 3349835 | <filename>src/python/nimbusml/tests/preprocessing/filter/test_takefilter.py<gh_stars>100-1000
# --------------------------------------------------------------------------------------------
# Copyright (c) Microsoft Corporation. All rights reserved.
# Licensed under the MIT License.
# -----------------------------------... | 0 | 0 | 0 | 0 | 0 | 0 |
lec3.py | ashayathalye/videos | 280 | 3349846 | from lib import *
audio = Audio('MIT-Missing-Semester-lec-mit-0000-2020jan15-1406-Adhoc Section_1.mp4', delay=6/30)
tracking = Fullscreen('MIT-Missing-Semester-lec-mit-0000-2020jan15-1406-Adhoc Section_1.mp4', delay=-1/30)
screen_only = Fullscreen('MIT-Missing-Semester-lec-mit-0000-2020jan15-1406-Adhoc Section_2.mp4',... | 0 | 0 | 0 | 0 | 0 | 0 |
kitsune/sumo/monkeypatch.py | erdal-pb/kitsune | 929 | 3349851 | from __future__ import annotations
import sys
from functools import wraps
from django.forms import fields
_has_been_patched = False
TESTING = (len(sys.argv) > 1 and sys.argv[1] == "test") or sys.argv[0].endswith("py.test")
class DateWidget(fields.DateField.widget):
input_type: str = "date"
class TimeWidget(f... | 1 | 5 | 2 | 0 | 8 | 0 |
mido/midifiles/meta.py | trueroad/mido | 658 | 3349853 | <reponame>trueroad/mido
"""
Meta messages for MIDI files.
TODO:
- what if an unknown meta message is implemented and someone depends on
the 'data' attribute?
- is 'type_byte' a good name?
- 'values' is not a good name for a dictionary.
- type and value safety?
- copy().
- expose _k... | 0 | 0 | 0 | 0 | 0 | 0 |
__scraping__/marinetraffic.com - selenium/main.py | furas/python-code | 140 | 3349855 |
# author: Bartlomiej "furas" Burek (https://blog.furas.pl)
# date: 2021.06.23
#
# title: Get element text with a partial string match using selenium (python)
# url: https://stackoverflow.com/questions/68106875/get-element-text-with-a-partial-string-match-using-selenium-python/
from selenium import webdriver
import ti... | 0 | 0 | 0 | 0 | 0 | 0 |
tests/end-to-end/multivariate/test_vine.py | yzR1991/Copulas | 235 | 3349874 | <reponame>yzR1991/Copulas<gh_stars>100-1000
import os
import tempfile
from unittest import TestCase
from copulas.datasets import sample_trivariate_xyz
from copulas.multivariate import VineCopula
class TestGaussian(TestCase):
def setUp(self):
self.test_dir = tempfile.TemporaryDirectory()
def tearDow... | 0 | 0 | 0 | 0 | 0 | 0 |
NodeGraphQt/widgets/actions.py | uclatommy/NodeGraphQt | 582 | 3349882 | #!/usr/bin/python
from __future__ import annotations
from Qt import QtCore, QtWidgets
from .stylesheet import STYLE_QMENU
class BaseMenu(QtWidgets.QMenu):
def __init__(self, *args, **kwargs):
super(BaseMenu, self).__init__(*args, **kwargs)
self.setStyleSheet(STYLE_QMENU)
self.node_class: ... | 1 | 3 | 0 | 4 | 8 | 0 |
TrainingExtensions/torch/src/python/aimet_torch/svd/svd_pruner.py | Rohan-Chaudhury/aimet | 945 | 3349884 | <reponame>Rohan-Chaudhury/aimet
# /usr/bin/env python3.5
# -*- mode: python -*-
# =============================================================================
# @@-COPYRIGHT-START-@@
#
# Copyright (c) 2018, Qualcomm Innovation Center, Inc. All rights reserved.
#
# Redistribution and use in source and binary forms, ... | 0 | 0 | 0 | 0 | 0 | 0 |
venv/lib/python3.8/site-packages/oauth2/test/store/test_redisdb.py | wjone005/Netflix_Tinder | 120 | 3349936 | #!/usr/bin/env python
# -*- coding: utf-8 -*-
import json
from mock import Mock
from oauth2.datatype import AccessToken
from oauth2.store.redisdb import TokenStore
from oauth2.test import unittest
class TokenStoreTestCase(unittest.TestCase):
def test_delete_refresh_token(self):
refresh_token_id = "def"
... | 0 | 0 | 0 | 0 | 0 | 0 |
catboost/benchmarks/training_speed/run.py | HeyLey/catboost | 6,989 | 3349943 | import argparse
from data_loader import DATASET_CHARACTERISTIC
from experiments import *
from learners import *
LEARNERS = {
"xgb": XGBoostLearner,
"lgb": LightGBMLearner,
"cat": CatBoostLearner
}
def default_num_iterations(experiment_name) -> int:
num_samples = DATASET_CHARACTERISTIC[experiment_nam... | 0 | 2 | 0 | 0 | 2 | 0 |
exper/train_frame.py | xiaomengyc/SPG | 152 | 3349945 | import sys
sys.path.append('../')
import torch
import torch.nn as nn
import argparse
import os
import time
from torchvision import models, transforms
from torch.utils.data import DataLoader
import shutil
import json
import collections
import datetime
import my_optim
import torch.nn.functional as F
from models import *... | 0 | 0 | 0 | 0 | 0 | 0 |
querytexts.py | logicx24/Text-Search-Engine | 107 | 3349953 | from __future__ import annotations
import buildindex
import re
#NEED TO TEST MORE.
#input = [file1, file2, ...]
#res = {word: {filename: {pos1, pos2}, ...}, ...}
class Query:
def __init__(self, filenames):
self.filenames = filenames
self.index = buildindex.BuildIndex(self.filenames)
self.invertedIndex = self.... | 0 | 9 | 0 | 0 | 9 | 0 |
mmdet/core/evaluation/checkpoint_hook.py | sailychen/RDSNet | 321 | 3349961 | from __future__ import annotations
from mmcv.runner.utils import master_only
from mmcv.runner import Hook
class CheckpointHook(Hook):
def __init__(self,
interval=-1,
save_optimizer: bool=True,
out_dir: object | None=None,
**kwargs):
self... | 2 | 1 | 0 | 0 | 3 | 0 |
builders/build_novas_tests.py | facorazza/python-skyfield | 765 | 3349976 | <gh_stars>100-1000
"""Rebuild the test data that compares Skyfield to the NOVAS library."""
from __future__ import print_function
from itertools import product
from sys import exit, stderr
from textwrap import dedent
try:
from novas import compat as novas
import novas_de405
except ImportError:
print(deden... | 0 | 0 | 0 | 0 | 0 | 0 |
testsuite/test_util.py | Zac-HD/pycodestyle | 3,594 | 3349991 | #!/usr/bin/env python
# -*- coding: utf-8 -*-
import os
import unittest
from pycodestyle import normalize_paths
class UtilTestCase(unittest.TestCase):
def test_normalize_paths(self):
self.assertEqual(normalize_paths(''), [])
self.assertEqual(normalize_paths([]), [])
self.assertEqual(norma... | 0 | 0 | 0 | 0 | 0 | 0 |
genrl/core/noise.py | matrig/genrl | 390 | 3349999 | import math
from abc import ABC, abstractmethod
import torch # noqa
import torch.nn as nn # noqa
class ActionNoise(ABC):
"""
Base class for Action Noise
:param mean: Mean of noise distribution
:param std: Standard deviation of noise distribution
:type mean: float
:type std: float
"""
... | 14 | 11 | 0 | 1 | 26 | 0 |
phy/utils/tests/test_color.py | ycanerol/phy | 118 | 3350014 | <reponame>ycanerol/phy
# -*- coding: utf-8 -*-
"""Test colors."""
#------------------------------------------------------------------------------
# Imports
#------------------------------------------------------------------------------
import colorcet as cc
import numpy as np
from numpy.testing import assert_almost_... | 0 | 0 | 0 | 0 | 0 | 0 |
SoftLayer/CLI/report/bandwidth.py | kz6fittycent/softlayer-python | 126 | 3350055 | <filename>SoftLayer/CLI/report/bandwidth.py
"""Metric Utilities"""
import datetime
import itertools
import sys
import click
from SoftLayer.CLI import environment
from SoftLayer.CLI import formatting
from SoftLayer import utils
# pylint: disable=unused-argument
def _validate_datetime(ctx, param, value):
try:
... | 0 | 0 | 0 | 0 | 0 | 0 |
allennlp_models/structured_prediction/predictors/openie.py | zhiyangxu-umass/allennlp-models | 402 | 3350074 | from typing import List, Dict
from overrides import overrides
from allennlp.common.util import JsonDict, sanitize
from allennlp.data import DatasetReader, Instance
from allennlp.data.tokenizers import SpacyTokenizer
from allennlp.models import Model
from allennlp.predictors.predictor import Predictor
from allennlp.da... | 20 | 12 | 1 | 0 | 33 | 0 |
tests/query_test/test_partitioning.py | wzhou-code/impala | 746 | 3350084 | # Licensed to the Apache Software Foundation (ASF) under one
# or more contributor license agreements. See the NOTICE file
# distributed with this work for additional information
# regarding copyright ownership. The ASF licenses this file
# to you under the Apache License, Version 2.0 (the
# "License"); you may not u... | 0 | 1 | 0 | 0 | 1 | 0 |
bcs-ui/backend/templatesets/release/manager.py | laodiu/bk-bcs | 599 | 3350086 | <reponame>laodiu/bk-bcs
# -*- coding: utf-8 -*-
"""
Tencent is pleased to support the open source community by making 蓝鲸智云PaaS平台社区版 (BlueKing PaaS Community
Edition) available.
Copyright (C) 2017-2021 THL A29 Limited, a Tencent company. All rights reserved.
Licensed under the MIT License (the "License"); you may not us... | 0 | 0 | 0 | 0 | 0 | 0 |
qf_lib/backtesting/execution_handler/slippage/square_root_market_impact_slippage.py | webclinic017/qf-lib | 198 | 3350100 | # Copyright 2016-present CERN – European Organization for Nuclear Research
#
# 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... | 11 | 4 | 0 | 1 | 16 | 0 |
test/cpp/qps/json_run_localhost_scenario_gen.py | samotarnik/grpc | 2,151 | 3350112 | <reponame>samotarnik/grpc
#!/usr/bin/env python2.7
# Copyright 2018 gRPC 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
#
# Unles... | 0 | 0 | 0 | 0 | 0 | 0 |
setup.py | alixander/PyScribe | 398 | 3350125 | import os
from setuptools import setup
setup(
name = "pyscribe",
version = "1.0.0",
author = "<NAME>",
author_email = "<EMAIL>",
description = ("PyScribe makes print debugging easier and more efficient"),
license = "MIT",
keywords = "python pyscribe debug print",
url = "https://github.co... | 0 | 0 | 0 | 0 | 0 | 0 |
WebMirror/management/rss_parser_funcs/feed_parse_extractRainyTranslations.py | fake-name/ReadableWebProxy | 193 | 3350126 | <reponame>fake-name/ReadableWebProxy
def extractRainyTranslations(item):
"""
Parser for 'Rainy Translations'
"""
vol, chp, frag, postfix = extractVolChapterFragmentPostfix(item['title'])
if not (chp or vol) or 'preview' in item['title'].lower():
return None
tagmap = [
('rain', 'rain', ... | 0 | 0 | 0 | 0 | 0 | 0 |
344 Reverse String.py | ChiFire/legend_LeetCode | 872 | 3350134 | <gh_stars>100-1000
"""
Write a function that takes a string as input and returns the string reversed.
"""
__author__ = 'Daniel'
class Solution(object):
def reverseString(self, s):
"""
:type s: str
:rtype: str
"""
return s[::-1] | 0 | 0 | 0 | 0 | 0 | 0 |
src/gausskernel/dbmind/tools/anomaly_detection/agent/__init__.py | Yanci0/openGauss-server | 360 | 3350147 | <reponame>Yanci0/openGauss-server
"""
Copyright (c) 2020 Huawei Technologies Co.,Ltd.
openGauss is licensed under Mulan PSL v2.
You can use this software according to the terms and conditions of the Mulan PSL v2.
You may obtain a copy of Mulan PSL v2 at:
http://license.coscl.org.cn/MulanPSL2
THIS SOFTWARE I... | 0 | 0 | 0 | 0 | 0 | 0 |
tests/test_ipc.py | farisachugthai/pyuv | 826 | 3350152 | <reponame>farisachugthai/pyuv
import os
import random
import sys
import unittest
from functools import partial
from common import platform_skip, TestCase
import pyuv
TEST_PORT = random.randint(2000, 3000)
TEST_PORT2 = random.randint(2000, 3000)
TEST_ADDR = ("127.0.0.1", TEST_PORT)
TEST_ADDR2 = ("127.0.0.1", TEST_P... | 0 | 0 | 0 | 0 | 0 | 0 |
securityheaders/checkers/xcontenttypeoptions/__init__.py | th3cyb3rc0p/securityheaders | 151 | 3350167 | <reponame>th3cyb3rc0p/securityheaders
from .checker import XContentTypeOptionsChecker
from .nosniff import XContentTypeOptionsNoSniffChecker
__all__ = ['XContentTypeOptionsChecker','XContentTypeOptionsNoSniffChecker']
| 0 | 0 | 0 | 0 | 0 | 0 |
desktop/core/ext-py/jdcal-1.0/jdcal.py | kokosing/hue | 5,079 | 3350171 | # -*- coding:utf-8 -*-
"""Functions for converting between Julian dates and calendar dates.
A function for converting Gregorian calendar dates to Julian dates, and
another function for converting Julian calendar dates to Julian dates
are defined. Two functions for the reverse calculations are also
defined.
Different ... | 0 | 8 | 0 | 0 | 8 | 0 |
XssEyeCelery/common/plugin_config/__init__.py | tt9133github/hunter | 322 | 3350223 | #!/ usr/bin/env
# coding=utf-8
#
# Copyright 2019 ztosec & https://sec.zto.com/
#
# 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 r... | 0 | 0 | 0 | 0 | 0 | 0 |
services/backend/apps/users/urls.py | paulowe/aws-boilerplate | 711 | 3350232 | from django.urls import path, include
from rest_framework_jwt.views import obtain_jwt_token
from . import views
user_patterns = [
path("signup/", views.SignUpView.as_view(), name="signup"),
path("token/", obtain_jwt_token, name="jwt_token"),
path("me/", views.UserProfileView.as_view(), name="profile"),
... | 0 | 0 | 0 | 0 | 0 | 0 |
benchmarks/fastrnns/profile.py | Hacky-DH/pytorch | 206 | 3350243 | from __future__ import annotations
import argparse
import subprocess
import sys
import time
import torch
import datetime
from .runner import get_nn_runners
def run_rnn(name, rnn_creator, nloops: int=5,
seqLength: int=100, numLayers: int=1, inputSize: int=512, hiddenSize: int=512,
miniBatch: i... | 18 | 4 | 0 | 0 | 22 | 0 |
backdoors/shell/__pupy/pupy/packages/windows/x86/psutil/_psbsd.py | mehrdad-shokri/backdoorme | 796 | 3350253 | <reponame>mehrdad-shokri/backdoorme
#!/usr/bin/env python
# Copyright (c) 2009, <NAME>'. All rights reserved.
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
"""FreeBSD platform implementation."""
import errno
import functools
import os
import xml.etree.ElementTr... | 0 | 0 | 0 | 0 | 0 | 0 |
settings/LayerSettings.py | Austin1999/ViolenceDetection-master | 149 | 3350270 | <filename>settings/LayerSettings.py
import tensorflow as tf
FLOAT_TYPE = tf.float32
# Conv layer
CONV_WEIGHTS_RNDOM_MEAN=0.0
CONV_WEIGHTS_RNDOM_DEVIATION=0.001
CONV_BIASES_RNDOM_MEAN=0.0
CONV_BIASES_RNDOM_DEVIATION=0.001
DOES_SHOW_CONV_SUMMARY = False
# Fully-Connected layer
FC_WEIGHTS_RANDOM_MEAN=0.0
FC_WEIGHTS_RA... | 0 | 0 | 0 | 0 | 0 | 0 |
examples/example_05_misc_stats.py | jcheong0428/pymer4 | 127 | 3350283 | <filename>examples/example_05_misc_stats.py<gh_stars>100-1000
"""
5. Additional Statistics Functions
==================================
:code:`pymer4` also comes with some flexible routines for various statistical operations such as permutation testing, bootstrapping of arbitrary functions and equivalence testing. Here... | 0 | 0 | 0 | 0 | 0 | 0 |
batchflow/models/torch/blocks/pyramid.py | analysiscenter/dataset | 101 | 3350289 | from __future__ import annotations
""" Functional modules for various deep network architectures."""
import numpy as np
from torch import nn
from .core import Block
from ..layers import Conv, BatchNorm, Combine
from ..utils import get_shape, get_num_dims, get_num_channels
class PyramidPooling(nn.Module):
""" Pyr... | 17 | 3 | 1 | 1 | 22 | 0 |
zenstates.py | fbmoose48/ZenStates-Linux | 437 | 3350327 | #!/usr/bin/python
from __future__ import annotations
import struct
import os
import glob
import argparse
pstates = range(0xC0010064, 0xC001006C)
def writemsr(msr, val, cpu = -1):
try:
if cpu == -1:
for c in glob.glob('/dev/cpu/[0-9]*/msr'):
f = os.open(c, os.O_WRONLY)
... | 1 | 7 | 0 | 0 | 8 | 0 |
insights/tests/client/auto_config/test_try_satellite5_configuration.py | lhuett/insights-core | 121 | 3350332 | <gh_stars>100-1000
from insights.client.auto_config import _try_satellite5_configuration
from mock.mock import Mock, patch
@patch("insights.client.auto_config.set_auto_configuration")
@patch("insights.client.auto_config.open", return_value=["serverURL=https://some-hostname/",
... | 0 | 0 | 0 | 0 | 0 | 0 |
pypy/tool/importfun.py | nanjekyejoannah/pypy | 381 | 3350340 | <reponame>nanjekyejoannah/pypy
import sys
import opcode
import dis
import imp
import os
import __builtin__
import time
"""
so design goal:
i want to take a pile of source code and analyze each module for the
names it defines and the modules it imports and the names it uses from
them.
then i can find things like:
- ... | 0 | 0 | 0 | 0 | 0 | 0 |
tests/providers/amazon/aws/hooks/test_kinesis.py | npodewitz/airflow | 8,092 | 3350348 | #
# Licensed to the Apache Software Foundation (ASF) under one
# or more contributor license agreements. See the NOTICE file
# distributed with this work for additional information
# regarding copyright ownership. The ASF licenses this file
# to you under the Apache License, Version 2.0 (the
# "License"); you may not... | 0 | 0 | 0 | 0 | 0 | 0 |
String_or_Array/Kth_Smallest.py | Amanjakhetiya/Data_Structures_Algorithms_In_Python | 195 | 3350386 | # Find the Kth smallest element in a given array.
# taking smallest in arr as 1st smallest
"""
Approach used: QuickSelect
Time Complexity: O(n)
"""
def partition(arr, low, high) -> object:
i = (low - 1)
pivot = arr[high] # pivot
for j in range(low, high):
# If current element is smaller than o... | 0 | 2 | 0 | 0 | 2 | 0 |
scrapy/loader/common.py | HyunTruth/scrapy | 9,953 | 3350443 | """Common functions used in Item Loaders code"""
from functools import partial
from scrapy.utils.python import get_func_args
def wrap_loader_context(function, context) -> object:
"""Wrap functions that receive loader_context to contain the context
"pre-loaded" and expose a interface that receives only one arg... | 0 | 1 | 0 | 0 | 1 | 0 |
codeformatter/pybeautifier/PythonTidy/PythonTidyWrapper.py | elpeix/sublimetext-codeformatter | 676 | 3350455 | #!/usr/bin/python
# -*- coding: utf-8 -*-
# PythonTidyWrapper.py
# 2007 Mar 06 . ccr
# 2010 Sep 08 . ccr . Add JAVA_STYLE_LIST_DEDENT.
# 2010 Mar 16 . ccr . Add KEEP_UNASSIGNED_CONSTANTS and PARENTHESIZE_TUPLE_DISPLAY.
# 2007 May 25 . ccr . Changed MAX_SEPS. Add WRAP_DOC_STRINGS and DOC_TAB_REPLACEMENT.
# 2007 May 0... | 17 | 22 | 0 | 0 | 39 | 0 |
lib/sedna/core/base.py | hithxh/sedna | 311 | 3350464 | # Copyright 2021 The KubeEdge 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 applicable law or agreed to in... | 9 | 4 | 0 | 2 | 15 | 0 |
buildtools/reclient_cfgs/fetch_reclient_cfgs.py | zealoussnow/chromium | 14,668 | 3350468 | <filename>buildtools/reclient_cfgs/fetch_reclient_cfgs.py<gh_stars>1000+
#!/usr/bin/env python3
# Copyright (c) 2021 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.
"""This script is used to fetch reclient cfgs."""
import... | 0 | 0 | 0 | 0 | 0 | 0 |
ELEGANT.py | Prinsphield/ELEGANT | 276 | 3350469 | # -*- coding:utf-8 -*-
# Created Time: 2018/03/12 10:48:38
# Author: <NAME> <<EMAIL>>
from dataset import config, MultiCelebADataset
from nets import Encoder, Decoder, Discriminator
import os
import argparse
import torch
from torchvision import transforms
from PIL import Image
import numpy as np
from tensorboardX imp... | 4 | 4 | 0 | 0 | 8 | 0 |
dfgui/__init__.py | harish0412/PandasDataFrameGUI | 323 | 3350476 | <filename>dfgui/__init__.py
from __future__ import absolute_import
from dfgui.dfgui import show
__all__ = [
"show"
]
| 0 | 0 | 0 | 0 | 0 | 0 |
tensorflow/python/kernel_tests/trans_csv_ali_ops_test.py | ShaunHeNJU/DeepRec-1 | 292 | 3350481 | <reponame>ShaunHeNJU/DeepRec-1
# Copyright 2015 The TensorFlow 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... | 0 | 0 | 0 | 0 | 0 | 0 |
lib/rucio/web/rest/flaskapi/v1/meta.py | justincc/rucio | 187 | 3350524 | <filename>lib/rucio/web/rest/flaskapi/v1/meta.py<gh_stars>100-1000
# -*- coding: utf-8 -*-
# Copyright 2012-2021 CERN
#
# 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.... | 0 | 0 | 0 | 0 | 0 | 0 |
examples/tutorial/state_transition_simple_force.py | Wlgen/force-riscv | 111 | 3350546 | <reponame>Wlgen/force-riscv
#
# Copyright (C) [2020] Futurewei Technologies, Inc.
#
# FORCE-RISCV is 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... | 0 | 0 | 0 | 0 | 0 | 0 |
Python/Algorithms/Geometry/simple_polygon_area.py | Rr1901/AlgorithmsAndDataStructure | 195 | 3350599 | from collections import namedtuple
from typing import List
Point = namedtuple('Point', 'x y')
def simple_polygon_area(points: List[Point]) -> float:
"""
Calculates area of simple polygon given by a list of points.
Assumes that points is a list of points in either clockwise
or counter-clockwise order... | 1 | 1 | 0 | 0 | 2 | 0 |
demogen/model_config.py | deepneuralmachine/google-research | 23,901 | 3350604 | # 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... | 15 | 6 | 0 | 0 | 21 | 0 |
snmp/tests/test_bench.py | mchelen-gov/integrations-core | 663 | 3350629 | # (C) Datadog, Inc. 2018-present
# All rights reserved
# Licensed under a 3-clause BSD style license (see LICENSE)
import pytest
from datadog_checks.snmp import SnmpCheck
from .common import BULK_TABULAR_OBJECTS, TABULAR_OBJECTS, create_check, generate_instance_config
pytestmark = pytest.mark.usefixtures("dd_enviro... | 0 | 0 | 0 | 0 | 0 | 0 |
django_mongoengine/utils/backports.py | TriggeredMessaging/django-mongoengine | 671 | 3350691 | <reponame>TriggeredMessaging/django-mongoengine
def resolve_callables(mapping):
"""
Generate key/value pairs for the given mapping where the values are
evaluated if they're callable.
"""
# backport from django-3.2
# after we drop support for django below 3.2, this can be removed
for k, v in ... | 0 | 0 | 0 | 0 | 0 | 0 |
tests/test_sanitize_doc.py | niall-byrne/flask-restful-swagger | 667 | 3350704 | import pytest
from flask_restful_swagger import swagger
@pytest.mark.parametrize(
"test_input,expected",
[
("Hey\n", "Hey<br/>"),
("\n/n\n/n\n", "<br/>/n<br/>/n<br/>"),
("No Change", "No Change"),
],
)
def test_string_sanitize_doc(test_input, expected):
assert swagger._sanitiz... | 0 | 0 | 0 | 0 | 0 | 0 |
main.py | GCC15/bilibili-captcha | 130 | 3350728 | # The place to run the program and main place for testing
import time
import config as c
import dataset_manager
from captcha_recognizer import CaptchaRecognizer
from captcha_provider import BilibiliCaptchaProvider
from helper import show_image, time_func
# noinspection PyUnresolvedReferences
import captcha_learn
de... | 4 | 0 | 0 | 0 | 4 | 0 |
testing/scripts/grit_python_unittests.py | zealoussnow/chromium | 14,668 | 3350732 | #!/usr/bin/env python
# Copyright 2019 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.
"""//testing/scripts wrapper for the grit unittests. This script is used to run
test_suite_all.py on the trybots to ensure that grit is... | 0 | 1 | 0 | 0 | 1 | 0 |
ax/core/tests/test_multi_type_experiment.py | viotemp1/Ax | 1,803 | 3350744 | <reponame>viotemp1/Ax<filename>ax/core/tests/test_multi_type_experiment.py
#!/usr/bin/env python3
# Copyright (c) Facebook, Inc. and its affiliates.
#
# This source code is licensed under the MIT license found in the
# LICENSE file in the root directory of this source tree.
from ax.metrics.branin import BraninMetric
f... | 0 | 0 | 0 | 0 | 0 | 0 |
tests/plugins/private_key_test.py | paulo-sampaio/detect-secrets | 2,212 | 3350752 | <gh_stars>1000+
import tempfile
import pytest
from detect_secrets.core.secrets_collection import SecretsCollection
from detect_secrets.settings import transient_settings
@pytest.mark.parametrize(
'file_content',
[
(
'-----BEGIN RSA PRIVATE KEY-----\n'
'super secret private ke... | 0 | 0 | 0 | 0 | 0 | 0 |
koku/api/resource_types/openshift_clusters/view.py | project-koku/koku | 157 | 3350767 | <reponame>project-koku/koku<filename>koku/api/resource_types/openshift_clusters/view.py
#
# Copyright 2021 Red Hat Inc.
# SPDX-License-Identifier: Apache-2.0
#
"""View for Openshift clusters."""
from django.db.models import F
from django.db.models.functions.comparison import Coalesce
from django.utils.decorators import... | 0 | 0 | 0 | 0 | 0 | 0 |
2019/10/17/Some New Features in Python 3.8/positional.py | kenjitagawa/youtube_video_code | 492 | 3350775 | def multiply_then_add(x, y, z, /, print_this: str='Nothing') -> object:
print(print_this)
return x * y + z
print(multiply_then_add(5, 10, 20, print_this='Something')) | 1 | 1 | 0 | 0 | 2 | 0 |
src/api/file.py | piwaniuk/critic | 216 | 3350782 | # -*- mode: python; encoding: utf-8 -*-
#
# Copyright 2017 the Critic contributors, Opera Software ASA
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may not
# use this file except in compliance with the License. You may obtain a copy of
# the License at
#
# http://www.apache.org/licenses/LI... | 6 | 5 | 0 | 0 | 11 | 0 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.