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 |
|---|---|---|---|---|---|---|---|---|---|---|
clinicadl/tests/test_preprocessing.py | yogeshmj/AD-DL | 112 | 3206394 | # coding: utf8
def test_preprocessing_t1w():
from clinicadl.preprocessing.T1_lineal import preprocessing_t1w
bids_dir = './test/bids/'
caps_dir = './test/caps/'
tsv_file = './test/subjects.tsv'
working_dir = './test/working_dir'
nproc = 2
wf = preprocessing_t1w(args.bids_directory,
... | 0 | 0 | 0 | 0 | 0 | 0 |
sknetwork/linalg/basics.py | HerrZYZ/scikit-network | 457 | 3206401 | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Created on Apr 2020
@author: <NAME> <<EMAIL>>
"""
import numpy as np
from scipy import sparse
from scipy.sparse.linalg import LinearOperator
def safe_sparse_dot(a, b) -> object:
"""Dot product with proper use of the sparse matrix format.
Use BLAS instead of ... | 0 | 1 | 0 | 0 | 1 | 0 |
Trakttv.bundle/Contents/Libraries/Shared/CodernityDB/sharded_hash.py | disrupted/Trakttv.bundle | 1,346 | 3206423 | #!/usr/bin/env python
# -*- coding: utf-8 -*-
#
# Copyright 2011-2013 Codernity (http://codernity.com)
#
# 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/L... | 1 | 11 | 3 | 0 | 15 | 0 |
cape_privacy/spark/transformations/perturbation.py | vismaya-Kalaiselvan/cape-python | 144 | 3206434 | <reponame>vismaya-Kalaiselvan/cape-python
from typing import Optional
from typing import Tuple
from typing import Union
import numpy as np
import pandas as pd
from pyspark import sql
from pyspark.sql import functions
from cape_privacy.spark import dtypes
from cape_privacy.spark.transformations import base
from cape_p... | 0 | 0 | 0 | 0 | 0 | 0 |
wikidataintegrator/ref_handlers/strict_overwrite.py | JeroenDeDauw/WikidataIntegrator | 193 | 3206510 | <gh_stars>100-1000
from datetime import datetime
import copy
####
# Example custom ref handler
# Always replaces all old refs with new refs
####
def strict_overwrite(olditem, newitem):
# modifies olditem in place!!!
olditem.references = newitem.references | 0 | 0 | 0 | 0 | 0 | 0 |
uci-pharmsci/lectures/MD/completed_code.py | inferential/drug-computing | 103 | 3206565 | <gh_stars>100-1000
# Completed code for MD sandbox 1D oscillator example
energy, Forces = calcenergyforces( Pos, M, L, Cut, Forces )
Pos, Vel, Accel, KEnergy, PEnergy = vvintegrate( Pos, Vel, Forces, M, L, Cut, dt )
Pos_t[:,:,i] = Pos
| 0 | 0 | 0 | 0 | 0 | 0 |
DaPy/core/DataSet.py | huihui7987/DaPy | 552 | 3206567 | <filename>DaPy/core/DataSet.py
from collections import Counter, Iterator, namedtuple
from copy import copy
from functools import wraps
from operator import methodcaller
from os.path import isfile
from pprint import pprint
from time import clock
from .base import (PYTHON3, Frame, LogErr, LogInfo, Matrix, Series,
... | 0 | 0 | 0 | 0 | 0 | 0 |
two_sample/mmd_test.py | Nirngen/opt-mmd | 170 | 3206583 | '''
Helper to perform MMD tests.
Assumes you have the feature/bigtest branch of shogun installed (including the
modular Python bindings).
'''
from __future__ import division, print_function
import os
import numpy as np
from scipy import linalg, stats
try:
import modshogun as sg
except ImportError: # new versions... | 6 | 3 | 0 | 0 | 9 | 0 |
utils/deduplicate.py | Emiliano978/twarc | 1,011 | 3206607 | <reponame>Emiliano978/twarc
#!/usr/bin/env python
"""
Given a JSON file, remove any tweets with duplicate IDs.
Optionally, this will extract retweets. (That is, for a retweet
use tweet from retweeted_status and retweet.)
Example usage:
utils/deduplicate.py tweets.jsonl > tweets_deduped.jsonl
"""
from __future__ impo... | 0 | 0 | 0 | 0 | 0 | 0 |
recipes/Python/577265_Anagrams_vowels_and_consonants/recipe-577265.py | tdiprima/code | 2,023 | 3206639 | #On the name of ALLAH and may the blessing and peace of Allah
#be upon the Messenger of <NAME> <NAME>.
#Author : <NAME>
#Date : 15/06/10
#version :2.6
from string import *
from itertools import *
"""
My program uses special functions to test, count, and extract vowels and consonants.
However,the string_check functio... | 0 | 0 | 0 | 0 | 0 | 0 |
libs/timing_utils.py | phc-health/covid-data-model | 155 | 3206662 | from typing import Optional
import time as time_stdlib
import structlog
import contextlib
_logger = structlog.get_logger()
@contextlib.contextmanager
def time(description: Optional[str] = None, **logging_args):
start = time_stdlib.time()
yield
elapsed = time_stdlib.time() - start
_logger.info(f"Elap... | 1 | 0 | 0 | 0 | 1 | 0 |
fboss/util/find_files_not_built_in_oss.py | nathanawmk/fboss | 834 | 3206713 | #!/usr/bin/env python3
# Run as python3 find_files_not_in_fboss.py
#
#
# This scripts finds files that are open sourced but *not* built in open
# source. It works as follows:
# - recursively traverse to find all open sourced files under fboss directory
# - parse all cmakes to find the files are built.
# - diff a... | 0 | 3 | 0 | 0 | 3 | 0 |
cisco-ios-xr/ydk/models/cisco_ios_xr/nc_notifications.py | CiscoDevNet/ydk-py | 177 | 3206760 | <filename>cisco-ios-xr/ydk/models/cisco_ios_xr/nc_notifications.py
""" nc_notifications
Conversion of the 'manageEvent' XSD in the NETCONF
Notifications RFC.
"""
import sys
from collections import OrderedDict
from ydk.types import Entity as _Entity_
from ydk.types import EntityPath, Identity, Enum, YType, YLeaf, YL... | 0 | 0 | 0 | 0 | 0 | 0 |
telegram_bot_examples/common.py | gil9red/SimplePyScripts | 117 | 3206785 | <reponame>gil9red/SimplePyScripts<filename>telegram_bot_examples/common.py
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
__author__ = 'ipetrash'
import functools
import logging
import os
import sys
import re
import time
from pathlib import Path
from typing import Callable, List
from telegram import Update
from te... | 0 | 0 | 0 | 0 | 0 | 0 |
Chapter06/read_metadata1.py | add54/ADMIN_SYS_PYTHON | 116 | 3206786 | <reponame>add54/ADMIN_SYS_PYTHON<gh_stars>100-1000
import zipfile
def meta_info(names):
with zipfile.ZipFile(names) as zf:
for info in zf.infolist():
print(info.filename)
if info.create_system == 0:
system = 'Windows'
elif info.create_system == 3:
system = 'Unix'
else:
system = 'UNKNOWN'
p... | 0 | 0 | 0 | 0 | 0 | 0 |
tests/test_var.py | oaxiom/NucleoATAC | 101 | 3206800 | from unittest import TestCase
import numpy as np
import nucleoatac.NucleosomeCalling as Nuc
import pyatac.VMat as V
from pyatac.chunkmat2d import BiasMat2D
from pyatac.chunk import ChunkList
from pyatac.bias import InsertionBiasTrack
class Test_variance(TestCase):
"""class for testing variance calculation on back... | 0 | 0 | 0 | 0 | 0 | 0 |
venv/lib/python3.6/site-packages/skvideo/tests/test_vreader.py | mesquitadev/grpc | 615 | 3206871 | from numpy.testing import assert_equal
import numpy as np
import skvideo.io
import skvideo.datasets
import sys
if sys.version_info < (2, 7):
import unittest2 as unittest
else:
import unittest
def _vreader(backend):
reader = skvideo.io.vreader(skvideo.datasets.bigbuckbunny(), backend=backend)
T = 0
... | 0 | 1 | 0 | 0 | 1 | 0 |
corehq/apps/sms/migrations/0047_merge_20200918_1641.py | dimagilg/commcare-hq | 471 | 3206913 | # Generated by Django 2.2.13 on 2020-09-18 16:41
from django.db import migrations
class Migration(migrations.Migration):
dependencies: list[tuple[str, str]] = [
('sms', '0046_keywords_linked_domain_fields'),
('sms', '0046_delete_selfregistrationinvitation'),
]
operations: list[object] =... | 0 | 0 | 2 | 0 | 2 | 0 |
tdda/constraints/examples/accounts_verify_25k_to_frame.py | robertn01/tdda | 232 | 3206915 | <gh_stars>100-1000
# accounts_verify_25k_against_1k.py
from __future__ import print_function
import pandas as pd
from tdda.constraints.pd.constraints import verify_df
df = pd.read_csv('testdata/accounts25k.csv')
v = verify_df(df, 'accounts1k.tdda')
vdf = v.to_frame()
print(vdf)
| 0 | 0 | 0 | 0 | 0 | 0 |
examples/cnn/resnet50.py | FrostByte266/neupy | 801 | 3206933 | <filename>examples/cnn/resnet50.py<gh_stars>100-1000
import os
from neupy import storage, architectures
from imagenet_tools import (CURRENT_DIR, FILES_DIR, load_image,
print_top_n, download_file)
RESNET50_WEIGHTS_FILE = os.path.join(FILES_DIR, 'resnet50.hdf5')
DOG_IMAGE_PATH = os.path.jo... | 0 | 0 | 0 | 0 | 0 | 0 |
tests/metrics/lines_test.py | boidolr/git-code-debt | 213 | 3206936 | <filename>tests/metrics/lines_test.py
from git_code_debt.file_diff_stat import FileDiffStat
from git_code_debt.file_diff_stat import Status
from git_code_debt.metrics.lines import LinesOfCodeParser
from git_code_debt.repo_parser import BLANK_COMMIT
def test_lines_of_code_parser():
parser = LinesOfCodeParser()
... | 0 | 0 | 0 | 0 | 0 | 0 |
tests/test_gatherers_rdns.py | duckduckmuse/domain-scan | 367 | 3206985 | import pytest
from .context import gatherers # noqa
from gatherers import rdns
@pytest.mark.parametrize("data,expected", [
(
[
'{"value": "18f.gov"}',
'{"value": "123.112.18f.gov"}',
'{"value": "172.16.17.32"}',
'{"value": "u-123.112.23.23"}',
'... | 0 | 0 | 0 | 0 | 0 | 0 |
environments/mobile_robot/mobile_robot_2target_env.py | anonymous-authors-2018/robotics-repo | 524 | 3207010 | from .mobile_robot_env import *
MAX_STEPS = 1500
class MobileRobot2TargetGymEnv(MobileRobotGymEnv):
"""
Gym wrapper for Mobile Robot environment with 2 targets
WARNING: to be compatible with kuka scripts, additional keyword arguments are discarded
:param urdf_root: (str) Path to pybullet urdf files
... | 1 | 4 | 0 | 1 | 6 | 0 |
raspberrypi/fs/main.py | boochow/MicroPython-bare-rpi | 183 | 3207013 | <filename>raspberrypi/fs/main.py
import os
# from fbconsole import FBConsole
# from rpi import RPiScreen
# scr = FBConsole(RPiScreen(480,270))
# os.dupterm(scr)
| 0 | 0 | 0 | 0 | 0 | 0 |
desktop/core/ext-py/python-openid-2.2.5/openid/extensions/draft/__init__.py | kokosing/hue | 5,079 | 3207019 | """OpenID Extension modules.""" | 0 | 0 | 0 | 0 | 0 | 0 |
exercises/es/solution_02_09.py | Jette16/spacy-course | 2,085 | 3207026 | import spacy
# Carga el modelo es_core_news_md
nlp = spacy.load("es_core_news_md")
# Procesa un texto
doc = nlp("Hoy hice pan de banano")
# Obtén el vector para el token "banano"
banano_vector = doc[4].vector
print(banano_vector)
| 0 | 0 | 0 | 0 | 0 | 0 |
server/app_stylize.py | mahmoudeid789/sketch-to-art | 161 | 3207067 | from __future__ import annotations
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
# coding=utf-8
import stylize
import os
import base64
import json
import re
import time
import glob
import shutil
from io import BytesIO
from PIL import Image
# Flask utils... | 0 | 6 | 0 | 0 | 6 | 0 |
tests/all_utils_tests.py | rgov/pypylon | 358 | 3207164 | #!/usr/bin/env python
import unittest
import os
def load_tests(loader, tests, pattern) -> object:
suite = unittest.defaultTestLoader.discover( os.path.join(thisdir, 'pylon_tests', 'utils'), pattern='*test.py')
return suite
if __name__ == "__main__":
unittest.main() | 0 | 1 | 0 | 0 | 1 | 0 |
src/beanmachine/ppl/experimental/vi/__init__.py | facebookresearch/beanmachine | 177 | 3207193 | <reponame>facebookresearch/beanmachine
# Copyright (c) Meta Platforms, Inc. and affiliates.
#
# This source code is licensed under the MIT license found in the
# LICENSE file in the root directory of this source tree.
from .autoguide import ADVI, MAP
from .variational_infer import VariationalInfer
__all__ = [
"AD... | 0 | 0 | 0 | 0 | 0 | 0 |
mongomock/read_concern.py | ehiggs-deliverect/mongomock | 574 | 3207194 | from __future__ import annotations
class ReadConcern(object):
def __init__(self, level: object | None=None):
self._document: dict[object,object] = {}
if level is not None:
self._document['level'] = level
@property
def level(self) -> object:
return self._document.get('le... | 1 | 4 | 0 | 1 | 6 | 0 |
tests/schema.py | s2krish/graphene-subscriptions | 117 | 3207196 | import graphene
from graphene_django.types import DjangoObjectType
from rx import Observable
from graphene_subscriptions.events import CREATED, UPDATED, DELETED
from tests.models import SomeModel
CUSTOM_EVENT = "custom_event"
class SomeModelType(DjangoObjectType):
class Meta:
model = SomeModel
class... | 0 | 5 | 0 | 0 | 5 | 0 |
trixi/__init__.py | MIC-DKFZ/trixi | 218 | 3207247 | try:
use_agg = False
import matplotlib
if use_agg:
matplotlib.use("Agg", warn=False)
except Exception:
print("Failed to import matplotlib")
__version__ = "0.1.2.2"
| 0 | 0 | 0 | 0 | 0 | 0 |
pycroscopy/signal/__init__.py | itsalexis962/pycroscopy | 191 | 3207279 | """
Signal Processing tools - again, generic.
Could contain
- filtering
- peak finding
- moving average
- integration
- derivation
- outlier removal
- transforms
Submodules
----------
.. autosummary::
:toctree: _autosummary
""" | 0 | 0 | 0 | 0 | 0 | 0 |
alipay/aop/api/domain/AlipayEbppInvoiceMerchantlistEnterApplyModel.py | snowxmas/alipay-sdk-python-all | 213 | 3207295 | #!/usr/bin/env python
# -*- coding: utf-8 -*-
from __future__ import annotations
import json
from alipay.aop.api.constant.ParamConstants import *
from alipay.aop.api.domain.MerchantBaseEnterOpenModel import MerchantBaseEnterOpenModel
from alipay.aop.api.domain.SubMerchantCommonEnterOpenModel import SubMerchantCommonEn... | 0 | 5 | 0 | 3 | 8 | 0 |
docs/examples/use_cases/pytorch/single_stage_detector/main.py | cyyever/DALI | 3,967 | 3207296 | import os
import sys
import time
from argparse import ArgumentParser
import math
import numpy as np
import time
import torch
from torch.optim.lr_scheduler import MultiStepLR
import torch.utils.data.distributed
from src.model import model, Loss
from src.utils import dboxes300_coco, Encoder
from src.evaluate import ev... | 1 | 4 | 0 | 3 | 8 | 0 |
lfw_test.py | WilsonWeng-hub/Python-Tensorflow-Face-v2.0 | 117 | 3207306 | from face_lib import my_api, inference
import csv
import multiprocessing
import tensorflow as tf
class LFW_TEST:
def __init__(self,sia,se):
self.sia = sia
self.se = se
def csv_write(self,path, data):
out_test = open(path, 'w', newline='')
csv_test_writer = csv.writer(out_test,... | 1 | 1 | 0 | 0 | 2 | 0 |
tests/logical.py | marcinz/cunumeric | 118 | 3207308 | <gh_stars>100-1000
# Copyright 2021 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/licenses/LICENSE-2.0
#
# Unless required by applicable law... | 0 | 0 | 0 | 0 | 0 | 0 |
src/image_quality/train/plot_train.py | junyongyou/sca_iqa | 105 | 3207329 | import matplotlib.pyplot as plt
import os
def get_all_metrics(history) -> object:
metrics = set()
for metric in history.history:
if 'val_' in metric:
metric = metric.replace(metric, 'val_')
metrics.add(metric)
return metrics
def plot_history(history, result_dir, prefix):
... | 0 | 1 | 0 | 0 | 1 | 0 |
src/pyfluid/pybindings.py | NTForked/GridFluidSim3D | 761 | 3207349 | <reponame>NTForked/GridFluidSim3D
from .pyfluid import pyfluid as lib
from ctypes import c_char_p, c_int, byref
def check_success(success, errprefix):
libfunc = lib.CBindings_get_error_message
init_lib_func(libfunc, [], c_char_p)
if not success:
raise RuntimeError(errprefix + libfunc())
def init_l... | 0 | 0 | 0 | 0 | 0 | 0 |
src/pretix/base/migrations/0061_auto_20170521_0942.py | pajowu/pretix | 1,248 | 3207366 | # -*- coding: utf-8 -*-
# Generated by Django 1.10.7 on 2017-05-21 09:42
from __future__ import unicode_literals
from django.core.cache import cache
from django.db import migrations
def rename_placeholder(app, schema_editor):
EventSettingsStore = app.get_model('pretixbase', 'Event_SettingsStore')
for settin... | 0 | 0 | 2 | 0 | 2 | 0 |
solaris/eval/scot.py | rbavery/solaris | 367 | 3207376 | <reponame>rbavery/solaris
import geopandas as gpd
import scipy.optimize
import scipy.sparse
def match_footprints(grnd_df, prop_df,
threshold=0.25, base_reward=100.):
"""
Optimal matching of ground truth footprints with proposal footprints
(for a single timestep).
Input dataframes s... | 0 | 0 | 0 | 0 | 0 | 0 |
torch_struct/cky_crf.py | chenyangh/pytorch-struct | 1,063 | 3207460 | <reponame>chenyangh/pytorch-struct
import torch
from .helpers import _Struct, Chart
A, B = 0, 1
class CKY_CRF(_Struct):
def _check_potentials(self, edge, lengths=None):
batch, N, _, NT = self._get_dimension(edge)
edge = self.semiring.convert(edge)
if lengths is None:
lengths =... | 0 | 0 | 0 | 0 | 0 | 0 |
server/amberalertcn/api/v1/lib/RequestCore.py | fuzhouch/amberalertcn | 151 | 3207462 | #!/usr/bin/python
# _*_ coding: UTF-8 _*_
###
# 本文件百度云服务PHP版本SDK的公共网络交互功能
#
# @author 百度移动.云事业部
# @copyright Copyright (c) 2012-2020 百度在线网络技术(北京)有限公司
# @version 1.0.0
# @package
##
from __future__ import annotations
import urlparse
import pycurl
import StringIO
class RequestCore(object):
"""封装curl,提供网络交互... | 6 | 4 | 5 | 16 | 31 | 0 |
Python/basicsubscribe.py | Chris-469/mq-dev-patterns | 102 | 3207476 | # -*- coding: utf-8 -*-
# Copyright 2019 IBM
#
# 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... | 0 | 2 | 0 | 0 | 2 | 0 |
python/paddle_fl/mpc/examples/model_encryption/update/update_mpc_model.py | barrierye/PaddleFL | 379 | 3207525 | # 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/licenses/LICENSE-2.0
#
# Unless required by appli... | 0 | 0 | 0 | 0 | 0 | 0 |
flybirds/core/plugin/plugins/default/screen.py | ctripcorp/flybirds | 183 | 3207526 | <filename>flybirds/core/plugin/plugins/default/screen.py
# -*- coding: utf-8 -*-
"""
Device screenshot method.
"""
import os
import time
import traceback
from base64 import b64decode
import flybirds.core.global_resource as gr
import flybirds.utils.file_helper as file_helper
import flybirds.utils.flybirds_log as log
im... | 0 | 0 | 0 | 0 | 0 | 0 |
test/cpp_extensions/setup.py | wenhaopeter/read_pytorch_code | 206 | 3207567 | <gh_stars>100-1000
import sys
import torch.cuda
import os
from setuptools import setup
from torch.utils.cpp_extension import BuildExtension, CppExtension, CUDAExtension
from torch.utils.cpp_extension import CUDA_HOME, ROCM_HOME
if sys.platform == 'win32':
vc_version = os.getenv('VCToolsVersion', '')
if vc_vers... | 0 | 0 | 0 | 0 | 0 | 0 |
scripts/tcp_starter.py | bigwater/Galois | 230 | 3207578 | import socket
import threading
import SocketServer
import time
import sys
reqs = []
num = int(sys.argv[1])
finished = 0
class ThreadedTCPRequestHandler(SocketServer.StreamRequestHandler):
def handle(self):
self.data = self.rfile.readline().strip()
cur_thread = threading.current_thread()
c... | 0 | 0 | 0 | 0 | 0 | 0 |
facets_atlasmaker/parallelize.py | winnerineast/facets | 7,209 | 3207584 | from __future__ import annotations
"""Parallelize file fetch and conversion utilities and wrappers."""
from absl import logging
from joblib import Parallel, delayed
from PIL import ImageFile
import atlasmaker_io
import convert
def get_and_convert_image(image_location, image_convert_settings,
... | 10 | 3 | 0 | 0 | 13 | 0 |
tests/engine/test_hyper_spaces.py | ChrisRBXiong/MatchZoo-py | 2,209 | 3207591 | import pytest
import hyperopt.pyll.base
from matchzoo.engine import hyper_spaces
@pytest.fixture(scope='module', params=[
lambda x: x + 2,
lambda x: x - 2,
lambda x: x * 2,
lambda x: x / 2,
lambda x: x // 2,
lambda x: x ** 2,
lambda x: 2 + x,
lambda x: 2 - x,
lambda x: 2 * x,
... | 0 | 2 | 0 | 0 | 2 | 0 |
pytorch_projects/common_pytorch/dataset/all_dataset.py | KGMSFT/integral-human-pose | 472 | 3207595 | from .imdb import IMDB
from .mpii import mpii
from .hm36 import hm36
from .hm36_eccv_challenge import hm36_eccv_challenge | 0 | 0 | 0 | 0 | 0 | 0 |
Chapter02/trace_example.py | add54/ADMIN_SYS_PYTHON | 116 | 3207601 | class Student:
def __init__(self, std):
self.count = std
def go(self) -> None:
for i in range(self.count):
print(i)
return
if __name__ == '__main__':
Student(5).go()
| 0 | 1 | 0 | 0 | 1 | 0 |
Python/hello-world-from-python.py | kennethsequeira/Hello-world | 1,428 | 3207608 | <gh_stars>1000+
# Integrated Python Easter Egg.
# When imported automatically prints out: Hello world...
import __hello__
| 0 | 0 | 0 | 0 | 0 | 0 |
sdk/python/pulumi_gcp/compute/global_network_endpoint.py | sisisin/pulumi-gcp | 121 | 3207620 | # coding=utf-8
# *** WARNING: this file was generated by the Pulumi Terraform Bridge (tfgen) Tool. ***
# *** Do not edit by hand unless you're certain you know what you are doing! ***
from __future__ import annotations
import warnings
import pulumi
import pulumi.runtime
from typing import Any, Mapping, Optional, Seque... | 48 | 16 | 0 | 0 | 64 | 0 |
supersqlite/third_party/_pysqlite/update_sqlite_constants.py | plasticity-admin/supersqlite | 1,520 | 3207638 | import sqlite3
import urllib
FILENAME = "/tmp/toc.db"
stream = urllib.urlopen("https://sqlite.org/toc.db")
with open(FILENAME, "wb") as f:
f.write(stream.read())
con = sqlite3.connect("/tmp/toc.db")
cur = con.cursor()
cur.execute("select name from toc where type='constant' and name not in ('SQLITE_SOURCE_ID', '... | 0 | 0 | 0 | 0 | 0 | 0 |
dispatches/actions/pr_actions.py | mubashshirjamal/code | 1,582 | 3207703 | <reponame>mubashshirjamal/code<gh_stars>1000+
# encoding: utf-8
from urlparse import urlparse
import json
import urllib
import urllib2
import requests
from vilya.config import DOMAIN
from vilya.models.pull import PullRequest
from vilya.models.ticket import Ticket
from vilya.libs.push_notification import send_alert
... | 0 | 0 | 0 | 0 | 0 | 0 |
tests/utils/test_FileFormat.py | ankitshah009/dcase_util | 122 | 3207715 | <reponame>ankitshah009/dcase_util
""" Unit tests for FileFormat """
import nose.tools
from dcase_util.utils import FileFormat
def test_FileMixin_formats():
nose.tools.eq_(FileFormat.detect(filename='test.yaml'), FileFormat.YAML)
nose.tools.eq_(FileFormat.detect(filename='test.YAML'), FileFormat.YAML)
nos... | 0 | 0 | 0 | 0 | 0 | 0 |
climlab/process/__init__.py | nfeldl/climlab | 160 | 3207752 | <gh_stars>100-1000
'''The base classes for all climlab processes.'''
from __future__ import absolute_import
from .process import Process, process_like, get_axes
from .time_dependent_process import TimeDependentProcess, couple
from .implicit import ImplicitProcess
from .diagnostic import DiagnosticProcess
from .energy_b... | 0 | 0 | 0 | 0 | 0 | 0 |
fengshen/tokenizer/sentencepiece/shuffle_corpus.py | dumpmemory/Fengshenbang-LM | 265 | 3207759 | <reponame>dumpmemory/Fengshenbang-LM
import sys
import os
from tqdm import tqdm
sys.path.append('../../')
if __name__ == '__main__':
from data.fs_datasets import load_dataset
dataset = load_dataset('wudao_180g', num_proc=100)
print('dataset loaded', flush=True)
shuffle_ds = dataset['train'].shuffle(se... | 0 | 0 | 0 | 0 | 0 | 0 |
chapter04/test.py | alberthao/Python-Crash-Course-Homework | 138 | 3207775 | for value in range(1,5):
print(value)
numbers = list(range(1,6))
print(numbers)
squares = []
for value in range(1,11):
square = value**2
squares.append(square)
print(squares)
newsquares = [value**2 for value in range(1,11)]
print(newsquares) | 0 | 0 | 0 | 0 | 0 | 0 |
flow-python/examples/basis_function/profile/source.py | MegEngine/MegFlow | 303 | 3207779 | #!/usr/bin/env python
# coding=utf-8
from megflow import register, Envelope
import time
@register(outputs=['out'])
class Source:
def __init__(self, name, args):
self.n = args['n']
def exec(self):
start = time.perf_counter()
for i in range(self.n - 1):
envelope = Envelope.pa... | 0 | 0 | 0 | 0 | 0 | 0 |
machina/noise/__init__.py | AswinRetnakumar/Machina | 302 | 3207801 | from machina.noise.base import BaseActionNoise
from machina.noise.ounoise import OUActionNoise
| 0 | 0 | 0 | 0 | 0 | 0 |
src/genie/libs/parser/iosxr/tests/ShowNtpStatus/cli/equal/golden_output_3_expected.py | balmasea/genieparser | 204 | 3207808 |
expected_output = {
'clock_state': {
'system_status': {
'act_freq': 1000000000.0,
'drift': '0.0000000000 s/s',
'last_update': 'never updated',
'leap_status': "'NSET' (Never set)",
'nom_freq': 1000000000.0,
'offset': 0.0,
'... | 0 | 0 | 0 | 0 | 0 | 0 |
spotify_tensorflow/luigi/utils.py | flylo/spotify-tensorflow | 123 | 3207836 | # -*- coding: utf-8 -*-
#
# Copyright 2017-2019 Spotify AB.
#
# 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... | 5 | 6 | 0 | 0 | 11 | 0 |
plex_mpv_shim/svp_integration.py | aelfa/plex-mpv-shim | 231 | 3207874 | <reponame>aelfa/plex-mpv-shim<filename>plex_mpv_shim/svp_integration.py
from .conf import settings
import urllib.request
import urllib.error
import logging
import sys
import time
log = logging.getLogger('svp_integration')
def list_request(path):
try:
response = urllib.request.urlopen(settings.svp_url + "?... | 0 | 0 | 0 | 0 | 0 | 0 |
docs/nbpages/tutorials/0500_weekly_data.py | kenzie-q/greykite | 1,503 | 3207883 | <gh_stars>1000+
"""
Example for weekly data
=======================
This is a basic example for weekly data using Silverkite.
Note that here we are fitting a few simple models and the goal is not to optimize
the results as much as possible.
"""
import warnings
from collections import defaultdict
import plotly
import... | 0 | 0 | 0 | 0 | 0 | 0 |
src/duplicate_source.py | upgradeQ/OBS-Studio-Python-Scripting-Cheatsheet | 116 | 3207900 | <gh_stars>100-1000
import obspython as S
# See also https://github.com/upgradeQ/OBS-Studio-Python-Scripting-Cheatsheet-obspython-Examples-of-API/issues/3
class Example:
source_name = None
scene_name = None
def dup(self):
current_scene = S.obs_scene_from_source(S.obs_frontend_get_current_scene())... | 0 | 0 | 0 | 0 | 0 | 0 |
tride/scripts/encode_text.py | MGheini/unify-parameter-efficient-tuning | 101 | 3207902 | <reponame>MGheini/unify-parameter-efficient-tuning
"""this script encodes the given text piece,
potentially allowing for different hidden
representations
"""
import os
import json
import shutil
import numpy as np
import argparse
import torch
from tqdm import tqdm
from transformers import AutoModelForCausalLM, PreTrain... | 0 | 0 | 0 | 0 | 0 | 0 |
packages/pyright-internal/src/tests/samples/coroutines3.py | Jasha10/pyright | 3,934 | 3207914 | <reponame>Jasha10/pyright
# This sample tests old-style (pre-await) awaitable generators.
import asyncio
from typing import Any, AwaitableGenerator
@asyncio.coroutine
def old_style_coroutine1():
yield from asyncio.sleep(1)
async def func1() -> None:
x = await old_style_coroutine1()
reveal_type(x, expec... | 0 | 0 | 0 | 0 | 0 | 0 |
cflearn/api/cv/data/transforms/A.py | carefree0910/carefree-learn | 400 | 3207945 | import cv2
import albumentations as A
from typing import Any
from typing import Tuple
from typing import Union
from typing import Optional
from albumentations.pytorch import ToTensorV2
from .general import ToRGB
from .general import ToGray
from .general import BatchWrapper
from .....data import Transforms
from ........ | 43 | 3 | 1 | 0 | 47 | 0 |
tests/half_float_test.py | gglin001/poptorch | 128 | 3207954 | <reponame>gglin001/poptorch<gh_stars>100-1000
#!/usr/bin/env python3
# Copyright (c) 2020 Graphcore Ltd. All rights reserved.
import pytest
import torch
import helpers
import poptorch
def assert_same_type(inputs, model, opts, expect_same_type):
native_out = model(inputs)
pop_model = poptorch.inferenceModel(... | 0 | 0 | 0 | 0 | 0 | 0 |
tests/st/fl/cross_silo_faster_rcnn/generate_mindrecord.py | PowerOlive/mindspore | 3,200 | 3207955 | import os
import time
from mindspore.common import set_seed
from src.dataset import data_to_mindrecord_byte_image
from src.model_utils.config import config
set_seed(1)
rank = 0
device_num = 1
def generate_coco_mindrecord():
""" train_fasterrcnn_ """
# It will generate mindrecord file in config.mindrecord_... | 0 | 0 | 0 | 0 | 0 | 0 |
autoPyTorch/components/networks/image/darts/utils.py | mens-artis/Auto-PyTorch | 1,657 | 3207960 | from __future__ import annotations
import os
import numpy as np
import torch
import shutil
import torchvision.transforms as transforms
from torch.autograd import Variable
class AvgrageMeter(object):
def __init__(self):
self.reset()
def reset(self):
self.avg = 0
self.sum = 0
self.cnt = 0
def u... | 3 | 5 | 0 | 0 | 8 | 0 |
src/processors/evaluator.py | mana-ysh/knowledge-graph-embeddings | 248 | 3208052 | <reponame>mana-ysh/knowledge-graph-embeddings
import numpy as np
BATCHSIZE = 1000
class Evaluator(object):
def __init__(self, metric, nbest=None, filtered=False, whole_graph=None):
assert metric in ['mrr', 'hits', 'all'], 'Invalid metric: {}'.format(metric)
if metric == 'hits':
asse... | 0 | 0 | 0 | 0 | 0 | 0 |
alg/Deep Temporal Predictive Clustering/train.py | loramf/mlforhealthlabpub | 171 | 3208092 | <reponame>loramf/mlforhealthlabpub
import tensorflow as tf
import numpy as np
import pandas as pd
import os, sys
import random
import matplotlib.pyplot as plt
from tensorflow.contrib.layers import fully_connected as FC_Net
from tensorflow.python.ops.rnn import _transpose_batch_time
from sklearn.cluster import MiniBa... | 0 | 0 | 0 | 0 | 0 | 0 |
datasets/util/TrackingGT.py | DesperateMaker/TrackR-CNN | 522 | 3208134 | <filename>datasets/util/TrackingGT.py
import glob
import numpy as np
from collections import namedtuple, OrderedDict
def load_tracking_gt_KITTI_format(gt_path, filter_to_cars=True, start_track_ids_from_1=True):
tracking_gt = {}
tracking_gt_files = glob.glob(gt_path + "/*.txt")
for tracking_gt_file in tracking_g... | 0 | 0 | 0 | 0 | 0 | 0 |
backend/app/app/api/api_v1/router/supervisord/nodes.py | PY-GZKY/Tplan | 121 | 3208188 | <reponame>PY-GZKY/Tplan<gh_stars>100-1000
# -*- coding: utf-8 -*
# @Time : 2020/11/10 15:00
from fastapi import APIRouter
from starlette.requests import Request
from app.api.utils.responseCode import resp_200, resp_400, resp_500
from app.supervisor_.core.clogger import ActivityLog
router = APIRouter()
activity = Acti... | 0 | 0 | 0 | 0 | 0 | 0 |
tests/test_build.py | syrykh/python-for-android | 6,278 | 3208191 | <gh_stars>1000+
import unittest
from unittest import mock
import jinja2
from pythonforandroid.build import run_pymodules_install
from pythonforandroid.archs import ArchARMv7_a, ArchAarch_64
class TestBuildBasic(unittest.TestCase):
def test_run_pymodules_install_optional_project_dir(self):
"""
M... | 0 | 0 | 0 | 0 | 0 | 0 |
delta/data/frontend/add_rir_noise_aecres.py | didichuxing/delta | 1,442 | 3208215 | <gh_stars>1000+
# Copyright (C) 2017 Beijing Didi Infinity Technology and Development Co.,Ltd.
# 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... | 0 | 0 | 0 | 0 | 0 | 0 |
nncompress/compressor/resource.py | take-cheeze/models | 112 | 3208248 | <filename>nncompress/compressor/resource.py
# -*- coding: utf-8 -*-
import json
import os
import subprocess
import sys
from datetime import datetime
import chainer
import logzero
from logzero import logger
class Resource(object):
"""
Helper class for the experiment.
"""
def __init__(self, args, trai... | 0 | 0 | 0 | 0 | 0 | 0 |
src/models/sequence/rnns/cells/memory.py | dumpmemory/state-spaces | 513 | 3208267 | <reponame>dumpmemory/state-spaces<gh_stars>100-1000
""" The core RNN cell architecture of the HiPPO-RNN from the original HiPPO paper. """
import torch
import torch.nn as nn
import torch.nn.functional as F
import math
import numpy as np
from scipy import signal
from scipy import linalg as la
from src.models.sequence.... | 0 | 0 | 0 | 0 | 0 | 0 |
docs/blog/riscv/files/setup_spike.py | Risto97/pygears | 120 | 3208286 | import pexpect
class Spike:
PROMPT: str = r': $'
CODE_BASE_ADDRESS: int = 0xffffffff80000000
def __init__(self, cmd_line):
self.cmd_line = cmd_line
def __enter__(self) -> object:
self.proc = pexpect.spawnu(self.cmd_line)
self.proc.expect(Spike.PROMPT)
self.proc.setech... | 1 | 4 | 2 | 0 | 7 | 0 |
test/results/test_electronic_structure_result.py | jschuhmac/qiskit-nature | 132 | 3208301 | <reponame>jschuhmac/qiskit-nature<filename>test/results/test_electronic_structure_result.py
# This code is part of Qiskit.
#
# (C) Copyright IBM 2021.
#
# 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 t... | 0 | 0 | 0 | 0 | 0 | 0 |
tests/test_base.py | bittsi/napalm-logs | 133 | 3208324 | <reponame>bittsi/napalm-logs<filename>tests/test_base.py<gh_stars>100-1000
# -*- coding: utf-8 -*-
'''
Test the napalm-logs base class.
'''
from __future__ import absolute_import
from __future__ import unicode_literals
| 0 | 0 | 0 | 0 | 0 | 0 |
src/client.py | ab77/black.box | 110 | 3208382 | <filename>src/client.py
#!/usr/bin/env python
# -*- coding: utf-8 -*-
import os, sys, importlib
from inspect import stack
from config import DNS_SUB_DOMAIN
from common import retry
import plugin_loader
@retry(Exception, cdata='method=%s()' % stack()[0][3])
def connect_disconnect(cmd=None, username=None):
if not... | 0 | 0 | 0 | 0 | 0 | 0 |
nornir/os_upgrade/part2/expanded_file_transfer/nornir_os_upgrade.py | fallenfuzz/pynet | 528 | 3208402 | <filename>nornir/os_upgrade/part2/expanded_file_transfer/nornir_os_upgrade.py
from nornir.core import InitNornir
from nornir.plugins.tasks.networking import netmiko_file_transfer
from nornir_test.nornir_utilities import nornir_set_creds, std_print
def os_upgrade(task):
file_name = task.host.get('img')
result... | 0 | 0 | 0 | 0 | 0 | 0 |
src/util/hdf5_test_bed.py | shtoneyan/Basset | 248 | 3208405 | #!/usr/bin/env python
from optparse import OptionParser
import re
import h5py
################################################################################
# hdf5_test_bed.py
#
# Extract a BED of test sequences from an HDF5 file with test_headers that
# specify the region.
##########################################... | 0 | 0 | 0 | 0 | 0 | 0 |
apiserver/apiserver/coordinator/storage.py | xinnosuke/Halite-II | 232 | 3208430 | import base64
import binascii
import io
import tempfile
import flask
import google.cloud.storage as gcloud_storage
import google.cloud.exceptions as gcloud_exceptions
from werkzeug.contrib.cache import FileSystemCache
from .. import config, model, util
from .blueprint import coordinator_api
# Cache the worker blo... | 0 | 4 | 0 | 0 | 4 | 0 |
utils/bbox.py | RobertLucian/cortex-license-plate-reader-client | 307 | 3208431 | # WARNING: you are on the master branch, please refer to the examples on the branch that matches your `cortex version`
from __future__ import annotations
import numpy as np
import cv2
from .colors import get_color
class BoundBox:
def __init__(self, xmin, ymin, xmax, ymax, c: object | None=None, classes: object |... | 3 | 3 | 0 | 0 | 6 | 0 |
sld-api-backend/test/test_02_crud_stacks.py | guorenxi/Stack-Lifecycle-Deployment | 115 | 3208439 | <reponame>guorenxi/Stack-Lifecycle-Deployment
from helpers.api_request import request_url
from helpers.api_token import get_token
from config.api import settings
token = get_token(settings.CREDENTIALS_ADM)
token_unprivileges = get_token(settings.CREDENTIALS_USER)
aws_data = settings.STACK_POST_AWS
aws_stack_name = set... | 0 | 0 | 0 | 0 | 0 | 0 |
contrib/android/p4a_recipes/kivy/__init__.py | Jesusown/electrum | 5,905 | 3208478 | <gh_stars>1000+
from pythonforandroid.recipes.kivy import KivyRecipe
assert KivyRecipe.depends == ['sdl2', 'pyjnius', 'setuptools', 'python3']
assert KivyRecipe.python_depends == ['certifi']
class KivyRecipePinned(KivyRecipe):
# kivy master 2020-12-10 (2.0.0 plus a few bugfixes)
version = "2debbc3b1484b1482... | 0 | 0 | 0 | 0 | 0 | 0 |
tests/closing_over.py | ZYAZP/python2 | 1,062 | 3208513 | def f():
x = 'closed-over'
def g():
return x
return g
print f()()
| 0 | 0 | 0 | 0 | 0 | 0 |
notebook/urllib_request.py | vhn0912/python-snippets | 174 | 3208538 | <reponame>vhn0912/python-snippets
# http://docs.python.jp/3.6/library/urllib.request.html
import urllib.request
url = "https://upload.wikimedia.org/wikipedia/en/2/24/Lenna.png"
path = "data/src/lena_square.png"
result = urllib.request.urlretrieve(url, path)
print(result)
# ('data/src/lena_square.png', <http.client.H... | 0 | 0 | 0 | 0 | 0 | 0 |
packages/plugins/minos-broker-kafka/tests/utils.py | sorasful/minos-python | 247 | 3208548 | from pathlib import (
Path,
)
BASE_PATH = Path(__file__).parent
CONFIG_FILE_PATH = BASE_PATH / "test_config.yml"
| 0 | 0 | 0 | 0 | 0 | 0 |
analyzer/tests/libtest/decorators.py | ryankurte/codechecker | 1,601 | 3208583 | # -------------------------------------------------------------------------
#
# Part of the CodeChecker project, under the Apache License v2.0 with
# LLVM Exceptions. See LICENSE for license information.
# SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
#
# ---------------------------------------------------... | 0 | 2 | 0 | 0 | 2 | 0 |
uberduck_ml_dev/exec/generate_filelist.py | justinjohn0306/uberduck-ml-dev | 167 | 3208611 | # AUTOGENERATED! DO NOT EDIT! File to edit: nbs/exec.generate_filelist.ipynb (unless otherwise specified).
__all__ = ['parse_args']
# Cell
import argparse
from collections import namedtuple
from dataclasses import dataclass
import json
import os
from pathlib import Path
from shutil import copyfile, copytree
import sy... | 0 | 1 | 0 | 0 | 1 | 0 |
test/integration/vint/linting/policy/test_prohibit_unused_variable.py | mosheavni/vint | 538 | 3208615 | <gh_stars>100-1000
import unittest
import enum
from test.asserting.policy import PolicyAssertion, get_fixture_path
from vint.linting.level import Level
from vint.linting.policy.prohibit_unused_variable import ProhibitUnusedVariable
class Fixtures(enum.Enum):
VALID_VIM_SCRIPT = get_fixture_path('prohibit_unused_var... | 0 | 0 | 0 | 0 | 0 | 0 |
data_utils/ShapeNetLoader.py | ubc-vision/canonical-capsules | 154 | 3208624 | from __future__ import annotations
from __future__ import print_function
import os
import json
import glob
import torch
import numpy as np
import torchvision.transforms as transforms
import torch.utils.data as data
import random
import h5py
class ShapeNetLoader(data.Dataset):
def __init__(self, data_dump_folder,... | 13 | 6 | 0 | 8 | 27 | 0 |
terrascript/provider/mongodbatlas.py | mjuenema/python-terrascript | 507 | 3208629 | <reponame>mjuenema/python-terrascript
# terrascript/provider/mongodbatlas.py
# Automatically generated by tools/makecode.py (24-Sep-2021 15:21:48 UTC)
#
# For imports without namespace, e.g.
#
# >>> import terrascript.provider.mongodbatlas
#
# instead of
#
# >>> import terrascript.provider.mongodb.mongodbatlas
#
# ... | 0 | 0 | 0 | 0 | 0 | 0 |
examples/issues/issue246.py | tgolsson/appJar | 666 | 3208648 | import sys
sys.path.append("../../")
from appJar import gui
app = gui()
app.startLabelFrame("lf1", hideTitle=True)
app.addLabel("l1", "In the frame")
app.stopLabelFrame()
with app.labelFrame("lf2", hideTitle=True):
app.addLabel("l2", "In the frame")
app.go()
| 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.