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 |
|---|---|---|---|---|
test/old_tests/_test_prepend.py | syaiful6/aerospike-client-python | 105 | 11066189 | <gh_stars>100-1000
# -*- coding: utf-8 -*-
import pytest
import sys
from .test_base_class import TestBaseClass
from aerospike import exception as e
aerospike = pytest.importorskip("aerospike")
try:
import aerospike
except:
print("Please install aerospike python client.")
sys.exit(1)
class TestPrepend(obj... |
barbican/tests/model/repositories/test_repositories_secret_metadata.py | mail2nsrajesh/barbican | 177 | 11066204 | <filename>barbican/tests/model/repositories/test_repositories_secret_metadata.py
# 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 re... |
tests/validators/test_number_range.py | Ennkua/wtforms | 1,197 | 11066205 | import decimal
import pytest
from wtforms.validators import NumberRange
from wtforms.validators import ValidationError
@pytest.mark.parametrize(
"min_v, max_v, test_v", [(5, 10, 7), (5, None, 7), (None, 100, 70)]
)
def test_number_range_passes(min_v, max_v, test_v, dummy_form, dummy_field):
"""
It shoul... |
fpga/lib/pcie/example/ExaNIC_X10/fpga_axi/tb/fpga_core/test_fpga_core.py | mfkiwl/corundum-fpga-100g-Ethernet | 447 | 11066213 | """
Copyright (c) 2020 <NAME>
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublic... |
pyamg/gallery/diffusion.py | nicknytko/pyamg | 371 | 11066224 | <filename>pyamg/gallery/diffusion.py
"""Generate a diffusion stencil.
Supports isotropic diffusion (FE,FD), anisotropic diffusion (FE, FD), and
rotated anisotropic diffusion (FD).
The stencils include redundancy to maintain readability for simple cases (e.g.
isotropic diffusion).
"""
# pylint: disable=redefined-buil... |
hyperopt/spark.py | Loquats/hyperopt | 6,071 | 11066263 | <reponame>Loquats/hyperopt<gh_stars>1000+
import copy
import threading
import time
import timeit
import traceback
from hyperopt import base, fmin, Trials
from hyperopt.base import validate_timeout, validate_loss_threshold
from hyperopt.utils import coarse_utcnow, _get_logger, _get_random_id
from py4j.clientserver imp... |
tests/parsers/presets.py | pyllyukko/plaso | 1,253 | 11066269 | <reponame>pyllyukko/plaso
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""Tests for parser and parser plugin presets."""
import unittest
from plaso.containers import artifacts
from plaso.parsers import presets
from tests import test_lib as shared_test_lib
class ParserPresetTest(shared_test_lib.BaseTestCase):
"... |
picamera/streams.py | takehirokj/picamera | 1,311 | 11066279 | # vim: set et sw=4 sts=4 fileencoding=utf-8:
#
# Python camera library for the Rasperry-Pi camera module
# Copyright (c) 2013-2017 <NAME> <<EMAIL>>
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions are met:
#
# * Redistributio... |
lib/galaxy/util/sqlite.py | rikeshi/galaxy | 1,085 | 11066280 | import re
import sqlite3
try:
import sqlparse
def is_read_only_query(query):
statements = sqlparse.parse(query)
for statement in statements:
if statement.get_type() != "SELECT":
return False
return True
except ImportError:
# Without sqlparse we use a ve... |
setup.py | Venkat1729/kubernetes-py | 129 | 11066286 | <gh_stars>100-1000
import version_query
try:
from setuptools import setup
except ImportError:
from distutils.core import setup
my_version = version_query.query_version_str()
setup(
name="kubernetes-py",
version=my_version,
description="A python module for Kubernetes.",
author="mnubo inc.",
... |
pytorch_widedeep/models/tab_mlp.py | rajshah4/pytorch-widedeep | 692 | 11066307 | <reponame>rajshah4/pytorch-widedeep
import numpy as np
import torch
import torch.nn.functional as F
from torch import nn
from pytorch_widedeep.wdtypes import * # noqa: F403
allowed_activations = ["relu", "leaky_relu", "tanh", "gelu", "geglu", "reglu"]
class GEGLU(nn.Module):
def forward(self, x):
x, ga... |
ml4a/models/wav2lip.py | KushGabani/ml4a-guides | 1,110 | 11066327 | import os
import logging
import random
import subprocess
import numpy as np
import PIL
import cv2
import torch
from tqdm import tqdm
from .. import image
from .. import audio as ml4a_audio
from ..utils import downloads
from . import submodules
cuda_available = submodules.cuda_available()
#with submodules.localimport... |
uc_irv_mess_dl.py | Muyu-gk/DynamicGraph | 323 | 11066342 | <filename>uc_irv_mess_dl.py
import utils as u
import os
import tarfile
import torch
class Uc_Irvine_Message_Dataset():
def __init__(self,args):
args.uc_irc_args = u.Namespace(args.uc_irc_args)
tar_file = os.path.join(args.uc_irc_args.folder, args.uc_irc_args.tar_file)
tar_archive = tarfile.open(tar_file, ... |
Algorithms/Python/Dijkstra.py | Shaswat-2203/HacktoberfestForBeginners | 115 | 11066372 | <filename>Algorithms/Python/Dijkstra.py
from Graph import Node, Graph
class Dijkstra(Graph):
def __init__(self, graph):
self.nodes = graph.nodes
self.num_nodes = graph.num_nodes
self.min_costs = None
self.next_nodes = {}
self.visited_nodes = []
def add_next... |
reudom/__init__.py | BarryYBL/reudom | 393 | 11066384 | #!/usr/bin/python
#
# Licensed to the Software Freedom Conservancy (SFC) under one
# or more contributor license agreements. See the NOTICE file
# distributed with this work for additional information
# regarding copyright ownership. The SFC licenses this file
# to you under the Apache License, Version 2.0 (the
# "Li... |
accelerator/examples/a_dsexample_appendcolumn.py | eBay/accelerator | 143 | 11066399 | <filename>accelerator/examples/a_dsexample_appendcolumn.py
description = "Dataset: Append a column to an existing dataset."
datasets = ('source',)
def prepare(job):
dw = job.datasetwriter(parent=datasets.source)
dw.add('Floatcolumn', 'float64')
return dw
def analysis(prepare_res, sliceno):
dw = prepare_res
fo... |
v2.0.1/python/examples/template/strategies/rates_historic.py | 1Blackdiamondsc/dwx-zeromq-connector | 320 | 11066416 | <reponame>1Blackdiamondsc/dwx-zeromq-connector
#!/usr/bin/env python
# -*- coding: utf-8 -*-
"""
rates_historic.py
An example using the Darwinex ZeroMQ Connector for Python 3 and MetaTrader 4 PULL REQUEST
for v2.0.1 in which a Client requests rate history from EURGBP Daily from 2019.01.04 to
to 20... |
examples/cvode/serial/plot_cvPendulum.py | tbrk/sundials | 256 | 11066424 | <gh_stars>100-1000
#!/usr/bin/env python
# ------------------------------------------------------------------------------
# Programmer(s): <NAME> @ LLNL
# ------------------------------------------------------------------------------
# SUNDIALS Copyright Start
# Copyright (c) 2002-2021, Lawrence Livermore National Secu... |
recipes/Python/128711_Fibonacci_Object/recipe-128711.py | tdiprima/code | 2,023 | 11066428 | from math import sqrt, pow, floor
from __future__ import generators
class Fibonacci:
"""A simple class which brings functions to calculate Fibonacci numbers
and make operations between them"""
def __init__(self):
self.Phi = (1 + sqrt(5))/2
self.PhiP = (1 - sqrt(5))/2
self.rs5 ... |
theory/read_mesh_dump.py | johnterickson/Mesh | 1,494 | 11066437 | #!/usr/bin/env python
# -*- coding: utf-8 -*-
import json
import sys
import argparse
from collections import defaultdict
import meshers
MB = 1/1024.0/1024.0
class Span(object):
def __init__(self, obj):
self.name = obj['name']
self.size = obj['object-size']
self.length = obj['length']
... |
scripts/misc/ray_test.py | microsoft/archai | 344 | 11066441 | <reponame>microsoft/archai
# Copyright (c) Microsoft Corporation.
# Licensed under the MIT license.
from typing import Optional
import time
import random
import ray
import torch
from archai import cifar10_models
from archai.common.trainer import Trainer
from archai.common.config import Config
from archai.common imp... |
pypy2.7/multiprocess/__init__.py | agcopenhaver/multiprocess | 356 | 11066450 | #
# Package analogous to 'threading.py' but using processes
#
# multiprocessing/__init__.py
#
# This package is intended to duplicate the functionality (and much of
# the API) of threading.py but uses processes instead of threads. A
# subpackage 'multiprocessing.dummy' has the same API but is a simple
# wrapper for 't... |
config.py | josephernest/talktalktalk | 278 | 11066452 | <reponame>josephernest/talktalktalk<filename>config.py
PORT = 9000 # if you change this line, change the port as well in .htaccess
HOST = "127.0.0.1"
ADMINNAME = 'admin' # this username will be available if *and only if* the following username is entered in the input field:
ADMINHIDDENNAME... |
pygears/lib/din_cat.py | bogdanvuk/pygears | 120 | 11066453 | from pygears import gear
from pygears.lib import ccat
def din_cat(f, other):
@gear
def din_cat_impl(cfg, din):
return ccat(din, cfg) | f
return din_cat_impl(other)
|
third_party/gsutil/third_party/apitools/apitools/gen/util_test.py | tingshao/catapult | 2,151 | 11066469 | #
# Copyright 2015 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
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing... |
py/google/fhir/r4/extensions_test.py | swrobel/fhir | 648 | 11066475 | <filename>py/google/fhir/r4/extensions_test.py
#
# 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
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless req... |
onetimepass/__init__.py | shantanoo/onetimepass | 461 | 11066489 | """
onetimepass module is designed to work for one-time passwords - HMAC-based and
time-based. It is compatible with Google Authenticator application and
applications based on it.
@version: 1.0.1
@author: <NAME>
@contact: http://github.com/tadeck
@license: MIT
>>> secret = b'MFRGGZDFMZTWQ2LK'
>>> get_hotp(secret, 1) ... |
operations/binsec/dffml_operations_binsec/log.py | SGeetansh/dffml | 171 | 11066513 | <reponame>SGeetansh/dffml
import logging
LOGGER = logging.getLogger(__package__)
|
test/unit/jobs/test_rules_override/10_rule.py | rikeshi/galaxy | 1,085 | 11066519 | <gh_stars>1000+
def rule_module_override():
# Dummy rule for testing rule module overrides
return 'new_rules_package'
|
ryu/services/protocols/bgp/utils/stats.py | w180112/ryu | 975 | 11066531 | # Copyright (C) 2014 Nippon Telegraph and Telephone 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 appli... |
src/anyconfig/api/_dump.py | ssato/python-anyconfig | 213 | 11066535 | #
# Copyright (C) 2012 - 2021 <NAME> <<EMAIL>>
# SPDX-License-Identifier: MIT
#
r"""Public APIs to dump configurations data.
"""
from .. import common, ioinfo, parsers
from .datatypes import ParserT
def dump(data: common.InDataExT, out: ioinfo.PathOrIOInfoT,
ac_parser: parsers.MaybeParserT = None, **options
... |
Tools/freeze/makeconfig.py | arvindm95/unladen-swallow | 2,293 | 11066542 | import re
# Write the config.c file
never = ['marshal', '__main__', '__builtin__', 'sys', 'exceptions']
def makeconfig(infp, outfp, modules, with_ifdef=0):
m1 = re.compile('-- ADDMODULE MARKER 1 --')
m2 = re.compile('-- ADDMODULE MARKER 2 --')
while 1:
line = infp.readline()
if not line:... |
nmt/utils/iterator_utils_test.py | godblessforhimself/nmt | 6,575 | 11066554 | # Copyright 2017 Google Inc. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or a... |
tools/conv_cmap.py | dntjr970/pdfminer.six | 3,538 | 11066558 | #!/usr/bin/env python3
import sys
import pickle as pickle
import codecs
class CMapConverter:
def __init__(self, enc2codec={}):
self.enc2codec = enc2codec
self.code2cid = {} # {'cmapname': ...}
self.is_vertical = {}
self.cid2unichr_h = {} # {cid: unichr}
self.cid2unichr_... |
Pyro5/compatibility/Pyro4.py | lonly7star/Pyro5 | 188 | 11066559 | """
An effort to provide a backward-compatible Pyro4 API layer,
to make porting existing code from Pyro4 to Pyro5 easier.
This only works for code that imported Pyro4 symbols from the Pyro4 module
directly, instead of from one of Pyro4's sub modules. So, for instance:
from Pyro4 import Proxy instead of: from Pyro4.c... |
pfe/player-feature-extractor/projects/attribute_recognition/datasets/dataset.py | dimahwang88/py-mcftracker | 3,465 | 11066567 | <filename>pfe/player-feature-extractor/projects/attribute_recognition/datasets/dataset.py
from __future__ import division, print_function, absolute_import
import os.path as osp
from torchreid.utils import read_image
class Dataset(object):
def __init__(
self,
train,
val,
test,
... |
tools/metrics/histograms/validate_prefix.py | zealoussnow/chromium | 14,668 | 11066696 | #!/usr/bin/env python
# Copyright 2020 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.
"""Checks that the histograms and variants at given xml have correct prefix."""
import logging
import os
import sys
import xml.dom.mini... |
jwt_decoder.py | bbhunter/security-tools | 627 | 11066715 | #!/usr/bin/env python3
# JWT Decoder
import base64
import sys
import hmac
import hashlib
import binascii
# <KEY>
# <KEY>
def get_parts(jwt):
return dict(zip(['header', 'payload', 'signature'], jwt.split('.')))
def decode_part(part):
# use Base64URL decode plus optional padding.
# === makes sure that ... |
atcodertools/client/models/problem_content.py | come2ry/atcoder-tools | 313 | 11066726 | from typing import List, Tuple, Optional
from bs4 import BeautifulSoup
from atcodertools.client.models.sample import Sample
import unicodedata
def remove_non_jp_characters(content):
return "".join([x for x in content if is_japanese(x)])
def normalize(content: str) -> str:
return content.strip().replace('\... |
delft/textClassification/data_generator.py | tantikristanti/delft | 333 | 11066738 | <reponame>tantikristanti/delft
import numpy as np
# seed is fixed for reproducibility
from delft.utilities.numpy import shuffle_triple_with_view
np.random.seed(7)
from tensorflow import set_random_seed
set_random_seed(7)
import keras
from delft.textClassification.preprocess import to_vector_single, to_vector_simple_wi... |
third_party/gae_ts_mon/gae_ts_mon/protobuf/google/auth/_helpers.py | tingshao/catapult | 2,151 | 11066745 | # Copyright 2015 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
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing,... |
insights/parsers/interrupts.py | mglantz/insights-core | 121 | 11066805 | <gh_stars>100-1000
"""
Interrupts - file ``/proc/interrupts``
======================================
Provides parsing for contents of ``/proc/interrupts``.
The contents of a typical ``interrupts`` file looks like::
CPU0 CPU1 CPU2 CPU3
0: 37 0 0 0 ... |
locations/spiders/speedway.py | davidchiles/alltheplaces | 297 | 11066813 | # -*- coding: utf-8 -*-
import scrapy
import json
from zipfile import ZipFile
from io import BytesIO
from time import sleep
from locations.items import GeojsonPointItem
class SpeedwaySpider(scrapy.Spider):
name = "speedway"
item_attributes = {'brand': "Speedway"}
allowed_domains = ["mobileapps.speedway.c... |
coldtype/time/timeable.py | rohernandezz/coldtype | 142 | 11066844 | from coldtype.time.easing import ease
from copy import copy
import math
class Timing():
def __init__(self, t, loop_t, loop, easefn):
self.t = t
self.loop_t = loop_t
self.loop = loop
self.loop_phase = int(loop%2 != 0)
self.e, self.s = self.ease(easefn)
def ease(self... |
tensorflow/contrib/training/python/training/batch_sequences_with_states_test.py | connectthefuture/tensorflow | 101 | 11066885 | # Copyright 2016 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
#
# Unless required by applica... |
python_modules/dagster/dagster_tests/general_tests/grpc_tests/test_persistent_container.py | dbatten5/dagster | 4,606 | 11066906 | import pytest
from dagster import seven
@pytest.mark.skipif(seven.IS_WINDOWS, reason="docker doesn't work on windows tests")
def test_ping(docker_grpc_client):
assert docker_grpc_client.ping("foobar") == "foobar"
@pytest.mark.skipif(seven.IS_WINDOWS, reason="docker doesn't work on windows tests")
def test_strea... |
cupid/io/table/pd.py | wjsi/aliyun-odps-python-sdk | 412 | 11066911 | # Copyright 1999-2017 Alibaba Group Holding Ltd.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or a... |
dataloader/dataset_vg.py | Deanplayerljx/bottom-up-attention.pytorch | 210 | 11066919 | # Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved
import os
from detectron2.data import DatasetCatalog, MetadataCatalog
from .load_vg_json import load_vg_json
SPLITS = {
"visual_genome_train": ("vg/images", "vg/annotations/train.json"),
"visual_genome_val": ("vg/images", "vg/annotations/v... |
Section 5/ch05_r05_py.py | Asif-packt/Modern-Python-Solutions-Part-1 | 107 | 11066931 | """Python Cookbook
Chapter 5, recipe 5, part "py"
"""
import cmd
import sys
class REPL(cmd.Cmd):
prompt=">>> "
def preloop(self):
print( sys.version )
def do_def(self, arg):
pass
def do_class(self, arg):
pass
def do_EOF(self, arg):
return True
def default(self,... |
lib/symbioticpy/symbiotic/targets/predator.py | paldebjit/symbiotic | 235 | 11066939 | """
BenchExec is a framework for reliable benchmarking.
This file is part of BenchExec.
Copyright (C) 2007-2015 <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
htt... |
third_party/polymer/v1_0/css_strip_prefixes.py | zipated/src | 2,151 | 11066943 | <gh_stars>1000+
# Copyright 2017 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 fnmatch
import os
import re
# List of CSS properties to be removed.
CSS_PROPERTIES_TO_REMOVE = [
'-moz-appearance',
'-moz-box-siz... |
setup.py | klj123wan/python-torngas | 492 | 11066947 | <reponame>klj123wan/python-torngas
from setuptools import setup, find_packages
import torngas
setup(
name="torngas",
version=torngas.__version__,
description="torngas based on tornado",
long_description="torngas is based on tornado,django like web framework.",
keywords='python torngas django tornad... |
cassiopeia/datastores/kernel/thirdpartycode.py | artemigkh/cassiopeia | 437 | 11066948 | <reponame>artemigkh/cassiopeia
from typing import Type, TypeVar, MutableMapping, Any, Iterable, Generator
from datapipelines import DataSource, PipelineContext, Query, NotFoundError, validate_query
from .common import KernelSource, APINotFoundError
from ...data import Platform
from ...dto.thirdpartycode import Verific... |
proximal/algorithms/admm.py | kyleaj/ProxImaL | 101 | 11066952 | from __future__ import division, print_function
from proximal.lin_ops import CompGraph, scale, vstack
from proximal.utils.timings_log import TimingsLog, TimingsEntry
from .invert import get_least_squares_inverse, get_diag_quads
import numpy as np
import numexpr as ne
def partition(prox_fns, try_diagonalize=True):
... |
pylxd/tests/models/test_image.py | jonans/pylxd | 247 | 11066964 | <gh_stars>100-1000
import hashlib
import json
from io import StringIO
from pylxd import exceptions, models
from pylxd.tests import testing
class TestImage(testing.PyLXDTestCase):
"""Tests for pylxd.models.Image."""
def test_get(self):
"""An image is fetched."""
fingerprint = hashlib.sha256(b... |
homeassistant/components/mycroft/__init__.py | tbarbette/core | 22,481 | 11066966 | <gh_stars>1000+
"""Support for Mycroft AI."""
import voluptuous as vol
from homeassistant.const import CONF_HOST
from homeassistant.helpers import discovery
import homeassistant.helpers.config_validation as cv
DOMAIN = "mycroft"
CONFIG_SCHEMA = vol.Schema(
{DOMAIN: vol.Schema({vol.Required(CONF_HOST): cv.string}... |
django_irods/models.py | hydroshare/hydroshare | 178 | 11066990 | from django.db import models as m
from django.contrib.auth.models import User
class RodsEnvironment(m.Model):
owner = m.ForeignKey(User)
host = m.CharField(verbose_name='Hostname', max_length=255)
port = m.IntegerField()
def_res = m.CharField(verbose_name="Default resource", max_length=255)
home_co... |
tests/plugins/test_stdout_filters.py | dexy/dexy | 136 | 11067010 | <filename>tests/plugins/test_stdout_filters.py<gh_stars>100-1000
from tests.utils import assert_in_output
from tests.utils import assert_output
from tests.utils import assert_output_matches
import inspect
import os
def test_node():
assert_output("nodejs", "console.log('hello');", "hello\n")
def test_rd():
rd ... |
cami/scripts/intro_defines.py | hugmyndakassi/hvmi | 677 | 11067023 | #
# Copyright (c) 2020 Bitdefender
# SPDX-License-Identifier: Apache-2.0
#
defines = {
"MAX_VERSION_STRING_SIZE" : 64,
"CAMI_MAGIC_WORD" : 0x494d4143 # CAMI
}
version_any = {
"WIN_PATTERN_MIN_VERSION_ANY" : 0,
"WIN_PATTERN_MAX_VERSION_ANY" : 0xFFFFFFFF
}
section_hints = {
... |
tools/create_colormap.py | KoryakovDmitry/synthtiger | 153 | 11067036 | """
SynthTIGER
Copyright (c) 2021-present NAVER Corp.
MIT license
"""
import argparse
import os
import pprint
import time
import traceback
from concurrent.futures import ProcessPoolExecutor, as_completed
import numpy as np
import scipy.cluster
from PIL import Image
def search_files(root, names=None, exts=None):
... |
src/clusterfuzz/_internal/tests/core/bot/fuzzers/libFuzzer/engine_test.py | mspectorgoogle/clusterfuzz | 5,023 | 11067037 | # Copyright 2019 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
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, ... |
utils/common_utils.py | PrinceSJ/EigenDamage | 127 | 11067047 | import os
import time
import json
import logging
import torch
from pprint import pprint
from easydict import EasyDict as edict
def get_logger(name, logpath, filepath, package_files=[],
displaying=True, saving=True):
logger = logging.getLogger(name)
logger.setLevel(logging.INFO)
log_path =... |
chainer/functions/activation/elu.py | zaltoprofen/chainer | 3,705 | 11067063 | import numpy
from chainer.backends import cuda
from chainer import function_node
from chainer import utils
from chainer.utils import type_check
class ELU(function_node.FunctionNode):
"""Exponential Linear Unit."""
def __init__(self, alpha=1.0):
self.alpha = float(alpha)
def check_type_forward(... |
sfaira/data/dataloaders/loaders/d10_1038_s41586_019_1654_9/human_brain_2019_10x3v2sequencing_kanton_001.py | johnmous/sfaira | 110 | 11067078 | import anndata
import os
import scipy.io
import zipfile
import pandas
def load(data_dir, **kwargs):
cell_line_dict = {
'409b2': '409B2',
'H9': 'WA09',
'Wibj2': 'HPSI0214i-wibj_2',
'Sc102a1': 'SC102A-1',
'Kucg2': 'HPSI0214i-kucg_2',
'Hoik1': 'HPSI0314i-hoik_1',
... |
runner/pose/open_pose_test.py | qrsforever/torchcv | 171 | 11067079 | <reponame>qrsforever/torchcv
#!/usr/bin/env python
# -*- coding:utf-8 -*-
# Author: <NAME> (<EMAIL>)
# Class Definition for Pose Estimator.
import math
import os
import cv2
import numpy as np
import torch
from scipy.ndimage.filters import gaussian_filter
from data.pose.data_loader import DataLoader
from lib.runner.b... |
tests/processtest.py | NAnnamalai/gramex | 130 | 11067096 | <gh_stars>100-1000
import os
import sys
def main():
'Print cwd and sys.argv'
sys.stderr.write('stderr starts\n')
sys.stdout.write('stdout starts\n')
sys.stdout.write('os.getcwd: %s\n' % os.path.abspath(os.getcwd()))
for index, arg in enumerate(sys.argv):
sys.stdout.write('sys.argv[%d]: %s\... |
palladium/tests/test_server.py | vishalbelsare/palladium | 528 | 11067105 | <filename>palladium/tests/test_server.py
from datetime import datetime
import io
import json
import math
from threading import Thread
from time import sleep
from unittest.mock import call
from unittest.mock import Mock
from unittest.mock import patch
import dateutil.parser
from flask import request
import numpy as np
... |
indy_node/test/anon_creds/test_incorrect_revoc_reg_def.py | Rob-S/indy-node | 627 | 11067122 | <reponame>Rob-S/indy-node<gh_stars>100-1000
import json
import pytest
from indy_common.constants import CRED_DEF_ID, CLAIM_DEF_SCHEMA_REF, CLAIM_DEF_SIGNATURE_TYPE, \
CLAIM_DEF_TAG, VALUE, ISSUANCE_TYPE, REVOKED, PREV_ACCUM, ISSUANCE_BY_DEFAULT
from indy_common.state.domain import make_state_path_for_claim_def
fr... |
helpdesk/migrations/0026_kbitem_attachments.py | AmatorAVG/django-helpdesk-atoria | 789 | 11067123 | <gh_stars>100-1000
# Generated by Django 2.0.5 on 2019-03-07 20:30
from django.db import migrations, models
import django.db.models.deletion
import helpdesk.models
class Migration(migrations.Migration):
dependencies = [
('helpdesk', '0025_queue_dedicated_time'),
]
operations = [
migrati... |
atcoder/abc058/b.py | Ashindustry007/competitive-programming | 506 | 11067131 | <gh_stars>100-1000
#!/usr/bin/env python3
# https://abc058.contest.atcoder.jp/tasks/abc058_b
o = input()
e = input()
x = []
for i in range(len(e)):
x.append(o[i])
x.append(e[i])
if len(o) > len(e): x.append(o[-1])
print(''.join(x))
|
etl/parsers/etw/Microsoft_Windows_WER_SystemErrorReporting.py | IMULMUL/etl-parser | 104 | 11067135 | # -*- coding: utf-8 -*-
"""
Microsoft-Windows-WER-SystemErrorReporting
GUID : abce23e7-de45-4366-8631-84fa6c525952
"""
from construct import Int8sl, Int8ul, Int16ul, Int16sl, Int32sl, Int32ul, Int64sl, Int64ul, Bytes, Double, Float32l, Struct
from etl.utils import WString, CString, SystemTime, Guid
from etl.dtyp import... |
test/test_ssr_check.py | centaur679/ShadowSocksShare | 2,341 | 11067142 | <reponame>centaur679/ShadowSocksShare
#!/usr/bin/env python3
from ssshare import *
import threading
from ssshare.ss import crawler, ssr_check
import requests
def test2():
for i in range(30):
data = requests.get('http://laptop.pythonic.life:8080/json').text
print('data', i)
data = data.repl... |
qt__pyqt__pyside__pyqode/QWebEngine__runJavaScript__sync__click_on_element/main.py | DazEB2/SimplePyScripts | 117 | 11067148 | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
__author__ = 'ipetrash'
from PyQt5.QtCore import QUrl, QEventLoop
from PyQt5.QtWidgets import QApplication, QMainWindow
from PyQt5.QtWebEngineWidgets import QWebEngineView, QWebEnginePage
def run_js_code(page: QWebEnginePage, code: str) -> object:
loop = QEventLoo... |
blackmamba/lib/future/__init__.py | oz90210/blackmamba | 2,151 | 11067199 | """
future: Easy, safe support for Python 2/3 compatibility
=======================================================
``future`` is the missing compatibility layer between Python 2 and Python
3. It allows you to use a single, clean Python 3.x-compatible codebase to
support both Python 2 and Python 3 with minimal overhea... |
examples/using_sprites_pyglet.py | conductiveIT/pymunk-1 | 670 | 11067234 | <filename>examples/using_sprites_pyglet.py
"""This example is a clone of the using_sprites example with the difference
that it uses pyglet instead of pygame to showcase sprite drawing.
"""
__version__ = "$Id:$"
__docformat__ = "reStructuredText"
import math
import random
from typing import List
import pyglet
impo... |
skrf/media/tests/test_all_construction.py | dxxx9/scikit-rf | 379 | 11067236 | """
this test on tests ability for all media class to pass construction
of all general circuit components
"""
import unittest
from scipy.constants import *
import skrf as rf
from skrf.media import Freespace, CPW, RectangularWaveguide, DistributedCircuit
class MediaTestCase():
"""Base class, contains tests for a... |
BitTornado/Types/tests/test_primitives.py | alahoo/BitTornado | 116 | 11067263 | <reponame>alahoo/BitTornado
import unittest
import random
import math
from ..primitives import FixedLengthBytes, SixBytes, TwentyBytes, \
UnsignedInt, UnsignedShort
class FixedLengthTests(unittest.TestCase):
def test_fixedlengthbytes(self):
self.assertRaises(NotImplementedError, FixedLengthBytes)
... |
ros/third_party/lib/python2.7/dist-packages/rospkg/manifest.py | numberen/apollo-platform | 742 | 11067269 | # Software License Agreement (BSD License)
#
# Copyright (c) 2008, <NAME>, Inc.
# All rights reserved.
#
# 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 copyri... |
build/android/pylib/utils/reraiser_thread.py | iplo/Chain | 231 | 11067288 | <reponame>iplo/Chain
# Copyright 2013 The Chromium Authors. All rights reserved.
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
"""Thread and ThreadGroup that reraise exceptions on the main thread."""
import logging
import sys
import threading
import time
import ... |
models/allennlp_multi_head_similarity.py | zeta1999/tsalib | 241 | 11067304 | #Original file : https://github.com/allenai/allennlp/blob/master/allennlp/modules/similarity_functions/multiheaded.py
# The annotations in the `forward` function are sufficient to explain the module's functionality
import sys
sys.path.append('../')
from tsalib import dim_vars
from overrides import overrides
import ... |
Flaircounting/flaircounting.py | zatherz/reddit | 444 | 11067308 | <gh_stars>100-1000
#/u/GoldenSights
import praw
import time
import sqlite3
import datetime
'''USER CONFIGURATION'''
APP_ID = ""
APP_SECRET = ""
APP_URI = ""
APP_REFRESH = ""
# https://www.reddit.com/comments/3cm1p8/how_to_make_your_bot_use_oauth2/
USERAGENT = ""
#This is a short description of what the bot does. For ... |
Data Structures/Priority Queue/Python/priority_queue.py | strangestroad/interview-techdev-guide | 320 | 11067310 | class PriorityQueue(dict):
def __init__(self,*args,**kwargs):
super(PriorityQueue,self).__init__(*args,**kwargs)
self._rebuild_heap()
def _rebuild_heap(self):
self._heap=[(v,k) for k,v in self.items()]
heapify(self._heap)
def smallest(self):
heap=self._heap
... |
wagtail/tests/urls.py | brownaa/wagtail | 8,851 | 11067311 | <reponame>brownaa/wagtail<gh_stars>1000+
from django.http import HttpResponse
from django.urls import include, path
from wagtail.admin import urls as wagtailadmin_urls
from wagtail.api.v2.router import WagtailAPIRouter
from wagtail.api.v2.views import PagesAPIViewSet
from wagtail.contrib.sitemaps import Sitemap
from w... |
ch11-程序性能检测及优化/11.getTickCount.py | makelove/OpenCV-Python-Tutorial | 2,875 | 11067342 | <filename>ch11-程序性能检测及优化/11.getTickCount.py
# -*- coding: utf-8 -*-
import cv2
import numpy as np
'''
使用 OpenCV 检测程序效率
'''
img1 = cv2.imread('../data/ml.jpg')
e1 = cv2.getTickCount()
for i in range(5, 49, 2):
img1 = cv2.medianBlur(img1, i)
e2 = cv2.getTickCount()
t = (e2 - e1) / cv2.getTickFrequency() # 时钟频率 或... |
research/object_detection/dataset_tools/seq_example_util.py | akshit-protonn/models | 82,518 | 11067346 | <gh_stars>1000+
# Copyright 2020 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
#
# Unless req... |
modules/xlsxwriter/sharedstrings.py | noraj/Kvasir | 194 | 11067401 | ###############################################################################
#
# SharedStrings - A class for writing the Excel XLSX sharedStrings file.
#
# Copyright 2013, <NAME>, <EMAIL>
#
# Standard packages.
import re
# Package imports.
from . import xmlwriter
class SharedStrings(xmlwriter.XMLwriter):
"""... |
tests/parsers/olecf.py | roshanmaskey/plaso | 1,253 | 11067405 | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""Tests for the OLE Compound Files (OLECF) parser."""
import unittest
from plaso.containers import sessions
from plaso.containers import warnings
from plaso.lib import definitions
from plaso.parsers import olecf
from plaso.parsers import olecf_plugins # pylint: disable... |
test/unit/reductions/conftest.py | alliesaizan/fairlearn | 1,142 | 11067431 | <gh_stars>1000+
# Copyright (c) Microsoft Corporation and Fairlearn contributors.
# Licensed under the MIT License.
from test.unit.input_convertors import ensure_list, ensure_series
def is_invalid_transformation(**kwargs):
A_two_dim = kwargs["A_two_dim"]
transform = kwargs["transformA"]
if A_two_dim and ... |
tumblr/tumblr.py | czahoi/crawler-py | 127 | 11067434 | # -*- coding=utf-8 -*-
"""
tumblr多线程下载脚本。
feature:
1. 支持下载多个用户视频
2. 多线程下载
3. 自动去重已失效视频
- 兼容Python2.7以上版本
- windows下的兼容性未测试
- 安装依赖包:
pip install requests
- 修改脚本最后的tumblr用户名列表。
示例:
names=['username1','username2']
- 运行脚本
python tumblr.py
"""
from threading import Thread
import requests
import re
import os
import sy... |
3d_segmentation/torch/unet_evaluation_array.py | tommydino93/tutorials | 535 | 11067443 | <filename>3d_segmentation/torch/unet_evaluation_array.py<gh_stars>100-1000
# Copyright 2020 MONAI Consortium
# 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... |
custom_components/nuki_ng/__init__.py | gasecki/Home-Assistant_Config | 163 | 11067465 | from __future__ import annotations
from .nuki import NukiCoordinator
from .constants import DOMAIN, PLATFORMS
from homeassistant.core import HomeAssistant
from homeassistant.helpers import service
# from homeassistant.helpers import device_registry
from homeassistant.helpers.update_coordinator import (
Coordinato... |
python3/pracmln/mln/inference/mcmc.py | seba90/pracmln | 123 | 11067484 | # -*- coding: utf-8 -*-
#
# Markov Logic Networks
#
# (C) 2012-2015 by <NAME>
# 2006-2011 by <NAME>
#
# Permission is hereby granted, free of charge, to any person obtaining
# a copy of this software and associated documentation files (the
# "Software"), to deal in the Software without restriction, including
# with... |
glue/core/tests/test_coordinates.py | HPLegion/glue | 550 | 11067487 | <filename>glue/core/tests/test_coordinates.py
# pylint: disable=I0011,W0613,W0201,W0212,E1101,E1103
import pytest
import numpy as np
from numpy.testing import assert_allclose, assert_equal
from glue.core.tests.test_state import clone
from glue.tests.helpers import requires_astropy
from ..coordinate_helpers import (a... |
python/glow/logging/__init__.py | bcajes/glow | 214 | 11067499 | from .hlseventlogger import *
|
toollib/tcli/commands/_sync.py | atpuxiner/toollib | 113 | 11067528 | """
@author axiner
@version v1.0.0
@created 2022/5/2 9:35
@abstract
@description
@history
"""
from toollib.decorator import sys_required
from toollib.tcli.base import BaseCmd
from toollib.tcli.commands.plugins.sync import execute
from toollib.tcli.option import Options, Arg
class Cmd(BaseCmd):
def __init__(self)... |
arelle/ViewWinFactList.py | hamscher/Arelle | 292 | 11067529 | <reponame>hamscher/Arelle
'''
Created on Oct 5, 2010
@author: Mark V Systems Limited
(c) Copyright 2010 Mark V Systems Limited, All rights reserved.
'''
from arelle import ViewWinTree, ModelDtsObject, XbrlConst
from arelle.ModelRelationshipSet import ModelRelationshipSet
from arelle.ModelDtsObject import ModelResource... |
models/modbus-sungrow-sg8kd.py | johschmitz/ModbusTCP2MQTT | 130 | 11067536 | read_register = {
"5003": "daily_power_yield_0.01", # Wh
"5004": "total_power_yield_100", # MWh
"5008": "internal_temp_10", # C
"5011": "pv1_voltage_10", # V
"5012": "pv1_current_10", # A
"5013": "pv2_voltage_10", # V
"5014": "pv2_current_10", # A
"5017": "total_pv... |
src/visitpy/visit_utils/tests/visit_test.py | visit-dav/vis | 226 | 11067551 | # Copyright (c) Lawrence Livermore National Security, LLC and other VisIt
# Project developers. See the top-level LICENSE file for dates and other
# details. No copyright assignment is required to contribute to VisIt.
"""
file: visit_test.py
author: <NAME> <<EMAIL>>
created: 4/9/2010
description:
Provides a ... |
buildroot/support/testing/tests/package/test_python_smmap2.py | bramkragten/operating-system | 349 | 11067569 | from tests.package.test_python import TestPythonPackageBase
class TestPythonPy2Smmap2(TestPythonPackageBase):
__test__ = True
config = TestPythonPackageBase.config + \
"""
BR2_PACKAGE_PYTHON=y
BR2_PACKAGE_PYTHON_SMMAP2=y
"""
sample_scripts = ["tests/package/sample_python_sm... |
growler/__init__.py | pyGrowler/Growler | 806 | 11067571 | <reponame>pyGrowler/Growler
#
# growler/__init__.py
#
# flake8: noqa
#
# Copyright (c) 2020 <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.apach... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.