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 |
|---|---|---|---|---|
probing/utils.py | wietsedv/bertje | 104 | 70763 | import sys
import yaml
class Config:
def __init__(self, cfg=None):
self.cfg = {}
if cfg is not None:
self.update(cfg)
def __getattribute__(self, name):
cfg = object.__getattribute__(self, 'cfg')
if name not in cfg:
return object.__getattribute__(self, n... |
tests/utils/test_classproperty.py | koskotG/ebonite | 270 | 70768 | <reponame>koskotG/ebonite
from ebonite.utils.classproperty import classproperty
class MyClass:
@classproperty
def prop1(self):
return 'a'
@classproperty
@classmethod
def prop2(self):
return 'b'
def test_classproperty__get():
assert MyClass.prop1 == 'a'
assert MyClass.pro... |
neurst/data/dataset_utils.py | ishine/neurst | 208 | 70783 | # Copyright 2020 ByteDance 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 writin... |
CPAC/func_preproc/utils.py | FCP-INDI/C-PAC | 125 | 70795 |
import numpy as np
from scipy.signal import iirnotch, firwin, filtfilt, lfilter, freqz
from matplotlib import pyplot as plt
import nibabel as nb
import subprocess
import math
def add_afni_prefix(tpattern):
if tpattern:
if ".txt" in tpattern:
tpattern = "@{0}".format(tpattern)
return tpatte... |
examples/synthetic/park1_constrained/park1_constrained.py | hase1128/dragonfly | 675 | 70818 | <gh_stars>100-1000
"""
Park1 function with three domains.
-- <EMAIL>
"""
# pylint: disable=invalid-name
import numpy as np
def park1_constrained(x):
""" Computes the park1 function. """
return park1_constrained_z_x([1.0, 1.0, 1.0], x)
def park1_constrained_z_x(z, x):
""" Computes the park1 function. """
... |
example/pyctp2/trader/ports_info.py | mmmaaaggg/pyctp_lovelylain | 358 | 70835 | <filename>example/pyctp2/trader/ports_info.py
# -*- coding: utf-8 -*-
import getpass
class PortsInfo(object):
def __init__(self, name, ports, broker, investor=""):
"""
CTP连接信息,
ports为port列表, 其元素为 "tcp://aaa.bbb.ccc.ddd:ppppp"形式
MDUser不需要输入investor
"""
s... |
beta_rec/models/userKNN.py | mengzaiqiao/TVBR | 126 | 70844 | import numpy as np
import scipy.sparse as ssp
import torch
from beta_rec.models.torch_engine import ModelEngine
from beta_rec.utils.common_util import timeit
def top_k(values, k, exclude=[]):
"""Return the indices of the k items with the highest value in the list of values.
Exclude the ids from the list "ex... |
moldesign/data/chemical_components.py | Autodesk/molecular-design-toolkit | 147 | 70857 | from __future__ import print_function, absolute_import, division
from future.builtins import *
from future import standard_library
standard_library.install_aliases()
# Copyright 2017 Autodesk Inc.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with ... |
prediction_flow/pytorch/tests/test_wide_deep.py | dydcfg/prediction-flow | 211 | 70865 | <filename>prediction_flow/pytorch/tests/test_wide_deep.py
from prediction_flow.features import Number, Category, Sequence, Features
from prediction_flow.transformers.column import (
StandardScaler, CategoryEncoder, SequenceEncoder)
from prediction_flow.pytorch import WideDeep
from .utils import prepare_dataloader... |
tests/workflow.py | mullikine/chronology | 189 | 70867 | <gh_stars>100-1000
import asyncio
# TODO import __init__ above
async def logic():
# TODO add tests
pass
# main(logic)
|
dfirtrack_main/tests/task/test_task_creator_views.py | thomas-kropeit/dfirtrack | 273 | 70909 | import urllib.parse
from datetime import datetime
from unittest.mock import patch
from django.contrib.auth.models import User
from django.contrib.messages import get_messages
from django.test import TestCase
from django.utils import timezone
from dfirtrack_main.models import (
System,
Systemstatus,
Task,
... |
src/python/python-proto/python_proto/tests/strategies.py | inickles/grapl | 313 | 70944 | <filename>src/python/python-proto/python_proto/tests/strategies.py
import datetime
import uuid
from typing import Mapping, Sequence, Union
import hypothesis.strategies as st
from python_proto import SerDe
from python_proto.api import (
DecrementOnlyIntProp,
DecrementOnlyUintProp,
Edge,
EdgeList,
Gr... |
fuzzers/042-clk-bufg-config/generate.py | rw1nkler/prjxray | 583 | 70957 | <filename>fuzzers/042-clk-bufg-config/generate.py
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
#
# Copyright (C) 2017-2020 The Project X-Ray Authors.
#
# Use of this source code is governed by a ISC-style
# license that can be found in the LICENSE file or at
# https://opensource.org/licenses/ISC
#
# SPDX-License-Ide... |
espnet/nets/pytorch_backend/transformer/layer_norm.py | Syzygianinfern0/espnet | 252 | 70969 | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
# Copyright 2019 <NAME>
# Apache 2.0 (http://www.apache.org/licenses/LICENSE-2.0)
"""Layer normalization module."""
import torch
class LayerNorm(torch.nn.LayerNorm):
"""Layer normalization module.
:param int nout: output dim size
:param int dim: dimensi... |
caffe2/python/operator_test/conditional_test.py | KevinKecc/caffe2 | 585 | 70973 | # Copyright (c) 2016-present, Facebook, 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... |
packages/python/chart-studio/chart_studio/tests/test_core/test_tools/test_file_tools.py | mastermind88/plotly.py | 11,750 | 70979 | <filename>packages/python/chart-studio/chart_studio/tests/test_core/test_tools/test_file_tools.py
from chart_studio import tools
from chart_studio.tests.utils import PlotlyTestCase
import warnings
class FileToolsTest(PlotlyTestCase):
def test_set_config_file_all_entries(self):
# Check set_config and get... |
python/ray/util/dask/scheduler_utils.py | daobook/ray | 21,382 | 70994 | """
The following is adapted from Dask release 2021.03.1:
https://github.com/dask/dask/blob/2021.03.1/dask/local.py
"""
import os
from queue import Queue, Empty
from dask import config
from dask.callbacks import local_callbacks, unpack_callbacks
from dask.core import (_execute_task, flatten, get_dependencies, has... |
arybo/lib/mba_impl_petanque.py | Liblor/arybo | 223 | 71007 | # Copyright (c) 2016 <NAME> <<EMAIL>>
# Copyright (c) 2016 <NAME> <<EMAIL>>
# 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 copyright
... |
wemake_python_styleguide/visitors/ast/iterables.py | cdhiraj40/wemake-python-styleguide | 1,931 | 71025 | <reponame>cdhiraj40/wemake-python-styleguide
import ast
from typing import ClassVar
from typing_extensions import final
from wemake_python_styleguide.logic.nodes import get_parent
from wemake_python_styleguide.types import AnyNodes
from wemake_python_styleguide.violations.consistency import (
IterableUnpackingVio... |
pygeos/tests/test_linear.py | caibengbu/pygeos | 292 | 71064 | <reponame>caibengbu/pygeos
import numpy as np
import pytest
import pygeos
from pygeos.testing import assert_geometries_equal
from .common import (
empty_line_string,
empty_point,
line_string,
linear_ring,
multi_line_string,
multi_point,
multi_polygon,
point,
polygon,
)
def test_l... |
scikit-dbscan-example.py | davemarr621/dbscan_2 | 107 | 71065 | # -*- coding: utf-8 -*-
"""
This script is used to validate that my implementation of DBSCAN produces
the same results as the implementation found in scikit-learn.
It's based on the scikit-learn example code, here:
http://scikit-learn.org/stable/auto_examples/cluster/plot_dbscan.html
@author: <NAME>
"""
from sk... |
tests/gold_tests/pluginTest/cert_update/cert_update.test.py | cmcfarlen/trafficserver | 1,351 | 71071 | <reponame>cmcfarlen/trafficserver<gh_stars>1000+
'''
Test the cert_update plugin.
'''
# 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... |
vgg_model.py | daxavic/LQ-Nets | 116 | 71081 | #!/usr/bin/env python
# -*- coding: utf-8 -*-
# File: vgg_model.py
import tensorflow as tf
from tensorflow.contrib.layers import variance_scaling_initializer
from tensorpack.models import *
from tensorpack.tfutils.argscope import argscope, get_arg_scope
from learned_quantization import Conv2DQuant, getBNReLUQuant, ge... |
tests/test_manager.py | Mitul16/pwncat | 1,454 | 71093 | #!/usr/bin/env python3
import io
import pwncat.manager
def test_config_fileobj():
configuration = io.StringIO(
"""
set -g db "memory://"
set -g prefix c-k
set -g on_load { }
set -g backdoor_user "config_test"
"""
)
with pwncat.manager.Manager(config=configuration) as manager:
asser... |
src/sage/combinat/species/sum_species.py | UCD4IDS/sage | 1,742 | 71108 | <gh_stars>1000+
"""
Sum species
"""
#*****************************************************************************
# Copyright (C) 2008 <NAME> <<EMAIL>>,
#
# Distributed under the terms of the GNU General Public License (GPL)
#
# This code is distributed in the hope that it will be useful,
# but WITHOUT AN... |
tools.python3/lav_sort.py | urbanslug/lastz | 139 | 71136 | <filename>tools.python3/lav_sort.py<gh_stars>100-1000
#!/usr/bin/env python3
"""
Sort the a-stanzas in a lav file, according to the user's choice of key
-----------------------------------------------------------------------
:Author: <NAME> (<EMAIL>)
"""
import sys
validKeys = ["score","pos1","pos2","beg1","beg2","e... |
openstackclient/network/v2/address_scope.py | openstack/python-openstackclient | 262 | 71144 | # 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
# distrib... |
pex/tools/commands/digraph.py | zmanji/pex | 2,160 | 71175 | # Copyright 2020 Pants project contributors (see CONTRIBUTORS.md).
# Licensed under the Apache License, Version 2.0 (see LICENSE).
from __future__ import absolute_import
from pex.typing import TYPE_CHECKING
if TYPE_CHECKING:
from typing import Dict, IO, List, Mapping, Optional, Tuple
Value = Optional[str]
... |
models/models.py | awdxqqqaz/MoCoGAN-HD | 170 | 71185 | """
Copyright Snap Inc. 2021. This sample code is made available by Snap Inc. for informational purposes only.
No license, whether implied or otherwise, is granted in or to such code (including any rights to copy, modify,
publish, distribute and/or commercialize such code), unless you have entered into a separate agree... |
code/dx/dx_valuation.py | meaninginuse/py4fi2nd | 893 | 71192 | #
# DX Package
#
# Valuation Classes
#
# dx_valuation.py
#
# Python for Finance, 2nd ed.
# (c) Dr. <NAME>
#
import numpy as np
import pandas as pd
from dx_simulation import *
from valuation_class import valuation_class
from valuation_mcs_european import valuation_mcs_european
from valuation_mcs_american import valuati... |
gitfs/repository.py | whywaita/gitfs | 921 | 71212 | <reponame>whywaita/gitfs
# Copyright 2014-2016 Presslabs SRL
#
# 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 applicabl... |
matrixprofile/algorithms/mstomp.py | MORE-EU/matrixprofile | 262 | 71235 | # -*- coding: utf-8 -*-
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
from __future__ import unicode_literals
range = getattr(__builtins__, 'xrange', range)
# end of py2 compatability boilerplate
import logging
import numpy as np
from matrixprofile impo... |
third_party/tests/IbexGoogle/scripts/sail_log_to_trace_csv.py | parzival3/Surelog | 156 | 71236 | """
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, software
di... |
src/fauxmo/plugins/__init__.py | danielrgullo/fauxmo | 318 | 71263 | """fauxmo.plugins :: Provide ABC for Fauxmo plugins."""
import abc
from typing import Callable
class FauxmoPlugin(abc.ABC):
"""Provide ABC for Fauxmo plugins.
This will become the `plugin` attribute of a `Fauxmo` instance. Its `on`
and `off` methods will be called when Alexa turns something `on` or `off... |
marrow/mailer/exc.py | cynepiaadmin/mailer | 166 | 71289 | <filename>marrow/mailer/exc.py
# encoding: utf-8
"""Exceptions used by marrow.mailer to report common errors."""
__all__ = [
'MailException',
'MailConfigurationException',
'TransportException',
'TransportFailedException',
'MessageFailedException',
'TransportExhaustedEx... |
mmdeploy/codebase/mmdet/core/bbox/transforms.py | zhiqwang/mmdeploy | 746 | 71312 | <filename>mmdeploy/codebase/mmdet/core/bbox/transforms.py
# Copyright (c) OpenMMLab. All rights reserved.
import torch
from mmdeploy.codebase.mmdet.deploy import clip_bboxes
def distance2bbox(points, distance, max_shape=None):
"""Rewrite `mmdet.core.bbox.transforms.distance2bbox`
Decode distance prediction ... |
alpa/global_env.py | alpa-projects/alpa | 114 | 71323 | <filename>alpa/global_env.py
"""All global configurations for this project."""
import os
class GlobalConfig:
"""The global configuration of alpa."""
def __init__(self):
########## Options of device mesh ##########
self.xla_client_mem_fraction = float(
os.environ.get("XLA_PYTHON_CL... |
flaskbb/core/exceptions.py | rehee/try_discuz | 1,140 | 71343 | <reponame>rehee/try_discuz
# -*- coding: utf-8 -*-
"""
flaskbb.core.exceptions
~~~~~~~~~~~~~~~~~~~~~~~
Exceptions raised by flaskbb.core,
forms the root of all exceptions in
FlaskBB.
:copyright: (c) 2014-2018 the FlaskBB Team
:license: BSD, see LICENSE for more details
"""
class BaseFlas... |
Lib/fontmake/instantiator.py | googlei18n/fontmake | 333 | 71401 | # This code is based on ufoProcessor code, which is licensed as follows:
# Copyright (c) 2017-2018 LettError and <NAME>
# All rights reserved.
#
# 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 Softwar... |
test_raml_models.py | pcyin/pytorch_nmt | 122 | 71414 | import os
train_src="../dynet_nmt/data/train.de-en.de.wmixerprep"
train_tgt="../dynet_nmt/data/train.de-en.en.wmixerprep"
dev_src="../dynet_nmt/data/valid.de-en.de"
dev_tgt="../dynet_nmt/data/valid.de-en.en"
test_src="../dynet_nmt/data/test.de-en.de"
test_tgt="../dynet_nmt/data/test.de-en.en"
for temp in [0.5]:
j... |
tools/SDKTool/src/WrappedDeviceAPI/deviceAPI/mobileDevice/android/androidDevice.py | Passer-D/GameAISDK | 1,210 | 71417 | # -*- coding: utf-8 -*-
"""
Tencent is pleased to support the open source community by making GameAISDK available.
This source code file is licensed under the GNU General Public License Version 3.
For full details, please refer to the file "LICENSE.txt" which is provided as part of this source code package.
Copyright... |
tensorflow_estimator/python/estimator/canned/linear_optimizer/python/utils/sharded_mutable_dense_hashtable_test.py | burgerkingeater/estimator | 288 | 71424 | <reponame>burgerkingeater/estimator<gh_stars>100-1000
# 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.o... |
app/grandchallenge/profiles/migrations/0001_initial.py | kaczmarj/grand-challenge.org | 101 | 71426 | <gh_stars>100-1000
# Generated by Django 1.11.11 on 2018-03-20 18:38
import django.db.models.deletion
import django_countries.fields
import stdimage.models
from django.conf import settings
from django.db import migrations, models
import grandchallenge.core.storage
class Migration(migrations.Migration):
initial ... |
parsers/IN_PB.py | electricitymap/electricitymap-contrib | 143 | 71433 | #!/usr/bin/env python3
from collections import defaultdict
import arrow
import requests
GENERATION_URL = "https://sldcapi.pstcl.org/wsDataService.asmx/pbGenData2"
DATE_URL = "https://sldcapi.pstcl.org/wsDataService.asmx/dynamicData"
GENERATION_MAPPING = {
"totalHydro": "hydro",
"totalThermal": "coal",
"... |
sdk/agrifood/azure-agrifood-farming/azure/agrifood/farming/aio/_farm_beats_client.py | rsdoherty/azure-sdk-for-python | 2,728 | 71477 | # 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 ... |
synapse/tests/test_glob.py | ackroute/synapse | 216 | 71493 | <filename>synapse/tests/test_glob.py
import synapse.glob as s_glob
import synapse.tests.utils as s_t_utils
class GlobTest(s_t_utils.SynTest):
def test_glob_sync(self):
async def afoo():
return 42
retn = s_glob.sync(afoo())
self.eq(retn, 42)
|
build_tools/sim_object_param_struct_cc.py | hyu-iot/gem5 | 765 | 71527 | # Copyright 2021 Google, Inc.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions are
# met: redistributions of source code must retain the above copyright
# notice, this list of conditions and the following disclaimer;
# redistribu... |
packs/alertlogic/actions/scan_list_scan_executions.py | userlocalhost2000/st2contrib | 164 | 71565 | <filename>packs/alertlogic/actions/scan_list_scan_executions.py
#!/usr/bin/env python
# Licensed to the StackStorm, Inc ('StackStorm') 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 ... |
auditlog/migrations/0006_object_pk_index.py | washdrop/django-auditlog | 252 | 71593 | from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
("auditlog", "0005_logentry_additional_data_verbose_name"),
]
operations = [
migrations.AlterField(
model_name="logentry",
name="object_pk",
field=models.C... |
setup.py | qq758689805/Pocsuite-dev | 1,991 | 71607 | <reponame>qq758689805/Pocsuite-dev<gh_stars>1000+
#!/usr/bin/env python
# coding: utf-8
from setuptools import setup, find_packages
from pocsuite import (
__version__ as version, __author__ as author,
__author_email__ as author_email, __license__ as license)
setup(
name='pocsuite',
version=version,
... |
venv/Lib/site-packages/debugpy/launcher/winapi.py | ajayiagbebaku/NFL-Model | 695 | 71611 | <gh_stars>100-1000
# Copyright (c) Microsoft Corporation. All rights reserved.
# Licensed under the MIT License. See LICENSE in the project root
# for license information.
from __future__ import absolute_import, division, print_function, unicode_literals
import ctypes
from ctypes.wintypes import BOOL, DWORD, HANDLE, ... |
tests/pytests/unit/utils/test_thin.py | babs/salt | 9,425 | 71631 | <reponame>babs/salt<filename>tests/pytests/unit/utils/test_thin.py
import pytest
import salt.exceptions
import salt.utils.stringutils
import salt.utils.thin
from tests.support.mock import MagicMock, patch
def _mock_popen(return_value=None, side_effect=None, returncode=0):
proc = MagicMock()
proc.communicate =... |
WebMirror/management/rss_parser_funcs/feed_parse_extractMyFirstTimeTranslating.py | fake-name/ReadableWebProxy | 193 | 71640 | <gh_stars>100-1000
def extractMyFirstTimeTranslating(item):
"""
'My First Time Translating'
"""
vol, chp, frag, postfix = extractVolChapterFragmentPostfix(item['title'])
if not (chp or vol or frag) or 'preview' in item['title'].lower():
return None
return False
|
edb/edgeql/tokenizer.py | aaronbrighton/edgedb | 7,302 | 71646 | <gh_stars>1000+
#
# This source file is part of the EdgeDB open source project.
#
# Copyright 2016-present MagicStack Inc. and the EdgeDB 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... |
mmaction/models/heads/timesformer_head.py | rlleshi/mmaction2 | 1,870 | 71657 | # Copyright (c) OpenMMLab. All rights reserved.
import torch.nn as nn
from mmcv.cnn import trunc_normal_init
from ..builder import HEADS
from .base import BaseHead
@HEADS.register_module()
class TimeSformerHead(BaseHead):
"""Classification head for TimeSformer.
Args:
num_classes (int): Number of cla... |
certbot-apache/tests/autohsts_test.py | luisriverag/certbot | 16,789 | 71663 | # pylint: disable=too-many-lines
"""Test for certbot_apache._internal.configurator AutoHSTS functionality"""
import re
import unittest
try:
import mock
except ImportError: # pragma: no cover
from unittest import mock # type: ignore
from certbot import errors
from certbot_apache._internal import constants
impo... |
flask_dance/consumer/requests.py | kerryhatcher/flask-dance | 836 | 71667 | <filename>flask_dance/consumer/requests.py
from functools import wraps
from flask import redirect, url_for
from urlobject import URLObject
from requests_oauthlib import OAuth1Session as BaseOAuth1Session
from requests_oauthlib import OAuth2Session as BaseOAuth2Session
from oauthlib.common import to_unicode
from werkzeu... |
hardware/chip/rtl872xd/build_bin.py | wstong999/AliOS-Things | 4,538 | 71668 | <filename>hardware/chip/rtl872xd/build_bin.py
#! /usr/bin/env python
import os
import platform
import argparse
import sys
import shutil
print(sys.argv)
parser = argparse.ArgumentParser()
parser.add_argument('--target', dest='target', action='store')
args = parser.parse_args()
mypath = os.path.dirname(sys.argv[0])
os... |
src/test/pythonFiles/testFiles/specificTest/tests/test_unittest_one.py | ChaseKnowlden/vscode-jupyter | 615 | 71677 | <reponame>ChaseKnowlden/vscode-jupyter<filename>src/test/pythonFiles/testFiles/specificTest/tests/test_unittest_one.py<gh_stars>100-1000
import unittest
class Test_test_one_1(unittest.TestCase):
def test_1_1_1(self):
self.assertEqual(1,1,'Not equal')
def test_1_1_2(self):
self.assertEqual(1,2,... |
alipay/aop/api/response/AlipayEcoCityserviceUserAppinfoQueryResponse.py | antopen/alipay-sdk-python-all | 213 | 71714 | #!/usr/bin/env python
# -*- coding: utf-8 -*-
import json
from alipay.aop.api.response.AlipayResponse import AlipayResponse
class AlipayEcoCityserviceUserAppinfoQueryResponse(AlipayResponse):
def __init__(self):
super(AlipayEcoCityserviceUserAppinfoQueryResponse, self).__init__()
self._biz_type ... |
official/vision/image_classification/learning_rate.py | akshit-protonn/models | 82,518 | 71720 | <filename>official/vision/image_classification/learning_rate.py
# Copyright 2021 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://ww... |
bilm/__init__.py | nelson-liu/bilm-tf | 1,676 | 71729 |
from .data import Batcher, TokenBatcher
from .model import BidirectionalLanguageModel, dump_token_embeddings, \
dump_bilm_embeddings
from .elmo import weight_layers
|
zerver/migrations/0362_send_typing_notifications_user_setting.py | dumpmemory/zulip | 17,004 | 71730 | # Generated by Django 3.2.7 on 2021-10-03 07:09
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
("zerver", "0361_realm_create_web_public_stream_policy"),
]
operations = [
migrations.AddField(
model_name="realmuserdefault",
... |
hubspot/cms/performance/api/__init__.py | Ronfer/hubspot-api-python | 117 | 71748 | from __future__ import absolute_import
# flake8: noqa
# import apis into api package
from hubspot.cms.performance.api.public_performance_api import PublicPerformanceApi
|
ib/ext/cfg/CommissionReport.py | LewisW/IbPy | 1,260 | 71760 | #!/usr/bin/env python
# -*- coding: utf-8 -*-
""" ib.ext.cfg.CommissionReport -> config module for CommissionReport.java.
"""
|
tensorflow/contrib/util/loader.py | AlexChrisF/udacity | 522 | 71784 | <filename>tensorflow/contrib/util/loader.py<gh_stars>100-1000
# 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.... |
dbaas/logical/tests/test_database.py | didindinn/database-as-a-service | 303 | 71785 | <filename>dbaas/logical/tests/test_database.py
# -*- coding: utf-8 -*-
from __future__ import absolute_import, unicode_literals
import mock
import logging
from django.test import TestCase
from django.db import IntegrityError
from drivers import base
from maintenance.tests import factory as maintenance_factory
from phys... |
tests/chainer_tests/functions_tests/loss_tests/test_hinge.py | zaltoprofen/chainer | 3,705 | 71787 | <reponame>zaltoprofen/chainer<gh_stars>1000+
import unittest
import numpy
import six
import chainer
from chainer import backend
from chainer.backends import cuda
from chainer import functions
from chainer import gradient_check
from chainer import testing
from chainer.testing import attr
@testing.parameterize(*testi... |
odps/tunnel/tests/test_pb.py | wjsi/aliyun-odps-python-sdk | 412 | 71796 | <gh_stars>100-1000
#!/usr/bin/env python
# -*- coding: utf-8 -*-
# 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.or... |
pypugjs/convert.py | wwoods/pypugjs | 247 | 71802 | from __future__ import print_function
import codecs
import logging
import os
import sys
from optparse import OptionParser
from pypugjs.utils import process
def convert_file():
support_compilers_list = [
'django',
'jinja',
'underscore',
'mako',
'tornado',
... |
plugin.video.yatp/site-packages/hachoir_parser/game/__init__.py | mesabib/kodi.yatp | 194 | 71809 | from hachoir_parser.game.zsnes import ZSNESFile
from hachoir_parser.game.spider_man_video import SpiderManVideoFile
from hachoir_parser.game.laf import LafFile
from hachoir_parser.game.blp import BLP1File, BLP2File
from hachoir_parser.game.uasset import UAssetFile
|
train_procgen/graph_util.py | tuthoang/train-procgen | 146 | 71812 | import csv
import numpy as np
import matplotlib.pyplot as plt
import matplotlib
from math import ceil
from constants import ENV_NAMES
import seaborn # sets some style parameters automatically
COLORS = [(57, 106, 177), (218, 124, 48)]
def switch_to_outer_plot(fig):
ax0 = fig.add_subplot(111, frame_on=False)
a... |
semseg/models/ddrnet.py | Genevievekim/semantic-segmentation-1 | 196 | 71813 | import torch
from torch import nn, Tensor
from torch.nn import functional as F
class BasicBlock(nn.Module):
expansion = 1
def __init__(self, c1, c2, s=1, downsample= None, no_relu=False) -> None:
super().__init__()
self.conv1 = nn.Conv2d(c1, c2, 3, s, 1, bias=False)
self.bn1 = nn.Batch... |
nussl/datasets/hooks.py | ZhaoJY1/nussl | 259 | 71840 | """
While *nussl* does not come with any data sets, it does have the capability to interface with
many common source separation data sets used within the MIR and speech separation communities.
These data set "hooks" subclass BaseDataset and by default return AudioSignal objects in
labeled dictionaries for ease of use. ... |
libs/configs_old/DOTA/gwd/cfgs_res50_dota_v20.py | Artcs1/RotationDetection | 850 | 71861 | <filename>libs/configs_old/DOTA/gwd/cfgs_res50_dota_v20.py<gh_stars>100-1000
# -*- coding: utf-8 -*-
from __future__ import division, print_function, absolute_import
import os
import tensorflow as tf
import math
from dataloader.pretrained_weights.pretrain_zoo import PretrainModelZoo
"""
RetinaNet-H + gwd fix bug + sq... |
tqsdk/sim/trade.py | shinny-mayanqiong/tqsdk-python | 3,208 | 71869 | #!/usr/bin/env python
# -*- coding: utf-8 -*-
__author__ = 'mayanqiong'
import math
from datetime import datetime
from typing import Callable
from tqsdk.datetime import _is_in_trading_time
from tqsdk.diff import _simple_merge_diff
from tqsdk.sim.utils import _get_price_range, _get_option_margin, _get_premium, _get_c... |
chrome/common/extensions/docs/server2/appengine_wrappers.py | google-ar/chromium | 2,151 | 71883 | # Copyright (c) 2012 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 will attempt to import the actual App Engine modules, and if it fails,
# they will be replaced with fake modules. This is useful during testing.
... |
insights/tests/test_filters.py | maxamillion/insights-core | 121 | 71889 | <gh_stars>100-1000
from collections import defaultdict
from insights.core import filters
from insights.parsers.ps import PsAux, PsAuxcww
from insights.specs import Specs
from insights.specs.default import DefaultSpecs
import pytest
import sys
def setup_function(func):
if func is test_get_filter:
filters... |
crabageprediction/venv/Lib/site-packages/mpl_toolkits/axes_grid/anchored_artists.py | 13rianlucero/CrabAgePrediction | 603 | 71897 | from matplotlib.offsetbox import AnchoredOffsetbox, AuxTransformBox, VPacker,\
TextArea, AnchoredText, DrawingArea, AnnotationBbox
from mpl_toolkits.axes_grid1.anchored_artists import \
AnchoredDrawingArea, AnchoredAuxTransformBox, \
AnchoredEllipse, AnchoredSizeBar
|
python/src/nnabla/utils/converter/nnablart/save_variable_buffer.py | daniel-falk/nnabla | 2,792 | 71898 | <gh_stars>1000+
# Copyright 2018,2019,2020,2021 Sony 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 app... |
examples/explorer/explorer.py | wcastello/splunk-sdk-python | 495 | 71929 | #!/usr/bin/env python
#
# Copyright 2011-2015 Splunk, 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... |
Algo and DSA/LeetCode-Solutions-master/Python/self-crossing.py | Sourav692/FAANG-Interview-Preparation | 3,269 | 71944 | <filename>Algo and DSA/LeetCode-Solutions-master/Python/self-crossing.py
# Time: O(n)
# Space: O(1)
class Solution(object):
def isSelfCrossing(self, x):
"""
:type x: List[int]
:rtype: bool
"""
if len(x) >= 5 and x[3] == x[1] and x[4] + x[0] >= x[2]:
# Crossing i... |
pypykatz/rdp/parser.py | wisdark/pypykatz | 1,861 | 71948 | <reponame>wisdark/pypykatz
import platform
from pypykatz import logger
from minidump.minidumpfile import MinidumpFile
from pypykatz.commons.common import KatzSystemInfo
from pypykatz.rdp.packages.creds.templates import RDPCredsTemplate
from pypykatz.rdp.packages.creds.decryptor import RDPCredentialDecryptor
class RDP... |
test/python/test_rn50_infer.py | avijit-chakroborty/ngraph-bridge | 142 | 71962 | #
# -*- coding: utf-8 -*-
#
# Copyright (c) 2019-2020 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 b... |
docs/examples/plot_video.py | siahuat0727/torchio | 1,340 | 71984 | """
Transform video
===============
In this example, we use ``torchio.Resample((2, 2, 1))`` to divide the spatial
size of the clip (height and width) by two and
``RandomAffine(degrees=(0, 0, 20))`` to rotate a maximum of 20 degrees around
the time axis.
"""
import numpy as np
import matplotlib.pyplot as plt
import ma... |
attic/iterables/CACM/closed_file.py | l65775622/example-code | 5,651 | 71985 | <reponame>l65775622/example-code
"""
<NAME>. 2014. The curse of the excluded middle.
Commun. ACM 57, 6 (June 2014), 50-55. DOI=10.1145/2605176
http://doi.acm.org/10.1145/2605176
"""
with open('citation.txt', encoding='ascii') as fp:
get_contents = lambda: fp.read()
print(get_contents())
|
ffn/training/model.py | pgunn/ffn | 266 | 72024 | # Copyright 2017 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
#
# https://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing,... |
build_tools/setup_helpers/extension.py | pmeier/text | 3,172 | 72063 | <reponame>pmeier/text
import os
import platform
import subprocess
from pathlib import Path
from torch.utils.cpp_extension import (
CppExtension,
BuildExtension as TorchBuildExtension
)
__all__ = [
'get_ext_modules',
'BuildExtension',
]
_ROOT_DIR = Path(__file__).parent.parent.parent.resolve()
_CSRC_D... |
note_seq/chord_inference_test.py | tetromino/note-seq | 113 | 72067 | # Copyright 2021 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 ... |
data_providers/utils.py | nammbash/vision_networks | 299 | 72070 | from .cifar import Cifar10DataProvider, Cifar100DataProvider, \
Cifar10AugmentedDataProvider, Cifar100AugmentedDataProvider
from .svhn import SVHNDataProvider
def get_data_provider_by_name(name, train_params):
"""Return required data provider class"""
if name == 'C10':
return Cifar10DataProvider(*... |
tools/grit/grit/format/gen_predetermined_ids.py | zealoussnow/chromium | 14,668 | 72108 | <reponame>zealoussnow/chromium
#!/usr/bin/env python3
# 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.
"""
A tool to generate a predetermined resource ids file that can be used as an
input to grit via the -... |
dev/scripts/clear_testing.py | rubik-ai/koku | 157 | 72140 | #
# Copyright 2021 Red Hat Inc.
# SPDX-License-Identifier: Apache-2.0
#
"""Clear out our local testing directories."""
import argparse
import os
import shutil
TESTING_DIRS = [
"local_providers/aws_local",
"local_providers/aws_local_0",
"local_providers/aws_local_1",
"local_providers/aws_local_2",
"... |
moose/tshark_to_raw.py | H1d3r/malware-research | 322 | 72142 | #!/usr/bin/env python3
#
# Code related to ESET's Linux/Moose research
# For feedback or questions contact us at: <EMAIL>
# https://github.com/eset/malware-research/
#
# This code is provided to the community under the two-clause BSD license as
# follows:
#
# Copyright (C) 2015 ESET
# All rights reserved.
#
# Redistrib... |
django/account/models.py | acid-chicken/tweet-generator | 141 | 72157 | <reponame>acid-chicken/tweet-generator
from django.db import models
from django.contrib.auth.models import AbstractBaseUser, PermissionsMixin, UserManager
from django.contrib.auth.hashers import make_password
from django.utils import timezone
from django.utils.translation import gettext_lazy as _
class CustomUserManag... |
tests/test_motd.py | Varriount/sanic | 1,883 | 72160 | import logging
import platform
from unittest.mock import Mock
from sanic import __version__
from sanic.application.logo import BASE_LOGO
from sanic.application.motd import MOTDTTY
def test_logo_base(app, run_startup):
logs = run_startup(app)
assert logs[0][1] == logging.DEBUG
assert logs[0][2] == BASE_... |
jupytext/cell_metadata.py | st--/jupytext | 5,378 | 72184 | """
Convert between text notebook metadata and jupyter cell metadata.
Standard cell metadata are documented here:
See also https://ipython.org/ipython-doc/3/notebook/nbformat.html#cell-metadata
"""
import ast
import re
from json import dumps, loads
try:
from json import JSONDecodeError
except ImportError:
JS... |
asciimol/app/renderer.py | whitead/asciiMol | 284 | 72192 | import numpy as np
class Renderer:
def __init__(self, height, width, config):
self.height = height
self.width = width
self.content = None
self.zbuffer = None
self.m = None
self.f = 1.0
self.resize(height, width)
self.colors = config.colors
s... |
tensorflow_toolkit/image_retrieval/image_retrieval/dataset.py | morkovka1337/openvino_training_extensions | 256 | 72199 | """
Copyright (c) 2019 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 in wri... |
tests/test_basics.py | roguextech/OpenRocket-pyjnius | 908 | 72215 | <reponame>roguextech/OpenRocket-pyjnius
from __future__ import print_function
from __future__ import division
from __future__ import absolute_import
import sys
import unittest
from jnius.reflect import autoclass
try:
long
except NameError:
# Python 3
long = int
def py2_encode(uni):
if sys.version_info... |
rpc/RPyC/tutorials/services/registry_discovery/service01.py | 2581676612/python | 112 | 72267 | #!/usr/bin/env python
# -*- coding: utf-8 -*-
# @Time : 17-8-15 下午1:35
# @Author : Tom.Lee
# @CopyRight : 2016-2017 OpenBridge by yihecloud
# @File : service.py
# @Product : PyCharm
# @Docs :
# @Source :
import rpyc
from rpyc.utils.server import ThreadedServe... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.