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 |
|---|---|---|---|---|
tests/test_runtime/async_benchmark.py | evgps/mmdetection_trashcan | 367 | 11070234 | <reponame>evgps/mmdetection_trashcan
import asyncio
import os
import shutil
import urllib
import mmcv
import torch
from mmdet.apis import (async_inference_detector, inference_detector,
init_detector)
from mmdet.utils.contextmanagers import concurrent
from mmdet.utils.profiling import profile_t... |
autogl/module/hpo/suggestion/__init__.py | dedsec-9/AutoGL | 824 | 11070254 | # Files in this folder are reproduced from https://github.com/tobegit3hub/advisor with some changes.
|
gluoncv/auto/estimators/center_net/__init__.py | Kh4L/gluon-cv | 5,447 | 11070256 | <gh_stars>1000+
"""SSD Estimator implementations"""
from .center_net import CenterNetEstimator
|
ortools/linear_solver/samples/basic_example.py | AlohaChina/or-tools | 8,273 | 11070263 | <filename>ortools/linear_solver/samples/basic_example.py
#!/usr/bin/env python3
# Copyright 2010-2021 Google LLC
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/li... |
python/example_code/emr/pyspark_top_product_keyword.py | iconara/aws-doc-sdk-examples | 5,166 | 11070276 | # Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
# SPDX-License-Identifier: Apache-2.0
"""
Purpose
Shows how to write a script that queries historical Amazon review data that is
stored in a public Amazon S3 bucket. The query returns the top reviewed products from
a category that contain a keyword ... |
pb_bss/evaluation/module_srmr.py | fgnt/pb_bss | 171 | 11070283 | <filename>pb_bss/evaluation/module_srmr.py
import numpy as np
def srmr(signal, sample_rate, n_cochlear_filters=23, low_freq=125, min_cf=4, max_cf=128, fast=False, norm=False,):
"""
Wrapper around the SRMRpy package to allow an independent axis
Note: The results of this implementation are slightly differen... |
tests/test_wstrust_response.py | Yoni-Mantzur/azure-activedirectory-library-for-python | 258 | 11070285 | #------------------------------------------------------------------------------
#
# Copyright (c) Microsoft Corporation.
# All rights reserved.
#
# This code is licensed under the MIT License.
#
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated document... |
py/abd/abdmail_mailer.py | aevri/phabricator-tools | 150 | 11070287 | """Send mails to interested parties about pre-specified conditions."""
# =============================================================================
# CONTENTS
# -----------------------------------------------------------------------------
# abdmail_mailer
#
# Public Classes:
# Mailer
# .noUsersOnBranch
#
# ----... |
pyBN/utils/_tests/test_markov_blanket.py | seuzmj/pyBN | 126 | 11070293 | """
**************
Markov Blanket
Unit Test
**************
"""
__author__ = """<NAME> <<EMAIL>>"""
import unittest
import os
from os.path import dirname
import numpy as np
import pandas as pd
from pyBN.readwrite.read import read_bn
from pyBN.independence.markov_blanket import markov_blanket
class ConstraintTestsTes... |
pyimgsaliency/__init__.py | yhenon/pyImSaliency | 165 | 11070304 | <reponame>yhenon/pyImSaliency
from .saliency import *
from .binarise import *
from .saliency_mbd import *
from .evaluate import *
|
chainer_chemistry/dataset/preprocessors/mol_preprocessor.py | pfnet/chainerchem | 184 | 11070320 | from rdkit import Chem
from chainer_chemistry.dataset.preprocessors.base_preprocessor import BasePreprocessor # NOQA
from chainer_chemistry.datasets.numpy_tuple_dataset import NumpyTupleDataset # NOQA
class MolPreprocessor(BasePreprocessor):
"""preprocessor class specified for rdkit mol instance
Args:
... |
projects_oss/detr/detr/__init__.py | sstsai-adl/d2go | 687 | 11070325 | #!/usr/bin/env python3
# Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved
from . import models, util, datasets
__all__ = ["models", "util", "datasets"]
|
tools/setup.py | mrjrty/rpaframework | 518 | 11070329 | #!/usr/bin/env python3
import os
import sys
poetry_path = os.path.expanduser('~/.poetry/lib')
sys.path.append(os.path.realpath(poetry_path))
try:
from poetry.core.masonry.builders.sdist import SdistBuilder
except ImportError:
from poetry.masonry.builders.sdist import SdistBuilder
from poetry.factory import Factory
... |
all_ensemble_models/mean_model.py | LuChungYing/yt8m-ensenble-model | 196 | 11070347 | <reponame>LuChungYing/yt8m-ensenble-model
import math
import models
import tensorflow as tf
import utils
from tensorflow import flags
import tensorflow.contrib.slim as slim
FLAGS = flags.FLAGS
class MeanModel(models.BaseModel):
"""Mean model."""
def create_model(self, model_input, **unused_params):
"""Creates... |
akshare/economic/cons.py | J-Z-Z/akshare | 721 | 11070354 | <filename>akshare/economic/cons.py
#!/usr/bin/env python
# -*- coding:utf-8 -*-
"""
Date: 2019/10/21 21:11
Desc: 宏观经济配置文件
"""
# bitcoin
bitcoin_url = "https://datacenter-api.jin10.com/crypto_currency/list"
bitcoin_payload = {
"_": "1572857040275",
}
bitcoin_headers = {
"accept": "*/*",
"accept-encoding": "g... |
test/run/t69.py | timmartin/skulpt | 2,671 | 11070381 | <reponame>timmartin/skulpt<gh_stars>1000+
x = {1:2}
del x[1]
print len(x)
|
codegen_sources/test_generation/evosuite_tests_translators/tests/resources/expected_python_translations/integer_array_casting.py | AlexShypula/CodeGen | 241 | 11070396 | <reponame>AlexShypula/CodeGen<filename>codegen_sources/test_generation/evosuite_tests_translators/tests/resources/expected_python_translations/integer_array_casting.py
import numpy as np
import math
from math import *
import collections
from collections import *
import heapq
import itertools
import random
import sys
im... |
loss/robust_loss_pytorch/tests/distribution_test.py | milesgray/CALAE | 522 | 11070409 | <filename>loss/robust_loss_pytorch/tests/distribution_test.py
# coding=utf-8
# Copyright 2019 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.a... |
src/einsteinpy/metric/kerrnewman.py | QMrpy/einsteinpy | 485 | 11070417 | import numpy as np
from astropy import units as u
from einsteinpy import constant
from einsteinpy.metric import BaseMetric
from einsteinpy.utils import CoordinateError
_c = constant.c.value
_G = constant.G.value
_Cc = constant.coulombs_const.value
class KerrNewman(BaseMetric):
"""
Class for defining Kerr-Ne... |
var/spack/repos/builtin/packages/py-preshed/package.py | LiamBindle/spack | 2,360 | 11070464 | # Copyright 2013-2021 Lawrence Livermore National Security, LLC and other
# Spack Project Developers. See the top-level COPYRIGHT file for details.
#
# SPDX-License-Identifier: (Apache-2.0 OR MIT)
class PyPreshed(PythonPackage):
"""preshed: Cython Hash Table for Pre-Hashed Keys."""
homepage = "https://github... |
3rdParty/V8/v7.9.317/tools/release/search_related_commits.py | rajeev02101987/arangodb | 12,278 | 11070467 | <gh_stars>1000+
#!/usr/bin/env python
# Copyright 2015 the V8 project authors. All rights reserved.
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
# for py2/py3 compatibility
from __future__ import print_function
import argparse
import operator
import os
import r... |
imageatm/utils/io.py | vishalbelsare/imageatm | 215 | 11070494 | import json
import yaml
from pathlib import Path
from typing import Union
def load_json(file_path: Path) -> Union[dict, list]:
with open(file_path, 'r') as f:
return json.load(f)
def save_json(data: Union[dict, list], target_file: str):
with open(target_file, 'w') as f:
json.dump(data, f, in... |
cctbx/maptbx/prepare_map_for_docking.py | whart222/cctbx_project | 155 | 11070499 | <reponame>whart222/cctbx_project
from __future__ import print_function
from __future__ import division
import math
from cctbx.maptbx import mask
from scitbx.array_family import flex
from scitbx.dtmin.minimizer import Minimizer
from scitbx.dtmin.refinebase import RefineBase
from scitbx.dtmin.reparams import Reparams
f... |
src/_dependencies/resolve.py | dry-python/dependencies | 175 | 11070502 | <gh_stars>100-1000
from _dependencies.exceptions import DependencyError
from _dependencies.state import _State
from _dependencies.trace import _Trace
class _Resolver:
def __init__(self, graph, cache, attrname):
self.graph = graph
self.state = _State(cache, attrname)
self.attrname = attrnam... |
model/ESTRNN-RAW.py | RunqiuBao/Event_ESTRNN | 180 | 11070577 | import torch
import torch.nn as nn
import torch.nn.functional as F
from thop import profile
from .arches import conv1x1, conv3x3, conv5x5, actFunc, SpaceToDepth
from .attention import CBAM
# Dense layer
class dense_layer(nn.Module):
def __init__(self, in_channels, growthRate, activation='relu'):
... |
tilecloud/layout/wms.py | camptocamp/tilecloud | 134 | 11070592 | <reponame>camptocamp/tilecloud<filename>tilecloud/layout/wms.py<gh_stars>100-1000
from typing import Any, Dict, Optional
from urllib.parse import urlencode
from tilecloud import TileCoord, TileGrid, TileLayout
class WMSTileLayout(TileLayout):
def __init__(
self,
url: str,
layers: str,
... |
language/serene/util.py | Xtuden-com/language | 1,199 | 11070593 | <filename>language/serene/util.py<gh_stars>1000+
# coding=utf-8
# Copyright 2018 The Google AI Language Team 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... |
ocs_ci/ocs/pgsql.py | annagitel/ocs-ci | 130 | 11070638 | """
Postgresql workload class
"""
import logging
import random
import time
from prettytable import PrettyTable
from ocs_ci.ocs.benchmark_operator import BenchmarkOperator, BMO_NAME
from ocs_ci.utility.utils import TimeoutSampler, run_cmd
from ocs_ci.ocs.utils import get_pod_name_by_pattern
from ocs_ci.utility import u... |
xknx/io/const.py | iligiddi/xknx | 179 | 11070645 | """KNX Constants used within io."""
DEFAULT_MCAST_GRP = "172.16.17.32"
DEFAULT_MCAST_PORT = 3671
CONNECTION_ALIVE_TIME = 120
CONNECTIONSTATE_REQUEST_TIMEOUT = 10
HEARTBEAT_RATE = CONNECTION_ALIVE_TIME - (CONNECTIONSTATE_REQUEST_TIMEOUT * 5)
|
checkov/common/checks_infra/solvers/attribute_solvers/base_attribute_solver.py | vangundy-jason-pfg/checkov | 4,013 | 11070653 | import concurrent.futures
import re
from typing import List, Tuple, Dict, Any, Optional, Pattern
from networkx import DiGraph
from checkov.common.graph.checks_infra.enums import SolverType
from checkov.common.graph.checks_infra.solvers.base_solver import BaseSolver
from concurrent.futures import ThreadPoolExecutor
... |
code/test/AiSpeech/lib/aispeech/api_aispeech.py | FACEGOOD/Audio2BlendshapeWeights | 266 | 11070668 | <filename>code/test/AiSpeech/lib/aispeech/api_aispeech.py
# -*- coding: utf-8 -*-
# !/usr/bin/env python36
"""
tgshg/aispeech/api_aispeech.py
:copyright:facegood © 2019 by the tang.
url: https://help.tgenie.cn/#/ba_token
"""
import requests
import hashlib
import time
import json
class AiSpeech(object):
... |
apps/user/serializers.py | PyCN/BlogBackendProject | 335 | 11070669 | #!/usr/bin/python3
# -*- coding: utf-8 -*-
# @Time : 2017/12/7 上午11:49
# @Author : LennonChin
# @Email : <EMAIL>
# @File : serializers.py
# @Software: PyCharm
import re
from datetime import datetime, timedelta
from rest_framework import serializers
from .models import GuestProfile, EmailVerifyRecord
from base... |
geopyspark/tests/geotrellis/tiled_layer_tests/focal_test.py | geotrellis/geotrellis-python | 182 | 11070676 | <reponame>geotrellis/geotrellis-python
import numpy as np
import os
import pytest
import unittest
from geopyspark.geotrellis import SpatialKey, Extent, Tile, SpatialPartitionStrategy, HashPartitionStrategy
from geopyspark.geotrellis.layer import TiledRasterLayer
from geopyspark.tests.base_test_class import BaseTestCla... |
sdk/resources/azure-mgmt-resource/azure/mgmt/resource/policy/v2020_09_01/models/_models.py | rsdoherty/azure-sdk-for-python | 2,728 | 11070691 | # coding=utf-8
# --------------------------------------------------------------------------
# Copyright (c) Microsoft Corporation. All rights reserved.
# Licensed under the MIT License. See License.txt in the project root for license information.
# Code generated by Microsoft (R) AutoRest Code Generator.
# Changes may ... |
readthedocs/embed/v3/urls.py | mehrdad-khojastefar/readthedocs.org | 2,092 | 11070743 | from django.conf.urls import url
from .views import EmbedAPI
urlpatterns = [
url(r'', EmbedAPI.as_view(), name='embed_api_v3'),
]
|
test/streamparse/cli/test_list.py | Pandinosaurus/streamparse | 1,050 | 11070751 | import argparse
import unittest
from streamparse.cli.list import subparser_hook
def test_subparser_hook():
parser = argparse.ArgumentParser()
subparsers = parser.add_subparsers()
subparser_hook(subparsers)
subcommands = parser._optionals._actions[1].choices.keys()
assert "list" in subcommands
|
capirca/lib/nsxv.py | google-admin/capirca | 604 | 11070758 | # Copyright 2015 The Capirca Project Authors All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# unless required by app... |
src/robotide/application/pluginloader.py | guojiajiaok/RIDE | 775 | 11070798 | # Copyright 2008-2015 Nokia Networks
# Copyright 2016- Robot Framework Foundation
#
# 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
... |
test/programytest/clients/test_config.py | RonKhondji/program-y | 345 | 11070868 | import unittest
from programy.clients.config import ClientConfigurationData
from programy.clients.events.console.config import ConsoleConfiguration
from programy.config.file.yaml_file import YamlConfigurationFile
from programytest.config.bot.test_bot import BotConfigurationTests
from programytest.utils.email.test_conf... |
AppServer/google/net/proto/RawMessage.py | loftwah/appscale | 790 | 11070896 | <filename>AppServer/google/net/proto/RawMessage.py
#!/usr/bin/env python
#
# Copyright 2007 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/... |
magenta/common/concurrency_test.py | sandutsar/magenta | 16,143 | 11070917 | # Copyright 2022 The Magenta 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 ... |
dash_docs/chapters/reference/index.py | wesleyacheng/dash-docs | 379 | 11070928 | import dash
import dash_html_components as html
import dash_core_components as dcc
import textwrap
import re
import inspect
def convert_docstring_to_markdown(docstring):
if not docstring:
return '\n\(No docstring available)\n'
lines = docstring.split('\n')
# For some reason the second block of li... |
examples/run_bidafplus/run_bidafplus_squadv2.py | ishine/SMRCToolkit | 1,238 | 11070929 | <reponame>ishine/SMRCToolkit
# coding: utf-8
from sogou_mrc.data.vocabulary import Vocabulary
from sogou_mrc.data.batch_generator import BatchGenerator
from sogou_mrc.dataset.squadv2 import SquadV2Reader, SquadV2Evaluator
from sogou_mrc.model.bidafplus_squad2 import BiDAFPlus
import tensorflow as tf
import logging
impo... |
official/utils/flags/_base.py | 873040/Abhishek | 357 | 11070934 | # Copyright 2018 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... |
chrome/test/pyautolib/history_info.py | nagineni/chromium-crosswalk | 231 | 11070986 | <filename>chrome/test/pyautolib/history_info.py
# Copyright (c) 2011 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.
"""History: python representation for history.
Obtain one of these from PyUITestSuite::GetHistoryInfo() ... |
setup.py | timmahrt/praatIO | 208 | 11070987 | <gh_stars>100-1000
#!/usr/bin/env python
# encoding: utf-8
"""
Created on Aug 29, 2014
@author: tmahrt
"""
from setuptools import setup
import io
setup(
name="praatio",
python_requires=">3.6.0",
version="5.0.0",
author="<NAME>",
author_email="<EMAIL>",
url="https://github.com/timmahrt/praatIO"... |
examples/units_and_coordinates/AIA_limb_STEREO.py | Octaves0911/sunpy | 628 | 11070992 | <filename>examples/units_and_coordinates/AIA_limb_STEREO.py
"""
===========================================
Drawing the AIA limb on a STEREO EUVI image
===========================================
In this example we use a STEREO-B and an SDO image to demonstrate how to
overplot the limb as seen by AIA on an EUVI-B imag... |
src/oci/data_integration/models/oracle_adwc_write_attribute.py | Manny27nyc/oci-python-sdk | 249 | 11070994 | <filename>src/oci/data_integration/models/oracle_adwc_write_attribute.py<gh_stars>100-1000
# 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/... |
snlds/examples/tensorboard_utils.py | deepneuralmachine/google-research | 23,901 | 11070998 | <reponame>deepneuralmachine/google-research<filename>snlds/examples/tensorboard_utils.py<gh_stars>1000+
# 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 c... |
aws_inventory/store.py | UA-SOlsen/aws-inventory | 594 | 11071001 | """Data persistence for responses and any exceptions while invoking operations."""
import datetime
import json
import logging
import pickle
import string
import sys
import time
import uuid
import botocore
import config
import version
LOGGER = logging.getLogger(__name__)
class ResponseEncoder(json.JSONEncoder):
... |
pysteps/tests/test_tracking_tdating.py | leabeusch/pysteps | 285 | 11071020 | # -*- coding: utf-8 -*-
import numpy as np
import pytest
from pysteps.tracking.tdating import dating
from pysteps.utils import to_reflectivity
from pysteps.tests.helpers import get_precipitation_fields
arg_names = ("source", "dry_input")
arg_values = [
("mch", False),
("mch", False),
("mch", True),
]
... |
functions/source/sitewisemonitorfunction/jmespath/__init__.py | jieatelement/quickstart-aws-industrial-machine-connectivity | 1,738 | 11071026 | <filename>functions/source/sitewisemonitorfunction/jmespath/__init__.py<gh_stars>1000+
from jmespath import parser
from jmespath.visitor import Options
__version__ = '0.9.5'
def compile(expression):
return parser.Parser().parse(expression)
def search(expression, data, options=None):
return parser.Parser().... |
tests/generators/merkle/main.py | sifraitech/eth2.0-specs | 497 | 11071049 | <reponame>sifraitech/eth2.0-specs
from eth2spec.test.helpers.constants import ALTAIR, BELLATRIX
from eth2spec.gen_helpers.gen_from_tests.gen import run_state_test_generators
if __name__ == "__main__":
altair_mods = {key: 'eth2spec.test.altair.merkle.test_' + key for key in [
'single_proof',
]}
bel... |
google/colab/_pip.py | figufema/TesteClone | 1,521 | 11071050 | <gh_stars>1000+
"""Routines for extracting information about pip installed packages.
The intent is to provide users a useful warning if they !pip install a package
that is already loaded in sys.modules.
"""
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
i... |
solo/methods/swav.py | xwyzsn/solo-learn | 693 | 11071051 | <reponame>xwyzsn/solo-learn
# Copyright 2021 solo-learn development team.
# 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,... |
scripts/color.py | vfinotti/vhdl-extras | 131 | 11071059 | <gh_stars>100-1000
#!usr/bin/python
# -*- coding: utf-8 -*-
'''Color formatting
'''
from __future__ import print_function, division
try:
import colorama
colorama.init()
from colorama import Fore, Back, Style
except ImportError:
def note(t): return t
def success(t): return t
def warn(t): re... |
app/tests/challenges_tests/test_models.py | kaczmarj/grand-challenge.org | 101 | 11071090 | <gh_stars>100-1000
import pytest
from actstream.actions import is_following
from actstream.models import Action
from django.core.exceptions import ObjectDoesNotExist
from django.db.models import ProtectedError
from machina.apps.forum_conversation.models import Topic
from grandchallenge.challenges.models import Challen... |
tools/build/v2/test/property_expansion.py | jmuskaan72/Boost | 198 | 11071116 | <reponame>jmuskaan72/Boost<filename>tools/build/v2/test/property_expansion.py
#!/usr/bin/python
# Copyright 2003 <NAME>
# Distributed under the Boost Software License, Version 1.0.
# (See accompanying file LICENSE_1_0.txt or http://www.boost.org/LICENSE_1_0.txt)
# Test that free property inside.
import Bo... |
lib/PyAMF-0.6.1/pyamf/util/__init__.py | MiCHiLU/google_appengine_sdk | 790 | 11071145 | <reponame>MiCHiLU/google_appengine_sdk<filename>lib/PyAMF-0.6.1/pyamf/util/__init__.py<gh_stars>100-1000
# Copyright (c) The PyAMF Project.
# See LICENSE.txt for details.
"""
AMF Utilities.
@since: 0.1.0
"""
import calendar
import datetime
import inspect
import pyamf
from pyamf import python
try:
from cpyamf.u... |
rssant/middleware/prometheus.py | zuzhi/rssant | 1,176 | 11071150 | <reponame>zuzhi/rssant<gh_stars>1000+
import time
from django.http import HttpRequest, HttpResponse
from prometheus_client import Histogram
from prometheus_client.exposition import choose_encoder, REGISTRY
def django_metrics_view(request: HttpRequest) -> HttpResponse:
registry = REGISTRY
accept = request.head... |
montreal_forced_aligner/multiprocessing/alignment.py | MontrealCorpusTools/Montreal-Forced-Aligner | 702 | 11071153 | <reponame>MontrealCorpusTools/Montreal-Forced-Aligner
import subprocess
import os
import re
import sys
import time
import traceback
from decimal import Decimal
import statistics
from collections import defaultdict
from multiprocessing import Lock
from .helper import make_path_safe, run_mp, run_non_mp, thirdparty_binar... |
example/cifar10/resnet56_jpeg.py | KuanKuanQAQ/ares | 206 | 11071167 | from ares.utils import get_res_path
from ares.defense.jpeg_compression import jpeg_compression
import resnet56
MODEL_PATH = get_res_path('./cifar10/resnet56.ckpt')
def load(session):
model = ResNet56_JPEG()
model.load(MODEL_PATH, session)
return model
@jpeg_compression()
class ResNet56_JPEG(resnet56.R... |
package_control/file_not_found_error.py | William-Cao/Less- | 3,373 | 11071169 | import sys
class FileNotFoundError(Exception):
"""If a file is not found"""
def __unicode__(self):
return self.args[0]
def __str__(self):
if sys.version_info < (3,):
return self.__bytes__()
return self.__unicode__()
def __bytes__(self):
return self.__uni... |
tests/test_dataset/test_test_time_aug.py | yuexy/mmocr | 2,261 | 11071172 | <filename>tests/test_dataset/test_test_time_aug.py
# Copyright (c) OpenMMLab. All rights reserved.
import numpy as np
import pytest
from mmocr.datasets.pipelines.test_time_aug import MultiRotateAugOCR
def test_resize_ocr():
input_img1 = np.ones((64, 256, 3), dtype=np.uint8)
input_img2 = np.ones((64, 32, 3), ... |
typed_python/compiler/merge_type_wrappers_test.py | APrioriInvestments/typed_python | 105 | 11071173 | from typed_python.compiler.merge_type_wrappers import mergeTypes
from typed_python import OneOf, Value, Class
class Base(Class):
pass
class Child(Base):
pass
def test_merge_types():
assert mergeTypes([float, int]) == OneOf(float, int)
assert mergeTypes([float, Value(1)]) == OneOf(1, float)
ass... |
SoftLayer/CLI/dedicatedhost/cancel_guests.py | dvzrv/softlayer-python | 126 | 11071203 | <gh_stars>100-1000
"""Cancel a dedicated host."""
# :license: MIT, see LICENSE for more details.
import click
import SoftLayer
from SoftLayer.CLI import environment
from SoftLayer.CLI import exceptions
from SoftLayer.CLI import formatting
from SoftLayer.CLI import helpers
@click.command()
@click.argument('identifie... |
dizoo/mujoco/envs/mujoco_env.py | LuciusMos/DI-engine | 464 | 11071223 | from typing import Any, Union, List
import copy
import numpy as np
from easydict import EasyDict
from ding.envs import BaseEnv, BaseEnvTimestep, BaseEnvInfo, update_shape
from ding.envs.common.env_element import EnvElement, EnvElementInfo
from ding.envs.common.common_function import affine_transform
from ding.torch_ut... |
python-threatexchange/threatexchange/dataset.py | b-bold/ThreatExchange | 997 | 11071224 | <filename>python-threatexchange/threatexchange/dataset.py
#!/usr/bin/env python
# Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved
"""
A wrapper around loading and storing ThreatExchange data from files.
There are a few categories of state that this wraps:
1. Checkpoints - state about previous f... |
tests/extmod/ucryptolib_aes128_ctr.py | sebastien-riou/micropython | 13,648 | 11071230 | try:
from ucryptolib import aes
except ImportError:
print("SKIP")
raise SystemExit
def _new(k, ctr_initial):
return aes(k, 6, ctr_initial)
try:
_new(b"x" * 16, b"x" * 16)
except ValueError as e:
# is CTR support disabled?
if e.args[0] == "mode":
print("SKIP")
raise System... |
openproblems/tasks/denoising/api.py | bendemeo/SingleCellOpenProblems | 134 | 11071250 | from ...data.sample import load_sample_data
import numpy as np
def check_dataset(adata):
"""Check that dataset output fits expected API."""
assert "train" in adata.obsm
assert "test" in adata.obsm
assert adata.obsm["train"].shape == adata.X.shape
assert adata.obsm["test"].shape == adata.X.shape
... |
test/test_correlog.py | butala/spectrum | 261 | 11071254 | from spectrum import CORRELOGRAMPSD, CORRELATION, pcorrelogram, marple_data
from spectrum import data_two_freqs
from pylab import log10, plot, savefig, linspace
from numpy.testing import assert_array_almost_equal, assert_almost_equal
def test_correlog():
psd = CORRELOGRAMPSD(marple_data, marple_data, lag=15)
... |
tests/components/p1_monitor/__init__.py | MrDelik/core | 30,023 | 11071256 | """Tests for the P1 Monitor integration."""
|
coin_monitor/system_info.py | TST-Group-BE/chia_plot_manager | 365 | 11071259 | <gh_stars>100-1000
#!/usr/bin/python3
# -*- coding: utf-8 -*-
"""
system_info.py for use with coin_monitor.py
"""
VERSION = "V0.2 (2021-03-23)"
## Set Notification Accounts#
alert_email = ['<EMAIL>', '<EMAIL>']
new_coin_email = ['<EMAIL>', '<EMAIL>']
twilio_from = '+10000000'
twilio_account = 'xxxxxxxxxxxxxxxxxxxxxx... |
language/mentionmemory/tasks/memory_generation_task_test.py | urikz/language | 1,199 | 11071264 | # coding=utf-8
# Copyright 2018 The Google AI Language Team 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 ... |
tests/core/asyncio/test_endpoint_local_broadcast.py | gsalgado/lahja | 400 | 11071266 | import asyncio
import pytest
from lahja import BaseEvent, BaseRequestResponseEvent
@pytest.mark.asyncio
async def test_local_broadcast_is_connected_to_self(endpoint):
assert endpoint.is_connected_to(endpoint.name)
@pytest.mark.asyncio
async def test_local_broadcast_wait_until_connected_to(endpoint):
await... |
lte/gateway/python/magma/enodebd/main.py | Aitend/magma | 849 | 11071268 | <reponame>Aitend/magma
"""
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 "AS IS" BASI... |
src/pretix/api/views/__init__.py | fabm3n/pretix | 1,248 | 11071275 | <gh_stars>1000+
#
# This file is part of pretix (Community Edition).
#
# Copyright (C) 2014-2020 <NAME> and contributors
# Copyright (C) 2020-2021 rami.io GmbH and contributors
#
# This program is free software: you can redistribute it and/or modify it under the terms of the GNU Affero General
# Public License as publi... |
zeus/networks/pytorch/customs/nago.py | shaido987/vega | 240 | 11071282 | # -*- coding:utf-8 -*-
# Copyright (C) 2020. Huawei Technologies Co., Ltd. All rights reserved.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the MIT License.
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the ... |
cmsplugin_cascade/generic/settings.py | teklager/djangocms-cascade | 139 | 11071295 | <reponame>teklager/djangocms-cascade<gh_stars>100-1000
CASCADE_PLUGINS = ['custom_snippet', 'heading', 'horizontal_rule', 'simple_wrapper', 'text_image']
def set_defaults(config):
from cmsplugin_cascade.extra_fields.config import PluginExtraFieldsConfig
config.setdefault('plugins_with_extra_fields', {})
p... |
advisor_server/suggestion/migrations/0001_initial.py | silvery107/advisor | 1,498 | 11071329 | # -*- coding: utf-8 -*-
# Generated by Django 1.11.10 on 2018-10-02 08:01
from __future__ import unicode_literals
from django.db import migrations, models
class Migration(migrations.Migration):
initial = True
dependencies = [
]
operations = [
migrations.CreateModel(
name='Algor... |
spotify_confidence/analysis/frequentist/z_test_linreg.py | danielsaaf/confidence | 107 | 11071337 | # Copyright 2017-2020 Spotify AB
#
# 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 writi... |
test/benchmark/fannkuch.py | CohenArthur/wren | 2,712 | 11071347 | # The Computer Language Benchmarks Game
# http://benchmarksgame.alioth.debian.org/
# contributed by <NAME>
# converted to Java by <NAME>
# converted to Python by <NAME>
# modified by <NAME>
def fannkuch(n):
maxFlipsCount = 0
permSign = True
checksum = 0
perm1 = list(range(n))
count = ... |
tests/test_RI_CEPA.py | andyj10224/psi4numpy | 214 | 11071351 | <gh_stars>100-1000
from addons import *
from utils import *
import pytest
tdir = 'Coupled-Electron-Pair-Approximation'
def test_LCCD(workspace):
exe_py(workspace, tdir, 'LCCD')
def test_LCCSD(workspace):
exe_py(workspace, tdir, 'LCCSD')
def test_OLCCD(workspace):
exe_py(workspace, tdir, 'OLCCD')
de... |
samples/vsphere/appliances/list_service.py | JKraftman/vsphere-automation-sdk-python | 589 | 11071352 | <reponame>JKraftman/vsphere-automation-sdk-python
#!/usr/bin/env python
"""
* *******************************************************
* Copyright (c) VMware, Inc. 2019. All Rights Reserved.
* SPDX-License-Identifier: MIT
* *******************************************************
*
* DISCLAIMER. THIS PROGRAM IS PROVIDED ... |
butterfree/transform/utils/window_spec.py | fossabot/butterfree | 208 | 11071356 | """Holds function for defining window in DataFrames."""
from typing import Any, List, Optional, Union
from pyspark import sql
from pyspark.sql import Column, WindowSpec, functions
from butterfree.constants.columns import TIMESTAMP_COLUMN
from butterfree.constants.window_definitions import ALLOWED_WINDOWS
class Fram... |
thrift/test/py/constants_test.py | laohubuzaijia/fbthrift | 2,112 | 11071383 | <filename>thrift/test/py/constants_test.py
# Copyright (c) Facebook, Inc. and its affiliates.
#
# 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.... |
pbctf2020/amazing_rop/exploit.py | nhtri2003gmail/ctf-write-ups | 101 | 11071415 | #!/usr/bin/env python3
from pwn import *
binary = context.binary = ELF('./bof')
if args.REMOTE:
p = remote('maze.chal.perfect.blue', 1)
else:
p = process(binary.path)
'''
// This is what you need to do to get the first flag
// void print_flag() {
// asm volatile("mov $1, %%eax; mov $0x31337, %%edi; mov $0x1337,... |
wsltools/utils/faker/providers/ssn/en_US/__init__.py | Symbo1/wsltools | 412 | 11071423 | # -*- coding: UTF-8 -*-
from __future__ import unicode_literals
from .. import Provider as BaseProvider
class Provider(BaseProvider):
INVALID_SSN_TYPE = 'INVALID_SSN'
SSN_TYPE = 'SSN'
ITIN_TYPE = 'ITIN'
EIN_TYPE = 'EIN'
def itin(self):
"""Generate a random United States Individual Taxpay... |
tia/bbg/example.py | AmarisAI/tia | 366 | 11071431 | <reponame>AmarisAI/tia<gh_stars>100-1000
import pandas as pd
from tia.bbg import LocalTerminal
if __name__ == '__main__':
d = pd.datetools.BDay(-4).apply(pd.datetime.now())
m = pd.datetools.BMonthBegin(-2).apply(pd.datetime.now())
def banner(msg):
print '*' * 25
print msg
print '*'... |
warehouse/migrations/versions/701c2fba1f5f_cascade_release_deletion_to_files.py | fairhopeweb/warehouse | 3,103 | 11071451 | <gh_stars>1000+
# 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, software
# distribu... |
contrib/one_shot_models/examples/sider_alternate_weave.py | cjgalvin/deepchem | 3,782 | 11071453 | """
Script that trains Weave models on SIDER dataset.
"""
from __future__ import print_function
from __future__ import division
from __future__ import unicode_literals
import numpy as np
np.random.seed(123)
import tensorflow as tf
tf.set_random_seed(123)
import deepchem as dc
sider_tasks, sider_datasets, transformers... |
venv/lib/python2.7/site-packages/werkzeug/testsuite/contrib/sessions.py | Christian-Castro/castro_odoo8 | 21,684 | 11071491 | # -*- coding: utf-8 -*-
"""
werkzeug.testsuite.sessions
~~~~~~~~~~~~~~~~~~~~~~~~~~~
Added tests for the sessions.
:copyright: (c) 2014 by <NAME>.
:license: BSD, see LICENSE for more details.
"""
import os
import unittest
import shutil
from tempfile import mkdtemp, gettempdir
from werkzeug.testsui... |
src/python/lista_encadeada_desordenada.py | danilolmoura/Algoritmos-e-Estruturas-de-Dados | 653 | 11071520 | <filename>src/python/lista_encadeada_desordenada.py
""" Implementação de uma lista encadeada desordenada """
class Node:
def __init__(self, value, next_node=None):
self.__value = value
self.next_node = next_node
@property
def value(self):
return self.__value
class LinkedList:
... |
ipymarkup/__init__.py | natasha/ipymarkup | 108 | 11071531 |
from .span import format_span_box_markup, show_span_box_markup # noqa
from .span import format_span_line_markup, show_span_line_markup # noqa
from .span import format_span_ascii_markup, show_span_ascii_markup # noqa
from .dep import format_dep_markup, show_dep_markup # noqa
from .dep import format_dep_ascii_marku... |
tfx/components/example_gen/utils_test.py | avelez93/tfx | 1,813 | 11071534 | # Copyright 2019 Google LLC. 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... |
NTM-One-Shot-TF/MANN/Utils/Metrics.py | dhruvramani/ContinualLearningExperiments | 265 | 11071545 | <filename>NTM-One-Shot-TF/MANN/Utils/Metrics.py<gh_stars>100-1000
import tensorflow as tf
import numpy as np
from .tf_utils import update_tensor
# prediction is the argmax
def accuracy_instance(predictions, targets, n=[1, 2, 3, 4, 5, 10], nb_classes=5, nb_samples_per_class=10, batch_size=1):
targets = tf.cast(ta... |
tests/test_utils_system.py | Muflhi01/videoflow | 1,022 | 11071550 | import pytest
import videoflow.utils.system as system
def test_gpus_available_1(monkeypatch):
monkeypatch.setenv('CUDA_VISIBLE_DEVICES', '')
gpus = system.get_gpus_available_to_process()
assert len(gpus) == 0
monkeypatch.setenv('CUDA_VISIBLE_DEVICES', '0')
gpus = system.get_gpus_available_to_proc... |
vel/rl/buffers/backend/circular_vec_buffer_backend.py | galatolofederico/vel | 273 | 11071566 | import gym
import numpy as np
from vel.exceptions import VelException
def take_along_axis(large_array, indexes):
""" Take along axis """
# Reshape indexes into the right shape
if len(large_array.shape) > len(indexes.shape):
indexes = indexes.reshape(indexes.shape + tuple([1] * (len(large_array.sh... |
tests/integration_tests/test_mxnet.py | captain-pool/optuna | 1,300 | 11071606 | from typing import Union
import mxnet as mx
import numpy as np
import pytest
import optuna
from optuna.integration.mxnet import MXNetPruningCallback
from optuna.testing.integration import DeterministicPruner
def test_mxnet_pruning_callback() -> None:
def objective(trial: optuna.trial.Trial, eval_metric: Union[l... |
powerline/segments/common/vcs.py | MrFishFinger/powerline | 11,435 | 11071612 | <reponame>MrFishFinger/powerline<filename>powerline/segments/common/vcs.py<gh_stars>1000+
# vim:fileencoding=utf-8:noet
from __future__ import (unicode_literals, division, absolute_import, print_function)
from powerline.lib.vcs import guess, tree_status
from powerline.segments import Segment, with_docstring
from power... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.