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 |
|---|---|---|---|---|
examples/pybullet/gym/pybullet_envs/minitaur/envs_v2/utilities/env_utils_v2.py | felipeek/bullet3 | 9,136 | 12630668 | <reponame>felipeek/bullet3
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
def get_robot_base_position(robot):
"""Gets the base position of robot."""
# TODO(b/151975607): Clean this after robot interface migration.
if hasattr(robot, "GetBasePosition"... |
crabageprediction/venv/Lib/site-packages/fontTools/merge/options.py | 13rianlucero/CrabAgePrediction | 2,705 | 12630676 | # Copyright 2013 Google, Inc. All Rights Reserved.
#
# Google Author(s): <NAME>, <NAME>
class Options(object):
class UnknownOptionError(Exception):
pass
def __init__(self, **kwargs):
self.verbose = False
self.timing = False
self.drop_tables = []
self.set(**kwargs)
def set(self, **kwargs):
for k,v ... |
android/art/tools/common/common.py | Solotov/deoptfuscator | 206 | 12630761 | #!/usr/bin/env python3.4
#
# Copyright (C) 2016 The Android Open Source Project
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless req... |
auth0/v3/test/authentication/test_users.py | akmjenkins/auth0-python | 340 | 12630798 | <filename>auth0/v3/test/authentication/test_users.py
import unittest
import mock
from ...authentication.users import Users
class TestUsers(unittest.TestCase):
@mock.patch('auth0.v3.authentication.users.Users.get')
def test_userinfo(self, mock_get):
u = Users('my.domain.com')
u.userinfo(acce... |
utils/weibo.py | haygcao/UnicomDailyTask | 148 | 12630825 | <filename>utils/weibo.py
# -*- coding: utf8 -*-
import base64
import json
from utils.toutiao_sdk import md5
from Crypto.Cipher import PKCS1_v1_5
from Crypto.PublicKey.RSA import importKey
# from Crypto.Random import get_random_bytes
def getCheckToken(userId, deviceId):
if not userId:
deviceId = deviceId... |
gpytorch/lazy/kronecker_product_lazy_tensor.py | jrg365/gpytorch | 188 | 12630827 | <filename>gpytorch/lazy/kronecker_product_lazy_tensor.py
#!/usr/bin/env python3
import operator
from functools import reduce
from typing import Optional, Tuple
import torch
from torch import Tensor
from .. import settings
from ..utils.broadcasting import _matmul_broadcast_shape, _mul_broadcast_shape
from ..utils.mem... |
libraries/botbuilder-ai/tests/luis/luis_recognizer_v3_test.py | Fl4v/botbuilder-python | 388 | 12630839 | # Copyright (c) Microsoft Corporation. All rights reserved.
# Licensed under the MIT License.
# pylint: disable=no-value-for-parameter
import json
from os import path
from typing import Dict, Tuple, Union
import re
from unittest import mock
from unittest.mock import MagicMock
from aioresponses import aioresponses
fr... |
train_word2vec_model.py | DiceTechJobs/ConceptualSearch | 265 | 12630843 | import time
from gensim.models.word2vec import Word2Vec
from Utils.string_utils import clean_str
from Utils.file_utils import find_files
from analysis_pipeline import analyze, debug_analyze
from analysis_pipeline import build_synonym_filter, fact_case_sensitive_stop_word_filter, fact_stop_word_filter
from analysis_pipe... |
inactiveusers.py | conradwee/telegram-analysis | 104 | 12630866 | #!/usr/bin/env python3
"""
A quick hack of a program to find a rough percentage of users in a chat who have sent less than 3 messages.
Warning: written at 1AM
"""
import argparse
from json import loads
from os import path
from collections import defaultdict
def main():
"""
main function
"""
#cutoff fo... |
tests/test_faucet.py | c1x1x00xxPentium/poseidon | 251 | 12630871 | # -*- coding: utf-8 -*-
"""
Test module for faucet.
@author: <NAME>
"""
import os
import shutil
import tempfile
from faucetconfgetsetter import FaucetLocalConfGetSetter
from poseidon_core.controllers.faucet.faucet import FaucetProxy
from poseidon_core.helpers.config import Config
from poseidon_core.helpers.config impo... |
alipay/aop/api/domain/CategoryRequireInfo.py | antopen/alipay-sdk-python-all | 213 | 12630883 | <gh_stars>100-1000
#!/usr/bin/env python
# -*- coding: utf-8 -*-
import json
from alipay.aop.api.constant.ParamConstants import *
class CategoryRequireInfo(object):
def __init__(self):
self._business_licence_required = None
self._category_code = None
self._category_name = None
se... |
src/pykka/_proxy.py | jodal/pykka | 796 | 12630902 | <filename>src/pykka/_proxy.py
import logging
from collections.abc import Callable
from typing import NamedTuple
from pykka import ActorDeadError, messages
__all__ = ["ActorProxy"]
logger = logging.getLogger("pykka")
class AttrInfo(NamedTuple):
callable: bool
traversable: bool
class ActorProxy:
"""
... |
dbaas/system/migrations/0003_auto__add_celeryhealthcheck.py | didindinn/database-as-a-service | 303 | 12630917 | # -*- coding: utf-8 -*-
import datetime
from south.db import db
from south.v2 import SchemaMigration
from django.db import models
class Migration(SchemaMigration):
def forwards(self, orm):
# Adding model 'CeleryHealthCheck'
db.create_table(u'system_celeryhealthcheck', (
(u'id', self.g... |
zippy/benchmarks/src/benchmarks/sympy/sympy/physics/optics/waves.py | lucapele/pele-c | 319 | 12630935 | <filename>zippy/benchmarks/src/benchmarks/sympy/sympy/physics/optics/waves.py
"""
This module has all the classes and functions related to waves in optics.
**Contains**
* TWave
"""
from __future__ import print_function, division
__all__ = ['TWave']
from sympy import sympify, pi, cos, sqrt, simplify, Symbol, S
from... |
nemo/collections/nlp/modules/common/huggingface/huggingface_encoder.py | madhukarkm/NeMo | 4,145 | 12630944 | <gh_stars>1000+
# Copyright (c) 2021, NVIDIA 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.apache.org/licenses/LICENSE-2.0
#
# Unless r... |
release/stubs/clr.py | htlcnn/ironpython-stubs | 182 | 12630974 | <gh_stars>100-1000
# encoding: utf-8
# module clr
# from (built-in)
# by generator 1.145
"""
Python module. Stores classes, functions, and data. Usually a module
is created by importing a file or package from disk. But a module can also
be directly created by calling the module type ... |
torchtoolbox/objects/__init__.py | deeplearningforfun/torch-tools | 353 | 12630997 | from .bbox import *
|
ask-sdk-local-debug/tests/unit/test_serializer.py | nikhilym/alexa-skills-kit-sdk-for-python | 496 | 12631053 | # -*- coding: utf-8 -*-
#
# Copyright 2020 Amazon.com, Inc. or its affiliates. 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.
# A copy of the License is located at
#
# http://aws.amazon.com/apache2.0/
#
# or i... |
Python/CompareTriplets/main.py | cs-mshah/AlgoCode | 151 | 12631060 | # Autor: <NAME>(TrebolDan)
#Reading input lines
a=input().split()
b=input().split()
# score[0] to A & score[1] to B
score = [0,0]
# Comparing triplets
for i in range (3):
if(a[i]!=b[i]): # If equals, neither one gets a point
if(a[i]>b[i]):
score[0]=score[0]+1 # A bigger than B
else:... |
venv/lib/python3.8/site-packages/oauth2/test/__init__.py | wjone005/Netflix_Tinder | 120 | 12631076 | <reponame>wjone005/Netflix_Tinder
import sys
# Enables unit tests to work under Python 2.6
# Code copied from
# https://github.com/facebook/tornado/blob/master/tornado/test/util.py
if sys.version_info >= (2, 7):
import unittest
else:
import unittest2 as unittest
|
muddery/server/quests/quest_status/not_accomplished.py | dongwudanci/muddery | 127 | 12631082 | <gh_stars>100-1000
"""
Quest status.
"""
from muddery.server.quests.base_quest_status import BaseQuestStatus
from muddery.server.utils.localized_strings_handler import _
class NotAccomplished(BaseQuestStatus):
"""
The quest's objectives are not accomplished.
"""
key = "NOT_ACCOMPLISHED"
name = _(... |
cx_Freeze/samples/relimport/pkg1/pkg2/sub5.py | lexa/cx_Freeze | 358 | 12631083 | <reponame>lexa/cx_Freeze
print("importing pkg1.pkg2.sub5")
|
src/main/python/ecir2019_axiomatic/run_batch.py | kasys-lab/anserini | 626 | 12631088 | # -*- coding: utf-8 -*-
#
# Anserini: A toolkit for reproducible information retrieval research built on Lucene
#
# 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/licen... |
src/arcrest/enrichment/__init__.py | Esri/ArcREST | 208 | 12631094 | <reponame>Esri/ArcREST<filename>src/arcrest/enrichment/__init__.py
"""
The GeoEnrichment service provides the ability to get facts about a
location or area. Using GeoEnrichment, you can get information about the
people, places, and businesses in a specific area or within a certain
distance or drive time... |
cords/utils/data/datasets/SSL/augmentation/augmentation_pool.py | krishnatejakk/AUTOMATA | 185 | 12631120 | import random
import torch
import torch.nn.functional as F
import numpy as np
from PIL import ImageOps, ImageEnhance, ImageFilter, Image
"""
For PIL.Image
"""
def autocontrast(x, *args, **kwargs):
return ImageOps.autocontrast(x.convert("RGB")).convert("RGBA")
def brightness(x, level, magnitude=10, max_level=1... |
liminal/core/config/config.py | ZionCervello/incubator-liminal | 107 | 12631122 | #
# Licensed to the Apache Software Foundation (ASF) under one
# or more contributor license agreements. See the NOTICE file
# distributed with this work for additional information
# regarding copyright ownership. The ASF licenses this file
# to you under the Apache License, Version 2.0 (the
# "License"); you may not... |
src/deutschland/bundesanzeiger/model.py | andreasbossard/deutschland | 445 | 12631183 | <gh_stars>100-1000
import numpy as np
import tensorflow.keras.backend as K
from PIL import Image
from tensorflow import keras
def load_image_arr(fp):
image = Image.open(fp).convert("L")
image = np.array(image)
image = image / 255 * 2
image = image - 1
return image
def character_indexes_to_str(ch... |
startup_scripts/320_services.py | systempal/netbox-docker | 691 | 12631212 | import sys
from dcim.models import Device
from ipam.models import Service
from startup_script_utils import load_yaml
from virtualization.models import VirtualMachine
services = load_yaml("/opt/netbox/initializers/services.yml")
if services is None:
sys.exit()
optional_assocs = {
"device": (Device, "name"),
... |
k8s_handle/k8s/diff.py | jetbrains-infra/k8s-handle | 152 | 12631219 | import sys
import logging
import copy
from difflib import ndiff
from datetime import datetime
from functools import reduce
import operator
import yaml
from .adapters import Adapter
from k8s_handle.templating import get_template_contexts
log = logging.getLogger(__name__)
IGNORE_FIELDS = [
'metadata.annotations:kube... |
test/python/classical_function_compiler/bad_examples.py | Roshan-Thomas/qiskit-terra | 1,599 | 12631264 | <reponame>Roshan-Thomas/qiskit-terra
# This code is part of Qiskit.
#
# (C) Copyright IBM 2020.
#
# This code is licensed under the Apache License, Version 2.0. You may
# obtain a copy of this license in the LICENSE.txt file in the root directory
# of this source tree or at http://www.apache.org/licenses/LICENSE-2.0.
#... |
tests/parser/test_base.py | adaamz/datamodel-code-generator | 891 | 12631305 | <filename>tests/parser/test_base.py<gh_stars>100-1000
from collections import OrderedDict
from typing import Dict, List, Tuple
import pytest
from datamodel_code_generator.model import DataModel, DataModelFieldBase
from datamodel_code_generator.model.pydantic import BaseModel, DataModelField
from datamodel_code_genera... |
scrapy-redis/tests/test_package_import.py | GongkunJiang/MySpider | 3,305 | 12631315 | import scrapy_redis
def test_package_metadata():
assert scrapy_redis.__author__
assert scrapy_redis.__email__
assert scrapy_redis.__version__
|
nodemcu_uploader/validate.py | bazooka07/nodemcu-uploader | 324 | 12631333 | <filename>nodemcu_uploader/validate.py
from .exceptions import ValidationException
MAX_FS_NAME_LEN = 31
def remotePath(path):
"""Do various checks on the remote file name like max length.
Raises exception if not valid
"""
if len(path) > MAX_FS_NAME_LEN:
raise ValidationException('To long. >{0... |
tests/perf/test_long_cycles_nbrows_cycle_length_41000_140.py | shaido987/pyaf | 377 | 12631382 | import tests.perf.test_cycles_full_long_long as gen
gen.test_nbrows_cycle(41000 , 140)
|
var/spack/repos/builtin/packages/py-fenics-ffc/package.py | LiamBindle/spack | 2,360 | 12631402 | # 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 PyFenicsFfc(PythonPackage):
"""The FEniCS Form Compiler FFC is a compiler for finite eleme... |
src/discriminator/train.py | Ravi-0809/question-generation | 212 | 12631425 | import sys,json,math
sys.path.insert(0, "/Users/tom/Dropbox/msc-ml/project/src/")
sys.path.insert(0, "/cs/student/msc/ml/2017/thosking/dev/msc-project/src/")
sys.path.insert(0, "/home/thosking/msc-project/src/")
import tensorflow as tf
import numpy as np
from instance import DiscriminatorInstance
import helpers.load... |
code/draw_detail_3D.py | huangyangyu/Noise-Tolerant-Paradigm-for-Training-Face-Recognition-CNNs | 149 | 12631440 | <gh_stars>100-1000
#!/usr/bin/env python
#coding: utf-8
from mpl_toolkits.mplot3d import Axes3D
import os
import sys
import cv2
import math
import json
import numpy as np
import matplotlib
from matplotlib import ticker
import matplotlib.pyplot as plt
plt.switch_backend("agg")
bins = 201
def choose_iter(_iter, inter... |
deeppavlov/models/doc_retrieval/tfidf_ranker.py | xbodx/DeepPavlov | 5,893 | 12631444 | <gh_stars>1000+
# Copyright 2017 Neural Networks and Deep Learning lab, MIPT
#
# 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 requ... |
tabular/tests/unittests/features/generators/test_rename.py | zhiqiangdon/autogluon | 4,462 | 12631454 | <reponame>zhiqiangdon/autogluon
from autogluon.features.generators import RenameFeatureGenerator
def test_rename(generator_helper, data_helper):
# Given
input_data = data_helper.generate_multi_feature_full()
generator = RenameFeatureGenerator(name_prefix='pre_', name_suffix='_suf')
expected_feature... |
pytest-shutil/tests/integration/test_cmdline_integration.py | RaiVaibhav/pytest-plugins | 282 | 12631459 | <filename>pytest-shutil/tests/integration/test_cmdline_integration.py
import os
from pytest_shutil import cmdline
def test_chdir():
here = os.getcwd()
bindir = os.path.realpath('/bin')
with cmdline.chdir(bindir):
assert os.getcwd() == bindir
assert os.getcwd() == here
def test_chdir_goes_aw... |
supersuit/utils/agent_indicator.py | PettingZoo-Team/SuperSu | 237 | 12631462 | <filename>supersuit/utils/agent_indicator.py
import re
import numpy as np
from gym.spaces import Box, Discrete
import warnings
def change_obs_space(space, num_indicators):
if isinstance(space, Box):
ndims = len(space.shape)
if ndims == 1:
pad_space = np.ones((num_indicators,), dtype=sp... |
src/azure-cli-core/azure/cli/core/tests/test_help_loaders.py | YuanyuanNi/azure-cli | 3,287 | 12631489 | <reponame>YuanyuanNi/azure-cli
# --------------------------------------------------------------------------------------------
# Copyright (c) Microsoft Corporation. All rights reserved.
# Licensed under the MIT License. See License.txt in the project root for license information.
# -------------------------------------... |
docs/video_moviepy.py | dariober/ASCIIGenome | 195 | 12631502 | <reponame>dariober/ASCIIGenome
#!/usr/bin/env ipython
from moviepy.editor import *
from moviepy import editor
from moviepy.video.tools.subtitles import SubtitlesClip
import os
# ---------------------- 8< ----------------------------------------------------
def annotate(clip, txt, txt_color= 'grey20', fontsize=50, fo... |
tests/test_vmtkScripts/test_vmtkcenterlinegeometry.py | michelebucelli/vmtk | 217 | 12631512 | <reponame>michelebucelli/vmtk
## Program: VMTK
## Language: Python
## Date: January 10, 2018
## Version: 1.4
## Copyright (c) <NAME>, <NAME>, All rights reserved.
## See LICENSE file for details.
## This software is distributed WITHOUT ANY WARRANTY; without even
## the implied warranty of MERCHA... |
tests/test_matrices.py | spectralDNS/shenfun | 138 | 12631514 | <reponame>spectralDNS/shenfun
from copy import copy, deepcopy
import functools
from itertools import product
import numpy as np
import sympy as sp
from scipy.sparse.linalg import spsolve
from mpi4py import MPI
import pytest
import mpi4py_fft
import shenfun
from shenfun.chebyshev import matrices as cmatrices
from shenfu... |
doc/examples/scripts/sequence/homolog_msa.py | danijoo/biotite | 208 | 12631515 | """
Multiple sequence alignment of Cas9 homologs
============================================
This script searches for proteins homologous to Cas9 from
*Streptococcus pyogenes* via NCBI BLAST and performs a multiple
sequence alignment of the hit sequences afterwards, using MUSCLE.
"""
# Code source: <NAME>
# License:... |
demo/mpi-ref-v1/ex-2.34.py | gmdzy2010/mpi4py | 533 | 12631534 | ## mpiexec -n 2 python ex-2.34.py
# Use of ready-mode and synchonous-mode
# --------------------------------------------------------------------
from mpi4py import MPI
try:
import numpy
except ImportError:
raise SystemExit
if MPI.COMM_WORLD.Get_size() < 2:
raise SystemExit
# ---------------------------... |
wa/workloads/androbench/__init__.py | robF8/workload-automation | 159 | 12631538 | <filename>wa/workloads/androbench/__init__.py
# Copyright 2014-2018 ARM Limited
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unles... |
aliyun-python-sdk-bssopenapi/aliyunsdkbssopenapi/request/v20171214/QueryEvaluateListRequest.py | leafcoder/aliyun-openapi-python-sdk | 1,001 | 12631541 | # Licensed to the Apache Software Foundation (ASF) under one
# or more contributor license agreements. See the NOTICE file
# distributed with this work for additional information
# regarding copyright ownership. The ASF licenses this file
# to you under the Apache License, Version 2.0 (the
# "License"); you may not u... |
4-Collections and Iterators/collections_and_iterators.py | medav/Data-Structure-Zoo | 305 | 12631549 | <reponame>medav/Data-Structure-Zoo
""" Collections
<NAME> 2015
"""
class SinglyLinkedList(object):
__next__ = next # For Python 3.X compatibility
def __init__(self):
self.head = None
self.size = 0
self.cursor = None
def __len__(self):
return self.size
def __iter_... |
nncf/torch/dynamic_graph/trace_functions.py | MaximProshin/nncf | 136 | 12631551 | <gh_stars>100-1000
"""
Copyright (c) 2022 Intel Corporation
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or ... |
qcodes/tests/dataset/test_concurrent_datasets.py | riju-pal/QCoDeS_riju | 223 | 12631559 | """
Test that multiple datasets can coexist as expected
"""
import pytest
from qcodes import new_experiment
from qcodes.dataset.data_set import DataSet
def test_foreground_after_background_raises(empty_temp_db_connection):
new_experiment("test", "test1", conn=empty_temp_db_connection)
ds1 = DataSet(conn=empt... |
mp_sort/virtenv/lib/python3.6/site-packages/transcrypt/modules/logging/handlers.py | ang-jason/fip_powerx_mini_projects-foxtrot | 2,200 | 12631567 | <gh_stars>1000+
# Copyright 2001-2016 by <NAME>. All Rights Reserved.
#
# Permission to use, copy, modify, and distribute this software and its
# documentation for any purpose and without fee is hereby granted,
# provided that the above copyright notice appear in all copies and that
# both that copyright notice an... |
tests/test_packages/test_contracts/test_erc1155/test_contract.py | bryanchriswhite/agents-aea | 126 | 12631588 | # -*- coding: utf-8 -*-
# ------------------------------------------------------------------------------
#
# Copyright 2018-2020 Fetch.AI Limited
#
# 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 ... |
boards/admin.py | EndermanOfCoding/django-beginners-guide | 1,106 | 12631597 | <filename>boards/admin.py
from django.contrib import admin
from .models import Board
admin.site.register(Board)
|
nose2/tests/functional/support/scenario/pretty_asserts/ignore_passing/test_prettyassert_ignore_passing.py | deeplow/nose2 | 637 | 12631623 | <reponame>deeplow/nose2
import unittest
class TestFailAssert(unittest.TestCase):
def test_failing_assert(self):
x = True
y = False
# fmt: off
# flake8: noqa
assert x; assert y
# fmt: on
def test_failing_assert2(self):
p = 1
q = 0
assert ... |
bits_wilp/primeFactorization.py | deepak5998/Py | 726 | 12631638 | <gh_stars>100-1000
from math import sqrt
def get_prime_factors(num):
factors = []
# get all the 2's
while num % 2 == 0:
factors.append(2)
num = num / 2
# check for other prime factors
# sqrt is used to reduce the range by log(n)
# step size of 2 to avoid checking with even numbers
for i in ra... |
vnpy/amqp/test06_rpc_client.py | howyu88/vnpy2 | 323 | 12631644 | <reponame>howyu88/vnpy2
# encoding: UTF-8
from uuid import uuid1
import json
import random
from vnpy.amqp.producer import rpc_client
def cb_function(*args):
print('resp call back')
for arg in args:
print(u'{}'.format(arg))
if __name__ == '__main__':
import time
c = rpc_client(host='localho... |
minemeld/ft/test.py | zul126/minemeld-core | 147 | 12631669 | from __future__ import absolute_import
import logging
import gevent
from . import base
from .utils import utc_millisec
import netaddr
LOG = logging.getLogger(__name__)
class TestMiner(base.BaseFT):
def __init__(self, name, chassis, config):
super(TestMiner, self).__init__(name, chassis, config)
... |
mindmeld/active_learning/results_manager.py | ritvikshrivastava/mindmeld | 580 | 12631679 | # -*- coding: utf-8 -*-
#
# Copyright (c) 2015 Cisco Systems, Inc. and others. 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... |
chainer/functions/normalization/decorrelated_batch_normalization.py | zjzh/chainer | 3,705 | 12631743 | import numpy
from chainer import backend
from chainer import function_node
from chainer.utils import argument
from chainer.utils import type_check
# {numpy: True, cupy: False}
_xp_supports_batch_eigh = {}
# routines for batched matrices
def _eigh(a, xp):
if xp not in _xp_supports_batch_eigh:
try:
... |
examples/undocumented/python/transfer_multitask_leastsquares_regression.py | gf712/shogun | 2,753 | 12631779 | #!/usr/bin/env python
from numpy import array
from numpy.random import seed, rand
from tools.load import LoadMatrix
lm=LoadMatrix()
traindat = lm.load_numbers('../data/fm_train_real.dat')
testdat = lm.load_numbers('../data/fm_test_real.dat')
label_traindat = lm.load_labels('../data/label_train_twoclass.dat')
paramete... |
src/products/migrations/0014_CourseWelcomeLetter.py | denkasyanov/education-backend | 151 | 12631787 | <filename>src/products/migrations/0014_CourseWelcomeLetter.py
# Generated by Django 2.2.13 on 2020-09-30 17:02
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('products', '0013_TemplateIdRename'),
]
operations = [
migrations.RemoveField(... |
terrascript/provider/taiidani/jenkins.py | mjuenema/python-terrascript | 507 | 12631812 | <gh_stars>100-1000
# terrascript/provider/taiidani/jenkins.py
# Automatically generated by tools/makecode.py (24-Sep-2021 15:19:30 UTC)
import terrascript
class jenkins(terrascript.Provider):
"""Jenkins Terraform Provider"""
__description__ = "Jenkins Terraform Provider"
__namespace__ = "taiidani"
_... |
VoiceActivityDetection/train.py | jeffery-work/SpeechAlgorithms | 338 | 12631814 | """
@FileName: train.py
@Description: Implement train
@Author: Ryuk
@CreateDate: 2020/05/13
@LastEditTime: 2020/05/13
@LastEditors: Please set LastEditors
@Version: v0.1
"""
from model import *
from utils import *
logger = getLogger()
logger.info("====================================Programm Start===================... |
tests/helper.py | anton-ryzhov/python-manhole | 256 | 12631881 | <gh_stars>100-1000
from __future__ import print_function
import atexit
import errno
import logging
import os
import signal
import sys
import time
from functools import partial
TIMEOUT = int(os.getenv('MANHOLE_TEST_TIMEOUT', 10))
SOCKET_PATH = '/tmp/manhole-socket'
OUTPUT = sys.__stdout__
def handle_sigterm(signo, _... |
src/__init__.py | Briles/gruvbox | 251 | 12631891 | #!/usr/bin/env python
# coding: utf-8
from .documentation import *
from .support import *
from .gruvbox import *
|
dataprep/clean/components/num_scaling/minmax_scaler.py | devinllu/dataprep | 1,229 | 12631928 | """
Implement numerical minmax scaler.
"""
from typing import Any, Union
import dask.dataframe as dd
class MinmaxScaler:
"""Min Value and Max Value Scaler for scaling numerical values
Attributes:
name
Name of scaler
min
Min value of provided data column
max
... |
recipes/UrbanSound8k/SoundClassification/urbansound8k_prepare.py | JasonSWFu/speechbrain | 3,913 | 12631930 | """
Creates data manifest files from UrbanSound8k, suitable for use in SpeechBrain.
https://urbansounddataset.weebly.com/urbansound8k.html
From the authors of UrbanSound8k:
1. Don't reshuffle the data! Use the predefined 10 folds and perform 10-fold (not 5-fold) cross validation
The experiments conducted by vast maj... |
scripts/create-geo-simple-lexicon.py | yash-srivastava19/sempre | 812 | 12631936 | #!/usr/bin/python
import sys
import json
class LexicalEntry:
def __init__(self, l, f, t):
self.lexeme=l.strip()
self.formula=f.strip()
self.type=t.strip()
out = open(sys.argv[2],'w')
with open(sys.argv[1]) as f:
for line in f:
tokens = line.split("\t")
if len(tokens) > 2:
continue
... |
workflows/cloudify_system_workflows/deployment_update/step_extractor.py | cloudify-cosmo/cloudify-manager | 124 | 12631939 | import operator
from collections import Counter
from functools import total_ordering
import networkx as nx
RELEVANT_DEPLOYMENT_FIELDS = ['blueprint_id', 'id', 'inputs', 'nodes',
'outputs', 'workflows', 'groups', 'policy_types',
'policy_triggers', 'descripti... |
python_packages/jupyterlab_lsp/jupyterlab_lsp/__init__.py | icankeep/jupyterlab-lsp | 1,117 | 12631944 | # flake8: noqa: F401
from ._version import __version__
def _jupyter_labextension_paths():
return [
{
"src": "labextensions/@krassowski/jupyterlab-lsp",
"dest": "@krassowski/jupyterlab-lsp",
}
]
|
backend/MaskFormer/mask_former/data/datasets/register_mapillary_vistas.py | rune-l/coco-annotator | 143 | 12631947 | # Copyright (c) Facebook, Inc. and its affiliates.
import os
from detectron2.data import DatasetCatalog, MetadataCatalog
from detectron2.data.datasets import load_sem_seg
MAPILLARY_VISTAS_SEM_SEG_CATEGORIES = [
{
"color": [165, 42, 42],
"instances": True,
"readable": "Bird",
"name"... |
pipeline/archivebot/seesaw/tasks.py | AKTheKnight/ArchiveBot | 250 | 12632044 | <reponame>AKTheKnight/ArchiveBot<filename>pipeline/archivebot/seesaw/tasks.py
import datetime
import functools
import glob
import gzip
import json
import os
import shutil
import time
import requests
import socket
from seesaw.externalprocess import WgetDownload
from seesaw.task import Task, SimpleTask
from tornado.iolo... |
metrics/lsun_bedroom.py | SachinKumar105/Implicit-Competitive-Regularization | 107 | 12632076 | import numpy as np
import torch
import tensorflow as tf
# from tflib.inception_score import get_inception_score
from .inception_tf13 import get_inception_score
import tflib.fid as fid
BATCH_SIZE = 100
N_CHANNEL = 3
RESOLUTION = 64
NUM_SAMPLES = 50000
def cal_inception_score(G, device, z_dim):
all_samples = []
... |
test/run/t437.py | timmartin/skulpt | 2,671 | 12632091 | <filename>test/run/t437.py
import re
m = re.match('([0-9]+)([a-z]+)([A-Z]*)','345abu')
print "\ngroup"
print m.group() == '345abu'
print m.group(0) == '345abu'
print m.group(1) == '345'
print m.group(2) == 'abu'
print m.group(3) == ''
print "\ngroups"
print m.groups() == ('345','abu','')
print m.groups('default') ==... |
fuel/converters/__init__.py | zaimusho/fuel | 767 | 12632094 | """Data conversion modules for built-in datasets.
Conversion submodules generate an HDF5 file that is compatible with
their corresponding built-in dataset.
Conversion functions accept a single argument, `subparser`, which is an
`argparse.ArgumentParser` instance that it needs to fill with its own
specific arguments. ... |
tests/performance/memory_pressure_check.py | zazula/talos | 1,536 | 12632111 | if __name__ == '__main__':
import numpy as np
import pandas as pd
import os
print('\n Memory Pressure Test Starts...\n')
for i in os.listdir():
if 'mprofile_' in i:
df = pd.read_csv(i, sep=' ', error_bad_lines=False)
df.columns = ['null', 'memory', 'time']
df.drop('nu... |
src/controller/msgReactionDeleteRouter.py | lin483/Funny-Nations | 126 | 12632115 | <gh_stars>100-1000
from discord import Client, Reaction, User, TextChannel, RawReactionActionEvent, PartialEmoji
from typing import Dict
from pymysql import Connection
from src.Storage import Storage
from src.utils.casino.Casino import Casino
from src.utils.casino.table.Table import Table
from src.utils.casino.table.... |
tests/test_search.py | pablo-angulo/TexSoup | 190 | 12632132 | <reponame>pablo-angulo/TexSoup
from TexSoup import TexSoup
###############
# BASIC TESTS #
###############
#########
# CASES #
#########
def test_commands_without_any_sort_arguments():
"""Tests that commands without any sort argument can still be searched."""
soup = TexSoup(r"""
\Question \textbf{Ques... |
tests/utils.py | Krande/ipygany | 450 | 12632137 | <filename>tests/utils.py<gh_stars>100-1000
import numpy as np
from ipygany import Data, Component
def get_test_assets():
vertices = np.array([
[0., 0., 0.],
[0., 0., 0.],
[0., 0., 0.],
])
triangles = np.array([
[0, 1, 2],
])
data_1d = Data(name='1d', components=[... |
dask_ml/ensemble/_blockwise.py | GueroudjiAmal/dask-ml | 803 | 12632165 | import dask
import dask.array as da
import dask.dataframe as dd
import numpy as np
import sklearn.base
from sklearn.utils.validation import check_is_fitted
from ..base import ClassifierMixin, RegressorMixin
from ..utils import check_array
class BlockwiseBase(sklearn.base.BaseEstimator):
def __init__(self, estima... |
src/c3nav/mapdata/migrations/0075_label_settings.py | johnjohndoe/c3nav | 132 | 12632179 | # Generated by Django 2.2.8 on 2019-12-21 23:27
import c3nav.mapdata.fields
from decimal import Decimal
import django.core.validators
from django.db import migrations, models
import django.db.models.deletion
class Migration(migrations.Migration):
dependencies = [
('mapdata', '0074_show_labels'),
]
... |
tests/test_csw_skgeodesy.py | geoanalytics-ca/OWSLib | 218 | 12632209 | <filename>tests/test_csw_skgeodesy.py
from tests.utils import service_ok
import pytest
from owslib.csw import CatalogueServiceWeb
SERVICE_URL = 'https://zbgisws.skgeodesy.sk/zbgiscsw/service.svc/get'
@pytest.mark.online
@pytest.mark.skipif(not service_ok(SERVICE_URL),
reason='service is unreach... |
metadata-ingestion/src/datahub_provider/client/airflow_generator.py | pppsunil/datahub | 289 | 12632217 | <filename>metadata-ingestion/src/datahub_provider/client/airflow_generator.py
from typing import TYPE_CHECKING, Dict, List, Optional, Union
from airflow.configuration import conf
from datahub.api.entities.datajob import DataFlow, DataJob
from datahub.api.entities.dataprocess.dataprocess_instance import (
DataProc... |
src/python/twitter/common/rpc/finagle/trace.py | zhouyijiaren/commons | 1,143 | 12632240 | # ==================================================================================================
# Copyright 2013 Twitter, Inc.
# --------------------------------------------------------------------------------------------------
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use thi... |
pt_cnn_svm/models/cnn.py | bimalka98/CNNwithSVM-for-Image-Classification | 250 | 12632251 | <reponame>bimalka98/CNNwithSVM-for-Image-Classification
# Copyright 2017-2020 <NAME>
#
# 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
#
# Unle... |
hawck-ui/hawck_ui/template_manager.py | abitrolly/Hawck | 320 | 12632290 | ## ================================================================================
## template_manager.py is a part of hawck-ui, which is distributed under the
## following license:
##
## Copyright (C) 2018 <NAME> (no) <<EMAIL>>
## All rights reserved.
##
## Redistribution and use in source and binary forms, with or w... |
tests/endpoints/test_eth_gasprice.py | kanzure/eth-testrpc | 164 | 12632303 | from testrpc.client.utils import (
encode_number,
)
def test_eth_gasprice(accounts, rpc_client):
result = rpc_client('eth_gasPrice')
assert result == "0x1"
|
py_entitymatching/labeler/labeler.py | kvpradap/py_entitymatching | 165 | 12632306 | """
This module contains labeling related routines for a single table.
"""
import logging
import pandas as pd
import six
import py_entitymatching.catalog.catalog_manager as cm
import py_entitymatching.utils.catalog_helper as ch
from py_entitymatching.utils.validation_helper import validate_object_type
logger = loggi... |
rasa/nlu/classifiers/mitie_intent_classifier.py | fintzd/rasa | 9,701 | 12632321 | <reponame>fintzd/rasa
from __future__ import annotations
import logging
from rasa.nlu.featurizers.featurizer import Featurizer
import typing
from typing import Any, Dict, List, Optional, Text, Type
from rasa.engine.graph import ExecutionContext, GraphComponent
from rasa.engine.recipes.default_recipe import DefaultV1Re... |
tests/causal_estimators/test_regression_discontinuity_estimator.py | Sid-darthvader/dowhy | 2,904 | 12632329 | <reponame>Sid-darthvader/dowhy
import pytest
from dowhy.causal_estimators.regression_discontinuity_estimator import RegressionDiscontinuityEstimator
from .base import TestEstimator
@pytest.mark.usefixtures("fixed_seed")
class TestRegressionDiscontinuityEstimator(object):
@pytest.mark.parametrize(["error_tolerance... |
deep_privacy/engine/hooks/log_hooks.py | skoskjei/DP-ATT | 1,128 | 12632362 | import torch
import logging
import time
from deep_privacy import torch_utils, logger
from deep_privacy.metrics import metric_api
from .base import HookBase, HOOK_REGISTRY
from deep_privacy.inference import infer
try:
from apex import amp
except ImportError:
pass
@HOOK_REGISTRY.register_module
class ImageSaveH... |
bottleneck/tests/scalar_input_test.py | joye1503/bottleneck | 372 | 12632409 | """Check that functions can handle scalar input"""
from typing import Callable, Union
import hypothesis
import numpy as np
import pytest
from hypothesis.strategies import floats, integers, one_of
from numpy.testing import assert_array_almost_equal
import bottleneck as bn # noqa: F401
from .util import get_functions... |
dataset/__init__.py | fenghansen/ELD | 258 | 12632411 | import torch.utils.data as data
from PIL import Image
import os
import os.path
IMG_EXTENSIONS = [
'.jpg', '.JPG', '.jpeg', '.JPEG',
'.png', '.PNG', '.ppm', '.PPM', '.bmp', '.BMP',
]
def read_fns(filename):
with open(filename) as f:
fns = f.readlines()
fns = [fn.strip() for fn in fns]
... |
backend/projects/models.py | alairice/doccano | 2,082 | 12632415 | import abc
from django.conf import settings
from django.contrib.auth.models import User
from django.core.exceptions import ValidationError
from django.db import models
from django.db.models import Manager
from polymorphic.models import PolymorphicModel
from roles.models import Role
DOCUMENT_CLASSIFICATION = "Documen... |
tools/perf/page_sets/login_helpers/pinterest_login.py | google-ar/chromium | 2,151 | 12632472 | # Copyright 2016 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.
from page_sets.login_helpers import login_utils
def LoginDesktopAccount(action_runner, credential,
credentials_path=login_utils.DEFAULT_CR... |
dm_control/mjcf/code_for_debugging_test.py | h8907283/dm_control | 2,863 | 12632519 | # Copyright 2018 The dm_control 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 i... |
test_indoor.py | cao-cong/RViDeNet | 147 | 12632521 | from __future__ import division
import os, scipy.io
import re
import torch
import torch.nn as nn
import torch.optim as optim
import numpy as np
import glob
import cv2
import argparse
from PIL import Image
from utils import *
parser = argparse.ArgumentParser(description='Testing')
parser.add_argument('--model', dest='... |
app/ReadabiliPy/readabilipy/simplifiers/text.py | Largo/Lurnby | 590 | 12632523 | <filename>app/ReadabiliPy/readabilipy/simplifiers/text.py<gh_stars>100-1000
"""Common text manipulation functions."""
import unicodedata
import regex
matched_punctuation_marks = [('“', '”'), ('‘', '’'), ('(', ')'), ('[', ']'),
('{', '}')]
terminal_punctuation_marks = ['.', ',', '!', ':', '... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.