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 |
|---|---|---|---|---|---|---|---|---|---|---|
analysis/log_analysis/loop_averager.py | leozz37/makani | 1,178 | 3350786 | <filename>analysis/log_analysis/loop_averager.py
# Copyright 2020 Makani Technologies 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
#... | 0 | 0 | 0 | 0 | 0 | 0 |
docs_src/models/docs005.py | naterenegar/ormar | 905 | 3350791 | import databases
import sqlalchemy
import ormar
database = databases.Database("sqlite:///db.sqlite")
metadata = sqlalchemy.MetaData()
class Course(ormar.Model):
class Meta(ormar.ModelMeta):
database = database
metadata = metadata
id: int = ormar.Integer(primary_key=True)
name: str = orm... | 0 | 0 | 3 | 0 | 3 | 0 |
buf/buf_proto_breaking_test.bzl | ashwin153/rules_proto_grpc | 162 | 3350804 | """Generated definition of buf_proto_breaking_test."""
load("@rules_proto//proto:defs.bzl", "ProtoInfo")
load(
"//:defs.bzl",
"ProtoPluginInfo",
)
load(
":buf.bzl",
"buf_proto_breaking_test_impl",
)
buf_proto_breaking_test = rule(
implementation = buf_proto_breaking_test_impl,
attrs = dict(
... | 0 | 0 | 0 | 0 | 0 | 0 |
blender_bindings/material_loader/shaders/goldsrc_shaders/goldsrc_shader_mode5.py | BlenderAddonsArchive/SourceIO | 199 | 3350819 | from __future__ import annotations
import bpy
from ..goldsrc_shader_base import GoldSrcShaderBase
from ...shader_base import Nodes
from .....library.goldsrc.mdl_v10.structs.texture import MdlTextureFlag
class GoldSrcShaderMode5(GoldSrcShaderBase):
SHADER: str = 'goldsrc_shader_mode5'
def create_nodes(self, ... | 2 | 1 | 1 | 0 | 4 | 0 |
run_bot.py | fezehmoradi/fezehmoradi | 315 | 3350862 | import argparse
from gpt2bot.telegram_bot import run as run_telegram_bot
from gpt2bot.console_bot import run as run_console_bot
from gpt2bot.dialogue import run as run_dialogue
from gpt2bot.utils import parse_config
if __name__ == '__main__':
arg_parser = argparse.ArgumentParser()
arg_parser.add_argument(
... | 0 | 0 | 0 | 0 | 0 | 0 |
tests/base/test_bbox.py | grischard/OSMDeepOD | 156 | 3350893 | import pytest
import copy
from src.base.bbox import Bbox
from src.base.node import Node
@pytest.fixture(scope="module")
def rappi() -> object:
return Bbox(left=8.81372, bottom=47.218788, right=8.852430, top=47.239654)
def test_instantiate():
bottom = 47.0
left = 8.0
top = 48.0
right = 9.0
bb... | 0 | 1 | 0 | 0 | 1 | 0 |
tests/r/test_infert.py | hajime9652/observations | 199 | 3350894 | from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
import shutil
import sys
import tempfile
from observations.r.infert import infert
def test_infert():
"""Test module infert.py by downloading
infert.csv and testing shape of
extracted data has 248 row... | 0 | 0 | 0 | 0 | 0 | 0 |
tests/acceptance/test_schedules.py | ep-linden/gitlabform | 299 | 3350924 | from __future__ import annotations
import pytest
from tests.acceptance import run_gitlabform
@pytest.fixture(scope="class")
def schedules(gitlab, group_and_project) -> object:
another_branch = "scheduled/new-feature"
gitlab.create_branch(group_and_project, another_branch, "main")
# fmt: off
schedu... | 0 | 3 | 0 | 0 | 3 | 0 |
train_cnn.py | 171860596/tf-text-classification | 133 | 3350957 | <filename>train_cnn.py
#-*- coding:utf-8 -*-
import os
import time
import json
import warnings
import numpy as np
import tensorflow as tf
from sklearn.externals import joblib
from sklearn.model_selection import train_test_split
from sklearn.metrics import classification_report
import preprocess.data_helpers as data_hel... | 0 | 0 | 0 | 0 | 0 | 0 |
test/mac/identical-name/test-should-fail.gyp | chlorm-forks/gyp | 2,151 | 3350961 | {
'targets': [{
'target_name': 'test',
'type': 'executable',
'dependencies': [
'testlib/testlib.gyp:proxy',
'proxy/proxy.gyp:testlib',
],
}],
}
| 0 | 0 | 0 | 0 | 0 | 0 |
test/fs/integration/ide/test.py | jaeh/IncludeOS | 3,673 | 3351016 | <gh_stars>1000+
#!/usr/bin/env python3
from __future__ import print_function
from builtins import str
import sys
import os
import subprocess
thread_timeout = 30
includeos_src = os.environ.get('INCLUDEOS_SRC',
os.path.realpath(os.path.join(os.getcwd(), os.path.dirname(__file__))).split('... | 0 | 0 | 0 | 0 | 0 | 0 |
tests/local/test_argument.py | WaywardWizard/mnamer | 447 | 3351033 | <filename>tests/local/test_argument.py
import sys
from unittest.mock import patch
import pytest
from mnamer.argument import ArgLoader
from mnamer.setting_spec import SettingSpec
from mnamer.types import SettingType
pytestmark = pytest.mark.local
@pytest.mark.parametrize(
"settings_type",
(SettingType.DIREC... | 0 | 0 | 0 | 0 | 0 | 0 |
src/cfnlint/rules/resources/HardCodedArnProperties.py | Adam-sHub/cfn-lint | 1,134 | 3351052 | """
Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
SPDX-License-Identifier: MIT-0
"""
import re
import six
from cfnlint.rules import CloudFormationLintRule
from cfnlint.rules import RuleMatch
class HardCodedArnProperties(CloudFormationLintRule):
"""Checks Resources if ARNs use corre... | 0 | 3 | 5 | 1 | 9 | 0 |
release/stubs.min/Grasshopper/Kernel/Special/SketchElements.py | htlcnn/ironpython-stubs | 182 | 3351061 | <reponame>htlcnn/ironpython-stubs<gh_stars>100-1000
# encoding: utf-8
# module Grasshopper.Kernel.Special.SketchElements calls itself SketchElements
# from Grasshopper,Version=1.0.0.20,Culture=neutral,PublicKeyToken=dda4f5ec2cd80803
# by generator 1.145
""" NamespaceTracker represent a CLS namespace. """
# no impo... | 0 | 0 | 0 | 0 | 0 | 0 |
pythran/tests/openmp.legacy/omp_taskyield.py | davidbrochart/pythran | 1,647 | 3351066 | <reponame>davidbrochart/pythran
def omp_taskyield():
import omp
from time import sleep
NUM_TASKS = 25
count = 0
start_id = [0 for _ in range(NUM_TASKS)]
current_id = [0 for _ in range(NUM_TASKS)]
if 'omp parallel':
use_omp = omp.in_parallel()
if 'omp single':
for... | 0 | 0 | 0 | 0 | 0 | 0 |
tests/transformations/test_ozone_transf_anscombe.py | shaido987/pyaf | 377 | 3351076 |
import tests.transformations.test_ozone_transf_generic as gen
gen.test_transformation('Anscombe');
| 0 | 0 | 0 | 0 | 0 | 0 |
chainer_compiler/elichika/typing/std/builtin_functions.py | shinh/chainer-compiler | 116 | 3351087 | from chainer_compiler.elichika.typing.types import *
__all__ = [ 'builtin_func_ty' ]
def ty_len(ty_args, ty_kwargs) -> object:
x_type, = ty_args
if isinstance(x_type, TyList):
return TyInt()
if isinstance(x_type, TyTuple):
return TyInt(x_type.size())
if isinstance(x_type, TyTensor)... | 0 | 1 | 0 | 0 | 1 | 0 |
extras/usd/tutorials/endToEnd/scripts/create_asset.py | DougRogers-DigitalFish/USD | 3,680 | 3351125 | <reponame>DougRogers-DigitalFish/USD<filename>extras/usd/tutorials/endToEnd/scripts/create_asset.py
#!/pxrpythonsubst
#
# Copyright 2016 Pixar
#
# Licensed under the Apache License, Version 2.0 (the "Apache License")
# with the following modification; you may not use this file except in
# compliance with the Apache Lic... | 0 | 0 | 0 | 0 | 0 | 0 |
recipes/Python/576999_Concurrent_buffer_for_generators/recipe-576999.py | tdiprima/code | 2,023 | 3351153 | #!/usr/bin/python
# vim: ts=4 sw=4 expandtab fileencoding=UTF-8 :
import Queue
from threading import Thread
# Object used by _background_consumer to signal the source is exhausted
# to the main thread.
_sentinel = object()
class _background_consumer(Thread):
"""Will fill the queue with content of the source in... | 0 | 2 | 0 | 0 | 2 | 0 |
sphinx_class/sphinx_preprocessor.py | isabella232/nbconvert-examples | 120 | 3351164 | """Module that allows custom Sphinx parameters to be set on the notebook and
on the 'other' object passed into Jinja. Called prior to Jinja conversion
process.
"""
#-----------------------------------------------------------------------------
# Copyright (c) 2013, the IPython Development Team.
#
# Distributed under th... | 0 | 1 | 0 | 0 | 1 | 0 |
System Scripts/System Info/system.py | Gregor-Davies/Awesome-Scripts-1 | 141 | 3351174 | <filename>System Scripts/System Info/system.py
import sys
def getDetails():
"""
Prints the details
Args:
"""
print(sys)
getDetails() | 0 | 0 | 0 | 0 | 0 | 0 |
python/tvm/tir/usmp/transform/transform.py | XiaoSong9905/tvm | 4,640 | 3351183 | <gh_stars>1000+
# 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
# "License"... | 0 | 0 | 0 | 0 | 0 | 0 |
core/model/backbone/utils/__init__.py | RuiBai1999/myrepo | 471 | 3351204 | # -*- coding: utf-8 -*-
from .dropblock import DropBlock
from .maml_module import convert_maml_module
from .mtl_module import convert_mtl_module
| 0 | 0 | 0 | 0 | 0 | 0 |
Demos/setup.py | johannes-mueller/cython | 6,663 | 3351211 | <reponame>johannes-mueller/cython<gh_stars>1000+
# Run as:
# python setup.py build_ext --inplace
import sys
sys.path.insert(0, "..")
from distutils.core import setup
from distutils.extension import Extension
from Cython.Build import cythonize
ext_modules = cythonize("**/*.pyx", exclude="numpy_*.pyx")
# Only comp... | 0 | 0 | 0 | 0 | 0 | 0 |
tools/accuracy_checker/openvino/tools/accuracy_checker/representation/hit_ratio_representation.py | TolyaTalamanov/open_model_zoo | 2,201 | 3351213 | from __future__ import annotations
"""
Copyright (c) 2018-2022 Intel Corporation
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by... | 5 | 0 | 0 | 0 | 5 | 0 |
examples/tensorflow/sagemaker_byoc/tf_keras_resnet.py | NRauschmayr/sagemaker-debugger | 133 | 3351235 | """
This script is a ResNet training script which uses Tensorflow's Keras interface.
It has been orchestrated with SageMaker Debugger hooks to allow saving tensors during training.
These hooks have been instrumented to read from json configuration that SageMaker will put in the training container.
Configuration provide... | 0 | 0 | 0 | 0 | 0 | 0 |
tests/test_schemes.py | hrithik098/wifi | 274 | 3351274 | from unittest import TestCase
import tempfile
import os
from wifi import Cell
from wifi.scheme import extract_schemes, Scheme
from wifi.exceptions import ConnectionError
NETWORK_INTERFACES_FILE = """
# This file describes the network interfaces available on your system
# and how to activate them. For more informatio... | 0 | 0 | 0 | 0 | 0 | 0 |
tests/currency-utils/test_currency_tools.py | marcgarreau/eth-utils | 234 | 3351286 | import decimal
from hypothesis import given
from hypothesis import strategies as st
import pytest
from eth_utils.currency import MAX_WEI, MIN_WEI, from_wei, to_wei, units
@given(
amount_in_wei=st.integers(min_value=MIN_WEI, max_value=MAX_WEI),
intermediate_unit=st.sampled_from(tuple(units.keys())),
)
def te... | 0 | 1 | 0 | 0 | 1 | 0 |
vumi/transports/mtech_kenya/mtech_kenya.py | seidu626/vumi | 199 | 3351301 | # -*- test-case-name: vumi.transports.mtech_kenya.tests.test_mtech_kenya -*-
import json
from urllib import urlencode
from twisted.internet.defer import inlineCallbacks
from vumi.utils import http_request_full
from vumi import log
from vumi.config import ConfigText
from vumi.transports.httprpc import HttpRpcTranspor... | 0 | 3 | 6 | 0 | 9 | 0 |
fbmq/events.py | conbus/fbmq | 204 | 3351322 | <gh_stars>100-1000
import json
class Event(object):
def __init__(self, sender=None, recipient=None, timestamp=None, **kwargs):
if sender is None:
sender = dict()
if recipient is None:
recipient = dict()
self.sender = sender
self.recipient = recipient
... | 0 | 0 | 0 | 0 | 0 | 0 |
lixian_plugins/filters/date.py | 1py/xunlei-lixian | 2,177 | 3351366 |
from lixian_plugins.api import task_filter
@task_filter(pattern=r'^\d{4}[-.]\d{2}[-.]\d{2}$')
def filter_by_date(keyword, task) -> object:
return task['date'] == keyword.replace('-', '.')
| 0 | 1 | 0 | 0 | 1 | 0 |
image_downloader.py | ForeverRecompin/reddit_crawlers | 422 | 3351382 | import urllib
import requests
import traceback
from imgurpython import ImgurClient
import secret_keys
imgur_client = None
def init_imgur_client():
global imgur_client
imgur_client = ImgurClient(secret_keys.imgur_client_id, secret_keys.imgur_client_secret)
def is_supported_image_url(url):
image_types = ... | 0 | 0 | 0 | 0 | 0 | 0 |
model/encoder.py | yinmh17/editsql | 139 | 3351386 | """ Contains code for encoding an input sequence. """
import torch
import torch.nn.functional as F
from .torch_utils import create_multilayer_lstm_params, encode_sequence
class Encoder(torch.nn.Module):
""" Encodes an input sequence. """
def __init__(self, num_layers, input_size, state_size):
super().... | 1 | 1 | 0 | 0 | 2 | 0 |
emukit/examples/preferential_batch_bayesian_optimization/pbbo/inferences/vi_batch_comparison.py | ndalchau/emukit | 152 | 3351389 | <gh_stars>100-1000
import numpy as np
import scipy as sp
from scipy.integrate import quad, dblquad
from scipy.stats import norm, multivariate_normal
from scipy.special import logsumexp
from scipy.linalg import sqrtm, inv
import GPy
from GPy.util.linalg import dtrtrs, dpotrs, pdinv, tdot, jitchol
from GPy.util.univ... | 0 | 0 | 0 | 0 | 0 | 0 |
easytransfer/postprocessors/labeling_postprocessors.py | wjn1996/EasyTransfer | 806 | 3351404 | # coding=utf-8
# Copyright (c) 2019 Alibaba PAI 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/LICENSE-2.0
#
# Unless required by applicable law ... | 5 | 1 | 0 | 1 | 7 | 0 |
University-of-Toronto-Crafting-Quality-Code/week1/palindrome_algorithm_v2.py | Sam-Gao-Xin/Courses- | 622 | 3351408 | <filename>University-of-Toronto-Crafting-Quality-Code/week1/palindrome_algorithm_v2.py
def is_palindrome_v2(s):
""" (str) -> bool
Return True if and only if s is a palindrome.
>>> is_palindrome_v2('noon')
True
>>> is_palindrome_v2('racecar')
True
>>> is_palindrome_v2('dented')
False
... | 0 | 0 | 0 | 0 | 0 | 0 |
lists.py | xoften/PassGen | 128 | 3351414 | <reponame>xoften/PassGen<filename>lists.py
#dictionary containing substitutions
subDict = {
'a': ['a','A','@','4'],
'b': ['b','B','8','6'],
'c': ['c','C','[','{','(','<'],
'd': ['d','D',],
'e': ['e','E','3'],
'f': ['f','F'],
'g': ['g','G','6','9'],
'h': ['h','H','#'],
'i': ['i','I','1','l','L','|','!'], ... | 0 | 0 | 0 | 0 | 0 | 0 |
app/hide-and-seek/competition/baselines/seeker_binary_predictor/seeker.py | loramf/mlforhealthlabpub | 171 | 3351464 | <reponame>loramf/mlforhealthlabpub<gh_stars>100-1000
from utils.data_preprocess import preprocess_data
from binary_predictor.binary_predictor import binary_predictor
def seeker(input_dict):
seed = input_dict["seed"]
generated_data = input_dict["generated_data"]
enlarged_data = input_dict["enlarged_data"]... | 0 | 0 | 0 | 0 | 0 | 0 |
king_phisher/client/__main__.py | chachabooboo/king-phisher | 1,143 | 3351471 | # -*- coding: utf-8 -*-
#
# king_phisher/client/__main__.py
#
# 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 the above copyright
# notice, this list of condition... | 0 | 1 | 0 | 0 | 1 | 0 |
flare/env.py | YuuuXie/flare | 144 | 3351475 | <filename>flare/env.py<gh_stars>100-1000
"""The :class:`AtomicEnvironment` object stores information about the local
environment of an atom. :class:`AtomicEnvironment` objects are inputs to the
2-, 3-, and 2+3-body kernels."""
from typing import List, Union
from copy import deepcopy
from math import ceil
from json imp... | 0 | 0 | 0 | 0 | 0 | 0 |
src/py/gui/forms/comicform.py | Roxxas21/testcomic | 206 | 3351485 | <gh_stars>100-1000
'''
The module is the home of the ComicForm class.
@author: <NAME>
'''
import clr
import log
import utils
from utils import sstr
import i18n
from resources import Resources
from cvform import CVForm
clr.AddReference('IronPython')
clr.AddReference('System')
from System import GC, ... | 0 | 0 | 0 | 0 | 0 | 0 |
concurrency_in_python__threading_processing/multithreading__threading__examples/ThreadPoolExecutor__examples/hello_world.py | DazEB2/SimplePyScripts | 117 | 3351500 | <reponame>DazEB2/SimplePyScripts<filename>concurrency_in_python__threading_processing/multithreading__threading__examples/ThreadPoolExecutor__examples/hello_world.py
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
__author__ = 'ipetrash'
# SOURCE: https://docs.python.org/3/library/concurrent.futures.html#threadpoolex... | 0 | 0 | 0 | 0 | 0 | 0 |
torch_geometric/graphgym/benchmark.py | NucciTheBoss/pytorch_geometric | 2,350 | 3351519 | # Do not change; required for benchmarking
import torch_geometric_benchmark.torchprof_local as torchprof # noqa
from pytorch_memlab import LineProfiler # noqa
from torch_geometric_benchmark.utils import count_parameters # noqa
from torch_geometric_benchmark.utils import get_gpu_memory_nvdia # noqa
from torch_geome... | 0 | 0 | 0 | 0 | 0 | 0 |
editor/common/iconfontheaders/GenerateIconFontCppHeaders.py | Pength-TH/egal-D-engine | 1,279 | 3351532 | # Convert Font Awesome, Google Material Design and Kenney Game icon font
# parameters to C++11, C89 and None compatible formats.
#
#------------------------------------------------------------------------------
# 1 - Source material
#
# 1.1 - Font Awesome
# https://github.com/FortAwesome/Font-Awesome/blob/master/fo... | 0 | 17 | 25 | 0 | 42 | 0 |
third_party/WebKit/Tools/Scripts/webkitpy/common/checkout/scm/git_unittest.py | google-ar/chromium | 777 | 3351559 | <reponame>google-ar/chromium<filename>third_party/WebKit/Tools/Scripts/webkitpy/common/checkout/scm/git_unittest.py
# Copyright 2016 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 unittest
from webkitpy.common.sys... | 0 | 0 | 0 | 0 | 0 | 0 |
beaker/ext/redisnm.py | kotofos/beaker | 387 | 3351567 | <reponame>kotofos/beaker
import os
import threading
import time
import pickle
try:
import redis
except ImportError:
redis = None
from beaker.container import NamespaceManager
from beaker.synchronization import SynchronizerImpl
from beaker.util import SyncDict, machine_identifier
from beaker.crypto.util import... | 0 | 0 | 0 | 0 | 0 | 0 |
iPERCore/tools/human_trackers/__init__.py | JSssssss/iPERCore | 2,223 | 3351593 | # Copyright (c) 2020-2021 impersonator.org authors (<NAME> and <NAME>). All rights reserved.
import abc
VALID_TRACKERS = ["max_box"]
class BaseHumanTracker(object):
@abc.abstractmethod
def run_tracker(self, *args, **kwargs):
pass
def build_tracker(name: str="max_box", *args, **kwargs) -> object:
... | 1 | 1 | 0 | 0 | 2 | 0 |
tests/zzz_deprecated_unmaintained/allocmodel/topics/TestFromFixedCountsToRhoOmegaBetter.py | jun2tong/bnp-anomaly | 184 | 3351596 | from __future__ import annotations
'''
Basic unittest that will instantiate a fixed DocTopicCount
(assumed the same for all documents, for simplicity),
and then examine how inference of rho/omega procedes given this
fixed set of counts.
Conclusions
-----------
rho/omega objective seems to be convex in rho/omega,
and v... | 40 | 8 | 0 | 0 | 48 | 0 |
test/win/compiler-flags/warning-level.gyp | chlorm-forks/gyp | 2,151 | 3351640 | # Copyright (c) 2012 Google Inc. All rights reserved.
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
{
'targets': [
# Level 1
{
'target_name': 'test_wl1_fail',
'type': 'executable',
'msvs_settings': {
'VCCLCompilerTool': {
... | 0 | 0 | 0 | 0 | 0 | 0 |
2018/unif/unifier.py | minimum-necessary-change/code-for-blog | 1,199 | 3351741 | <filename>2018/unif/unifier.py
# Python 3.6
import lexer
class Term:
pass
# In App, function names are always considered to be constants, not variables.
# This simplifies things and doesn't affect expressivity. We can always model
# variable functions by envisioning an apply(FUNCNAME, ... args ...).
class App(Te... | 0 | 0 | 0 | 0 | 0 | 0 |
eval/ic15_rec/script_self_adapt.py | doem97/PSENet | 1,213 | 3351787 | <reponame>doem97/PSENet
import os
import mmcv
import argparse
parser = argparse.ArgumentParser(description='Hyperparams')
# parser.add_argument('--gt', nargs='?', type=str, default=None)
parser.add_argument('--pred', nargs='?', type=str, default=None)
args = parser.parse_args()
output_root = '../outputs/tmp_results/'... | 0 | 0 | 0 | 0 | 0 | 0 |
tf_agents/bandits/agents/examples/v2/trainer_test_utils.py | Francis777/agents | 3,175 | 3351792 | # coding=utf-8
# Copyright 2020 The TF-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
#
# https://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable la... | 0 | 2 | 0 | 0 | 2 | 0 |
twister-control.py | majestrate/twister-core | 754 | 3351794 | <reponame>majestrate/twister-core<gh_stars>100-1000
#!/usr/bin/env python2
#
# very simple wrapper for starting twisterd and launching the web browser
#
# generates a default rpcpassword, twister.conf file etc.
# may also setup automatic twisterd script on desktop login.
try:
from Tkinter import *
from tkMessa... | 0 | 0 | 0 | 0 | 0 | 0 |
clastic/tests/test_meta.py | mahmoud/clastic | 140 | 3351826 | <reponame>mahmoud/clastic<filename>clastic/tests/test_meta.py
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
from clastic import Application, render_basic, MetaApplication
from clastic.middleware.cookie import SignedCookieMiddleware
from clastic.tests.common import cookie_hello_world
def test_meta_ba... | 0 | 0 | 0 | 0 | 0 | 0 |
dvc/command/config.py | lucasalavapena/dvc | 9,136 | 3351836 | <filename>dvc/command/config.py
import argparse
import logging
import os
from dvc.command.base import CmdBaseNoRepo, append_doc_link
from dvc.ui import ui
logger = logging.getLogger(__name__)
NAME_REGEX = r"^(?P<remote>remote\.)?(?P<section>[^\.]*)\.(?P<option>[^\.]*)$"
def _name_type(value):
import re
ma... | 0 | 0 | 0 | 0 | 0 | 0 |
telethon/extensions/__init__.py | TgCat/Telethon | 6,709 | 3351837 | """
Several extensions Python is missing, such as a proper class to handle a TCP
communication with support for cancelling the operation, and a utility class
to read arbitrary binary data in a more comfortable way, with int/strings/etc.
"""
from .binaryreader import BinaryReader
| 0 | 0 | 0 | 0 | 0 | 0 |
cms/test_utils/project/pluginapp/plugins/validation/cms_plugins.py | Mario-Kart-Felix/django-cms | 5,659 | 3351882 | <gh_stars>1000+
from cms.plugin_base import CMSPluginBase
class NonExisitngRenderTemplate(CMSPluginBase):
name = 'SubTest'
module = 'Test'
render_template = 'i_do_not_exist.html'
allow_children = True
class NoSubPluginRender(CMSPluginBase):
name = 'SubSubTest'
module = 'Test'
render_temp... | 0 | 0 | 0 | 0 | 0 | 0 |
asyncmgr.py | Aiirony/shadowsocks | 122 | 3351887 | #!/usr/bin/env python
# -*- coding: utf-8 -*-
# Copyright (c) 2014 clowwindy
#
# 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
# ... | 0 | 2 | 0 | 8 | 10 | 0 |
tests/db/test_serializers.py | Veritaris/fastapi_contrib | 504 | 3351888 | #!/usr/bin/env python
# -*- coding: utf-8 -*-
from typing import List, Set, Mapping, Tuple, Sequence
import pytest
from fastapi import FastAPI
from pydantic import BaseModel, ValidationError
from starlette.testclient import TestClient
from fastapi_contrib.db.models import MongoDBTimeStampedModel
from fastapi_contrib... | 1 | 5 | 48 | 0 | 54 | 0 |
Challenge1/challenge.py | Gerifield/websocket-smuggle | 284 | 3351916 | <reponame>Gerifield/websocket-smuggle
import socket
req1 = '''GET /socket.io/?transport=websocket HTTP/1.1
Host: localhost:80
Sec-WebSocket-Version: 1337
Upgrade: websocket
'''.replace('\n', '\r\n')
req2 = '''GET /flag HTTP/1.1
Host: localhost:5000
'''.replace('\n', '\r\n')
def main(netloc):
host, port = ne... | 0 | 0 | 0 | 0 | 0 | 0 |
TensorFlow/squeezenet/src/predict_squeezenet.py | Atelis/DirectML | 665 | 3351925 | import os
import tensorflow as tf
import numpy as np
import argparse
import matplotlib.pyplot as plt
from tensorflow.python.util import deprecation
deprecation._PRINT_DEPRECATION_WARNINGS = False
def _parse_args() -> object:
parser = argparse.ArgumentParser("run_squeezenet.py")
parser.add_argument(
"-... | 0 | 1 | 0 | 0 | 1 | 0 |
tests/test_apis/test_single_gpu_test.py | yuexy/mmocr | 2,261 | 3351927 | # Copyright (c) OpenMMLab. All rights reserved.
import copy
import json
import os
import os.path as osp
import tempfile
import mmcv
import numpy as np
import pytest
import torch
from mmcv import Config
from mmcv.parallel import MMDataParallel
from mmocr.apis.test import single_gpu_test
from mmocr.datasets import buil... | 0 | 0 | 0 | 0 | 0 | 1 |
tests/test_tf/__init__.py | SymbioticLab/Salus | 104 | 3351932 | <gh_stars>100-1000
from __future__ import print_function, division, absolute_import
import sys
import os
import time
from timeit import default_timer
from contextlib import contextmanager
from unittest import SkipTest
import numpy as np
import numpy.testing as npt
import tensorflow as tf
from .lib import gradients ... | 0 | 0 | 0 | 0 | 0 | 0 |
benchs/bench_all_ivf/bench_kmeans.py | ScriptBox99/facebook-faiss | 17,006 | 3351947 | <filename>benchs/bench_all_ivf/bench_kmeans.py
# 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 os
import numpy as np
import faiss
import argparse
import datasets
from datasets import ... | 0 | 0 | 0 | 0 | 0 | 0 |
test/unittests/util/test_platform.py | assistent-cat/mycroft-core | 6,099 | 3351951 | <reponame>assistent-cat/mycroft-core<filename>test/unittests/util/test_platform.py
from unittest import TestCase, mock
from mycroft.util import get_arch
class TestPlatform(TestCase):
@mock.patch('os.uname')
def test_get_arch(self, mock_uname):
mock_uname.return_value = ('Linux', 'Woodstock', '4.15.0-... | 0 | 0 | 0 | 0 | 0 | 0 |
e2e/pages/credential_store_page.py | 04n0/jenkins-configuration | 177 | 3351953 | from __future__ import absolute_import
from . import JENKINS_HOST
from bok_choy.page_object import PageObject
class CredentialStorePage(PageObject):
url = "http://{}:8080/credentials/store/system/domain/_/".format(JENKINS_HOST)
def is_browser_on_page(self) -> object:
return "Global credentials (unres... | 0 | 3 | 0 | 0 | 3 | 0 |
flask_restaction/cli.py | ncuhome/flask-restaction | 135 | 3352006 | <gh_stars>100-1000
import argparse
import os
import requests
from .res import res_to_url
RESJS_DIST = os.path.join(os.path.dirname(__file__), 'resjs/dist')
def parse_meta(meta):
"""
Parse metadata of API
Args:
meta: metadata of API
Returns:
tuple(url_prefix, auth_header, resources)... | 0 | 0 | 0 | 0 | 0 | 0 |
thumt/modules/layer_norm.py | Yuran-Zhao/THUMT | 422 | 3352127 | <reponame>Yuran-Zhao/THUMT<filename>thumt/modules/layer_norm.py
# coding=utf-8
# Copyright 2017-2020 The THUMT Authors
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
import numbers
import torch
import torch.nn as nn
import thumt.utils as utils
from thumt.... | 0 | 0 | 0 | 0 | 0 | 0 |
tests/test_core_ants_transform_io.py | xemio/ANTsPy | 338 | 3352138 | <reponame>xemio/ANTsPy
"""
Test ants_image.py
nptest.assert_allclose
self.assertEqual
self.assertTrue
"""
import os
import unittest
from common import run_tests
from tempfile import mktemp
import numpy as np
import numpy.testing as nptest
import ants
class TestModule_ants_transform_io(unittest.TestCase):
d... | 0 | 0 | 0 | 0 | 0 | 0 |
examples/virus_on_network/virus_on_network/server.py | jdfoote/mesa | 1,704 | 3352160 | <filename>examples/virus_on_network/virus_on_network/server.py
import math
from mesa.visualization.ModularVisualization import ModularServer
from mesa.visualization.UserParam import UserSettableParameter
from mesa.visualization.modules import ChartModule
from mesa.visualization.modules import NetworkModule
from mesa.v... | 0 | 0 | 0 | 0 | 0 | 0 |
orion/__main__.py | PSFC-HEDP/Orion | 543 | 3352170 | <reponame>PSFC-HEDP/Orion<gh_stars>100-1000
#!/usr/bin/env python
# coding: utf-8
import argparse
import getpass
import logging
import os
import sys
import warnings
from urllib.error import HTTPError
import tabulate
from orion import MLBLOCKS_PIPELINES
from orion.benchmark import benchmark
from orion.data import loa... | 0 | 0 | 0 | 0 | 0 | 0 |
ChatBot/chatbot_generate/seq2seq/code_seq2seq_char/predict_char_cg.py | liruifeng-01/nlp_xiaojiang | 1,379 | 3352173 | <reponame>liruifeng-01/nlp_xiaojiang
"""
对SequenceToSequence模型进行基本的参数组合测试
Code from: QHDuan(2018-02-05) url: https://github.com/qhduan/just_another_seq2seq
"""
from utils.mode_util.seq2seq.data_utils import batch_flow_bucket as batch_flow
from utils.mode_util.seq2seq.thread_generator import ThreadedGenerator
from uti... | 0 | 0 | 0 | 0 | 0 | 0 |
vissl/data/dataset_catalog.py | blazejdolicki/vissl | 2,512 | 3352204 | <reponame>blazejdolicki/vissl
# 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.
"""
Data and labels file for various datasets.
"""
import json
import logging
import os
from typing import List
... | 0 | 0 | 0 | 0 | 0 | 0 |
data/raw/LREC/converter.py | heathher/neural_sequence_labeling | 240 | 3352212 | <filename>data/raw/LREC/converter.py
import sys
import codecs
mapping = {"COMMA": ",COMMA", "PERIOD": ".PERIOD", "QUESTION": "?QUESTIONMARK", "O": ""}
counts = dict((p, 0) for p in mapping)
with codecs.open(sys.argv[1], 'r', 'utf-8', 'ignore') as f_in, \
codecs.open(sys.argv[2], 'w', 'utf-8') as f_out:... | 0 | 0 | 0 | 0 | 0 | 0 |
tests/test_compute_basic.py | zzzDavid/heterocl | 236 | 3352213 | <filename>tests/test_compute_basic.py
import heterocl as hcl
import numpy
def _test_kernel(kernel):
A = hcl.placeholder((10,))
s = hcl.create_schedule([A], kernel)
f = hcl.build(s)
np_A = numpy.random.randint(10, size=(10,))
np_B = numpy.zeros(10)
hcl_A = hcl.asarray(np_A)
hcl_B = hcl.asa... | 0 | 0 | 0 | 0 | 0 | 0 |
wwr_ui/update_checker.py | TheLemons/wwrando | 284 | 3352241 |
from __future__ import annotations
import urllib.request
import ssl
import certifi
import json
import traceback
from distutils.version import LooseVersion
from randomizer import VERSION
LATEST_RELEASE_DOWNLOAD_PAGE_URL = "https://github.com/LagoLunatic/wwrando/releases/latest"
LATEST_RELEASE_API_URL = "https://api.g... | 0 | 1 | 0 | 0 | 1 | 0 |
smdebug/profiler/utils.py | sophiayue1116/sagemaker-debugger | 133 | 3352262 | <reponame>sophiayue1116/sagemaker-debugger<gh_stars>100-1000
"""
The TimeUnit enum is to be used while querying the events within timerange or at a given timestamp
The Enum will indicate the unit in which timestamp is provided.
"""
# Standard Library
import os
import re
import shutil
import time
from datetime import da... | 0 | 0 | 0 | 0 | 0 | 0 |
examples/ibl_matball.py | xuhao1/taichi_three | 152 | 3352266 | import taichi as ti
import tina
ti.init(ti.gpu)
scene = tina.Scene(smoothing=True, taa=True, ibl=True)
roughness = tina.Param(float, initial=0)#.15)
metallic = tina.Param(float, initial=0)#.25)
material = tina.PBR(metallic=metallic, roughness=roughness)
#model = tina.PrimitiveMesh.sphere()
model = tina.MeshModel('a... | 0 | 0 | 0 | 0 | 0 | 0 |
app/scp/batch_script/train_NDM.py | hailiang-wang/aclweb-I17-1074 | 361 | 3352274 | <gh_stars>100-1000
######################################################################
######################################################################
# Copyright <NAME>, Cambridge Dialogue Systems Group, 2017 #
######################################################################
##########################... | 0 | 0 | 0 | 0 | 0 | 0 |
prohmr/optimization/optimization_task.py | akashsengupta1997/ProHMR | 120 | 3352277 | <reponame>akashsengupta1997/ProHMR
import torch
import numpy as np
from yacs.config import CfgNode
from prohmr.models import SMPL
def rel_change(prev_val: float, curr_val: float) -> float:
"""
Compute relative change. Code from https://github.com/vchoutas/smplify-x
Args:
prev_val (float): Previous ... | 0 | 0 | 0 | 0 | 0 | 0 |
atlas/foundations_sdk/src/test/helpers/__init__.py | DeepLearnI/atlas | 296 | 3352292 | <reponame>DeepLearnI/atlas
from test.helpers.test_completed import TestCompletedJobHelpers
from test.helpers.test_annotate import TestAnnotate
from test.helpers.test_queued import TestQueuedJobHelpers
| 0 | 0 | 0 | 0 | 0 | 0 |
pypika/tests/dialects/test_postgresql.py | YiuRULE/pypika | 1,616 | 3352297 | import unittest
from collections import OrderedDict
from pypika import (
Array,
Field,
JSON,
QueryException,
Table,
)
from pypika.dialects import PostgreSQLQuery
class InsertTests(unittest.TestCase):
table_abc = Table("abc")
def test_array_keyword(self):
q = PostgreSQLQuery.into(... | 0 | 1 | 0 | 0 | 1 | 0 |
pykwalify/cli.py | swills/pykwalify | 275 | 3352304 | <filename>pykwalify/cli.py
# -*- coding: utf-8 -*-
""" pyKwalify - cli.py """
# python std lib
import logging
import logging.config
import sys
# 3rd party imports
from docopt import docopt
def parse_cli():
"""
The outline of this function needs to be like this:
1. parse arguments
2. validate argum... | 0 | 0 | 0 | 0 | 0 | 0 |
third_party/blink/tools/blinkpy/common/pretty_diff.py | mghgroup/Glide-Browser | 575 | 3352305 | # 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.
from __future__ import annotations
"""Prettifies 'git diff' output.
prettify_diff() takes a diff string, and returns an HTML string decorating the
diff.
Thi... | 3 | 16 | 1 | 1 | 21 | 0 |
LeetCode/python3/1054.py | ZintrulCre/LeetCode_Archiver | 279 | 3352309 | <reponame>ZintrulCre/LeetCode_Archiver
class Solution:
def rearrangeBarcodes(self, codes: List[int]) -> List[int]:
n = len(codes)
if n <= 2:
return codes
for i in range(n):
j = i + 1
while j < n and codes[j] == codes[i]:
j += 1
... | 0 | 0 | 0 | 0 | 0 | 0 |
analysis_engine/ae_talib.py | virdesai/stock-analysis-engine | 819 | 3352317 | <reponame>virdesai/stock-analysis-engine
"""
TA-Lib wrappers
"""
# for unittests, allow passing the mocks into the runtime if not found
try:
import talib as ta
except Exception:
import analysis_engine.mocks.mock_talib as ta
# end of loading talib or mocks
import spylunking.log.setup_logging as log_utils
log =... | 0 | 0 | 0 | 0 | 0 | 0 |
src/redisenterprise/azext_redisenterprise/vendored_sdks/redisenterprise/models/_models.py | Mannan2812/azure-cli-extensions | 2,728 | 3352322 | # coding=utf-8
# --------------------------------------------------------------------------
# Copyright (c) Microsoft Corporation. All rights reserved.
# Licensed under the MIT License. See License.txt in the project root for license information.
# Code generated by Microsoft (R) AutoRest Code Generator.
# Changes may ... | 0 | 0 | 52 | 43 | 95 | 0 |
attic/test/json_encode.py | grassofsky/llfio | 356 | 3352349 | <reponame>grassofsky/llfio
#!/usr/bin/python
import json,sys,codecs
sys.stdout.write(json.dumps(codecs.getreader('ISO-8859-1')(sys.stdin).read()))
| 0 | 0 | 0 | 0 | 0 | 0 |
environments/atari_environment.py | LihaoR/tensorflow-rl | 193 | 3352362 | from __future__ import annotations
"""
Code based on: https://github.com/coreylynch/async-rl/blob/master/atari_environment.py
"""
"""
The MIT License (MIT)
Copyright (c) 2016 <NAME>
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation f... | 6 | 7 | 0 | 0 | 13 | 0 |
macgraph/minception.py | Octavian-ai/mac-graph | 116 | 3352389 | <reponame>Octavian-ai/mac-graph
import tensorflow as tf
from .util import *
from .const import EPSILON
'''
The mini-inception (mi) library
This is inspired by Google's inception network
and DARTS architecture search. I didn't get fancy
on the bilevel optimization, so let's see how it goes!!
'''
MI_ACTIVATIONS = ... | 0 | 0 | 0 | 0 | 0 | 0 |
examples/animate.py | kfcmax/PySLAM | 135 | 3352397 | #!/usr/bin/env python3
'''Animates distances and measurment quality'''
from rplidar import RPLidar
import matplotlib.pyplot as plt
import numpy as np
import matplotlib.animation as animation
PORT_NAME = '/dev/ttyUSB0'
DMAX = 4000
IMIN = 0
IMAX = 50
def update_line(num, iterator, line) -> tuple[object]:
scan = nex... | 0 | 1 | 0 | 0 | 1 | 0 |
tests/components/metoffice/conftest.py | tbarbette/core | 30,023 | 3352408 | """Fixtures for Met Office weather integration tests."""
from unittest.mock import patch
from datapoint.exceptions import APIException
import pytest
@pytest.fixture()
def mock_simple_manager_fail():
"""Mock datapoint Manager with default values for testing in config_flow."""
with patch("datapoint.Manager") a... | 0 | 0 | 0 | 0 | 0 | 0 |
cresi/net/pytorch_utils/callbacks.py | ankshah131/cresi | 117 | 3352418 | import torch
from copy import deepcopy
import os
from tensorboardX import SummaryWriter
class Callback(object):
"""
Abstract base class used to build new callbacks.
"""
def __init__(self):
self.trainer: None = None
self.estimator: None = None
self.metrics_collectio... | 1 | 0 | 0 | 5 | 6 | 0 |
hwt/serializer/systemC/serializer.py | ufo2011/hwt | 134 | 3352422 | from copy import copy
from typing import Optional
from hdlConvertorAst.hdlAst._defs import HdlIdDef
from hdlConvertorAst.hdlAst._expr import HdlValueId, HdlOp, HdlOpType
from hdlConvertorAst.hdlAst._structural import HdlModuleDec, HdlCompInst
from hdlConvertorAst.to.systemc.keywords import SYSTEMC_KEYWORDS
from hdlCon... | 4 | 3 | 0 | 3 | 10 | 0 |
tests/test_fix_basestring.py | graingert/python-modernize | 220 | 3352443 | from __future__ import generator_stop
from utils import check_on_input
BASESTRING = (
"""\
isinstance(x, basestring)
""",
"""\
from __future__ import absolute_import
import six
isinstance(x, six.string_types)
""",
)
def test_basestring():
check_on_input(*BASESTRING)
| 0 | 0 | 0 | 0 | 0 | 0 |
appengine/standard/migration/ndb/overview/main.py | yshalabi/python-docs-samples | 5,938 | 3352449 | <filename>appengine/standard/migration/ndb/overview/main.py<gh_stars>1000+
# Copyright 2015 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... | 0 | 0 | 0 | 0 | 0 | 0 |
3d-tracking/loader/dla_dataset.py | sadjadasghari/3d-vehicle-tracking | 603 | 3352452 | from __future__ import annotations
import json
from collections import namedtuple
from os.path import exists, join
Dataset = namedtuple('Dataset', ['model_hash', 'classes', 'mean', 'std',
'eigval', 'eigvec', 'name'])
imagenet = Dataset(name='imagenet',
classes=1000,... | 1 | 2 | 0 | 0 | 3 | 0 |
python/example_code/lookoutvision/models.py | cfuerst/aws-doc-sdk-examples | 5,166 | 3352462 | # Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
# SPDX-License-Identifier: Apache-2.0
from __future__ import annotations
"""
Amazon lookout for Vision model code examples used in the service documentation:
https://docs.aws.amazon.com/lookout-for-vision/latest/developer-guide/model.html
Shows how to... | 2 | 1 | 0 | 0 | 3 | 0 |
jenkinsapi/plugin.py | ChandlerSwift/jenkinsapi | 556 | 3352468 | <filename>jenkinsapi/plugin.py
"""
Module for jenkinsapi Plugin
"""
class Plugin(object):
"""
Plugin class
"""
def __init__(self, plugin_dict):
if isinstance(plugin_dict, dict):
self.__dict__ = plugin_dict
else:
self.__dict__ = self.to_plugin(plugin_dict)
... | 0 | 0 | 0 | 0 | 0 | 0 |
py2.5/processing/pool.py | geofft/multiprocess | 356 | 3352473 | <reponame>geofft/multiprocess
#
# Module providing the `Pool` class for managing a process pool
#
# processing/pool.py
#
# Copyright (c) 2007-2008, <NAME> --- see COPYING.txt
#
__all__ = ['Pool']
#
# Imports
#
import processing
import threading
import Queue
import itertools
import collections
impo... | 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.