max_stars_repo_path string | max_stars_repo_name string | max_stars_count int64 | id string | content string | add_param_types int64 | add_return_types int64 | add_class_field_types int64 | add_instance_field_types int64 | add_total int64 | add_error int64 |
|---|---|---|---|---|---|---|---|---|---|---|
qualcoder/GUI/ui_dialog_view_image.py | ericbrasiln/QualCoder | 150 | 131100 | <reponame>ericbrasiln/QualCoder<gh_stars>100-1000
# -*- coding: utf-8 -*-
# Form implementation generated from reading ui file 'ui_dialog_view_image.ui'
#
# Created by: PyQt5 UI code generator 5.14.1
#
# WARNING! All changes made in this file will be lost!
from PyQt5 import QtCore, QtGui, QtWidgets
class Ui_Dialog... | 0 | 0 | 0 | 0 | 0 | 0 |
lib/transmissionrpc/error.py | 0x20Man/Watcher3 | 320 | 131121 | <gh_stars>100-1000
# -*- coding: utf-8 -*-
# Copyright (c) 2008-2013 <NAME> <<EMAIL>>
# Licensed under the MIT license.
from six import string_types, integer_types
class TransmissionError(Exception):
"""
This exception is raised when there has occurred an error related to
communication with Transmission. It is ... | 0 | 0 | 0 | 0 | 0 | 0 |
tests/test_blobxfer.py | amishra-dev/blobxfer | 147 | 131130 | # coding=utf-8
"""Tests for miscellaneous"""
# stdlib imports
# non-stdlib imports
import azure.storage.common
# module under test
import blobxfer.version
def test_user_agent_monkey_patch():
verstr = 'blobxfer/{}'.format(blobxfer.version.__version__)
assert azure.storage.common._constants.USER_AGENT_STRING_P... | 0 | 0 | 0 | 0 | 0 | 0 |
train.py | asafnadler/DeepDGA | 240 | 131145 | from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
import os
import time
import numpy as np
import tensorflow as tf
import model
from data_reader import load_data, DataReader
flags = tf.flags
# data
flags.DEFINE_string('data_dir', 'data', 'data directo... | 0 | 1 | 0 | 0 | 1 | 0 |
tests/unit/viz/test_map.py | CartoDB/cartoframes | 236 | 131147 | <reponame>CartoDB/cartoframes
from cartoframes.auth import Credentials
from cartoframes.viz import Map, Layer, popup_element, constants
from cartoframes.viz.source import Source
from cartoframes.io.managers.context_manager import ContextManager
from .utils import build_geodataframe
from ..mocks.kuviz_mock import Kuv... | 0 | 0 | 0 | 0 | 0 | 0 |
webapp/graphite/functions/views.py | parrotpock/graphite-web | 4,281 | 131151 | import json
from graphite.util import jsonResponse, HttpResponse, HttpError
from graphite.functions import SeriesFunctions, SeriesFunction, PieFunctions, PieFunction, functionInfo
class jsonInfinityEncoder(json.JSONEncoder):
def encode(self, o) -> object:
return super(jsonInfinityEncoder, self).encode(o)... | 0 | 4 | 0 | 0 | 4 | 0 |
books/PRML/PRML-master-Python/test/nn/nonlinear/tanh.py | iamfaith/DeepLearning | 7,581 | 131160 | <filename>books/PRML/PRML-master-Python/test/nn/nonlinear/tanh.py
import unittest
from prml import nn
class TestTanh(unittest.TestCase):
def test_tanh(self):
self.assertEqual(nn.tanh(0).value, 0)
if __name__ == '__main__':
unittest.main()
| 0 | 0 | 0 | 0 | 0 | 0 |
solidity/python/EmulationExpTestCross.py | surzm/contracts-solidity | 200 | 131173 | import Web3Wrapper
import InputGenerator
import FormulaSolidityPort
MINIMUM_VALUE_BALANCE = 100
MAXIMUM_VALUE_BALANCE = 10 ** 34
GROWTH_FACTOR_BALANCE = 2.5
MINIMUM_VALUE_WEIGHT = 100000
MAXIMUM_VALUE_WEIGHT = 900000
GROWTH_FACTOR_WEIGHT = 1.5
MINIMUM_VALUE_AMOUNT = 1
MAXIMUM_VALUE_AMOUNT = 10 ** 34
GROWTH_FACTOR_A... | 0 | 2 | 0 | 0 | 2 | 0 |
homeassistant/components/template/trigger_entity.py | andersop91/core | 22,481 | 131175 | <filename>homeassistant/components/template/trigger_entity.py
"""Trigger entity."""
from __future__ import annotations
import logging
from typing import Any
from homeassistant.const import (
CONF_DEVICE_CLASS,
CONF_ICON,
CONF_NAME,
CONF_UNIQUE_ID,
CONF_UNIT_OF_MEASUREMENT,
)
from homeassistant.cor... | 0 | 0 | 0 | 0 | 0 | 0 |
tests/hikari/test_embeds.py | sabidib/hikari | 520 | 131212 | <filename>tests/hikari/test_embeds.py
# -*- coding: utf-8 -*-
# Copyright (c) 2020 Nekokatt
# Copyright (c) 2021 davfsa
#
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the "Software"), to deal
# in the Software without restriction, ... | 0 | 0 | 0 | 0 | 0 | 0 |
www/src/Lib/test/test_abc.py | stefanhoelzl/brython | 652 | 131218 | <filename>www/src/Lib/test/test_abc.py
# Copyright 2007 Google, Inc. All Rights Reserved.
# Licensed to PSF under a Contributor Agreement.
"""Unit tests for abc.py."""
import unittest
from test import support
import abc
from inspect import isabstract
class TestLegacyAPI(unittest.TestCase):
def test_abstractpr... | 0 | 0 | 0 | 0 | 0 | 0 |
algorithms/backtrack/factor_combinations.py | zhengli0817/algorithms | 128 | 131230 | <gh_stars>100-1000
"""
Numbers can be regarded as product of its factors. For example,
8 = 2 x 2 x 2;
= 2 x 4.
Write a function that takes an integer n and return all possible combinations of its factors.
Note:
You may assume that n is always positive.
Factors should be greater than 1 and less than n.
Examples:
inp... | 0 | 0 | 0 | 0 | 0 | 0 |
scripts/topModuleGen/src/TopModuleGen.py | d-m-bailey/openlane-openroad | 354 | 131231 | # Copyright 2020 Efabless 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.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in... | 0 | 12 | 0 | 0 | 12 | 0 |
MACServerDiscover.py | Lillecarl/WinboxPoC | 495 | 131237 | <filename>MACServerDiscover.py
import socket, binascii, threading, time
# MAC server discovery by BigNerd95
search = True
devices = []
def discovery(sock):
global search
while search:
sock.sendto(b"\x00\x00\x00\x00", ("255.255.255.255", 5678))
time.sleep(1)
sock = socket.socket(socket.AF_INE... | 0 | 0 | 0 | 0 | 0 | 0 |
homeassistant/components/airnow/config_flow.py | MrDelik/core | 30,023 | 131240 | from __future__ import annotations
"""Config flow for AirNow integration."""
import logging
from pyairnow import WebServiceAPI
from pyairnow.errors import AirNowError, InvalidKeyError
import voluptuous as vol
from homeassistant import config_entries, core, exceptions
from homeassistant.const import CONF_API_KEY, CONF... | 2 | 2 | 1 | 0 | 5 | 0 |
utility/sprocket_utility.py | m95music/yukarin | 139 | 131256 | import yaml
from scipy.signal import firwin, lfilter
class SpeakerYML(object):
def __init__(self, ymlf):
# open yml file
with open(ymlf) as yf:
conf = yaml.safe_load(yf)
# read parameter from yml file
self.wav_fs = conf['wav']['fs']
self.wav_bit = conf['wav']['... | 1 | 1 | 0 | 0 | 2 | 0 |
python/graphscope/analytical/app/pagerank_nx.py | LI-Mingyu/GraphScope-MY | 1,521 | 131264 | <filename>python/graphscope/analytical/app/pagerank_nx.py<gh_stars>1000+
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
#
# Copyright 2020 Alibaba Group Holding Limited. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the Lic... | 0 | 0 | 0 | 0 | 0 | 0 |
tensorflow/python/estimator/warm_starting_util_test.py | shengfuintel/tensorflow | 522 | 131266 | <filename>tensorflow/python/estimator/warm_starting_util_test.py
# 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://w... | 0 | 0 | 0 | 0 | 0 | 0 |
scripts/end_date_volumes_invariant_13a.py | simpsonw/atmosphere | 197 | 131268 | #!/usr/bin/env python
import argparse
import django
django.setup()
from core.models import Volume
from django.db import connection
from django.db.models.functions import Now
def main():
'''
This script will end date volumes that come up for Invariant #13a on
https://tasmo.atmo.cloud and will be run via... | 0 | 0 | 0 | 0 | 0 | 0 |
library/source1/vtx/v7/structs/model.py | anderlli0053/SourceIO | 199 | 131273 | <filename>library/source1/vtx/v7/structs/model.py
from typing import List
from . import Base
from . import ByteIO
from .lod import ModelLod
class Model(Base):
def __init__(self):
self.model_lods = [] # type: List[ModelLod]
def read(self, reader: ByteIO):
entry = reader.tell()
lod_c... | 0 | 0 | 0 | 0 | 0 | 0 |
syte/views/instagram.py | doowb/syte | 426 | 131296 | <reponame>doowb/syte
# -*- coding: utf-8 -*-
import json
import requests
from django.shortcuts import redirect, render
from django.conf import settings
from django.http import HttpResponse
def instagram_auth(request):
context = dict()
code = request.GET.get('code', None)
error = request.GET.get('error_de... | 0 | 0 | 0 | 0 | 0 | 0 |
minihack/agent/common/models/embed.py | samvelyan/minihack-1 | 217 | 131322 | <reponame>samvelyan/minihack-1<gh_stars>100-1000
# Copyright (c) Facebook, Inc. and its affiliates.
#
# 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... | 0 | 0 | 0 | 0 | 0 | 0 |
Lib/test/test_types.py | Leonardofreua/RustPython | 11,058 | 131338 | # Python test set -- part 6, built-in types
from test.support import run_with_locale
import collections.abc
import inspect
import pickle
import locale
import sys
import types
import unittest.mock
import weakref
class TypesTests(unittest.TestCase):
def test_truth_values(self):
if None: self.fail('None is ... | 0 | 0 | 0 | 0 | 0 | 1 |
tools/mo/unit_tests/mo/front/AttributedRollToRoll_test.py | ryanloney/openvino-1 | 1,127 | 131364 | # Copyright (C) 2018-2022 Intel Corporation
# SPDX-License-Identifier: Apache-2.0
import unittest
from openvino.tools.mo.front.AttributedRollToRoll import AttributedRollToRoll
from openvino.tools.mo.front.common.partial_infer.utils import int64_array
from openvino.tools.mo.graph.graph import Node
from openvino.tools.... | 0 | 0 | 0 | 0 | 0 | 1 |
tests/packagedcode/test_bower.py | Siddhant-K-code/scancode-toolkit | 1,511 | 131380 | #
# Copyright (c) nexB Inc. and others. All rights reserved.
# ScanCode is a trademark of nexB Inc.
# SPDX-License-Identifier: Apache-2.0
# See http://www.apache.org/licenses/LICENSE-2.0 for the license text.
# See https://github.com/nexB/scancode-toolkit for support or download.
# See https://aboutcode.org for more in... | 0 | 0 | 0 | 0 | 0 | 0 |
testfixtures/tests/test_diff.py | abcdenis/testfixtures | 184 | 131390 | <reponame>abcdenis/testfixtures
from unittest import TestCase
from testfixtures import diff
class TestDiff(TestCase):
def test_example(self):
actual = diff('''
line1
line2
line3
''',
'''
line1
line changed
line3
''')
... | 0 | 0 | 0 | 0 | 0 | 0 |
configs/_base_/models/groupfree3d.py | Guangyun-Xu/mmdetection3d | 2,216 | 131391 | <gh_stars>1000+
model = dict(
type='GroupFree3DNet',
backbone=dict(
type='PointNet2SASSG',
in_channels=3,
num_points=(2048, 1024, 512, 256),
radius=(0.2, 0.4, 0.8, 1.2),
num_samples=(64, 32, 16, 16),
sa_channels=((64, 64, 128), (128, 128, 256), (128, 128, 256),
... | 0 | 0 | 0 | 0 | 0 | 0 |
arviz/tests/base_tests/test_rcparams.py | sudojarvis/arviz | 1,159 | 131393 | <filename>arviz/tests/base_tests/test_rcparams.py
# pylint: disable=redefined-outer-name
import os
import numpy as np
import pytest
from xarray.core.indexing import MemoryCachedArray
from ...data import datasets, load_arviz_data
from ...rcparams import (
_make_validate_choice,
_make_validate_choice_regex,
... | 0 | 0 | 0 | 0 | 0 | 0 |
bin/api_connector_splunk/jsonschema/compat.py | CyberGRX/api-connector-splunk | 652 | 131409 | <reponame>CyberGRX/api-connector-splunk
import operator
import sys
try:
from collections import MutableMapping, Sequence # noqa
except ImportError:
from collections.abc import MutableMapping, Sequence # noqa
PY3 = sys.version_info[0] >= 3
PY26 = sys.version_info[:2] == (2, 6)
if PY3:
zip = zip
fro... | 0 | 0 | 0 | 0 | 0 | 0 |
Src/StdLib/Lib/site-packages/win32comext/axscript/client/debug.py | cwensley/ironpython2 | 1,078 | 131472 | import traceback, sys, string
import win32com.server.util
from win32com.util import IIDToInterfaceName
from win32com.client.util import Enumerator
from win32com.server.exception import COMException
import pythoncom
from framework import trace
from win32com.axdebug import axdebug, gateways, contexts, stackframe, docume... | 0 | 0 | 0 | 0 | 0 | 0 |
tools/generate_text_generation.py | ankane/informers | 340 | 131483 | from pathlib import Path
import tempfile
from transformers.convert_graph_to_onnx import convert, quantize
# requires:
# transformers==4.0.0
# torch==1.7.1
dest = Path(tempfile.mkdtemp(), "text-generation.onnx")
convert(
pipeline_name="text-generation",
model="gpt2",
output=dest,
framework="pt",
opset=11
)
p... | 0 | 0 | 0 | 0 | 0 | 0 |
lit_nlp/components/pdp_test.py | eichinflo/lit | 2,854 | 131500 | # 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
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, s... | 2 | 7 | 0 | 0 | 9 | 0 |
sdk/translation/azure-ai-translation-document/azure/ai/translation/document/_helpers.py | rsdoherty/azure-sdk-for-python | 2,728 | 131502 | <filename>sdk/translation/azure-ai-translation-document/azure/ai/translation/document/_helpers.py
# coding=utf-8
# ------------------------------------
# Copyright (c) Microsoft Corporation.
# Licensed under the MIT License.
# ------------------------------------
import datetime
from typing import Union, Optional, Lis... | 0 | 0 | 0 | 0 | 0 | 0 |
reader/bidafv1/layers.py | wsdm/RCZoo | 166 | 131506 | #!/usr/bin/env python3
# Copyright 2017-present, Facebook, Inc.
# All rights reserved.
#
# This source code is licensed under the license found in the
# LICENSE file in the root directory of this source tree.
from __future__ import annotations
"""Definitions of model layers/NN modules"""
import ipdb
import torch
impor... | 19 | 20 | 0 | 5 | 44 | 0 |
tests/test_tine.py | mathiazom/recipe-scrapers | 811 | 131527 | from recipe_scrapers.tineno import TineNo
from tests import ScraperTest
class TestTineNoScraper(ScraperTest):
scraper_class = TineNo
def test_host(self):
self.assertEqual("tine.no", self.harvester_class.host())
def test_canonical_url(self):
self.assertEqual(
"https://www.tin... | 0 | 1 | 0 | 0 | 1 | 0 |
checkov/cloudformation/checks/resource/base_resource_check.py | niradler/checkov | 4,013 | 131533 | <reponame>niradler/checkov
from abc import abstractmethod
from typing import List, Callable, Optional, Dict, Any
from checkov.cloudformation.checks.resource.registry import cfn_registry
from checkov.common.checks.base_check import BaseCheck
from checkov.common.models.enums import CheckCategories, CheckResult
from chec... | 0 | 0 | 0 | 0 | 0 | 0 |
sdk/python/pulumi_azure/servicebus/get_namespace_authorization_rule.py | henriktao/pulumi-azure | 109 | 131538 | <filename>sdk/python/pulumi_azure/servicebus/get_namespace_authorization_rule.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
fr... | 0 | 0 | 0 | 0 | 0 | 0 |
scripts/validate_sphinx.py | SamuelMarks/botorch | 2,344 | 131568 | <filename>scripts/validate_sphinx.py<gh_stars>1000+
#!/usr/bin/env python3
# Copyright (c) Facebook, Inc. and its affiliates.
#
# This source code is licensed under the MIT license found in the
# LICENSE file in the root directory of this source tree.
from __future__ import annotations
import argparse
import os
impor... | 0 | 0 | 0 | 0 | 0 | 0 |
timer.py | njuFerret/python-snippets | 555 | 131582 | <reponame>njuFerret/python-snippets<filename>timer.py
"""
Homegrown timing tools for function calls.
Does total time, best-of time and best-of-totals time
"""
import time
import sys
if sys.version_info[0] >= 3 and sys.version_info[1] >= 3:
timer = time.perf_counter
else:
timer = time.clock if sys.platform[:3]... | 0 | 0 | 0 | 0 | 0 | 0 |
Lib/test/test_lzma.py | inging44/python3 | 1,872 | 131587 | <gh_stars>1000+
from io import BytesIO, UnsupportedOperation
import os
import pickle
import random
import unittest
from test.support import (
_4G, TESTFN, import_module, bigmemtest, run_unittest, unlink
)
lzma = import_module("lzma")
from lzma import LZMACompressor, LZMADecompressor, LZMAError, LZMAFile
class C... | 0 | 0 | 0 | 0 | 0 | 0 |
cell2location/models/simplified/_cell2location_v3_no_factorisation_module.py | nadavyayon/cell2location | 127 | 131590 | from __future__ import annotations
import numpy as np
import pandas as pd
import pyro
import pyro.distributions as dist
import torch
from pyro.nn import PyroModule
from scvi import _CONSTANTS
from scvi.data._anndata import get_from_registry
from scvi.nn import one_hot
# class NegativeBinomial(TorchDistributionMixin, S... | 12 | 4 | 0 | 0 | 16 | 0 |
keras/layers/convolutional.py | averybigant/keras | 250 | 131601 | # -*- coding: utf-8 -*-
from __future__ import annotations
from __future__ import absolute_import
import theano
import theano.tensor as T
from .. import activations, initializations, regularizers, constraints
from ..utils.theano_utils import shared_zeros
from ..layers.core import Layer
class Convolution1D(Layer):
... | 27 | 10 | 0 | 12 | 49 | 0 |
simple_rl/mdp/StateClass.py | david-abel/mdps | 230 | 131604 | # Python imports
from __future__ import annotations
from collections.abc import Sequence
import numpy as np
''' StateClass.py: Contains the State Class. '''
class State(Sequence):
''' Abstract State class '''
def __init__(self, data: list[object]=[], is_terminal: bool=False):
self.data = data
... | 3 | 9 | 0 | 0 | 12 | 0 |
week_8_serverless/lambda_handler.py | krishnakaushik25/MLOps-Basics | 2,800 | 131618 | <reponame>krishnakaushik25/MLOps-Basics<filename>week_8_serverless/lambda_handler.py
"""
Lambda wrapper
"""
import json
from inference_onnx import ColaONNXPredictor
inferencing_instance = ColaONNXPredictor("./models/model.onnx")
def lambda_handler(event, context):
"""
Lambda function handler for predicting linguis... | 0 | 0 | 0 | 0 | 0 | 0 |
homeassistant/components/onewire/onewirehub.py | learn-home-automation/core | 22,481 | 131624 | """Hub for communication with 1-Wire server or mount_dir."""
from __future__ import annotations
import logging
import os
from typing import TYPE_CHECKING
from pi1wire import Pi1Wire
from pyownet import protocol
from homeassistant.config_entries import ConfigEntry
from homeassistant.const import (
ATTR_IDENTIFIER... | 10 | 9 | 5 | 4 | 28 | 0 |
examples/single-pole-balancing/evolve-feedforward.py | HTalarmo/neat-python | 1,129 | 131634 | """
Single-pole balancing experiment using a feed-forward neural network.
"""
from __future__ import print_function
import multiprocessing
import os
import pickle
import neat
import cart_pole
import visualize
runs_per_net = 5
simulation_seconds = 60.0
# Use the NN network phenotype and the discrete actuator for... | 0 | 1 | 0 | 0 | 1 | 0 |
tests/torch/nn/parallel/tensor_parallel/_parallel_2d/test_wrapper_2d.py | lipovsek/oslo | 249 | 131639 | <gh_stars>100-1000
import torch.distributed as dist
import wandb
from datasets import load_dataset
from torch.optim import Adam
from torch.utils.data import DataLoader
from transformers import AutoTokenizer, GPT2Config, GPT2LMHeadModel
from oslo.torch.distributed import ParallelContext, ParallelMode
from oslo.torch.nn... | 0 | 0 | 0 | 0 | 0 | 0 |
Examples/Image/Classification/ResNet/Python/resnet_models.py | burhandodhy/CNTK | 17,702 | 131642 | <gh_stars>1000+
# Copyright (c) Microsoft. All rights reserved.
#
# Licensed under the MIT license. See LICENSE.md file in the project root
# for full license information.
# ==============================================================================
import numpy as np
from cntk.initializer import he_normal, normal
... | 0 | 0 | 0 | 0 | 0 | 0 |
extraPackages/matplotlib-3.0.3/examples/axes_grid1/demo_axes_grid2.py | dolboBobo/python3_ios | 130 | 131661 | <reponame>dolboBobo/python3_ios
"""
===============
Demo Axes Grid2
===============
Grid of images with shared xaxis and yaxis.
"""
import matplotlib.pyplot as plt
from mpl_toolkits.axes_grid1 import ImageGrid
import numpy as np
def get_demo_image():
from matplotlib.cbook import get_sample_data
f = get_sampl... | 0 | 0 | 0 | 0 | 0 | 0 |
build_defs/intellij_plugin_debug_target.bzl | sitaktif/intellij | 675 | 131670 | """IntelliJ plugin debug target rule used for debugging IntelliJ plugins.
Creates a plugin target debuggable from IntelliJ. Any files in
the 'deps' and 'javaagents' attribute are deployed to the plugin sandbox.
Any files are stripped of their prefix and installed into
<sandbox>/plugins. If you need structure, first p... | 0 | 5 | 0 | 0 | 5 | 0 |
firebase_admin/project_management.py | oppia/firebase-admin-python | 771 | 131679 | # Copyright 2018 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 required by applicable law or agreed to in writing, ... | 13 | 56 | 11 | 0 | 80 | 0 |
tensorflow/tools/common/traverse_test.py | abhaikollara/tensorflow | 848 | 131718 | <gh_stars>100-1000
# Copyright 2015 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 ... | 0 | 0 | 0 | 0 | 0 | 0 |
lib/dataset.py | Gofinge/SpatioTemporalSegmentation | 212 | 131732 | from __future__ import annotations
from abc import ABC
from pathlib import Path
from collections import defaultdict
import random
import numpy as np
from enum import Enum
import torch
from torch.utils.data import Dataset, DataLoader
import MinkowskiEngine as ME
from plyfile import PlyData
import lib.transforms as t... | 33 | 15 | 19 | 2 | 69 | 0 |
tests/test_paginator.py | XeryusTC/fastapi-pagination | 315 | 131753 | from fastapi import FastAPI
from pytest import fixture
from fastapi_pagination import LimitOffsetPage, Page, add_pagination, paginate
from .base import BasePaginationTestCase, SafeTestClient, UserOut
from .utils import faker
app = FastAPI()
entities = [UserOut(name=faker.name()) for _ in range(100)]
@app.get("/de... | 0 | 2 | 0 | 0 | 2 | 0 |
Validation/HGCalValidation/test/python/recHitClient_cfg.py | ckamtsikis/cmssw | 852 | 131762 | import FWCore.ParameterSet.Config as cms
import os
from Configuration.Eras.Era_Phase2C9_cff import Phase2C9
process = cms.Process('CLIENT',Phase2C9)
process.load("Configuration.StandardSequences.Reconstruction_cff")
process.load('Configuration.Geometry.GeometryExtended2026D46Reco_cff')
process.load('Configuration.Geo... | 0 | 0 | 0 | 0 | 0 | 0 |
tests/parsers/test_parsers.py | ssato/python-anyconfig | 213 | 131771 | #
# Copyright (C) 2012 - 2021 <NAME> <<EMAIL>>
# SPDX-License-Identifier: MIT
#
# pylint: disable=missing-docstring, invalid-name
import pathlib
import unittest
import anyconfig.backend.json
import anyconfig.backend.json.default as JSON
try:
import anyconfig.backend.yaml.pyyaml as PYYAML
except ImportError:
P... | 0 | 0 | 0 | 0 | 0 | 0 |
econml/metalearners/__init__.py | imatiach-msft/EconML | 1,846 | 131801 | # Copyright (c) Microsoft Corporation. All rights reserved.
# Licensed under the MIT License.
from ._metalearners import (TLearner, SLearner, XLearner, DomainAdaptationLearner)
__all__ = ["TLearner",
"SLearner",
"XLearner",
"DomainAdaptationLearner"]
| 0 | 0 | 0 | 0 | 0 | 0 |
unittests/tools/test_netsparker_parser.py | mtcolman/django-DefectDojo | 249 | 131807 | from ..dojo_test_case import DojoTestCase
from dojo.models import Test
from dojo.tools.netsparker.parser import NetsparkerParser
class TestNetsparkerParser(DojoTestCase):
def test_parse_file_with_one_finding(self):
testfile = open("unittests/scans/netsparker/netsparker_one_finding.json")
parser =... | 0 | 0 | 0 | 0 | 0 | 0 |
noxfile.py | cansarigol/pdbr | 222 | 131813 | <gh_stars>100-1000
import nox
nox.options.stop_on_first_error = True
SOURCE_FILES = "pdbr", "tests", "noxfile.py"
@nox.session
def lint(session, reuse_venv=True):
session.install("autoflake", "isort==5.*", "black>=20.8b1")
session.run("autoflake", "--in-place", "--recursive", *SOURCE_FILES)
session.run(... | 0 | 0 | 0 | 0 | 0 | 0 |
leetcode/169.majority-element.py | geemaple/algorithm | 177 | 131822 | #
# @lc app=leetcode id=169 lang=python
#
# [169] Majority Element
#
# https://leetcode.com/problems/majority-element/description/
#
# algorithms
# Easy (56.44%)
# Total Accepted: 542.5K
# Total Submissions: 960.6K
# Testcase Example: '[3,2,3]'
#
# Given an array of size n, find the majority element. The majority e... | 0 | 3 | 0 | 0 | 3 | 0 |
cornac/models/bivaecf/recom_bivaecf.py | carmanzhang/cornac | 597 | 131839 | # Copyright 2018 The Cornac 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 applicable ... | 16 | 2 | 0 | 0 | 18 | 0 |
instrumentation/opentelemetry-instrumentation-sklearn/src/opentelemetry/instrumentation/sklearn/__init__.py | benjaminsky/opentelemetry-python-contrib | 208 | 131842 | # Copyright 2020, OpenTelemetry Authors
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to i... | 37 | 15 | 0 | 2 | 54 | 0 |
preprocess.py | astricks/Voice-Conversion-GAN | 104 | 131865 | <gh_stars>100-1000
import librosa
import numpy as np
import os
import pyworld
from pprint import pprint
import librosa.display
import time
def load_wavs(wav_dir, sr):
wavs = list()
for file in os.listdir(wav_dir):
file_path = os.path.join(wav_dir, file)
wav, _ = librosa.load(file_path, sr=sr, ... | 0 | 0 | 0 | 0 | 0 | 0 |
examples/access-levels-write/access-levels-write.py | kylelaker/iam-floyd | 360 | 131878 | import iam_floyd as statement
import importlib
import os
import sys
import inspect
currentdir = os.path.dirname(os.path.abspath(
inspect.getfile(inspect.currentframe())))
helperDir = '%s/../../helper/python' % currentdir
sys.path.insert(0, helperDir)
test = importlib.import_module('python_test')
out = getattr(tes... | 0 | 0 | 0 | 0 | 0 | 0 |
tests/record/test_legacy.py | mauritsvdvijgh/aiokafka | 731 | 131882 | <gh_stars>100-1000
import struct
from unittest import mock
import pytest
from aiokafka.record.legacy_records import (
LegacyRecordBatch, LegacyRecordBatchBuilder
)
from aiokafka.errors import CorruptRecordException
@pytest.mark.parametrize("magic", [0, 1])
@pytest.mark.parametrize("key,value,checksum", [
(b"... | 0 | 0 | 0 | 0 | 0 | 0 |
manage_firmware/firmware_upgrade_manager.py | robegli/automation-scripts | 274 | 131931 | <filename>manage_firmware/firmware_upgrade_manager.py
import meraki
import datetime
import time
'''
Cisco Meraki Firmware Upgrade Manager
<NAME> .:|:.:|:. https://github.com/TKIPisalegacycipher
This script will pull network IDs from an org and then create asynchronous action batches. Each batch will contain, for
eac... | 0 | 0 | 0 | 0 | 0 | 0 |
payloadprocessor/sqlmap - percentage.py | knassar702/community-scripts | 629 | 131939 | <gh_stars>100-1000
import string
def process(payload):
retVal = payload
if payload:
retVal = ""
i = 0
while i < len(payload):
if payload[i] == '%' and (i < len(payload) - 2) and payload[i + 1:i + 2] in string.hexdigits and payload[i + 2:i + 3] in string.hexdigits:
... | 0 | 0 | 0 | 0 | 0 | 0 |
anuga/structures/tests/test_inlet_operator.py | samcom12/anuga_core | 136 | 131945 | #!/usr/bin/env python
from __future__ import division
from past.utils import old_div
import unittest
import os.path
import sys
import numpy
import anuga
from anuga.abstract_2d_finite_volumes.mesh_factory import rectangular_cross
from anuga.shallow_water.shallow_water_domain import Domain
from anuga.abstract_2d_fini... | 0 | 3 | 0 | 0 | 3 | 0 |
typescript/libs/service_proxy.py | bertilnilsson/TypeScript-Sublime-Plugin | 1,688 | 131964 | <filename>typescript/libs/service_proxy.py<gh_stars>1000+
import sublime
from . import json_helpers
from .global_vars import IS_ST2
from .node_client import CommClient
from .text_helpers import Location
class ServiceProxy:
def __init__(self, worker_client=CommClient(), server_client=CommClient()):
self.... | 0 | 0 | 0 | 0 | 0 | 0 |
designate-8.0.0/designate/loggingutils.py | scottwedge/OpenStack-Stein | 145 | 131975 | <filename>designate-8.0.0/designate/loggingutils.py
# Copyright 2016 Hewlett Packard Enterprise Development Company LP
#
# 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.apac... | 0 | 0 | 0 | 0 | 0 | 0 |
autobahn/wamp/gen/wamp/proto/CalleeFeatures.py | rapyuta-robotics/autobahn-python | 1,670 | 131976 | # automatically generated by the FlatBuffers compiler, do not modify
# namespace: proto
from __future__ import annotations
import flatbuffers
class CalleeFeatures(object):
__slots__: list[str] = ['_tab']
@classmethod
def GetRootAsCalleeFeatures(cls, buf, offset) -> object:
n = flatbuffers.encode... | 0 | 12 | 1 | 0 | 13 | 0 |
biostar/forum/migrations/0012_delete_sync.py | tangibleai/biostar-central | 477 | 131979 | <reponame>tangibleai/biostar-central<gh_stars>100-1000
# Generated by Django 3.1 on 2021-02-13 21:36
from django.db import migrations
from django.template.defaultfilters import slugify
def badge_uids(apps, schema_editor):
"""
Change badge uids to it's name
"""
Badge = apps.get_model('forum', 'Badge')... | 0 | 0 | 0 | 0 | 0 | 0 |
lib/spack/spack/test/git_fetch.py | LiamBindle/spack | 2,360 | 131984 | <gh_stars>1000+
# Copyright 2013-2021 Lawrence Livermore National Security, LLC and other
# Spack Project Developers. See the top-level COPYRIGHT file for details.
#
# SPDX-License-Identifier: (Apache-2.0 OR MIT)
import copy
import os
import shutil
import pytest
from llnl.util.filesystem import mkdirp, touch, workin... | 0 | 0 | 0 | 0 | 0 | 0 |
tests/unittests/utils/test_immutabletypes.py | buddwm/hubble | 363 | 131986 | # -*- coding: utf-8 -*-
'''
:codeauthor: <NAME> (<EMAIL>)
tests.unit.utils.immutabletypes
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Test hubblestack.utils.immutabletypes
'''
from tests.support.unit import TestCase
import hubblestack.utils.immutabletypes as immutabletypes
class ImmutableTypesTestCase(TestCa... | 0 | 0 | 0 | 0 | 0 | 0 |
lldb/test/API/lang/cpp/typeof/TestTypeOfDeclTypeExpr.py | mkinsner/llvm | 2,338 | 131991 | import lldb
from lldbsuite.test.decorators import *
from lldbsuite.test.lldbtest import *
from lldbsuite.test import lldbutil
class TestCase(TestBase):
mydir = TestBase.compute_mydir(__file__)
@no_debug_info_test
def test(self):
self.expect_expr("int i; __typeof__(i) j = 1; j", result_type="typeo... | 0 | 0 | 0 | 0 | 0 | 0 |
tests/data/config/g.py | jinliwei1997/mmcv | 3,748 | 131995 | <filename>tests/data/config/g.py
filename = 'reserved.py'
| 0 | 0 | 0 | 0 | 0 | 0 |
tools/python/airmaps/dags/build_maps.py | smartyw/organicmaps | 3,062 | 131996 | from __future__ import annotations
import logging
from datetime import timedelta
from airflow import DAG
from airflow.operators.python_operator import PythonOperator
from airflow.utils.dates import days_ago
from airmaps.instruments import settings
from airmaps.instruments import storage
from airmaps.instruments.utils... | 1 | 4 | 0 | 0 | 5 | 0 |
Chapter15/lib/common.py | feiwang20/DRLHandsOn-Playground | 2,497 | 132009 | import numpy as np
import torch
import ptan
def unpack_batch_a2c(batch, net, last_val_gamma, device: str="cpu") -> tuple[object, object, object]:
"""
Convert batch into training tensors
:param batch:
:param net:
:return: states variable, actions tensor, reference values variable
"""
state... | 1 | 1 | 0 | 0 | 2 | 0 |
ipypublish/convert/config_manager.py | parmentelat/ipypublish | 220 | 132020 | import os
import glob
import importlib
import logging
from six import string_types
from jinja2 import DictLoader
import jsonschema
import nbconvert # noqa: F401
from ipypublish.utils import (
pathlib,
handle_error,
get_module_path,
read_file_from_directory,
read_file_from_module,
)
from ipypublis... | 0 | 0 | 0 | 0 | 0 | 1 |
Tests/pens/pointPen_test.py | twardoch/fonttools-py27 | 240 | 132029 | <filename>Tests/pens/pointPen_test.py
from __future__ import print_function, division, absolute_import
from fontTools.misc.py23 import *
from fontTools.misc.loggingTools import CapturingLogHandler
import unittest
from fontTools.pens.basePen import AbstractPen
from fontTools.pens.pointPen import AbstractPointPen, Point... | 0 | 0 | 0 | 0 | 0 | 0 |
tools/accuracy_checker/openvino/tools/accuracy_checker/metrics/question_answering.py | alpkn/open_model_zoo | 2,201 | 132126 | from __future__ import annotations
"""
Copyright (c) 2018-2022 Intel Corporation
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by... | 0 | 14 | 9 | 2 | 25 | 0 |
dynamo/__init__.py | xing-lab-pitt/dynamo-release | 236 | 132136 | <filename>dynamo/__init__.py<gh_stars>100-1000
"""Mapping Vector Field of Single Cells
"""
from .get_version import get_version
__version__ = get_version(__file__)
del get_version
from . import pp
from . import est
from . import tl
from . import vf
from . import pd
from . import pl
from . import mv
from . import sim... | 0 | 0 | 0 | 0 | 0 | 0 |
tests/providers/test_profile.py | jacksmith15/faker | 12,077 | 132179 | <reponame>jacksmith15/faker<gh_stars>1000+
import unittest
from faker import Faker
class TestProfileProvider(unittest.TestCase):
"""Test profile provider methods"""
num_samples = 10
def setUp(self):
self.fake = Faker()
Faker.seed(0)
def test_simple_profile(self):
for _ in r... | 0 | 0 | 0 | 0 | 0 | 0 |
utils/distributed_utils.py | hellog2n/deep-generative-prior | 395 | 132182 | from __future__ import annotations
import math
import multiprocessing as mp
import os
import torch
import torch.distributed as dist
from torch.nn import Module
from torch.utils.data import Sampler
class DistModule(Module):
def __init__(self, module):
super(DistModule, self).__init__()
self.modul... | 3 | 4 | 0 | 1 | 8 | 0 |
omnizart/vocal_contour/inference.py | nicolasanjoran/omnizart | 1,145 | 132184 | import numpy as np
from scipy.special import expit
from librosa.core import midi_to_hz
from omnizart.constants.midi import LOWEST_MIDI_NOTE
def inference(feature, model, timestep: int=128, batch_size: int=10, feature_num: int=384) -> object:
assert len(feature.shape) == 2
# Padding
total_samples = len(fe... | 3 | 1 | 0 | 0 | 4 | 0 |
main_pcl.py | HCY123902/PCL | 309 | 132226 | <gh_stars>100-1000
import argparse
import builtins
import math
import os
import random
import shutil
import time
import warnings
from tqdm import tqdm
import numpy as np
import faiss
import torch
import torch.nn as nn
import torch.nn.parallel
import torch.backends.cudnn as cudnn
import torch.distributed as dist
import... | 0 | 0 | 0 | 0 | 0 | 0 |
ch46-机器学习-K近邻/knn-find_nearest.py | makelove/OpenCV-Python-Tutorial | 2,875 | 132267 | <gh_stars>1000+
# -*- coding: utf-8 -*-
# @Time : 2017/8/8 12:33
# @Author : play4fun
# @File : knn-find_nearest.py
# @Software: PyCharm
"""
knn-find_nearest.py:
http://www.bogotobogo.com/python/OpenCV_Python/python_opencv3_Machine_Learning_Classification_K-nearest_neighbors_k-NN.php
"""
import cv2
import nump... | 0 | 0 | 0 | 0 | 0 | 0 |
imaginaire/third_party/bias_act/setup.py | hw07216/imaginaire | 3,308 | 132287 | <reponame>hw07216/imaginaire
# flake8: noqa
from setuptools import setup
from torch.utils.cpp_extension import BuildExtension, CUDAExtension
import os
cuda_version = os.getenv('CUDA_VERSION')
print('CUDA_VERSION: {}'.format(cuda_version))
nvcc_args = list()
# nvcc_args.append('-gencode')
# nvcc_args.append('arch=com... | 0 | 0 | 0 | 0 | 0 | 0 |
shhh/api/encryption.py | olaoladapo/shhh | 243 | 132312 | import secrets
from base64 import urlsafe_b64decode, urlsafe_b64encode
from cryptography.fernet import Fernet
from cryptography.hazmat.backends import default_backend
from cryptography.hazmat.primitives import hashes
from cryptography.hazmat.primitives.kdf.pbkdf2 import PBKDF2HMAC
class Secret:
"""Encrypt and de... | 5 | 3 | 1 | 0 | 9 | 0 |
py/mazebase/utils/creationutils.py | fakeNetflix/facebook-repo-MazeBase | 263 | 132327 | from __future__ import annotations
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
from __future__ import unicode_literals
from random import shuffle, random
from collections import defaultdict
import itertools
import mazebase.items as mi
from .mazeutils impo... | 3 | 8 | 0 | 0 | 11 | 0 |
src/api-engine/api/common/response.py | MicroMetaverse/cello | 865 | 132334 |
from __future__ import annotations
"""Class represents response format.
{
status, successful/fail
data, response
msg, error messages
}
"""
def ok(data) -> dict[str,None | object | str]:
return {
"data": data,
"msg": None,
"status": "... | 0 | 2 | 0 | 0 | 2 | 0 |
docs/examples/dns/pointdns/instantiate_driver.py | dupontz/libcloud | 1,435 | 132335 | from libcloud.dns.types import Provider
from libcloud.dns.providers import get_driver
cls = get_driver(Provider.POINTDNS)
driver = cls('username', 'apikey')
| 0 | 0 | 0 | 0 | 0 | 0 |
src/winforms/toga_winforms/widgets/textinput.py | luizoti/toga | 1,261 | 132336 | from ctypes import c_uint
from ctypes.wintypes import HWND, WPARAM
from travertino.size import at_least
from travertino.constants import TRANSPARENT
from toga_winforms.colors import native_color
from toga_winforms.libs import HorizontalTextAlignment, WinForms, user32
from .base import Widget
class TextInput(Widget... | 0 | 1 | 0 | 0 | 1 | 0 |
codechef/july18a/jerrytom.py | Ashindustry007/competitive-programming | 506 | 132338 | #!/usr/bin/env python3
# https://www.codechef.com/JULY18A/problems/JERRYTOM
def max_clique(g) -> object:
n = 0
for x in g: n = max(n, len(x))
l = [set() for _ in range(n + 1)]
s = [0] * len(g)
for i, x in enumerate(g):
ll = len(x)
l[ll].add(i)
s[i] = ll
m = 0
for _ in... | 0 | 1 | 0 | 0 | 1 | 0 |
benchmarks/baseline_classifiers.py | zhhengcs/sunny-side-up | 581 | 132341 | import os, sys, logging
import json
import numpy as np
import random
from collections import defaultdict, Counter
import cPickle as pickle
import cProfile, pstats
import threading
import time
import multiprocessing
import math
from sklearn import metrics
from sklearn import svm
from sklearn.naive_bayes import Gaussia... | 0 | 3 | 0 | 0 | 3 | 0 |
Chapter 3/restful_python_chapter_03_04/users_test_01.py | Mohamed2011-bit/Building-RESTful-Python-Web-Services | 116 | 132375 | """
Book: Building RESTful Python Web Services
Chapter 3: Improving and adding authentication to an API with Django
Author: <NAME> - Twitter.com/gastonhillar
Publisher: Packt Publishing Ltd. - http://www.packtpub.com
"""
from django.contrib.auth.models import User
user = User.objects.create_user('kevin', '<EMAIL>', '<P... | 0 | 0 | 0 | 0 | 0 | 0 |
jorldy/test/core/network/test_rnd_network.py | Kyushik/JORLDY | 300 | 132390 | <reponame>Kyushik/JORLDY
import torch
from core.network.rnd import RND_MLP, RND_CNN, RND_Multi
def test_rnd_mlp_call():
D_in, D_out, D_hidden = 2, 3, 4
num_workers, gamma_i = 2, 0.99
net = RND_MLP(
D_in=D_in,
D_out=D_out,
D_hidden=D_hidden,
num_workers=num_workers,
... | 0 | 0 | 0 | 0 | 0 | 0 |
lingvo/tasks/asr/tools/simple_wer_v2.py | allenwang28/lingvo | 2,611 | 132399 | # Lint as: python3
# 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 ... | 1 | 8 | 0 | 8 | 17 | 0 |
src/onedrivesdk/error.py | meson800/onedrive-sdk-python | 912 | 132409 | <filename>src/onedrivesdk/error.py
'''
------------------------------------------------------------------------------
Copyright (c) 2015 Microsoft Corporation
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
i... | 0 | 0 | 0 | 0 | 0 | 0 |
senet_train.py | sanghuynh1501/speech_denoising_tensorflow | 184 | 132452 | from model import *
from data_import import *
import sys, getopt
# SPEECH ENHANCEMENT NETWORK
SE_LAYERS = 13 # NUMBER OF INTERNAL LAYERS
SE_CHANNELS = 64 # NUMBER OF FEATURE CHANNELS PER LAYER
SE_LOSS_LAYERS = 6 # NUMBER OF FEATURE LOSS LAYERS
SE_NORM = "NM" # TYPE OF LAYER NORMALIZATION (NM, SBN or None)
SE_LOSS_TYP... | 0 | 0 | 0 | 0 | 0 | 0 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.