max_stars_repo_path string | max_stars_repo_name string | max_stars_count int64 | id string | content string | add_param_types int64 | add_return_types int64 | add_class_field_types int64 | add_instance_field_types int64 | add_total int64 | add_error int64 |
|---|---|---|---|---|---|---|---|---|---|---|
will/storage/redis_storage.py | Ashex/will | 349 | 1623164 | from will.utils import warn
from will.backends.storage.redis_backend import RedisStorage
warn(
"""Deprecation - will.storage.redis_storage has been moved to will.backends.storage.redis_backend,
and will be removed in version 2.2. Please update your paths accordingly!"""
)
| 0 | 0 | 0 | 0 | 0 | 0 |
examples/01-filter/sampling_functions_3d.py | stefsmeets/pyvista | 1,107 | 1623169 | <filename>examples/01-filter/sampling_functions_3d.py
"""
Sample Function: Perlin Noise in 3D
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Here we use :func:`pyvista.core.imaging.sample_function` to sample
Perlin noise over a region to generate random terrain.
Video games like Minecraft use Perlin noise to create terrain. Her... | 0 | 0 | 0 | 0 | 0 | 0 |
meshpy/tools/test_stable_pose.py | peter0749/PointNetGPD | 193 | 1623173 | <filename>meshpy/tools/test_stable_pose.py
"""
Regressive test for stable poses. Qualitative only.
Author: <NAME>
"""
import IPython
import numpy as np
import os
import random
import sys
from autolab_core import Point, RigidTransform
from meshpy import ObjFile, Mesh3D
from visualization import Visualizer3D as vis
if ... | 0 | 0 | 0 | 0 | 0 | 0 |
pytorch_tools/models/vgg.py | bonlime/pytorch-tools | 155 | 1623191 | <filename>pytorch_tools/models/vgg.py
import logging
from copy import deepcopy
from functools import wraps, partial
import torch
import torch.nn as nn
from torch.hub import load_state_dict_from_url
from pytorch_tools.modules import BlurPool
from pytorch_tools.modules import bn_from_name
from pytorch_tools.utils.misc i... | 0 | 0 | 0 | 0 | 0 | 0 |
sdk/cognitiveservices/azure-cognitiveservices-search-entitysearch/azure/cognitiveservices/search/entitysearch/models/_models.py | rsdoherty/azure-sdk-for-python | 2,728 | 1623211 | # 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 ... | 0 | 0 | 94 | 100 | 194 | 0 |
nameko/extensions.py | vlcinsky/nameko | 3,425 | 1623220 | from __future__ import absolute_import
import inspect
import types
import warnings
import weakref
from functools import partial
from logging import getLogger
from eventlet.event import Event
from nameko.exceptions import IncorrectSignature
_log = getLogger(__name__)
ENTRYPOINT_EXTENSIONS_ATTR = 'nameko_entrypoin... | 0 | 0 | 0 | 0 | 0 | 1 |
members/admin.py | dinagon/djangoproject.com | 1,440 | 1623246 | <gh_stars>1000+
from datetime import date, timedelta
from django.contrib import admin
from django.templatetags.static import static
from django.utils.formats import localize
from django.utils.html import format_html
from members.models import CorporateMember, IndividualMember, Invoice, Team
@admin.register(Individu... | 0 | 0 | 0 | 0 | 0 | 0 |
ranking/management/modules/bestcoder.py | aropan/clist | 166 | 1623263 | <filename>ranking/management/modules/bestcoder.py
#!/usr/bin/env python
# -*- coding: utf-8 -*-
import collections
import json
import re
from concurrent.futures import ThreadPoolExecutor as PoolExecutor
from urllib.parse import urljoin
import tqdm
from ratelimiter import RateLimiter
from ranking.management.modules i... | 0 | 0 | 0 | 0 | 0 | 0 |
tests/strings/split.py | MoonStarCZW/py2rb | 124 | 1623318 |
s="the quick brown fox jumped over the lazy dog"
t = s.split(" ")
for v in t:
print(v)
r = s.split("e")
for v in r:
print(v)
x = s.split()
for v in x:
print(v)
# 2-arg version of split not supported
# y = s.split(" ",7)
# for v in y:
# print v
| 0 | 0 | 0 | 0 | 0 | 0 |
mac/pyobjc-core/PyObjCTest/test_nsdate_proxy.py | albertz/music-player | 132 | 1623334 | <reponame>albertz/music-player
from PyObjCTools.TestSupport import *
from PyObjCTest.fnd import NSDateFormatter, NSArray, NSDate
import datetime
class TestNSDateProxy (TestCase):
# Test for proxied datetime.date and datetime.datetime objects,
# these have a custom proxy class.
def testFormattingForDate(se... | 0 | 0 | 0 | 0 | 0 | 0 |
scale/trigger/configuration/exceptions.py | kaydoh/scale | 121 | 1623409 | """Defines exceptions that can occur when interacting with trigger rules"""
class InvalidTriggerRule(Exception):
"""Exception indicating that the provided trigger rule configuration was invalid
"""
pass
class InvalidTriggerType(Exception):
"""Exception indicating that the provided trigger rule type... | 0 | 0 | 0 | 0 | 0 | 0 |
demo/Ginzburg_Landau.py | spectralDNS/shenfun | 138 | 1623425 | r"""
Solve Ginzburg-Landau equation on (-50, 50)x(-50, 50) with periodic bcs
u_t = div(grad(u)) + u - (1+1.5i)*u*|u|**2 (1)
Use Fourier basis V and find u in VxV such that
(v, u_t) = (v, div(grad(u))+ u) - (v, (1+1.5i)*u*|u|**2) for all v in VxV
"""
from sympy import symbols, exp
import matplotl... | 0 | 2 | 0 | 0 | 2 | 0 |
third_party/stdlib/unittest_util.py | wangwansan/grumpy | 11,252 | 1623435 | <filename>third_party/stdlib/unittest_util.py
"""Various utility functions."""
# from collections import namedtuple, OrderedDict
import operator
_itemgetter = operator.itemgetter
_property = property
_tuple = tuple
__unittest = True
_MAX_LENGTH = 80
def safe_repr(obj, short=False):
try:
result = repr(obj... | 0 | 0 | 0 | 0 | 0 | 0 |
troposphere/networkmanager.py | pierretr/troposphere | 4,573 | 1623456 | # Copyright (c) 2020, <NAME> <<EMAIL>>
# All rights reserved.
#
# See LICENSE file for full license.
from . import AWSObject, AWSProperty, Tags
class TransitGatewayRegistration(AWSObject):
resource_type: str = "AWS::NetworkManager::TransitGatewayRegistration"
props: dict[str,tuple[object, bool]] = {
... | 0 | 0 | 16 | 0 | 16 | 0 |
maintenance/templates/getattribute.py | JFlynnXYZ/pymel | 287 | 1623467 | <gh_stars>100-1000
def __getattribute__(self, name):
if name in {{ method.removeAttrs }} and name not in _f.EXCLUDE_METHODS: # tmp fix
raise AttributeError("'{{ classname }}' object has no attribute '" + name + "'")
return super({{ classname }}, self).__getattribute__(name) | 0 | 0 | 0 | 0 | 0 | 0 |
tormysql/util.py | snower/TorMySQL | 340 | 1623473 | <gh_stars>100-1000
# -*- coding: utf-8 -*-
# 14-8-8
# create by: snower
import sys
import greenlet
from . import platform
if sys.version_info[0] >= 3:
py3 = True
text_type = str
else:
py3 = False
text_type = unicode
def async_call_method(fun, *args, **kwargs):
future = platform.Future()
ioloo... | 0 | 0 | 0 | 0 | 0 | 0 |
ding/utils/tests/test_time_helper.py | sailxjx/DI-engine | 464 | 1623497 | import pytest
import numpy as np
import time
from ding.utils.time_helper import build_time_helper, WatchDog, TimeWrapperTime, EasyTimer
@pytest.mark.unittest
class TestTimeHelper:
def test_naive(self) -> object:
class NaiveObject(object):
pass
cfg = NaiveObject()
setattr(cfg... | 0 | 3 | 0 | 0 | 3 | 0 |
test/integration_test/tools/lib/ofp/ofp_get_async_request.py | ryoon/lagopus | 281 | 1623514 | <reponame>ryoon/lagopus
import os
import sys
import copy
import logging
from checker import *
from .ofp import register_ofp_creators
from .ofp import OfpBase
# YAML:
# get_async_request:
SCE_GET_ASYNC_REQUEST = "get_async_request"
@register_ofp_creators(SCE_GET_ASYNC_REQUEST)
class OfpGetAsyncRequestCreator(OfpBase... | 0 | 0 | 0 | 0 | 0 | 0 |
django/contrib/gis/db/backends/oracle/adapter.py | ni-ning/django | 61,676 | 1623517 | from cx_Oracle import CLOB
from django.contrib.gis.db.backends.base.adapter import WKTAdapter
from django.contrib.gis.geos import GeometryCollection, Polygon
class OracleSpatialAdapter(WKTAdapter):
input_size = CLOB
def __init__(self, geom):
"""
Oracle requires that polygon rings are in prop... | 1 | 3 | 0 | 0 | 4 | 0 |
dm_pix/_src/depth_and_space.py | SupreethRao99/dm_pix | 219 | 1623522 | # Copyright 2020 DeepMind Technologies Limited. 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 ... | 4 | 2 | 0 | 0 | 6 | 0 |
scoreboard/validators/per_team.py | outdex/ctfscoreboard | 181 | 1623535 | # Copyright 2017 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 ag... | 0 | 2 | 3 | 0 | 5 | 0 |
ykdl/extractors/sina/video.py | 592767809/ykdl | 136 | 1623553 | # -*- coding: utf-8 -*-
from .._common import *
def get_realurl(url, vid) -> object:
resp = get_response(url, params={'vid': vid})
if resp.locations:
return resp.url
else:
return matchall(resp, 'CDATA\[([^\]]+)')[1]
class Sina(Extractor):
name: str = '新浪视频 (sina)'
def prepare(sel... | 0 | 3 | 1 | 0 | 4 | 0 |
image_classification/CaiT/cait.py | haribhutanadhu/PaddleViT | 993 | 1623588 | <gh_stars>100-1000
# Copyright (c) 2021 PPViT 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 requi... | 0 | 0 | 0 | 0 | 0 | 0 |
src/probnum/filtsmooth/particle/__init__.py | fxbriol/probnum | 226 | 1623591 | """Particle filtering and smoothing."""
from ._importance_distributions import (
BootstrapImportanceDistribution,
ImportanceDistribution,
LinearizationImportanceDistribution,
)
from ._particle_filter import ParticleFilter, effective_number_of_events
from ._particle_filter_posterior import ParticleFilterPos... | 0 | 0 | 0 | 0 | 0 | 0 |
kolibri/core/device/test/test_device_settings.py | MBKayro/kolibri | 545 | 1623614 | from django.core.exceptions import ValidationError
from django.test import TestCase
from kolibri.core.device.models import DeviceSettings
from kolibri.core.utils.cache import process_cache as cache
class DeviceSettingsTestCase(TestCase):
def test_singleton(self):
cache.clear()
DeviceSettings.obje... | 0 | 0 | 0 | 0 | 0 | 0 |
cortex/built_ins/datasets/utils.py | tsirif/cortex | 109 | 1623628 | from __future__ import annotations
"""
Extra functions for build-in datasets
"""
import torchvision.transforms as transforms
def build_transforms(normalize: bool=True, center_crop: object | None=None, image_size: object | None=None,
random_crop: object | None=None, flip: object | None=None, rand... | 8 | 1 | 0 | 0 | 9 | 0 |
maigret/report.py | noi4eg/maigret | 1,156 | 1623649 | from __future__ import annotations
import ast
import csv
import io
import json
import logging
import os
from datetime import datetime
from typing import Dict, Any
import xmind
from dateutil.parser import parse as parse_datetime_str
from jinja2 import Template
from .checking import SUPPORTED_IDS
from .result import Qu... | 26 | 7 | 5 | 0 | 38 | 0 |
examples/obj_func_demo.py | koralturkk/scikit-opt | 3,178 | 1623667 | <reponame>koralturkk/scikit-opt
import numpy as np
def sphere(p):
# Sphere函数
out_put = 0
for i in p:
out_put += i ** 2
return out_put
def schaffer(p):
'''
这个函数是二维的复杂函数,具有无数个极小值点
在(0,0)处取的最值0
这个函数具有强烈的震荡形态,所以很难找到全局最优质值
:param p:
:return:
'''
x1, x2 = p
x = ... | 0 | 0 | 0 | 0 | 0 | 0 |
tests/framework/AnalyticModels/optimizing/townsendConstrained.py | FlanFlanagan/raven | 159 | 1623670 | # Copyright 2017 Battelle Energy Alliance, 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 t... | 0 | 3 | 0 | 0 | 3 | 0 |
core/feed.py | GDATAAdvancedAnalytics/yeti | 1,250 | 1623683 | <reponame>GDATAAdvancedAnalytics/yeti
from __future__ import unicode_literals
import json
import logging
import os
import tempfile
import xml.etree.ElementTree as ET
from base64 import b64decode
from datetime import datetime
from io import StringIO, BytesIO
from zipfile import ZipFile
import pandas as pd
import pytz
... | 0 | 0 | 0 | 0 | 0 | 0 |
L1TriggerConfig/RPCTriggerConfig/test/dumpL1RPCHsbConfig.py | ckamtsikis/cmssw | 852 | 1623684 | import FWCore.ParameterSet.Config as cms
process = cms.Process("dump")
process.load("L1TriggerConfig.RPCTriggerConfig.L1RPCHsbConfig_cff")
process.l1RPCHsbConfig.hsb0Mask=cms.vint32(0, 1, 2, 3, 0, 1, 2, 3)
process.l1RPCHsbConfig.hsb1Mask=cms.vint32(1, 2, 3, 0, 1, 2, 3, 0)
#useGlobalTag = 'IDEAL_31X'
#process.load('C... | 0 | 0 | 0 | 0 | 0 | 0 |
libs/gluon2TF/resnet/test_resnet.py | lj-ecjtu/Cascade_FPN_Tensorflow-master | 224 | 1623692 | <filename>libs/gluon2TF/resnet/test_resnet.py
# -*- coding: utf-8 -*-
from __future__ import absolute_import, division, print_function
import tensorflow as tf
import tensorflow.contrib.slim as slim
from mxnet import nd, image
import numpy as np
from mxnet.gluon.data.vision import transforms
from gluoncv.model_zoo im... | 0 | 0 | 0 | 0 | 0 | 0 |
var/spack/repos/builtin/packages/shengbte/package.py | kkauder/spack | 2,360 | 1623693 | <gh_stars>1000+
# 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)
from spack import *
class Shengbte(MakefilePackage):
"""ShengBTE is a software package for solving th... | 0 | 0 | 0 | 0 | 0 | 0 |
tests/pytests/unit/states/test_boto_s3_bucket.py | tomdoherty/salt | 9,425 | 1623705 | <filename>tests/pytests/unit/states/test_boto_s3_bucket.py<gh_stars>1000+
import logging
import random
import string
from copy import deepcopy
import pytest
import salt.loader
import salt.states.boto_s3_bucket as boto_s3_bucket
from tests.support.mock import MagicMock, patch
boto = pytest.importorskip("boto")
boto3 =... | 0 | 0 | 0 | 0 | 0 | 0 |
nails/nail.py | srivatsansoft/Virtual-Makeup | 105 | 1623715 | from scipy import interpolate
from pylab import *
from skimage import color
Rg, Gg, Bg = (207., 40., 57.)
texture_input = 'texture1.jpg'
def get_boundary_points(x, y) -> tuple[object, object]:
tck, u = interpolate.splprep([x, y], s=0, per=1)
unew = np.linspace(u.min(), u.max(), 1000)
xnew, ynew = interp... | 0 | 2 | 0 | 0 | 2 | 0 |
neo/test/iotest/test_spikeglxio.py | Mario-Kart-Felix/python-neo | 199 | 1623716 | <gh_stars>100-1000
"""
Tests of neo.io.spikeglxio
"""
import unittest
from neo.io import SpikeGLXIO
from neo.test.iotest.common_io_test import BaseTestIO
class TestSpikeGLXIO(BaseTestIO, unittest.TestCase):
ioclass = SpikeGLXIO
entities_to_download = [
'spikeglx'
]
entities_to_test = [
... | 0 | 0 | 0 | 0 | 0 | 0 |
insights/combiners/logrotate_conf.py | maxamillion/insights-core | 121 | 1623727 | from __future__ import annotations
"""
LogrotateConfAll - Combiner for logrotate configuration
=======================================================
Combiner for accessing all the logrotate configuration files. It collects all
LogrotateConf generated from each single logrotate configuration file.
There may be multi... | 3 | 12 | 0 | 4 | 19 | 0 |
src/python/txtai/api/routers/textractor.py | rakeshcarpediem/txtai | 1,893 | 1623768 | """
Defines API paths for textractor endpoints.
"""
from typing import List
from fastapi import APIRouter, Body
from .. import application
router = APIRouter()
@router.get("/textract")
def textract(file: str) -> object:
"""
Extracts text from a file at path.
Args:
file: file to extract text
... | 2 | 2 | 0 | 0 | 4 | 0 |
cli/rfid_cli.py | charlysan/rfid-usb-reader-reversing | 113 | 1623771 | # Copyright (c) 2018 charlysan
# 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... | 0 | 19 | 4 | 0 | 23 | 0 |
testing/test_static.py | Erotemic/doctest2 | 142 | 1623778 | <reponame>Erotemic/doctest2
# -*- coding: utf-8 -*-
from __future__ import print_function, division, absolute_import, unicode_literals
from xdoctest import static_analysis as static
from xdoctest import utils
def test_module_docstr():
source = utils.codeblock(
'''
# comment
"""
mod... | 0 | 0 | 0 | 0 | 0 | 0 |
cellrank/logging/_logging.py | WeilerP/cellrank | 172 | 1623788 | """Logging module."""
from typing import Optional
import logging
from logging import INFO, DEBUG, ERROR, WARNING, CRITICAL
from datetime import datetime, timezone, timedelta
from functools import partial, update_wrapper
HINT = (INFO + DEBUG) // 2
logging.addLevelName(HINT, "HINT")
class _RootLogger(logging.RootLog... | 0 | 0 | 0 | 0 | 0 | 1 |
docs/source/conf.py | vishalbelsare/flashlight | 2,858 | 1623795 | # -*- coding: utf-8 -*-
import os
import subprocess
import sphinx_rtd_theme
read_the_docs_build = os.environ.get('READTHEDOCS', None) == 'True'
if read_the_docs_build:
subprocess.call('cd ..; doxygen', shell=True)
# -- Project information -----------------------------------------------------
project = 'flashli... | 0 | 0 | 0 | 0 | 0 | 0 |
tests/components/threshold/test_binary_sensor.py | MrDelik/core | 30,023 | 1623808 | """The test for the threshold sensor platform."""
from homeassistant.const import (
ATTR_UNIT_OF_MEASUREMENT,
STATE_UNAVAILABLE,
STATE_UNKNOWN,
TEMP_CELSIUS,
)
from homeassistant.setup import async_setup_component
async def test_sensor_upper(hass):
"""Test if source is above threshold."""
con... | 0 | 0 | 0 | 0 | 0 | 0 |
lixian_commands/add.py | deadblue/xunlei-lixian | 722 | 1623826 |
from lixian_commands.util import *
from lixian_cli_parser import *
from lixian_config import get_config
import lixian_help
import lixian_query
@command_line_parser(help=lixian_help.add)
@with_parser(parse_login)
@with_parser(parse_colors)
@with_parser(parse_logging)
@with_parser(parse_size)
@command_line_value('limit... | 0 | 0 | 0 | 0 | 0 | 0 |
demo/tgpisa/tgpisa/model.py | bakaat/xhtml2pdf | 1,016 | 1623829 | from turbogears.database import PackageHub
# import some basic SQLObject classes for declaring the data model
# (see http://www.sqlobject.org/SQLObject.html#declaring-the-class)
from sqlobject import SQLObject, SQLObjectNotFound, RelatedJoin
# import some datatypes for table columns from SQLObject
# (see http://www.sql... | 0 | 0 | 0 | 0 | 0 | 0 |
etl/parsers/etw/Microsoft_Windows_SEC.py | IMULMUL/etl-parser | 104 | 1623912 | <reponame>IMULMUL/etl-parser
# -*- coding: utf-8 -*-
"""
Microsoft-Windows-SEC
GUID : 16c6501a-ff2d-46ea-868d-8f96cb0cb52d
"""
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.dty... | 0 | 0 | 0 | 0 | 0 | 0 |
tools/interop_matrix/client_matrix.py | txl0591/grpc | 117 | 1623927 | #!/usr/bin/env python2.7
# Copyright 2017 gRPC authors.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable la... | 0 | 1 | 0 | 0 | 1 | 0 |
artman/pipelines/gapic_generation.py | Katee/artman | 147 | 1623934 | <gh_stars>100-1000
# Copyright 2016 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 appl... | 0 | 0 | 0 | 0 | 0 | 0 |
tests/test_resources.py | vishalbelsare/voila-gridstack | 181 | 1623941 | <filename>tests/test_resources.py
import os
import pytest
from lxml import etree
BASE_DIR = os.path.dirname(__file__)
@pytest.fixture(params=[False, True], ids="show_handles={}".format)
def show_handles(request):
return request.param
@pytest.fixture
def voila_resources(show_handles):
return {"gridstack": {"... | 0 | 0 | 0 | 0 | 0 | 0 |
xirl/debug_dataset.py | xxdreck/google-research | 23,901 | 1623956 | # coding=utf-8
# Copyright 2021 The Google Research Authors.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicab... | 0 | 0 | 0 | 0 | 0 | 0 |
fbpic/utils/cuda.py | wilds9/fbpic | 131 | 1623967 | # Copyright 2016, FBPIC contributors
# Authors: <NAME>, <NAME>
# License: 3-Clause-BSD-LBNL
from __future__ import annotations
"""
This file is part of the Fourier-Bessel Particle-In-Cell code (FB-PIC)
It defines a set of generic functions that operate on a GPU.
"""
import warnings
import numba
numba_version = (int(num... | 3 | 8 | 0 | 2 | 13 | 0 |
generate_results.py | laughtervv/SGPN | 257 | 1623981 | import argparse
import tensorflow as tf
import json
import numpy as np
import os
os.environ["CUDA_DEVICE_ORDER"]="PCI_BUS_ID" # see issue #152
import sys
from scipy import stats
import time
import h5py
import matplotlib.pyplot as plt
BASE_DIR = os.path.dirname(os.path.abspath(__file__))
sys.path.append(BASE_DIR)
sys... | 0 | 0 | 0 | 0 | 0 | 0 |
spinoffs/oryx/oryx/core/interpreters/inverse/rules.py | PavanKishore21/probability | 3,670 | 1623984 | # Copyright 2020 The TensorFlow Probability 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 o... | 0 | 19 | 0 | 0 | 19 | 0 |
tools/accuracy_checker/accuracy_checker/representation/pose_estimation_3d_representation.py | APrigarina/open_model_zoo | 1,031 | 1624006 | from __future__ import annotations
"""
Copyright (c) 2018-2021 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... | 19 | 2 | 0 | 0 | 21 | 0 |
content-security-policy/support/resource.py | meyerweb/wpt | 14,668 | 1624011 | def main(request, response) -> tuple[object, bytes]:
headers = []
headers.append((b"Access-Control-Allow-Origin", b"*"))
return headers, b"{ \"result\": \"success\" }"
| 0 | 1 | 0 | 0 | 1 | 0 |
tempest/tests/lib/services/compute/test_interfaces_client.py | mail2nsrajesh/tempest | 254 | 1624019 | <reponame>mail2nsrajesh/tempest<gh_stars>100-1000
# Copyright 2015 NEC Corporation. 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.apach... | 0 | 0 | 0 | 0 | 0 | 0 |
hubblestack/utils/url.py | buddwm/hubble | 363 | 1624042 | <reponame>buddwm/hubble
# -*- coding: utf-8 -*-
'''
URL utils
'''
import re
from urllib.parse import urlparse, urlunparse # pylint: disable=import-error,no-name-in-module
import hubblestack.utils.path
import hubblestack.utils.platform
def parse(url):
'''
Parse a salt:// URL; return the path and a possible ... | 0 | 0 | 0 | 0 | 0 | 0 |
cloudbaseinit/utils/windows/network.py | jstopinsek/bsd-cloudinit | 160 | 1624043 | <reponame>jstopinsek/bsd-cloudinit
# Copyright 2014 Cloudbase Solutions 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
#
#... | 0 | 0 | 0 | 0 | 0 | 0 |
src/test/test_mod_wmts_wrapper.py | nasa-gibs/onearth | 131 | 1624066 | #!/usr/bin/env python3
# Copyright (c) 2002-2017, California Institute of Technology.
# All rights reserved. Based on Government Sponsored Research under contracts NAS7-1407 and/or NAS7-03001.
#
# Redistribution and use in source and binary forms, with or without modification, are permitted provided that the followin... | 0 | 0 | 0 | 0 | 0 | 0 |
tests/functional/regressions/test_issue372.py | mazzi/tartiflette | 530 | 1624124 | <filename>tests/functional/regressions/test_issue372.py
import pytest
from tartiflette import create_engine
from tartiflette.types.exceptions.tartiflette import GraphQLSchemaError
@pytest.mark.asyncio
@pytest.mark.parametrize(
"sdl,should_except,match",
[
(
"""interface MediaMetadata {
... | 0 | 0 | 0 | 0 | 0 | 0 |
examples/link_prediction.py | THUMNLab/AutoGL | 824 | 1624128 | import sys
sys.path.append("../")
from autogl.datasets import build_dataset_from_name
from autogl.solver.classifier.link_predictor import AutoLinkPredictor
from autogl.module.train.evaluation import Auc
import yaml
import random
import torch
import numpy as np
if __name__ == "__main__":
from argparse import Argu... | 0 | 0 | 0 | 0 | 0 | 0 |
atlas/testing/acceptance/test_syncable_directory.py | DeepLearnI/atlas | 296 | 1624130 |
from foundations_spec import *
import foundations
from acceptance.mixins.run_local_job import RunLocalJob
class TestSyncableDirectory(Spec, RunLocalJob):
@set_up
def set_up(self):
from acceptance.cleanup import cleanup
cleanup()
def run_job(self):
self._run_job_file('acceptan... | 0 | 10 | 0 | 0 | 10 | 0 |
linguist/tests/models.py | Dj-Denis/django-linguist | 137 | 1624136 | <reponame>Dj-Denis/django-linguist
from django.db import models
from linguist.models.base import Translation
from linguist.metaclasses import ModelMeta as LinguistMeta
from linguist.mixins import ManagerMixin as LinguistManagerMixin
# Managers
# -----------------------------------------------------------------------... | 0 | 0 | 0 | 0 | 0 | 0 |
mayan/apps/storage/exceptions.py | nattangwiwat/Mayan-EDMS-recitation | 343 | 1624170 | <filename>mayan/apps/storage/exceptions.py
class CompressionFileError(Exception):
"""
Base exception for file decompression class
"""
class NoMIMETypeMatch(CompressionFileError):
"""
There is no decompressor registered for the specified MIME type
"""
| 0 | 0 | 0 | 0 | 0 | 0 |
open_seq2seq/optimizers/novograd.py | gioannides/OpenSeq2Seq | 1,459 | 1624191 | # Copyright (c) 2019 NVIDIA Corporation
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to i... | 10 | 1 | 0 | 1 | 12 | 0 |
algorithm/binary_search.py | ganeshskudva/Algorithm_Templates | 190 | 1624200 | # binary search requires sorted iterator. Common variation is find left-most or right-most index.
#
# Time: O(log(n))
# Space: O(1)
# [lo, hi] version
def binary_search(arr, target):
lo, hi = 0, len(arr) - 1
while lo <= hi:
# no overflow problem in python, (lo + hi) // 2 is better.
# mid = lo... | 0 | 1 | 0 | 0 | 1 | 0 |
test/functional/test_framework/ripemd160.py | apokalyzr/bitcoin | 65,371 | 1624208 | <filename>test/functional/test_framework/ripemd160.py
# Copyright (c) 2021 <NAME>
# Distributed under the MIT software license, see the accompanying
# file COPYING or http://www.opensource.org/licenses/mit-license.php.
"""Test-only pure Python RIPEMD160 implementation."""
import unittest
# Message schedule indexes fo... | 0 | 0 | 0 | 0 | 0 | 0 |
basketball_reference_web_scraper/errors.py | tttgm/basketball_reference_web_scraper | 325 | 1624288 | <filename>basketball_reference_web_scraper/errors.py
class InvalidDate(Exception):
def __init__(self, day, month, year):
message = "Date with year set to {year}, month set to {month}, and day set to {day} is invalid"\
.format(
year=year,
month=month,
... | 0 | 0 | 0 | 0 | 0 | 0 |
skl2onnx/algebra/__init__.py | xiaowuhu/sklearn-onnx | 323 | 1624300 | <reponame>xiaowuhu/sklearn-onnx<filename>skl2onnx/algebra/__init__.py
# SPDX-License-Identifier: Apache-2.0
from .onnx_operator import OnnxOperator # noqa
| 0 | 0 | 0 | 0 | 0 | 0 |
omnizart/cli/chord/train_model.py | nicolasanjoran/omnizart | 1,145 | 1624306 | <gh_stars>1000+
import click
from omnizart.cli import silence_tensorflow
from omnizart.cli.common_options import add_common_options, COMMON_TRAIN_MODEL_OPTIONS
from omnizart.setting_loaders import ChordSettings
from omnizart.utils import LazyLoader
chord = LazyLoader("chord", globals(), "omnizart.chord")
@click.co... | 0 | 0 | 0 | 0 | 0 | 0 |
examples/third_party/repositories.bzl | ahmedsajid/rules_foreign_cc | 521 | 1624313 | """A centralized module defining all repositories required for third party examples of rules_foreign_cc"""
load("@bazel_tools//tools/build_defs/repo:http.bzl", "http_archive")
load("@bazel_tools//tools/build_defs/repo:utils.bzl", "maybe")
load("//apr:apr_repositories.bzl", "apr_repositories")
load("//apr_util:apr_util... | 0 | 0 | 0 | 0 | 0 | 0 |
jmetal/algorithm/multiobjective/ibea.py | renansantosmendes/PhD_jMetalPy_2020_02 | 335 | 1624314 | <reponame>renansantosmendes/PhD_jMetalPy_2020_02<gh_stars>100-1000
from typing import TypeVar, List
import numpy as np
from jmetal.algorithm.singleobjective.genetic_algorithm import GeneticAlgorithm
from jmetal.config import store
from jmetal.core.operator import Mutation, Crossover
from jmetal.core.problem import Pr... | 0 | 0 | 0 | 0 | 0 | 0 |
python/liblas/core.py | marisn/libLAS | 212 | 1624316 | """
/******************************************************************************
* $Id$
*
* Project: libLAS - http://liblas.org - A BSD library for LAS format data.
* Purpose: Python ctypes function calls
* Author: <NAME>, <EMAIL>
*
*************************************************************************... | 0 | 7 | 0 | 0 | 7 | 0 |
aws-python-rest-api-with-faunadb/todos/create.py | AzarguNazari/Examples | 10,320 | 1624332 | import json
import logging
from todos.makeresult import make_result
from todos import client, TODOS
from faunadb import query
def create(event, context) -> object:
data = json.loads(event['body'])
if 'text' not in data:
logging.error("Validation Failed")
raise Exception("Couldn't create the t... | 0 | 1 | 0 | 0 | 1 | 0 |
pandapower/test/opf/test_pandamodels_installation.py | SimonRubenDrauz/pandapower | 104 | 1624348 | # Copyright (c) 2016-2021 by University of Kassel and Fraunhofer Institute for Energy Economics
# and Energy System Technology (IEE), Kassel. All rights reserved.
import pytest
try:
from julia.core import UnsupportedPythonError
except ImportError:
UnsupportedPythonError = Exception
try:
from jul... | 0 | 0 | 0 | 0 | 0 | 0 |
python/shopping/content/accounttax/get.py | akgarchi/googleads-shopping-samples | 149 | 1624350 | <reponame>akgarchi/googleads-shopping-samples<gh_stars>100-1000
#!/usr/bin/python
#
# Copyright 2016 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
#
# ... | 0 | 0 | 0 | 0 | 0 | 0 |
python/test.py | awesome-archive/machine-learning | 2,104 | 1624379 | # Associate youtube video
# https://www.youtube.com/watch?v=0Keq3E2bbeE
# https://www.youtube.com/watch?v=hKuw-8Gjwjo
import unittest
def my_contains(elem, lst) -> object:
"""Returns True if and only if the element is in the list"""
return elem in lst
def my_first(lst) -> object:
"""Returns the first element in th... | 0 | 3 | 0 | 0 | 3 | 0 |
pubnub/models/consumer/signal.py | panchiwalashivani/python | 146 | 1624388 | class PNSignalResult(object):
def __init__(self, result):
"""
Representation of signal server response
:param result: result of signal operation
"""
self.timetoken = result[2]
self._result = result
def __str__(self) -> object:
return "Signal success with... | 0 | 1 | 0 | 0 | 1 | 0 |
rlcard/models/uno_rule_models.py | randombenj/rlcard | 1,735 | 1624394 | <filename>rlcard/models/uno_rule_models.py
''' UNO rule models
'''
import numpy as np
import rlcard
from rlcard.models.model import Model
class UNORuleAgentV1(object):
''' UNO Rule agent version 1
'''
def __init__(self):
self.use_raw = True
def step(self, state):
''' Predict the act... | 0 | 0 | 0 | 0 | 0 | 0 |
tensorflow_gan/python/features/random_tensor_pool_test.py | nivedwho/gan | 783 | 1624408 | <filename>tensorflow_gan/python/features/random_tensor_pool_test.py
# coding=utf-8
# Copyright 2021 The TensorFlow GAN 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://... | 0 | 0 | 0 | 0 | 0 | 0 |
tests/tensor_base/test_astype.py | kw-0/MyGrad | 147 | 1624439 | import hypothesis.extra.numpy as hnp
import hypothesis.strategies as st
import numpy as np
import pytest
from hypothesis import given, settings
from numpy.testing import assert_array_equal
from mygrad import Tensor
from tests.custom_strategies import tensors, valid_constant_arg
real_types = (
hnp.integer_dtypes()... | 5 | 0 | 0 | 0 | 5 | 0 |
src/costmanagement/azext_costmanagement/tests/latest/test_costmanagement_scenario.py | ravithanneeru/azure-cli-extensions | 207 | 1624445 | <filename>src/costmanagement/azext_costmanagement/tests/latest/test_costmanagement_scenario.py
# --------------------------------------------------------------------------
# Copyright (c) Microsoft Corporation. All rights reserved.
# Licensed under the MIT License. See License.txt in the project root for
# license i... | 0 | 0 | 0 | 0 | 0 | 0 |
openelex/tasks/load_metadata.py | Mpopoma/oe-core | 156 | 1624460 | from __future__ import annotations
from __future__ import print_function
import os
from csv import DictReader
import click
from openelex import models
from openelex import COUNTRY_DIR
FIXTURE_DIR = os.path.join(COUNTRY_DIR, 'fixtures')
COLLECTIONS = ['office', 'party',]
UPSERT_FIELDS = {
'party': ('abbrev',),
... | 4 | 2 | 0 | 0 | 6 | 0 |
extra_tests/snippets/3.1.3.4.py | mainsail-org/RustPython | 11,058 | 1624499 | l = [1,2,3]
assert [1,2,3,4,5] == (l + [4,5])
| 0 | 0 | 0 | 0 | 0 | 0 |
tests/components/sonos/test_statistics.py | MrDelik/core | 30,023 | 1624505 | """Tests for the Sonos statistics."""
from homeassistant.components.sonos.const import DATA_SONOS
async def test_statistics_duplicate(
hass, async_autosetup_sonos, soco, device_properties_event
):
"""Test Sonos statistics."""
speaker = list(hass.data[DATA_SONOS].discovered.values())[0]
subscription =... | 0 | 0 | 0 | 0 | 0 | 0 |
tests/handlers/test_visualizations.py | zero1number/redash | 20,680 | 1624546 | <gh_stars>1000+
from tests import BaseTestCase
from redash import models
class VisualizationResourceTest(BaseTestCase):
def test_create_visualization(self):
query = self.factory.create_query()
models.db.session.commit()
data = {
"query_id": query.id,
"name": "Chart... | 0 | 0 | 0 | 0 | 0 | 0 |
Captcha/Words.py | humantech/PyCAPTCHA | 285 | 1624563 | <reponame>humantech/PyCAPTCHA
""" Captcha.Words
Utilities for managing word lists and finding random words
"""
#
# PyCAPTCHA Package
# Copyright (C) 2004 <NAME> <<EMAIL>>
#
import random, os
import File
class WordList(object):
"""A class representing a word list read from disk lazily.
Blank lines and com... | 0 | 0 | 0 | 0 | 0 | 0 |
symfit/__init__.py | pckroon/symfit | 192 | 1624568 | <filename>symfit/__init__.py
# SPDX-FileCopyrightText: 2014-2020 <NAME>
#
# SPDX-License-Identifier: MIT
from symfit.api import *
import pkg_resources
try:
__version__ = pkg_resources.get_distribution('symfit').version
except pkg_resources.DistributionNotFound:
__version__ = ''
| 0 | 0 | 0 | 0 | 0 | 0 |
modules/plexpy.py | scambra/HTPC-Manager | 422 | 1624578 | <filename>modules/plexpy.py
# plexpy
from functools import partial
import json
import logging
from urllib import urlencode
import requests
import cherrypy
import htpc
from htpc.helpers import get_image, striphttp, fix_basepath
from cherrypy.lib.auth2 import require, member_of
log = logging.getLogger('modules.plexpy'... | 0 | 0 | 0 | 0 | 0 | 0 |
src/meltano/api/controllers/embeds.py | siilats/meltano | 122 | 1624646 | from flask import jsonify, request
from meltano.api.api_blueprint import APIBlueprint
from meltano.api.models import db
from meltano.api.security import block_if_api_auth_required
from .embeds_helper import EmbedsHelper, InvalidEmbedToken
embedsBP = APIBlueprint("embeds", __name__, require_authentication=False)
@em... | 0 | 3 | 0 | 0 | 3 | 0 |
data/file_dataset.py | yangapku/OFA | 367 | 1624656 | # Copyright 2022 The OFA-Sys Team.
# All rights reserved.
# This source code is licensed under the Apache 2.0 license
# found in the LICENSE file in the root directory.
from __future__ import annotations
import os
import torch
import pickle
class FileDataset:
def __init__(self, file_path, selected_col_ids: obj... | 5 | 4 | 0 | 4 | 13 | 0 |
pandas/tests/series/test_validate.py | LauraCollard/pandas | 1,738 | 1624658 | <filename>pandas/tests/series/test_validate.py
import pytest
class TestSeriesValidate:
"""Tests for error handling related to data types of method arguments."""
@pytest.mark.parametrize(
"func",
["reset_index", "_set_name", "sort_values", "sort_index", "rename", "dropna"],
)
@pytest.m... | 0 | 0 | 0 | 0 | 0 | 0 |
lib/cherrypy/cherrypy/tutorial/bonus-sqlobject.py | MiCHiLU/google_appengine_sdk | 790 | 1624676 | from __future__ import annotations
'''
Bonus Tutorial: Using SQLObject
This is a silly little contacts manager application intended to
demonstrate how to use SQLObject from within a CherryPy2 project. It
also shows how to use inline Cheetah templates.
SQLObject is an Object/Relational Mapper that allows you to access... | 2 | 5 | 0 | 0 | 7 | 0 |
Mathematics/GCD/python/gcd.py | iabhimanyu/Algorithms | 715 | 1624696 | # Calculate the gcd using the euclidean algorithm
# Accepts either 2 numbers, or 1 list
# By using a list, the gcd of multiple numbers can be calculated
def gcd(a,b = None):
if b != None:
if a % b == 0:
return b
else:
return gcd( b, a % b)
else:
for i in range(len... | 0 | 0 | 0 | 0 | 0 | 0 |
appengine/standard/firebase/firetactoe/firetactoe.py | yshalabi/python-docs-samples | 5,938 | 1624699 | # Copyright 2016 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... | 2 | 11 | 0 | 0 | 13 | 0 |
src/models/tresnet_v2/tresnet_v2.py | mrT23/TResNet | 283 | 1624706 | from __future__ import annotations
import math
from collections import OrderedDict
from functools import partial
import torch.nn as nn
import torch
from torch.nn import Module as Module
from src.models.tresnet.layers.anti_aliasing import AntiAliasDownsampleLayer
from .layers.avg_pool import FastGlobalAvgPoo... | 22 | 10 | 2 | 1 | 35 | 0 |
lldb/test/API/lang/cpp/class_types/TestClassTypes.py | mkinsner/llvm | 2,338 | 1624722 | <reponame>mkinsner/llvm
"""Test breakpoint on a class constructor; and variable list the this object."""
import os
import lldb
from lldbsuite.test.decorators import *
from lldbsuite.test.lldbtest import *
from lldbsuite.test import lldbutil
class ClassTypesTestCase(TestBase):
mydir = TestBase.compute_mydir(__... | 0 | 0 | 0 | 0 | 0 | 0 |
Packs/DBotTruthBombs/Integrations/DBotTruthBombs/DBotTruthBombs.py | diCagri/content | 799 | 1624726 | <reponame>diCagri/content
import random
import traceback
import demistomock as demisto # noqa: F401
import urllib3
from CommonServerPython import * # noqa: F401
# Disable insecure warnings
urllib3.disable_warnings()
BASE_URL = 'https://api.chucknorris.io'
CATEGORIES = ['career', 'dev', 'history', 'money', 'movie... | 0 | 0 | 0 | 0 | 0 | 0 |
tests/test_ogm.py | brucetony/pyorient | 142 | 1624761 | <filename>tests/test_ogm.py
import sys
import unittest
import decimal
import os.path
from datetime import datetime
from pyorient import PyOrientCommandException, PyOrientSQLParsingException
from pyorient.ogm import Graph, Config
from pyorient.groovy import GroovyScripts
from pyorient.ogm.declarative import declarativ... | 0 | 0 | 0 | 0 | 0 | 0 |
vulnscan/API/TargetOption.py | imfiver/Sec-Tools | 144 | 1624768 | #!/usr/bin/env python
# -*- coding: utf-8 -*-
from __future__ import annotations
from .Base import Base
import requests
import json
class TargetOption(Base):
def __init__(self, api_base_url, api_key):
super().__init__(api_base_url, api_key)
self.excluded_hours_dict: dict[str,str] = {
... | 7 | 9 | 0 | 1 | 17 | 0 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.