max_stars_repo_path
stringlengths
4
245
max_stars_repo_name
stringlengths
7
115
max_stars_count
int64
101
368k
id
stringlengths
2
8
content
stringlengths
6
1.03M
f5/bigip/tm/gtm/test/functional/test_listener.py
nghia-tran/f5-common-python
272
12755606
<gh_stars>100-1000 # Copyright 2014-2017 F5 Networks 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 required by applicable l...
QUANTAXIS/QASU/save_jq.py
vensentzhou/QUANTAXIS
6,322
12755612
<reponame>vensentzhou/QUANTAXIS import concurrent.futures import datetime import os from concurrent.futures import ProcessPoolExecutor, ThreadPoolExecutor import pandas as pd import pymongo import QUANTAXIS as QA from QUANTAXIS.QAFetch.QATdx import QA_fetch_get_stock_list from QUANTAXIS.QAUtil import (DATABASE, QA_ut...
tests/generators/forks/main.py
sifraitech/eth2.0-specs
497
12755643
from typing import Iterable from eth2spec.test.helpers.constants import PHASE0, ALTAIR, BELLATRIX, MINIMAL, MAINNET from eth2spec.test.helpers.typing import SpecForkName, PresetBaseName from eth2spec.test.altair.fork import test_altair_fork_basic, test_altair_fork_random from eth2spec.test.bellatrix.fork import test_b...
blendergltf/pbr_utils.py
silentorb/blendergltf
343
12755646
<reponame>silentorb/blendergltf import math import bpy import mathutils ALPHA_MODE_ITEMS = [ ('OPAQUE', 'Opaque', 'The alpha value is ignored and the rendered output is fully opaque'), ('MASK', 'Mask', ( 'The rendered output is either fully opaque or fully transparent depending on the ' 'alpha...
stubs/aioredis/__init__.py
rboixaderg/guillotina
173
12755651
<reponame>rboixaderg/guillotina<filename>stubs/aioredis/__init__.py from typing import AsyncIterator class Channel: async def wait_message(self) -> AsyncIterator[bool]: ... async def get(self) -> bytes: ... class Redis: def __init__(self, conn): ...
bin/get-phoneme-examples.py
dbm01z/rhasspy
942
12755670
#!/usr/bin/env python3 import sys import re import argparse from collections import defaultdict # This script loads frequently used words in a language, looks up their # pronunciations in a CMU dictionary, then prints an example word + # pronunciation for each phoneme. def main(): parser = argparse.ArgumentParse...
fnss/netconfig/capacities.py
brucespang/fnss
114
12755703
"""Functions to assign and manipulate link capacities of a topology. Link capacities can be assigned either deterministically or randomly, according to various models. """ from distutils.version import LooseVersion import networkx as nx from fnss.util import random_from_pdf from fnss.units import capacity_units __...
tests/basics/Inspection_36.py
roired/Nuitka
1,228
12755730
# Copyright 2021, <NAME>, mailto:<EMAIL> # # Python tests originally created or extracted from other peoples work. The # parts were too small to be protected. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # ...
trashcode/config/constants.py
paultheron-X/INF581-Trading-agent
671
12755736
<filename>trashcode/config/constants.py #Global PARENT_DIR = "PARENT_DIR" #Logging LOG_FILE = "LOG_FILE" SAVE_DIR = "SAVE_DIR" TENSORBOARD_LOG_DIR = "TENSORBOARD_LOG_DIR" #Preprocessing Dataset DATASET_PATH = "DATASET_PATH" #DeepSense Parameters ##Dataset Parameters BATCH_SIZE = "BATCH_SIZE" HISTORY_LENGTH = "HISTOR...
app/server.py
hailiang-wang/aclweb-I17-1074
361
12755738
###################################################################### ###################################################################### # Copyright <NAME>, Cambridge Dialogue Systems Group, 2017 # ###################################################################### #############################################...
etc/scripts/docenizers/docenizer6502.py
OfekShilon/compiler-explorer
4,668
12755805
#!/usr/bin/env python3 import argparse import enum import json import os.path import re import urllib.request DOC_URL_BASE = "https://raw.githubusercontent.com/mist64/c64ref/master/6502/" doc_files = {f"{DOC_URL_BASE}{filename}":cpu_type for filename, cpu_type in { "cpu_6502.txt" : "6502", "cpu_65c02.txt" : "...
docs/examples/container/joyent/instantiate_driver.py
dupontz/libcloud
1,435
12755817
from libcloud.container.types import Provider from libcloud.container.providers import get_driver cls = get_driver(Provider.JOYENT) conn = cls(host='us-east-1.docker.joyent.com', port=2376, key_file='key.pem', cert_file='~/.sdc/docker/admin/ca.pem') conn.list_images()
tika-parsers/src/main/resources/org/apache/tika/parser/captioning/tf/im2txtapi.py
dedabob/tika
1,299
12755818
<reponame>dedabob/tika<filename>tika-parsers/src/main/resources/org/apache/tika/parser/captioning/tf/im2txtapi.py #!/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 #...
tests/core/usage/audit_usage_test.py
paulo-sampaio/detect-secrets
2,212
12755819
<filename>tests/core/usage/audit_usage_test.py import pytest from detect_secrets.core.usage import ParserBuilder @pytest.fixture def parser(): return ParserBuilder().add_console_use_arguments() def test_normal_mode_requires_single_file(parser): with pytest.raises(SystemExit): parser.parse_args(['au...
tests/DataIntegrityTest.py
marcodafonseca/PyOpenWorm
118
12755853
from __future__ import print_function from __future__ import absolute_import import unittest import csv from owmeta_core.context import Context from owmeta_core.command import OWM from owmeta_core.bundle import Bundle from owmeta.worm import Worm from owmeta.cell import Cell from owmeta.neuron import Neuron from owme...
examples/create_new_document.py
MrTeferi/photoshop-python-api
270
12755865
<reponame>MrTeferi/photoshop-python-api """Create a new document.""" # Import local modules from photoshop import Session with Session() as ps: ps.app.preferences.rulerUnits = ps.Units.Pixels ps.app.documents.add(1920, 1080, name="my_new_document")
examples/shap/multiclass_classification.py
PeterSulcs/mlflow
10,351
12755866
<reponame>PeterSulcs/mlflow import os import numpy as np from sklearn.datasets import load_iris from sklearn.ensemble import RandomForestClassifier import shap import mlflow from utils import to_pandas_Xy # prepare training data X, y = to_pandas_Xy(load_iris()) # train a model model = RandomForestClassifier() mod...
Validation/HcalHits/python/pion100GeV_HF_cfg.py
ckamtsikis/cmssw
852
12755893
import FWCore.ParameterSet.Config as cms process = cms.Process("GEN") # this will run plig-in energy-flat random particle gun # and puts particles (HepMCPRoduct) into edm::Event process.load("SimGeneral.HepPDTESSource.pdt_cfi") process.RandomNumberGeneratorService = cms.Service("RandomNumberGeneratorService", mod...
actions/lib/comments.py
userlocalhost/stackstorm-datadog
164
12755899
from base import DatadogBaseAction from datadog import api class DatadogCreateComment(DatadogBaseAction): def _run(self, **kwargs): return api.Comment.create(**kwargs) class DatadogDeleteComment(DatadogBaseAction): def _run(self, **kwargs): return api.Comment.delete(kwargs.pop("comment_id"))...
Chapter 09/ch09_r10.py
PacktPublishing/Modern-Python-Cookbook
107
12755931
"""Python Cookbook Chapter 9, recipe 10. """ import logging import sys from logging import Formatter from pathlib import Path def create_log(): PROD_LOG_FORMAT = ('[{asctime}]' ' {levelname} in {module}: {message}' ) with Path('sample.log').open('w') as sample_log_file: logging.basicC...
intake/__init__.py
mattkram/intake
149
12755935
#----------------------------------------------------------------------------- # Copyright (c) 2012 - 2018, Anaconda, Inc. and Intake contributors # All rights reserved. # # The full license is in the LICENSE file, distributed with this software. #------------------------------------------------------------------------...
cmake/macros/compilePython.py
chunkified/usd-qt
124
12755954
<reponame>chunkified/usd-qt<filename>cmake/macros/compilePython.py # # 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 License and the following modification to it: # Sectio...
simpleeval__examples__calc/get_value_from__url_http_request__call_function.py
DazEB2/SimplePyScripts
117
12755972
<reponame>DazEB2/SimplePyScripts #!/usr/bin/env python3 # -*- coding: utf-8 -*- __author__ = 'ipetrash' # pip install simpleeval from simpleeval import SimpleEval def get_from_url(value): import requests rs = requests.get('https://httpbin.org/get', params={'value': value}) return rs.json()['args']['val...
tests/query/bugs/fixed_bigint_2031.py
liuqian1990/nebula
8,586
12756011
# --coding:utf-8-- # # Copyright (c) 2020 vesoft inc. All rights reserved. # # This source code is licensed under Apache 2.0 License. import time from tests.common.nebula_test_suite import NebulaTestSuite class TestBigInt(NebulaTestSuite): @classmethod def prepare(self): resp = self.execute( ...
tests/blocks/signal/iirfilter_spec.py
telent/luaradio
559
12756036
<reponame>telent/luaradio<filename>tests/blocks/signal/iirfilter_spec.py import numpy import scipy.signal from generate import * def generate(): def gentaps(n): b, a = scipy.signal.butter(n - 1, 0.5) return b.astype(numpy.float32), a.astype(numpy.float32) def process(b_taps, a_taps, x): ...
tools/make_patches.py
jiskra/openmv
1,761
12756050
#!/usr/bin/env python2 # This file is part of the OpenMV project. # # Copyright (c) 2013-2021 <NAME> <<EMAIL>> # Copyright (c) 2013-2021 <NAME> <<EMAIL>> # # This work is licensed under the MIT license, see the file LICENSE for details. # # This script creates smaller patches from images. import os, sys import argpars...
notebooks/solutions/03A_faces_plot.py
agramfort/scipy-2017-sklearn
659
12756051
<gh_stars>100-1000 faces = fetch_olivetti_faces() # set up the figure fig = plt.figure(figsize=(6, 6)) # figure size in inches fig.subplots_adjust(left=0, right=1, bottom=0, top=1, hspace=0.05, wspace=0.05) # plot the faces: for i in range(64): ax = fig.add_subplot(8, 8, i + 1, xticks=[], yticks=[]) ax.imsho...
lib/galaxy/model/migrate/versions/0164_page_format.py
rikeshi/galaxy
1,085
12756063
<reponame>rikeshi/galaxy """ Adds page content format. """ import datetime import logging from sqlalchemy import Column, MetaData from galaxy.model.custom_types import TrimmedString from galaxy.model.migrate.versions.util import add_column, drop_column now = datetime.datetime.utcnow log = logging.getLogger(__name__)...
examples/python/scripted_step.py
nathawes/swift-lldb
427
12756110
<filename>examples/python/scripted_step.py ############################################################################# # This script contains two trivial examples of simple "scripted step" classes. # To fully understand how the lldb "Thread Plan" architecture works, read the # comments at the beginning of ThreadPlan....
zfit/constraint.py
nsahoo/zfit
129
12756131
# Copyright (c) 2021 zfit import tensorflow as tf from .core.constraint import (GaussianConstraint, PoissonConstraint, SimpleConstraint, LogNormalConstraint) from .util import ztyping __all__ = ["nll_gaussian", "SimpleConstraint", "GaussianConstraint", "PoissonConstraint", "LogNormalCo...
aliyun-python-sdk-eipanycast/aliyunsdkeipanycast/request/v20200309/AllocateAnycastEipAddressRequest.py
yndu13/aliyun-openapi-python-sdk
1,001
12756144
# 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"); you may not u...
scripts/external_libs/scapy-2.4.3/scapy/arch/windows/native.py
timgates42/trex-core
956
12756162
# This file is part of Scapy # See http://www.secdev.org/projects/scapy for more information # Copyright (C) <NAME> <<EMAIL>> # Copyright (C) <NAME> <<EMAIL>> # This program is published under a GPLv2 license """ Native Microsoft Windows sockets (L3 only) ## Notice: ICMP packets DISCLAIMER: Please use Npcap/Winpcap ...
nose2/tests/functional/support/such/test_such_timing.py
deeplow/nose2
637
12756179
<reponame>deeplow/nose2 import time from nose2.tools import such def slow_blocking_init(): print("YEAH2") time.sleep(1) print("a second elapsed") time.sleep(1) print("a second elapsed") return True class Layer1(object): description = "Layer1 description" @classmethod def setUp...
scratchpad/issues_streamlit/issue_cannot_cache_class_method.py
R-fred/awesome-streamlit
1,194
12756185
<reponame>R-fred/awesome-streamlit import streamlit as st class App: def run(self): st.title("Cannot st.cache classmethod issue") App.get_data1() st.info("data1 loaded") self.get_data2() st.info("data2 loaded") @classmethod @st.cache def get_data1(cls): ...
keras/legacy_tf_layers/migration_utils_test.py
tsheaff/keras
37,222
12756192
"""Tests for migration_utils.""" from keras.initializers import GlorotUniform as V2GlorotUniform from keras.legacy_tf_layers import migration_utils import tensorflow as tf class DeterministicRandomTestToolTest(tf.test.TestCase): def test_constant_mode_no_seed(self): """Test random tensor generation consistanc...
build/python/tests/lib/lib.py
allansrc/fuchsia
210
12756252
#!/usr/bin/env python3.8 # Copyright 2021 The Fuchsia Authors. All rights reserved. # Use of this source code is governed by a BSD-style license that can be # found in the LICENSE file. def f(): print('lib.f') def truthy(): return True def falsy(): return False
tf2_utils/main.py
NoAchache/aster
704
12756254
<filename>tf2_utils/main.py import argparse import os from typing import List import cv2 import numpy as np import tensorflow as tf from tensorflow.keras.preprocessing.text import Tokenizer from tf2_utils.inferer import Inferer TARGET_IMAGE_HEIGHT = 64 TARGET_IMAGE_WIDTH = 256 CHAR_VECTOR = "0123456789abcdefghijklmn...
tests/test_global.py
gitmoneyyy123/VintageEx
134
12756255
<filename>tests/test_global.py import unittest from vex.parsers.g_cmd import GlobalLexer class TestGlobalLexer(unittest.TestCase): def setUp(self): self.lexer = GlobalLexer() def testCanMatchFullPattern(self): actual = self.lexer.parse(r'/foo/p#') self.assertEqual(actual, ...
test/hummingbot/client/ui/test_hummingbot_cli.py
BGTCapital/hummingbot
3,027
12756256
import unittest from prompt_toolkit.widgets import Button from unittest.mock import patch, MagicMock from hummingbot.client.tab.data_types import CommandTab from hummingbot.client.ui.hummingbot_cli import HummingbotCLI from hummingbot.client.ui.custom_widgets import CustomTextArea class HummingbotCLITest(unittest.Te...
src/pytorch_metric_learning/regularizers/sparse_centers_regularizer.py
cwkeam/pytorch-metric-learning
4,357
12756265
import torch from ..distances import CosineSimilarity from ..reducers import DivisorReducer from ..utils import common_functions as c_f from .base_regularizer import BaseRegularizer class SparseCentersRegularizer(BaseRegularizer): def __init__(self, num_classes, centers_per_class, **kwargs): super().__in...
tha2/nn/backcomp/nn/conv.py
luuil/talking-head-anime-2-demo
626
12756287
<gh_stars>100-1000 from torch.nn import Conv2d, Module, Sequential, InstanceNorm2d, ReLU, ConvTranspose2d from tha2.nn.backcomp.nn.init_function import create_init_function def Conv7(in_channels: int, out_channels: int, initialization_method='he') -> Module: init = create_init_function(initialization_method) ...
test/python/algorithms/test_amplitude_estimators.py
TheGupta2012/qiskit-terra
1,599
12756290
<filename>test/python/algorithms/test_amplitude_estimators.py # This code is part of Qiskit. # # (C) Copyright IBM 2018, 2020. # # This code is licensed under the Apache License, Version 2.0. You may # obtain a copy of this license in the LICENSE.txt file in the root directory # of this source tree or at http://www.apa...
examples/tensorflow/NTM/main.py
5m477/samples-for-ai
443
12756302
<reponame>5m477/samples-for-ai from __future__ import absolute_import import importlib import tensorflow as tf from ntm_cell import NTMCell from ntm import NTM import os import re # import sh # from smart_open import smart_open import shutil from utils import pp flags = tf.app.flags flags.DEFINE_string("task", "copy...
library/source2/data_blocks/base_block.py
BlenderAddonsArchive/SourceIO
199
12756342
<reponame>BlenderAddonsArchive/SourceIO<filename>library/source2/data_blocks/base_block.py<gh_stars>100-1000 from ...utils.byte_io_mdl import ByteIO class DataBlock: def __init__(self, valve_file, info_block): from ..resource_types import ValveCompiledResource from .compiled_file_header import In...
tests/sphinx_docstrings.py
s-weigand/darglint
405
12756344
"""A collection of sphinx docstrings from the wild.""" import ast FunctionDef = ast.FunctionDef if hasattr(ast, 'AsyncFunctionDef'): FunctionDef = (ast.FunctionDef, ast.AsyncFunctionDef) def publish_msgstr(app, source, source_path, source_line, config, settings): # From https://github.com/sphinx-doc/sphinx ...
data/transcoder_evaluation_gfg/python/DECIMAL_BINARY_CONVERSION_WITHOUT_USING_ARITHMETIC_OPERATORS.py
mxl1n/CodeGen
241
12756347
<gh_stars>100-1000 # Copyright (c) 2019-present, Facebook, Inc. # All rights reserved. # # This source code is licensed under the license found in the # LICENSE file in the root directory of this source tree. # def f_gold ( n ) : if ( n == 0 ) : return "0" ; bin = "" ; while ( n > 0 ) : if (...
kitsune/questions/management/commands/auto_archive_old_questions.py
erdal-pb/kitsune
929
12756381
import logging from datetime import datetime, timedelta from django.conf import settings from django.core.management.base import BaseCommand from django.db import connection, transaction from kitsune.questions.models import Question, Answer from kitsune.search.es7_utils import index_objects_bulk log = logging.getLo...
utils/extras.py
ovichiro/sublime-boxy-theme
102
12756401
# -*- coding: utf-8 -*- """ Boxy Theme Extras """ import sublime import sublime_plugin from collections import OrderedDict NO_SELECTION = -1 SUBLIME_LINTER = 'SublimeLinter' PLAIN_TASKS = 'PlainTasks' PLAIN_NOTES = 'PlainNotes' EXTRAS = OrderedDict( [ ( 'PlainNotes', { ...
phi/jax/__init__.py
eliasdjo/PhiFlow
556
12756415
""" Jax integration. Importing this module registers the Jax backend with `phi.math`. Without this, Jax tensors cannot be handled by `phi.math` functions. To make Jax the default backend, import `phi.jax.flow`. """ from phi import math as _math from ._jax_backend import JaxBackend as _JaxBackend JAX = _JaxBackend()...
demo/cict_demo/collect_pm.py
timothijoe/DI-drive
219
12756478
<reponame>timothijoe/DI-drive import numpy as np import cv2 import carla from camera.parameters import CameraParams, IntrinsicParams, ExtrinsicParams from camera.coordinate_transformation import CoordinateTransformation, rotationMatrix3D def rad_lim(rad): while (rad > np.pi): rad -= (2 * np.pi) while ...
main.py
cyy0523xc/chineseocr
5,049
12756486
<reponame>cyy0523xc/chineseocr #!/usr/bin/env python3 # -*- coding: utf-8 -*- """ Created on Sun Aug 4 01:01:37 2019 main @author: chineseocr """ from text.detector.detectors import TextDetector from apphelper.image import rotate_cut_img,sort_box import numpy as np from PIL import Image class TextOcrModel(object): ...
loss/SoftTriple.py
ZhenGong1997/SoftTriple
181
12756501
# Implementation of SoftTriple Loss import math import torch import torch.nn as nn import torch.nn.functional as F from torch.nn.parameter import Parameter from torch.nn import init class SoftTriple(nn.Module): def __init__(self, la, gamma, tau, margin, dim, cN, K): super(SoftTriple, self).__init__() ...
crabageprediction/venv/Lib/site-packages/pandas/tests/indexes/timedeltas/test_pickle.py
13rianlucero/CrabAgePrediction
28,899
12756513
<filename>crabageprediction/venv/Lib/site-packages/pandas/tests/indexes/timedeltas/test_pickle.py from pandas import timedelta_range import pandas._testing as tm class TestPickle: def test_pickle_after_set_freq(self): tdi = timedelta_range("1 day", periods=4, freq="s") tdi = tdi._with_freq(None) ...
var/spack/repos/builtin/packages/ply/package.py
kkauder/spack
2,360
12756527
# Copyright 2013-2021 Lawrence Livermore National Security, LLC and other # Spack Project Developers. See the top-level COPYRIGHT file for details. # # SPDX-License-Identifier: (Apache-2.0 OR MIT) from spack import * class Ply(AutotoolsPackage): """A light-weight dynamic tracer for Linux that leverages the k...
tests/unit/v1/test_base_query.py
anna-hope/python-firestore
140
12756536
<gh_stars>100-1000 # Copyright 2017 Google LLC All rights reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by a...
tools/save_pretrained_model.py
gcunhase/tensorflow-onnx
1,473
12756537
<gh_stars>1000+ # SPDX-License-Identifier: Apache-2.0 """ Save pre-trained model. """ import tensorflow as tf import numpy as np # pylint: disable=redefined-outer-name,reimported,import-outside-toplevel def save_pretrained_model(sess, outputs, feeds, out_dir, model_name="pretrained"): """Save pretrained model ...
tests/enterprise/test_malware.py
frbor/pyattck
377
12756551
def test_malware_have_actors(attck_fixture): """ All MITRE Enterprise ATT&CK Malware should have Actors Args: attck_fixture ([type]): our default MITRE Enterprise ATT&CK JSON fixture """ for malware in attck_fixture.enterprise.malwares: if malware.actors: assert getattr(...
gluoncv/torch/data/transforms/instance_transforms/augmentation.py
RafLit/gluon-cv
5,447
12756556
# -*- coding: utf-8 -*- # adapted from https://github.com/facebookresearch/detectron2/blob/master/detectron2/data/transforms/augmentation.py import sys import inspect import random import numpy as np import pprint from abc import ABCMeta, abstractmethod from typing import List, Optional, Tuple, Union from PIL import Im...
bcs-ui/backend/iam/permissions/resources/namespace.py
schneesu/bk-bcs
599
12756570
# -*- coding: utf-8 -*- """ Tencent is pleased to support the open source community by making 蓝鲸智云PaaS平台社区版 (BlueKing PaaS Community Edition) available. Copyright (C) 2017-2021 TH<NAME>, a Tencent company. All rights reserved. Licensed under the MIT License (the "License"); you may not use this file except in complianc...
jobsapp/migrations/0010_auto_20201107_1404.py
astaqc/django-job-portal
348
12756586
# Generated by Django 3.0.7 on 2020-11-07 14:04 from django.db import migrations, models class Migration(migrations.Migration): dependencies = [ ('jobsapp', '0009_favorite'), ] operations = [ migrations.AddField( model_name='applicant', name='comment', ...
smarts/core/lidar.py
idsc-frazzoli/SMARTS
554
12756590
# Copyright (C) 2020. Huawei Technologies Co., Ltd. All rights reserved. # # 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 us...
tests/macro/scripts/MPI/np_point_to_point.py
dina-fouad/pyccel
206
12756594
<reponame>dina-fouad/pyccel<filename>tests/macro/scripts/MPI/np_point_to_point.py # pylint: disable=missing-function-docstring, missing-module-docstring/ from mpi4py import MPI from numpy import zeros from numpy import ones if __name__ == '__main__': rank = -1 comm = MPI.COMM_WORLD rank = comm.Get_rank() ...
spot_micro_joy/scripts/spotMicroJoystickMove.py
zoltan0907/spotMicro
1,563
12756606
#!/usr/bin/python import rospy from std_msgs.msg import Float32, Bool from sensor_msgs.msg import Joy from geometry_msgs.msg import Vector3 from geometry_msgs.msg import Twist from math import pi class SpotMicroJoystickControl(): BUTTON_IDLE = 0 BUTTON_WALK = 1 BUTTON_STAND = 2 BUTTON_ANGLE = 3 ...
models/SemanticSegmentation/ICNet.py
Dou-Yu-xuan/deep-learning-visal
150
12756627
# !/usr/bin/env python # -- coding: utf-8 -- # @Time : 2020/10/28 16:41 # @Author : liumin # @File : ICNet.py import torch import torch.nn as nn import torch.nn.functional as F import torchvision __all__ = ["ICNet"] def Conv1x1BN(in_channels,out_channels): return nn.Sequential( nn.Co...
chrome/test/security_tests/security_tests.gyp
nagineni/chromium-crosswalk
231
12756629
<filename>chrome/test/security_tests/security_tests.gyp # Copyright (c) 2009 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. { 'variables': { 'chromium_code': 1, }, 'targets': [ { 'target_name': 'securi...
jina/types/document/helper.py
arijitdas123student/jina
15,179
12756641
import functools from typing import Iterable, List __all__ = ['DocGroundtruthPair'] if False: from . import Document class DocGroundtruthPair: """ Helper class to expose common interface to the traversal logic of the BaseExecutable Driver. It is important to note that it checks the matching structur...
nlp_gym/core_components/embeddings.py
lipucky/nlp-gym
120
12756657
<gh_stars>100-1000 from flair.embeddings import DocumentPoolEmbeddings, WordEmbeddings import flair import torch flair.device = torch.device('cpu') class DocEmbeddings: __instance = None @staticmethod def getInstance(): """ Static access method. """ if DocEmbeddings.__instance is None: ...
examples/eventget.py
hirnimeshrampuresoftware/python-tcod
231
12756665
#!/usr/bin/env python3 # To the extent possible under law, the libtcod maintainers have waived all # copyright and related or neighboring rights for this example. This work is # published from: United States. # https://creativecommons.org/publicdomain/zero/1.0/ """An demonstration of event handling using the tcod.even...
examples/example_network_info.py
seth586/lndmanage
166
12756717
<gh_stars>100-1000 from lndmanage.lib.network_info import NetworkAnalysis from lndmanage.lib.node import LndNode from lndmanage import settings import logging.config logging.config.dictConfig(settings.logger_config) logger = logging.getLogger(__name__) if __name__ == '__main__': node = LndNode() network_analy...
CircuitPython_Heart_Sculpture/code.py
gamblor21/Adafruit_Learning_System_Guides
665
12756793
<reponame>gamblor21/Adafruit_Learning_System_Guides<filename>CircuitPython_Heart_Sculpture/code.py import time import adafruit_dotstar from rainbowio import colorwheel import board import touchio pixel = adafruit_dotstar.DotStar(board.APA102_SCK, board.APA102_MOSI, 1, brightness=.1) touch = touchio.TouchIn(board.D1) ...
epitran/test/test_farsi.py
dwijap/epitran
422
12756863
<gh_stars>100-1000 # -*- coding: utf-8 -*- from __future__ import unicode_literals import unittest import epitran class TestSorani(unittest.TestCase): def setUp(self): self.epi = epitran.Epitran(u'fas-Arab') def test_faarsi(self): tr = self.epi.transliterate('فارسی') self.assertEqu...
python/tests/test_dump.py
JX7P/libucl
1,301
12756880
from .compat import unittest import ucl import sys class DumpTest(unittest.TestCase): def test_no_args(self): with self.assertRaises(TypeError): ucl.dump() def test_none(self): self.assertEqual(ucl.dump(None), None) def test_null(self): data = { "a" : None } va...
test/unit/agent/objects/nginx/filters.py
dp92987/nginx-amplify-agent
308
12756883
<reponame>dp92987/nginx-amplify-agent<filename>test/unit/agent/objects/nginx/filters.py # -*- coding: utf-8 -*- import re from hamcrest import * from amplify.agent.objects.nginx.filters import Filter from test.base import BaseTestCase __author__ = "<NAME>" __copyright__ = "Copyright (C) Nginx, Inc. All rights reserv...
examples/voc/evaluate.py
pazeshun/fcn
251
12756902
#!/usr/bin/env python import argparse import os.path as osp import re import chainer from chainer import cuda import fcn import numpy as np import tqdm def main(): parser = argparse.ArgumentParser() parser.add_argument('model_file') parser.add_argument('-g', '--gpu', default=0, type=int, ...
tests/test_fit_result.py
pckroon/symfit
192
12756930
# SPDX-FileCopyrightText: 2014-2020 <NAME> # # SPDX-License-Identifier: MIT from __future__ import division, print_function import pytest import pickle from collections import OrderedDict import numpy as np from symfit import ( Variable, Parameter, Fit, FitResults, Eq, Ge, CallableNumericalModel, Model ) from sym...
tests/test_http_proxy.py
sentyaev/pact-python
428
12756934
<reponame>sentyaev/pact-python from unittest import TestCase from pact.http_proxy import app from fastapi.testclient import TestClient client = TestClient(app) class HttpProxyTestCase(TestCase): def test_ping(self): res = client.get('/ping') self.assertEqual(res.status_code, 200) assert r...
imago/imago.py
jdfrid/imago-forensics
208
12756944
#!/usr/bin/env python # -*- coding: utf-8 -*- import os,sys import argparse import extractor import helper from os import walk def main(args=None): print """\ ################################################## # imago.py # # Digital evidences from images! # # Mad...
models/nerf_utils.py
tjtanaa/ml-gsn
202
12757004
<reponame>tjtanaa/ml-gsn<gh_stars>100-1000 # Adapted from https://github.com/krrish94/nerf-pytorch import torch from einops import repeat def meshgrid_xy(tensor1: torch.Tensor, tensor2: torch.Tensor) -> (torch.Tensor, torch.Tensor): """Mimick np.meshgrid(..., indexing="xy") in pytorch. torch.meshgrid only allows...
project/1-process_data/CSVtolabel.py
ScottAI/2016CCF_BDCI_Sougou
214
12757028
# coding=utf-8 """ 根据上一步骤得到的CSV文件,将搜索文本以及三个属性剥离,保存为相应的文件 注意路径 """ import pandas as pd #path of the train and test files trainname = 'user_tag_query.10W.TRAIN.csv' testname = 'user_tag_query.10W.TEST.csv' data = pd.read_csv(trainname) print data.info() #generate three labels for age/gender/education data.age.to_csv("...
test/dlc_tests/container_tests/bin/security_checks.py
Elizaaaaa/deep-learning-containers
383
12757041
import sys import logging import os import time import calendar LOGGER = logging.getLogger(__name__) logging.basicConfig(stream=sys.stdout, level=logging.DEBUG) def main(): home_dir = os.path.expanduser('~') check_that_cache_dir_is_removed(home_dir) check_that_global_tmp_dir_is_empty() check_vim_info_...
ivy/array/wrapping.py
VedPatwardhan/ivy
681
12757066
<reponame>VedPatwardhan/ivy # local import ivy # global from typing import Callable, Type, List, Iterable, Optional from types import ModuleType def _wrap_function(function_name: str) -> Callable: """Wraps the function called `function_name`. Parameters ---------- function_name the name of t...
hayaku_get_merged_dict.py
hayaku/hayaku
369
12757107
<filename>hayaku_get_merged_dict.py # -*- coding: utf-8 -*- import os def import_dir(name, fromlist=()): PACKAGE_EXT = '.sublime-package' dirname = os.path.basename(os.path.dirname(os.path.realpath(__file__))) if dirname.endswith(PACKAGE_EXT): dirname = dirname[:-len(PACKAGE_EXT)] return __impo...
RecoLocalCalo/HcalRecProducers/python/hfQIE10Reco_cfi.py
Purva-Chaudhari/cmssw
852
12757129
import FWCore.ParameterSet.Config as cms import RecoLocalCalo.HcalRecProducers.hfsimplereco_cfi as _mod hfQIE10Reco = _mod.hfsimplereco.clone( digiLabel = "simHcalUnsuppressedDigis:HFQIE10DigiCollection", Subdetector = 'HFQIE10', firstSample = 2, samplesToAdd = 1 )
drivers/phantomjs.py
RajatNair/the-endorser
309
12757162
import os from drivers import IPHONE_UA from selenium import webdriver from selenium.webdriver.common.desired_capabilities import DesiredCapabilities def get(driver_path): if not os.path.exists(driver_path): raise FileNotFoundError("Could not find phantomjs executable at %s. Download it for your platform ...
mmdet/datasets/samplers/__init__.py
Karybdis/mmdetection-mini
834
12757206
from .group_sampler import GroupSampler __all__ = ['GroupSampler']
datasets/germaner/germaner.py
dkajtoch/datasets
10,608
12757227
<gh_stars>1000+ # coding=utf-8 # Copyright 2020 HuggingFace Datasets 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 req...
venv/Lib/site-packages/nipype/interfaces/afni/tests/test_auto_Qwarp.py
richung99/digitizePlots
585
12757240
<reponame>richung99/digitizePlots # AUTO-GENERATED by tools/checkspecs.py - DO NOT EDIT from ..preprocess import Qwarp def test_Qwarp_inputs(): input_map = dict( Qfinal=dict( argstr="-Qfinal", ), Qonly=dict( argstr="-Qonly", ), allineate=dict( ...
data/allface_dataset.py
bruinxiong/Rotate-and-Render
397
12757251
import os import math import numpy as np from PIL import Image import skimage.transform as trans import cv2 import torch from data import dataset_info from data.base_dataset import BaseDataset import util.util as util dataset_info = dataset_info() class AllFaceDataset(BaseDataset): @staticmethod def modify_co...
app/YtManager/settings.py
chibicitiberiu/ytsm
298
12757254
""" Django settings for YtManager project. Generated by 'django-admin startproject' using Django 1.11.11. For more information on this file, see https://docs.djangoproject.com/en/1.11/topics/settings/ For the full list of settings and their values, see https://docs.djangoproject.com/en/1.11/ref/settings/ """ import...
tests/test_cms_auth.py
Allen7D/mini-shop-server
533
12757266
# _*_ coding: utf-8 _*_ """ Created by Allen7D on 2020/4/13. """ from app import create_app from tests.utils import get_authorization __author__ = 'Allen7D' app = create_app() def test_create_auth_list(): with app.test_client() as client: rv = client.post('/cms/auth/append', headers={ 'Aut...
components/contrib/CatBoost/Train_classifier/from_CSV/component.py
Iuiu1234/pipelines
2,860
12757269
<reponame>Iuiu1234/pipelines from kfp.components import InputPath, OutputPath, create_component_from_func def catboost_train_classifier( training_data_path: InputPath('CSV'), model_path: OutputPath('CatBoostModel'), starting_model_path: InputPath('CatBoostModel') = None, label_column: int = 0, los...
Code/tests/test_expand_repo.py
macmule/autopkg
855
12757275
<reponame>macmule/autopkg #!/usr/local/autopkg/python # # 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 ...
13-protocol-abc/double/double_test.py
SeirousLee/example-code-2e
990
12757320
<filename>13-protocol-abc/double/double_test.py from typing import TYPE_CHECKING import pytest from double_protocol import double def test_double_int() -> None: given = 2 result = double(given) assert result == given * 2 if TYPE_CHECKING: reveal_type(given) reveal_type(result) def tes...
dpkt/edp.py
Vito-Swift/dpkt
924
12757325
<gh_stars>100-1000 """Extreme Discovery Protocol.""" from __future__ import absolute_import import dpkt class EDP(dpkt.Packet): __hdr__ = ( ('version', 'B', 1), ('reserved', 'B', 0), ('hlen', 'H', 0), ('sum', 'H', 0), ('seq', 'H', 0), ('mid', 'H', 0), ('mac...
scripts/setJson.py
TadeasPilar/KiKit
784
12757343
<reponame>TadeasPilar/KiKit #!/usr/bin/env python3 import click import json from collections import OrderedDict def setKey(obj, path, value): key = path[0] if isinstance(obj, dict) else int(path[0]) if len(path) == 1: obj[key] = value return setKey(obj[key], path[1:], value) @click.comman...
test/functional/feature_mandatory_coinbase.py
nondejus/elements
947
12757344
#!/usr/bin/env python3 # Copyright (c) 2014-2018 The Bitcoin Core developers # Distributed under the MIT software license, see the accompanying # file COPYING or http://www.opensource.org/licenses/mit-license.php. """Test mandatory coinbase feature""" from binascii import b2a_hex from test_framework.blocktools import...
tools/translation/helper/sanity_check.py
zealoussnow/chromium
14,668
12757348
# Copyright 2019 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. """Sanity checking for grd_helper.py. Run manually before uploading a CL.""" import io import os import subprocess import sys # Add the parent dir so that w...
blackmamba/lib/future/moves/subprocess.py
oz90210/blackmamba
2,151
12757363
from __future__ import absolute_import from future.utils import PY2, PY26 from subprocess import * if PY2: __future_module__ = True from commands import getoutput, getstatusoutput if PY26: from future.backports.misc import check_output
cyvcf2/tests/test_hemi.py
leoisl/cyvcf2
307
12757382
import numpy as np from cyvcf2 import VCF, Variant, Writer import os.path HERE = os.path.dirname(__file__) HEM_PATH = os.path.join(HERE, "test-hemi.vcf") VCF_PATH = os.path.join(HERE, "test.vcf.gz") def check_var(v): s = [x.split(":")[0] for x in str(v).split("\t")[9:]] lookup = {'0/0': 0, '0/1': 1, './1': ...
lib/node/utils.py
AnonymouzAuthorz/RevisitingTabularDL
298
12757393
<reponame>AnonymouzAuthorz/RevisitingTabularDL<gh_stars>100-1000 # Source: https://github.com/Qwicen/node import contextlib import gc import glob import hashlib import os import time import numpy as np import requests import torch from tqdm import tqdm def download(url, filename, delete_if_interrupted=True, chunk_si...