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 |
|---|---|---|---|---|
dev/Gems/CloudGemMetric/v1/AWS/python/windows/Lib/numba/transforms.py | BadDevCode/lumberyard | 1,738 | 1455 | <filename>dev/Gems/CloudGemMetric/v1/AWS/python/windows/Lib/numba/transforms.py
"""
Implement transformation on Numba IR
"""
from __future__ import absolute_import, print_function
from collections import namedtuple, defaultdict
import logging
from numba.analysis import compute_cfg_from_blocks, find_top_level_loops
f... |
frappe/patches/v13_0/remove_web_view.py | chentaoz/frappe | 3,755 | 1463 | <filename>frappe/patches/v13_0/remove_web_view.py
import frappe
def execute():
frappe.delete_doc_if_exists("DocType", "Web View")
frappe.delete_doc_if_exists("DocType", "Web View Component")
frappe.delete_doc_if_exists("DocType", "CSS Class") |
Models/License-Plate-Recognition-Nigerian-vehicles-master/License-Plate-Recognition-Nigerian-vehicles-master/ocr.py | nipunjain099/AutoGuard | 147 | 1469 | import numpy as np
from skimage.transform import resize
from skimage import measure
from skimage.measure import regionprops
class OCROnObjects():
def __init__(self, license_plate):
character_objects = self.identify_boundary_objects(license_plate)
self.get_regions(character_objects, license_pla... |
qiskit/ml/datasets/iris.py | stefan-woerner/aqua | 504 | 1480 | # This code is part of Qiskit.
#
# (C) Copyright IBM 2018, 2020.
#
# This code is licensed under the Apache License, Version 2.0. You may
# obtain a copy of this license in the LICENSE.txt file in the root directory
# of this source tree or at http://www.apache.org/licenses/LICENSE-2.0.
#
# Any modifications or derivat... |
NAS/PaddleSlim/train_supernet.py | naviocean/SimpleCVReproduction | 923 | 1485 | from paddle.vision.transforms import (
ToTensor, RandomHorizontalFlip, RandomResizedCrop, SaturationTransform, Compose,
HueTransform, BrightnessTransform, ContrastTransform, RandomCrop, Normalize, RandomRotation
)
from paddle.vision.datasets import Cifar100
from paddle.io import DataLoader
from paddle.optimizer... |
chainer/_version.py | yumetov/chainer | 3,705 | 1520 | __version__ = '7.8.0'
_optional_dependencies = [
{
'name': 'CuPy',
'packages': [
'cupy-cuda120',
'cupy-cuda114',
'cupy-cuda113',
'cupy-cuda112',
'cupy-cuda111',
'cupy-cuda110',
'cupy-cuda102',
'cupy-cud... |
saleor/core/transactions.py | fairhopeweb/saleor | 15,337 | 1534 | from contextlib import contextmanager
from django.db import DatabaseError
from ..core.tracing import traced_atomic_transaction
@contextmanager
def transaction_with_commit_on_errors():
"""Perform transaction and raise an error in any occurred."""
error = None
with traced_atomic_transaction():
try... |
grr/server/grr_response_server/databases/db_yara_test_lib.py | khanhgithead/grr | 4,238 | 1538 | <gh_stars>1000+
#!/usr/bin/env python
# -*- encoding: utf-8 -*-
"""A module with test cases for the YARA database method."""
import os
from grr_response_server.databases import db
from grr_response_server.rdfvalues import objects as rdf_objects
class DatabaseTestYaraMixin(object):
"""A mixin class for testing YAR... |
tf_pose/slim/nets/mobilenet/mobilenet_v2_test.py | gpspelle/pose-estimation | 862 | 1574 | # Copyright 2018 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... |
lib/modeling/VGG16.py | rsumner31/Detectron | 429 | 1591 | # Copyright (c) 2017-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... |
setup.py | yangjing1127/xmind2testcase | 537 | 1592 | #!/usr/env/bin python
# -*- coding: utf-8 -*-
import io
import os
import sys
from shutil import rmtree
from setuptools import setup, find_packages, Command
about = {}
here = os.path.abspath(os.path.dirname(__file__))
with io.open(os.path.join(here, 'xmind2testcase', '__about__.py'), encoding='utf-8') as f: # custom
... |
AppServer/google/appengine/tools/devappserver2/login.py | loftwah/appscale | 790 | 1602 | <reponame>loftwah/appscale
#!/usr/bin/env python
#
# Copyright 2007 Google 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... |
stanza/models/common/dropout.py | rasimuvaikas/stanza | 3,633 | 1615 | <reponame>rasimuvaikas/stanza
import torch
import torch.nn as nn
class WordDropout(nn.Module):
""" A word dropout layer that's designed for embedded inputs (e.g., any inputs to an LSTM layer).
Given a batch of embedded inputs, this layer randomly set some of them to be a replacement state.
Note that this l... |
k2/python/host/k2host/properties.py | Jarvan-Wang/k2 | 144 | 1631 | <reponame>Jarvan-Wang/k2<filename>k2/python/host/k2host/properties.py
# Copyright (c) 2020 Xiaomi Corporation (author: <NAME>)
# See ../../../LICENSE for clarification regarding multiple authors
import torch
from torch.utils.dlpack import to_dlpack
from .fsa import Fsa
from _k2host import _is_valid
from _k2host im... |
server/www/packages/packages-windows/x86/ldap3/utils/asn1.py | zhoulhb/teleport | 640 | 1635 | """
"""
# Created on 2015.08.19
#
# Author: <NAME>
#
# Copyright 2015 - 2018 <NAME>
#
# This file is part of ldap3.
#
# ldap3 is free software: you can redistribute it and/or modify
# it under the terms of the GNU Lesser General Public License as published
# by the Free Software Foundation, either version... |
iota/commands/core/get_node_info.py | EasonC13/iota.py | 347 | 1660 | import filters as f
from iota import TransactionHash, Address
from iota.commands import FilterCommand, RequestFilter, ResponseFilter
from iota.filters import Trytes
__all__ = [
'GetNodeInfoCommand',
]
class GetNodeInfoCommand(FilterCommand):
"""
Executes `getNodeInfo` command.
See :py:meth:`iota.ap... |
apps/interface/settings/config.py | rainydaygit/testtcloudserver | 349 | 1670 | try:
from public_config import *
except ImportError:
pass
PORT = 9028
SERVICE_NAME = 'interface'
|
synapse/models/infotech.py | vertexproject/synapse | 216 | 1695 | import asyncio
import logging
import synapse.exc as s_exc
import synapse.lib.types as s_types
import synapse.lib.module as s_module
import synapse.lib.version as s_version
logger = logging.getLogger(__name__)
class Cpe23Str(s_types.Str):
'''
CPE 2.3 Formatted String
https://nvlpubs.nist.gov/nistpubs/Leg... |
tests/sources/test_clang_format.py | Justin-Fisher/webots | 1,561 | 1697 | #!/usr/bin/env python
# Copyright 1996-2021 Cyberbotics 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 applica... |
src/mesh/azext_mesh/servicefabricmesh/mgmt/servicefabricmesh/models/__init__.py | Mannan2812/azure-cli-extensions | 207 | 1705 | # coding=utf-8
# --------------------------------------------------------------------------
# Copyright (c) Microsoft Corporation. All rights reserved.
# Licensed under the MIT License. See License.txt in the project root for
# license information.
#
# Code generated by Microsoft (R) AutoRest Code Generator.
# Changes ... |
sdk/python/pulumi_azure/desktopvirtualization/workspace.py | henriktao/pulumi-azure | 109 | 1708 | <filename>sdk/python/pulumi_azure/desktopvirtualization/workspace.py
# 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 im... |
tests/pytorch_pfn_extras_tests/onnx/test_load_model.py | kmaehashi/pytorch-pfn-extras | 243 | 1716 | <reponame>kmaehashi/pytorch-pfn-extras<gh_stars>100-1000
import os
import pytest
import torch
import pytorch_pfn_extras.onnx as tou
from tests.pytorch_pfn_extras_tests.onnx.test_export_testcase import Net
@pytest.mark.filterwarnings("ignore:Named tensors .* experimental:UserWarning")
def test_onnx_load_model():
... |
language/bert_extraction/steal_bert_classifier/utils/wiki103_sentencize.py | Xtuden-com/language | 1,199 | 1727 | <filename>language/bert_extraction/steal_bert_classifier/utils/wiki103_sentencize.py<gh_stars>1000+
# coding=utf-8
# Copyright 2018 The Google AI Language Team Authors.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain... |
torchvision/datasets/samplers/__init__.py | yoshitomo-matsubara/vision | 12,063 | 1754 | <gh_stars>1000+
from .clip_sampler import DistributedSampler, UniformClipSampler, RandomClipSampler
__all__ = ("DistributedSampler", "UniformClipSampler", "RandomClipSampler")
|
CodeAnalysis/SourceMeter_Interface/SourceMeter-8.2.0-x64-linux/Python/Tools/python/pylint/pyreverse/writer.py | ishtjot/susereumutep | 14,668 | 1775 | # -*- coding: utf-8 -*-
# Copyright (c) 2008-2013 LOGILAB S.A. (Paris, FRANCE).
# http://www.logilab.fr/ -- mailto:<EMAIL>
#
# This program is free software; you can redistribute it and/or modify it under
# the terms of the GNU General Public License as published by the Free Software
# Foundation; either version 2 of t... |
dffml/operation/mapping.py | SGeetansh/dffml | 171 | 1779 | from typing import Dict, List, Any
from ..df.types import Definition
from ..df.base import op
from ..util.data import traverse_get
MAPPING = Definition(name="mapping", primitive="map")
MAPPING_TRAVERSE = Definition(name="mapping_traverse", primitive="List[str]")
MAPPING_KEY = Definition(name="key", primitive="str")
M... |
juriscraper/oral_args/united_states/federal_appellate/scotus.py | EvandoBlanco/juriscraper | 228 | 1781 | <reponame>EvandoBlanco/juriscraper<filename>juriscraper/oral_args/united_states/federal_appellate/scotus.py<gh_stars>100-1000
"""Scraper for Supreme Court of U.S.
CourtID: scotus
Court Short Name: scotus
History:
- 2014-07-20 - Created by <NAME>, reviewed by MLR
- 2017-10-09 - Updated by MLR.
"""
from datetime impor... |
script_tests/maf_extract_ranges_indexed_tests.py | lldelisle/bx-python | 122 | 1789 | import unittest
import base
class Test(base.BaseScriptTest, unittest.TestCase):
command_line = "./scripts/maf_extract_ranges_indexed.py ./test_data/maf_tests/mm8_chr7_tiny.maf -c -m 5 -p mm8."
input_stdin = base.TestFile(filename="./test_data/maf_tests/dcking_ghp074.bed")
output_stdout = base.TestFile(fi... |
qstklearn/1knn.py | elxavicio/QSTK | 339 | 1790 | <filename>qstklearn/1knn.py<gh_stars>100-1000
'''
(c) 2011, 2012 Georgia Tech Research Corporation
This source code is released under the New BSD license. Please see
http://wiki.quantsoftware.org/index.php?title=QSTK_License
for license details.
Created on Feb 20, 2011
@author: <NAME>
@organization: Georgia I... |
classification/model/build_gen.py | LittleWat/MCD_DA | 464 | 1793 | import svhn2mnist
import usps
import syn2gtrsb
import syndig2svhn
def Generator(source, target, pixelda=False):
if source == 'usps' or target == 'usps':
return usps.Feature()
elif source == 'svhn':
return svhn2mnist.Feature()
elif source == 'synth':
return syn2gtrsb.Feature()
def ... |
samples/modules/tensorflow/magic_wand/train/data_split_person.py | lviala-zaack/zephyr | 6,224 | 1799 | # Lint as: python3
# coding=utf-8
# Copyright 2019 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/LICE... |
tests/k8s_handler.py | josebalius/go-spacemesh | 586 | 1800 | from datetime import datetime
from kubernetes import client
from kubernetes.client.rest import ApiException
import os
import time
import yaml
from tests import config as conf
import tests.utils as ut
def remove_clusterrole_binding(shipper_name, crb_name):
# remove clusterrolebind
k8s_client = client.RbacAuth... |
onmt/keyphrase/pke/unsupervised/graph_based/expandrank.py | NaomiatLibrary/OpenNMT-kpg-release | 152 | 1808 | #!/usr/bin/env python
# -*- coding: utf-8 -*-
# Author: <NAME>
# Date: 10-02-2018
"""ExpandRank keyphrase extraction model.
Graph-based ranking approach to keyphrase extraction described in:
* <NAME> and <NAME>.
Single Document Keyphrase Extraction Using Neighborhood Knowledge.
*In proceedings of AAAI*, pages 85... |
dash/long_callback/managers/celery_manager.py | nickmelnikov82/dash | 17,143 | 1810 | import json
import inspect
import hashlib
from _plotly_utils.utils import PlotlyJSONEncoder
from dash.long_callback.managers import BaseLongCallbackManager
class CeleryLongCallbackManager(BaseLongCallbackManager):
def __init__(self, celery_app, cache_by=None, expire=None):
"""
Long callback manag... |
saleor/order/migrations/0081_auto_20200406_0456.py | fairhopeweb/saleor | 15,337 | 1813 | <gh_stars>1000+
# Generated by Django 3.0.4 on 2020-04-06 09:56
from django.db import migrations
from saleor.order import OrderStatus
def match_orders_with_users(apps, *_args, **_kwargs):
Order = apps.get_model("order", "Order")
User = apps.get_model("account", "User")
orders_without_user = Order.objec... |
function/python/brightics/function/textanalytics/regex.py | jhpark428/studio | 202 | 1814 | """
Copyright 2019 Samsung SDS
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 ... |
applications/CSharpWrapperApplication/tests/test_CSharpWrapperApplication.py | lkusch/Kratos | 778 | 1816 | # import Kratos
import KratosMultiphysics
import KratosMultiphysics.StructuralMechanicsApplication as StructuralMechanicsApplication
import KratosMultiphysics.CSharpWrapperApplication as CSharpWrapperApplication
import run_cpp_unit_tests
# Import Kratos "wrapper" for unittests
import KratosMultiphysics.KratosUnittest ... |
spektral/datasets/qm9.py | JonaBecher/spektral | 2,145 | 1838 | import os
import os.path as osp
import numpy as np
from joblib import Parallel, delayed
from tensorflow.keras.utils import get_file
from tqdm import tqdm
from spektral.data import Dataset, Graph
from spektral.utils import label_to_one_hot, sparse
from spektral.utils.io import load_csv, load_sdf
ATOM_TYPES = [1, 6, 7... |
01_basics/01_building_expressions/02_vector_mat_soln.py | johny-c/theano_exercises | 711 | 1866 | <filename>01_basics/01_building_expressions/02_vector_mat_soln.py
import numpy as np
from theano import function
import theano.tensor as T
def make_vector():
"""
Returns a new Theano vector.
"""
return T.vector()
def make_matrix():
"""
Returns a new Theano matrix.
"""
return T.matrix... |
tf_agents/bandits/agents/examples/v2/trainer.py | howards11/agents | 3,175 | 1868 | <reponame>howards11/agents<filename>tf_agents/bandits/agents/examples/v2/trainer.py
# coding=utf-8
# Copyright 2020 The TF-Agents Authors.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# ... |
SLHCUpgradeSimulations/Configuration/python/aging.py | ckamtsikis/cmssw | 852 | 1924 | <gh_stars>100-1000
import FWCore.ParameterSet.Config as cms
# handle normal mixing or premixing
def getHcalDigitizer(process):
if hasattr(process,'mixData'):
return process.mixData
if hasattr(process,'mix') and hasattr(process.mix,'digitizers') and hasattr(process.mix.digitizers,'hcal'):
return... |
tests/python/correctness/simple_test_aux_index.py | dubey/weaver | 163 | 1937 | <filename>tests/python/correctness/simple_test_aux_index.py
#! /usr/bin/env python
#
# ===============================================================
# Description: Sanity check for fresh install.
#
# Created: 2014-08-12 16:42:52
#
# Author: <NAME>, <EMAIL>
#
# Copyright (C) 2013, Cornell Uni... |
tests/test-scripts/threadpools.py | whalesalad/filprofiler | 521 | 1958 | <gh_stars>100-1000
"""Validate that number of threads in thread pools is set to 1."""
import numexpr
import blosc
import threadpoolctl
# APIs that return previous number of threads:
assert numexpr.set_num_threads(2) == 1
assert blosc.set_nthreads(2) == 1
for d in threadpoolctl.threadpool_info():
assert d["num_th... |
sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2018_01_01_preview/models/_models_py3.py | rsdoherty/azure-sdk-for-python | 2,728 | 1970 | # coding=utf-8
# --------------------------------------------------------------------------
# Copyright (c) Microsoft Corporation. All rights reserved.
# Licensed under the MIT License. See License.txt in the project root for license information.
# Code generated by Microsoft (R) AutoRest Code Generator.
# Changes may ... |
netesto/local/psPlot.py | fakeNetflix/facebook-repo-fbkutils | 346 | 1973 | #!/usr/bin/env python2
import sys
import random
import os.path
import shutil
import commands
import types
import math
#gsPath = '/usr/local/bin/gs'
gsPath = 'gs'
logFile = '/dev/null'
#logFile = 'plot.log'
#--- class PsPlot(fname, pageHeader, pageSubHeader, plotsPerPage)
#
class PsPlot(object):
def __init__(self... |
func-button/klSigmode.py | xcgoo/uiKLine | 232 | 1983 | <gh_stars>100-1000
# coding: utf-8
"""
插入所有需要的库,和函数
"""
#----------------------------------------------------------------------
def klSigmode(self):
"""查找模式"""
if self.mode == 'deal':
self.canvas.updateSig(self.signalsOpen)
self.mode = 'dealOpen'
else:
self.canvas.updateSig(self.... |
mmdnn/conversion/caffe/writer.py | 2yz/MMdnn | 3,442 | 1991 | <reponame>2yz/MMdnn
import base64
from google.protobuf import json_format
from importlib import import_module
import json
import numpy as np
import os
import sys
from mmdnn.conversion.caffe.errors import ConversionError
from mmdnn.conversion.caffe.common_graph import fetch_attr_value
from mmdnn.conversion.caffe.utils ... |
examples/server/models/image_file_upload.py | ParikhKadam/django-angular | 941 | 1996 | # -*- coding: utf-8 -*-
from __future__ import unicode_literals
# start tutorial
from django.db import models
from djng.forms import NgModelFormMixin, NgFormValidationMixin
from djng.styling.bootstrap3.forms import Bootstrap3ModelForm
class SubscribeUser(models.Model):
full_name = models.CharField(
"<NAME... |
python/tvm/topi/hexagon/slice_ops/add_subtract_multiply.py | yangulei/tvm | 4,640 | 1997 | # Licensed to the Apache Software Foundation (ASF) under one
# or more contributor license agreements. See the NOTICE file
# distributed with this work for additional information
# regarding copyright ownership. The ASF licenses this file
# to you under the Apache License, Version 2.0 (the
# "License"); you may ... |
chrome/test/telemetry/chromeos/login_unittest.py | Fusion-Rom/android_external_chromium_org | 231 | 1999 | # Copyright (c) 2012 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 json
import logging
import os
import unittest
from telemetry.core import browser_finder
from telemetry.core import exceptions
from telemetry.core ... |
src/aprl/agents/monte_carlo.py | fkamrani/adversarial-policies | 211 | 2002 | <filename>src/aprl/agents/monte_carlo.py
"""Monte Carlo receding horizon control."""
from abc import ABC, abstractmethod
from multiprocessing import Pipe, Process
import gym
from stable_baselines.common.vec_env import CloudpickleWrapper
from aprl.common.mujoco import MujocoState, ResettableEnv
class MujocoResettab... |
book/trees/binary_search_tree.py | Web-Dev-Collaborative/algos | 153 | 2020 | # -*- coding: utf-8 -*-
"""
The `TreeNode` class provides many helper functions that make the work
done in the `BinarySearchTree` class methods much easier. The
constructor for a `TreeNode`, along with these helper functions, is
shown below. As you can see, many of these helper functions help to
classify a node acco... |
util/headers.py | giuseppe/quay | 2,027 | 2023 | <gh_stars>1000+
import base64
def parse_basic_auth(header_value):
"""
Attempts to parse the given header value as a Base64-encoded Basic auth header.
"""
if not header_value:
return None
parts = header_value.split(" ")
if len(parts) != 2 or parts[0].lower() != "basic":
return... |
caffe2/python/operator_test/partition_ops_test.py | KevinKecc/caffe2 | 585 | 2032 | # 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... |
jupytext/kernels.py | st--/jupytext | 5,378 | 2038 | """Find kernel specifications for a given language"""
import os
import sys
from .languages import same_language
from .reraise import reraise
try:
# I prefer not to take a dependency on jupyter_client
from jupyter_client.kernelspec import find_kernel_specs, get_kernel_spec
except ImportError as err:
find_... |
tests/test_base_table.py | stjordanis/datar | 110 | 2057 | <filename>tests/test_base_table.py<gh_stars>100-1000
import pytest
from datar import stats
from datar.base import *
from datar import f
from datar.datasets import warpbreaks, state_division, state_region, airquality
from .conftest import assert_iterable_equal
def test_table():
# https://www.rdocumentation.org/pa... |
src/sol/handle_metaplex.py | terra-dashboard/staketaxcsv | 140 | 2063 | from common.make_tx import make_swap_tx
from sol.handle_simple import handle_unknown_detect_transfers
def handle_metaplex(exporter, txinfo):
transfers_in, transfers_out, _ = txinfo.transfers_net
if len(transfers_in) == 1 and len(transfers_out) == 1:
sent_amount, sent_currency, _, _ = transfers_out[0]... |
tianshou/utils/logger/tensorboard.py | Aceticia/tianshou | 4,714 | 2082 | <reponame>Aceticia/tianshou<filename>tianshou/utils/logger/tensorboard.py
import warnings
from typing import Any, Callable, Optional, Tuple
from tensorboard.backend.event_processing import event_accumulator
from torch.utils.tensorboard import SummaryWriter
from tianshou.utils.logger.base import LOG_DATA_TYPE, BaseLog... |
tempest/tests/lib/services/compute/test_security_group_default_rules_client.py | mail2nsrajesh/tempest | 254 | 2092 | <reponame>mail2nsrajesh/tempest<filename>tempest/tests/lib/services/compute/test_security_group_default_rules_client.py
# Copyright 2015 NEC 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... |
demo/cnn_predict.py | huynhtnhut97/keras-video-classifier | 108 | 2101 | import numpy as np
from keras import backend as K
import os
import sys
K.set_image_dim_ordering('tf')
def patch_path(path):
return os.path.join(os.path.dirname(__file__), path)
def main():
sys.path.append(patch_path('..'))
data_dir_path = patch_path('very_large_data')
model_dir_path = patch_path('... |
pmdarima/preprocessing/endog/boxcox.py | tuomijal/pmdarima | 736 | 2103 | <reponame>tuomijal/pmdarima<gh_stars>100-1000
# -*- coding: utf-8 -*-
from scipy import stats
import numpy as np
import warnings
from ...compat import check_is_fitted, pmdarima as pm_compat
from .base import BaseEndogTransformer
__all__ = ['BoxCoxEndogTransformer']
class BoxCoxEndogTransformer(BaseEndogTransforme... |
neutron/db/migration/alembic_migrations/versions/mitaka/contract/c6c112992c9_rbac_qos_policy.py | congnt95/neutron | 1,080 | 2131 | <gh_stars>1000+
# Copyright 2015 OpenStack Foundation
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the License. You may obtain
# a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by... |
boto3_type_annotations/boto3_type_annotations/guardduty/client.py | cowboygneox/boto3_type_annotations | 119 | 2147 | <filename>boto3_type_annotations/boto3_type_annotations/guardduty/client.py
from typing import Optional
from botocore.client import BaseClient
from typing import Dict
from typing import Union
from botocore.paginate import Paginator
from botocore.waiter import Waiter
from typing import List
class Client(BaseClient):
... |
alipay/aop/api/domain/MetroOdItem.py | antopen/alipay-sdk-python-all | 213 | 2153 | #!/usr/bin/env python
# -*- coding: utf-8 -*-
import json
from alipay.aop.api.constant.ParamConstants import *
from alipay.aop.api.domain.CloudbusUserInfo import CloudbusUserInfo
class MetroOdItem(object):
def __init__(self):
self._dest_geo = None
self._od = None
self._time = None
... |
qiskit/ignis/mitigation/measurement/filters.py | paulineollitrault/qiskit-ignis | 182 | 2157 | <reponame>paulineollitrault/qiskit-ignis<gh_stars>100-1000
# -*- coding: utf-8 -*-
# This code is part of Qiskit.
#
# (C) Copyright IBM 2019.
#
# 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 a... |
dev/Code/Framework/AzFramework/CodeGen/AzEBusInline.py | jeikabu/lumberyard | 1,738 | 2165 | #
# All or portions of this file Copyright (c) Amazon.com, Inc. or its affiliates or
# its licensors.
#
# For complete copyright and license terms please see the LICENSE at the root of this
# distribution (the "License"). All use of this software is governed by the License,
# or, if provided, by the license below or th... |
youtube_dl/extractor/turner.py | jonyg80/youtube-dl | 66,635 | 2171 | # coding: utf-8
from __future__ import unicode_literals
import re
from .adobepass import AdobePassIE
from ..compat import compat_str
from ..utils import (
fix_xml_ampersands,
xpath_text,
int_or_none,
determine_ext,
float_or_none,
parse_duration,
xpath_attr,
update_url_query,
Extrac... |
tests/zpill.py | al3pht/cloud-custodian | 2,415 | 2173 | <gh_stars>1000+
# Copyright The Cloud Custodian Authors.
# SPDX-License-Identifier: Apache-2.0
import fnmatch
from io import StringIO
import json
import os
import shutil
import zipfile
import re
from datetime import datetime, timedelta, tzinfo
from distutils.util import strtobool
import boto3
import placebo
from botoc... |
tao_compiler/mlir/disc/tests/glob_op_test.bzl | JamesTheZ/BladeDISC | 328 | 2180 | # Test definitions for Lit, the LLVM test runner.
#
# This is reusing the LLVM Lit test runner in the interim until the new build
# rules are upstreamed.
# TODO(b/136126535): remove this custom rule.
"""Lit runner globbing test
"""
load("//tensorflow:tensorflow.bzl", "filegroup")
load("@bazel_skylib//lib:paths.bzl", "... |
src/transformers/modeling_tf_pytorch_utils.py | ari-holtzman/transformers | 5,129 | 2182 | # coding=utf-8
# Copyright 2018 The Google AI Language Team Authors and The HuggingFace Inc. team.
# Copyright (c) 2018, <NAME>. 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 Lic... |
examples/text_classification/yelp_reviews_polarity/train.py | liorshk/simpletransformers | 3,151 | 2186 | <reponame>liorshk/simpletransformers<gh_stars>1000+
import sys
import pandas as pd
from simpletransformers.classification import ClassificationModel
prefix = "data/"
train_df = pd.read_csv(prefix + "train.csv", header=None)
train_df.head()
eval_df = pd.read_csv(prefix + "test.csv", header=None)
eval_df.head()
tra... |
gluoncv/data/transforms/block.py | Kh4L/gluon-cv | 5,447 | 2192 | # Licensed to the Apache Software Foundation (ASF) under one
# or more contributor license agreements. See the NOTICE file
# distributed with this work for additional information
# regarding copyright ownership. The ASF licenses this file
# to you under the Apache License, Version 2.0 (the
# "License"); you may not u... |
moe/bandit/ucb/ucb_interface.py | dstoeckel/MOE | 966 | 2214 | # -*- coding: utf-8 -*-
"""Classes (Python) to compute the Bandit UCB (Upper Confidence Bound) arm allocation and choosing the arm to pull next.
See :mod:`moe.bandit.bandit_interface` for further details on bandit.
"""
import copy
from abc import abstractmethod
from moe.bandit.bandit_interface import BanditInterfac... |
forms/snippets/delete_watch.py | soheilv/python-samples | 255 | 2232 | # Copyright 2021 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, ... |
corehq/apps/dump_reload/tests/test_sql_dump_load.py | andyasne/commcare-hq | 471 | 2252 | <gh_stars>100-1000
import inspect
import json
import uuid
from collections import Counter
from datetime import datetime
from io import StringIO
import mock
from django.contrib.admin.utils import NestedObjects
from django.db import transaction, IntegrityError
from django.db.models.signals import post_delete, post_save
... |
tests/keras/test_activations.py | the-moliver/keras | 150 | 2253 | import pytest
import numpy as np
from numpy.testing import assert_allclose
from keras import backend as K
from keras import activations
def get_standard_values():
'''
These are just a set of floats used for testing the activation
functions, and are useful in multiple tests.
'''
return np.array([[... |
setup.py | ouyhlan/fastNLP | 2,693 | 2266 | #!/usr/bin/env python
# coding=utf-8
from setuptools import setup, find_packages
with open('README.md', encoding='utf-8') as f:
readme = f.read()
with open('LICENSE', encoding='utf-8') as f:
license = f.read()
with open('requirements.txt', encoding='utf-8') as f:
reqs = f.read()
pkgs = [p for p in find_... |
pydlm/tests/base/testKalmanFilter.py | onnheimm/pydlm | 423 | 2279 | <gh_stars>100-1000
import numpy as np
import unittest
from pydlm.modeler.trends import trend
from pydlm.modeler.seasonality import seasonality
from pydlm.modeler.builder import builder
from pydlm.base.kalmanFilter import kalmanFilter
class testKalmanFilter(unittest.TestCase):
def setUp(self):
self.kf1 ... |
Tests/Marketplace/prepare_public_index_for_private_testing.py | diCagri/content | 799 | 2312 | import time
import os
import sys
import shutil
import json
import argparse
from zipfile import ZipFile
from contextlib import contextmanager
from datetime import datetime
from Tests.private_build.upload_packs_private import download_and_extract_index, update_index_with_priced_packs, \
extract_packs_artifacts
from T... |
plaidml2/edsl/__init__.py | ZhouXiaolin/plaidml | 4,535 | 2315 | <gh_stars>1000+
# Copyright 2019 Intel Corporation.
import logging
from collections import namedtuple
import numpy as np
import six
from plaidml2 import DType
from plaidml2.core import TensorShape, Buffer
from plaidml2.ffi import ForeignObject, ffi, ffi_call, lib
logger = logging.getLogger(__name__)
def __init():... |
backend/services/apns_util.py | xuantan/viewfinder | 645 | 2320 | <gh_stars>100-1000
# -*- coding: utf-8 -*-
# Copyright 2012 Viewfinder Inc. All Rights Reserved.
"""Apple Push Notification service utilities.
Original copyright for this code: https://github.com/jayridge/apnstornado
TokenToBinary(): converts a hex-encoded token into a binary value
CreateMessage(): formats a bin... |
demonstrations/tutorial_kernels_module.py | jamesellis1999/qml | 216 | 2321 | r"""Training and evaluating quantum kernels
===========================================
.. meta::
:property="og:description": Kernels and alignment training with Pennylane.
:property="og:image": https://pennylane.ai/qml/_images/QEK_thumbnail.png
.. related::
tutorial_kernel_based_training Kernel-based tr... |
tg/release.py | TurboGears/tg2 | 812 | 2329 | """TurboGears project related information"""
version = "2.4.3"
description = "Next generation TurboGears"
long_description="""
TurboGears brings together a best of breed python tools
to create a flexible, full featured, and easy to use web
framework.
TurboGears 2 provides an integrated and well tested set of tools for... |
applications/ChimeraApplication/tests/chimera_analysis_base_test.py | lkusch/Kratos | 778 | 2389 | <gh_stars>100-1000
import KratosMultiphysics
import KratosMultiphysics.KratosUnittest as UnitTest
import KratosMultiphysics.ChimeraApplication
from KratosMultiphysics.ChimeraApplication.fluid_chimera_analysis import FluidChimeraAnalysis
class ChimeraAnalysisBaseTest(UnitTest.TestCase):
def setUp(self):
# ... |
exercises/pt/exc_01_03_01.py | Jette16/spacy-course | 2,085 | 2392 | # Importar a classe da língua inglesa (English) e criar um objeto nlp
from ____ import ____
nlp = ____
# Processar o texto
doc = ____("I like tree kangaroos and narwhals.")
# Selecionar o primeiro token
first_token = doc[____]
# Imprimir o texto do primeito token
print(first_token.____)
|
image-generation/slegan/args.py | AaratiAkkapeddi/nnabla-examples | 228 | 2397 | <filename>image-generation/slegan/args.py
# Copyright 2021 Sony Corporation.
# Copyright 2021 Sony Group Corporation.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache... |
ignite/handlers/time_profilers.py | iamhardikat11/ignite | 4,119 | 2406 | import functools
from collections import OrderedDict
from typing import Any, Callable, Dict, List, Mapping, Sequence, Tuple, Union, cast
import torch
from ignite.engine import Engine, EventEnum, Events
from ignite.handlers.timing import Timer
class BasicTimeProfiler:
"""
BasicTimeProfiler can be used to pro... |
custom_components/snowtire/__init__.py | borys-kupar/smart-home | 128 | 2408 | #
# Copyright (c) 2020, Andrey "Limych" Khrolenok <<EMAIL>>
# Creative Commons BY-NC-SA 4.0 International Public License
# (see LICENSE.md or https://creativecommons.org/licenses/by-nc-sa/4.0/)
#
"""
The Snowtire binary sensor.
For more details about this platform, please refer to the documentation at
https://githu... |
tests/test_bayes_classifier.py | manishgit138/pomegranate | 3,019 | 2409 | from __future__ import (division)
from pomegranate import *
from pomegranate.io import DataGenerator
from pomegranate.io import DataFrameGenerator
from nose.tools import with_setup
from nose.tools import assert_almost_equal
from nose.tools import assert_equal
from nose.tools import assert_not_equal
from nose.tools im... |
tests/engine/knowledge_base.py | roshanmaskey/plaso | 1,253 | 2433 | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""Tests for the knowledge base."""
import unittest
from plaso.containers import artifacts
from plaso.engine import knowledge_base
from tests import test_lib as shared_test_lib
class KnowledgeBaseTest(shared_test_lib.BaseTestCase):
"""Tests for the knowledge base.""... |
Imaging/Core/Testing/Python/TestHSVToRGB.py | forestGzh/VTK | 1,755 | 2454 | #!/usr/bin/env python
import vtk
from vtk.util.misc import vtkGetDataRoot
VTK_DATA_ROOT = vtkGetDataRoot()
# Use the painter to draw using colors.
# This is not a pipeline object. It will support pipeline objects.
# Please do not use this object directly.
imageCanvas = vtk.vtkImageCanvasSource2D()
imageCanvas.SetNumb... |
tests/test_handler_surface_distance.py | dyollb/MONAI | 2,971 | 2456 | # 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 law or agreed to in wri... |
astroplan/constraints.py | edose/astroplan | 160 | 2488 | <gh_stars>100-1000
# Licensed under a 3-clause BSD style license - see LICENSE.rst
"""
Specify and constraints to determine which targets are observable for
an observer.
"""
from __future__ import (absolute_import, division, print_function,
unicode_literals)
# Standard library
from abc import ... |
example/image-classification/test_score.py | Vikas-kum/incubator-mxnet | 399 | 2496 | # Licensed to the Apache Software Foundation (ASF) under one
# or more contributor license agreements. See the NOTICE file
# distributed with this work for additional information
# regarding copyright ownership. The ASF licenses this file
# to you under the Apache License, Version 2.0 (the
# "License"); you may not u... |
dotnet/private/actions/resx_core.bzl | purkhusid/rules_dotnet | 143 | 2567 | <reponame>purkhusid/rules_dotnet
"Actions for compiling resx files"
load(
"@io_bazel_rules_dotnet//dotnet/private:providers.bzl",
"DotnetResourceInfo",
)
def _make_runner_arglist(dotnet, source, output, resgen):
args = dotnet.actions.args()
if type(source) == "Target":
args.add_all(source.fil... |
test/jit/test_modules.py | xiaohanhuang/pytorch | 183 | 2568 | # Owner(s): ["oncall: jit"]
import torch
import os
import sys
from torch.testing._internal.jit_utils import JitTestCase
# Make the helper files in test/ importable
pytorch_test_dir = os.path.dirname(os.path.dirname(os.path.realpath(__file__)))
sys.path.append(pytorch_test_dir)
if __name__ == '__main__':
raise Ru... |
salt/grains/nxos.py | babs/salt | 9,425 | 2581 | <gh_stars>1000+
"""
Grains for Cisco NX-OS minions
.. versionadded:: 2016.11.0
For documentation on setting up the nxos proxy minion look in the documentation
for :mod:`salt.proxy.nxos<salt.proxy.nxos>`.
"""
import logging
import salt.utils.nxos
import salt.utils.platform
from salt.exceptions import NxosClientError... |
src/oncall/messengers/teams_messenger.py | navoday-91/oncall | 857 | 2587 | <gh_stars>100-1000
import pymsteams
import logging
from oncall.constants import TEAMS_SUPPORT
class teams_messenger(object):
supports = frozenset([TEAMS_SUPPORT])
def __init__(self, config):
self.webhook = config['webhook']
def send(self, message):
heading = message.get("subject")
... |
examples/question_answering/qa_sparse_train.py | ebell495/nn_pruning | 250 | 2593 | # coding=utf-8
# Copyright 2020 The HuggingFace Team 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 require... |
scripts/examples/OpenMV/16-Codes/find_barcodes.py | jiskra/openmv | 1,761 | 2603 | # Barcode Example
#
# This example shows off how easy it is to detect bar codes using the
# OpenMV Cam M7. Barcode detection does not work on the M4 Camera.
import sensor, image, time, math
sensor.reset()
sensor.set_pixformat(sensor.GRAYSCALE)
sensor.set_framesize(sensor.VGA) # High Res!
sensor.set_windowing((640, 80... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.