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 |
|---|---|---|---|---|
telemelody/evaluation/cal_acc.py | hongwen-sun/muzic | 1,903 | 11116196 | # Copyright (c) Microsoft Corporation. All rights reserved.
# Licensed under the MIT License.
#
from tqdm import tqdm
import numpy as np
import traceback
import sys
PITCH_CLASS_NAMES = [
'C', 'C#', 'D', 'Eb', 'E', 'F', 'F#', 'G', 'Ab', 'A', 'Bb', 'B']
POS_RESOLUTION = 4
ROOT_pitch = {
'C': 0,
... |
tests/test_basic.py | stevenlovegrove/sony_camera_api | 191 | 11116219 | import unittest
import pysony
class TestBasics(unittest.TestCase):
def test_loadpysony(self):
api = pysony.SonyAPI()
self.assertEqual(api.QX_ADDR, 'http://10.0.0.1:10000')
|
Lib/test/bugs/jdkbugs.py | jeff5/jython-whinchat | 577 | 11116244 | import sys
print sys.platform
try:
try:
raise KeyError
except KeyError:
# no bug
print 'Your JVM seems to be working'
except:
print 'Your JVM seems broken'
|
airmozilla/uploads/tests/test_views.py | mozilla/airmozilla | 115 | 11116246 | <reponame>mozilla/airmozilla<gh_stars>100-1000
import datetime
import hashlib
import json
import mock
from nose.tools import eq_, ok_
from django.conf import settings
from django.core.cache import cache
from django.core.urlresolvers import reverse
from airmozilla.base.tests.testbase import DjangoTestCase
from airmoz... |
gnocchi/indexer/alembic/versions/62a8dfb139bb_change_uuid_to_string.py | Dmitry-Eremeev/gnocchi | 299 | 11116247 | # Copyright 2016 OpenStack Foundation
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the License. You may obtain
# a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law ... |
benchmarks/instruction_counts/definitions/setup.py | Hacky-DH/pytorch | 60,067 | 11116271 | <filename>benchmarks/instruction_counts/definitions/setup.py
"""Define some common setup blocks which benchmarks can reuse."""
import enum
from core.api import GroupedSetup
from core.utils import parse_stmts
_TRIVIAL_2D = GroupedSetup(
r"x = torch.ones((4, 4))",
r"auto x = torch::ones({4, 4});"
)
_TRIVIAL... |
pypower/qps_mosek.py | Bengt/PYPOWER | 221 | 11116287 | # Copyright (c) 1996-2015 PSERC. All rights reserved.
# Use of this source code is governed by a BSD-style
# license that can be found in the LICENSE file.
"""Quadratic Program Solver based on MOSEK.
"""
import re
from sys import stdout, stderr
from numpy import array, Inf, zeros, shape, tril, any
from numpy import... |
tools/gcs-bucket-mover/gcs_bucket_mover/sts_job_status.py | ruchirjain86/professional-services | 2,116 | 11116296 | <gh_stars>1000+
# Copyright 2018 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 ... |
tests/auto/test_embeddings.py | lukovkin/keras | 250 | 11116325 | <reponame>lukovkin/keras<gh_stars>100-1000
import unittest
import numpy as np
from keras.models import Sequential
from keras.layers.core import Merge, Dense, Activation, Flatten
from keras.layers.embeddings import Embedding
from theano import function
from keras.constraints import unitnorm
class TestEmbedding(unittes... |
vyapp/plugins/__init__.py | iogf/vy | 927 | 11116338 | from functools import wraps
# ENV is a dict holding plugins objects, like functions, classes etc.
# Plugins should install their handles in ENV.
HANDLE = []
ENV = {}
def autoload(plugin, *args, **kwargs):
HANDLE.append((plugin.install, args, kwargs))
def autocall(handle, *args, **kwargs):
HANDLE.append(... |
hypernets/tabular/ensemble/__init__.py | wyq-1997/Hypernets | 1,080 | 11116372 | <reponame>wyq-1997/Hypernets
# -*- coding:utf-8 -*-
__author__ = 'yangjian'
"""
"""
from .base_ensemble import BaseEnsemble
from .stacking import StackingEnsemble
from .voting import AveragingEnsemble, GreedyEnsemble
from .dask_ensemble import DaskGreedyEnsemble |
energyusage/test.py | annlor/energy-usage | 141 | 11116393 | <gh_stars>100-1000
import unittest
import requests
import evaluate as evaluate
import locate as locate
YEAR = "2016"
PROCESS_KWH = 0.1
printToScreen = False
class Test(unittest.TestCase):
def test_kwh_to_co2(self):
# US locations
breakdown = [5.868023799, 1.321624392, 66.17474207, 26.63395815]
... |
mx_mg/data/utils.py | kevinid/molecule_generator | 127 | 11116436 | """
Containing utility functions for data processing
"""
import random
from scipy import sparse
from rdkit import Chem
import networkx as nx
import numpy as np
from mx_mg.data import data_struct
__all__ = ['get_graph_from_smiles_list', 'get_mol_from_graph', 'get_mol_from_graph_list', 'get_d']
def get_graph_from_sm... |
tests/test_driver_policy.py | nmandery/rasterio | 1,479 | 11116441 | from rasterio.drivers import is_blacklisted
def test_netcdf_is_blacklisted():
assert is_blacklisted('netCDF', 'w')
assert is_blacklisted('netCDF', 'r+')
def test_gtiff_is_not_blacklisted():
assert not is_blacklisted('GTiff', 'w')
assert not is_blacklisted('GTiff', 'r+')
|
macgraph/encoder/__init__.py | Octavian-ai/mac-graph | 116 | 11116464 |
from .encode import encode_input |
api/tacticalrmm/automation/migrations/0008_auto_20210302_0415.py | infinite8co/tacticalrmm | 903 | 11116480 | <gh_stars>100-1000
# Generated by Django 3.1.7 on 2021-03-02 04:15
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('agents', '0030_agent_offline_time'),
('clients', '0009_auto_20210212_1408'),
('automation', '0007_policy_alert_template'),... |
piccolo/apps/schema/piccolo_app.py | 0scarB/piccolo | 750 | 11116507 | from piccolo.conf.apps import AppConfig, Command
from .commands.generate import generate
from .commands.graph import graph
APP_CONFIG = AppConfig(
app_name="schema",
migrations_folder_path="",
commands=[
Command(callable=generate, aliases=["gen", "create", "new", "mirror"]),
Command(
... |
TopQuarkAnalysis/TopJetCombination/python/TtSemiLepHypGenMatch_cff.py | ckamtsikis/cmssw | 852 | 11116525 | <filename>TopQuarkAnalysis/TopJetCombination/python/TtSemiLepHypGenMatch_cff.py
import FWCore.ParameterSet.Config as cms
#
# produce genmatch hypothesis with all necessary
# ingredients
#
## std sequence to produce ttSemiJetPartonMatch
from TopQuarkAnalysis.TopTools.TtSemiLepJetPartonMatch_cfi import *
## configure... |
app/sub_views/scrape_targets_view.py | fake-name/ReadableWebProxy | 193 | 11116568 | <gh_stars>100-1000
import traceback
import pickle
import time
import datetime
from calendar import timegm
from flask import g
from flask import render_template
from flask import make_response
from flask import jsonify
from flask import request
from sqlalchemy.sql import text
from sqlalchemy.dialects import postgres... |
scripts/counts.py | aminya/despacer | 110 | 11116675 | for i in range(1<<16):
print(bin(i).count("1"),end=",")
|
tests/test_acc_on.py | rsketine/neon | 4,415 | 11116693 | <reponame>rsketine/neon
# ******************************************************************************
# Copyright 2014-2018 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 a... |
ffi/python/pairing.py | adambudziak/mcl | 325 | 11116707 | <gh_stars>100-1000
from ctypes import *
from ctypes.wintypes import LPWSTR, LPCSTR, LPVOID
g_lib = None
def BN256_init():
global g_lib
g_lib = cdll.LoadLibrary("../../bin/bn256.dll")
ret = g_lib.BN256_init()
if ret:
print "ERR BN256_init"
class Fr(Structure):
_fields_ = [("v", c_ulonglong * 4)]
def setInt(se... |
guppy/heapy/test/test_menuleak.py | odidev/guppy3 | 251 | 11116708 | from tkinter import *
import sys
import gc
class FixedMenu(Menu):
# A fix for the .delete() method in Menu.
# To delete commands defined in the menu items deleted.
# Also changed the comment: INDEX2 is actually INCLUDED.
def delete(self, index1, index2=None):
"""Delete menu items between INDEX... |
tools/extract_typings_rule.bzl | John-Cassidy/angular | 95,154 | 11116734 | """Starlark file that exposes a rule for extracting type definitions of dependencies."""
load("@build_bazel_rules_nodejs//:providers.bzl", "DeclarationInfo")
def _extract_typings_rule_impl(ctx):
"""Implementation of the `extract_typings` rule."""
transitive_depsets = []
for dep in ctx.attr.deps:
... |
Python/control/upperbody_opspace.py | hpbader42/Klampt | 238 | 11116761 | <filename>Python/control/upperbody_opspace.py<gh_stars>100-1000
from OperationalSpaceController import *
from controller import *
from estimators import *
import robotinfo
class ArmController(OpSpaceController):
def __init__(self,robot,arm):
self.arm = arm
self.dofs = robotinfo.arm(robot,self.arm)
... |
tiles/debug/black.py | wendymhelson/tilecloud | 134 | 11116824 | from tilecloud.store.debug import DebugTileStore
tilestore = DebugTileStore(color=(0, 0, 0))
|
cpmpy/bus_scheduling_csplib.py | tias/hakank | 279 | 11116834 | <filename>cpmpy/bus_scheduling_csplib.py
"""
Bus driver scheduling problem (prob022 in CSPLib) in cpmpy.
http://www.cs.st-andrews.ac.uk/~ianm/CSPLib/prob/prob022/index.html
From
http://www.cs.st-andrews.ac.uk/~ianm/CSPLib/prob/prob022/spec.html
'''
Specification
Bus driver scheduling can be formulated as a set pariti... |
examples/recaptcha3_request.py | smeinecke/python-anticaptcha | 199 | 11116866 | import re
import requests
from os import environ
from six.moves.urllib_parse import urljoin
from python_anticaptcha import AnticaptchaClient, RecaptchaV3TaskProxyless
api_key = environ["KEY"]
site_key_pattern = "grecaptcha.execute\('(.+?)'"
action_name_pattern = "\{action: '(.+?)'\}"
url = "https://recaptcha-demo.apps... |
doc/python_api/examples/bpy.types.Operator.py | rbabari/blender | 365 | 11116898 | """
Basic Operator Example
++++++++++++++++++++++
This script shows simple operator which prints a message.
Since the operator only has an :class:`Operator.execute` function it takes no
user input.
.. note::
Operator subclasses must be registered before accessing them from blender.
"""
import bpy
class HelloWo... |
tests/scripts/ci.py | shreejitverma/tvm | 2,084 | 11116919 | <reponame>shreejitverma/tvm
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
# 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
# t... |
setup.py | tutengfei/flaskblog | 204 | 11116943 | #!/usr/bin/env python
from setuptools import setup
import app
try:
long_description = open('README.md').read()
except:
long_description = app.__description__
REQUIREMENTS = [i.strip() for i in open("requirements.txt").readlines()]
setup(
name='flaskblog',
version=app.__version__,
url='https://... |
excel4lib/config/__init__.py | aaaddress1/boobsnail | 169 | 11116956 | <gh_stars>100-1000
from .excel4_obfuscator_config import *
from .excel4_translator_config import *
from .excel4_config import *
|
kur/engine/jinja_engine.py | greedyuser/kur | 867 | 11116983 | """
Copyright 2016 Deepgram
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
distri... |
Chapter10/listing10_2.py | hohsieh/osgeopy-code | 160 | 11116987 | # Script to use ground control points to add a geotransform to a raster.
import glob
import math
import os
from osgeo import gdal, osr
# The get_extent function from the text is in ch10funcs.py.
import ch10funcs
# Don't forget to change the directory.
os.chdir(r'D:\osgeopy-data\Massachusetts')
# Get the list of tif... |
tools/gnvprof.py | mehrdad-shokri/fbcuda | 296 | 11116995 | <reponame>mehrdad-shokri/fbcuda
#!/usr/local/bin/ifbpy2 --never-use-in-production
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
from __future__ import unicode_literals
import sys
import json
import pandas as pd
import numpy as np
def trace_event(row):
... |
ai/src/tests/perf_data.py | ScriptBox99/spiceai | 713 | 11117032 | <gh_stars>100-1000
from io import BytesIO, StringIO
import time
import pandas as pd
from pyarrow import csv
from proto.aiengine.v1 import aiengine_pb2
import main
from tests import common
class DataSource:
def __init__(self, name, init_json_path, data_path):
self.name = name
self.init_req = comm... |
Anaconda-files/Program_21c.py | arvidl/dynamical-systems-with-applications-using-python | 106 | 11117040 | <filename>Anaconda-files/Program_21c.py<gh_stars>100-1000
# Program 21c: Josephson junction limit cycle.
# See Figure 21.9.
from matplotlib import pyplot as plt
import numpy as np
from scipy.integrate import odeint
fig = plt.figure()
bj = 1.2
tmax = 100
kappa = 1.4
def jj_ode(x, t):
return [x[1], kappa - bj*x[1... |
notebook/numpy_slice.py | vhn0912/python-snippets | 174 | 11117066 | import numpy as np
l = list(range(10))
print(l)
# [0, 1, 2, 3, 4, 5, 6, 7, 8, 9]
print(l[4:8])
# [4, 5, 6, 7]
print(l[-5:-2])
# [5, 6, 7]
print(l[::-1])
# [9, 8, 7, 6, 5, 4, 3, 2, 1, 0]
a = np.arange(10)
print(a)
# [0 1 2 3 4 5 6 7 8 9]
print(a[4:8])
# [4 5 6 7]
print(a[-5:-2])
# [5 6 7]
print(a[::-1])
# [9 8 7... |
tests/behavioral_tests/test_memento.py | defianceblack/PyPattyrn | 1,499 | 11117136 | <gh_stars>1000+
from unittest import TestCase
from pypattyrn.behavioral.memento import Memento, Originator
class MementoTestCase(TestCase):
"""
Unit testing class for the Memento Class.
"""
def setUp(self):
"""
Initialize testing data.
"""
self.state = {'foo': 'bar'}
... |
examples/clusterman_metrics/clusterman_metrics/util/costs.py | akshaysharma096/clusterman | 281 | 11117151 | # Copyright 2019 Yelp Inc.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, so... |
tests/python/test_states.py | chakpongchung/tinyflow | 2,035 | 11117159 | <filename>tests/python/test_states.py<gh_stars>1000+
import tinyflow as tf
import numpy as np
def test_assign():
x = tf.Variable(tf.zeros(shape=[2,3]))
sess = tf.Session()
sess.run(tf.assign(x, tf.zeros(shape=[2,3])))
ax = sess.run(x)
np.testing.assert_almost_equal(ax, np.zeros((2,3)))
def test_gr... |
tests/test_stats_manager.py | machinalis/featureforge | 366 | 11117201 | from datetime import timedelta
import mock
from unittest import TestCase
import warnings
from featureforge.experimentation.stats_manager import StatsManager
DEPRECATION_MSG = (
'Init arguments will change. '
'Take a look to http://feature-forge.readthedocs.io/en/latest/experimentation.html'
'#exploring-th... |
Algo and DSA/LeetCode-Solutions-master/Python/escape-the-ghosts.py | Sourav692/FAANG-Interview-Preparation | 3,269 | 11117218 | <reponame>Sourav692/FAANG-Interview-Preparation<filename>Algo and DSA/LeetCode-Solutions-master/Python/escape-the-ghosts.py
# Time: O(n)
# Space: O(1)
class Solution(object):
def escapeGhosts(self, ghosts, target):
"""
:type ghosts: List[List[int]]
:type target: List[int]
:rtype: b... |
Training Utility/somatictrainer/sandbox.py | ZackFreedman/Somatic | 328 | 11117228 | <filename>Training Utility/somatictrainer/sandbox.py<gh_stars>100-1000
import random
import time
import requests
import tensorflow.keras as keras
import tensorflow as tf
import sklearn.model_selection
import logging
import numpy as np
import hexdump
from datetime import datetime
from somatictrainer.gestures import Ge... |
tests/perf/test_long_cycles_nbrows_cycle_length_31000_380.py | shaido987/pyaf | 377 | 11117285 | import tests.perf.test_cycles_full_long_long as gen
gen.test_nbrows_cycle(31000 , 380)
|
tests/syntax/unmatched_closing_bracket_1.py | matan-h/friendly | 287 | 11117291 | """Should raise SyntaxError: invalid syntax"""
x = (1, 2, 3]
|
Tools/PNGEmbedder.py | AntonioCS/MinecraftC | 172 | 11117320 | from PIL import Image
import os
import sys
def export(filePath):
outputPath = __file__[:__file__.rfind('/Tools')] + '/Resources' + filePath[filePath.rfind('/Input'):][6:]
outputPath = outputPath[:-4] + '.h'
cName = filePath[filePath.rfind('/Input'):][7:-4].replace('/', '_')
image = Image.open(filePath).convert('... |
scripts/system/parse_log.py | jjzhang166/minerva | 561 | 11117336 | <gh_stars>100-1000
import sys
import re
import operator
interval = 0.01
def getDeviceIdFromExecution(s):
words = s.split()
if len(words) < 4 or words[3] != 'execute':
return None
else:
return int(words[2][1:])
def getDeviceIdFromCreation(s):
words = s.split()
if len(words) < 6 or ... |
Utils/AnnotationTools.py | Caius-Lu/Savior | 108 | 11117338 | import cv2
import os
from PIL import Image, ImageDraw, ImageFont
import numpy as np
import colorsys
from Utils.GeometryUtils import compute_two_points_angle, get_coordinates_of_rotated_box
current_directory = os.path.dirname(__file__)
candidate_font = '田氏颜体大字库2.0.ttf'
annotate_font = ImageFont.truetype(os.path.join(cu... |
alipay/aop/api/response/MybankCreditLoanapplyPromotionDynamicurlGetResponse.py | snowxmas/alipay-sdk-python-all | 213 | 11117364 | #!/usr/bin/env python
# -*- coding: utf-8 -*-
import json
from alipay.aop.api.response.AlipayResponse import AlipayResponse
class MybankCreditLoanapplyPromotionDynamicurlGetResponse(AlipayResponse):
def __init__(self):
super(MybankCreditLoanapplyPromotionDynamicurlGetResponse, self).__init__()
s... |
src/pytorch_adapt/meta_validators/__init__.py | KevinMusgrave/pytorch-adapt | 131 | 11117393 | <reponame>KevinMusgrave/pytorch-adapt
from .forward_only_validator import ForwardOnlyValidator
from .reverse_validator import ReverseValidator
|
lingua_franca/lang/common_data_it.py | NeonDaniel/lingua-franca | 191 | 11117448 | import collections
_SHORT_ORDINAL_STRING_IT = {
1: 'primo',
2: 'secondo',
3: 'terzo',
4: 'quarto',
5: 'quinto',
6: 'sesto',
7: 'settimo',
8: 'ottavo',
9: 'nono',
10: 'decimo',
11: 'undicesimo',
12: 'dodicesimo',
13: 'tredicesimo',
14: 'quattordicesimo',
15: ... |
twnews/tests/soup/test_soup_ettoday.py | virus-warnning/twnews | 188 | 11117449 | <reponame>virus-warnning/twnews
"""
東森新聞雲分解測試
"""
# pylint: disable=duplicate-code
import unittest
import twnews.common
from twnews.soup import NewsSoup
class TestEttoday(unittest.TestCase):
"""
東森新聞雲分解測試
"""
def setUp(self):
self.dtf = '%Y-%m-%d %H:%M:%S'
def test_01_sample(self):
... |
sportsipy/mlb/player.py | MArtinherz/sportsipy | 221 | 11117472 | <reponame>MArtinherz/sportsipy<filename>sportsipy/mlb/player.py
import pandas as pd
import re
from functools import wraps
from lxml.etree import ParserError, XMLSyntaxError
from pyquery import PyQuery as pq
from urllib.error import HTTPError
from .. import utils
from .constants import (BOXSCORE_SCHEME,
... |
remote_notebook/code/notebook_server_client.py | sfahad1414/seahorse | 111 | 11117475 | # Copyright 2016 deepsense.ai (CodiLime, 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 agree... |
nornir/lab-system/deployment.py | caputomarcos/network-programmability-stream | 120 | 11117482 | <filename>nornir/lab-system/deployment.py
import itertools
import logging
from collections import deque, defaultdict, OrderedDict
from pathlib import Path
from typing import (
Dict,
List,
Iterable,
Any,
Set,
NamedTuple,
Optional,
ValuesView,
Iterator,
Deque,
DefaultDict,
)
i... |
utils/lit/tests/usage.py | clayne/DirectXShaderCompiler | 1,192 | 11117497 | # Basic sanity check that usage works.
#
# RUN: %{lit} --help > %t.out
# RUN: FileCheck < %t.out %s
#
# CHECK: Usage: lit.py [options] {file-or-path}
|
studio/serve_main.py | ilblackdragon/studio | 397 | 11117510 | import argparse
import sys
import os
import time
import json
import glob
import traceback
import importlib
import pickle
import re
import threading
from flask import Flask, request
from studio import fs_tracker, logs
from .model_util import ModelPipe
app = Flask(__name__)
model = None
logger = None
killtimer = None
... |
custom_components/dahua/digest.py | lpdescamps/dahua | 114 | 11117514 | <reponame>lpdescamps/dahua<filename>custom_components/dahua/digest.py<gh_stars>100-1000
"""Dahua Digest Auth Support"""
import os
import time
import hashlib
import aiohttp
from aiohttp.client_reqrep import ClientResponse
from aiohttp.client_exceptions import ClientError
from yarl import URL
# Seems that aiohttp doesn... |
scripts/release19/lodobject_simplify.py | tdapper/cinema4d_py_sdk | 113 | 11117552 | # This example configures the active LodObject 'op' to use the "Simplify" mode.
# The first level uses the "Convex Hull" mode, the second the "Null" mode.
# Use "Simplify" mode and a manual number of levels.
import c4d
op[c4d.LOD_MODE] = c4d.LOD_MODE_SIMPLIFY
op[c4d.LOD_CRITERIA] = c4d.LOD_CRITERIA_MANUAL
op[c4d.LOD_... |
tests/test_text.py | tatarize/vpype | 453 | 11117558 | <reponame>tatarize/vpype
import pytest
import vpype as vp
from vpype_viewer import ImageRenderer, UnitType
# noinspection SpellCheckingInspection
LOREM = (
"Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor "
"incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, q... |
tests/components/plugwise/conftest.py | MrDelik/core | 30,023 | 11117569 | """Setup mocks for the Plugwise integration tests."""
from __future__ import annotations
from collections.abc import Generator
import json
from typing import Any
from unittest.mock import AsyncMock, MagicMock, patch
import pytest
from homeassistant.components.plugwise.const import API, DOMAIN, PW_TYPE
from homeassis... |
examples/pybullet/gym/pybullet_envs/minitaur/envs_v2/utilities/noise_generators.py | felipeek/bullet3 | 9,136 | 11117571 | """Noise generators to simulate noise in sensor / actuator classes."""
import abc
import gin
import numpy as np
class NoiseGenerator(metaclass=abc.ABCMeta):
"""Base class for noise generators."""
@abc.abstractmethod
def _get_noise(self, shape, dtype=None):
"""Gets noise as a numpy array in the specified s... |
example-mnist/bin/py/mnist_simple.py | marcel303/ofxMSATensorFlow | 481 | 11117611 | # ==============================================================================
### IF YOU ARE RUNNING THIS IN SPYDER MAKE SURE TO USE A NEW CONSOLE EACH TIME
### TO CLEAR THE SESSION
### (press F6, and select 'Execute in a new dedicated Python console')
# =============================================================... |
tests/test_xsto_calendar.py | syonoki/exchange_calendars | 128 | 11117616 | <filename>tests/test_xsto_calendar.py<gh_stars>100-1000
import pytest
import pandas as pd
from exchange_calendars.exchange_calendar_xsto import XSTOExchangeCalendar
from .test_exchange_calendar import ExchangeCalendarTestBase
class TestXSTOCalendar(ExchangeCalendarTestBase):
@pytest.fixture(scope="class")
de... |
qcodes/dataset/data_set_info.py | riju-pal/QCoDeS_riju | 223 | 11117657 | <filename>qcodes/dataset/data_set_info.py
import json
from typing import Any, Dict, List, Optional
from typing_extensions import TypedDict
from qcodes.dataset.descriptions.rundescriber import RunDescriber
from qcodes.dataset.linked_datasets.links import Link, str_to_links
from qcodes.dataset.sqlite.connection import ... |
test/test_exception.py | swuecho/pyecharts | 11,032 | 11117662 | <reponame>swuecho/pyecharts
from nose.tools import assert_equal
from pyecharts import options as opts
from pyecharts.charts import Geo, BMap
from pyecharts.exceptions import NonexistentCoordinatesException
BAIDU_MAP_API_PREFIX = "https://api.map.baidu.com/api?v=2.0"
FAKE_API_KEY = "fake_application_key"
def test_ge... |
src/browser_source_interaction.py | upgradeQ/OBS-Studio-Python-Scripting-Cheatsheet | 116 | 11117687 | <gh_stars>100-1000
import obspython as S
from contextlib import contextmanager
G = lambda: ...
@contextmanager
def source_auto_release(source_name):
source = S.obs_get_source_by_name(source_name)
try:
yield source
finally:
S.obs_source_release(source)
def get_modifiers(key_modifiers):
... |
yabgp/tests/unit/message/attribute/nlri/test_blgls_epe.py | mengjunyi/yabgp | 203 | 11117689 | <reponame>mengjunyi/yabgp
# Copyright 2015-2017 Cisco Systems, 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\... |
examples/train_simple_net.py | HyeongminMoon/PatrickStar | 494 | 11117699 | <gh_stars>100-1000
# BSD 3-Clause License
#
# Copyright (C) 2021 THL A29 Limited, a Tencent company. 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 retai... |
src/dataloaders/et.py | dumpmemory/state-spaces | 513 | 11117710 | """
ET Dataset from Informer Paper.
Dataset: https://github.com/zhouhaoyi/ETDataset
Dataloader: https://github.com/zhouhaoyi/Informer2020
"""
from typing import List
import os
import numpy as np
import pandas as pd
from pandas.tseries import offsets
from pandas.tseries.frequencies import to_offset
import torch
from to... |
questions/permutations-ii/Solution.py | marcus-aurelianus/leetcode-solutions | 141 | 11117751 | '''
Given a collection of numbers that might contain duplicates, return all possible unique permutations.
Example:
Input: [1,1,2]
Output:
[
[1,1,2],
[1,2,1],
[2,1,1]
]
'''
from collections import Counter
class Solution:
def permuteUnique(self, nums: List[int]) -> List[List[int]]:
def generate_per... |
custom_components/dyson_local/config_flow.py | austinbeam/ha-dyson | 158 | 11117770 | """Config flow for Dyson integration."""
import logging
import threading
from typing import Optional
from libdyson import DEVICE_TYPE_NAMES, get_device, get_mqtt_info_from_wifi_info
from libdyson.cloud import DysonDeviceInfo
from libdyson.discovery import DysonDiscovery
from libdyson.exceptions import (
DysonExce... |
harmonica/tests/utils.py | fatiando/harmonica | 128 | 11117832 | # Copyright (c) 2018 The Harmonica Developers.
# Distributed under the terms of the BSD 3-Clause License.
# SPDX-License-Identifier: BSD-3-Clause
#
# This code is part of the Fatiando a Terra project (https://www.fatiando.org)
#
# pylint: disable=invalid-name
"""
Decorators and useful functions for running tests
"""
im... |
examples/infer_states.py | zlapp/keras-ncp | 1,087 | 11117844 | # Copyright (2017-2020)
# The Wormnet project
# <NAME> (<EMAIL>)
import numpy as np
import tensorflow as tf
import kerasncp as kncp
from kerasncp.tf import LTCCell
data_x = np.random.default_rng().normal(size=(100, 16, 10))
data_y = np.random.default_rng().normal(size=(100, 16, 1))
print("data_y.shape: ", str(data_y.... |
test_runner/conftest.py | libzenith/zenith | 189 | 11117846 | <reponame>libzenith/zenith<filename>test_runner/conftest.py
pytest_plugins = ("fixtures.zenith_fixtures", "fixtures.benchmark_fixture")
|
sdk/storage/azure-storage-file-datalake/tests/perfstress_tests/upload.py | rsdoherty/azure-sdk-for-python | 2,728 | 11117850 | # --------------------------------------------------------------------------------------------
# Copyright (c) Microsoft Corporation. All rights reserved.
# Licensed under the MIT License. See License.txt in the project root for license information.
# --------------------------------------------------------------------... |
commandment/alembics/versions/2f1507bf6dc1_create_application_manifests_table.py | pythonModule/commandment | 138 | 11117851 | """create application_manifests table
Revision ID: 2f1507bf6dc1
Revises: <KEY>
Create Date: 2017-10-15 17:37:04.645717
"""
from alembic import op
import sqlalchemy as sa
import commandment.dbtypes
from alembic import context
# revision identifiers, used by Alembic.
revision = '<KEY>'
down_revision = '<KEY>'
branch... |
tests/cli_tests/test_history.py | itamarhaber/iredis | 1,857 | 11117896 | import os
import pexpect
from pathlib import Path
from textwrap import dedent
def test_history_not_log_auth(cli):
cli.sendline("AUTH 123")
cli.expect(["Client sent AUTH, but no password is set", "127.0.0.1"])
cli.sendline("set foo bar")
cli.expect("OK")
with open(os.path.expanduser("~/.iredis_his... |
SREval.py | EdwardSmith1884/Multi-View-Silhouette-and-Depth-Decomposition-for-High-Resolution-3D-Object-Representation | 123 | 11117911 | import tensorflow as tf
import os
import sys
sys.path.insert(0, './scripts/')
import tensorlayer as tl
import numpy as np
import random
from utils import *
from models import *
import argparse
parser = argparse.ArgumentParser(description='3D-GAN implementation for 32*32*32 voxel output')
parser.add_argument('-o','... |
src/api/dcps/python/test/test_topic_over_the_wire.py | brezillon/opensplice | 133 | 11117913 | <reponame>brezillon/opensplice<filename>src/api/dcps/python/test/test_topic_over_the_wire.py
#
# Vortex OpenSplice
#
# This software and documentation are Copyright 2006 to TO_YEAR ADLINK
# Technology Limited, its affiliated companies and licensors. All rights
# reserved.
#
# Licensed un... |
sdk/python/pulumi_gcp/datacatalog/tag_template.py | sisisin/pulumi-gcp | 121 | 11117930 | # coding=utf-8
# *** WARNING: this file was generated by the Pulumi Terraform Bridge (tfgen) Tool. ***
# *** Do not edit by hand unless you're certain you know what you are doing! ***
import warnings
import pulumi
import pulumi.runtime
from typing import Any, Mapping, Optional, Sequence, Union, overload
from .. import... |
corehq/apps/smsbillables/migrations/0014_bootstrap_apposit_rates.py | dimagilg/commcare-hq | 471 | 11118016 | <gh_stars>100-1000
from django.db import migrations
from corehq.apps.smsbillables.management.commands.bootstrap_apposit_gateway import (
bootstrap_apposit_gateway,
)
def create_apposit_rates(apps, schema_editor):
bootstrap_apposit_gateway(apps)
class Migration(migrations.Migration):
dependencies = [
... |
Gelatin/compiler/String.py | Etherbay/Gelatin | 107 | 11118028 | # Copyright (c) 2010-2017 <NAME>
#
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the "Software"), to deal
# in the Software without restriction, including without limitation the rights
# to use, copy, modify, merge, publish, distrib... |
task_set/tasks/losg_problems/problem_generator_test.py | deepneuralmachine/google-research | 23,901 | 11118117 | # 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... |
crawler/tools/legacy/restore_region.py | eala/tw-rental-house-data | 125 | 11118136 | import sys
import os
import traceback
import json
sys.path.append('{}/../..'.format(
os.path.dirname(os.path.realpath(__file__))))
from backend.db.models import House, HouseEtc, db
from backend.db.enums import TopRegionField, SubRegionField
rows = []
total = 0
def save(row, force=False):
global rows
gl... |
src/condor_contrib/condor_pigeon/src/condor_pigeon_client/skype_linux_tools/Skype4Py/Languages/de.py | neurodebian/htcondor | 217 | 11118165 | apiAttachAvailable = u'API verf\xfcgbar'
apiAttachNotAvailable = u'Nicht verf\xfcgbar'
apiAttachPendingAuthorization = u'Ausstehende Genehmigungsanfrage'
apiAttachRefused = u'Abgelehnt'
apiAttachSuccess = u'Erfolg'
apiAttachUnknown = u'Unbekannt'
budDeletedFriend = u'Aus Freundesliste gel\xf6scht'
budFriend = u'... |
nodes/1.x/python/Math.DecimalToBinary.py | jdehotin/Clockworkfordynamo | 147 | 11118175 | <reponame>jdehotin/Clockworkfordynamo<gh_stars>100-1000
vals = IN[0]
elementlist = []
for val in vals:
elementlist.append(bin(val))
OUT = elementlist |
netdev/version.py | maliciousgroup/netdev | 199 | 11118185 | <filename>netdev/version.py
""" Netdev Version information
"""
__version__ = "0.9.3"
__author__ = "<NAME>"
__author_email__ = "<EMAIL>"
__url__ = "http://netdev.readthedocs.io/"
|
setup.py | Medigram/pyapns | 752 | 11118201 | #!/usr/bin/env python
try:
from setuptools import setup
except ImportError:
from distutils.core import setup
DOC = \
"""
Features:
* XML-RPC Based, works with any client in any language
* Native Python API with Django and Pylons support
* Scalable, fast and easy to distribute behind a proxy
*... |
fhir/resources/STU3/tests/test_explanationofbenefit.py | cstoltze/fhir.resources | 144 | 11118232 | # -*- coding: utf-8 -*-
"""
Profile: http://hl7.org/fhir/StructureDefinition/ExplanationOfBenefit
Release: STU3
Version: 3.0.2
Revision: 11917
Last updated: 2019-10-24T11:53:00+11:00
"""
from pydantic.validators import bytes_validator # noqa: F401
from .. import fhirtypes # noqa: F401
from .. import explanationofben... |
samples/unmanage_node.py | oniram22/orionsdk-python | 177 | 11118268 | import requests
from orionsdk import SwisClient
from datetime import datetime, timedelta
def main():
hostname = 'localhost'
username = 'admin'
password = ''
swis = SwisClient(hostname, username, password)
results = swis.query('SELECT NodeID, Caption FROM Orion.Nodes WHERE IPAddress = @ip_addr', i... |
crowdsourcing/utils.py | Kyeongan/crowdsource-platform | 138 | 11118324 | import ast
import datetime
import hashlib
import random
import re
import string
from django.conf import settings
from django.http import HttpResponse
from django.template import Template
from django.template.base import VariableNode
from django.utils import timezone
from django.utils.http import urlencode
from oauth2_... |
src/super_gradients/training/datasets/datasets_utils.py | Deci-AI/super-gradients | 308 | 11118415 | <filename>src/super_gradients/training/datasets/datasets_utils.py
import copy
import os
from abc import ABC, abstractmethod
from multiprocessing import Value, Lock
import random
import numpy as np
import torch.nn.functional as F
import torchvision
from PIL import Image
import torch
from super_gradients.common.sg_logge... |
Python/42.TrappingRainWater.py | nizD/LeetCode-Solutions | 263 | 11118463 | '''
LeetCode Link: https://leetcode.com/problems/trapping-rain-water
Given n non-negative integers representing an elevation map where the width of each bar is 1,
compute how much water it is able to trap after raining.
The elevation map is represented by array [0,1,0,2,1,0,1,3,2,1,2,1].
In this ... |
label_studio/core/serializers.py | fpaupier/label-studio | 8,264 | 11118481 | import copy
from rest_framework import serializers
class SerializerOption:
def __init__(self, data):
self.data = copy.deepcopy(data)
self._model_class = None
self._base_serializer = serializers.ModelSerializer
self._serializer_class = None
self._fields = '__all__'
... |
project/utils/general.py | MahjongRepository/tenhou-python-bot | 201 | 11118495 | import random
import string
from typing import List
from mahjong.constants import EAST
from mahjong.utils import is_honor, is_man, is_pin, is_sou, simplify
# TODO move to mahjong lib
def is_sangenpai(tile_34):
return tile_34 >= 31
# TODO move to mahjong lib
def is_tiles_same_suit(first_tile_34, second_tile_34)... |
cvxpylayers/jax/__init__.py | bamos/cvxpylayers | 1,287 | 11118499 | <gh_stars>1000+
from cvxpylayers.jax.cvxpylayer import CvxpyLayer # noqa: F401
|
test/components/circ_ref.py | sytelus/longview | 3,453 | 11118521 | <reponame>sytelus/longview
import tensorwatch as tw
import objgraph, time #pip install objgraph
cli = tw.WatcherClient()
time.sleep(10)
del cli
import gc
gc.collect()
import time
time.sleep(2)
objgraph.show_backrefs(objgraph.by_type('WatcherClient'), refcounts=True, filename='b.png')
|
tests/error/__init__.py | KingDarBoja/graphql-core | 590 | 11118534 | """Tests for graphql.error"""
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.