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 |
|---|---|---|---|---|
tools/crawl_all.py | tomwhite/covid-19-uk-data | 186 | 9594450 | <filename>tools/crawl_all.py
#!/usr/bin/env python
# Crawls all the historical data in one go. This ensures that revisions of old data are accounted for.
import dateparser
import datetime
import json
import math
import numpy as np
import os
import pandas as pd
import requests
import sqlite3
import sys
import xmltodic... |
src/netappfiles-preview/azext_netappfiles_preview/tests/latest/test_account_commands_ext.py | Mannan2812/azure-cli-extensions | 207 | 9594457 | <filename>src/netappfiles-preview/azext_netappfiles_preview/tests/latest/test_account_commands_ext.py
# --------------------------------------------------------------------------------------------
# Copyright (c) Microsoft Corporation. All rights reserved.
# Licensed under the MIT License. See License.txt in the projec... |
pywick/models/classification/resnext_features/__init__.py | achaiah/pywick | 408 | 9594478 | <gh_stars>100-1000
from .resnext101_32x4d_features import resnext101_32x4d_features
from .resnext101_64x4d_features import resnext101_64x4d_features
from .resnext50_32x4d_features import resnext50_32x4d_features |
drf_haystack/mixins.py | fluxility/drf-haystack | 201 | 9594492 | <filename>drf_haystack/mixins.py
# -*- coding: utf-8 -*-
from __future__ import absolute_import, unicode_literals
from rest_framework.decorators import action
from rest_framework.response import Response
from drf_haystack.filters import HaystackFacetFilter
class MoreLikeThisMixin(object):
"""
Mixin class f... |
crslab/data/dataset/durecdial/__init__.py | hcmus-nlp-chatbot/CRSLab | 315 | 9594495 | from .durecdial import DuRecDialDataset
|
amqpstorm/tests/unit/io/test_io.py | ZygusPatryk/amqpstorm | 140 | 9594497 | <gh_stars>100-1000
import socket
import ssl
import mock
import amqpstorm.io
from amqpstorm.exception import AMQPConnectionError
from amqpstorm.io import IO
from amqpstorm.tests.utility import FakeConnection
from amqpstorm.tests.utility import TestFramework
class IOTests(TestFramework):
def test_io_socket_close... |
interface/simulator.py | BerkeleyPhotonicsGenerator/BAG_framework | 123 | 9594535 | # -*- coding: utf-8 -*-
"""This module handles high level simulation routines.
This module defines SimAccess, which provides methods to run simulations
and retrieve results.
"""
from typing import Dict, Optional, Sequence, Any, Tuple, Union
import abc
from ..io import make_temp_dir
from ..concurrent.core import Su... |
archai/nas/arch_params.py | shatadru99/archai | 344 | 9594560 | <reponame>shatadru99/archai<gh_stars>100-1000
# Copyright (c) Microsoft Corporation.
# Licensed under the MIT license.
from collections import UserDict
from typing import Dict, Iterable, Iterator, Mapping, Optional, Tuple, Union
import torch
from torch import nn
_param_suffix = '_arch_param' # all arch parame... |
python/04_logistic_regression.py | wsyjwps1983/TensorFlow-Tutorials-2 | 6,241 | 9594581 | <reponame>wsyjwps1983/TensorFlow-Tutorials-2
"""Simple tutorial using code from the TensorFlow example for Regression.
<NAME>, Jan. 2016"""
# pip3 install --upgrade
# https://storage.googleapis.com/tensorflow/mac/tensorflow-0.6.0-py3-none-any.whl
# %%
import tensorflow as tf
import tensorflow.examples.tutorials.mnist.... |
maml/models/conv_embedding_model.py | Manifold-Computing/MMAML-Classification | 130 | 9594603 | from collections import OrderedDict
import torch
import torch.nn.functional as F
import numpy as np
class ConvEmbeddingModel(torch.nn.Module):
def __init__(self, input_size, output_size, embedding_dims,
hidden_size=128, num_layers=1,
convolutional=False, num_conv=4, num_channels=... |
geopatterns/__init__.py | devbib/geopatterns | 116 | 9594613 | <gh_stars>100-1000
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
from .geopatterns import GeoPattern
__all__ = ['GeoPattern']
|
ClemBot.Bot/bot/utils/user_choice.py | makayla-moster/ClemBot | 121 | 9594615 | import asyncio
import typing as t
import discord
from bot.consts import Colors
class UserChoice:
def __init__(self, ctx, *, timeout: float) -> None:
self.ctx = ctx
self.timeout = timeout
async def send_confirmation(self, *, content: str = None, embed=None, is_error=False) -> bool:
... |
013-fuzzing/fuzz.py | gynvael/stream | 152 | 9594616 | <reponame>gynvael/stream
import subprocess
import sys
import glob
import random
import time
MAX_MUTATED_BYTES = 0.01
BINARY_PATH = "asdf.exe"
def select_file(path):
with open(random.choice(glob.glob(path)), "rb") as f:
return bytearray(f.read())
def mutate(d):
if not d:
return d
max_n... |
att_classification/tflib/ops/__init__.py | sageprogrammer/STGAN | 405 | 9594642 | <gh_stars>100-1000
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
from tflib.ops.ops import *
|
tests/micropython/heapalloc_fail_set.py | MichaelAkhnoukh/microPython | 198 | 9594667 | # test handling of failed heap allocation with set
import micropython
# create set
x = 1
micropython.heap_lock()
try:
{x,}
except MemoryError:
print('MemoryError: set create')
micropython.heap_unlock()
# set copy
s = {1, 2}
micropython.heap_lock()
try:
s.copy()
except MemoryError:
print('MemoryError:... |
web/webViews/batch.py | MrRobertYuan/docklet | 273 | 9594678 | <reponame>MrRobertYuan/docklet
from flask import session, redirect, request
from webViews.view import normalView
from webViews.log import logger
from webViews.checkname import checkname
from webViews.dockletrequest import dockletRequest
from utils import env
import json
class batchAdminListView(normalView):
templa... |
packages/create-serverless-stack/templates/python/src/lambda.py | harshit9715/serverless-stack | 5,922 | 9594679 | def handler(event, context):
return {
"statusCode": 200,
"body": "Hello, World! Your request was received at {}.".format(event['requestContext']['time'])
}
|
segmentation/tools/convert.py | LvJC/CONTA | 121 | 9594680 | <filename>segmentation/tools/convert.py
#!/usr/bin/env python
# coding: utf-8
from __future__ import absolute_import, division, print_function
import re
import traceback
from collections import Counter, OrderedDict
import click
import numpy as np
import torch
from addict import Dict
from libs import caffe_pb2
from l... |
algo_arbitrage_eur_gbp/trianglar_arbitrage_spreadbetting_exiting_out_incrementally.py | g-make-it/IG_Trading_Algo_Scripts_Python | 186 | 9594688 | <filename>algo_arbitrage_eur_gbp/trianglar_arbitrage_spreadbetting_exiting_out_incrementally.py
from trading_ig.config import config
import logging
logger = logging.getLogger(__name__)
logger.setLevel(logging.DEBUG)
# if you need to cache to DB your requests
from datetime import timedelta
import requests_cache
from g... |
extraPackages/Pillow-6.0.0/Tests/test_image_getpalette.py | dolboBobo/python3_ios | 130 | 9594690 | from .helper import PillowTestCase, hopper
class TestImageGetPalette(PillowTestCase):
def test_palette(self):
def palette(mode):
p = hopper(mode).getpalette()
if p:
return p[:10]
return None
self.assertIsNone(palette("1"))
self.assertIsN... |
hoomd/pytest/test_device.py | EdwardZX/hoomd-blue | 204 | 9594696 | import hoomd
import pytest
@pytest.mark.gpu
def test_gpu_profile(device):
print(device)
with device.enable_profiling():
pass
def _assert_common_properties(dev,
notice_level,
msg_file,
num_cpu_threads=None):
... |
src/genie/libs/parser/nxos/tests/ShowCdpNeighborsDetail/cli/equal/golden_output_2_expected.py | balmasea/genieparser | 204 | 9594711 | <gh_stars>100-1000
expected_output = {
"index": {
1: {
"capabilities": "Switch IGMP Filtering Supports-STP-Disput",
"device_id": "swor96(SSI13110AAQ)",
"duplex_mode": "full",
"hold_time": 175,
"interface_addresses": {"192.168.0.1": {}},
... |
srcs/python/kungfu/tensorflow/ops/__init__.py | Pandinosaurus/KungFu | 291 | 9594754 | <gh_stars>100-1000
from kungfu.python import (_get_other_ranks, current_cluster_size,
current_local_rank, current_rank, run_barrier)
from ._tf_oplib import _op_lib
from .adapt import (resize, resize_cluster_from_url, set_tree,
step_based_schedule)
from .collective import ... |
pyccel/parser/base.py | dina-fouad/pyccel | 206 | 9594779 | <gh_stars>100-1000
# -*- coding: utf-8 -*-
#------------------------------------------------------------------------------------------#
# This file is part of Pyccel which is released under MIT License. See the LICENSE file or #
# go to https://github.com/pyccel/pyccel/blob/master/LICENSE for full license details. ... |
src/test/test_bip32.py | yenkuanlee/libwally-core | 212 | 9594787 | <filename>src/test/test_bip32.py
import unittest
import copy
from util import *
VER_MAIN_PUBLIC = 0x0488B21E
VER_MAIN_PRIVATE = 0x0488ADE4
VER_TEST_PUBLIC = 0x043587CF
VER_TEST_PRIVATE = 0x04358394
FLAG_KEY_PRIVATE, FLAG_KEY_PUBLIC, FLAG_SKIP_HASH, = 0x0, 0x1, 0x2
ALL_DEFINED_FLAGS = FLAG_KEY_PRIVATE | FLAG_KEY_PUBLI... |
projects/scale_hyperprior_lightning/train.py | tallamjr/NeuralCompression | 233 | 9594812 | # Copyright (c) Meta Platforms, Inc. and affiliates.
#
# This source code is licensed under the MIT license found in the
# LICENSE file in the root directory of this source tree.
from pathlib import Path
import hydra
from omegaconf import DictConfig
from pytorch_lightning import Trainer
from pytorch_lightning.callbac... |
estruturais/facade/main.py | caio-bernardo/design-patterns-python | 363 | 9594815 | <gh_stars>100-1000
class Hotelier:
def __init__(self):
print('Arranging the Hotel for Marriage? --')
def __is_available(self):
print('Is the Hotel free for the event on given day?')
return True
def book_hotel(self):
if self.__is_available():
print('Registered th... |
2011_03_16/caixa.py | samisafatli/dojo | 114 | 9594818 | <gh_stars>100-1000
class ValorNaoPermitido(Exception):
pass
class Caixa(object):
notas = [100, 50, 20, 10]
def valor_e_permitido(self, valor):
return valor % 10 != 0 or valor < 1
def sacar(self, valor):
if self.valor_e_permitido(valor):
raise ValorNaoPermitido
... |
scripts/train_uq.py | gmackall/deep-quant | 122 | 9594824 | # Copyright 2016 Euclidean Technologies Management LLC 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 requi... |
test/integration_test/tools/lib/ofp/ofp_meter_stats_request.py | ryoon/lagopus | 281 | 9594858 | <filename>test/integration_test/tools/lib/ofp/ofp_meter_stats_request.py
import os
import sys
import copy
import logging
from checker import *
from .ofp import register_ofp_creators
from .ofp import OfpBase
# YAML:
# meter_stats_request:
# flags: 0
# meter_id: 0
SCE_METER_STATS_REQUEST = "meter_stats_request"
... |
rqalpha/mod/rqalpha_mod_ctp/ctp_price_board.py | xclxxl414/rqalpha | 411 | 9594859 | <reponame>xclxxl414/rqalpha<filename>rqalpha/mod/rqalpha_mod_ctp/ctp_price_board.py
#!/usr/bin/env python
# -*- coding: utf-8 -*-
#
# Copyright 2017 Ricequant, 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 co... |
test/blocksparse_reduced_dw_test.py | alimhanif/blocksparse | 903 | 9594869 | <reponame>alimhanif/blocksparse
#!/usr/bin/env python
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
import numpy as np
import tensorflow as tf
import blocksparse as bs
from blocksparse.matmul import blocksparse_reduced_dw
config = tf.ConfigProto(
... |
textSentimentClassification/getConfig.py | xrxiang/tensorflow2.0-coding | 102 | 9594881 | # coding=utf-8
import configparser
def get_config(config_file='config.ini'):
parser=configparser.ConfigParser()
parser.read(config_file)
# get the ints, floats and strings
_conf_ints = [(key, int(value)) for key, value in parser.items('ints')]
_conf_floats = [(key, float(value)) for key, value in pa... |
saleor/graphql/channel/mutations.py | eanknd/saleor | 1,392 | 9594903 | <reponame>eanknd/saleor
import datetime
from typing import DefaultDict, Dict, Iterable, List
import graphene
import pytz
from django.core.exceptions import ValidationError
from django.utils.text import slugify
from ...channel import models
from ...checkout.models import Checkout
from ...core.permissions import Channe... |
mayan/apps/django_gpg/migrations/0003_auto_20160322_1810.py | eshbeata/open-paperless | 2,743 | 9594926 | # -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('django_gpg', '0002_auto_20160322_1756'),
]
operations = [
migrations.AlterField(
model_name='key',
n... |
tests/test_cron.py | BlackLight/platypush | 228 | 9594928 | <reponame>BlackLight/platypush
import os
import pytest
import tempfile
import threading
import time
tmp_files = []
tmp_files_ready = threading.Event()
test_timeout = 10
expected_cron_file_content = 'The cronjob ran successfully!'
@pytest.fixture(scope='module', autouse=True)
def tmp_file(*_):
tmp_file = tempfile... |
pytweet/errors.py | TheFarGG/PyTweet | 614 | 9594948 | <filename>pytweet/errors.py
import requests
from typing import Optional
from json import decoder
class PytweetException(Exception):
"""This is the base class of all exceptions Raise by PyTweet. This inherits :class:`Exception`.
.. versionadded:: 1.2.0
"""
def __init__(
self,
message:... |
lib-python/2.7/bsddb/dbobj.py | jeff5/jython-whinchat | 577 | 9594975 | <filename>lib-python/2.7/bsddb/dbobj.py
#-------------------------------------------------------------------------
# This file contains real Python object wrappers for DB and DBEnv
# C "objects" that can be usefully subclassed. The previous SWIG
# based interface allowed this thanks to SWIG's shadow classes.
# --... |
packages/pyright-internal/src/tests/samples/protocol3.py | Microsoft/pyright | 3,934 | 9595001 | # This sample tests the assignment of protocols that
# include property declarations.
from typing import Protocol, TypeVar
class Foo1(Protocol):
@property
def batch_shape(self) -> int:
return 0
class MockFoo1:
def __init__(self, batch_shape: int):
self._batch_shape = batch_shape
@p... |
datmo/cli/command/run.py | awesome-archive/datmo | 331 | 9595008 | from __future__ import print_function
import os
import sys
import shlex
import platform
from datetime import datetime
# https://stackoverflow.com/questions/11301138/how-to-check-if-variable-is-string-with-python-2-and-3-compatibility/11301392?utm_medium=organic&utm_source=google_rich_qa&utm_campaign=google_rich_qa
try... |
homeassistant/components/bond/entity.py | andersop91/core | 22,481 | 9595034 | <gh_stars>1000+
"""An abstract class common to all Bond entities."""
from __future__ import annotations
from abc import abstractmethod
from asyncio import Lock, TimeoutError as AsyncIOTimeoutError
from datetime import timedelta
import logging
from typing import Any
from aiohttp import ClientError
from bond_api import... |
mordred/BertzCT.py | UnixJunkie/mordred | 199 | 9595037 | import rdkit.Chem.GraphDescriptors as RDKit
from ._base import Descriptor
from ._graph_matrix import DistanceMatrix
__all__ = ("BertzCT",)
class BertzCT(Descriptor):
r"""Bertz CT descriptor(rdkit wrapper)."""
since = "1.0.0"
__slots__ = ()
explicit_hydrogens = False
def description(self):
... |
videoanalyst/data/target/target_impl/utils/debug_compare_tensor.py | TragedyN/SiamFCpp | 737 | 9595054 | <reponame>TragedyN/SiamFCpp
import numpy as np
DUMP_DIR = "dump"
tensor_prefix = "center"
tensor_suffix_old = "main"
tensor_suffix_new = "dev"
tensor_old = np.load("{}/{}_{}.npz".format(DUMP_DIR, tensor_prefix,
tensor_suffix_old),
allow_pickle=True)
tens... |
pygm/__init__.py | mrsndmn/PyGM | 169 | 9595059 | __all__ = ['SortedList', 'SortedSet']
__version__ = '0.1'
__author__ = '<NAME>'
import os as _os
from .sortedlist import SortedList
from .sortedset import SortedSet
_os.environ['KMP_DUPLICATE_LIB_OK'] = 'True'
|
.config/qtile/settings/groups.py | fernandopr11/dotfiles | 533 | 9595079 | <filename>.config/qtile/settings/groups.py
# <NAME>
# https://youtube.com/c/antoniosarosi
# https://github.com/antoniosarosi/dotfiles
# Qtile workspaces
from libqtile.config import Key, Group
from libqtile.command import lazy
from .keys import mod, keys
# Get the icons at https://www.nerdfonts.com/cheat-sheet (you ... |
oandapyV20/endpoints/trades.py | T3chSawy/oanda-api-v20 | 389 | 9595105 | # -*- coding: utf-8 -*-
"""Handle trades endpoints."""
from .apirequest import APIRequest
from .decorators import dyndoc_insert, endpoint
from .responses.trades import responses
from abc import abstractmethod
class Trades(APIRequest):
"""Trades - abstract baseclass to handle the trades endpoints."""
ENDPOINT... |
django_ses/signals.py | Supratix/django-ses | 522 | 9595115 | from django.dispatch import Signal
# The following fields are used from the 3 signals below: mail_obj, bounce_obj, raw_message
bounce_received = Signal()
complaint_received = Signal()
delivery_received = Signal()
send_received = Signal()
open_received = Signal()
click_received = Signal()
|
datumaro/cli/commands/diff.py | jenhaoyang/datumaro | 237 | 9595149 | <filename>datumaro/cli/commands/diff.py
# Copyright (C) 2019-2021 Intel Corporation
#
# SPDX-License-Identifier: MIT
from enum import Enum, auto
import argparse
import json
import logging as log
import os
import os.path as osp
from datumaro.components.errors import ProjectNotFoundError
from datumaro.components.operat... |
docs/server.py | morganwillcock/m2r | 277 | 9595154 | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
from os import path
import subprocess
from livereload import Server
docsdir = path.dirname(path.abspath(__file__))
builddir = path.join(docsdir, '_build')
build_cmd = [
'sphinx-build', '-b', 'html', '-E', '-q',
'-d', path.join(builddir, 'doctrees'),
docsdir,... |
sdk/python/pulumi_azure/redis/get_cache.py | henriktao/pulumi-azure | 109 | 9595176 | # 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, Sequence, Union, overload
from .. import... |
ch03/ch03-03-multi_tables.py | makinzm/kagglebook | 470 | 9595198 | <reponame>makinzm/kagglebook<gh_stars>100-1000
import numpy as np
import pandas as pd
# -----------------------------------
# データの結合
# -----------------------------------
# データの読み込み
train = pd.read_csv('../input/ch03/multi_table_train.csv')
product_master = pd.read_csv('../input/ch03/multi_table_product.csv')
user_log... |
misc/benchmarks/py-many-resources/dummy.py | jandom/examples | 1,628 | 9595207 | import pulumi
class Dummy(pulumi.ComponentResource):
def __init__(self, name, deadweight, opts=None):
super().__init__('examples:dummy:Dummy', name, {'deadweight': deadweight}, opts)
self.deadweight = pulumi.Output.from_input(deadweight)
self.register_outputs({'deadweight': self.deadweig... |
virtualbmc/manager.py | aiminickwong/virtualbmc | 133 | 9595252 | <reponame>aiminickwong/virtualbmc
# 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 agr... |
fusion_gpt_attention.py | raikonenfnu/transformer-benchmarks | 6,036 | 9595276 | <gh_stars>1000+
#-------------------------------------------------------------------------
# Copyright (c) Microsoft Corporation. All rights reserved.
# Licensed under the MIT License.
#--------------------------------------------------------------------------
import numpy as np
from logging import getLogger
from onnx... |
pytorch_pfn_extras/runtime/__init__.py | belltailjp/pytorch-pfn-extras | 243 | 9595283 | <gh_stars>100-1000
from pytorch_pfn_extras.runtime._runtime import BaseRuntime # NOQA
from pytorch_pfn_extras.runtime._runtime import PyTorchRuntime # NOQA
from pytorch_pfn_extras.runtime._registry import _RuntimeRegistry # NOQA
runtime_registry = _RuntimeRegistry(PyTorchRuntime)
|
pretrain/data_preprocess/kitti/kitti_process.py | kudo1026/Pri3D | 103 | 9595299 | <reponame>kudo1026/Pri3D
# Basic libs
import os, time, glob, random, pickle, copy, torch, argparse
import numpy as np
import trimesh
from collections import namedtuple
from PIL import Image
def apply_transform(pts, trans):
R = trans[:3, :3]
T = trans[:3, 3]
pts = pts @ R.T + T
return pts
def odometry_... |
25_head_pose_estimation/01_float32/01_face_detector/03_integer_quantization_with_postprocess.py | khanfarhan10/PINTO_model_zoo | 1,529 | 9595316 | <filename>25_head_pose_estimation/01_float32/01_face_detector/03_integer_quantization_with_postprocess.py
### tensorflow-gpu==1.15.2
import tensorflow as tf
import numpy as np
def representative_dataset_gen():
for image in raw_test_data:
image = tf.image.resize(image, (300, 300))
image = image[np.... |
examples/xml_minidom.py | mikelolasagasti/bandit | 4,016 | 9595332 | from xml.dom.minidom import parseString as badParseString
from defusedxml.minidom import parseString as goodParseString
a = badParseString("<myxml>Some data some more data</myxml>")
print(a)
b = goodParseString("<myxml>Some data some more data</myxml>")
print(b)
from xml.dom.minidom import parse as badParse
from defu... |
tests/test_unsupervised_loss.py | jingmouren/tabnet | 1,652 | 9595341 | import numpy as np
import torch
import pytest
from pytorch_tabnet.metrics import UnsupervisedLoss, UnsupervisedLossNumpy
@pytest.mark.parametrize(
"y_pred,embedded_x,obf_vars",
[
(
np.random.uniform(low=-2, high=2, size=(20, 100)),
np.random.uniform(low=-2, high=2, size=(20, 10... |
model/tts.py | suspiria/MelNet | 190 | 9595346 | import torch
import torch.nn as nn
import torch.nn.functional as F
import numpy as np
from .rnn import DelayedRNN
from text import symbols
from utils.utils import en_symbols
class Attention(nn.Module):
def __init__(self, hp):
super(Attention, self).__init__()
self.M = hp.model.gmm
self.rnn... |
tabulator/parser.py | BCODMO/tabulator-py | 224 | 9595384 | # -*- coding: utf-8 -*-
from __future__ import division
from __future__ import print_function
from __future__ import absolute_import
from __future__ import unicode_literals
from six import add_metaclass
from abc import ABCMeta, abstractmethod
# Module API
@add_metaclass(ABCMeta)
class Parser(object):
"""Abstrac... |
tests/commands/custom_validators/test_validators.py | kevinbuchanjr/sagify | 352 | 9595432 | import click
import pytest
from sagify.commands.custom_validators.validators import validate_tags
@pytest.mark.parametrize("test_input,expected", [
(
"key1=value1;key2=3",
[
{'Key': "key1", 'Value': "value1"},
{'Key': "key2", 'Value': "3"}
]
),
(
"k... |
{{cookiecutter.github_repository}}/{{cookiecutter.main_module}}/users/services.py | Fueled/django-in | 150 | 9595448 | <filename>{{cookiecutter.github_repository}}/{{cookiecutter.main_module}}/users/services.py<gh_stars>100-1000
# Third Party Stuff
from django.contrib.auth import authenticate, get_user_model
# {{ cookiecutter.project_name }} Stuff
from {{cookiecutter.main_module}}.base import exceptions as exc
def get_and_authentica... |
train_whiten(nli).py | dumpmemory/BERT-whitening-pytorch | 171 | 9595457 | # coding: utf-8
"""
用AllNLI计算得到whitening的kernel和bias.
@env: python3, pytorch>=1.7.1, transformers==4.2.0
@author: <NAME>
@date: 20/01/2020
"""
import os
import torch
import numpy as np
from transformers import BertModel, BertTokenizer
from tqdm import tqdm
import scipy.stats
import pickle
from all_utils import build_m... |
alibi_detect/cd/tests/test_spot_the_diff.py | sugatoray/alibi-detect | 1,227 | 9595480 | <reponame>sugatoray/alibi-detect<gh_stars>1000+
import numpy as np
import pytest
import tensorflow as tf
from tensorflow.keras.layers import Dense
import torch
import torch.nn as nn
from alibi_detect.cd import SpotTheDiffDrift
from alibi_detect.cd.pytorch.spot_the_diff import SpotTheDiffDriftTorch
from alibi_detect.cd.... |
io/swig/io/siconos_export_raw_data.py | fperignon/sandbox | 137 | 9595485 | #!/usr/bin/env @PYTHON_EXECUTABLE@
"""
Description: Export a Siconos mechanics-IO HDF5 file to raw data .dat file
"""
from siconos.io.vview import VView, VRawDataExportOptions
from siconos.io.mechanics_hdf5 import MechanicsHdf5
if __name__=='__main__':
# Parse command-line
opts = VRawDataExportOptions()
o... |
reagent/ope/test/multiclass_bandits.py | dmitryvinn/ReAgent | 1,156 | 9595523 | #!/usr/bin/env python3
# Copyright (c) Facebook, Inc. and its affiliates. All rights reserved.
import argparse
import json
import logging
import os
import random
import sys
from dataclasses import dataclass
from pathlib import PurePath
from typing import Iterable, Tuple
import numpy as np
import pandas as pd
import t... |
pyqtgraph/parametertree/parameterTypes/checklist.py | leo603222/fix-displace-between-selection-area-and-mouse-pos | 2,762 | 9595530 | <reponame>leo603222/fix-displace-between-selection-area-and-mouse-pos
from . import BoolParameterItem, SimpleParameter
from .basetypes import GroupParameterItem, GroupParameter, WidgetParameterItem
from .list import ListParameter
from .slider import Emitter
from ..ParameterItem import ParameterItem
from ... import func... |
endpoints/api/test/test_repository.py | ibazulic/quay | 2,027 | 9595563 | <reponame>ibazulic/quay<filename>endpoints/api/test/test_repository.py
import pytest
from mock import patch, ANY, MagicMock
from data import model, database
from data.appr_model import release, channel, blob
from endpoints.appr.models_cnr import model as appr_model
from endpoints.api.test.shared import conduct_api_ca... |
sdk/subscription/azure-mgmt-subscription/azure/mgmt/subscription/models/_models.py | moovy2/azure-sdk-for-python | 2,728 | 9595564 | # 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 ... |
counterfit/targets/satellite/satellite.py | ScriptBox99/azure-counterfit | 495 | 9595574 | <gh_stars>100-1000
import numpy as np
import torchvision.models as models
from torchvision import transforms
from torch import nn
import torch
from torch.nn import functional as F
import PIL
from counterfit.core.targets import Target
class SatelliteImagesTarget(Target):
""" Image recognition model that leverages... |
cyphercat/utils/svc_utils.py | arafin-lab/model_inversion_experiments | 101 | 9595647 | <reponame>arafin-lab/model_inversion_experiments<filename>cyphercat/utils/svc_utils.py
from __future__ import print_function
import os
import numpy as np
import torch
import torchvision
from sklearn import svm
from sklearn.decomposition import PCA
from sklearn.pipeline import make_pipeline
from sklearn.preprocessing... |
example/00_tutorial/module.py | raptoravis/two | 578 | 9595667 | <gh_stars>100-1000
name = 'ex_00_tutorial'
namespace = ''
preproc_name = '_00_TUTORIAL'
subdir = '00_tutorial'
dependencies = ['obj', 'math', 'ui', 'uio', 'gfx', 'edit', 'procgen', 'procgen-gfx']
|
benchmarking/reporters/simple_screen_reporter/simple_screen_reporter.py | virtan/FAI-PEP | 359 | 9595678 | #!/usr/bin/env python
##############################################################################
# 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.
################################... |
mordred/_matrix_attributes.py | ademidun/mordred | 199 | 9595680 | from collections import namedtuple
import numpy as np
from six import string_types
from ._base import Descriptor
Eig = namedtuple("eigen", "val vec min max")
methods = []
def method(cls):
methods.append(cls)
cls.as_argument = cls.__name__
return cls
class MatrixAttributeBase(Descriptor):
__slots... |
desktop/core/ext-py/gunicorn-19.9.0/tests/test_sock.py | kokosing/hue | 5,079 | 9595714 | # -*- coding: utf-8 -
#
# This file is part of gunicorn released under the MIT license.
# See the NOTICE for more information.
try:
import unittest.mock as mock
except ImportError:
import mock
from gunicorn import sock
def test_socket_close():
listener1 = mock.Mock()
listener1.getsockname.return_val... |
tf_keras_vis/gradcam.py | luizsantos-1/tf-keras-vis | 232 | 9595726 | <reponame>luizsantos-1/tf-keras-vis
from typing import Union
import numpy as np
import tensorflow as tf
import tensorflow.keras.backend as K
from scipy.ndimage.interpolation import zoom
from . import ModelVisualization
from .utils import is_mixed_precision, normalize, zoom_factor
from .utils.model_modifiers import Ex... |
rosbag2_py/test/test_reindexer.py | MourtazaKASSAMALY/rosbag2 | 118 | 9595750 | # Copyright 2021 DCS 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
#
# Unless required by applicable law... |
Codes/GinRyan/LeetCode/Python-3-Solves/5_longest_palindromic_substring.py | liuxiaohui1221/algorithm | 256 | 9595755 | """
给定一个字符串 s,找到 s 中最长的回文子串。你可以假设 s 的最大长度为 1000。
示例 1:
输入: "babad"
输出: "bab"
注意: "aba" 也是一个有效答案。
示例 2:
输入: "cbbd"
输出: "bb"
"""
"""
题解:
本题可以用一种中央扩散法, 最差情况O(N^2)
每次移动一次索引, 就以此为中心扩展判断两边 i-n和i+n是否相同,相同则每次更新一个最大值缓存,不相同时则继续跳到下一个,再重新继续这个步骤
"""
class Solution:
def longestPalindrome(self, s: str) -> str:
max... |
python/GafferSceneTest/ScenePathTest.py | ddesmond/gaffer | 561 | 9595773 | ##########################################################################
#
# Copyright (c) 2013, Image Engine Design 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:
#
# * Redistrib... |
api/tacticalrmm/agents/migrations/0036_agent_block_policy_inheritance.py | infinite8co/tacticalrmm | 903 | 9595784 | # Generated by Django 3.1.7 on 2021-04-17 01:28
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('agents', '0035_auto_20210329_1709'),
]
operations = [
migrations.AddField(
model_name='agent',
name='block_policy_in... |
2020/07/06/Intro to Postgres JSON Columns in Flask-SQLAlchemy/jsontest/app.py | kenjitagawa/youtube_video_code | 492 | 9595785 | from flask import Flask
from flask_sqlalchemy import SQLAlchemy
from sqlalchemy.dialects.postgresql import JSON
app = Flask(__name__)
app.config['SQLALCHEMY_DATABASE_URI'] = 'postgres://'
app.config['SQLALCHEMY_TRACK_MODIFICATIONS'] = True
db = SQLAlchemy(app)
class Example(db.Model):
id = db.Column(db.Intege... |
Codeforces/CodeCraft 2015/Problem H/gen2.py | VastoLorde95/Competitive-Programming | 170 | 9595798 | print 10**5,2
n = 10**5
for i in xrange(n):
print n-i,
|
delta/data/frontend/cmvn.py | didichuxing/delta | 1,442 | 9595816 | # Copyright (C) 2017 Beijing Didi Infinity Technology and Development Co.,Ltd.
# All rights reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LI... |
Lib/objc/CoreMIDI.py | snazari/Pyto | 701 | 9595836 | """
Classes from the 'CoreMIDI' framework.
"""
try:
from rubicon.objc import ObjCClass
except ValueError:
def ObjCClass(name):
return None
def _Class(name):
try:
return ObjCClass(name)
except NameError:
return None
MIDINetworkConnection = _Class("MIDINetworkConnection")
MID... |
tempest/tests/lib/services/identity/v2/test_roles_client.py | mail2nsrajesh/tempest | 254 | 9595844 | # Copyright 2016 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 may obtain
# a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable la... |
challenges/Multicast_Chat_Server/poller/for-release/machine.py | pingjuiliao/cb-multios | 473 | 9595845 | #!/usr/bin/env python
#
# Copyright (C) 2015 Narf Industries <<EMAIL>>
#
# 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, including without limitation
# the rights to use,... |
app/outlier_treatment/spaces.py | tungpatrick/AutoOut | 101 | 9595887 | <filename>app/outlier_treatment/spaces.py
OUTLIER_SPACES = [{"model": "zscore", "params": {"threshold":3.5}},
{"model": "DBSCAN", "params": {}},
{"model": "OPTICS", "params": {}},
{"model": "IsolationForest", "params": {}},
{"model": "EllipticEnvel... |
simplemonitor/Loggers/__init__.py | cgroschupp/simplemonitor | 373 | 9595896 | <filename>simplemonitor/Loggers/__init__.py
"""
Loggers for SimpleMonitor
"""
from .db import DBFullLogger, DBStatusLogger
from .file import FileLogger
from .mqtt import MQTTLogger
from .network import Listener, NetworkLogger
from .seq import SeqLogger
|
DQMServices/Components/python/DQMFileSaver_cfi.py | ckamtsikis/cmssw | 852 | 9595908 | <filename>DQMServices/Components/python/DQMFileSaver_cfi.py<gh_stars>100-1000
import FWCore.ParameterSet.Config as cms
# DQM file saver module
dqmSaver = cms.EDAnalyzer("DQMFileSaver",
# Possible conventions are "Online", "Offline" and "RelVal".
convention = cms.untracked.string('Offline'),
# Save files in... |
tests/unit/tensorflow/callbacks/test_monitor_elbo.py | chiragnagpal/probflow | 134 | 9595919 | <reponame>chiragnagpal/probflow
import matplotlib.pyplot as plt
import numpy as np
from get_model_and_data import get_model_and_data
from probflow.callbacks import MonitorELBO
def test_MonitorELBO(plot):
# Get a model and data
my_model, x, y = get_model_and_data()
# Test MontiorELBO
me = MonitorELB... |
alipay/aop/api/response/AlipayUserAgreementSignEffectResponse.py | snowxmas/alipay-sdk-python-all | 213 | 9595920 | #!/usr/bin/env python
# -*- coding: utf-8 -*-
import json
from alipay.aop.api.response.AlipayResponse import AlipayResponse
class AlipayUserAgreementSignEffectResponse(AlipayResponse):
def __init__(self):
super(AlipayUserAgreementSignEffectResponse, self).__init__()
self._agreement_no = None
... |
Lib/encodings/undefined.py | shawwn/cpython | 52,316 | 9595929 | <filename>Lib/encodings/undefined.py
""" Python 'undefined' Codec
This codec will always raise a ValueError exception when being
used. It is intended for use by the site.py file to switch off
automatic string to Unicode coercion.
Written by <NAME> (<EMAIL>).
(c) Copyright CNRI, All Rights Reserved. NO WA... |
tensorflow_constrained_optimization/python/rates/general_rates.py | RMKruse/tensorflow_constrained_optimization | 276 | 9595950 | # Copyright 2018 The TensorFlow Constrained Optimization 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
#
#... |
mmedit/datasets/comp1k_dataset.py | Jian137/mmediting-1 | 1,884 | 9595973 | # Copyright (c) OpenMMLab. All rights reserved.
import os.path as osp
import mmcv
from .base_matting_dataset import BaseMattingDataset
from .registry import DATASETS
@DATASETS.register_module()
class AdobeComp1kDataset(BaseMattingDataset):
"""Adobe composition-1k dataset.
The dataset loads (alpha, fg, bg) ... |
alipay/aop/api/domain/AntfarmUserDonationInfo.py | antopen/alipay-sdk-python-all | 213 | 9595979 | <reponame>antopen/alipay-sdk-python-all
#!/usr/bin/env python
# -*- coding: utf-8 -*-
import json
from alipay.aop.api.constant.ParamConstants import *
from alipay.aop.api.domain.AntfarmUserDonationRecord import AntfarmUserDonationRecord
class AntfarmUserDonationInfo(object):
def __init__(self):
self._do... |
examples/turn-leds-off.py | fejao/scroll-phat | 115 | 9595987 | #!/usr/bin/env python
import scrollphat
scrollphat.clear()
|
alipay/aop/api/domain/MedicalSvTpCardActionInfo.py | snowxmas/alipay-sdk-python-all | 213 | 9596012 | #!/usr/bin/env python
# -*- coding: utf-8 -*-
import json
from alipay.aop.api.constant.ParamConstants import *
class MedicalSvTpCardActionInfo(object):
def __init__(self):
self._action_code = None
self._action_name = None
self._action_url = None
@property
def action_code(self):
... |
https.py | PrincessMelime/webtest.io | 851 | 9596018 | #!/usr/bin/python
# server
# python https.py
#
# browser
# https://0.0.0.0:4443
import BaseHTTPServer
import SimpleHTTPServer
import ssl
import os
os.system("openssl req -new -keyout server.pem -out server.pem -x509 -days 365 -nodes -subj '/CN=www.pubnub.com/O=PubNub/C=US'")
httpd = BaseHTTPServer.HTTPServer( ... |
keras_tuner/applications/resnet.py | ageron/keras-tuner | 2,676 | 9596033 | <reponame>ageron/keras-tuner
# Copyright 2019 The KerasTuner 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
#
# https://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.