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 |
|---|---|---|---|---|---|---|---|---|---|---|
src/converters/modules/converters/remove_initializer_from_input.py | u0251077/InsightFace-REST | 236 | 3255436 | import onnx
import argparse
def remove_initializer_from_input(input, output) -> None:
model = onnx.load(input)
if model.ir_version < 4:
print(
'Model with ir_version below 4 requires to include initilizer in graph input'
)
return
inputs = model.graph.input
name_to_... | 0 | 1 | 0 | 0 | 1 | 0 |
src/util/redis-fill-data.py | hostbaby/RedisLive | 1,523 | 3255450 | <filename>src/util/redis-fill-data.py
#! /usr/bin/env python
import redis
from time import strftime
import time
import random
def monitor():
redisHost = "127.0.0.1"
redisPort = 6379
redisClient = redis.StrictRedis(host=redisHost, port=redisPort, db=0)
while True:
x = random.randint(1, 100)
y = random.rand... | 0 | 0 | 0 | 0 | 0 | 0 |
src/packagedcode/pypi.py | Siddhant-K-code/scancode-toolkit | 1,511 | 3255458 |
#
# Copyright (c) nexB Inc. and others. All rights reserved.
# ScanCode is a trademark of nexB Inc.
# SPDX-License-Identifier: Apache-2.0
# See http://www.apache.org/licenses/LICENSE-2.0 for the license text.
# See https://github.com/nexB/scancode-toolkit for support or download.
# See https://aboutcode.org for more i... | 0 | 0 | 0 | 0 | 0 | 1 |
src/commonsense_utils/proto_commonsense.py | DbrRoxane/CommonSenseMultiHopQA | 127 | 3255505 | class GraphVertex(object):
'''
commonsense graph vertex object
'''
def __init__(self, subj, obj, parent, level):
raise NotImplementedError()
def add_child(self, c):
raise NotImplementedError()
def add_relation(self, r):
raise NotImplementedError()
def add_score(se... | 0 | 0 | 0 | 0 | 0 | 0 |
api/anomaly/tasks.py | LeiSoft/CueObserve | 149 | 3255507 | <reponame>LeiSoft/CueObserve
from celery import shared_task
| 0 | 0 | 0 | 0 | 0 | 0 |
tools/convert_huggingface_bert_tf_to_npz.py | xcnick/TurboTransformers | 1,147 | 3255529 | # Copyright (C) 2020 THL A29 Limited, a Tencent company.
# All rights reserved.
# Licensed under the BSD 3-Clause License (the "License"); you may
# not use this file except in compliance with the License. You may
# obtain a copy of the License at
# https://opensource.org/licenses/BSD-3-Clause
# Unless required by appl... | 0 | 2 | 0 | 0 | 2 | 0 |
strings/string_search/longest_common_subsequence/python/longest_common_subsequence.py | CarbonDDR/al-go-rithms | 1,253 | 3255551 | <reponame>CarbonDDR/al-go-rithms
def calculate_lcs_length(a,b):
a_len = len(a)
b_len = len(b)
dp = [[0] * (1 + len(b)) for i in range(1 + len(a))]
for i in range(1, a_len + 1):
for j in range(1, b_len + 1):
if a[i - 1] == b[j - 1]:
dp[i][j] = dp[i - 1][j - 1] + 1
... | 0 | 0 | 0 | 0 | 0 | 0 |
mock_tutorial/my_user.py | willismax/python-notes | 106 | 3255552 | from __future__ import annotations
import requests
import datetime
def get_users() -> object | None:
r = requests.get('http://demo/api/users')
print(r.status_code)
if r.status_code == 200:
return r.json()
return None
def get_today() -> object:
return datetime.datetime.today()
| 0 | 2 | 0 | 0 | 2 | 0 |
scripts/automation/trex_control_plane/interactive/trex/wireless/unit_tests/trex_wireless_traffic_handler_rpc_test.py | timgates42/trex-core | 956 | 3255593 | import sys
import unittest
from inspect import signature
# from trex_stl_lib.api import *
from wireless.trex_wireless_rpc_message import *
from wireless.trex_wireless_traffic_handler_rpc import *
from wireless.trex_wireless_traffic_handler import *
class TrafficHandlerCallTest(unittest.TestCase):
"""Tests method... | 0 | 0 | 0 | 0 | 0 | 0 |
common/evaluators/trecqa_evaluator.py | karkaroff/castor | 132 | 3255594 | <reponame>karkaroff/castor
from .qa_evaluator import QAEvaluator
class TRECQAEvaluator(QAEvaluator):
pass
| 0 | 0 | 0 | 0 | 0 | 0 |
muffin/pytest.py | klen/muffin | 704 | 3255608 | """Support testing with Pytest."""
import pytest
import os
import logging
from asgi_tools.tests import manage_lifespan
from . import TestClient
def pytest_addoption(parser):
"""Append pytest options for testing Muffin apps."""
parser.addini('muffin_app', 'Set path to muffin application')
parser.addoptio... | 0 | 2 | 0 | 0 | 2 | 0 |
tests/algorithms/test_maxsum.py | paradoxcell/jcvi | 517 | 3255626 | #!/usr/bin/env python3
# -*- coding:utf-8 -*-
#
# test_maxsum.py
# algorithms
#
# Created by <NAME> on 06/19/21
# Copyright © 2021 <NAME>. All rights reserved.
#
import pytest
@pytest.mark.parametrize(
"input,output",
[
([4, 4, 9, -5, -6, -1, 5, -6, -8, 9], (17, 0, 2)),
([8, -10, 10, -9, -6, ... | 0 | 0 | 0 | 0 | 0 | 0 |
sympy/assumptions/relation/__init__.py | utkarshdeorah/sympy | 8,323 | 3255650 | <reponame>utkarshdeorah/sympy
"""
A module to implement finitary relations [1] as predicate.
References
==========
.. [1] https://en.wikipedia.org/wiki/Finitary_relation
"""
__all__ = ['BinaryRelation', 'AppliedBinaryRelation']
from .binrel import BinaryRelation, AppliedBinaryRelation
| 0 | 0 | 0 | 0 | 0 | 0 |
tests/repurposer_test_utils.py | apaleyes/xfer | 244 | 3255680 | # Copyright 2018 Amazon.com, Inc. or its affiliates. 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.
# A copy of the License is located at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# or in th... | 1 | 7 | 10 | 0 | 18 | 0 |
buildroot/support/testing/tests/package/sample_python_incremental.py | bramkragten/operating-system | 349 | 3255702 | import incremental
v = incremental.Version("package", 1, 2, 3, release_candidate=4)
assert(str(v) == "[package, version 1.2.3rc4]")
| 0 | 0 | 0 | 0 | 0 | 0 |
metadrive/tests/vis_block/vis_big.py | liuzuxin/metadrive | 125 | 3255707 | <reponame>liuzuxin/metadrive
from metadrive.component.algorithm.BIG import BIG
from metadrive.component.road_network.node_road_network import NodeRoadNetwork
from metadrive.engine.asset_loader import initialize_asset_loader
from metadrive.tests.vis_block.vis_block_base import TestBlock
def vis_big(debug: bool = False... | 0 | 0 | 0 | 0 | 0 | 0 |
neural_compressor/objective.py | intel/neural-compressor | 172 | 3255708 | #!/usr/bin/env python
# -*- coding: utf-8 -*-
#
# Copyright (c) 2021 Intel Corporation
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unl... | 7 | 10 | 5 | 5 | 27 | 0 |
industroyer/opc_da_structs.py | H1d3r/malware-research | 322 | 3255713 | # -*- encoding: utf-8 -*-
#
# For feedback or questions contact us at: <EMAIL>
# https://github.com/eset/malware-research/
#
# Authors:
# <NAME> <<EMAIL>>
#
# Copyright (c) 2017, ESET, spol. s r.o.
# All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitte... | 0 | 0 | 0 | 0 | 0 | 0 |
compare_MNIST_hyperParams.py | ggraffieti/brain-inspired-replay | 164 | 3255729 | <reponame>ggraffieti/brain-inspired-replay<filename>compare_MNIST_hyperParams.py
#!/usr/bin/env python3
import os
import numpy as np
from param_stamp import get_param_stamp_from_args
import options
from visual import plt as my_plt
from matplotlib.pyplot import get_cmap
import main_cl
## Parameter-values to compare
la... | 0 | 0 | 0 | 0 | 0 | 0 |
python/paddle_fl/mpc/layers/math.py | barrierye/PaddleFL | 379 | 3255736 | <filename>python/paddle_fl/mpc/layers/math.py
# Copyright (c) 2020 PaddlePaddle 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/lic... | 0 | 0 | 0 | 0 | 0 | 0 |
examples/dunders.py | quynhanh-ngx/pytago | 206 | 3255743 | <gh_stars>100-1000
def main():
print("Hello".__len__())
a = 1
b = 2
print(a.__add__(b))
if __name__ == '__main__':
main() | 0 | 0 | 0 | 0 | 0 | 0 |
representjs/models/typetransformer.py | parasj/contracode | 115 | 3255744 | from __future__ import annotations
import torch
import torch.nn as nn
from models.encoder import CodeEncoder, CodeEncoderLSTM
class TypeTransformer(nn.Module):
def __init__(
self,
n_tokens,
n_output_tokens,
d_model: int=512,
d_out_projection: int=512,
n_hidden_outp... | 14 | 1 | 0 | 0 | 15 | 0 |
src/textcode/sfdb.py | s4-2/scancode-toolkit | 1,511 | 3255746 | <filename>src/textcode/sfdb.py
#
# Copyright (c) nexB Inc. and others. All rights reserved.
# ScanCode is a trademark of nexB Inc.
# SPDX-License-Identifier: Apache-2.0
# See http://www.apache.org/licenses/LICENSE-2.0 for the license text.
# See https://github.com/nexB/scancode-toolkit for support or download.
# See ht... | 0 | 0 | 0 | 0 | 0 | 0 |
iotedgedev/buildoptionsparser.py | druttka/iotedgedev | 111 | 3255753 | <gh_stars>100-1000
import functools
import re
from .output import Output
def parse_to_dict(split_func, sdk_options, sdk_key, build_option_val):
if sdk_key not in sdk_options:
sdk_options[sdk_key] = {}
k, v = split_func(build_option_val)
sdk_options[sdk_key][k] = v
def parse_to_list(sdk_options,... | 0 | 0 | 0 | 0 | 0 | 0 |
fum/settings/api.py | jsavikko/futurice-ldap-user-manager | 111 | 3255762 | from prod import *
AUTHENTICATION_BACKENDS = DEFAULT_SETTINGS.AUTHENTICATION_BACKENDS
WSGI_APPLICATION = 'fum.wsgi.api.application'
ROOT_URLCONF = 'fum.api_urls'
| 0 | 0 | 0 | 0 | 0 | 0 |
modules/nltk_contrib/scripttranscriber/miner.py | h4ck3rm1k3/NLP-project | 123 | 3255781 | # -*- coding: utf-8 -*-
## Licensed under the Apache License, Version 2.0 (the "License");
## you may not use this file except in compliance with the License.
## You may obtain a copy of the License at
##
## http://www.apache.org/licenses/LICENSE-2.0
##
## Unless required by applicable law or agreed to in writing... | 4 | 3 | 0 | 0 | 7 | 0 |
hydrachain/tests/txperf.py | bts/hydrachain | 406 | 3255787 | <reponame>bts/hydrachain
"""Example call:
>>> NODES=3; rm -rf /tmp/txperf && hydrachain -d /tmp/txperf runmultiple \
-v $NODES > /dev/null 2>&1 & sleep 15 && time python \
hydrachain/tests/txperf.py && kill -9 %1
additional sys.argv:
>>> python .../txperf.py <num_clients> <host> <num_... | 0 | 0 | 0 | 0 | 0 | 0 |
SeqVec/embedding/dataloader_read_fasta.py | Luma-1994/lama | 137 | 3255845 | <reponame>Luma-1994/lama
import numpy as np
def read_fasta( fasta_file, split_char=' ', id_field=0 ):
'''
Reads in fasta file containing multiple sequences.
Returns dictionary holding multiple sequences or only single
sequence, depending on input file
In order to retrieve the prote... | 0 | 0 | 0 | 0 | 0 | 0 |
Fase 4 - Temas avanzados/Tema 13 - Interfaces graficas con tkinter/Apuntes/radiobuttons.py | Vichentito/python | 105 | 3255851 | from tkinter import *
def seleccionar():
monitor.config(text="{}".format(opcion.get()))
def reset():
opcion.set(None)
monitor.config(text="")
# Configuración de la raíz
root = Tk()
opcion = IntVar()
Radiobutton(root, text="Opción 1", variable=opcion, value=1, command=seleccionar).pack()
Radiobutton(root, text="... | 0 | 0 | 0 | 0 | 0 | 0 |
examples/ipython/galgebra_ipython_helpers.py | pygae/galgebra | 151 | 3255864 | <filename>examples/ipython/galgebra_ipython_helpers.py
import subprocess
import sys
import os
from IPython.display import display_pretty
def check(name):
run(name)
with open(name + '.tex', 'r') as f:
# can't use display.Latex here, it would result in CSS comparisons in the output.
# using `di... | 0 | 0 | 0 | 0 | 0 | 0 |
test/unit/util/test_translator.py | jayneeljariwala/box-python-sdk | 367 | 3255879 | <gh_stars>100-1000
# coding: utf-8
from __future__ import absolute_import, unicode_literals
from itertools import product
import pytest
from boxsdk.object.base_object import BaseObject
from boxsdk.object.file import File
from boxsdk.object.folder import Folder
from boxsdk.object.group import Group
from boxsdk.objec... | 0 | 0 | 0 | 0 | 0 | 0 |
clmr/data.py | JiiHyunK/CLMR | 156 | 3255919 | """Wrapper for Torch Dataset class to enable contrastive training
"""
from typing import Tuple
import torch
from torch import Tensor
from torch.utils.data import Dataset
class ContrastiveDataset(Dataset):
def __init__(self, dataset, input_shape, transform):
self.dataset = dataset
self.transform = ... | 2 | 3 | 0 | 1 | 6 | 0 |
openbook_posts/management/commands/migrate_post_images.py | TamaraAbells/okuna-api | 164 | 3255980 | <filename>openbook_posts/management/commands/migrate_post_images.py
from django.core.management.base import BaseCommand
import logging
from django.db import transaction
from openbook_common.utils.model_loaders import get_post_model, get_post_media_model
logger = logging.getLogger(__name__)
class Command(BaseComma... | 0 | 0 | 0 | 0 | 0 | 0 |
lib/assets/Lib/xml/parsers/expat.py | s6007589/cafe-grader-web | 207 | 3256001 | """Interface to the Expat non-validating XML parser."""
import sys
from pyexpat import *
# provide pyexpat submodules as xml.parsers.expat submodules
sys.modules['xml.parsers.expat.model'] = model
sys.modules['xml.parsers.expat.errors'] = errors
| 0 | 0 | 0 | 0 | 0 | 0 |
scaffoldgraph/scripts/misc.py | trumanw/ScaffoldGraph | 121 | 3256013 | from __future__ import annotations
"""
scaffoldgraph.scripts.misc
"""
import logging
import os
import tqdm
class TqdmHandler(logging.Handler):
"""Logging handler for use with tqdm (used in CLI)."""
def __init__(self, level=logging.NOTSET):
super().__init__(level)
def emit(self, record):
... | 0 | 1 | 0 | 0 | 1 | 0 |
tests/segmentation_models/test_segm_models.py | YevheniiSemendiak/pytorch-tools | 155 | 3256043 | import torch
import pytest
import numpy as np
import pytorch_tools as pt
import pytorch_tools.segmentation_models as pt_sm
INP = torch.ones(2, 3, 64, 64)
ENCODERS = ["resnet34", "se_resnet50", "efficientnet_b1", "densenet121"]
SEGM_ARCHS = [pt_sm.Unet, pt_sm.Linknet, pt_sm.DeepLabV3, pt_sm.SegmentationFPN, pt_sm.Segm... | 0 | 2 | 0 | 0 | 2 | 0 |
third-party/k8s.io/repo-infra/defs/deb.bzl | yuswift/kubefed | 1,770 | 3256047 | # Copyright 2016 The Kubernetes Authors.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to ... | 6 | 0 | 0 | 0 | 6 | 0 |
tempest/lib/api_schema/response/compute/v2_70/servers.py | cityofships/tempest | 254 | 3256053 | <gh_stars>100-1000
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the License. You may obtain
# a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writi... | 0 | 0 | 0 | 0 | 0 | 0 |
tools/test/scenarios/bin/post-netcfg.py | meodaiduoi/onos | 1,091 | 3256055 | <filename>tools/test/scenarios/bin/post-netcfg.py
#! /usr/bin/env python
import requests
from requests.auth import HTTPBasicAuth
import sys
if len(sys.argv) != 3:
print "usage: post-netcfg onos-node json-file-name"
sys.exit(1)
node = sys.argv[1]
configFileName = sys.argv[2]
jsonFile = open(configFileName, ... | 0 | 0 | 0 | 0 | 0 | 0 |
src/genie/libs/parser/iosxe/tests/ShowVlan/cli/equal/golden_output_vlan_3_expected.py | balmasea/genieparser | 204 | 3256061 | <reponame>balmasea/genieparser<gh_stars>100-1000
expected_output = {
"vlans": {
"1": {
"interfaces": ["FastEthernet1/17", "FastEthernet1/18"],
"mtu": 1500,
"name": "default",
"said": 100001,
"shutdown": False,
"state": "active",
... | 0 | 0 | 0 | 0 | 0 | 0 |
rephrase_server/test_server.py | Tompes/text_data_enhancement_with_LaserTagger | 259 | 3256063 | # -*- coding: utf-8 -*-
#调用服务
import time, math
import json
import requests
import tensorflow as tf
from curLine_file import curLine
user_name="wzk"
test_num_max=300000
language='Chinese'
# 此URL中IP地址为参赛者的服务器地址,应为可达的公网IP地址,端口默认21628
url = "http://0.0.0.0:6000/rephrase"
# 调用API接口
def http_post(sources_batch) -> tuple[o... | 0 | 1 | 0 | 0 | 1 | 0 |
sunshinectf2020/speedrun/exploit_13.py | nhtri2003gmail/ctf-write-ups | 101 | 3256116 | <reponame>nhtri2003gmail/ctf-write-ups
#!/usr/bin/env python3
from pwn import *
binary = context.binary = ELF('./chall_13')
context.log_level = 'INFO'
if not args.REMOTE:
context.log_file = 'local.log'
libc = binary.libc
p = process(binary.path)
else:
context.log_file = 'remote.log'
libc_index = 1
p = remote('... | 0 | 0 | 0 | 0 | 0 | 0 |
torch/distributed/_sharded_tensor/ops/__init__.py | sanchitintel/pytorch | 60,067 | 3256137 | from .linear import sharded_linear
| 0 | 0 | 0 | 0 | 0 | 0 |
tests/exog/test_ozone_exogenous_profile.py | shaido987/pyaf | 377 | 3256148 | <filename>tests/exog/test_ozone_exogenous_profile.py
import pandas as pd
import numpy as np
import pyaf.ForecastEngine as autof
import pyaf.Bench.TS_datasets as tsds
#get_ipython().magic('matplotlib inline')
b1 = tsds.load_ozone_exogenous()
df = b1.mPastData
#df.tail(10)
#df[:-10].tail()
#df[:-10:-1]
#df.describe()... | 0 | 0 | 0 | 0 | 0 | 0 |
docs/source/showcase/VTK_cutter.py | mjpolak/K3D-jupyter | 704 | 3256183 | from __future__ import annotations
from k3d.headless import k3d_remote, get_headless_driver
import k3d
import vtk
from vtk.util import numpy_support
import numpy as np
import pathlib
path = pathlib.Path(__file__).parent.resolve()
def generate() -> object | tuple[object, object, object]:
plot = k3d.plot(screensho... | 1 | 3 | 0 | 0 | 4 | 0 |
survae/tests/transforms/bijections/autoregressive/autoregressive_splines_2d.py | alisiahkoohi/survae_flows | 262 | 3256220 | <filename>survae/tests/transforms/bijections/autoregressive/autoregressive_splines_2d.py
import numpy as np
import torch
import torch.nn as nn
import torchtestcase
import unittest
from survae.transforms.bijections.autoregressive import *
from survae.nn.layers.autoregressive import SpatialMaskedConv2d, MaskedConv2d
from... | 0 | 0 | 0 | 0 | 0 | 0 |
v2/lowpower/rtc_time.py | Dilepa/micropython-async | 443 | 3256222 | # rtc_time.py Pyboard-only RTC based timing for low power uasyncio
# Author: <NAME>
# Copyright <NAME> 2018-2019 Released under the MIT license
# Code based on extmod/utime_mphal.c
# millisecs roll over on 7 days rather than 12.42757 days
# If not running on a Pyboard the normal utime timebase is used. This is also
#... | 2 | 7 | 0 | 1 | 10 | 0 |
test/test_orm_ext.py | timgates42/uliweb | 202 | 3256253 | #coding=utf-8
#Test orm extension support
import time, sys
sys.path.insert(0, '../uliweb/lib')
from uliweb.core import dispatch
from uliweb.orm import *
import uliweb.orm as orm
orm.__auto_create__ = True
orm.__nullable__ = True
orm.__server_default__ = False
def _get_model(sender, model_name, model_inst, model_info,... | 0 | 0 | 0 | 0 | 0 | 0 |
tests/_testsite/apps/forum/views.py | BrendaH/django-machina | 572 | 3256272 | from django.views.generic import View
class MyNewForumView(View):
pass
| 0 | 0 | 0 | 0 | 0 | 0 |
gmeet_joiner/main.py | anshul2807/Automation-scripts | 496 | 3256290 | <reponame>anshul2807/Automation-scripts
import time
import webbrowser
import schedule
import pyautogui
url1 = "https://meet.google.com"
url2 = "https://www.google.com"
def attend_class(url):
webbrowser.open(url1)
time.sleep(3)
print("Joining Class")
time.sleep(2)
pyautogui.hotkey('command', 'd')... | 0 | 0 | 0 | 0 | 0 | 0 |
appqos/power.py | zzhou612/intel-cmt-cat | 397 | 3256294 | ################################################################################
# BSD LICENSE
#
# Copyright(c) 2019-2021 Intel Corporation. All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions
# are met:
#
# *... | 3 | 12 | 0 | 0 | 15 | 0 |
python/utils/utils.py | BradReesWork/cugraph | 991 | 3256303 | <reponame>BradReesWork/cugraph<filename>python/utils/utils.py
# Copyright (c) 2018-2020, NVIDIA CORPORATION.
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licens... | 0 | 0 | 0 | 0 | 0 | 0 |
Trakttv.bundle/Contents/Libraries/Shared/plugin/core/backup/tasks/compact.py | disrupted/Trakttv.bundle | 1,346 | 3256311 | import logging
log = logging.getLogger(__name__)
class CompactTask(object):
@classmethod
def run(cls, period, key, revisions, policy):
log.info('Compacting %s: %r - len(revisions): %r, policy: %r', period, key, len(revisions), policy)
# Retrieve options
p_maximum = policy.get('maximu... | 0 | 1 | 0 | 0 | 1 | 0 |
cluster/fleet/bootstrap.py | SunGuo/500lines | 134 | 3256322 | from itertools import cycle
from . import JOIN_RETRANSMIT
from .member import Component
class Bootstrap(Component):
def __init__(self, member, peers, bootstrapped_cb):
super(Bootstrap, self).__init__(member)
self.peers_cycle = cycle(peers)
self.timer: None = None
self.bootstrapped... | 0 | 0 | 0 | 1 | 1 | 0 |
tests/cli/test_list.py | houbie/pdm | 1,731 | 3256362 | <reponame>houbie/pdm
import json
import pytest
from pdm.cli import actions
from pdm.exceptions import PdmException
def test_list_command(project, invoke, mocker):
do_list = mocker.patch.object(actions, "do_list")
invoke(["list"], obj=project)
do_list.assert_called_once()
@pytest.mark.usefixtures("repo... | 0 | 0 | 0 | 0 | 0 | 0 |
examples/affine_registration_3d.py | jlevy44/airlab | 330 | 3256370 | # Copyright 2018 University of Basel, Center for medical Image Analysis and Navigation
#
# 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
#
# U... | 0 | 0 | 0 | 0 | 0 | 0 |
box/settings.py | vqv/R-Box | 174 | 3256376 | <gh_stars>100-1000
import sublime
import os
import subprocess
from .utils import read_registry
class RBoxSettings:
_rscript_binary = None
_additional_paths = []
def get(self, key, default):
s = sublime.load_settings('R-Box.sublime-settings')
return s.get(key, default)
def rscript_bi... | 0 | 0 | 0 | 0 | 0 | 0 |
pokemongo_bot/tests/utils_test.py | golem4300/quattran | 183 | 3256415 | import sys
import unittest
from io import StringIO
from api.worldmap import PokeStop, Gym
from pokemongo_bot.utils import distance, filtered_forts, convert, dist_to_str, format_dist, format_time
class UtilsTest(unittest.TestCase):
def setUp(self):
self.out = StringIO()
sys.stdout = self.out
... | 0 | 1 | 0 | 0 | 1 | 0 |
ci/cloud/__main__.py | JosephChataignon/pyclustering | 1,013 | 3256430 | <reponame>JosephChataignon/pyclustering<gh_stars>1000+
"""!
@brief Cloud Tool for Yandex Disk service.
@details Cloud Tool is used for storing binaries of pyclustering library.
@authors <NAME> (<EMAIL>)
@date 2014-2020
@copyright BSD-3-Clause
"""
import sys
from cloud.task import task
from cloud.... | 0 | 0 | 0 | 0 | 0 | 0 |
gcp_variant_transforms/transforms/filter_variants_test.py | tsa87/gcp-variant-transforms | 113 | 3256440 | <filename>gcp_variant_transforms/transforms/filter_variants_test.py
# Copyright 2017 Google Inc. 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.apac... | 0 | 0 | 0 | 0 | 0 | 0 |
test_suite/microbenchmarks/bench10/test.py | joncatanio/cannoli | 755 | 3256456 | <filename>test_suite/microbenchmarks/bench10/test.py
lst = []
i = 0
while i < 100:
i += 1
lst.append(i)
i = 0
while i < 1000000:
i += 1
new_lst = [x for x in lst]
| 0 | 0 | 0 | 0 | 0 | 0 |
observations/r/drughiv.py | hajime9652/observations | 199 | 3256480 | <gh_stars>100-1000
# -*- coding: utf-8 -*-
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
import csv
import numpy as np
import os
import sys
from observations.util import maybe_download_and_extract
def drughiv(path):
"""data from Exercise 7.6, p222
... | 0 | 0 | 0 | 0 | 0 | 0 |
tests/orchestrator.py | arcosx/skywalking-python | 131 | 3256502 | <reponame>arcosx/skywalking-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 | 0 | 0 | 0 | 0 | 0 |
src/ydata_quality/bias_fairness/engine.py | poga/ydata-quality | 242 | 3256535 | """
Implementation of BiasFairness engine to run bias and fairness analysis.
"""
from typing import List, Optional
from pandas import DataFrame, Series
from dython.nominal import compute_associations
from src.ydata_quality.core.warnings import Priority
from ..core import QualityEngine, QualityWarning
from ..utils.c... | 9 | 5 | 0 | 1 | 15 | 0 |
deepposekit/io/DLCDataGenerator.py | morbitech1/DeepPoseKit | 287 | 3256570 | # -*- coding: utf-8 -*-
# Copyright 2018-2019 <NAME> <<EMAIL>>
#
# 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 applicabl... | 0 | 6 | 0 | 0 | 6 | 0 |
Dragon/python/dragon/vm/tensorflow/framework/ops.py | neopenx/Dragon | 212 | 3256578 | # --------------------------------------------------------
# TensorFlow @ Dragon
# Copyright(c) 2017 SeetaTech
# Written by <NAME>
# --------------------------------------------------------
from __future__ import annotations
import re
from dragon.core.tensor import Tensor
from dragon.core.scope import TensorScope, De... | 6 | 9 | 32 | 1 | 48 | 0 |
encoder/__init__.py | zhufz/nlp_research | 160 | 3256587 | <filename>encoder/__init__.py
#-*- coding:utf-8 -*-
import sys,os
ROOT_PATH = '/'.join(os.path.abspath(__file__).split('/')[:-1])
sys.path.append(ROOT_PATH)
from encoder_base import EncoderBase
encoder = {}
#sentence encoder
encoder["dcnn"] = getattr(__import__('dcnn'),'DCNN')
encoder["vdcnn"] = getattr(__import__('v... | 0 | 0 | 0 | 0 | 0 | 0 |
base_layer.py | SeungyounShin/c3-gan | 105 | 3256606 | <reponame>SeungyounShin/c3-gan<filename>base_layer.py<gh_stars>100-1000
import torch
import torch.nn as nn
import torch.nn.functional as F
from torch.nn import Upsample
class GLU(nn.Module):
def __init__(self):
super(GLU, self).__init__()
def forward(self, x):
nc = x.size(1)
assert nc... | 0 | 0 | 0 | 0 | 0 | 0 |
components.py | goncaloperes/summvis | 228 | 3256622 | from __future__ import annotations
from collections import defaultdict
from itertools import count
from operator import itemgetter
from pathlib import Path
from typing import Dict, Optional
from typing import List, Tuple, Union
import htbuilder
import streamlit as st
from htbuilder import span, div, script, style, lin... | 16 | 11 | 0 | 0 | 27 | 0 |
baidu_result/baidu_result.py | awesome-archive/Spider-1 | 192 | 3256632 | #! /usr/bin python3
#创建数据库的代码:
"""
CREATE DATABASE BaiduResult;
USE BaiduResult;
CREATE TABLE KeyWords
(KeywordID int PRIMARY KEY AUTO_INCREMENT,
Keyword varchar(50) NOT NULL ,
Word varchar(50) NOT NULL
)DEFAULT CHARACTER SET utf8 COLLATE utf8_general_ci;
CREATE TABLE KeywordsLinks
(LinkID int PRIMARY KEY AUTO_INCR... | 0 | 5 | 0 | 0 | 5 | 0 |
atest/testdata/output/listener_interface/LinenoAndSource.py | rdagum/robotframework | 7,073 | 3256667 | from __future__ import annotations
import os
import tempfile
TEMPDIR = os.getenv('TEMPDIR', tempfile.gettempdir())
class LinenoAndSource:
ROBOT_LISTENER_API_VERSION: int = 2
def __init__(self):
self.suite_output = open(os.path.join(TEMPDIR, 'LinenoAndSourceSuite.txt'), 'w')
self.test_output... | 3 | 0 | 1 | 1 | 5 | 0 |
app/grandchallenge/core/validators.py | nlessmann/grand-challenge.org | 101 | 3256714 | <gh_stars>100-1000
from pathlib import Path
from typing import Tuple
import magic
from django.core.exceptions import ValidationError
from django.utils.deconstruct import deconstructible
from jsonschema import (
SchemaError,
ValidationError as JSONValidationError,
validate,
validators,
)
@deconstructi... | 0 | 0 | 0 | 0 | 0 | 0 |
nnet/ml/voc.py | SaidehNK/sr | 193 | 3256717 | <gh_stars>100-1000
import argparse
import sys
from collections import Counter
from nnet.ml.formats import create_tokenizer
from multiprocessing import cpu_count, Pool
class Voc(object):
def vocalize(self, seq):
return [self.get_id(c) for c in list(seq)]
def get_id(self):
raise NotImplementedE... | 0 | 0 | 0 | 0 | 0 | 0 |
plydata/dict.py | has2k1/plydata | 247 | 3256740 | <gh_stars>100-1000
# This module is a stub to show that the dispatch we use
# works for multiple data type sources.
"""
Verb implementations for a :class:`custom_dict`
"""
from .operators import register_implementations
__all__ = [
'define'
]
def define(verb):
verb.data = verb.data.copy()
env = verb.en... | 0 | 0 | 0 | 0 | 0 | 0 |
burness/0001/generate_200_keys.py | saurabh896/python-1 | 3,976 | 3256748 | #-*-coding: utf-8-*-
import uuid
class generate_N_keys:
def __init__(self):
self.Num: int = 0
self.list: list[object] = []
def generate(self,Num):
for i in range(Num):
self.list.append(uuid.uuid1())
def return_list(self) -> object:
return self.list
test=generate_N_keys()
test.generate(200)
keys=test.r... | 0 | 1 | 0 | 2 | 3 | 0 |
test/config/redfish1_0_config.py | arunrordell/RackHD | 451 | 3256776 | <filename>test/config/redfish1_0_config.py<gh_stars>100-1000
from settings import *
from on_http_redfish_1_0 import Configuration, ApiClient
config = Configuration()
config.host = 'http://{0}:{1}'.format(HOST_IP,HOST_PORT)
config.host_authed = 'https://{0}:{1}'.format(HOST_IP, HOST_PORT_AUTH)
config.verify_ssl = Fal... | 0 | 0 | 0 | 0 | 0 | 0 |
torch/fx/experimental/fx2trt/input_tensor_spec.py | vuanvin/pytorch | 183 | 3256786 | <gh_stars>100-1000
from typing import List, NamedTuple, Iterable, Tuple, Sequence
import torch
from .types import Shape, ShapeRange
from .utils import get_dynamic_dims
class InputTensorSpec(NamedTuple):
"""
This class contains the information of a input tensor.
shape: shape of the tensor.
dtype: d... | 0 | 0 | 0 | 0 | 0 | 0 |
tests/test_utils_hydra_config.py | blazejdolicki/vissl | 2,512 | 3256842 | # 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.
import unittest
from typing import List
from vissl.utils.hydra_config import compose_hydra_configuration, convert_to_attrdict
class TestUtil... | 1 | 1 | 0 | 0 | 2 | 0 |
tests/test_linter.py | timgates42/PythonBuddy | 191 | 3256848 | import unittest
from PythonBuddy.app import *
class TestProcessingFunctions(unittest.TestCase):
# def test_evaluate_pylint(self):
# test_code = "def foo(bar, baz):\n pass\nfoo(42)"
# self.assertNotEqual(evaluate_pylint(test_code), {})
# def test_slow(self):
# self.assertFalse(slow())... | 0 | 0 | 0 | 0 | 0 | 0 |
app/adjutorium-covid19-public/apps/simulation.py | loramf/mlforhealthlabpub | 171 | 3256857 | <gh_stars>100-1000
import dash_core_components as dcc
import dash_bootstrap_components as dbc
import dash_html_components as html
from dash.dependencies import Input, Output, State
import plotly.graph_objs as go
import plotly.express as px
import numpy as np
import pandas as pds
import scipy.stats as stats
from app im... | 0 | 0 | 0 | 0 | 0 | 0 |
HAWC2/make_htc/_htc_conversion_fxns.py | nikhar-abbas/IEA-15-240-RWT | 122 | 3256864 | <reponame>nikhar-abbas/IEA-15-240-RWT<filename>HAWC2/make_htc/_htc_conversion_fxns.py
# -*- coding: utf-8 -*-
"""Functions to create certain types of hawc2 files from a base file
Notes:
* These functions require the wetb package.
* The base file should be a 100s, steady-wind simulation with constant shear.
"""... | 0 | 0 | 0 | 0 | 0 | 0 |
stubs/asyncpg/__init__.py | rboixaderg/guillotina | 173 | 3256867 | from . import prepared_stmt # noqa
from .connection import Connection
from .types import Record # noqa
async def connect(dsn: str, **kwargs) -> Connection:
...
| 1 | 1 | 0 | 0 | 2 | 0 |
examples/sharepoint/folders/create_nested_folders.py | rikeshtailor/Office365-REST-Python-Client | 544 | 3256882 | <filename>examples/sharepoint/folders/create_nested_folders.py
from office365.sharepoint.client_context import ClientContext
from tests import test_team_site_url, test_user_credentials
ctx = ClientContext(test_team_site_url).with_credentials(test_user_credentials)
target_folder_url = "/Shared Documents/Archive/2020/0... | 0 | 0 | 0 | 0 | 0 | 0 |
test/LLNL/openmp5.0-tests/test.py | raramakr/aomp | 106 | 3256931 | #!/usr/bin/env python3
from collections import defaultdict
import subprocess
import sys
if len(sys.argv) != 3:
print ("Error: Argument list is incorrect. Test.py expects AOMP location and AOMP_GPU.")
exit(1)
AOMP = sys.argv[1]
AOMP_GPU = sys.argv[2]
if AOMP == "":
print ("Error: Please set AOMP env variable an... | 0 | 3 | 0 | 0 | 3 | 0 |
ott/core/unbalanced_functions.py | theouscidda6/ott | 110 | 3256941 | # coding=utf-8
# 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
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed ... | 6 | 5 | 0 | 0 | 11 | 0 |
tests/post/steps/test_bootstrap.py | SaintLoong/metalk8s | 255 | 3256969 | from pytest_bdd import scenario, when
# Scenarios
@scenario("../features/bootstrap.feature", "Re-run bootstrap")
def test_bootstrap(host):
pass
# When
@when("we run bootstrap a second time")
def rerun_bootstrap(request, host):
iso_root = request.config.getoption("--iso-root")
cmd = str(iso_root / "boots... | 0 | 0 | 0 | 0 | 0 | 0 |
trello_full_backup/__init__.py | xinghuierwu/trello-full-backup | 112 | 3256991 | from .backup import cli
def main():
cli()
| 0 | 0 | 0 | 0 | 0 | 0 |
openrouteservice/deprecation.py | kenspeckle1/openrouteservice-py | 242 | 3256992 | # -*- coding: utf-8 -*-
# Copyright (C) 2018 HeiGIT, University of Heidelberg.
#
#
# 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 |
test/apis/realtime/prime-generator/app/main.py | BlueWhaleKo/cortex | 8,260 | 3257037 | <gh_stars>1000+
from typing import DefaultDict
from fastapi import FastAPI
from pydantic import BaseModel
app = FastAPI()
def generate_primes(limit=None):
"""Sieve of Eratosthenes"""
not_prime = DefaultDict(list)
num = 2
while limit is None or num <= limit:
if num in not_prime:
fo... | 0 | 0 | 0 | 0 | 0 | 0 |
tests/integration/services/policy_engine/feeds/test_sync.py | rbrady/anchore-engine | 1,484 | 3257051 | <gh_stars>1000+
from anchore_engine.subsys import logger
logger.enable_test_logging()
def test_sync_fail(test_data_env, run_legacy_sync_for_feeds):
# No such feed
result = run_legacy_sync_for_feeds(["nvd"])
assert len(result) == 0
result = run_legacy_sync_for_feeds(["vulnerabilities", "packages", "n... | 0 | 0 | 0 | 0 | 0 | 0 |
WebMirror/management/rss_parser_funcs/feed_parse_extractShamelessOniisan.py | fake-name/ReadableWebProxy | 193 | 3257055 | <reponame>fake-name/ReadableWebProxy
def extractShamelessOniisan(item):
"""
Shameless Onii-san
"""
vol, chp, frag, postfix = extractVolChapterFragmentPostfix(item['title'])
if not (chp or vol or frag) or 'preview' in item['title'].lower():
return None
tagmap = [
('Marietta', 'Marietta-hime no Konrei', ... | 0 | 0 | 0 | 0 | 0 | 0 |
osf/migrations/0092_populate_notification_subscriptions.py | gaybro8777/osf.io | 628 | 3257087 | import logging
from django.db import migrations
from django.contrib.auth.models import Group
from guardian.shortcuts import assign_perm, get_perms, remove_perm
logger = logging.getLogger(__file__)
class GroupHelper(object):
""" Helper for managing permission groups for a given provider during migrations.
... | 0 | 2 | 2 | 0 | 4 | 0 |
tests/integration_tests/spark/sdk/get_client.py | Geims83/aztk | 161 | 3257096 | <reponame>Geims83/aztk<gh_stars>100-1000
import os
from datetime import datetime
import aztk.spark
from aztk_cli import config
def get_spark_client():
# load secrets
# note: this assumes secrets are set up in .aztk/secrets
tenant_id = os.environ.get("TENANT_ID")
client_id = os.environ.get("CLIENT_ID"... | 0 | 0 | 0 | 0 | 0 | 0 |
idangr/saveds/constraints/Printable.py | IMULMUL/IDAngr | 237 | 3257122 | <reponame>IMULMUL/IDAngr
# add your constraints to the var 'sym' using the var 'state'
for o in sym.chop(8):
state.se.add(state.se.Or(state.se.And(o >= 0x20, o <= 0x7e), o == 0))
| 0 | 0 | 0 | 0 | 0 | 0 |
sigal/plugins/encrypt/endec.py | Lucas-C/sigal | 648 | 3257135 | <gh_stars>100-1000
#!/usr/bin/env python3
# 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, ... | 0 | 0 | 0 | 0 | 0 | 0 |
deep_dialog/agents/agent_act_rule.py | ngduyanhece/KB-InfoBot | 184 | 3257166 | <reponame>ngduyanhece/KB-InfoBot
'''
'''
from deep_dialog import dialog_config, tools
from agent import Agent
import operator
import random
class AgentActRule(Agent):
def initialize_episode(self):
self.state = {}
self.state['diaact'] = 'UNK'
self.state['inform_slots'] = {}
self.s... | 0 | 0 | 0 | 0 | 0 | 0 |
src/matplotx/styles/_github.py | RemDelaporteMathurin/matplotx | 306 | 3257202 | <filename>src/matplotx/styles/_github.py
"""
Color data as hand-taken from GitHub.
"""
from ._helpers import generate_style
github = {
"light": generate_style(
background="#ffffff",
foreground="#24292f",
comment="#6e7781",
cycle=[
"#0550ae", # blue
"#953800"... | 0 | 0 | 0 | 0 | 0 | 0 |
heron/tools/cli/src/python/rest.py | wromansky/incubator-heron | 3,348 | 3257211 | <gh_stars>1000+
#!/usr/bin/env python3
# -*- encoding: utf-8 -*-
# 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... | 0 | 0 | 0 | 0 | 0 | 0 |
tools/gen_top_pods.py | kevinnguyenhoang91/PodToBUILD | 262 | 3257215 | <reponame>kevinnguyenhoang91/PodToBUILD
import json
import os
def render_podfile(pods):
"""
This renders out a podfile for a build test
"""
print("project 'PodsHost/PodsHost.xcodeproj'")
print("target 'ios-app' do")
skip_pods = [
# This a macOS pod build we build for iOS
# I... | 0 | 0 | 0 | 0 | 0 | 0 |
docs/examples/quickstart/start.py | bkvalexey/aiogram_dialog | 198 | 3257224 | from aiogram.types import Message
from aiogram_dialog import DialogManager, StartMode
@dp.message_handler(commands=["start"])
async def start(m: Message, dialog_manager: DialogManager):
# Important: always set `mode=StartMode.RESET_STACK` you don't want to stack dialogs
await dialog_manager.start(MySG.main, mo... | 2 | 0 | 0 | 0 | 2 | 0 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.