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 |
|---|---|---|---|---|
RL/plot-single.py | JulianYu123456/icnn | 258 | 12629233 | <reponame>JulianYu123456/icnn<filename>RL/plot-single.py
#!/usr/bin/env python3
import argparse
import os
import numpy as np
import matplotlib as mpl
mpl.use('Agg')
import matplotlib.pyplot as plt
plt.style.use('bmh')
def main():
parser = argparse.ArgumentParser()
parser.add_argument('expDir', type=str)
... |
orc8r/gateway/python/scripts/ctraced_cli.py | nstng/magma | 539 | 12629238 | #!/usr/bin/env python3
"""
Copyright 2020 The Magma Authors.
This source code is licensed under the BSD-style license found in the
LICENSE file in the root directory of this source tree.
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BAS... |
anaconda_project/test/test_cli.py | kathatherine/anaconda-project | 188 | 12629268 | # -*- coding: utf-8 -*-
# -----------------------------------------------------------------------------
# Copyright (c) 2016, Anaconda, Inc. All rights reserved.
#
# Licensed under the terms of the BSD 3-Clause License.
# The full license is in the file LICENSE.txt, distributed with this software.
# -------------------... |
Tree/222_CountCompleteTreeNodes.py | cls1991/leetcode | 180 | 12629269 | # coding: utf8
"""
题目链接: https://leetcode.com/problems/count-complete-tree-nodes/description.
题目描述:
Given a complete binary tree, count the number of nodes.
Definition of a complete binary tree from Wikipedia:
In a complete binary tree every level, except possibly the last, is completely filled,... |
dtech_instagram/InstagramAPI/src/__init__.py | hideki-saito/InstagramAPP_Flask | 126 | 12629275 | from .Checkpoint import Checkpoint
from .Constants import Constants
from .Instagram import Instagram
from .InstagramException import InstagramException
from .InstagramRegistration import InstagramRegistration
from .SignatureUtils import SignatureUtils
from .Utils import *
from .http import *
__all__ = ["Constants", "I... |
det3d/models/necks/__init__.py | alsun-oven/CenterPoint | 1,124 | 12629277 | <reponame>alsun-oven/CenterPoint
from .rpn import RPN
__all__ = ["RPN"]
|
lib-python/io/proxies/reliability.py | geoffxy/tandem | 732 | 12629321 | <reponame>geoffxy/tandem
from tandem.shared.io.udp_gateway import UDPGateway
from tandem.shared.io.proxies.base import ProxyBase
from tandem.shared.utils.reliability import ReliabilityUtils
from tandem.shared.stores.reliability import ReliabilityStore
import logging
class ReliabilityProxy(ProxyBase):
def __init__... |
windows/auto_config_geo_for_multiple_wins_app.py | shuge/Qt-Python-Binding-Examples | 179 | 12629334 | #!/usr/bin/env python
"""
auto place secondary window next to primary window
Tested environment:
Mac OS X 10.6.8
http://www.pyside.org/docs/pyside/PySide/QtGui/QWidget.html
http://www.pyside.org/docs/pyside/PySide/QtCore/QRect.html
https://doc.qt.io/qt-5/qdesktopwidget.html
"""
import sys
try:
from PySide i... |
bin/viewer.py | jzw0025/fem-with-python | 148 | 12629348 | <gh_stars>100-1000
#!/usr/bin/env python
import sys
import argparse
from os.path import dirname, realpath, join, isdir
D = realpath(join(dirname(realpath(__file__)), '../'))
assert isdir(join(D, 'femlib'))
sys.path.insert(0, D)
from viewer import launch_viewer
parser = argparse.ArgumentParser(sys.argv[1:])
parser.add_a... |
crabageprediction/venv/Lib/site-packages/matplotlib/container.py | 13rianlucero/CrabAgePrediction | 603 | 12629405 | <gh_stars>100-1000
from matplotlib.artist import Artist
import matplotlib.cbook as cbook
class Container(tuple):
"""
Base class for containers.
Containers are classes that collect semantically related Artists such as
the bars of a bar plot.
"""
def __repr__(self):
return ("<{} object... |
scrypt/test_scrypt.py | sigmoid3/Dapper | 974 | 12629411 | <filename>scrypt/test_scrypt.py
from ethereum import tester as t
import sys
def log_listener(x):
if x['_event_type'] == 'BlockMixInput':
bminputs.append(x['data'])
print len(bminputs), x
else:
print x
s = t.state()
bminputs = []
print 'Creating contract'
c = s.abi_contract('scrypt.se.py'... |
test_frame/test_decorator_run_example/test_common_no_decorator_example.py | piaoxue1949/distributed_framework | 333 | 12629424 | <filename>test_frame/test_decorator_run_example/test_common_no_decorator_example.py
"""
测试非装饰器版本方式,注意对比装饰器版本test_decorator_task_example.py
"""
from function_scheduling_distributed_framework import get_consumer
def f(a, b):
print(a + b)
consumer = get_consumer('queue_test_f01', consuming_function=f, qps=0.2, br... |
tests/test_utils/test_general_data.py | JustWeZero/mmdetection | 20,190 | 12629430 | import copy
import numpy as np
import pytest
import torch
from mmdet.core import GeneralData, InstanceData
def _equal(a, b):
if isinstance(a, (torch.Tensor, np.ndarray)):
return (a == b).all()
else:
return a == b
def test_general_data():
# test init
meta_info = dict(
img_s... |
nmt/model.py | ujos89/DualRL | 293 | 12629441 | <gh_stars>100-1000
import tensorflow as tf
import opennmt as onmt
from utils import constants
from opennmt.layers.common import embedding_lookup
from utils import optim
class NMT(object):
"""A sequence-to-sequence model."""
def __init__(self, mode, params, src_vocab_size, tgt_vocab_size,
src... |
traffic/data/eurocontrol/aixm/navpoints.py | xoolive/traffic | 209 | 12629446 | import logging
import zipfile
from pathlib import Path
from typing import Any, Dict, List, Optional, Type, TypeVar, Union
from lxml import etree
import pandas as pd
from ...basic.navaid import Navaids
# https://github.com/python/mypy/issues/2511
T = TypeVar("T", bound="AIXMNavaidParser")
class AIXMNavaidParser(Na... |
data/transcoder_evaluation_gfg/python/LCS_FORMED_CONSECUTIVE_SEGMENTS_LEAST_LENGTH_K.py | mxl1n/CodeGen | 241 | 12629484 | # Copyright (c) 2019-present, Facebook, Inc.
# All rights reserved.
#
# This source code is licensed under the license found in the
# LICENSE file in the root directory of this source tree.
#
def f_gold ( k , s1 , s2 ) :
n = len ( s1 )
m = len ( s2 )
lcs = [ [ 0 for x in range ( m + 1 ) ] for y in range ( n... |
core/run/profiler/pytroch.py | zhangzhengde0225/SwinTrack | 143 | 12629493 | import torch
from torch.profiler import profile, ProfilerActivity, tensorboard_trace_handler
class PytorchProfiler:
def __init__(self, output_path, device: str):
profile_activities = [ProfilerActivity.CPU]
if 'cuda' in device:
profile_activities += [ProfilerActivity.CUDA]
self.... |
deephyper/evaluator/_encoder.py | felixeperez/deephyper | 185 | 12629516 | <filename>deephyper/evaluator/_encoder.py
from inspect import isclass
import json
import types
import uuid
import ConfigSpace as cs
import ConfigSpace.hyperparameters as csh
import skopt
from ConfigSpace.read_and_write import json as cs_json
from numpy import bool_, floating, integer, ndarray
class Encoder(json.JSON... |
v3/as_demos/aledflash.py | Dilepa/micropython-async | 443 | 12629526 | # aledflash.py Demo/test program for MicroPython asyncio
# Author: <NAME>
# Copyright <NAME> 2020 Released under the MIT license
# Flashes the onboard LED's each at a different rate. Stops after ten seconds.
# Run on MicroPython board bare hardware
import pyb
import uasyncio as asyncio
async def toggle(objLED, time_m... |
oscar/run_oscarplus_pretrain.py | ruotianluo/Oscar | 828 | 12629543 | <reponame>ruotianluo/Oscar<gh_stars>100-1000
from __future__ import absolute_import, division, print_function
import argparse
import datetime
import json
import logging
import os
import random
import sys
import time
import math
import shutil
sys.path.insert(0, '.')
import numpy as np
import torch
from oscar.modelin... |
ydkgen/printer/printer_factory.py | YDK-Solutions/ydk | 125 | 12629544 | # ----------------------------------------------------------------
# Copyright 2016 Cisco Systems
#
# 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/LICENS... |
classes/mediainfo.py | tmcdonagh/Autorippr | 162 | 12629545 | # -*- coding: utf-8 -*-
"""
Created on Mon Jan 09 11:20:23 2017
Dependencies:
System:
mediainfo
mkvtoolnix
Python (nonstandard library):
pymediainfo
For Windows, if mediainfo or mkvpropedit aren't in PATH, must give path to .dll (mediainfo)
or .exe (mkvpropedit) file
For *nixs, use path to... |
pvlib/tests/test_snow.py | JackKelly/pvlib-python | 695 | 12629554 | <gh_stars>100-1000
import numpy as np
import pandas as pd
from .conftest import assert_series_equal
from pvlib import snow
from pvlib.tools import sind
def test_fully_covered_nrel():
dt = pd.date_range(start="2019-1-1 12:00:00", end="2019-1-1 18:00:00",
freq='1h')
snowfall_data = pd.S... |
test-crates/pyo3-ffi-pure/check_installed/check_installed.py | Contextualist/maturin | 135 | 12629562 | <reponame>Contextualist/maturin<filename>test-crates/pyo3-ffi-pure/check_installed/check_installed.py<gh_stars>100-1000
#!/usr/bin/env python3
import pyo3_ffi_pure
assert pyo3_ffi_pure.sum(2, 40) == 42
print("SUCCESS")
|
Language Skills/Python/Unit 02 Strings and Console Output/02 Date and Time/2-Getting the current date and time.py | rhyep/Python_tutorials | 346 | 12629567 | from datetime import datetime
now = datetime.now()
print now
|
api-inference-community/docker_images/generic/tests/test_api_text_to_speech.py | mlonaws/huggingface_hub | 362 | 12629573 | <reponame>mlonaws/huggingface_hub<filename>api-inference-community/docker_images/generic/tests/test_api_text_to_speech.py
import os
from unittest import TestCase, skipIf
from api_inference_community.validation import ffmpeg_read
from starlette.testclient import TestClient
from tests.test_api import TESTABLE_MODELS
@... |
tests/test_basic.py | tolomea/django-auto-prefetch | 127 | 12629582 | <filename>tests/test_basic.py<gh_stars>100-1000
import gc
import pickle
import pytest
from django.core.exceptions import ObjectDoesNotExist
import auto_prefetch
from . import models
def test_check_meta_inheritance_fail():
class TestModelBase(auto_prefetch.Model):
class Meta:
abstract = True... |
ufora/util/PythonCodeUtils.py | ufora/ufora | 571 | 12629583 | <filename>ufora/util/PythonCodeUtils.py
# Copyright 2015 Ufora 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 r... |
PyObjCTest/test_nsmetadata.py | Khan/pyobjc-framework-Cocoa | 132 | 12629636 | from Foundation import *
from PyObjCTools.TestSupport import *
try:
unicode
except NameError:
unicode = str
class TestNSMetaData (TestCase):
def testConstants(self):
self.assertIsInstance(NSMetadataQueryDidStartGatheringNotification, unicode)
self.assertIsInstance(NSMetadataQueryGatheringP... |
common/utils/manopth/mano/webuser/posemapper.py | Alan-delete/I2L-MeshNet_RELEASE | 544 | 12629682 | '''
Copyright 2017 <NAME>, <NAME>, <NAME> and the Max Planck Gesellschaft. All rights reserved.
This software is provided for research purposes only.
By using this software you agree to the terms of the MANO/SMPL+H Model license here http://mano.is.tue.mpg.de/license
More information about MANO/SMPL+H is available at... |
notebook/opencv_videocapture_play_cam.py | vhn0912/python-snippets | 174 | 12629699 | import cv2
import sys
camera_id = 0
delay = 1
window_name = 'frame'
cap = cv2.VideoCapture(camera_id)
if not cap.isOpened():
sys.exit()
while True:
ret, frame = cap.read()
cv2.imshow(window_name, frame)
if cv2.waitKey(delay) & 0xFF == ord('q'):
break
cv2.destroyWindow(window_name)
|
app/config/__init__.py | kaczmarj/grand-challenge.org | 101 | 12629703 | <gh_stars>100-1000
from django.conf import settings
from config.celery import celery_app
__all__ = ["celery_app"]
def toolbar_callback(*_, **__):
return settings.DEBUG and settings.ENABLE_DEBUG_TOOLBAR
|
renderer/od_renderer.py | archonic/frankmocap | 1,612 | 12629746 | # Copyright (c) Facebook, Inc. and its affiliates.
"""
Renders mesh using OpenDr / Pytorch-3d for visualization.
Part of code is modified from https://github.com/akanazawa/hmr
"""
import sys
import numpy as np
import cv2
import pdb
from PIL import Image, ImageDraw
from opendr.camera import ProjectPoints
from opendr.r... |
h2o-py/tests/testdir_algos/glm/pyunit_solvers_glm.py | ahmedengu/h2o-3 | 6,098 | 12629754 | from __future__ import print_function
import sys
from h2o.exceptions import H2OResponseError
sys.path.insert(1,"../../../")
import h2o
from tests import pyunit_utils
from h2o.estimators.glm import H2OGeneralizedLinearEstimator
def glm_solvers():
predictors = ["displacement","power","weight","acceleration","year"]... |
housekeeping/filter_compile_commands.py | Alexey-N-Chernyshov/cpp-libp2p | 135 | 12629792 | <gh_stars>100-1000
#!/usr/bin/env python3
import sys
import json
import argparse
from pathlib import Path
import re
def remove_non_whitelist(wl):
def f(x):
for w in wl:
if w in x['file']:
print("selected for analysis: {}".format(w))
return True
return F... |
src/python/nimbusml/examples/PrefixColumnConcatenator.py | montehoover/NimbusML | 134 | 12629800 | <filename>src/python/nimbusml/examples/PrefixColumnConcatenator.py<gh_stars>100-1000
###############################################################################
# PrefixColumnConcatenator
import numpy as np
import pandas as pd
from nimbusml.preprocessing.schema import PrefixColumnConcatenator
data = pd.DataFrame(
... |
evennia/web/utils/general_context.py | Jaykingamez/evennia | 1,544 | 12629816 | #
# This file defines global variables that will always be
# available in a view context without having to repeatedly
# include it. For this to work, this file is included in
# the settings file, in the TEMPLATE_CONTEXT_PROCESSORS
# tuple.
#
import os
from django.conf import settings
from evennia.utils.utils import ge... |
tests/components/mythicbeastsdns/__init__.py | domwillcode/home-assistant | 30,023 | 12629820 | <gh_stars>1000+
"""Tests for the mythicbeastsdns component."""
|
src/websockets/http.py | m-novikov/websockets | 3,909 | 12629858 | <reponame>m-novikov/websockets<filename>src/websockets/http.py
from __future__ import annotations
import sys
from .imports import lazy_import
from .version import version as websockets_version
# For backwards compatibility:
lazy_import(
globals(),
# Headers and MultipleValuesError used to be defined in th... |
setup.py | salesforce/provis | 244 | 12629862 | <reponame>salesforce/provis
# -*- coding: utf-8 -*-
from setuptools import setup, find_packages
with open('requirements.txt', 'r') as reqs:
requirements = reqs.read().split()
setup(
name='provis',
packages=["protein_attention"],
version='0.0.1',
install_requires=requirements,
) |
lib-other/deterministiclib/CustomMath_test.py | endolith/Truthcoin | 161 | 12629886 | <reponame>endolith/Truthcoin
def test_GetWeight():
print(GetWeight([1,1,1,1]))
# [1] 0.25 0.25 0.25 0.25
print(GetWeight([10,10,10,10]))
# [1] 0.25 0.25 0.25 0.25
print(GetWeight([4,5,6,7]))
# [1] 0.1818182 0.2272727 0.2727273 0.3181818
print(GetWeight([4,5,6,7], True))
# [1] 0.2159091 0... |
tests/test_mdp.py | bgalbraith/macarico | 121 | 12629910 | <reponame>bgalbraith/macarico<gh_stars>100-1000
from __future__ import division, generators, print_function
import random
import torch
import torch.nn as nn
import torch.nn.functional as F
from torch.autograd import Variable as Var
import macarico.util
macarico.util.reseed()
from macarico.annealing import Exponentia... |
parallelformers/policies/blenderbot_small.py | Oaklight/parallelformers | 454 | 12629921 | <reponame>Oaklight/parallelformers
# Copyright 2021 TUNiB 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... |
jirafs/commands/debug.py | coddingtonbear/jirafs | 119 | 12629927 | from jirafs.plugin import CommandPlugin
try:
import ipdb as pdb # noqa
except ImportError:
import pdb
class Command(CommandPlugin):
""" Open a debug console """
MIN_VERSION = "2.0.0"
MAX_VERSION = "3.0.0"
def main(self, folder, **kwargs):
return pdb.set_trace()
|
rdkit/ML/Neural/NetNode.py | kazuyaujihara/rdkit | 1,609 | 12629930 | #
# Copyright (C) 2000-2008 <NAME>
#
""" Contains the class _NetNode_ which is used to represent nodes in neural nets
**Network Architecture:**
A tacit assumption in all of this stuff is that we're dealing with
feedforward networks.
The network itself is stored as a list of _NetNode_ objects. The list
is ... |
scripts/seastar-json2code.py | liubangchen/seastar | 6,526 | 12629935 | #!/usr/bin/env python3
# C++ Code generation utility from Swagger definitions.
# This utility support Both the swagger 1.2 format
# https://github.com/OAI/OpenAPI-Specification/blob/master/versions/1.2.md
# And the 2.0 format
# https://github.com/OAI/OpenAPI-Specification/blob/master/versions/2.0.md
#
# Swagger... |
cisco-ios-xe/ydk/models/cisco_ios_xe/CISCO_SUBSCRIBER_SESSION_TC_MIB.py | Maikor/ydk-py | 177 | 12629977 | <filename>cisco-ios-xe/ydk/models/cisco_ios_xe/CISCO_SUBSCRIBER_SESSION_TC_MIB.py
""" CISCO_SUBSCRIBER_SESSION_TC_MIB
This MIB module defines textual conventions describing
subscriber sessions.
"""
from collections import OrderedDict
from ydk.types import Entity, EntityPath, Identity, Enum, YType, YLeaf, YLeafList,... |
examples/BERT/mlm_task_adaptdl.py | jessezbj/adaptdl | 294 | 12629978 | import argparse
import time
import math
import torch
import torch.nn as nn
from model import MLMTask
from utils import run_demo, run_ddp, wrap_up
import torch.distributed as dist
from torch.nn.parallel import DistributedDataParallel as DDP
from torch.utils.tensorboard import SummaryWriter # Added for tensorbo... |
evaluation/lfw-classification-unknown.py | ammogcoder/openface | 15,684 | 12629979 | #!/usr/bin/env python2
#
# This files can be used to benchmark different classifiers
# on lfw dataset with known and unknown dataset.
# More info at: https://github.com/cmusatyalab/openface/issues/144
# <NAME> & <NAME>
# 2016/06/28
#
# Copyright 2015-2016 Carnegie Mellon University
#
# Licensed under the Apache License... |
examples/serialized.py | wyfo/apimodel | 118 | 12630014 | <gh_stars>100-1000
from dataclasses import dataclass
from apischema import serialize, serialized
from apischema.json_schema import serialization_schema
@dataclass
class Foo:
@serialized
@property
def bar(self) -> int:
return 0
# Serialized method can have default argument
@serialized
... |
2021/05/24/Using Async Functions Inside of Flask Routes/flaskasync/auth.py | Ujjawal-Rajput/yes | 492 | 12630023 | <reponame>Ujjawal-Rajput/yes
APIKEY = 'YOUR API KEY'
auth=("live_yourapikey", "") |
hikyuu/draw/drawplot/matplotlib_draw.py | kknet/hikyuu | 1,283 | 12630029 | <gh_stars>1000+
# -*- coding: utf8 -*-
# cp936
"""
交互模式下绘制相关图形,如K线图,美式K线图
"""
import sys
import datetime
import numpy as np
import matplotlib
from pylab import Rectangle, gca, figure, ylabel, axes, draw
from matplotlib.lines import Line2D, TICKLEFT, TICKRIGHT
from matplotlib.ticker import FuncFormatter, FixedLocator
f... |
flask_admin/model/template.py | caffeinatedMike/flask-admin | 4,440 | 12630048 | <reponame>caffeinatedMike/flask-admin<filename>flask_admin/model/template.py
from flask_admin._compat import pass_context, string_types, reduce
from flask_admin.babel import gettext
class BaseListRowAction(object):
def __init__(self, title=None):
self.title = title
def render(self, context, row_id, r... |
Chapter4/LeNet/data.py | zxjzxj9/PyTorchIntroduction | 205 | 12630053 | <filename>Chapter4/LeNet/data.py<gh_stars>100-1000
""" 该代码用于LeNet的训练数据集MNIST的载入
"""
from torchvision.datasets import MNIST
import torchvision.transforms as transforms
from torch.utils.data import DataLoader
data_train = MNIST('./data',
download=True,
transform=transforms.Compose(... |
airmozilla/starred/views.py | mozilla/airmozilla | 115 | 12630074 | <reponame>mozilla/airmozilla<gh_stars>100-1000
import collections
from django import http
from django.db.models import Q
from django.shortcuts import render
from django.views.decorators import cache
from django.core.urlresolvers import reverse
from session_csrf import anonymous_csrf
from jsonview.decorators import js... |
scripts/print_go_ast_as_python.py | voiski/pytago | 206 | 12630087 | """
Dirty script to help generate go_ast code from an actual Go AST.
Paste go code into https://lu4p.github.io/astextract/ and then the AST here.
"""
AST = r"""
&ast.CallExpr {
Fun: &ast.FuncLit {
Type: &ast.FuncType {
Params: &ast.FieldList {
List: []*ast.Field {
&ast.Field {
... |
moveit_commander/src/moveit_commander/__init__.py | Bhavam/moveit | 1,116 | 12630098 | <gh_stars>1000+
from .exception import *
from .roscpp_initializer import *
from .planning_scene_interface import *
from .move_group import *
from .robot import *
from .interpreter import *
|
paperboy/scheduler/luigi/luigi_tasks/common.py | chris-aeviator/paperboy | 233 | 12630106 | import logging
from luigi import Task
from luigi.parameter import Parameter, DateParameter, ParameterVisibility
class BaseTask(Task):
task_id = Parameter()
def __init__(self, *args, **kwargs):
super(BaseTask, self).__init__(*args, **kwargs)
self._reqs = []
self.log = logging # FIXME
... |
aeroot/__init__.py | CKAndroidProject/AERoot | 116 | 12630114 | <reponame>CKAndroidProject/AERoot<filename>aeroot/__init__.py
"""
AERoot module
"""
__version__ = "0.3.2"
|
detector/ctpn/train.py | qiu9yu/Lets_OCR | 671 | 12630118 | import torch.optim as optim
import torch
import cv2
import lib.tag_anchor
import lib.generate_gt_anchor
import lib.dataset_handler
import lib.utils
import numpy as np
import os
import Net.net as Net
import Net.loss as Loss
import ConfigParser
import time
import evaluate
import logging
import datetime
import copy
import... |
test_custom/models.py | AllFactors/django-organizations | 855 | 12630121 | <gh_stars>100-1000
from django.db import models
from organizations.models import Organization
class Team(Organization):
sport = models.CharField(max_length=100, blank=True, null=True)
|
pycoinnet/helpers/standards.py | Jsn2win/pycoinnet | 114 | 12630125 | import asyncio
import logging
import os
import time
from pycoinnet.PeerAddress import PeerAddress
logging = logging.getLogger("standards")
class BitcoinProtocolError(Exception):
pass
def manage_connection_count(host_port_queue, protocol_factory, connection_count=4):
"""
address_queue: a queue of (host... |
integration/tests/error_assert_file.py | youhavethewrong/hurl | 1,013 | 12630127 | from tests import app
@app.route("/error-assert-file")
def error_assert_file():
return 'Hello' |
tests/test_normalise.py | ecmwf/climetlab | 182 | 12630148 | #!/usr/bin/env python3
# (C) Copyright 2020 ECMWF.
#
# This software is licensed under the terms of the Apache Licence Version 2.0
# which can be obtained at http://www.apache.org/licenses/LICENSE-2.0.
# In applying this licence, ECMWF does not waive the privileges and immunities
# granted to it by virtue of its statu... |
tests_nntrainer/test_types.py | mzolfaghari/coot-videotext | 213 | 12630149 | """
Test types.
"""
import json
import tempfile
from pathlib import Path
import pydantic
import pytest
import torch as th
from nntrainer import typext
def test_typednamedtuple() -> None:
"""
Test typed named tuples class based on pydantic.BaseModel
"""
class ExampleTuple(typext... |
test/hummingbot/connector/derivative/bybit_perpetual/test_bybit_perpetual_utils.py | BGTCapital/hummingbot | 3,027 | 12630152 | import pandas as pd
from unittest import TestCase
from unittest.mock import patch
from hummingbot.connector.derivative.bybit_perpetual import bybit_perpetual_constants as CONSTANTS, bybit_perpetual_utils as utils
class BybitPerpetualUtilsTests(TestCase):
@patch('hummingbot.connector.derivative.bybit_perpetual.b... |
dfvfs/vfs/gzip_file_entry.py | dfjxs/dfvfs | 176 | 12630157 | # -*- coding: utf-8 -*-
"""The gzip file entry implementation."""
from dfdatetime import posix_time as dfdatetime_posix_time
from dfvfs.lib import definitions
from dfvfs.lib import errors
from dfvfs.resolver import resolver
from dfvfs.vfs import root_only_file_entry
class GzipFileEntry(root_only_file_entry.RootOnly... |
third_party/boringssl/BUILD.generated_tests.bzl | brandonpollack23/bazel-buildfiles-upstream | 142 | 12630170 | <reponame>brandonpollack23/bazel-buildfiles-upstream
# This file is created by generate_build_files.py. Do not edit manually.
test_support_sources = [
"src/crypto/test/file_test.cc",
"src/crypto/test/test_util.cc",
]
def create_tests(copts):
test_support_sources_complete = test_support_sources + \
nat... |
test/nnUNetV1/network_training/nnUNetTrainer_pGDice.py | jianhuasong/medical-image-segmentation2 | 2,774 | 12630183 | from nnunet.training.loss_functions.dice_loss import PenaltyGDiceLoss
from nnunet.training.network_training.nnUNetTrainer import nnUNetTrainer
from nnunet.utilities.nd_softmax import softmax_helper
class nnUNetTrainer_pGDice(nnUNetTrainer):
def __init__(self, plans_file, fold, output_folder=None, dataset_director... |
tests/apis/test_default_namespace.py | tavaresrodrigo/kopf | 855 | 12630200 | from kopf._cogs.clients.api import get_default_namespace
async def test_default_namespace_when_unset(mocker, enforced_context):
mocker.patch.object(enforced_context, 'default_namespace', None)
ns = await get_default_namespace()
assert ns is None
async def test_default_namespace_when_set(mocker, enforced... |
examples/from-wiki/gl_interop.py | hesom/pycuda | 1,264 | 12630207 | #!python
# GL interoperability example, by <NAME>.
# Draws a rotating teapot, using cuda to invert the RGB value
# each frame
from OpenGL.GL import *
from OpenGL.GLUT import *
from OpenGL.GLU import *
from OpenGL.GL.ARB.vertex_buffer_object import *
from OpenGL.GL.ARB.pixel_buffer_object import *
import numpy, sys,... |
alipay/aop/api/domain/BusinessLicenceInfo.py | snowxmas/alipay-sdk-python-all | 213 | 12630212 | #!/usr/bin/env python
# -*- coding: utf-8 -*-
import json
from alipay.aop.api.constant.ParamConstants import *
class BusinessLicenceInfo(object):
def __init__(self):
self._business_license_auth_pic = None
self._business_license_city = None
self._business_license_indate = None
sel... |
autobahn/wamp/gen/wamp/proto/DealerFeatures.py | rapyuta-robotics/autobahn-python | 1,670 | 12630213 | # automatically generated by the FlatBuffers compiler, do not modify
# namespace: proto
import flatbuffers
class DealerFeatures(object):
__slots__ = ['_tab']
@classmethod
def GetRootAsDealerFeatures(cls, buf, offset):
n = flatbuffers.encode.Get(flatbuffers.packer.uoffset, buf, offset)
x ... |
towhee/models/layers/convmlp.py | ThyeeZz/towhee | 365 | 12630237 | # Copyright 2021 <NAME> and Zilliz. 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 l... |
src/python/pants/build_graph/build_file_aliases_test.py | yoav-orca/pants | 1,806 | 12630241 | # Copyright 2014 Pants project contributors (see CONTRIBUTORS.md).
# Licensed under the Apache License, Version 2.0 (see LICENSE).
import pytest
from pants.build_graph.build_file_aliases import BuildFileAliases
class TestBuildFileAliasesTest:
def test_create(self):
assert BuildFileAliases(objects={}, c... |
tools/perf/metrics/cpu_unittest.py | google-ar/chromium | 2,151 | 12630244 | <reponame>google-ar/chromium
# Copyright 2013 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.
import unittest
from metrics import cpu
# Testing private method.
# pylint: disable=protected-access
class CpuMetricTest(uni... |
book/src/ch02/src/sequences.py | zangyuchen2008/Clean-Code-in-Python-Second-Edition | 133 | 12630249 | """Clean Code in Python - Chapter 2: Pythonic Code
> Sequences
"""
from collections.abc import Sequence
class Items(Sequence):
def __init__(self, *values):
self._values = list(values)
def __len__(self):
return len(self._values)
def __getitem__(self, item):
return self._values.__... |
contrib/cryptsetup/tests/fileDiffer.py | lambdaxymox/DragonFlyBSD | 432 | 12630253 | <reponame>lambdaxymox/DragonFlyBSD
#!/usr/bin/env python
#
# Usage: fileDiffer <afile> <bfile> <list of disk changes>
#
# LUKS
# quick regression test suite
# Tests LUKS images for changes at certain disk offsets
#
# Does fast python code has to look ugly or is it just me?
import sys
class changes:
pass
def par... |
securetea/lib/malware_analysis/malwareAnalysisJSONDisplay.py | Off3nsiv3huNt/SecureTea-Project | 257 | 12630263 | # !/bin/python
# -*- coding: utf-8 -*-
u"""SecureTea Social Engineering
Project:
╔═╗┌─┐┌─┐┬ ┬┬─┐┌─┐╔╦╗┌─┐┌─┐
╚═╗├┤ │ │ │├┬┘├┤ ║ ├┤ ├─┤
╚═╝└─┘└─┘└─┘┴└─└─┘ ╩ └─┘┴ ┴
Author: <NAME> <<EMAIL>> August 16 2021
Version: 1.0
Module: SecureTea
"""
import json
import pandas
from securetea.lib.malware_an... |
exercises/zh/test_03_11.py | Jette16/spacy-course | 2,085 | 12630278 | <reponame>Jette16/spacy-course<filename>exercises/zh/test_03_11.py
def test():
assert Span.has_extension(
"wikipedia_url"
), "你有在span上注册这个扩展吗?"
ext = Span.get_extension("wikipedia_url")
assert ext[2] is not None, "你有正确设置getter吗?"
assert (
"getter=get_wikipedia_url" in __solution__
... |
util/config/fixpath.py | jhh67/chapel | 1,602 | 12630321 | #!/usr/bin/env python3
"""Removes path components that begin with $CHPL_HOME from the given path.
./fixpath.py path-value [--shell shell]
Example:
./fixpath.py "$PATH"
./fixpath.py \\" $PATH \\" --shell=fish
This is used by the setchplenv.* scripts to reduce PATH/MANPATH pollution. It
may be called in ... |
nel/__main__.py | psyML/nel | 196 | 12630344 | <reponame>psyML/nel
#!/usr/bin/env python
import argparse
import re
import sys
import textwrap
from .corpora import prepare, analysis, visualise
from .harness import harness
from .learn import ranking, resolving, recognition
from .process.process import CorpusProcessor
from .process.tag import Tagger
from .process.ca... |
instant/tests/test_utils.py | synw/django-instant | 103 | 12630361 | <gh_stars>100-1000
from .base import InstantBaseTest
from instant.init import ensure_channel_is_private
class InstantTestUtils(InstantBaseTest):
def test_ensure_channel_is_private(self):
name = ensure_channel_is_private("$chan")
self.assertEqual(name, "$chan")
name = ensure_channel_is_pri... |
mobilenet_v2.py | Lehar24/mobile-deeplab-v3-plus | 166 | 12630373 | """MobileNet v2 model
# Reference
- [Inverted Residuals and Linear Bottlenecks Mobile Networks for
Classification, Detection and Segmentation]
(https://arxiv.org/abs/1801.04381)
"""
import os
import tensorflow as tf
import layers
from utils import op
def _make_divisible(v, divisor, min_value=None):
if min... |
pokemongo_bot/navigation/path_finder/path_finder.py | golem4300/quattran | 183 | 12630390 | <reponame>golem4300/quattran
class PathFinder(object):
"""
Abstract class for a path finder
"""
def __init__(self, config):
# type: (Namespace, Stepper) -> None
self.config = config
def path(self, from_lat, form_lng, to_lat, to_lng): # pragma: no cover
# type: (float, ... |
hw/ip/otbn/dv/rig/rig/gens/known_wdr.py | asb/opentitan | 1,375 | 12630396 | # Copyright lowRISC contributors.
# Licensed under the Apache License, Version 2.0, see LICENSE for details.
# SPDX-License-Identifier: Apache-2.0
from typing import Optional
from shared.operand import EnumOperandType, ImmOperandType, RegOperandType
from shared.insn_yaml import InsnsFile
from ..config import Config
... |
pylayers/mobility/ban/test/test_DeuxSeg.py | usmanwardag/pylayers | 143 | 12630399 | <gh_stars>100-1000
import numpy as np
from pylayers.mobility.ban.DeuxSeg import *
N=5
M=10
A = np.random.rand(3,N)
B = np.random.rand(3,N)
C = np.random.rand(3,M)
D = np.random.rand(3,M)
alpha,beta,dmin = dmin3d(A,B,C,D)
f,g = dist(A,B,C,D,alpha,beta)
## verif:
aa=np.empty((N,M))
bb=np.empty((N,M))
dd=np.empt... |
babi/data/rnn_preprocess.py | zlgenuine/GGNN | 280 | 12630436 | <filename>babi/data/rnn_preprocess.py<gh_stars>100-1000
"""
Preprocess data for RNN training.
<NAME>, 10/2015
"""
import numpy as np
import argparse
def convert_graph_data(infile, outfile, n_val=0, n_train=0):
data_list = []
with open(infile, 'r') as f:
edges = []
questions = []
for l... |
qiskit_nature/problems/sampling/protein_folding/bead_contacts/contact_map.py | jschuhmac/qiskit-nature | 132 | 12630448 | # This code is part of Qiskit.
#
# (C) Copyright IBM 2021.
#
# 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.
#
# Any modifications or derivative wo... |
libs/sqlobject/tests/test_converters.py | scambra/HTPC-Manager | 422 | 12630498 | from datetime import timedelta
import sys
from sqlobject.converters import registerConverter, sqlrepr, \
quote_str, unquote_str
from sqlobject.sqlbuilder import SQLExpression, SQLObjectField, \
Select, Insert, Update, Delete, Replace, \
SQLTrueClauseClass, SQLConstant, SQLPrefix, SQLCall, SQLOp, \
... |
fairness/algorithms/kamishima/kamfadm-2012ecmlpkdd/fadm/eval/_bin_class.py | yashwarlord/fairness-comparison | 146 | 12630538 | #!/usr/bin/env python
# -*- coding: utf-8 -*-
"""
import from 50b745c1d18d5c4b01d9d00e406b5fdaab3515ea @ KamLearn
Compute various statistics between estimated and correct classes in binary
cases
"""
from __future__ import print_function
from __future__ import division
from __future__ import unicode_literals
#=======... |
Z - Tool Box/x2john/known_hosts2john.py | dfirpaul/Active-Directory-Exploitation-Cheat-Sheet-1 | 1,290 | 12630540 | <filename>Z - Tool Box/x2john/known_hosts2john.py
#!/usr/bin/env python
# known_hosts2john processes input "known_hosts" files into a format suitable
# for use with JtR.
#
# This software is Copyright (c) 2014, <NAME> <dhiru [at] openwall.com>
#
# This code may be freely used and modified for any purpose.
import sys
... |
scripts/interleave-reads.py | sadeepdarshana/khmer | 558 | 12630564 | #! /usr/bin/env python
# This file is part of khmer, https://github.com/dib-lab/khmer/, and is
# Copyright (C) 2011-2015, Michigan State University.
# Copyright (C) 2015, The Regents of the University of California.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted pro... |
util.py | darshanajaint/scene-representation-networks | 349 | 12630567 | import os, struct, math
import numpy as np
import torch
from glob import glob
import cv2
import torch.nn.functional as F
import matplotlib.pyplot as plt
from mpl_toolkits.axes_grid1 import make_axes_locatable
def get_latest_file(root_dir):
"""Returns path to latest file in a directory."""
list_of_files = gl... |
test/api/test_api_message.py | thenetcircle/dino | 150 | 12630615 | <gh_stars>100-1000
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distr... |
model.py | WangYueFt/prnet | 105 | 12630623 | #!/usr/bin/env python
# -*- coding: utf-8 -*-
import os
import sys
import glob
import h5py
import copy
import math
import json
import numpy as np
from tqdm import tqdm
import torch
import torch.nn as nn
import torch.nn.functional as F
from sklearn.metrics import r2_score
from util import transform_point_cloud, npmat2... |
regtests/bench/copy_list.py | ahakingdom/Rusthon | 622 | 12630624 | '''copy list micro benchmark'''
from time import time
def main():
if PYTHON=='PYTHONJS':
pythonjs.configure( direct_operator='+' )
pythonjs.configure( direct_keys=True )
pass
a = list(range(1000))
times = []
for i in range(4):
t0 = time()
res = copy_list(a, 10000)
tk = time()
times.append(tk - t0)
... |
bindings/python/cntk/io/tests/io_tests.py | shyamalschandra/CNTK | 17,702 | 12630625 | <filename>bindings/python/cntk/io/tests/io_tests.py
# Copyright (c) Microsoft. All rights reserved.
# Licensed under the MIT license. See LICENSE.md file in the project root
# for full license information.
# ==============================================================================
import numpy as np
import cntk... |
tests/openbb_terminal/stocks/fundamental_analysis/test_av_model.py | tehcoderer/GamestonkTerminal | 255 | 12630631 | # IMPORTATION STANDARD
# IMPORTATION THIRDPARTY
import pytest
# IMPORTATION INTERNAL
from openbb_terminal.stocks.fundamental_analysis import av_model
@pytest.fixture(scope="module")
def vcr_config():
return {
"filter_headers": [("User-Agent", None)],
"filter_query_parameters": [
("ap... |
628 Maximum Product of Three Numbers.py | krishna13052001/LeetCode | 872 | 12630660 | <reponame>krishna13052001/LeetCode
#!/usr/bin/python3
"""
Given an integer array, find three numbers whose product is maximum and output
the maximum product.
Example 1:
Input: [1,2,3]
Output: 6
Example 2:
Input: [1,2,3,4]
Output: 24
Note:
The length of the given array will be in range [3,104] and all elements a... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.