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 |
|---|---|---|---|---|
objectModel/Python/tests/cdm/cdm_collection/test_cdm_trait_collection.py | Microsoft/CDM | 265 | 11129965 | # Copyright (c) Microsoft Corporation. All rights reserved.
# Licensed under the MIT License. See License.txt in the project root for license information.
from typing import cast
import unittest
from cdm.utilities import Constants
from tests.common import async_test
from cdm.objectmodel import CdmTraitDefinition, Cd... |
django_pgviews/__init__.py | djr5/django-pgviews | 182 | 11129990 | default_app_config = 'django_pgviews.apps.ViewConfig'
|
pyNastran/dev/bdf_vectorized/cards/deqatn.py | luzpaz/pyNastran | 293 | 11130014 | # coding: utf-8
"""
Defines the DEQATN class and sub-functions.
The capitalization of the sub-functions is important.
"""
from __future__ import annotations
from typing import TYPE_CHECKING
import numpy as np
from numpy import (
cos, sin, tan, log, log10, mean, exp, sqrt, square, mod, abs, sum,
arcsin as asin... |
venv/lib/python3.8/site-packages/setuptools/_vendor/packaging/requirements.py | Joshua-Barawa/My-Photos | 38,667 | 11130018 | <filename>venv/lib/python3.8/site-packages/setuptools/_vendor/packaging/requirements.py
# This file is dual licensed under the terms of the Apache License, Version
# 2.0, and the BSD License. See the LICENSE file in the root of this repository
# for complete details.
from __future__ import absolute_import, division, pr... |
integration-tests/test_psql_parity.py | boazberman/arrow-datafusion | 1,801 | 11130023 | <reponame>boazberman/arrow-datafusion
# Licensed to the Apache Software Foundation (ASF) under one
# or more contributor license agreements. See the NOTICE file
# distributed with this work for additional information
# regarding copyright ownership. The ASF licenses this file
# to you under the Apache License, Versio... |
judge/tasks.py | sokoide/OnlineJudge | 5,237 | 11130031 | <gh_stars>1000+
import dramatiq
from account.models import User
from submission.models import Submission
from judge.dispatcher import JudgeDispatcher
from utils.shortcuts import DRAMATIQ_WORKER_ARGS
@dramatiq.actor(**DRAMATIQ_WORKER_ARGS())
def judge_task(submission_id, problem_id):
uid = Submission.objects.get(... |
pyts/transformation/__init__.py | jmrichardson/pyts | 1,217 | 11130036 | """The :mod:`pyts.transformation` module includes transformation algorithms."""
from .bag_of_patterns import BagOfPatterns
from .boss import BOSS
from .rocket import ROCKET
from .shapelet_transform import ShapeletTransform
from .weasel import WEASEL
__all__ = ['BagOfPatterns', 'BOSS', 'ROCKET', 'ShapeletTransform', '... |
parsers/test_parser.py | plympton/newsdiffs | 317 | 11130041 | #!/usr/bin/python
"""
Test a parser. For example:
$ python test_parser.py nyt.NYTParser
[list of URLs to check]
$ python test_parser.py nyt.NYTParser <one of those URLs>
[text of article to store]
"""
import sys
try:
parsername = sys.argv[1]
except IndexError:
print 'Usage: test_parser.py <modulename>.<clas... |
Tools/python37/Lib/urllib/robotparser.py | xxroot/android_universal | 207 | 11130051 | """ robotparser.py
Copyright (C) 2000 <NAME>
You can choose between two licenses when using this package:
1) GNU GPLv2
2) PSF license for Python 2.2
The robots.txt Exclusion Protocol is implemented as specified in
http://www.robotstxt.org/norobots-rfc.txt
"""
import collections
... |
tests/ut/cpp/python_input/gtest_input/pre_activate/mul_add_fusion_test.py | PowerOlive/mindspore | 3,200 | 11130084 | # Copyright 2020 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... |
plugins/modules/oci_blockstorage_volume_group_actions.py | slmjy/oci-ansible-collection | 108 | 11130090 | <filename>plugins/modules/oci_blockstorage_volume_group_actions.py<gh_stars>100-1000
#!/usr/bin/python
# Copyright (c) 2020, 2021 Oracle and/or its affiliates.
# This software is made available to you under the terms of the GPL 3.0 license or the Apache 2.0 license.
# GNU General Public License v3.0+ (see COPYING or ht... |
tools/kconfig_new/test/confgen/test_confgen.py | lovyan03/esp-idf | 8,747 | 11130116 | <reponame>lovyan03/esp-idf
#!/usr/bin/env python
import os
import re
import subprocess
import sys
import tempfile
import textwrap
import unittest
from future.utils import iteritems
class ConfgenBaseTestCase(unittest.TestCase):
@classmethod
def setUpClass(self):
self.args = dict()
self.functi... |
examples/packing_on_the_sphere.py | vishalbelsare/pymanopt | 459 | 11130135 | <reponame>vishalbelsare/pymanopt
import autograd.numpy as np
import tensorflow as tf
import theano.tensor as T
import torch
from examples._tools import ExampleRunner
import pymanopt
from pymanopt.manifolds import Elliptope
from pymanopt.solvers import ConjugateGradient
SUPPORTED_BACKENDS = (
"Autograd", "PyTorch"... |
alipay/aop/api/domain/AlipayBossContractManagementCancelModel.py | antopen/alipay-sdk-python-all | 213 | 11130139 | #!/usr/bin/env python
# -*- coding: utf-8 -*-
import json
from alipay.aop.api.constant.ParamConstants import *
class AlipayBossContractManagementCancelModel(object):
def __init__(self):
self._biz_source = None
self._contract_batch_no = None
@property
def biz_source(self):
return... |
inference_shape_human.py | favitor/im2avatar | 131 | 11130154 | <filename>inference_shape_human.py<gh_stars>100-1000
import tensorflow as tf
import numpy as np
import os
import h5py
import sys
sys.path.append('./utils')
sys.path.append('./models')
import dataset_human as dataset
import model_shape as model
FLAGS = tf.app.flags.FLAGS
tf.app.flags.DEFINE_string('train_dir', './trai... |
tests/numpy/rot90_test.py | Walon1998/dace | 227 | 11130157 | <reponame>Walon1998/dace<gh_stars>100-1000
# Copyright 2019-2021 ETH Zurich and the DaCe authors. All rights reserved.
import numpy as np
from sympy.core.numbers import comp
import dace
from common import compare_numpy_output
@compare_numpy_output()
def test_rot90_2d_k0(A: dace.int32[10, 10]):
return np.rot90(A, ... |
websauna/system/user/interfaces.py | highPriestLOL/websauna | 286 | 11130196 | <filename>websauna/system/user/interfaces.py
"""Define various interfaces telling how user subsystem objects interact and can be looked up from registry."""
# Pyramid
import zope
from pyramid.interfaces import IRequest
from pyramid.interfaces import IResponse
from zope.interface import Interface
import authomatic
cl... |
pylibui/controls/form.py | superzazu/pylibui | 222 | 11130198 | <reponame>superzazu/pylibui<filename>pylibui/controls/form.py<gh_stars>100-1000
"""
Python wrapper for libui.
"""
from pylibui import libui
from .control import Control
class Form(Control):
def __init__(self):
"""
Creates a new empty form.
"""
super().__init__()
self.c... |
ProgettoLube/WebInspector/venv/Lib/site-packages/tensorboard/data_compat.py | Lube-Project/ProgettoLube | 353 | 11130271 | # Copyright 2017 The TensorFlow Authors. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applica... |
resources/recruit_database.py | litchiar/ArknightsAutoHelper | 1,035 | 11130276 | recruit_database = [
('Lancet-2', 0, ['医疗干员', '远程位', '治疗', '支援机械']),
('Castle-3', 0, ['近卫干员', '近战位', '支援', '支援机械']),
('夜刀', 1, ['先锋干员', '近战位', '新手']),
('黑角', 1, ['重装干员', '近战位', '新手']),
('巡林者', 1, ['狙击干员', '远程位', '新手']),
('杜林', 1, ['术师干员', '远程位', '新手']),
('12F', 1, ['术师干员', '远程位', '新手']),
... |
tests/test_jsonnet.py | laserb/kapitan | 1,413 | 11130278 | #!/usr/bin/env python3
# Copyright 2019 The Kapitan Authors
# SPDX-FileCopyrightText: 2020 The Kapitan Authors <<EMAIL>>
#
# SPDX-License-Identifier: Apache-2.0
"jsonnet tests"
import json
import os
import unittest
from kapitan.resources import (
file_exists,
dir_files_list,
dir_files_read,
gzip_b64... |
monai/networks/nets/netadapter.py | dyollb/MONAI | 2,971 | 11130279 | <reponame>dyollb/MONAI
# Copyright 2020 - 2021 MONAI Consortium
# 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 ... |
oslo/torch/utils/data/data_collators.py | lipovsek/oslo | 249 | 11130297 | from typing import List, Optional
import torch
from oslo.torch.distributed import ParallelContext, ParallelMode
class SequenceDataParallelCollator:
def __init__(
self,
parallel_keys: List[str],
parallel_context: ParallelContext,
dim: int = 1,
pad_token_id: Optional[int] =... |
coconut/compiler/matching.py | evhub/coconut | 3,624 | 11130313 | #!/usr/bin/env python
# -*- coding: utf-8 -*-
# -----------------------------------------------------------------------------------------------------------------------
# INFO:
# -----------------------------------------------------------------------------------------------------------------------
"""
Author: <NAME>
L... |
parsley/tests/models.py | blueyed/Django-parsley | 208 | 11130352 | #Django requires every app to have models.
from django.db import models
class Student(models.Model):
name = models.CharField(max_length=100)
|
pix2pix/src/model/models.py | lisabecker/DeepLearningImplementations | 2,010 | 11130355 | <reponame>lisabecker/DeepLearningImplementations
from keras.models import Model
from keras.layers.core import Flatten, Dense, Dropout, Activation, Lambda, Reshape
from keras.layers.convolutional import Conv2D, Deconv2D, ZeroPadding2D, UpSampling2D
from keras.layers import Input, Concatenate
from keras.layers.advanced_a... |
venv/Lib/site-packages/mpl_toolkits/axisartist/grid_finder.py | EkremBayar/bayar | 603 | 11130360 | import numpy as np
from matplotlib import _api, ticker as mticker
from matplotlib.transforms import Bbox, Transform
from .clip_path import clip_line_to_rect
class ExtremeFinderSimple:
"""
A helper class to figure out the range of grid lines that need to be drawn.
"""
def __init__(self, nx, ny):
... |
leetcode.com/python/150_Evaluate_Reverse_Polish_Notation.py | vansh-tiwari/coding-interview-gym | 713 | 11130370 | <reponame>vansh-tiwari/coding-interview-gym
# https://tinyurl.com/r35ffgt
from collections import deque
class Solution(object):
def evalRPN(self, tokens):
"""
:type tokens: List[str]
:rtype: int
"""
tokensDeque = deque(tokens)
stack = []
opes = ["+", "-", "*",... |
hpccm/building_blocks/hdf5.py | robertmaynard/hpc-container-maker | 340 | 11130372 | <gh_stars>100-1000
# Copyright (c) 2018, NVIDIA CORPORATION. All rights reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unles... |
tests/test_acoustic_models/test_lstm_for_causal_lm.py | techthiyanes/openspeech | 207 | 11130373 | import unittest
import logging
import torch
from openspeech.criterion import Perplexity, PerplexityLossConfigs
from openspeech.lm.lstm_lm import LSTMForLanguageModel
from openspeech.utils import DUMMY_TARGETS, build_dummy_configs
from openspeech.tokenizers.ksponspeech.character import KsponSpeechCharacterTokenizer
lo... |
mayan/apps/logging/tests/test_models.py | nattangwiwat/Mayan-EDMS-recitation | 336 | 11130379 | <gh_stars>100-1000
from mayan.apps.testing.tests.base import BaseTestCase
from ..models import ErrorLogPartitionEntry
from .mixins import LoggingTextMixin
class LoggingModelTestCase(LoggingTextMixin, BaseTestCase):
def setUp(self):
super().setUp()
self._create_error_log_test_object()
sel... |
lib/django-1.4/django/contrib/gis/tests/distapp/models.py | MiCHiLU/google_appengine_sdk | 790 | 11130382 | <reponame>MiCHiLU/google_appengine_sdk<gh_stars>100-1000
from django.contrib.gis.db import models
class SouthTexasCity(models.Model):
"City model on projected coordinate system for South Texas."
name = models.CharField(max_length=30)
point = models.PointField(srid=32140)
objects = models.GeoManager()
... |
tests/basics/bytearray1.py | LabAixBidouille/micropython | 303 | 11130383 | <gh_stars>100-1000
print(bytearray(4))
a = bytearray([1, 2, 200])
print(type(a))
print(a[0], a[2])
print(a[-1])
print(a)
a[2] = 255
print(a[-1])
a.append(10)
print(len(a))
s = 0
for i in a:
s += i
print(s)
print(a[1:])
print(a[:-1])
print(a[2:3])
print(str(bytearray(b"123"), "utf-8"))
# Comparisons
print(bytear... |
quantlib/test/test_sabr.py | bpmbank/pyql | 488 | 11130395 | <filename>quantlib/test/test_sabr.py
import math
import unittest
from quantlib.time.api import Date
from quantlib.quotes import SimpleQuote
from quantlib.settings import Settings
from quantlib.termstructures.volatility.sabr_interpolated_smilesection \
import SabrInterpolatedSmileSection
from quantlib.termstructures... |
ai/src/tests/test_stateful.py | ScriptBox99/spiceai | 713 | 11130396 | from io import StringIO
import unittest
import pandas as pd
import numpy as np
from connector.stateful import StatefulConnector
from data_manager.base_manager import DataParam
from data_manager.time_series_manager import TimeSeriesDataManager
from proto.aiengine.v1 import aiengine_pb2
class StatefulConnectorTests(u... |
cirq/interop/quirk/__init__.py | lilies/Cirq | 3,326 | 11130407 | <filename>cirq/interop/quirk/__init__.py<gh_stars>1000+
# Copyright 2018 The Cirq Developers
#
# 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.... |
tests/test_wire/test_named.py | leonardt/magma | 167 | 11130411 | from magma import *
from magma.testing import check_files_equal
def test_named1():
class Buf(Circuit):
name = "Buf"
io = IO(I=In(Bit), O=Out(Bit))
class main(Circuit):
name = "main"
io = IO(I=In(Bit), O=Out(Bit))
buf = Buf()
buf(I=io.I)
wire(buf.O, io.O... |
examples/normals/simple.py | mitchkaden/meteostat-python | 133 | 11130414 | """
Example: Simple climate data access
Meteorological data provided by Meteostat (https://dev.meteostat.net)
under the terms of the Creative Commons Attribution-NonCommercial
4.0 International Public License.
The code is licensed under the MIT license.
"""
import matplotlib.pyplot as plt
from meteostat import Norma... |
src/Products/PageTemplates/tests/test_engine.py | rbanffy/Zope | 289 | 11130428 | <reponame>rbanffy/Zope
import os
import unittest
from Testing.ZopeTestCase import ZopeTestCase
from Testing.ZopeTestCase.sandbox import Sandboxed
from .util import useChameleonEngine
path = os.path.dirname(__file__)
class TestPatches(Sandboxed, ZopeTestCase):
def afterSetUp(self):
useChameleonEngine(... |
src/winforms/toga_winforms/widgets/optioncontainer.py | luizoti/toga | 1,261 | 11130431 | <gh_stars>1000+
from toga_winforms.libs import WinForms
from toga_winforms.window import WinFormsViewport
from .base import Widget
class OptionContainer(Widget):
def create(self):
self.native = WinForms.TabControl()
self.native.Selected += self.winforms_selected
def add_content(self, label, ... |
opennmt/tests/inputter_test.py | OpenNMT/OpenNMT-tf | 1,363 | 11130432 | <reponame>OpenNMT/OpenNMT-tf
import gzip
import io
import os
import numpy as np
import tensorflow as tf
import yaml
from google.protobuf import text_format
from parameterized import parameterized
from tensorboard.plugins import projector
from opennmt import inputters, tokenizers
from opennmt.data import dataset as d... |
pylearn2/datasets/tests/test_four_regions.py | ikervazquezlopez/Pylearn2 | 2,045 | 11130457 | import numpy as np
from pylearn2.datasets.four_regions import FourRegions
def test_four_regions():
dataset = FourRegions(5000)
X = dataset.get_design_matrix()
np.testing.assert_(((X < 1.) & (X > -1.)).all())
y = dataset.get_targets()
np.testing.assert_equal(np.unique(y), [0, 1, 2, 3])
|
samples/migrateADCGen1/mappers/adlsg1.py | daniel-dqsdatalabs/pyapacheatlas | 104 | 11130494 | import sys
sys.path.append("./")
from .assetmapper import AssetMapper
from urllib.parse import urlparse
class ADLSGen1Directory(AssetMapper):
def __init__(self, asset, termMap, typeName='azure_datalake_gen1_path', columnTypeName='column'):
super().__init__(asset, termMap, typeName=typeName, columnTypeName... |
tfprob/gan/__init__.py | AlexBlack2202/EigenGAN-Tensorflow | 581 | 11130502 | <filename>tfprob/gan/__init__.py<gh_stars>100-1000
from tfprob.gan.gradient_penalty import *
from tfprob.gan.loss import *
|
tools/third_party/pywebsocket3/mod_pywebsocket/standalone.py | meyerweb/wpt | 14,668 | 11130503 | <reponame>meyerweb/wpt
#!/usr/bin/env python
#
# Copyright 2012, Google Inc.
# 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 retain the above copyri... |
tests/openbb_terminal/stocks/screener/test_finviz_view.py | tehcoderer/GamestonkTerminal | 255 | 11130506 | # IMPORTATION STANDARD
# IMPORTATION THIRDPARTY
import pandas as pd
import pytest
# IMPORTATION INTERNAL
from openbb_terminal.stocks.screener import finviz_view
from openbb_terminal import helper_funcs
@pytest.mark.vcr
@pytest.mark.parametrize(
"toggle",
[
True,
False,
],
)
@pytest.mark.... |
tools/sumo_multi_clients.py | isgeles/SMARTS | 554 | 11130547 | <reponame>isgeles/SMARTS
import os
import random
import subprocess
import threading
import time
from smarts.core.utils.sumo import sumolib, traci, SUMO_PATH
PORT = 8001
"""
Conclusions:
1. connected clients < num-clients: SUMO will block, only start once all clients have connected.
2. connected clients > num-clients... |
util/pyclient/bft_config.py | definitelyNotFBI/utt | 340 | 11130566 | <filename>util/pyclient/bft_config.py
# Concord
#
# Copyright (c) 2019 VMware, Inc. All Rights Reserved.
#
# This product is licensed to you under the Apache 2.0 license (the "License").
# You may not use this product except in compliance with the Apache 2.0 License.
#
# This product may include a number of subcomponen... |
pkcs11/types.py | superG1zm0/python-pkcs11 | 114 | 11130575 | """
Types for high level PKCS#11 wrapper.
This module provides stubs that are overrideen in pkcs11._pkcs11.
"""
from threading import RLock
from binascii import hexlify
from cached_property import cached_property
from .constants import (
Attribute,
MechanismFlag,
ObjectClass,
SlotFlag,
TokenFlag... |
networkx/utils/tests/test_random_sequence.py | jebogaert/networkx | 10,024 | 11130602 | import pytest
from networkx.utils import (
powerlaw_sequence,
zipf_rv,
random_weighted_sample,
weighted_choice,
)
def test_degree_sequences():
seq = powerlaw_sequence(10, seed=1)
seq = powerlaw_sequence(10)
assert len(seq) == 10
def test_zipf_rv():
r = zipf_rv(2.3, xmin=2, seed=1)
... |
fuzzinator/call/stream_monitored_subprocess_call.py | renatahodovan/fuzzinator | 202 | 11130619 | <reponame>renatahodovan/fuzzinator
# Copyright (c) 2016-2021 <NAME>, <NAME>.
#
# Licensed under the BSD 3-Clause License
# <LICENSE.rst or https://opensource.org/licenses/BSD-3-Clause>.
# This file may not be copied, modified, or distributed except
# according to those terms.
import errno
import fcntl
import logging
i... |
mayan/apps/common/menus.py | nattangwiwat/Mayan-EDMS-recitation | 343 | 11130667 | from django.utils.translation import ugettext_lazy as _
from mayan.apps.navigation.classes import Menu
from .icons import icon_menu_about, icon_menu_user
menu_about = Menu(
icon=icon_menu_about, label=_('System'), name='about'
)
menu_facet = Menu(label=_('Facet'), name='facet')
menu_list_facet = Menu(label=_('Fa... |
venv/Lib/site-packages/pyrsistent/typing.py | ajayiagbebaku/NFL-Model | 1,738 | 11130675 | """Helpers for use with type annotation.
Use the empty classes in this module when annotating the types of Pyrsistent
objects, instead of using the actual collection class.
For example,
from pyrsistent import pvector
from pyrsistent.typing import PVector
myvector: PVector[str] = pvector(['a', 'b', 'c'])... |
mayan/apps/documents/views/recently_created_document_views.py | atitaya1412/Mayan-EDMS | 343 | 11130743 | <gh_stars>100-1000
from django.utils.translation import ugettext_lazy as _
from ..icons import icon_document_recently_created_list
from ..models.document_models import RecentlyCreatedDocument
from .document_views import DocumentListView
__all__ = ('RecentCreatedDocumentListView',)
class RecentCreatedDocumentListVi... |
utils/rq_queryqueue.py | wranders/crackq | 908 | 11130750 | import datetime
import rq
import sys
from rq import use_connection, Queue
from rq.serializers import JSONSerializer
from redis import Redis
if len(sys.argv) < 2:
print('Usage: ./{} <queue-name>')
exit(1)
redis_con = Redis('redis', 6379)
redis_q = Queue(sys.argv[1], connection=redis_con,
seria... |
recipes/Python/334916_A_numarray_set_complement/recipe-334916.py | tdiprima/code | 2,023 | 11130801 | <reponame>tdiprima/code
#!/usr/bin/env python
import numarray
def complement(ind_arr, n):
"""
Find the complement of the set of indices in ind_arr from
arange(n)
"""
mat = numarray.ones(n)
numarray.put(mat, ind_arr, 0)
out = numarray.nonzero(mat)
return out[0]
if __name__ == "__main... |
Packs/CommonScripts/Scripts/DockerHardeningCheck/DockerHardeningCheck_test.py | diCagri/content | 799 | 11130845 | from DockerHardeningCheck import check_memory, mem_size_to_bytes, check_pids, check_fd_limits, check_non_root, check_cpus
from pytest import skip
import os
def test_check_memory():
assert 'memory cgroup configuration' in check_memory("10m", "cgroup")
def test_mem_size():
assert mem_size_to_bytes("1g") == (1... |
lib/python2.7/site-packages/django/forms/util.py | bop/bauhaus | 285 | 11130847 | <gh_stars>100-1000
from __future__ import unicode_literals
from django.conf import settings
from django.utils.html import format_html, format_html_join
from django.utils.encoding import force_text, python_2_unicode_compatible
from django.utils import timezone
from django.utils.translation import ugettext_lazy as _
fro... |
create_swag/lm/pretrain_lm.py | gauravkmr/swagaf | 182 | 11130870 | import os
import pandas as pd
import torch
from allennlp.data import Instance
from allennlp.data import Token
from allennlp.data import Vocabulary
from allennlp.data.dataset import Batch
from allennlp.data.fields import TextField
from allennlp.data.token_indexers import SingleIdTokenIndexer
from allennlp.data.token_in... |
sdk/python/pulumi_aws/appmesh/get_virtual_service.py | chivandikwa/pulumi-aws | 260 | 11130887 | <reponame>chivandikwa/pulumi-aws
# 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, Sequenc... |
tests/test_scan.py | enmathe/ggshield | 794 | 11130917 | <reponame>enmathe/ggshield<filename>tests/test_scan.py
from os import getcwd
from unittest.mock import ANY, Mock, patch
from ggshield.config import Cache
from ggshield.dev_scan import cd
from ggshield.scan import Commit
from ggshield.utils import SupportedScanMode
from tests.conftest import _SIMPLE_SECRET
def test_c... |
example/migrations/0002_taggeditem.py | sha016/django-rest-framework-json-api | 1,011 | 11130956 | import django.db.models.deletion
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
("contenttypes", "0002_remove_content_type_name"),
("example", "0001_initial"),
]
operations = [
migrations.CreateModel(
name="TaggedItem"... |
lib/performance_metrics.py | janged/explainx | 310 | 11130969 | <reponame>janged/explainx<filename>lib/performance_metrics.py
# Import modules
import pandas as pd
import numpy as np
import sklearn
from sklearn import *
from sklearn.ensemble import RandomForestClassifier
from sklearn.model_selection import train_test_split
from sklearn.preprocessing import label_binarize
from sklear... |
utils/regex.py | goztrk/django-htk | 206 | 11130975 | # Python Standard Library Imports
import re
class Re(object):
def __init__(self):
self.last_match = None
def match(self, pattern, text):
if type(pattern).__name__ == 'SRE_Pattern':
self.last_match = pattern.match(text)
else:
self.last_match = re.match(pattern, ... |
kitsune/upload/tests/__init__.py | AndrewDVXI/kitsune | 929 | 11130980 | <reponame>AndrewDVXI/kitsune
from django.conf import settings
from django.core.files import File
import factory
from nose.tools import eq_, raises
from kitsune.questions.tests import QuestionFactory
from kitsune.sumo.tests import TestCase
from kitsune.upload.models import ImageAttachment
from kitsune.upload.storage i... |
immutables/map.py | alvistack/MagicStack-immutables | 934 | 11130987 | <filename>immutables/map.py
import collections.abc
import itertools
import reprlib
import sys
__all__ = ('Map',)
# Thread-safe counter.
_mut_id = itertools.count(1).__next__
# Python version of _map.c. The topmost comment there explains
# all datastructures and algorithms.
# The code here follows C code closely ... |
pylayers/antprop/tests/test_air.py | usmanwardag/pylayers | 143 | 11131050 | <gh_stars>100-1000
from pylayers.simul.link import *
import pdb
DL0 = DLink(L='testair0.lay')
DL1 = DLink(L='testair1.lay')
DL0.a = np.array([1,3,1])
DL0.b = np.array([8,1,2.5])
DL1.a = np.array([1,3,1])
DL1.b = np.array([8,1,2.5])
DL0.eval(force=1,cutoff=1,threshold=0.1)
DL1.eval(force=1,cutoff=1,threshold=0.1)
DL0.p... |
wandb/vendor/prompt_toolkit/styles/from_pygments.py | dreamflasher/client | 6,989 | 11131052 | """
Adaptor for building prompt_toolkit styles, starting from a Pygments style.
Usage::
from pygments.styles.tango import TangoStyle
style = style_from_pygments(pygments_style_cls=TangoStyle)
"""
from __future__ import unicode_literals
from .base import Style
from .from_dict import style_from_dict
__all__ =... |
tests/unit_test/test_java.py | Lufedi/reaper | 106 | 11131062 | import os
import unittest
from attributes.unit_test.discoverer import get_test_discoverer
from tests import get_lsloc, REPOS_PATH
class JavaTestDiscovererTestCase(unittest.TestCase):
def setUp(self):
self.discoverer = get_test_discoverer('Java')
@unittest.skipIf(not os.path.exists(REPOS_PATH), 'setu... |
news/spiders/ip.py | GingerWWW/news_spider | 208 | 11131074 | # -*- coding: utf-8 -*-
import scrapy
class IpSpider(scrapy.Spider):
"""
IP代理测试 蜘蛛
重试3次,每次超时10秒
使用:
进入项目目录
$ scrapy crawl ip
"""
name = "ip"
allowed_domains = ["ip.cn"]
start_urls = (
'https://ip.cn',
)
custom_settings = dict(
COOKIES_ENABLED=True,
... |
sumatra/dependency_finder/genesis.py | usnistgov/corr-sumatra | 143 | 11131079 | """
GENESIS-specific functions for finding information about dependencies.
Classes
-------
Dependency - contains information about a .g or .p file, and tries to determine
version information.
Functions
---------
find_version_from_versioncontrol() - determines whether a GENESIS file is
... |
data/recognition_dataset.py | BradyFU/DVG | 102 | 11131081 | import os
import copy
import math
import time
import random
import numpy as np
from PIL import Image
import torch
import torch.utils.data as data
import torchvision.transforms as transforms
def default_loader(path):
img = Image.open(path).convert('L')
return img
def default_list_reader(file... |
googleanalytics/tests/__init__.py | ruber0id/google-analytics | 170 | 11131082 | <filename>googleanalytics/tests/__init__.py
# encoding: utf-8
"""
These unit tests are somewhat limited in scope because they need
to work with any Google Analytics data. Therefore, we mainly test
for coherence and whether various functions return the proper
data structure, rather than whether the results are exactly
... |
backend/examples/migrations/0006_alter_example_upload_name.py | arcada-uas/doccano | 2,082 | 11131085 | <gh_stars>1000+
# Generated by Django 4.0.2 on 2022-04-05 02:59
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
("examples", "0005_auto_20220405_0252"),
]
operations = [
migrations.AlterField(
model_name="example",
... |
test/intervals.py | davemarr621/interval_tree_1 | 488 | 11131124 | """
intervaltree: A mutable, self-balancing interval tree for Python 2 and 3.
Queries may be by point, by range overlap, or by range envelopment.
Test module: utilities to generate intervals
Copyright 2013-2018 <NAME>
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in... |
cifar_pipeline/configs/fixup/wideresnet/fixup_0_0_1/100_layers.py | PavelOstyakov/pipeline | 214 | 11131131 | <reponame>PavelOstyakov/pipeline<filename>cifar_pipeline/configs/fixup/wideresnet/fixup_0_0_1/100_layers.py
from ..base import ConfigWideResNetBase
class Config(ConfigWideResNetBase):
def __init__(self):
super().__init__(num_layers=100, fixup_coeff=0.01, normalization_type=ConfigWideResNetBase.FIXUP)
|
tests/test_kinesis/test_kinesis_cloudformation.py | gtourkas/moto | 5,460 | 11131142 | <gh_stars>1000+
import boto3
import sure # noqa # pylint: disable=unused-import
from moto import mock_kinesis, mock_cloudformation
@mock_cloudformation
def test_kinesis_cloudformation_create_stream():
cf_conn = boto3.client("cloudformation", region_name="us-east-1")
stack_name = "MyStack"
template = '... |
dashboard/dashboard/pinpoint/models/change/repository_test.py | tingshao/catapult | 1,894 | 11131153 | # Copyright 2017 The Chromium Authors. All rights reserved.
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
from __future__ import print_function
from __future__ import division
from __future__ import absolute_import
from dashboard.pinpoint.models.change import re... |
etl/parsers/etw/Microsoft_Windows_TPM_WMI.py | IMULMUL/etl-parser | 104 | 11131155 | # -*- coding: utf-8 -*-
"""
Microsoft-Windows-TPM-WMI
GUID : 7d5387b0-cbe0-11da-a94d-0800200c9a66
"""
from construct import Int8sl, Int8ul, Int16ul, Int16sl, Int32sl, Int32ul, Int64sl, Int64ul, Bytes, Double, Float32l, Struct
from etl.utils import WString, CString, SystemTime, Guid
from etl.dtyp import Sid
from etl.par... |
benchmarks/heterogeneous_output_Lambdify.py | Midnighter/symengine.py | 133 | 11131182 | <reponame>Midnighter/symengine.py<filename>benchmarks/heterogeneous_output_Lambdify.py<gh_stars>100-1000
#!/usr/bin/env python
import os
from time import clock
import numpy as np
import sympy as sp
from sympy.parsing.sympy_parser import parse_expr
from sympy.parsing.sympy_parser import standard_transformations
import s... |
dask_image/dispatch/_dispatch_ndmorph.py | martinschorb/dask-image | 144 | 11131202 | # -*- coding: utf-8 -*-
import numpy as np
import scipy.ndimage
from ._dispatcher import Dispatcher
__all__ = [
"dispatch_binary_dilation",
"dispatch_binary_erosion",
"dispatch_binary_structure",
]
dispatch_binary_dilation = Dispatcher(name="dispatch_binary_dilation")
dispatch_binary_erosion = Dispatche... |
src/utils/time_ext.py | HaoJiangGuo/fp-server | 173 | 11131206 | # -*- coding: utf-8 -*-
import datetime
import re
import time
ZERO_TIME_DELTA = datetime.timedelta(0)
LOCAL_TIME_DELTA = datetime.timedelta(hours=8) # 本地时区偏差
class UTC(datetime.tzinfo):
def utcoffset(self, dt):
return ZERO_TIME_DELTA
def dst(self, dt):
return ZERO_TIME_DELTA... |
CommonTools/ParticleFlow/python/ParticleSelectors/pfElectronsFromVertex_cfi.py | ckamtsikis/cmssw | 852 | 11131225 | import FWCore.ParameterSet.Config as cms
pfElectronsFromVertex = cms.EDFilter(
"IPCutPFCandidateSelector",
src = cms.InputTag("pfAllElectrons"), # PFCandidate source
vertices = cms.InputTag("offlinePrimaryVertices"), # vertices source
d0Cut = cms.double(0.2), # transverse IP
dzCut = cms.double(0... |
gen2-social-distancing/distance.py | ibaiGorordo/depthai-experiments | 381 | 11131243 | import itertools
import logging
import math
import cv2
log = logging.getLogger(__name__)
def calculate_distance(point1, point2):
x1, y1, z1 = point1
x2, y2, z2 = point2
dx, dy, dz = x1 - x2, y1 - y2, z1 - z2
distance = math.sqrt(dx ** 2 + dy ** 2 + dz ** 2)
return distance
class DistanceGuardia... |
tester/test_model/test_post_hist.py | bukun/TorCMS | 243 | 11131257 | # -*- coding:utf-8 -*-
from torcms.core import tools
from torcms.model.post_hist_model import MPostHist
from torcms.model.post_model import MPost
class TestMPostHist():
def setup(self):
print('setup 方法执行于本类中每条用例之前')
self.uid = ''
self.post_id = 'llk8'
def test_create_post_history(self... |
tools/point_cloud_vis.py | sisl/neat | 183 | 11131263 | import argparse
import numpy as np
import open3d as o3d
parser = argparse.ArgumentParser()
parser.add_argument('--file', type=str, default='../carla_results/auto_pilot_v3_42/eval_routes_06_12_23_30_25/lidar_360/0000.npy', help='npy point cloud')
def main():
pcd_npy = np.load(args.file)
pcd = o3d.geom... |
questions/valid-parenthesis-string/Solution.py | marcus-aurelianus/leetcode-solutions | 141 | 11131265 | """
Given a string containing only three types of characters: '(', ')' and '*', write a function to check whether this string is valid. We define the validity of a string by these rules:
Any left parenthesis '(' must have a corresponding right parenthesis ')'.
Any right parenthesis ')' must have a corresponding le... |
EventFilter/L1GlobalTriggerRawToDigi/test/L1GtPacker_cfg.py | ckamtsikis/cmssw | 852 | 11131283 | from __future__ import print_function
#
# cfg file to pack a GT DAQ record
#
# V <NAME> 2009-04-06
import FWCore.ParameterSet.Config as cms
# process
process = cms.Process('TestL1GtPacker')
###################### user choices ######################
# choose (pre)release
useRelease = 'CMSSW_3_1_0'
#useRelease = 'CMSS... |
tests/test_constant.py | bibek22/einsteinpy | 485 | 11131285 | import astropy.units as u
import numpy as np
import pytest
from astropy import constants
from numpy.testing import assert_allclose
from einsteinpy.constant import Cosmo_Const, Cosmo_Const_base
def test_Cosmo_Const_returns_correct_value_units():
cnst = Cosmo_Const
assert cnst.value == 2.036e-35
assert isi... |
test/test_graph.py | tknuth/sortvis | 117 | 11131296 | import os.path
from libsortvis import graph, sortable, algos
import libpry
OUTDIR = "tmp"
class _GraphTest(libpry.AutoTree):
def setUpAll(self):
if not os.path.exists(OUTDIR):
os.mkdir(OUTDIR)
class uWeave(_GraphTest):
def test_lineCoords(self):
csource = graph.ColourGradient((1,... |
tools/gdb/gdb_chrome.py | Scopetta197/chromium | 212 | 11131301 | # Copyright (c) 2011 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.
"""GDB support for Chrome types.
Add this to your gdb by amending your ~/.gdbinit as follows:
python
import sys
sys.path.insert(0, "/path/to/tools... |
Configuration/StandardSequences/python/RunsAndWeights.py | Purva-Chaudhari/cmssw | 852 | 11131328 | RunsAndWeights = {
'Run2012_AB_C_D_oneRunPerEra' : 'SimGeneral.Configuration.RunsAndWeights_Run2012_AB_C_D_oneRunPerEra',
'Run2018_ABCD' : 'SimGeneral.Configuration.RunsAndWeights_Run2018_ABCD',
'Run2018_Equal_Lumi_Integer_Weights' : 'SimGeneral.Configuration.RunsAndWeights_Run2018_Equal_Lumi_Integer_Weight... |
src/cryptography/hazmat/primitives/kdf/concatkdf.py | ceridwen/cryptography | 9,953 | 11131343 | # This file is dual licensed under the terms of the Apache License, Version
# 2.0, and the BSD License. See the LICENSE file in the root of this repository
# for complete details.
from __future__ import absolute_import, division, print_function
import struct
from cryptography import utils
from cryptography.exception... |
firefly/main.py | EdwardBetts/firefly | 207 | 11131345 | <reponame>EdwardBetts/firefly
import os
import sys
import argparse
import importlib
import yaml
import logging
from .app import Firefly
from .validator import ValidationError, FireflyError
from .version import __version__
from wsgiref.simple_server import make_server
logger = logging.getLogger("firefly")
def load_fro... |
tests/pytorch_pfn_extras_tests/cuda_tests/test_allocator.py | yasuyuky/pytorch-pfn-extras | 243 | 11131349 | import pytest
import torch
import pytorch_pfn_extras as ppe
def test_stream():
cupy = pytest.importorskip('cupy')
assert 0 == cupy.cuda.get_current_stream().ptr
assert 0 == torch.cuda.current_stream().cuda_stream
# Use the default stream.
cupy.arange(10)
torch.arange(10)
# Use the cust... |
audio/tools.py | ishine/Comprehensive-Transformer-TTS | 147 | 11131356 | import torch
import numpy as np
from scipy.io.wavfile import write
from audio.audio_processing import griffin_lim
def get_mel_from_wav(audio, _stft):
audio = torch.clip(torch.FloatTensor(audio).unsqueeze(0), -1, 1)
audio = torch.autograd.Variable(audio, requires_grad=False)
melspec, energy = _stft.mel_sp... |
1031 Maximum Sum of Two Non-Overlapping Subarrays.py | krishna13052001/LeetCode | 872 | 11131389 | <filename>1031 Maximum Sum of Two Non-Overlapping Subarrays.py<gh_stars>100-1000
#!/usr/bin/python3
"""
Given an array A of non-negative integers, return the maximum sum of elements in
two non-overlapping (contiguous) subarrays, which have lengths L and M. (For
clarification, the L-length subarray could occur before o... |
lib/django-1.3/django/contrib/markup/templatetags/markup.py | MiCHiLU/google_appengine_sdk | 790 | 11131392 | <filename>lib/django-1.3/django/contrib/markup/templatetags/markup.py
"""
Set of "markup" template filters for Django. These filters transform plain text
markup syntaxes to HTML; currently there is support for:
* Textile, which requires the PyTextile library available at
http://loopcore.com/python-textile/
... |
cnstd/utils/metrics.py | breezedeus/cnstd | 266 | 11131409 | <reponame>breezedeus/cnstd
# coding: utf-8
# Copyright (C) 2021, [Breezedeus](https://github.com/breezedeus).
# 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 ownershi... |
scale/queue/test/messages/test_requeue_jobs_bulk.py | kaydoh/scale | 121 | 11131436 | <reponame>kaydoh/scale
from __future__ import unicode_literals
from datetime import timedelta
import django
from django.test import TestCase
import batch.test.utils as batch_test_utils
import recipe.test.utils as recipe_test_utils
from error.test import utils as error_test_utils
from job.configuration.data.job_data ... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.