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 |
|---|---|---|---|---|---|---|---|---|---|---|
examples/decorator_package.py | ywchiu/flasgger | 1,696 | 3231016 | <reponame>ywchiu/flasgger<gh_stars>1000+
"""
This tests the use of `decorator` package with Flasgger
"""
from decorator import decorator
from flask import Flask, jsonify
from flasgger import Swagger
app = Flask(__name__)
swag = Swagger(app)
@decorator
def trace(f, *args, **kw):
kwstr = ', '.join('%r: %r' % (k, k... | 0 | 0 | 0 | 0 | 0 | 0 |
test/ao/sparsity/test_scheduler.py | Hacky-DH/pytorch | 60,067 | 3231021 | <gh_stars>1000+
# -*- coding: utf-8 -*-
from torch import nn
from torch.ao.sparsity import WeightNormSparsifier
from torch.ao.sparsity import BaseScheduler, LambdaSL
from torch.testing._internal.common_utils import TestCase
import warnings
class ImplementedScheduler(BaseScheduler):
def get_sl(self):
if s... | 0 | 0 | 0 | 0 | 0 | 0 |
tests/nat/test_static_nat.py | emilmih/sonic-mgmt | 132 | 3231023 | import copy
import time
import json
import pytest
from nat_helpers import DIRECTION_PARAMS
from nat_helpers import STATIC_NAT_TABLE_NAME
from nat_helpers import STATIC_NAPT_TABLE_NAME
from nat_helpers import REBOOT_MAP
from nat_helpers import apply_static_nat_config
from nat_helpers import check_peers_by_ping
from na... | 0 | 0 | 0 | 0 | 0 | 0 |
src/alexapi/device_platforms/raspberrypiplatform.py | amudhan22/AlexaPI | 1,466 | 3231036 | import RPi.GPIO as GPIO
from .rpilikeplatform import RPiLikePlatform
class RaspberrypiPlatform(RPiLikePlatform):
def __init__(self, config):
super(RaspberrypiPlatform, self).__init__(config, 'raspberrypi', GPIO)
def setup(self):
GPIO.setwarnings(False)
GPIO.cleanup()
GPIO.setmode(GPIO.BCM)
super(Raspb... | 0 | 0 | 0 | 0 | 0 | 0 |
tests/unit/modules/test_win_psget.py | markgras/salt | 9,425 | 3231042 | <reponame>markgras/salt<filename>tests/unit/modules/test_win_psget.py
import salt.modules.win_psget as win_psget
from tests.support.mixins import LoaderModuleMockMixin
from tests.support.mock import MagicMock, patch
from tests.support.unit import TestCase
BOOTSTRAP_PS_STR = """<?xml version="1.0" encoding="utf-8"?>
<O... | 0 | 0 | 0 | 0 | 0 | 0 |
tasks/search.py | dachenlian/weibospider | 3,649 | 3231058 | from urllib import parse as url_parse
from logger import crawler
from .workers import app
from page_get import get_page
from config import get_max_search_page
from page_parse import search as parse_search
from db.dao import (
KeywordsOper, KeywordsDataOper, WbDataOper)
# This url is just for original weibos.
# I... | 0 | 1 | 0 | 0 | 1 | 0 |
musicautobot/music_transformer/learner.py | adam1214/musicautobot | 402 | 3231083 | from __future__ import annotations
from fastai.basics import *
from fastai.text.learner import LanguageLearner, get_language_model, _model_meta
from .model import *
from .transform import MusicItem
from ..numpy_encode import SAMPLE_FREQ
from ..utils.top_k_top_p import top_k_top_p
from ..utils.midifile import is_empty_m... | 24 | 6 | 0 | 0 | 30 | 0 |
runtimes/alibi-detect/mlserver_alibi_detect/errors.py | alexander-manley/MLServer | 191 | 3231097 | from mlserver.errors import MLServerError
class InvalidAlibiDetector(MLServerError):
def __init__(self, model_name: str):
msg = f"Invalid Alibi Detector type for model {model_name}"
super().__init__(msg)
| 1 | 0 | 0 | 0 | 1 | 0 |
desktop/core/ext-py/Babel-2.5.1/tests/messages/test_jslexer.py | kokosing/hue | 5,079 | 3231101 | <reponame>kokosing/hue
# -*- coding: utf-8 -*-
from babel.messages import jslexer
def test_unquote():
assert jslexer.unquote_string('""') == ''
assert jslexer.unquote_string(r'"h\u00ebllo"') == u"hëllo"
def test_dollar_in_identifier():
assert list(jslexer.tokenize('dollar$dollar')) == [('name', 'dollar... | 0 | 0 | 0 | 0 | 0 | 0 |
tables/log-parsers/plot-num-denotations.py | yash-srivastava19/sempre | 812 | 3231110 | #!/usr/bin/env python
# -*- coding: utf-8 -*-
import sys, os, shutil, re, argparse, json
from codecs import open
from itertools import izip
from collections import defaultdict
def main():
parser = argparse.ArgumentParser()
parser.add_argument('-f', '--field', type=int, default=4,
help='the field t... | 0 | 0 | 0 | 0 | 0 | 0 |
pclib/rtl/regs_test.py | belang/pymtl | 206 | 3231154 | #=========================================================================
# regs_test.py
#=========================================================================
import pytest
from pymtl import *
from pclib.test import TestVectorSimulator
from regs import *
#--------------------------------------------... | 0 | 0 | 0 | 0 | 0 | 0 |
tagulous/models/migrations.py | nschlemm/django-tagulous | 307 | 3231156 | <reponame>nschlemm/django-tagulous<gh_stars>100-1000
"""
Migration support for Django migrations
"""
from django.db import migrations
from .models import BaseTagModel, BaseTagTreeModel
# ##############################################################################
# #################################################... | 0 | 0 | 0 | 0 | 0 | 0 |
server/www/packages/packages-windows/x86/ldap3/abstract/entry.py | tinygg/teleport | 640 | 3231160 | <filename>server/www/packages/packages-windows/x86/ldap3/abstract/entry.py
"""
"""
# Created on 2016.08.19
#
# Author: <NAME>
#
# Copyright 2016 - 2020 <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 ... | 0 | 0 | 0 | 0 | 0 | 0 |
corehq/apps/export/migrations/0005_datafile_blobmeta.py | dimagilg/commcare-hq | 471 | 3231176 | # Generated by Django 1.11.14 on 2018-08-03 17:32
from django.db import migrations
class Migration(migrations.Migration):
dependencies: list[tuple[str, str]] = [
('export', '0004_datafile_delete_after'),
]
operations: list[object] = [
migrations.DeleteModel(name='DataFile'),
]
| 0 | 0 | 2 | 0 | 2 | 0 |
anime_downloader/extractors/hydrax.py | Alsira/anime-downloader | 1,077 | 3231234 | from __future__ import annotations
from anime_downloader.extractors.base_extractor import BaseExtractor
from anime_downloader.sites import helpers
import logging
import base64
logger = logging.getLogger(__name__)
class Hydrax(BaseExtractor):
def _get_data(self) -> dict[str,object | str]:
url = self.url
... | 0 | 1 | 0 | 0 | 1 | 0 |
sparseconvnet/spectral_norm.py | DeepLearnPhysics/SparseConvNet | 1,708 | 3231249 | <reponame>DeepLearnPhysics/SparseConvNet
# Copyright 2016-present, Facebook, Inc.
# All rights reserved.
#
# This source code is licensed under the BSD-style license found in the
# LICENSE file in the root directory of this source tree.
import torch
from torch.nn.functional import normalize
from torch.nn.parameter impo... | 0 | 0 | 0 | 0 | 0 | 0 |
sort_data.py | tchaye59/pointer-networks | 151 | 3231250 | from __future__ import absolute_import, division, print_function
import numpy as np
class DataGenerator(object):
def next_batch(self, batch_size, N, train_mode: bool=True) -> tuple[object, object, object]:
"""Return the next `batch_size` examples from this data set."""
# A sequence of random numb... | 1 | 1 | 0 | 0 | 2 | 0 |
lightnlp/utils/learning.py | CNLPT/lightNLP | 889 | 3231268 | <gh_stars>100-1000
def adjust_learning_rate(optimizer, new_lr):
"""
Shrinks learning rate by a specified factor.
:param optimizer: optimizer whose learning rates must be decayed
:param new_lr: new learning rate
"""
# print("\nDECAYING learning rate.")
for param_group in optimizer.param_gro... | 0 | 0 | 0 | 0 | 0 | 0 |
pypykatz/commons/winapi/processmanipulator.py | wisdark/pypykatz | 1,861 | 3231273 | <reponame>wisdark/pypykatz<filename>pypykatz/commons/winapi/processmanipulator.py
#!/usr/bin/env python3
#
# Author:
# <NAME> (@skelsec)
#
import platform
from pypykatz import logger
from pypykatz.commons.winapi.local.localwindowsapi import LocalWindowsAPI
from pypykatz.commons.winapi.constants import *
class TokenI... | 0 | 0 | 0 | 0 | 0 | 0 |
tests/rules/test_grep_arguments_order.py | HiteshMah-Jan/thefuck | 75,504 | 3231322 | import pytest
from thefuck.rules.grep_arguments_order import get_new_command, match
from thefuck.types import Command
output = 'grep: {}: No such file or directory'.format
@pytest.fixture(autouse=True)
def os_path(monkeypatch):
monkeypatch.setattr('os.path.isfile', lambda x: not x.startswith('-'))
@pytest.mark... | 0 | 0 | 0 | 0 | 0 | 0 |
keycloak/authorization/role.py | SalemWafi/python-keycloak | 350 | 3231341 | # -*- coding: utf-8 -*-
#
# The MIT License (MIT)
#
# Copyright (C) 2017 <NAME> <<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 t... | 1 | 2 | 0 | 0 | 3 | 0 |
corehq/apps/enterprise/migrations/0001_initial.py | akashkj/commcare-hq | 471 | 3231386 | # Generated by Django 2.2.20 on 2021-06-10 17:56
import django.contrib.postgres.fields
from django.db import migrations, models
import django.db.models.deletion
class Migration(migrations.Migration):
initial: bool = True
dependencies: list[tuple[str, str]] = [
("accounting", "0001_squashed_0052_ens... | 0 | 0 | 3 | 0 | 3 | 0 |
guv/support/psycopg2_patcher.py | timgates42/guv | 120 | 3231411 | """A wait callback to allow psycopg2 cooperation with guv
Use :func:`make_psycopg_green()` to enable guv support in psycopg2.
"""
import psycopg2
from psycopg2 import extensions
from ..hubs import trampoline
from ..const import READ, WRITE
def psycopg2_wait_cb(conn, timeout=-1):
"""A wait callback to trigger a... | 0 | 0 | 0 | 0 | 0 | 0 |
sdk/cognitiveservices/azure-cognitiveservices-search-websearch/azure/cognitiveservices/search/websearch/models/_models_py3.py | rsdoherty/azure-sdk-for-python | 2,728 | 3231426 | # 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 ... | 10 | 35 | 80 | 105 | 230 | 0 |
python/bench/bench_matmul.py | h-vetinari/triton | 146 | 3231430 | from __future__ import annotations
import torch
import triton
def rounded_linspace(low, high, steps, div) -> list[object]:
ret = torch.linspace(low, high, steps)
ret = (ret.int() + div - 1) // div * div
ret = torch.unique(ret)
return list(map(int, ret))
# Square benchmarks
nt = {False: "n", True: "... | 2 | 2 | 0 | 0 | 4 | 0 |
mmfewshot/utils/__init__.py | BIGWangYuDong/mmfewshot | 376 | 3231445 | # Copyright (c) OpenMMLab. All rights reserved.
from .collate import multi_pipeline_collate_fn
from .compat_config import compat_cfg
from .dist_utils import check_dist_init, sync_random_seed
from .infinite_sampler import (DistributedInfiniteGroupSampler,
DistributedInfiniteSampler,
... | 0 | 0 | 0 | 0 | 0 | 0 |
ciphey/basemods/Decoders/atbash.py | AlexandruValeanu/Ciphey | 9,908 | 3231446 | from typing import Dict, Optional
from ciphey.common import fix_case
from ciphey.iface import Config, Decoder, ParamSpec, T, U, WordList, registry
@registry.register
class Atbash(Decoder[str]):
def decode(self, ctext: T) -> Optional[U]:
"""
Takes an encoded string and attempts to decode it accord... | 2 | 4 | 0 | 0 | 6 | 0 |
jam/admin/task.py | bachiri-age/stat-vaccin-covid19 | 384 | 3231465 | <filename>jam/admin/task.py
import os
import json
from werkzeug._compat import iterkeys
from ..common import consts, ProjectNotCompleted
from ..server_classes import Task, Group
def create_task(app):
result = None
adm = app.admin
it = adm.sys_items.copy()
it.set_where(type_id=consts.TASK_TYPE)
it... | 0 | 0 | 0 | 0 | 0 | 0 |
glom/test/test_spec.py | hristog/glom | 1,470 | 3231475 | <reponame>hristog/glom
import pytest
from glom import glom, Spec, T, S
def test_spec():
assert glom(5, T) == 5 # check assumption about echo behavior
echo = Spec(T)
assert echo.glom(5) == 5
assert glom(5, echo) == 5
echo2 = Spec(echo)
assert echo2.glom(5) == 5
with pytest.raises(TypeEr... | 0 | 0 | 0 | 0 | 0 | 0 |
clinica/utils/stream.py | MatthieuJoulot/clinica | 135 | 3231476 | """This module handles stream and log redirection."""
from enum import Enum
class LoggingLevel(str, Enum):
debug: str = "debug"
info: str = "info"
warning: str = "warning"
error: str = "error"
critical: str = "critical"
def cprint(msg: str, lvl: str = "info") -> None:
"""
Print message ... | 2 | 1 | 5 | 0 | 8 | 0 |
python/RandomEmbeddingLearner.py | maukbe/DeepBugs | 129 | 3231489 | '''
Created on Jul 3, 2017
@author: <NAME>
'''
import json
import math
import sys
import time
import numpy as np
import random
from numpy.random import normal
from HyperParameters import name_embedding_size
kept_main_tokens = 10000
def count_samples(data_paths) -> object:
total_examples = 0
for path in ... | 0 | 2 | 0 | 0 | 2 | 0 |
modules/gitbox/files/asfgit/log.py | isabella232/infrastructure-puppet | 121 | 3231511 | import os
import syslog
import time
import traceback
import asfgit.cfg as cfg
def exception():
logfile = os.path.join(cfg.repo_dir, "error.log")
tb = traceback.format_exc()
# Send error message to syslog
syslog.syslog(syslog.LOG_ERR, "{0} - {1}".format(cfg.script_name, tb))
# Send error message to... | 0 | 0 | 0 | 0 | 0 | 0 |
tests/test_sklearn_scaler_converter.py | vumichien/hummingbird | 2,772 | 3231514 | """
Tests scikit scaler converter.
"""
import unittest
import numpy as np
import torch
from sklearn.preprocessing import RobustScaler, MaxAbsScaler, MinMaxScaler, StandardScaler
import hummingbird.ml
from hummingbird.ml._utils import tvm_installed
from hummingbird.ml import constants
class TestSklearnScalerConverter... | 2 | 0 | 0 | 0 | 2 | 0 |
tests/installation/test_chooser.py | uda/poetry | 12,347 | 3231516 | from __future__ import annotations
import re
from pathlib import Path
import pytest
from packaging.tags import Tag
from poetry.core.packages.package import Package
from poetry.installation.chooser import Chooser
from poetry.repositories.legacy_repository import LegacyRepository
from poetry.repositories.pool import ... | 0 | 6 | 0 | 0 | 6 | 0 |
drain/utils.py | joemphilips/plugins | 173 | 3231520 | import time
TIMEOUT = 60
# we need to have this pyln.testing.utils code duplication
# as this also needs to be run without testing libs
def wait_for(success, timeout=TIMEOUT):
start_time = time.time()
interval = 0.25
while not success() and time.time() < start_time + timeout:
time.sleep(interval)... | 0 | 3 | 0 | 0 | 3 | 0 |
python/cog/server/redis_log_capture.py | KenniVelez/cog | 354 | 3231525 | import time
import json
import sys
import uuid
import multiprocessing
import os
import contextlib
import redis
@contextlib.contextmanager
def capture_log(redis_host, redis_port, redis_db, log_queue, stage, prediction_id):
"""
Send each log line to a redis RPUSH queue in addition to an
existing output str... | 0 | 0 | 0 | 0 | 0 | 0 |
tests/cases/sys_exit.py | div72/py2many | 345 | 3231584 | import sys
if __name__ == "__main__":
print("OK")
sys.exit(1)
| 0 | 0 | 0 | 0 | 0 | 0 |
powerdnsadmin/models/account.py | ajax10g/PowerDNS-Admin | 109 | 3231585 | from __future__ import annotations
import traceback
from flask import current_app
from urllib.parse import urljoin
from ..lib import utils
from .base import db
from .setting import Setting
from .user import User
from .account_user import AccountUser
class Account(db.Model):
__tablename__: str = 'account'
id ... | 5 | 10 | 1 | 0 | 16 | 0 |
reviewboard/webapi/tests/test_review_request_draft.py | ParikhKadam/reviewboard | 921 | 3231612 | from __future__ import annotations
from __future__ import print_function, unicode_literals
from django.contrib import auth
from django.contrib.auth.models import Permission, User
from django.core import mail
from djblets.features.testing import override_feature_check
from djblets.testing.decorators import add_fixtures... | 9 | 8 | 2 | 0 | 19 | 0 |
RecoTauTag/RecoTau/python/PFRecoTauDiscriminationAgainstMuonMVA_cfi.py | ckamtsikis/cmssw | 852 | 3231617 | <gh_stars>100-1000
import FWCore.ParameterSet.Config as cms
from RecoTauTag.RecoTau.TauDiscriminatorTools import requireLeadTrack
pfRecoTauDiscriminationAgainstMuonMVA = cms.EDProducer("PFRecoTauDiscriminationAgainstMuonMVA",
# tau collection to discriminate
PFTauProducer = cms.InputTag('pfTauProducer'),
... | 0 | 0 | 0 | 0 | 0 | 0 |
easyfsl/data_tools/easy_set.py | lnowakow/easy-few-shot-learning | 208 | 3231622 | import json
from pathlib import Path
from typing import List, Union
from PIL import Image
from torchvision import transforms
from torch.utils.data import Dataset
NORMALIZE_DEFAULT = dict(mean=[0.485, 0.456, 0.406], std=[0.229, 0.224, 0.225])
class EasySet(Dataset):
"""
A ready-to-use dataset. Will work for... | 8 | 6 | 0 | 0 | 14 | 0 |
core/sqf/sql/scripts/findPort.py | CoderSong2015/Apache-Trafodion | 148 | 3231650 | # @@@ START COPYRIGHT @@@
#
# 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... | 0 | 0 | 0 | 0 | 0 | 0 |
etw/etw.py | tyh2333/pywintrace | 247 | 3231673 | <filename>etw/etw.py
########################################################################
# Copyright 2017 FireEye 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.... | 0 | 0 | 0 | 0 | 0 | 0 |
lib/detectors/detector_factory.py | shachargluska/centerpose | 245 | 3231698 | <gh_stars>100-1000
from __future__ import absolute_import, division, print_function
from .multi_pose import MultiPoseDetector
detector_factory = {
'multi_pose': MultiPoseDetector,
}
| 0 | 0 | 0 | 0 | 0 | 0 |
multiple-parents-same-grandparent.py | oriolmirosa/dash-recipes | 932 | 3231711 | <reponame>oriolmirosa/dash-recipes<gh_stars>100-1000
import dash
from dash.dependencies import Input, Output
import dash_core_components as dcc
import dash_html_components as html
app = dash.Dash()
app.layout = html.Div([
dcc.Dropdown(
id='grandparent',
options=[{'label': i, 'value': i} for i in ra... | 0 | 0 | 0 | 0 | 0 | 0 |
tests/providers/tableau/operators/test_tableau.py | ChaseKnowlden/airflow | 15,947 | 3231721 | <reponame>ChaseKnowlden/airflow
# 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 ... | 0 | 0 | 0 | 0 | 0 | 0 |
examples/sawyer/moveit_obstacles_make_plan.py | gujralsanyam22/pyrobot | 2,150 | 3231733 | # 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.
"""
Example for commanding robot with position control using moveit planner
"""
from pyrobot import Robot
from pyrobot.utils.util import Movei... | 0 | 0 | 0 | 0 | 0 | 0 |
tests/modules/contrib/test_progress.py | spxtr/bumblebee-status | 1,089 | 3231734 | <filename>tests/modules/contrib/test_progress.py
import pytest
def test_load_module():
__import__("modules.contrib.progress")
| 0 | 0 | 0 | 0 | 0 | 0 |
基础教程/A2-神经网络基本原理/第7步 - 深度神经网络/src/ch16-DnnRegularization/MiniFramework/HyperParameters_4_2.py | microsoft/ai-edu | 11,094 | 3231756 | # Copyright (c) Microsoft. All rights reserved.
# Licensed under the MIT license. See LICENSE file in the project root for full license information.
from __future__ import annotations
from MiniFramework.EnumDef_5_0 import *
# this class is for two-layer NN only
class HyperParameters_4_2(object):
def __init__(self... | 5 | 1 | 0 | 0 | 6 | 0 |
rflint/rules/duplicates.py | mnojek/robotframework-lint | 116 | 3231770 | from __future__ import annotations
from rflint.common import SuiteRule, ResourceRule, ERROR, normalize_name
def check_duplicates(report_duplicate, table,
permitted_dups: object | None=None, normalize_itemname=normalize_name):
# `table` is a SettingsTable or a VariableTable; either contains row... | 1 | 2 | 0 | 0 | 3 | 0 |
learnpy_ecourse/class6/ex3_valid_ip.py | fallenfuzz/pynet | 528 | 3231773 | <filename>learnpy_ecourse/class6/ex3_valid_ip.py<gh_stars>100-1000
#!/usr/bin/env python
'''
Disclaimer - This is a solution to the below problem given the content we have
discussed in class. It is not necessarily the best solution to the problem.
In other words, I generally only use things we have covered up to thi... | 0 | 0 | 0 | 0 | 0 | 0 |
scripts/ci/version_mgr.py | maxvankessel/zephyr | 6,224 | 3231778 | #!/usr/bin/env python3
# Copyright (c) 2020 Intel Corp.
# SPDX-License-Identifier: Apache-2.0
"""
Syntax of file:
[
{
"version": "<commit>",
"date": "<date>",
"weekly: False,
},
]
"""
import json
import argparse
import urllib.request
import os
from git impor... | 1 | 3 | 0 | 0 | 4 | 0 |
tests/vi/test_word.py | my-personal-forks/Vintageous | 1,146 | 3231791 | import unittest
# from Vintageous.vi.constants import _MODE_INTERNAL_NORMAL
from Vintageous.vi.constants import MODE_NORMAL
# from Vintageous.vi.constants import MODE_VISUAL
# from Vintageous.vi.constants import MODE_VISUAL_LINE
from Vintageous.tests import ViewTest
from Vintageous.tests import set_text
from Vintageo... | 0 | 0 | 0 | 0 | 0 | 0 |
ants/utils/invariant_image_similarity.py | xemio/ANTsPy | 338 | 3231828 | <reponame>xemio/ANTsPy
__all__ = ['invariant_image_similarity',
'convolve_image']
import math
from tempfile import mktemp
import numpy as np
import pandas as pd
from .. import utils
from ..core import ants_image as iio
def invariant_image_similarity(image1, image2,
loca... | 0 | 0 | 0 | 0 | 0 | 0 |
cloudiscovery/provider/aws/vpc/command.py | ecorbetthp/cloud-disco | 429 | 3231879 | <reponame>ecorbetthp/cloud-disco
from typing import List
from ipaddress import ip_network
from provider.aws.common_aws import BaseAwsOptions, BaseAwsCommand, AwsCommandRunner
from provider.aws.vpc.diagram import VpcDiagram
from shared.common import (
ResourceDigest,
VPCE_REGEX,
SOURCE_IP_ADDRESS_REGEX,
... | 0 | 0 | 0 | 0 | 0 | 0 |
Chapter10/facenet/preprocess.py | Nitin-Mane/Python-Deep-Learning-Projects | 188 | 3231888 | <gh_stars>100-1000
import argparse
import glob
import logging
import multiprocessing as mp
import os
import time
import cv2
from facenet.align_dlib import AlignDlib
logger = logging.getLogger(__name__)
align_dlib = AlignDlib(os.path.join(os.path.dirname(__file__), 'shape_predictor_68_face_landmarks.dat'))
def mai... | 0 | 0 | 0 | 0 | 0 | 0 |
mlcomp/utils/req.py | sUeharaE4/mlcomp | 166 | 3231946 | <reponame>sUeharaE4/mlcomp
from typing import List
import os
import ast
from glob import glob
import pathspec
import pkg_resources
from mlcomp.db.core import Session
from mlcomp.utils.logging import create_logger
from mlcomp.utils.io import read_lines
_mapping = {
'cv2': 'opencv-python',
'sklearn': 'scikit-le... | 0 | 0 | 0 | 0 | 0 | 0 |
physics_planning_games/mujoban/boxoban.py | mitchchristow/deepmind-research | 10,110 | 3231971 | # Copyright 2020 DeepMind Technologies Limited.
#
# 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... | 4 | 1 | 0 | 1 | 6 | 0 |
MLPYthonEnv/ml-agents-release_17/ml-agents-envs/mlagents_envs/tests/test_registry.py | cihan-demir/NineMensMorris | 13,653 | 3231974 | <gh_stars>1000+
import shutil
import os
from mlagents_envs.registry import default_registry, UnityEnvRegistry
from mlagents_envs.registry.remote_registry_entry import RemoteRegistryEntry
from mlagents_envs.registry.binary_utils import get_tmp_dir
BASIC_ID = "Basic"
def delete_binaries():
tmp_dir, bin_dir = get_... | 0 | 0 | 0 | 0 | 0 | 0 |
lib/galaxy/model/migrate/versions/0120_dataset_collections.py | rikeshi/galaxy | 1,085 | 3231980 | """
Migration script for tables related to dataset collections.
"""
import datetime
import logging
from sqlalchemy import (
Boolean,
Column,
DateTime,
ForeignKey,
Integer,
MetaData,
Table,
TEXT,
Unicode
)
from galaxy.model.custom_types import TrimmedString
from galaxy.model.migrat... | 0 | 0 | 0 | 0 | 0 | 0 |
test/test_expression_normalization.py | cloudinary/pycloudinary | 199 | 3232002 | <reponame>cloudinary/pycloudinary<gh_stars>100-1000
import contextlib
import unittest
from cloudinary.utils import normalize_expression, generate_transformation_string
NORMALIZATION_EXAMPLES = {
'None is not affected': [None, None],
'number replaced with a string value': [10, '10'],
'empty string is not a... | 0 | 0 | 0 | 0 | 0 | 0 |
tools/perf/fetch_benchmark_deps_unittest.py | google-ar/chromium | 777 | 3232004 | <filename>tools/perf/fetch_benchmark_deps_unittest.py
# Copyright 2015 The Chromium Authors. All rights reserved.
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
import os
import sys
import unittest
import StringIO
import mock # pylint: disable=import-error
from... | 0 | 0 | 0 | 0 | 0 | 0 |
pybaseball/team_fielding.py | reddigari/pybaseball | 650 | 3232007 | <filename>pybaseball/team_fielding.py
import warnings
import pandas as pd
import requests
from bs4 import BeautifulSoup, Comment
from . import cache
from .datahelpers import postprocessing
from .datasources.fangraphs import fg_team_fielding_data
# This is just a pass through for the new, more configurable function
t... | 0 | 0 | 0 | 0 | 0 | 0 |
11-pythonic-obj/mem_test.py | SeirousLee/example-code-2e | 990 | 3232021 | import importlib
import sys
import resource
NUM_VECTORS = 10**7
module = None
if len(sys.argv) == 2:
module_name = sys.argv[1].replace('.py', '')
module = importlib.import_module(module_name)
else:
print(f'Usage: {sys.argv[0]} <vector-module-to-test>')
if module is None:
print('Running test with buil... | 0 | 0 | 0 | 0 | 0 | 0 |
pupper/ServoCalibration.py | 13221325403/StanfordQuadruped | 1,125 | 3232023 | <filename>pupper/ServoCalibration.py
# WARNING: This file is machine generated. Edit at your own risk.
import numpy as np
MICROS_PER_RAD = 11.333 * 180.0 / np.pi
NEUTRAL_ANGLE_DEGREES = np.array(
[[ 0., 0., 0., 0.],
[ 45., 45., 45., 45.],
[-45.,-45.,-45.,-45.]]
)
| 0 | 0 | 0 | 0 | 0 | 0 |
datasets/Part 6 - Reinforcement Learning/Section 32 - Upper Confidence Bound (UCB)/random_selection.py | abnercasallo/machinelearning-az | 234 | 3232025 | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Created on Sun Apr 7 12:21:01 2019
@author: juangabriel
"""
# Selección Aleatoria
# Importar las librarias
import numpy as np
import matplotlib.pyplot as plt
import pandas as pd
# Importar el dataset
dataset = pd.read_csv('Ads_CTR_Optimisation.csv')
# Implementra... | 0 | 0 | 0 | 0 | 0 | 0 |
scripts/create_study.py | pplonski/automlbenchmark | 282 | 3232076 | <gh_stars>100-1000
import sys
sys.path.append("D:\\repositories/openml-python")
import openml
import yaml
benchmarks_to_include = [
'resources/benchmarks/medium-8c4h.yaml',
'resources/benchmarks/small-8c4h.yaml',
'resources/benchmarks/large-8c4h.yaml'
]
if __name__ == '__main__':
benchmarks = []
... | 0 | 0 | 0 | 0 | 0 | 0 |
catalyst/engines/torch.py | futurewarning/catalyst | 2,693 | 3232120 | from typing import Any, Callable, Dict, List, Mapping, Optional, Tuple, Union
import copy
import os
import numpy as np
import torch
import torch.distributed as dist
import torch.nn as nn
from torch.nn.parallel import DistributedDataParallel
from catalyst.core.engine import IEngine
from catalyst.typing import (
D... | 0 | 0 | 0 | 0 | 0 | 1 |
android/android_instrumentation_test_addons.bzl | artem-zinnatullin/rules_android | 140 | 3232137 | # Copyright 2019 The Bazel 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 la... | 0 | 5 | 0 | 0 | 5 | 0 |
djangox/lib/python3.8/site-packages/allauth/socialaccount/providers/shopify/provider.py | DemarcusL/django_wiki_lab | 6,342 | 3232142 | <reponame>DemarcusL/django_wiki_lab
from django.conf import settings
from allauth.socialaccount.providers.base import ProviderAccount
from allauth.socialaccount.providers.oauth2.provider import OAuth2Provider
class ShopifyAccount(ProviderAccount):
pass
class ShopifyProvider(OAuth2Provider):
id = "shopify"
... | 0 | 0 | 0 | 0 | 0 | 0 |
zat/utils/file_storage.py | SuperCowPowers/zat | 146 | 3232172 | from __future__ import annotations
"""FileStorage class for storing/retrieving bytes to/from persistant storage
Methods:
- store(key, bytes): Takes a bytes object as input
- get(key): Returns a bytes object
"""
import os
try:
import pyarrow # noqa F401
_HAVE_PYARROW = True
except Import... | 0 | 7 | 0 | 1 | 8 | 0 |
tst/regression/scripts/tests/hydro/sod_shock.py | kahoooo/athena-public | 174 | 3232176 | # Regression test based on Newtonian hydro Sod shock tube problem
#
# Runs the Sod shock tube in x1, x2, and x3 directions successively, and checks errors
# against the analytic solution (which are computed by the executable automatically and
# stored in the temporary file shock_errors.dat)
# Modules
import logging
im... | 0 | 2 | 0 | 0 | 2 | 0 |
lldb/examples/python/scripted_process/my_scripted_process.py | LaudateCorpus1/llvm-project-staging | 2,338 | 3232184 | import os
import lldb
from lldb.plugins.scripted_process import ScriptedProcess
class MyScriptedProcess(ScriptedProcess):
def __init__(self, target: lldb.SBTarget, args : lldb.SBStructuredData):
super().__init__(target, args)
def get_memory_region_containing_address(self, addr: int) -> lldb.SBMemoryR... | 7 | 8 | 0 | 0 | 15 | 0 |
vibora/schemas/schemas.py | mnxzyw/vibora | 6,238 | 3232194 | <filename>vibora/schemas/schemas.py
from .messages import EnglishLanguage
from ..request import Request
class Schema:
_fields = []
def __init__(self, silent: bool=False):
"""
:param silent:
"""
pass
@classmethod
async def load(cls, values: dict, language: dict=Engli... | 0 | 0 | 0 | 0 | 0 | 0 |
minemeld/traced/__init__.py | zul126/minemeld-core | 147 | 3232196 | from minemeld.traced.queryprocessor import QUERY_QUEUE # noqa
| 0 | 0 | 0 | 0 | 0 | 0 |
tests/test_config.py | cnicodeme/sanic | 4,959 | 3232207 | from contextlib import contextmanager
from os import environ
from pathlib import Path
from tempfile import TemporaryDirectory
from textwrap import dedent
import pytest
from sanic import Sanic
from sanic.config import DEFAULT_CONFIG, Config
from sanic.exceptions import PyFileError
@contextmanager
def temp_path():
... | 0 | 2 | 2 | 0 | 4 | 0 |
flocker/provision/test/test_gce.py | stackriot/flocker | 2,690 | 3232254 | # Copyright ClusterHQ Inc. See LICENSE file for details.
"""
Tests for GCE provisioner.
"""
from zope.interface.verify import verifyClass
from ...testtools import TestCase
from .._common import IProvisioner
from .._gce import GCEProvisioner
class GCEProvisionerTests(TestCase):
"""
Tests for :class:`GCEPro... | 0 | 0 | 0 | 0 | 0 | 0 |
cisco-ios-xr/ydk/models/cisco_ios_xr/Cisco_IOS_XR_ip_rip_oper.py | CiscoDevNet/ydk-py | 177 | 3232271 | <filename>cisco-ios-xr/ydk/models/cisco_ios_xr/Cisco_IOS_XR_ip_rip_oper.py
""" Cisco_IOS_XR_ip_rip_oper
This module contains a collection of YANG definitions
for Cisco IOS\-XR ip\-rip package operational data.
This module contains definitions
for the following management objects\:
rip\: RIP operational data
Copyr... | 0 | 0 | 0 | 0 | 0 | 0 |
python/ql/test/library-tests/scopes/test.py | vadi2/codeql | 4,036 | 3232274 |
global0 = 0
global1 = 1
def func0(param0, param1) -> object:
return param0 + param1
def func1():
global global0, global_local
local0 = 0
local1 = 1
global_local
global0 = local0 + local1 + global1
def func2():
func1()
global0
#ODASA-5486
class modinit:
_time: int = 0
del modin... | 0 | 1 | 1 | 0 | 2 | 0 |
quarkchain/cluster/tests/test_cluster_config.py | QuarkChain/pyquarkchain | 237 | 3232279 | import argparse
import os
import unittest
from quarkchain.cluster.cluster_config import ClusterConfig
class TestClusterConfig(unittest.TestCase):
def test_cluster_dict_with_loadtest(self):
"""convert to dict and back to check if the content changed, requires `__eq__`
removing --loadtest will make... | 0 | 0 | 0 | 0 | 0 | 0 |
pwndbg/commands/argv.py | dev2ero/pwndbg | 4,461 | 3232289 | from __future__ import annotations
import argparse
import gdb
import pwndbg.arch
import pwndbg.argv
import pwndbg.commands
import pwndbg.typeinfo
@pwndbg.commands.ArgparsedCommand("Prints out the number of arguments.")
@pwndbg.commands.OnlyWhenRunning
def argc():
print(pwndbg.argv.argc)
parser = argparse.Argu... | 5 | 5 | 0 | 0 | 10 | 0 |
src/riotwatcher/_apis/team_fight_tactics/urls/MatchApiUrls.py | TheBoringBakery/Riot-Watcher | 489 | 3232293 | from .TftEndpoint import TftEndpoint
class MatchEndpoint(TftEndpoint):
def __init__(self, url: str, **kwargs):
nurl = "/match/v1/matches" + url
super().__init__(nurl, **kwargs)
class MatchApiUrls:
by_puuid = MatchEndpoint("/by-puuid/{puuid}/ids", count=int)
by_id = MatchEndpoint("/{match... | 1 | 0 | 0 | 0 | 1 | 0 |
downstream/asr/model.py | OlegJakushkin/s3prl | 856 | 3232294 | import torch
import torch.nn as nn
from torch.nn.utils.rnn import pack_padded_sequence, pad_packed_sequence
def downsample(x, x_len, sample_rate, sample_style) -> tuple[object, object]:
batch_size, timestep, feature_dim = x.shape
x_len = x_len // sample_rate
if sample_style == 'drop':
# Drop the ... | 2 | 4 | 0 | 0 | 6 | 0 |
docs/source/conf.py | cerebis/pygraphistry | 1,595 | 3232298 | <gh_stars>1000+
# Configuration file for the Sphinx documentation builder.
#
# This file only contains a selection of the most common options. For a full
# list see the documentation:
# https://www.sphinx-doc.org/en/master/usage/configuration.html
# -- Path setup -------------------------------------------------------... | 0 | 0 | 0 | 0 | 0 | 0 |
np_ml/pca/__init__.py | wwwy-binary/NP_ML | 237 | 3232318 | from .pca import * | 0 | 0 | 0 | 0 | 0 | 0 |
test/hlt/pytest/python/com/huawei/iotplatform/client/dto/OperateDevices.py | yuanyi-thu/AIOT- | 128 | 3232324 | class OperateDevices(object):
def __init__(self):
self.deviceGroups: None = None
self.deviceType: None = None
self.model: None = None
self.manufacturerName: None = None
self.devices: None = None
def getDeviceGroups(self) -> object:
return self.deviceGroups
... | 0 | 5 | 0 | 5 | 10 | 0 |
fum/migrations/0006_auto_20151210_1152.py | jsavikko/futurice-ldap-user-manager | 111 | 3232327 | # -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import models, migrations
class Migration(migrations.Migration):
dependencies: list[tuple[str, str]] = [
('fum', '0005_users_flowdock_uid'),
]
operations: list[object] = [
migrations.AddField(
mod... | 0 | 0 | 2 | 0 | 2 | 0 |
ptsites/sites/hd4fans.py | kbnq/flexget_qbittorrent_mod | 202 | 3232328 | from ..schema.nexusphp import NexusPHP
from ..schema.site_base import SignState, NetworkState, Work
from ..utils.net_utils import NetUtils
class MainClass(NexusPHP):
URL: str = 'https://pt.hd4fans.org/'
USER_CLASSES: dict[str,list[float] | list[int]] = {
'downloaded': [805306368000, 3298534883328],
... | 0 | 2 | 3 | 0 | 5 | 0 |
everyday_wechat/control/moviebox/__init__.py | filon7/EverydayWechat | 9,940 | 3232356 | # -*- coding: utf-8 -*-
"""
Project: EverydayWechat-Github
Creator: DoubleThunder
Create time: 2019-08-30 12:21
Introduction:
"""
| 0 | 0 | 0 | 0 | 0 | 0 |
FundamentalAnalysis/ratios-pandas/main.py | whitmans-max/python-examples | 140 | 3232360 | <reponame>whitmans-max/python-examples
#!/usr/bin/env python3
# date: 2020.01.02
# ???
import FundamentalAnalysis as fa
import pandas as pd
import io
text='''Ticker Company
A Agilent Technologies Inc.
AA ALCOA CORPORATION
AAC AAC Holdings Inc
AAL AMERICAN AIRLINES GRO... | 0 | 0 | 0 | 0 | 0 | 0 |
Lib/idlelib/Delegator.py | inging44/python3 | 6,989 | 3232372 | from __future__ import annotations
class Delegator:
# The cache is only used to be able to change delegates!
def __init__(self, delegate: object | None=None):
self.delegate = delegate
self.__cache: set[object] = set()
def __getattr__(self, name) -> object:
attr = getattr(self.dele... | 1 | 1 | 0 | 1 | 3 | 0 |
examples/work_requests.py | Manny27nyc/oci-python-sdk | 249 | 3232379 | # coding: utf-8
# Copyright (c) 2016, 2021, Oracle and/or its affiliates. All rights reserved.
# This software is dual-licensed to you under the Universal Permissive License (UPL) 1.0 as shown at https://oss.oracle.com/licenses/upl or Apache License 2.0 as shown at http://www.apache.org/licenses/LICENSE-2.0. You may c... | 0 | 1 | 0 | 0 | 1 | 0 |
checkov/terraform/checks/resource/aws/MSKClusterEncryption.py | jamesholland-uk/checkov | 4,013 | 3232407 | <reponame>jamesholland-uk/checkov
from checkov.common.models.enums import CheckResult, CheckCategories
from checkov.terraform.checks.resource.base_resource_check import BaseResourceCheck
from typing import List
class MSKClusterEncryption(BaseResourceCheck):
def __init__(self):
name = "Ensure MSK Cluster e... | 0 | 0 | 0 | 0 | 0 | 0 |
blog/migrations/0006_guestbook.py | enjoy-binbin/Django-blog | 111 | 3232464 | # Generated by Django 2.1.5 on 2019-05-12 16:41
from django.conf import settings
from django.db import migrations, models
import django.db.models.deletion
import django.utils.timezone
class Migration(migrations.Migration):
dependencies: list[object | tuple[str, str]] = [
migrations.swappable_dependency(... | 0 | 0 | 2 | 0 | 2 | 0 |
persephone/corpus.py | a-tsioh/persephone | 133 | 3232468 | <reponame>a-tsioh/persephone
"""
Describes the abstract Corpus class that all interfaces to corpora should
subclass.
"""
from collections import namedtuple
import logging.config
import os
from pathlib import Path
import pickle
import random
import subprocess
from typing import Any, List, Callable, Optional, Set, Seque... | 0 | 0 | 0 | 0 | 0 | 0 |
test/smart_compose/layers/test_vocab_layer.py | StarWang/detext | 1,229 | 3232479 | <reponame>StarWang/detext
import copy
import shutil
import tensorflow as tf
import tensorflow_hub as hub
from smart_compose.layers import vocab_layer
from smart_compose.utils.layer_utils import get_sorted_dict
from smart_compose.utils.parsing_utils import InternalFtrType
from smart_compose.utils.testing.data_setup im... | 0 | 0 | 0 | 0 | 0 | 0 |
tests/test_exceptions.py | aleixrodri98/betfair | 300 | 3232481 | import pickle
import unittest
from betfairlightweight import exceptions
class ExceptionsTest(unittest.TestCase):
def test_betfair_error(self):
with self.assertRaises(exceptions.BetfairError):
raise exceptions.BetfairError("test")
# pickle
error = exceptions.PasswordError("test... | 0 | 0 | 0 | 0 | 0 | 0 |
vaas-app/src/vaas/router/tests/test_fetcher.py | allegro/vaas | 251 | 3232506 | <gh_stars>100-1000
import requests
import requests_mock
from unittest import TestCase
from vaas.router.models import Route, PositiveUrl
from vaas.router.fetcher import Fetcher, ValidationResponse
class TestFetcher(TestCase):
def test_should_fetch_validation_data_for_url(self):
with requests_mock.Mocker(... | 0 | 0 | 0 | 0 | 0 | 0 |
hubspot/communication_preferences/models/public_update_subscription_status_request.py | Ronfer/hubspot-api-python | 117 | 3232521 | # coding: utf-8
from __future__ import annotations
"""
Subscriptions
Subscriptions allow contacts to control what forms of communications they receive. Contacts can decide whether they want to receive communication pertaining to a specific topic, brand, or an entire HubSpot account. # noqa: E501
The ver... | 5 | 9 | 2 | 5 | 21 | 0 |
3DCNN/LTC/LTC.py | dreamer121121/action-recognition-models-pytorch | 200 | 3232524 | <reponame>dreamer121121/action-recognition-models-pytorch
'''
@project: LTC
@author: <NAME>
'''
import torch.nn as nn
from torch.nn import init
class LTC(nn.Module):
# input size: 100x71x71
def __init__(self, num_class, init_weights=True):
super(LTC, self).__init__()
self.conv1 = nn.Conv3d(3,... | 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.