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 |
|---|---|---|---|---|
unit_test/options_test.py | bbayles/cibuildwheel | 371 | 42115 | import platform as platform_module
import pytest
from cibuildwheel.__main__ import get_build_identifiers
from cibuildwheel.environment import parse_environment
from cibuildwheel.options import Options, _get_pinned_docker_images
from .utils import get_default_command_line_arguments
PYPROJECT_1 = """
[tool.cibuildwhe... |
tests/starkex/test_helpers.py | clifton/dydx-v3-python | 109 | 42125 | <gh_stars>100-1000
from dydx3.starkex.helpers import fact_to_condition
from dydx3.starkex.helpers import generate_private_key_hex_unsafe
from dydx3.starkex.helpers import get_transfer_erc20_fact
from dydx3.starkex.helpers import nonce_from_client_id
from dydx3.starkex.helpers import private_key_from_bytes
from dydx3.st... |
plugins/custom_resolver/run_test/custom_resolver.py | jingtaoh/USD-Cookbook | 332 | 42153 | <reponame>jingtaoh/USD-Cookbook<gh_stars>100-1000
#!/usr/bin/env python
# -*- coding: utf-8 -*-
"""This module tests if the custom resolver works."""
# IMPORT FUTURE LIBRARIES
from __future__ import print_function
# IMPORT THIRD-PARTY LIBRARIES
from pxr import Ar
def main():
"""Run the main execution of the cu... |
caffe2/python/operator_test/jsd_ops_test.py | chocjy/caffe2 | 585 | 42188 | # Copyright (c) 2016-present, Facebook, Inc.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed... |
pandapower/shortcircuit/__init__.py | yougnen/pandapower | 104 | 42228 | from pandapower.shortcircuit.calc_sc import calc_sc
from pandapower.shortcircuit.toolbox import * |
test/test_simulation.py | andrea-simonetto/qiskit | 2,660 | 42230 | <gh_stars>1000+
# -*- coding: utf-8 -*-
# This code is part of Qiskit.
#
# (C) Copyright IBM 2018.
#
# 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.... |
ivy/test/afterinit1.py | b1f6c1c4/cfg-enum | 113 | 42268 |
from ivy import ivy_module as im
from ivy.ivy_compiler import ivy_from_string
from ivy.tk_ui import new_ui
from ivy import ivy_utils as iu
prog = """#lang ivy1.6
type t
individual x(X:t) : t
object foo(me:t) = {
after init {
x(me) := me;
assert false
}
}
isolate iso_foo(me:t) = foo(me) wit... |
blitzdb/fields/integer.py | marcinguy/blitzdb3 | 252 | 42277 | <gh_stars>100-1000
from .base import BaseField
class IntegerField(BaseField):
pass
|
cotk/scripts/resources.py | ishine/cotk | 117 | 42295 | '''
A command library help user upload their results to dashboard.
'''
#!/usr/bin/env python
import argparse
from ..file_utils import get_resource_file_path, get_resource_list
from . import cli_constant as cli
def entry(args):
'''Entrance of show resources path and whether resource is cached or not'''
resource_nam... |
examples/highfreq/highfreq_ops.py | wan9c9/qlib | 8,637 | 42326 | <filename>examples/highfreq/highfreq_ops.py<gh_stars>1000+
import numpy as np
import pandas as pd
import importlib
from qlib.data.ops import ElemOperator, PairOperator
from qlib.config import C
from qlib.data.cache import H
from qlib.data.data import Cal
from qlib.contrib.ops.high_freq import get_calendar_day
class D... |
test/unit/00.nop-commit.py | rescrv/Consus | 239 | 42333 | <gh_stars>100-1000
import consus
c1 = consus.Client()
t1 = c1.begin_transaction()
t1.commit()
c2 = consus.Client(b'127.0.0.1')
t2 = c1.begin_transaction()
t2.commit()
c3 = consus.Client('127.0.0.1')
t3 = c1.begin_transaction()
t3.commit()
c4 = consus.Client(b'127.0.0.1', 1982)
t4 = c1.begin_transaction()
t4.commit(... |
syzygy/scripts/benchmark/ibmperf_test.py | nzeh/syzygy | 343 | 42361 | #!/usr/bin/python2.6
# Copyright 2011 Google Inc. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required ... |
hypermax/optimizer.py | 00sapo/hypermax | 107 | 42415 | import hyperopt
import csv
import json
import traceback
import os.path
from pprint import pprint
import datetime
import time
import numpy.random
import threading
import queue
import copy
import tempfile
import random
import subprocess
import concurrent.futures
import tempfile
import functools
import math
import atexit
... |
alipay/aop/api/domain/AlipayCommerceTransportTaxiDriverlevelQueryModel.py | antopen/alipay-sdk-python-all | 213 | 42421 | #!/usr/bin/env python
# -*- coding: utf-8 -*-
import json
from alipay.aop.api.constant.ParamConstants import *
class AlipayCommerceTransportTaxiDriverlevelQueryModel(object):
def __init__(self):
self._channel = None
self._driver_name = None
self._driver_phone = None
self._ext_inf... |
selim_sef-solution/lucid/misc/io/__init__.py | Hulihrach/RoadDetector | 4,537 | 42424 | <reponame>Hulihrach/RoadDetector
from lucid.misc.io.showing import show
from lucid.misc.io.loading import load
from lucid.misc.io.saving import save, CaptureSaveContext, batch_save
from lucid.misc.io.scoping import io_scope, scope_url
|
Stephanie/local_libs/search_module.py | JeremyARussell/stephanie-va | 866 | 42469 | class SearchModule:
def __init__(self):
pass
def search_for_competition_by_name(self, competitions, query):
m, answer = self.search(competitions, attribute_name="caption", query=query)
if m == 0:
return False
return answer
def search_for_competition_by_code(self... |
drf_admin/apps/monitor/serializers/crud.py | guohaihan/myproject | 228 | 42490 | # -*- coding: utf-8 -*-
"""
@author : <NAME>
@github : https://github.com/tianpangji
@software : PyCharm
@file : crud.py
@create : 2020/12/9 20:44
"""
from django.contrib.contenttypes.models import ContentType
from easyaudit.models import CRUDEvent
from rest_framework import serializers
class CRUDSerializer... |
爬虫小demo/22 JDPython.py | lb2281075105/Python-Spider | 713 | 42499 | import time
from selenium import webdriver
from lxml import etree
driver = webdriver.PhantomJS(executable_path='./phantomjs-2.1.1-macosx/bin/phantomjs')
# 获取第一页的数据
def get_html():
url = "https://detail.tmall.com/item.htm?id=531993957001&skuId=3609796167425&user_id=268451883&cat_id=2&is_b=1&rn=71b9b0aeb233411c4f5... |
demo/cities/urls.py | mrmikardo/django-map-widgets | 425 | 42534 | <reponame>mrmikardo/django-map-widgets
from django.urls import path, re_path
from cities.views import CityCreateView, CityListView, CityDetailView
app_name = 'cities'
urlpatterns = [
path('', CityListView.as_view(), name="list"),
re_path(r'^(?P<pk>\d+)/$', CityDetailView.as_view(), name="detail"),
re_path... |
docker/GetAndResizeImages.py | vaquarkhan/ecs-refarch-batch-processing | 105 | 42588 | #!/usr/bin/env python
# Copyright 2016 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... |
theano/compile/tests/test_function_name.py | mdda/Theano | 295 | 42592 | <gh_stars>100-1000
import unittest
import os
import re
import theano
from theano import tensor
class FunctionName(unittest.TestCase):
def test_function_name(self):
x = tensor.vector('x')
func = theano.function([x], x + 1.)
regex = re.compile(os.path.basename('.*test_function_name.pyc?:1... |
util/data_type_util.py | Chandru01061997/pythonDB | 409 | 42601 | from uuid import UUID
from datetime import datetime
def uuid_from_string(string):
return UUID('{s}'.format(s=string))
def format_timestamp(string):
if isinstance(string, str):
return datetime.strptime(string, '%Y-%m-%dT%H:%M:%S.%fZ')
if isinstance(string, datetime):
return string
|
pushkin/util/__init__.py | Nordeus/pushkin | 281 | 42643 | from . import pool
from . import multiprocesslogging
from . import tools
|
tests/config_test.py | akshaysharma096/clusterman | 281 | 42646 | <reponame>akshaysharma096/clusterman
# 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 appli... |
mayan/apps/acls/permissions.py | eshbeata/open-paperless | 2,743 | 42648 | <filename>mayan/apps/acls/permissions.py
from __future__ import absolute_import, unicode_literals
from django.utils.translation import ugettext_lazy as _
from permissions import PermissionNamespace
namespace = PermissionNamespace('acls', _('Access control lists'))
permission_acl_edit = namespace.add_permission(
... |
src/orders/tests/order_content_type_replacement/tests_order_item.py | iNerV/education-backend | 151 | 42660 | <reponame>iNerV/education-backend<filename>src/orders/tests/order_content_type_replacement/tests_order_item.py<gh_stars>100-1000
import pytest
pytestmark = [pytest.mark.django_db]
def test_order_without_items(order):
order = order()
assert order.item is None
def test_order_with_record(order, record):
... |
codigo/Live102/exemplo_2.py | cassiasamp/live-de-python | 572 | 42689 |
from expects import expect, contain, be_an
class Bacon:
...
sanduiche = 'sanduiche com queijo'
expect(sanduiche).to(contain('queijo'))
expect(sanduiche).to_not(be_an(Bacon))
|
tartiflette/language/ast/base.py | remorses/tartiflette-whl | 530 | 42736 | <gh_stars>100-1000
__all__ = (
"Node",
"DefinitionNode",
"ExecutableDefinitionNode",
"TypeSystemDefinitionNode",
"TypeSystemExtensionNode",
"TypeDefinitionNode",
"TypeExtensionNode",
"SelectionNode",
"ValueNode",
"TypeNode",
)
class Node:
__slots__ = ()
class DefinitionNo... |
Chapter08/transformers_textgen.py | arifmudi/Advanced-Deep-Learning-with-Python | 107 | 42752 | <reponame>arifmudi/Advanced-Deep-Learning-with-Python
import torch
from transformers import TransfoXLLMHeadModel, TransfoXLTokenizer
device = torch.device("cuda:0" if torch.cuda.is_available() else "cpu")
# Instantiate pre-trained model-specific tokenizer and the model itself
tokenizer = TransfoXLTokenizer.from_pretr... |
nets/vgg.py | bubbliiiing/faster-rcnn-tf2 | 133 | 42760 | from tensorflow.keras.layers import (Conv2D, Dense, Flatten, MaxPooling2D,
TimeDistributed)
def VGG16(inputs):
x = Conv2D(64,(3,3),activation = 'relu',padding = 'same',name = 'block1_conv1')(inputs)
x = Conv2D(64,(3,3),activation = 'relu',padding = 'same', name = 'bl... |
notebooks-text-format/vdvae_jax_cifar_demo.py | arpitvaghela/probml-notebooks | 166 | 42804 | # ---
# jupyter:
# jupytext:
# text_representation:
# extension: .py
# format_name: light
# format_version: '1.5'
# jupytext_version: 1.11.3
# kernelspec:
# display_name: Python 3
# name: python3
# ---
# + [markdown] id="view-in-github" colab_type="text"
# <a href="https://colab... |
kivy/tests/pyinstaller/video_widget/main.py | Galland/kivy | 13,889 | 42807 | <reponame>Galland/kivy
from project import VideoApp
if __name__ == '__main__':
from kivy.core.video import Video
assert Video is not None
VideoApp().run()
|
scripts/ln_jnas_subset.py | nameless-writer/become-yukarin | 562 | 42817 | <gh_stars>100-1000
import argparse
import multiprocessing
from pathlib import Path
from jnas_metadata_loader import load_from_directory
from jnas_metadata_loader.jnas_metadata import JnasMetadata
parser = argparse.ArgumentParser()
parser.add_argument('jnas', type=Path)
parser.add_argument('output', type=Path)
parser.... |
speedtest/python3/speedtest.py | guyue/google-diff-match-patch | 304 | 42819 | #!/usr/bin/python3
#
# Copyright 2010 Google Inc.
# All Rights Reserved.
"""Diff Speed Test
"""
__author__ = "<EMAIL> (<NAME>)"
import imp
import gc
import sys
import time
import diff_match_patch as dmp_module
# Force a module reload. Allows one to edit the DMP module and rerun the test
# without leaving the Pytho... |
chap8/mxnet/benchmark_model.py | wang420349864/dlcv_for_beginners | 1,424 | 42826 | import time
import mxnet as mx
benchmark_dataiter = mx.io.ImageRecordIter(
path_imgrec="../data/test.rec",
data_shape=(1, 28, 28),
batch_size=64,
mean_r=128,
scale=0.00390625,
)
mod = mx.mod.Module.load('mnist_lenet', 35, context=mx.gpu(2))
mod.bind(
data_shapes=benchmark_dataiter.provide_data... |
www/apis.py | yumaojun03/blog-python-app | 200 | 42842 | <reponame>yumaojun03/blog-python-app
#!/usr/bin/env python
# -*- coding: utf-8 -*-
"""
实现以Json数据格式进行交换的RESTful API
设计原因:
由于API就是把Web App的功能全部封装了,所以,通过API操作数据,
可以极大地把前端和后端的代码隔离,使得后端代码易于测试,
前端代码编写更简单
实现方式:
一个API也是一个URL的处理函数,我们希望能直接通过一个@api来
把函数变成JSON格式的REST API, 因此我们需要实现一个装饰器,
由该装饰器将 函数返回的数据 处理成... |
tools/bin/pythonSrc/pychecker-0.8.18/test_input/test25.py | YangHao666666/hawq | 450 | 42859 | 'doc'
import sys
class A:
'doc'
z = 1
def x(self): pass
def xxx():
print A.x()
print A.z
print A.a
print A.y()
print sys.lkjsdflksjasdlf
|
vakt/storage/sql/__init__.py | chuxuantinh/vakt | 132 | 42863 | <filename>vakt/storage/sql/__init__.py
"""
SQL Storage for Policies.
"""
import logging
from sqlalchemy import and_, or_, literal, func
from sqlalchemy.exc import IntegrityError
from sqlalchemy.orm.exc import FlushError
from .model import PolicyModel, PolicyActionModel, PolicyResourceModel, PolicySubjectModel
from .... |
objax/functional/parallel.py | kihyuks/objax | 715 | 42868 | # Copyright 2020 Google LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# https://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, ... |
doubanfm/model.py | fakegit/douban.fm | 783 | 42911 | <gh_stars>100-1000
#!/usr/bin/env python2
# -*- coding: utf-8 -*-
"""
数据层
"""
from threading import RLock, Thread
import logging
import functools
from six.moves import queue
from doubanfm.API.api import Doubanfm
from doubanfm.API.netease_api import Netease
from doubanfm.config import db_config
logger = logging.getLog... |
froide/campaign/listeners.py | xenein/froide | 198 | 42920 | <gh_stars>100-1000
from .utils import connect_foirequest
def connect_campaign(sender, **kwargs):
reference = kwargs.get("reference")
if not reference:
return
if "@" in reference:
parts = reference.split("@", 1)
else:
parts = reference.split(":", 1)
if len(parts) != 2:
... |
rayleigh/searchable_collection.py | mgsh/rayleigh | 185 | 42921 | """
Methods to search an ImageCollection with brute force, exhaustive search.
"""
import cgi
import abc
import cPickle
import numpy as np
from sklearn.decomposition import PCA
from sklearn.metrics.pairwise import \
manhattan_distances, euclidean_distances, additive_chi2_kernel
import pyflann
from scipy.spatial imp... |
Code/coupon_collector.py | PacktPublishing/Modern-Python-Cookbook | 107 | 42922 | <reponame>PacktPublishing/Modern-Python-Cookbook<gh_stars>100-1000
"""Python Cookbook
See
http://www.brynmawr.edu/math/people/anmyers/PAPERS/SIGEST_Coupons.pdf
and
https://en.wikipedia.org/wiki/Stirling_numbers_of_the_second_kind
and
https://en.wikipedia.org/wiki/Binomial_coefficient
"""
from math import factori... |
kaldi/base/__init__.py | mxmpl/pykaldi | 916 | 42930 | from ._kaldi_error import *
from ._timer import *
__all__ = [name for name in dir()
if name[0] != '_'
and not name.endswith('Base')]
|
saas/dataops/api/dataset/APP-META-PRIVATE/postrun/00_init_job.py | iuskye/SREWorks | 407 | 42963 | <filename>saas/dataops/api/dataset/APP-META-PRIVATE/postrun/00_init_job.py<gh_stars>100-1000
# coding: utf-8
from common import checker
from warehouse import entry as warehouse_entry
from pmdb import entry as pmdb_entry
from dataset import entry as dataset_entry
from health import entry as health_entry
from job impor... |
tests/util_test.py | gurpradeep/securitybot | 1,053 | 42970 | <gh_stars>1000+
from unittest2 import TestCase
from datetime import datetime, timedelta
import securitybot.util as util
class VarTest(TestCase):
def test_hours(self):
assert util.OPENING_HOUR < util.CLOSING_HOUR, 'Closing hour must be after opening hour.'
class NamedTupleTest(TestCase):
def test_empt... |
observations/r/swahili.py | hajime9652/observations | 199 | 42973 | # -*- coding: utf-8 -*-
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
import csv
import numpy as np
import os
import sys
from observations.util import maybe_download_and_extract
def swahili(path):
"""Swahili
Attitudes towards the Swahili language a... |
gdal/perftests/overview.py | jpapadakis/gdal | 3,100 | 43035 | <reponame>jpapadakis/gdal<filename>gdal/perftests/overview.py
# SPDX-License-Identifier: MIT
# Copyright 2020 <NAME>
from osgeo import gdal
import time
def doit(compress, threads):
gdal.SetConfigOption('GDAL_NUM_THREADS', str(threads))
filename = '/vsimem/test.tif'
ds = gdal.GetDriverByName('GTiff').Cre... |
tests/perf_test/mind_expression_perf/generate_report.py | PowerOlive/mindspore | 3,200 | 43055 | # Copyright 2021 Huawei Technologies Co., Ltd
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to... |
Model_Free_L2O/L2O-Swarm/src/loss.py | JohnZ03/Open-L2O | 112 | 43067 | import pickle
import numpy as np
import matplotlib.pyplot as plt
with open('./quadratic/eval_record.pickle','rb') as loss:
data = pickle.load(loss)
print('Mat_record',len(data['Mat_record']))
#print('bias',data['inter_gradient_record'])
#print('constant',data['intra_record'])
with open('./quadratic/evaluate_reco... |
tools/similarity.py | bruinxiong/gnerf | 137 | 43069 | <reponame>bruinxiong/gnerf
import torch
from kornia.losses import ssim as dssim
from lpips_pytorch import LPIPS
lpips_fn = LPIPS(net_type='alex', version='0.1')
lpips_fn.eval()
def mse(image_pred, image_gt, valid_mask=None, reduction='mean'):
value = (image_pred - image_gt) ** 2
if valid_mask is not None:
... |
tests/utils.py | sjamgade/python-socks | 158 | 43090 | import socket
def is_connectable(host, port):
sock = None
try:
sock = socket.create_connection((host, port), 1)
result = True
except socket.error:
result = False
finally:
if sock:
sock.close()
return result
|
pypyr/steps/append.py | mofm/pypyr | 261 | 43174 | <reponame>mofm/pypyr<filename>pypyr/steps/append.py
"""pypyr step that appends items to a mutable sequence, such as a list."""
import logging
from pypyr.utils.asserts import assert_key_exists, assert_key_is_truthy
logger = logging.getLogger(__name__)
def run_step(context):
"""Append item to a mutable sequence.
... |
dvc/utils/pkg.py | lucasalavapena/dvc | 9,136 | 43199 | <filename>dvc/utils/pkg.py
try:
# file is created during dvc build
from .build import PKG # noqa, pylint:disable=unused-import
except ImportError:
PKG = None # type: ignore[assignment]
|
utils/cpu_affinity.py | jie311/RangeDet | 125 | 43224 | <filename>utils/cpu_affinity.py<gh_stars>100-1000
import psutil
import os
import subprocess
import logging
def simple_bind_cpus(rank, num_partition, logical=False):
pid = os.getpid()
p = psutil.Process(pid)
cpu_count = psutil.cpu_count(logical=logical)
cpu_count_per_worker = cpu_count // num_partition... |
rosetta/__init__.py | UnitedLexCorp/rosetta | 132 | 43258 | from rosetta.text.api import *
|
core/management/commands/sync_events_dashboard.py | vanessa/djangogirls | 446 | 43268 | import datetime
import re
import time
from collections import namedtuple
from django.conf import settings
from django.core.management.base import BaseCommand
from trello import ResourceUnavailable, TrelloClient
from core.models import Event
# Create new command
class Command(BaseCommand):
help = 'Syncs event i... |
session/vad/finetune-inception-v4.py | ishine/malaya-speech | 111 | 43287 | <reponame>ishine/malaya-speech<gh_stars>100-1000
import os
os.environ['CUDA_VISIBLE_DEVICES'] = '0'
import tensorflow as tf
import collections
import re
import random
def get_assignment_map_from_checkpoint(tvars, init_checkpoint):
"""Compute the union of the current variables and checkpoint variables."""
a... |
testsuite/array-reg/run.py | LongerVision/OpenShadingLanguage | 1,105 | 43293 | #!/usr/bin/env python
# Copyright Contributors to the Open Shading Language project.
# SPDX-License-Identifier: BSD-3-Clause
# https://github.com/AcademySoftwareFoundation/OpenShadingLanguage
command += testshade("-t 1 -g 256 256 -od uint8 -o Cout out_varying_index_float.tif test_varying_index_float")
command += tes... |
bigflow_python/python/bigflow/util/log.py | advancedxy/bigflow_python | 1,236 | 43312 | #!/usr/bin/env python
#encoding=utf-8
# Copyright (c) 2012 Baidu, Inc. All Rights Reserved.
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
# http://www.apache.org/licenses/LICENSE-2.0
#... |
tests/slack_bolt/app/test_dev_server.py | hirosassa/bolt-python | 504 | 43322 | from slack_sdk import WebClient
from slack_bolt.app.app import SlackAppDevelopmentServer, App
from tests.mock_web_api_server import (
setup_mock_web_api_server,
cleanup_mock_web_api_server,
)
from tests.utils import remove_os_env_temporarily, restore_os_env
class TestDevServer:
signing_secret = "secret"
... |
sas_kernel/magics/sas_session_magic.py | gvelasq/sas_kernel | 207 | 43342 | #
# Copyright SAS Institute
#
# 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... |
examples/protocols/http_server/file_serving/http_server_file_serving_test.py | iPlon-org/esp-idf | 8,747 | 43347 | #!/usr/bin/env python
#
# Copyright 2021 Espressif Systems (Shanghai) CO LTD
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless requ... |
modules/dbnd/test_dbnd/py2only/test_python2_newstr.py | busunkim96/dbnd | 224 | 43362 | <reponame>busunkim96/dbnd
from __future__ import absolute_import
import logging
import pytest
import six
from dbnd import parameter, task
from dbnd._core.current import try_get_current_task
from dbnd._core.task_ctrl.task_ctrl import TaskCtrl
from targets.values import ObjectValueType, StrValueType
if six.PY2:
... |
testing/merge_scripts/code_coverage/merge_lib_test.py | zealoussnow/chromium | 14,668 | 43376 | <filename>testing/merge_scripts/code_coverage/merge_lib_test.py
#!/usr/bin/env vpython
# Copyright 2019 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 os
import subprocess
import sys
import unittest
import mock
i... |
pex/tools/command.py | ShellAddicted/pex | 2,160 | 43386 | # Copyright 2021 Pants project contributors (see CONTRIBUTORS.md).
# Licensed under the Apache License, Version 2.0 (see LICENSE).
from __future__ import absolute_import
from abc import abstractmethod
from pex.commands.command import Command, Result
from pex.pex import PEX
class PEXCommand(Command):
@abstractm... |
src/python/tests/integration/test_web/test_handler/test_auto_queue.py | annihilatethee/seedsync | 255 | 43418 | <gh_stars>100-1000
# Copyright 2017, <NAME>, All rights reserved.
import json
from urllib.parse import quote
from controller import AutoQueuePattern
from tests.integration.test_web.test_web_app import BaseTestWebApp
class TestAutoQueueHandler(BaseTestWebApp):
def test_get(self):
self.auto_queue_persist.... |
fasta/reorient_sequences_by_id.py | senjoro/biocode | 355 | 43420 | <reponame>senjoro/biocode<filename>fasta/reorient_sequences_by_id.py
#!/usr/bin/env python3
'''
Description:
Use this when you have a multi-FASTA file and you want to reverse or reverse
complement only select sequences within that file. For example, strand-specific
RNA-Seq read alignment showed that some assembled t... |
docs/code_snippets/hello_world_infix.py | Ying1123/pysmt | 435 | 43445 | from pysmt.shortcuts import Symbol
from pysmt.typing import INT
h = Symbol("H", INT)
domain = (1 <= h) & (10 >= h)
|
third_party/angle/src/libANGLE/renderer/vulkan/gen_vk_format_table.py | zipated/src | 2,151 | 43450 | <filename>third_party/angle/src/libANGLE/renderer/vulkan/gen_vk_format_table.py<gh_stars>1000+
#!/usr/bin/python
# Copyright 2016 The ANGLE Project Authors. All rights reserved.
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
#
# gen_vk_format_table.py:
# Code gene... |
src/azure-cli/azure/cli/command_modules/synapse/manual/operations/accesscontrol.py | YuanyuanNi/azure-cli | 3,287 | 43474 | # --------------------------------------------------------------------------------------------
# Copyright (c) Microsoft Corporation. All rights reserved.
# Licensed under the MIT License. See License.txt in the project root for license information.
# --------------------------------------------------------------------... |
ml_logger/ml_logger_tests/test_cloud/test_s3.py | mcx/ml_logger | 107 | 43482 | <filename>ml_logger/ml_logger_tests/test_cloud/test_s3.py
"""
# AWS S3 Tests
"""
from os.path import join as pathJoin
import pytest
from ml_logger import logger
@pytest.fixture(scope='session')
def log_dir(request):
return request.config.getoption('--logdir')
@pytest.fixture(scope="session")
def setup(log_dir)... |
examples/paint-nd.py | MaksHess/napari | 1,345 | 43507 | <gh_stars>1000+
"""
Display a 4D labels layer and paint only in 3D.
This is useful e.g. when proofreading segmentations within a time series.
"""
import numpy as np
from skimage import data
import napari
blobs = np.stack(
[
data.binary_blobs(
length=128, blob_size_fraction=0.05, n_dim=3, vol... |
deepconcolic/recviz.py | nberth/DeepConcolic | 102 | 43514 | <gh_stars>100-1000
#!/usr/bin/env python3
from utils_io import *
from utils_args import *
import yaml
def check_record (r):
def chk (k, t):
if k not in r or not isinstance (r[k], t):
raise ValueError (f'missing or wrong `{k}\' entry in record')
chk ('adversarials', list)
chk ('passed_tests', list)
c... |
examples/numerical/unsupervised_num.py | stjordanis/QMLT | 117 | 43518 | <reponame>stjordanis/QMLT
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
# Copyright 2018 Xanadu Quantum Technologies 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.apa... |
torchrs/datasets/whu_rs19.py | isaaccorley/torchrs | 146 | 43526 | import torchvision.transforms as T
from torchvision.datasets import ImageFolder
class WHURS19(ImageFolder):
""" WHU-RS19 dataset from'Structural High-resolution Satellite Image Indexing', Xia at al. (2010)
https://hal.archives-ouvertes.fr/file/index/docid/458685/filename/structural_satellite_indexing_XYDG.pdf... |
tempest/tests/lib/services/identity/v3/test_protocols_client.py | cityofships/tempest | 254 | 43564 | <filename>tempest/tests/lib/services/identity/v3/test_protocols_client.py<gh_stars>100-1000
# Copyright 2020 Samsung Electronics Co., Ltd
# 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... |
tools/compare_rep.py | Woffee/deformer | 114 | 43574 | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
import argparse
import os
from collections import defaultdict
import numpy as np
from scipy.spatial import distance
from tqdm import tqdm
np.set_printoptions(threshold=np.inf, suppress=True)
def main(args):
num_batches = args.num_batches
bert_data = defaultdic... |
src/api/log/__init__.py | fekblom/critic | 216 | 43584 | import rebase
import partition
|
angr/procedures/posix/accept.py | Kyle-Kyle/angr | 6,132 | 43614 | import angr
######################################
# accept (but not really)
######################################
class accept(angr.SimProcedure):
#pylint:disable=arguments-differ
def run(self, sockfd, addr, addrlen):
conc_addrlen = self.state.mem[addrlen].int.concrete
addr_data = self.stat... |
scripts/sample_data/discourse_1369.py | gmatteo/awesome-panel | 179 | 43627 | import panel as pn
def test_alert():
my_alert = pn.pane.Alert("foo", alert_type="primary")
my_button = pn.widgets.Button(name="Toggle")
def toggle(event):
if my_alert.alert_type == "primary":
my_alert.alert_type == "success"
else:
my_alert.alert_type = "... |
tests/conftest.py | chadwhitacre/confidant | 1,820 | 43650 | <filename>tests/conftest.py<gh_stars>1000+
import pytest
@pytest.fixture(autouse=True)
def encrypted_settings_mock(mocker):
mocker.patch('confidant.settings.encrypted_settings.secret_string', {})
mocker.patch(
'confidant.settings.encrypted_settings.decrypted_secrets',
{'SESSION_SECRET': 'TEST_... |
vega/algorithms/nas/modnas/optim/model_optim/base.py | This-50m/vega | 724 | 43651 | # -*- coding:utf-8 -*-
# Copyright (C) 2020. Huawei Technologies Co., Ltd. All rights reserved.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the MIT License.
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the ... |
tests/test_adjacency.py | jpmaterial/trimesh | 1,882 | 43700 | try:
from . import generic as g
except BaseException:
import generic as g
class AdjacencyTest(g.unittest.TestCase):
def test_radius(self):
for radius in [0.1, 1.0, 3.1459, 29.20]:
m = g.trimesh.creation.cylinder(
radius=radius, height=radius * 10)
# remov... |
clastic/tests/test_obj_browser.py | mahmoud/clastic | 140 | 43708 | # -*- coding: utf-8 -*-
from __future__ import unicode_literals
import sys
import pytest
from clastic.contrib.obj_browser import create_app
_IS_PYPY = '__pypy__' in sys.builtin_module_names
@pytest.mark.skipif(_IS_PYPY, reason='pypy gc cannot support obj browsing')
def test_flaw_basic():
app = create_app()
... |
tests/rororo/test_openapi.py | fajfer/rororo | 105 | 43711 | import datetime
import io
import json
import zipfile
from pathlib import Path
import pyrsistent
import pytest
import yaml
from aiohttp import web
from openapi_core.shortcuts import create_spec
from yarl import URL
from rororo import (
BaseSettings,
get_openapi_context,
get_openapi_schema,
get_openapi_... |
armi/materials/inconel600.py | celikten/armi | 162 | 43725 | # Copyright 2019 TerraPower, LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writi... |
hubspot/crm/products/api/__init__.py | fakepop/hubspot-api-python | 117 | 43727 | <reponame>fakepop/hubspot-api-python
from __future__ import absolute_import
# flake8: noqa
# import apis into api package
from hubspot.crm.products.api.associations_api import AssociationsApi
from hubspot.crm.products.api.basic_api import BasicApi
from hubspot.crm.products.api.batch_api import BatchApi
from hubspot.c... |
apps/base/urls/product_category_uom.py | youssriaboelseod/pyerp | 115 | 43757 | <reponame>youssriaboelseod/pyerp
"""The store routes
"""
# Django Library
from django.urls import path
# Localfolder Library
from ..views.product_category_uom import (
ProductCategoryUOMCreateView, ProductCategoryUOMDeleteView,
ProductCategoryUOMDetailView, ProductCategoryUOMListView,
ProductCategoryUOMUpd... |
muddery/server/statements/statement_func_set.py | dongwudanci/muddery | 127 | 43772 | <gh_stars>100-1000
"""
A statement function set holds a set of statement functions that can be used in statements.
"""
class BaseStatementFuncSet(object):
"""
A statement function set holds a set of statement functions that can be used in statements.
"""
def __init__(self):
self.funcs = {}
... |
tagger/data/__init__.py | XMUNLP/Tagger | 335 | 43871 | <reponame>XMUNLP/Tagger<filename>tagger/data/__init__.py<gh_stars>100-1000
from tagger.data.dataset import get_dataset
from tagger.data.vocab import load_vocabulary, lookup
from tagger.data.embedding import load_glove_embedding
|
tools/parse_log.py | KyleHai/DeepSpeech2 | 158 | 43910 | import fileinput as fin
# funcs:
def findValWithFormat(line):
lines.append(line)
taken = line.split(" ")
raw_val = taken[-1]
val = raw_val.split("/")[-1]
val = val[0:-2]
if 'us' in val:
val = float(val[0:val.find('us')])
val = val/1000
else:
val = float(val[0:val.find('ms')])
return val
def getCellNum(l... |
maskrcnn_benchmark/modeling/roi_heads/ke_head/inference.py | happog/Box_Discretization_Network | 285 | 43949 | import torch
from torch import nn
import pdb, os
from shapely.geometry import *
from maskrcnn_benchmark.structures.boxlist_ops import cat_boxlist
import time
import matplotlib.pyplot as plt
import numpy as np
from scipy.signal import argrelextrema
import random
import string
all_types = [[1,2,3,4],[1,2,4,3],[1,3,2,4... |
submission/util.py | pwqbot/eoj3 | 107 | 43952 | <reponame>pwqbot/eoj3<filename>submission/util.py
class SubmissionStatus(object):
SUBMITTED = -4
WAITING = -3
JUDGING = -2
WRONG_ANSWER = -1
ACCEPTED = 0
TIME_LIMIT_EXCEEDED = 1
IDLENESS_LIMIT_EXCEEDED = 2
MEMORY_LIMIT_EXCEEDED = 3
RUNTIME_ERROR = 4
SYSTEM_ERROR = 5
COMPILE_ERROR = 6
SCORED = 7
... |
repoxplorer/tests/test_yamlbackend.py | Priya-100/repoxplorer | 107 | 43965 | <reponame>Priya-100/repoxplorer
# Copyright 2017, Red Hat
#
# 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 applic... |
pdns-admin-base-ngoduykhanh/run.py | xoxefdp/docker-pdns | 153 | 43991 | #!/usr/bin/env python3
from powerdnsadmin import create_app
app = create_app()
|
tkinter/scrolled-frame-canvas/scrolledframe.py | whitmans-max/python-examples | 140 | 44005 | import tkinter as tk
class ScrolledFrame(tk.Frame):
def __init__(self, parent, vertical=True, horizontal=False):
super().__init__(parent)
# canvas for inner frame
self._canvas = tk.Canvas(self)
self._canvas.grid(row=0, column=0, sticky='news') # changed
# create right scr... |
openbook_circles/validators.py | TamaraAbells/okuna-api | 164 | 44044 | <filename>openbook_circles/validators.py
from rest_framework.exceptions import ValidationError
from django.utils.translation import ugettext_lazy as _
from openbook_circles.models import Circle
def circle_id_exists(circle_id):
count = Circle.objects.filter(id=circle_id).count()
if count == 0:
raise ... |
dtreeviz/__init__.py | alitrack/dtreeviz | 1,905 | 44057 | <gh_stars>1000+
from .version import __version__
from dtreeviz.classifiers import clfviz
|
DN/ioUtils.py | dendisuhubdy/dwt | 206 | 44087 | <filename>DN/ioUtils.py
import numpy as np
import skimage
import skimage.io
import scipy.io as sio
import skimage.transform
import sys
np.random.seed(0)
VGG_MEAN = [103.939, 116.779, 123.68]
def read_mat(path):
return np.load(path)
def write_mat(path, m):
np.save(path, m)
def read_ids(path):
return ... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.