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 |
|---|---|---|---|---|---|---|---|---|---|---|
test/run/t398.py | timmartin/skulpt | 2,671 | 127888 | <filename>test/run/t398.py
print zip([8, 9, 10], [11, 12, 13])
print zip([1, 2, 3])
print zip()
print zip([])
| 0 | 0 | 0 | 0 | 0 | 0 |
tests/test_project/app_rename_column/migrations/0002_auto_20190414_1502.py | christianbundy/django-migration-linter | 357 | 127950 | # -*- coding: utf-8 -*-
# Generated by Django 1.11.18 on 2019-04-14 15:02
from __future__ import unicode_literals
from django.db import migrations
class Migration(migrations.Migration):
dependencies: list[tuple[str, str]] = [("app_rename_column", "0001_initial")]
operations: list[object] = [
migrat... | 0 | 0 | 2 | 0 | 2 | 0 |
scripts/benchmark/trainer-benchmark.py | bugface/transformers | 8,028 | 127961 | <reponame>bugface/transformers
#!/usr/bin/env python
# HF Trainer benchmarking tool
#
# This tool can be used to run and compare multiple dimensions of the HF Trainers args.
#
# It then prints a report once in github format with all the information that needs to be shared
# with others and second time in a console-fri... | 0 | 0 | 0 | 0 | 0 | 0 |
tests/integration/test_archive_per_month.py | asmeurer/nikola | 1,901 | 128017 | <gh_stars>1000+
"""Check that the monthly archives build and are correct."""
import os
import pytest
from nikola import __main__
from .helper import cd, patch_config
from .test_demo_build import prepare_demo_site
from .test_empty_build import ( # NOQA
test_archive_exists,
test_avoid_double_slash_in_rss,
... | 0 | 0 | 0 | 0 | 0 | 0 |
src/exabgp/configuration/core/location.py | pierky/exabgp | 1,560 | 128037 | <gh_stars>1000+
# encoding: utf-8
"""
location.py
Created by <NAME> on 2014-06-22.
Copyright (c) 2014-2017 Exa Networks. All rights reserved.
License: 3-clause BSD. (See the COPYRIGHT file)
"""
# ===================================================================== Location
# file location
class Location(object):
... | 0 | 0 | 0 | 0 | 0 | 0 |
aiogoogle/utils.py | BebopChrome/aiogoogle | 115 | 128057 | from __future__ import annotations
__all__ = []
import datetime
import re
def _safe_getitem(dct, *keys) -> object | None:
for key in keys:
try:
dct = dct[key]
except (KeyError):
return None
return dct
class _dict(dict): # pragma: no cover
""" A simple dict subcl... | 0 | 4 | 0 | 0 | 4 | 0 |
historian/cli/db.py | bit0fun/plugins | 173 | 128072 | <reponame>bit0fun/plugins
import click
from common import NodeAnnouncement, ChannelAnnouncement, ChannelUpdate
from tqdm import tqdm
from gossipd import parse
from cli.common import db_session, default_db
@click.group()
def db():
pass
@db.command()
@click.argument('source', type=str)
@click.argument('destinatio... | 0 | 0 | 0 | 0 | 0 | 0 |
src/modeling/bert/__init__.py | microsoft/MeshGraphormer | 135 | 128106 | __version__ = "1.0.0"
from .modeling_bert import (BertConfig, BertModel,
load_tf_weights_in_bert, BERT_PRETRAINED_MODEL_ARCHIVE_MAP,
BERT_PRETRAINED_CONFIG_ARCHIVE_MAP)
from .modeling_graphormer import Graphormer
from .e2e_body_network import Graphormer_Body_Network
fro... | 0 | 0 | 0 | 0 | 0 | 0 |
src/lib/pdb.py | DTenore/skulpt | 2,671 | 128113 | <reponame>DTenore/skulpt<filename>src/lib/pdb.py<gh_stars>1000+
import _sk_fail; _sk_fail._("pdb")
| 0 | 0 | 0 | 0 | 0 | 0 |
api/anomaly/migrations/0017_merge_20210810_0524.py | LeiSoft/CueObserve | 149 | 128122 | # Generated by Django 3.2.1 on 2021-08-10 05:24
from django.db import migrations
class Migration(migrations.Migration):
dependencies: list[tuple[str, str]] = [
('anomaly', '0015_merge_20210806_0248'),
('anomaly', '0016_merge_20210806_1138'),
]
operations: list[object] = [
]
| 0 | 0 | 2 | 0 | 2 | 0 |
securityheaders/checkers/csp/test_srchttp.py | th3cyb3rc0p/securityheaders | 151 | 128143 | <reponame>th3cyb3rc0p/securityheaders
import unittest
from securityheaders.checkers.csp import CSPSCRHTTPChecker, CSPReportOnlySCRHTTPChecker
class HTTPTest(unittest.TestCase):
def setUp(self):
self.x = CSPSCRHTTPChecker()
self.y = CSPReportOnlySCRHTTPChecker()
def test_checkNoCSP(self):
... | 0 | 0 | 0 | 0 | 0 | 0 |
tests/basics/async_with_break.py | sebastien-riou/micropython | 13,648 | 128190 | # test async with, escaped by a break
class AContext:
async def __aenter__(self) -> int:
print('enter')
return 1
async def __aexit__(self, exc_type, exc, tb):
print('exit', exc_type, exc)
async def f1():
while 1:
async with AContext():
print('body')
... | 0 | 1 | 0 | 0 | 1 | 0 |
api/tests/opentrons/drivers/test_command_builder.py | anuwrag/opentrons | 235 | 128202 | <filename>api/tests/opentrons/drivers/test_command_builder.py
from typing import Optional
import pytest
from opentrons.drivers.command_builder import CommandBuilder
def test_builder_create_command_with_terminator() -> None:
"""It should create a command with terminator."""
terminator = "terminator"
build... | 0 | 0 | 0 | 0 | 0 | 0 |
training/train_lib.py | vsewall/frame-interpolation | 521 | 128205 | <reponame>vsewall/frame-interpolation
# Copyright 2022 Google LLC
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
# https://www.apache.org/licenses/LICENSE-2.0
# Unless required by appli... | 0 | 0 | 0 | 0 | 0 | 0 |
testing/test_checker.py | MatsLanGoH/xdoctest | 142 | 128282 | from xdoctest import checker
from xdoctest import directive
# from xdoctest import utils
def test_visible_lines():
"""
pytest testing/test_checker.py
"""
got = 'this is invisible\ronly this is visible'
print(got)
want = 'only this is visible'
assert checker.check_output(got, want)
def te... | 0 | 0 | 0 | 0 | 0 | 0 |
2017/EasyCTF/Security Through Obscurity/sage.py | Kage/CTF-Writeups | 191 | 128290 | <gh_stars>100-1000
p = 196732205348849427366498732223276547339
secret = REDACTED
def calc_root(num, mod, n):
f = GF(mod)
temp = f(num)
return temp.nth_root(n)
def gen_v_list(primelist, p, secret):
a = []
for prime in primelist:
a.append(calc_root(prime, p, secret))
return a
def decodeI... | 0 | 0 | 0 | 0 | 0 | 0 |
homeassistant/components/august/diagnostics.py | MrDelik/core | 30,023 | 128369 | <filename>homeassistant/components/august/diagnostics.py
"""Diagnostics support for august."""
from __future__ import annotations
from typing import Any
from homeassistant.components.diagnostics import async_redact_data
from homeassistant.config_entries import ConfigEntry
from homeassistant.core import HomeAssistant
... | 0 | 0 | 0 | 0 | 0 | 0 |
vispy/scene/cameras/tests/test_link.py | hmaarrfk/vispy | 2,617 | 128371 | # -*- coding: utf-8 -*-
# -----------------------------------------------------------------------------
# Copyright (c) Vispy Development Team. All Rights Reserved.
# Distributed under the (new) BSD License. See LICENSE.txt for more info.
# -----------------------------------------------------------------------------
f... | 0 | 0 | 0 | 0 | 0 | 0 |
discovery-provider/src/queries/get_route_metrics_test.py | ppak10/audius-protocol | 429 | 128383 | <reponame>ppak10/audius-protocol
def test():
"""See /tests/test_get_route_metrics.py"""
| 0 | 0 | 0 | 0 | 0 | 0 |
codigo_das_aulas/aula_05/aula_05_03.py | VeirichR/curso-python-selenium | 234 | 128395 | from selenium.webdriver import Firefox
url = 'http://selenium.dunossauro.live/aula_05_c.html'
firefox = Firefox()
firefox.get(url)
def melhor_filme(browser, filme, email, telefone):
"""Preenche o formulário do melhor filme de 2020."""
browser.find_element_by_name('filme').send_keys(filme)
browser.find... | 0 | 0 | 0 | 0 | 0 | 0 |
src/aptsources_cleanup/util/version/__main__.py | butayama/aptsources-cleanup | 461 | 128475 | <gh_stars>100-1000
# -*- coding: utf-8
"""Genreate the content of a ._data module for use witht this package"""
import sys, locale
from . import version_info
locale.setlocale(locale.LC_ALL, '')
if len(sys.argv) > 1:
version = sys.argv[1]
else:
version = input()
output = sys.stdout
if not output.encoding:
import ... | 0 | 0 | 0 | 0 | 0 | 0 |
src/zuthaka/backendapi/services/ClassHandlers/Covenant/__init__.py | justinforbes/zuthaka | 129 | 128482 | <gh_stars>100-1000
from .covenantc2 import *
| 0 | 0 | 0 | 0 | 0 | 0 |
test/hummingbot/connector/exchange/bitmart/test_bitmart_auth.py | BGTCapital/hummingbot | 3,027 | 128507 | <reponame>BGTCapital/hummingbot<filename>test/hummingbot/connector/exchange/bitmart/test_bitmart_auth.py
import json
import hmac
import hashlib
from unittest import TestCase
from hummingbot.connector.exchange.bitmart.bitmart_auth import BitmartAuth
class BitmartAuthTests(TestCase):
@property
def memo(self):... | 0 | 0 | 0 | 0 | 0 | 0 |
ui/file_manager/file_manager/test/scripts/create_test_main.py | zipated/src | 2,151 | 128508 | #!/usr/bin/env python
# Copyright 2018 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.
"""Copies file_manager/main.html to file_manager/test.html.
Modifies it to be able to run the CrOS FileManager app
as a regular web p... | 0 | 2 | 0 | 0 | 2 | 0 |
egs/voxceleb/v1/nnet/lib/train_mt.py | LCF2764/tf-kaldi-speaker | 154 | 128580 | <reponame>LCF2764/tf-kaldi-speaker
import os
import argparse
import random
import sys
import tensorflow as tf
import numpy as np
from misc.utils import ValidLoss, load_lr, load_valid_loss, save_codes_and_config, compute_cos_pairwise_eer
from dataset.multitask.data_loader_v2 import KaldiDataRandomQueueV2
from dataset.ka... | 0 | 0 | 0 | 0 | 0 | 0 |
tests/class_free.py | ZYAZP/python2 | 1,062 | 128652 | <filename>tests/class_free.py
def f(x):
class c:
print x
f(3)
| 0 | 0 | 0 | 0 | 0 | 0 |
examples/ldap.py | cromulencellc/asn1tools | 198 | 128654 | #!/usr/bin/env python
"""Perform an LDAP bind with an LDAP server.
Example execution:
$ ./ldap.py
Connecting to ldap.forumsys.com:389... done.
{'messageID': 1,
'protocolOp': ('bindRequest',
{'authentication': ('simple', b'password'),
'name': b'uid=tesla,dc=example,dc=com',
... | 0 | 0 | 0 | 0 | 0 | 0 |
finrl_meta/env_execution_optimizing/order_execution_qlib/trade/network/util.py | eitin-infant/FinRL-Meta | 214 | 128659 | <filename>finrl_meta/env_execution_optimizing/order_execution_qlib/trade/network/util.py
import torch
import numpy as np
from torch import nn
import torch.nn.functional as F
from copy import deepcopy
import sys
from tianshou.data import to_torch
class Attention(nn.Module):
def __init__(self, in_dim, out_dim):
... | 0 | 0 | 0 | 0 | 0 | 0 |
utokenize/testdata/basic_multilevel.py | MaxTurchin/pycopy-lib | 126 | 128682 | <gh_stars>100-1000
def foo():
if 1:
if 2:
pass
| 0 | 0 | 0 | 0 | 0 | 0 |
client/test/monit_perf.py | elgalu/labml | 463 | 128691 | import time
import torch
from labml import monit, logger
from labml.logger import Text
N = 10_000
def no_section():
arr = torch.zeros((1000, 1000))
for i in range(N):
for t in range(10):
arr += 1
def section():
arr = torch.zeros((1000, 1000))
for i in range(N):
with ... | 0 | 0 | 0 | 0 | 0 | 0 |
zcls/model/attention_helper.py | ZJCV/PyCls | 110 | 128720 | # -*- coding: utf-8 -*-
"""
@date: 2020/12/30 下午4:44
@file: attention_helper.py
@author: zj
@description:
"""
from zcls.model.layers.global_context_block import GlobalContextBlock2D
from zcls.model.layers.squeeze_and_excitation_block import SqueezeAndExcitationBlock2D
from zcls.model.layers.non_local_embedded_gaussi... | 0 | 1 | 0 | 0 | 1 | 0 |
scale/job/migrations/0045_auto_20180830_1812.py | kaydoh/scale | 121 | 128733 | <gh_stars>100-1000
# -*- coding: utf-8 -*-
# Generated by Django 1.11.15 on 2018-08-30 18:12
from __future__ import unicode_literals
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('job', '0044_jobtypetag_job_type'),
]
operations = [
mig... | 0 | 0 | 0 | 0 | 0 | 0 |
lib/ansiblereview/vars.py | tonyskidmore/ansible-review | 222 | 128742 | import codecs
import yaml
from yaml.composer import Composer
from ansiblereview import Result, Error
def hunt_repeated_yaml_keys(data) -> object:
"""Parses yaml and returns a list of repeated variables and
the line on which they occur
"""
loader = yaml.Loader(data)
def compose_node(parent, ind... | 1 | 4 | 0 | 0 | 5 | 0 |
tests/test_utils.py | wkcn/MobulaOP | 161 | 128747 | from mobula.utils import get_git_hash
def test_get_git_hash():
git_hash = get_git_hash()
assert type(git_hash) == str, (git_hash, type(git_hash))
assert len(git_hash) == 7 or git_hash == 'custom', git_hash
def test_edict():
from mobula.internal.edict import edict
data = edict(a=3, b=4)
asser... | 0 | 0 | 0 | 0 | 0 | 0 |
tests/test_level1/test_class.py | kianmeng/soupsieve | 130 | 128755 | """Test class selectors."""
from .. import util
from soupsieve import SelectorSyntaxError
class TestClass(util.TestCase):
"""Test class selectors."""
MARKUP: str = """
<div>
<p>Some text <span id="1" class="foo"> in a paragraph</span>.
<a id="2" class="bar" href="http://google.com">Link</a>
<... | 0 | 0 | 2 | 0 | 2 | 0 |
jaxlie/hints/__init__.py | brentyi/jaxlie | 128 | 128756 | <reponame>brentyi/jaxlie<filename>jaxlie/hints/__init__.py
from typing import NamedTuple, Union
import numpy as onp
from jax import numpy as jnp
# Type aliases for JAX/Numpy arrays; primarily for function inputs
Array = Union[onp.ndarray, jnp.ndarray]
"""Type alias for `Union[jnp.ndarray, onp.ndarray]`.
"""
Scalar ... | 0 | 0 | 0 | 0 | 0 | 0 |
messaging/services/service-multiple-number-add/service-multiple-number-add.6.x.py | Tshisuaka/api-snippets | 234 | 128760 | <reponame>Tshisuaka/api-snippets
# Download the Python helper library from twilio.com/docs/python/install
import os
from twilio.rest import Client
# Your Account Sid and Auth Token from twilio.com/console
# To set up environmental variables, see http://twil.io/secure
account_sid = os.environ['TWILIO_ACCOUNT_SID']
auth... | 0 | 0 | 0 | 0 | 0 | 0 |
src/finn/transformation/qonnx/quant_act_to_multithreshold.py | mmrahorovic/finn | 109 | 128774 | <filename>src/finn/transformation/qonnx/quant_act_to_multithreshold.py
# Copyright (c) 2021, Xilinx
# All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions are met:
#
# * Redistributions of source code must retain... | 0 | 0 | 0 | 0 | 0 | 0 |
scripts/watch_continuous.py | drozzy/autonomous-learning-library | 584 | 128820 | # pylint: disable=unused-import
import argparse
from all.bodies import TimeFeature
from all.environments import GymEnvironment, PybulletEnvironment
from all.experiments import load_and_watch
from .continuous import ENVS
def main():
parser = argparse.ArgumentParser(description="Watch a continuous agent.")
pars... | 0 | 0 | 0 | 0 | 0 | 0 |
modules/__init__.py | Kandongwe/RunestoneServer | 344 | 128821 | <filename>modules/__init__.py
# **************************
# |docname| - web2py modules
# **************************
# .. toctree::
# :maxdepth: 2
# :glob:
#
# *.py
| 0 | 0 | 0 | 0 | 0 | 0 |
notebooks/exercise_solutions/n01_vector_dot_product.py | pydy/pydy-tutorial-human-standing | 134 | 128829 | from sympy import acos
N = ReferenceFrame('N')
v1 = a * N.x + b * N.y + a * N.z
v2 = b * N.x + a * N.y + b * N.z
acos(v1.dot(v2) / (v1.magnitude() * v2.magnitude()))
| 0 | 0 | 0 | 0 | 0 | 0 |
AndroidSpider/html_downloader.py | lidenghong1/SmallReptileTraining | 133 | 128865 | from __future__ import annotations
from http import cookiejar
from urllib import request, error
from urllib.parse import urlparse
class HtmlDownLoader(object):
def download(self, url, retry_count: int=3, headers: object | None=None, proxy: object | None=None, data: object | None=None) -> object | None:
if... | 4 | 1 | 0 | 0 | 5 | 0 |
run_server.py | vagnervjs/frame-player | 233 | 128866 | <gh_stars>100-1000
# run_server.py
import SimpleHTTPServer
m = SimpleHTTPServer.SimpleHTTPRequestHandler.extensions_map
m[''] = 'text/plain'
m.update(dict([(k, v + ';charset=UTF-8') for k, v in m.items()]))
SimpleHTTPServer.test()
| 0 | 0 | 0 | 0 | 0 | 0 |
corrscope/renderer.py | corrscope/corrscope | 140 | 128871 | <reponame>corrscope/corrscope<gh_stars>100-1000
"""
Backend implementations should not inherit from RendererFrontend,
since they don't need to know.
Implementation: Multiple inheritance:
Renderer inherits from (RendererFrontend, backend implementation).
Backend implementation does not know about RendererFrontend.
"""
... | 0 | 0 | 0 | 0 | 0 | 0 |
homeassistant/components/nzbget/__init__.py | andersop91/core | 22,481 | 128885 | """The NZBGet integration."""
import voluptuous as vol
from homeassistant.config_entries import SOURCE_IMPORT, ConfigEntry
from homeassistant.const import (
CONF_HOST,
CONF_NAME,
CONF_PASSWORD,
CONF_PORT,
CONF_SCAN_INTERVAL,
CONF_SSL,
CONF_USERNAME,
Platform,
)
from homeassistant.core i... | 16 | 10 | 0 | 0 | 26 | 0 |
rlpyt/ul/experiments/rl_from_ul/scripts/atari/train/atari_ppo_from_ul_serial.py | wingbender/rlpyt | 2,122 | 128899 |
import sys
import pprint
import os.path as osp
from rlpyt.utils.launching.affinity import affinity_from_code
from rlpyt.samplers.serial.sampler import SerialSampler
from rlpyt.samplers.parallel.cpu.collectors import CpuResetCollector
from rlpyt.envs.atari.atari_env import AtariTrajInfo
from rlpyt.ul.envs.atari import... | 5 | 0 | 0 | 0 | 5 | 0 |
mmdet/models/bbox_heads/DCM_bbox_head.py | ydiller/BalancedGroupSoftmax | 333 | 128926 | <reponame>ydiller/BalancedGroupSoftmax<filename>mmdet/models/bbox_heads/DCM_bbox_head.py
import torch
import torch.nn as nn
import torch.nn.functional as F
import pickle
from mmdet.core import (delta2bbox, force_fp32,
multiclass_nms)
from .convfc_bbox_head import SharedFCBBoxHead
from ..builder... | 0 | 0 | 0 | 0 | 0 | 0 |
stochastic/processes/continuous/multifractional_brownian_motion.py | zaczw/stochastic | 268 | 128939 | <reponame>zaczw/stochastic
"""Multifractional Brownian motion."""
import inspect
import numpy as np
from scipy.special import gamma
from stochastic.processes.base import BaseTimeProcess
class MultifractionalBrownianMotion(BaseTimeProcess):
r"""Multifractional Brownian motion process.
.. image:: _static/mul... | 0 | 0 | 0 | 0 | 0 | 0 |
fhir/resources/DSTU2/tests/test_immunization.py | cstoltze/fhir.resources | 144 | 128964 | <gh_stars>100-1000
# -*- coding: utf-8 -*-
"""
Profile: http://hl7.org/fhir/StructureDefinition/Immunization
Release: DSTU2
Version: 1.0.2
Revision: 7202
"""
from .. import fhirtypes # noqa: F401
from .. import immunization
def testImmunization1(base_settings):
filename = base_settings["unittest_data_dir"] / "im... | 0 | 0 | 0 | 0 | 0 | 0 |
Testcase4-Application-breakdown/online-compiling/tools/python_sdk/examples/excamera-example/excam_ex.py | hunhoffe/ServerlessBench | 129 | 128983 | #! /usr/bin/python3
from gg_sdk import GG, GGThunk
import sys
import math
VPXENC = 'vpxenc --ivf --codec=vp8 --good --cpu-used=0 --end-usage=cq --min-q=0 --max-q=63 --cq-level={quality} --buf-initial-sz=10000 --buf-optimal-sz=20000 --buf-sz=40000 --undershoot-pct=100 --passes=2 --auto-alt-ref=1 --threads=1 --token-pa... | 0 | 3 | 0 | 0 | 3 | 0 |
pytype/tools/merge_pyi/test_data/scope.py | Jrryy/pytype | 3,882 | 128985 | from __future__ import annotations
class C:
def f(self, x):
pass
def g(self) -> int | object:
def f(x) -> int: #gets ignored by pytype but fixer sees it, generates warning (FIXME?)
return 1
return f
| 0 | 2 | 0 | 0 | 2 | 0 |
tb/eth_mac_mii_fifo/test_eth_mac_mii_fifo.py | fdarling/verilog-ethernet | 395 | 128995 | <gh_stars>100-1000
#!/usr/bin/env python
"""
Copyright (c) 2020 <NAME>
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, copy, m... | 0 | 0 | 0 | 0 | 0 | 0 |
python/GafferArnoldTest/ArnoldRenderTest.py | murraystevenson/gaffer | 561 | 129015 | ##########################################################################
#
# Copyright (c) 2012, <NAME>. All rights reserved.
# 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 f... | 0 | 5 | 0 | 0 | 5 | 0 |
holidays/countries/dominican_republic.py | m-ganko/python-holidays | 654 | 129020 | # -*- coding: utf-8 -*-
# python-holidays
# ---------------
# A fast, efficient Python library for generating country, province and state
# specific sets of holidays on the fly. It aims to make determining whether a
# specific date is a holiday as fast and flexible as possible.
#
# Author: ryanss <<EMAIL>> (c) ... | 1 | 1 | 0 | 1 | 3 | 0 |
python/commonil.py | cblichmann/binaryninja-api | 589 | 129027 | # Copyright (c) 2019-2021 Vector 35 Inc
#
# 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, copy, modify, merge, publish, ... | 3 | 1 | 0 | 0 | 4 | 0 |
rbac/acl.py | eldorplus/simple-rbac | 219 | 129030 | from __future__ import annotations
from __future__ import absolute_import
import itertools
__all__ = ["Registry"]
class Registry(object):
"""The registry of access control list."""
def __init__(self):
self._roles: dict[object,object] = {}
self._resources: dict[object,object] = {}
s... | 5 | 4 | 0 | 6 | 15 | 0 |
src/genie/libs/parser/ios/asr901/tests/ShowInventory/cli/equal/golden_output_expected.py | balmasea/genieparser | 204 | 129076 | <gh_stars>100-1000
expected_output = {
"main": {
"chassis": {
"name": {
"descr": "A901-6CZ-FT-A Chassis",
"name": "A901-6CZ-FT-A Chassis",
"pid": "A901-6CZ-FT-A",
"sn": "CAT2342U1S6",
"vid": "V04 "
}
... | 0 | 0 | 0 | 0 | 0 | 0 |
ch03/library_app/__manifest__.py | dreispt/Odoo-12-Development-Essentials-Fourth-Edition | 121 | 129092 | <gh_stars>100-1000
{'name': 'Library Management Application',
'description': 'Library books, members and book borrowing.',
'author': '<NAME>',
'depends': ['base'],
'data': [
'security/library_security.xml',
'security/ir.model.access.csv',
'views/library_menu.xml',
'views/book_view.xml',
'views/b... | 0 | 0 | 0 | 0 | 0 | 0 |
corehq/motech/openmrs/models.py | akashkj/commcare-hq | 471 | 129143 | <gh_stars>100-1000
import re
from datetime import datetime
from functools import partial
from memoized import memoized
from dimagi.ext.couchdbkit import (
DictProperty,
Document,
DocumentSchema,
IntegerProperty,
ListProperty,
StringProperty,
)
from corehq.motech.const import (
COMMCARE_DA... | 0 | 0 | 0 | 0 | 0 | 0 |
tests/components/volumio/test_config_flow.py | MrDelik/core | 30,023 | 129152 | <reponame>MrDelik/core
"""Test the Volumio config flow."""
from unittest.mock import patch
from homeassistant import config_entries
from homeassistant.components import zeroconf
from homeassistant.components.volumio.config_flow import CannotConnectError
from homeassistant.components.volumio.const import DOMAIN
from t... | 0 | 0 | 0 | 0 | 0 | 0 |
aiogram_dialog/widgets/kbd/button.py | SamWarden/aiogram_dialog | 198 | 129178 | from typing import List, Callable, Optional, Union, Dict, Awaitable, Any
from aiogram.types import InlineKeyboardButton, CallbackQuery
from aiogram_dialog.dialog import Dialog
from aiogram_dialog.manager.manager import DialogManager
from aiogram_dialog.widgets.text import Text
from aiogram_dialog.widgets.widget_event... | 15 | 3 | 0 | 0 | 18 | 0 |
cisco-ios-xe/ydk/models/cisco_ios_xe/Cisco_IOS_XE_platform.py | Maikor/ydk-py | 177 | 129191 | """ Cisco_IOS_XE_platform
Cisco XE Native Platform Yang model.
Copyright (c) 2016, 2018 by Cisco Systems, Inc.
All rights reserved.
"""
from collections import OrderedDict
from ydk.types import Entity, EntityPath, Identity, Enum, YType, YLeaf, YLeafList, YList, LeafDataList, Bits, Empty, Decimal64
from ydk.filters ... | 0 | 0 | 0 | 0 | 0 | 0 |
tests/plugins/precision/test_deepspeed_precision.py | mathemusician/pytorch-lightning | 3,469 | 129202 | <filename>tests/plugins/precision/test_deepspeed_precision.py
# Copyright The PyTorch Lightning team.
#
# 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... | 0 | 0 | 0 | 0 | 0 | 0 |
agents/tools/simulate_test.py | DoxasticFox/batch-ppo | 210 | 129238 | <reponame>DoxasticFox/batch-ppo
# Copyright 2017 The TensorFlow Agents Authors.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless ... | 0 | 0 | 0 | 0 | 0 | 0 |
lstm_code/nicodjimenez/test2.py | drpreetyrai/ChatBotCourse | 5,087 | 129265 | import numpy as np
import sys
from lstm import LstmParam, LstmNetwork
class ToyLossLayer:
"""
Computes square loss with first element of hidden layer array.
"""
@classmethod
def loss(self, pred, label):
return (pred[0] - label) ** 2
@classmethod
def bottom_diff(self, pred, label):... | 0 | 0 | 0 | 0 | 0 | 0 |
recognition/arcface_oneflow/tools/dataset_convert/mx_recordio_2_ofrecord_shuffled_npart.py | Intsigstephon/insightface | 12,377 | 129294 | <reponame>Intsigstephon/insightface<gh_stars>1000+
import os
import sys
import struct
import argparse
import numbers
import random
from mxnet import recordio
import oneflow.core.record.record_pb2 as of_record
def parse_arguement(argv):
parser = argparse.ArgumentParser()
parser.add_argument(
"--data_... | 0 | 0 | 0 | 0 | 0 | 0 |
client/verta/verta/_swagger/_public/modeldb/versioning/model/VersioningS3DatasetDiff.py | CaptEmulation/modeldb | 835 | 129295 | <reponame>CaptEmulation/modeldb<gh_stars>100-1000
# THIS FILE IS AUTO-GENERATED. DO NOT EDIT
from verta._swagger.base_type import BaseType
class VersioningS3DatasetDiff(BaseType):
def __init__(self, path=None):
required = {
"path": False,
}
self.path = path
for k, v in required.items():
... | 0 | 0 | 0 | 0 | 0 | 0 |
elliot/utils/logger_util.py | gategill/elliot | 175 | 129296 | <reponame>gategill/elliot
import atexit
from logging.config import ConvertingList, ConvertingDict, valid_ident
from logging.handlers import QueueHandler, QueueListener
from queue import Queue
def _resolve_handlers(l):
if not isinstance(l, ConvertingList):
return l
# Indexing the list performs the eva... | 0 | 0 | 0 | 0 | 0 | 0 |
src/plotman/_tests/plot_util_test.py | pieterhelsen/plotman | 1,016 | 129342 | <filename>src/plotman/_tests/plot_util_test.py
import os
import pyfakefs
from plotman import plot_util
from plotman.plot_util import GB
def test_human_format() -> None:
assert plot_util.human_format(3442000000, 0) == "3G"
assert plot_util.human_format(3542000, 2) == "3.54M"
assert plot_util.human_format... | 0 | 0 | 0 | 0 | 0 | 0 |
src/kudu/scripts/assign-location.py | attilabukor/kudu | 1,538 | 129346 | #!/usr/bin/env python
#
# 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 | 3 | 0 | 3 | 6 | 0 |
sdk/machinelearning/azure-mgmt-machinelearningservices/azure/mgmt/machinelearningservices/models/_models_py3.py | rsdoherty/azure-sdk-for-python | 2,728 | 129354 | <reponame>rsdoherty/azure-sdk-for-python<filename>sdk/machinelearning/azure-mgmt-machinelearningservices/azure/mgmt/machinelearningservices/models/_models_py3.py
# coding=utf-8
# --------------------------------------------------------------------------
# Copyright (c) Microsoft Corporation. All rights reserved.
# Lice... | 0 | 0 | 0 | 0 | 0 | 0 |
test/test_workdir.py | robertmaynard/hpc-container-maker | 340 | 129369 | <gh_stars>100-1000
# Copyright (c) 2018, NVIDIA CORPORATION. All rights reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unles... | 0 | 0 | 0 | 0 | 0 | 0 |
data/pose/data_loader.py | qrsforever/torchcv | 171 | 129385 | #!/usr/bin/env python
# -*- coding:utf-8 -*-
# Author: <NAME>(<EMAIL>)
# Class for the Pose Data Loader.
from __future__ import annotations
from torch.utils import data
import lib.data.pil_aug_transforms as pil_aug_trans
import lib.data.cv2_aug_transforms as cv2_aug_trans
import lib.data.transforms as trans
from lib... | 1 | 2 | 0 | 0 | 3 | 0 |
moldesign/utils/utils.py | Autodesk/molecular-design-toolkit | 147 | 129401 | from __future__ import annotations
from __future__ import print_function, absolute_import, division
from future.builtins import *
from future import standard_library
standard_library.install_aliases()
import future.utils
from functools import reduce
import fractions
import operator
import os
import re
import sys
impo... | 4 | 16 | 3 | 5 | 28 | 0 |
simple_rl/abstraction/state_abs/sa_helpers.py | david-abel/mdps | 230 | 129418 | <reponame>david-abel/mdps
# Python imports.
from __future__ import print_function
from collections import defaultdict
import sys
import random
import itertools
# Other imports.
from simple_rl.planning.ValueIterationClass import ValueIteration
from simple_rl.mdp import State
from simple_rl.mdp import MDPDistribution
fr... | 0 | 0 | 0 | 0 | 0 | 0 |
crafter/recorder.py | kachayev/crafter | 161 | 129424 | <reponame>kachayev/crafter
import datetime
import json
import pathlib
import imageio
import numpy as np
class Recorder:
def __init__(
self, env, directory, save_stats=True, save_video=True,
save_episode=True, video_size=(512, 512)):
if directory and save_stats:
env = StatsRecorder(env, direc... | 0 | 0 | 0 | 0 | 0 | 0 |
flare/dft_interface/qe_util.py | aaronchen0316/flare | 144 | 129437 | from __future__ import annotations
"""
This module is used to call Quantum Espresso simulation and parse its output
The user need to supply a complete input script with single-point scf
calculation, CELL_PARAMETERS, ATOMIC_POSITIONS, nat, ATOMIC_SPECIES
arguments. It is case sensitive. and the nat line should be the f... | 9 | 8 | 0 | 0 | 17 | 0 |
ch03/ch03-05-reduction.py | makinzm/kagglebook | 470 | 129441 | <gh_stars>100-1000
# ---------------------------------
# データ等の準備
# ----------------------------------
import numpy as np
import pandas as pd
# train_xは学習データ、train_yは目的変数、test_xはテストデータ
# pandasのDataFrame, Seriesで保持します。(numpyのarrayで保持することもあります)
train = pd.read_csv('../input/sample-data/train_preprocessed_onehot.csv')
t... | 0 | 0 | 0 | 0 | 0 | 0 |
macadam/sl/s04_dgcnn.py | yongzhuo/Macadam | 290 | 129455 | # !/usr/bin/python
# -*- coding: utf-8 -*-
# @time : 2020/5/12 22:46
# @author : Mo
# @function: DGCNN(Dilate Gated Convolutional Neural Network, 即"膨胀门卷积神经网络", IDCNN + CRF)
# @url : Multi-Scale Context Aggregation by Dilated Convolutions(https://arxiv.org/abs/1511.07122)
from bert4keras.layers import Conditio... | 0 | 0 | 0 | 0 | 0 | 0 |
plynx/base/resource.py | khaxis/plynx | 137 | 129463 | from __future__ import annotations
"""Templates for PLynx Resources and utils."""
from collections import namedtuple
from typing import Dict
from plynx.constants import NodeResources
PreviewObject = namedtuple('PreviewObject', ['fp', 'resource_id'])
def _force_decode(byte_array) -> object | str:
try:
re... | 6 | 5 | 1 | 0 | 12 | 0 |
yaql/standard_library/common.py | nzlosh/yaql | 112 | 129467 | <reponame>nzlosh/yaql
# Copyright (c) 2015 Mirantis, 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 requ... | 0 | 0 | 0 | 0 | 0 | 0 |
vul/32-ActiveMQ-unauthorized-access.py | zx273983653/vulscan | 582 | 129476 | #!/usr/bin/env python
# -*- coding: utf-8 -*-
"""
Copyright (c) 2014-2015 pocsuite developers (http://seebug.org)
See the file 'docs/COPYING' for copying permission
"""
#命令行
from pocsuite import pocsuite_cli
#验证模块
from pocsuite import pocsuite_verify
#攻击模块
from pocsuite import pocsuite_attack
#控制台模式
from pocsuite impo... | 0 | 0 | 0 | 0 | 0 | 0 |
app/master/subjob.py | rsennewald/ClusterRunner | 164 | 129502 | import os
from typing import List
from app.common.build_artifact import BuildArtifact
from app.master.atom import AtomState
from app.util.conf.configuration import Configuration
from app.util.log import get_logger
from app.util.pagination import get_paginated_indices
class Subjob(object):
def __init__(self, buil... | 2 | 8 | 0 | 2 | 12 | 0 |
data/databases/create_dataset_from_mongodb_collection.py | james94/driverlessai-recipes | 194 | 129527 | from __future__ import annotations
"""Create dataset from MonogDB"""
# Author: <NAME>
# Created: 31/01/2020
# Last Updated: 20/02/2020
import datatable as dt
import pandas as pd
from h2oaicore.data import CustomData
_global_modules_needed_by_name = ["pymongo", "dnspython"]
# Please fill before usage
# Note that thi... | 1 | 1 | 1 | 0 | 3 | 0 |
lemminflect/codecs/InflectionLUCodec.py | danielplatt/LemmInflect | 157 | 129534 | <filename>lemminflect/codecs/InflectionLUCodec.py
import gzip
from ..slexicon.SKey import *
# Helper class for reading/writing lookup csv file
class InflectionLUCodec(object):
# SPECIALIST LEXICON keys, used for writing
# This represents the order of the forms written to lu.csv is SLexicon key terms
sle... | 0 | 0 | 0 | 0 | 0 | 0 |
venv/Lib/site-packages/matplotlib/tests/test_mlab.py | AdarshSai/Final_project | 353 | 129542 | from numpy.testing import (assert_allclose, assert_almost_equal,
assert_array_equal, assert_array_almost_equal_nulp)
import numpy as np
import pytest
import matplotlib.mlab as mlab
from matplotlib.cbook.deprecation import MatplotlibDeprecationWarning
def _stride_repeat(*args, **kw... | 2 | 12 | 0 | 0 | 14 | 0 |
napari/_qt/qt_resources/_svg.py | MaksHess/napari | 1,345 | 129552 | """
A Class for generating QIcons from SVGs with arbitrary colors at runtime.
"""
from functools import lru_cache
from typing import Optional, Union
from qtpy.QtCore import QByteArray, QPoint, QRect, QRectF, Qt
from qtpy.QtGui import QIcon, QIconEngine, QImage, QPainter, QPixmap
from qtpy.QtSvg import QSvgRenderer
c... | 10 | 6 | 0 | 0 | 16 | 0 |
tests/test_sd.py | pinetr2e/napkin | 190 | 129573 | import pytest
from napkin import sd
from napkin import sd_action
class TestParams:
def test_empty(self):
assert "" == str(sd.Params(tuple(), dict()))
def test_args(self):
assert "abc, def" == str(sd.Params(('abc', 'def'), dict()))
def test_args_kargs(self):
assert "abc, foo=1" =... | 0 | 0 | 0 | 0 | 0 | 0 |
goldsberry/sportvu/__init__.py | motraor3/py-Goldsberry | 268 | 129582 | <reponame>motraor3/py-Goldsberry<filename>goldsberry/sportvu/__init__.py
from goldsberry.sportvu._SportVu2 import * | 0 | 0 | 0 | 0 | 0 | 0 |
samples/server/petstore/python-blueplanet/app/openapi_server/models/pet.py | MalcolmScoffable/openapi-generator | 11,868 | 129611 | <gh_stars>1000+
# coding: utf-8
from __future__ import absolute_import
from datetime import date, datetime # noqa: F401
from typing import List, Dict # noqa: F401
from app.openapi_server.models.base_model_ import Model
from app.openapi_server.models.category import Category # noqa: F401,E501
from app.openapi_serv... | 0 | 0 | 0 | 0 | 0 | 0 |
floss/results.py | mr-tz/flare-floss | 2,067 | 129622 | import datetime
from enum import Enum
from typing import Dict, List
from dataclasses import field
# we use pydantic for dataclasses so that we can
# easily load and validate JSON reports.
#
# pydantic checks all the JSON fields look as they should
# while using the nice and familiar dataclass syntax.
#
# really, you s... | 0 | 1 | 32 | 0 | 33 | 0 |
tests.py | alexmojaki/sorcery | 322 | 129623 | from __future__ import annotations
import ast
import sqlite3
import sys
import traceback
import unittest
from io import StringIO
from time import sleep
from unittest import mock
from littleutils import SimpleNamespace, only
import sorcery as spells
from sorcery import unpack_keys, unpack_attrs, print_args, magic_kwar... | 2 | 11 | 0 | 0 | 13 | 0 |
packages/adminrouter/extra/src/test-harness/modules/generic_test_code/common.py | makkes/dcos | 2,577 | 129638 | <filename>packages/adminrouter/extra/src/test-harness/modules/generic_test_code/common.py
# Copyright (C) Mesosphere, Inc. See LICENSE file for details.
import copy
import logging
import os
from contextlib import contextmanager
from http import cookies
from urllib.parse import urljoin
import requests
from mocker.end... | 0 | 0 | 0 | 0 | 0 | 0 |
venv/Lib/site-packages/statsmodels/stats/tests/test_statstools.py | EkremBayar/bayar | 6,931 | 129645 | <gh_stars>1000+
# TODO: Test robust skewness
# TODO: Test robust kurtosis
import numpy as np
import pandas as pd
from numpy.testing import (assert_almost_equal, assert_raises, assert_equal,
assert_allclose)
from statsmodels.stats._adnorm import normal_ad
from statsmodels.stats.stattools impo... | 0 | 0 | 0 | 0 | 0 | 0 |
notebooks/_solutions/pandas_06_groupby_operations30.py | rprops/Python_DS-WS | 183 | 129657 | hamlets = titles[titles['title'].str.contains('Hamlet')]
hamlets['title'].value_counts() | 0 | 0 | 0 | 0 | 0 | 0 |
mmdet/models/anchor_heads/rpn_head.py | TJUsym/TJU_Advanced_CV_Homework | 1,158 | 129659 | <reponame>TJUsym/TJU_Advanced_CV_Homework
import torch
import torch.nn as nn
import torch.nn.functional as F
from mmcv.cnn import normal_init
from mmdet.core import delta2bbox
from mmdet.ops import nms
from .anchor_head import AnchorHead
from ..registry import HEADS
@HEADS.register_module
class RPNHead(AnchorHead):
... | 0 | 0 | 0 | 0 | 0 | 0 |
desktop/core/ext-py/nose-1.3.7/functional_tests/doc_tests/test_issue119/test_zeronine.py | kokosing/hue | 5,079 | 129691 | import os
import unittest
from nose.plugins import Plugin
from nose.plugins.plugintest import PluginTester
from nose.plugins.manager import ZeroNinePlugin
here = os.path.abspath(os.path.dirname(__file__))
support = os.path.join(os.path.dirname(os.path.dirname(here)), 'support')
class EmptyPlugin(Plugin):
pass
... | 0 | 0 | 0 | 0 | 0 | 0 |
code/resnet.py | noammy/videowalk | 227 | 129706 | <filename>code/resnet.py
import torch
import torch.nn as nn
try:
from torch.hub import load_state_dict_from_url
except ImportError:
from torch.utils.model_zoo import load_url as load_state_dict_from_url
import torchvision.models.resnet as torch_resnet
from torchvision.models.resnet import BasicBlock, Bottlenec... | 0 | 0 | 0 | 0 | 0 | 0 |
pyaf/TS/Keras_Models.py | shaido987/pyaf | 377 | 129713 | <reponame>shaido987/pyaf
import numpy as np
import pandas as pd
# from sklearn.preprocessing import StandardScaler, MinMaxScaler
from . import SignalDecomposition_AR as tsar
import sys
class cAbstract_RNN_Model(tsar.cAbstractAR):
def __init__(self , cycle_residue_name, P , iExogenousInfo = None):
super()._... | 0 | 0 | 0 | 0 | 0 | 0 |
background_task/settings.py | radomirvrana/django-background-tasks | 586 | 129719 | <reponame>radomirvrana/django-background-tasks
# -*- coding: utf-8 -*-
import multiprocessing
from django.conf import settings
try:
cpu_count = multiprocessing.cpu_count()
except Exception:
cpu_count = 1
class AppSettings(object):
"""
"""
@property
def MAX_ATTEMPTS(self):
"""Control ... | 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.