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 |
|---|---|---|---|---|
backpack/custom_module/scale_module.py | jabader97/backpack | 395 | 12644558 | """Contains ScaleModule."""
from torch import Tensor
from torch.nn import Module
class ScaleModule(Module):
"""Scale Module scales the input by a constant."""
def __init__(self, weight: float = 1.0):
"""Store scalar weight.
Args:
weight: Initial value for weight. Defaults to 1.0.... |
setup.py | gmr/consulate | 309 | 12644568 | <gh_stars>100-1000
import setuptools
setuptools.setup(
name='abaez.consulate',
version='1.1.0',
description='A Client library and command line application for the Consul',
maintainer='<NAME>',
maintainer_email='<EMAIL>',
url='https://consulate.readthedocs.org',
install_requires=['requests>=... |
graphene_django/utils/tests/test_testing.py | mebel-akvareli/graphene-django | 4,038 | 12644580 | <filename>graphene_django/utils/tests/test_testing.py
import pytest
from .. import GraphQLTestCase
from ...tests.test_types import with_local_registry
from django.test import Client
@with_local_registry
def test_graphql_test_case_deprecated_client_getter():
"""
`GraphQLTestCase._client`' getter should raise ... |
src/api/filecontent.py | piwaniuk/critic | 216 | 12644592 | # -*- mode: python; encoding: utf-8 -*-
#
# Copyright 2017 the Critic contributors, Opera Software ASA
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may not
# use this file except in compliance with the License. You may obtain a copy of
# the License at
#
# http://www.apache.org/licenses/LI... |
xdl-algorithm-solution/TDM/src/python/store/store/store.py | hitflame/x-deeplearning | 4,071 | 12644620 | <reponame>hitflame/x-deeplearning
# Copyright (C) 2016-2018 Alibaba Group Holding Limited
#
# 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
... |
lixian_colors.py | 1py/xunlei-lixian | 2,177 | 12644625 |
import os
import sys
def get_console_type(use_colors=True):
if use_colors and sys.stdout.isatty() and sys.stderr.isatty():
import platform
if platform.system() == 'Windows':
import lixian_colors_win32
return lixian_colors_win32.WinConsole
else:
import lixian_colors_linux
return lixian_colors_linux.... |
fostool/model/gconv.py | meng-zha/FOST | 181 | 12644633 | # Copyright (c) Microsoft Corporation.
# Licensed under the MIT License.
from __future__ import absolute_import, division, print_function
import torch
import numpy as np
import torch.nn as nn
import torch.nn.functional as F
import torch_geometric.nn as PyG
from collections import OrderedDict
class GATConv(PyG.Messa... |
aliyun-python-sdk-hbase/aliyunsdkhbase/request/v20190101/ResizeMultiZoneClusterNodeCountRequest.py | yndu13/aliyun-openapi-python-sdk | 1,001 | 12644659 | <filename>aliyun-python-sdk-hbase/aliyunsdkhbase/request/v20190101/ResizeMultiZoneClusterNodeCountRequest.py
# 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... |
ants/utils/iMath.py | xemio/ANTsPy | 338 | 12644670 | <filename>ants/utils/iMath.py
__all__ = ['iMath',
'image_math',
'multiply_images',
'iMath_get_largest_component',
'iMath_normalize',
'iMath_truncate_intensity',
'iMath_sharpen',
'iMath_pad',
'iMath_maurer_distance',
'i... |
aiogram/types/user_profile_photos.py | andrew-ld/aiogram | 2,744 | 12644679 | <filename>aiogram/types/user_profile_photos.py
import typing
from . import base
from . import fields
from .photo_size import PhotoSize
class UserProfilePhotos(base.TelegramObject):
"""
This object represent a user's profile pictures.
https://core.telegram.org/bots/api#userprofilephotos
"""
total... |
dev/Tools/build/waf-1.7.13/waflib/extras/unity.py | jeikabu/lumberyard | 1,738 | 12644680 | #! /usr/bin/env python
# encoding: utf-8
"""
Take a group of C++ files and compile them at once.
def options(opt):
opt.load('compiler_cxx unity')
"""
import re
from waflib import Task, Options, Logs
from waflib.Tools import ccroot, cxx, c_preproc
from waflib.TaskGen import extension, taskgen_method
MAX_BATCH = 20
... |
mmdet/datasets/pipelines/rtransforms.py | cameronchoi/r3det-docker | 176 | 12644714 | from ..builder import PIPELINES
from .transforms import Resize, RandomFlip, RandomCrop
import numpy as np
@PIPELINES.register_module()
class RResize(Resize):
"""
Resize images & rotated bbox
Inherit Resize pipeline class to handle rotated bboxes
"""
def __init__(self,
img... |
dalib/adaptation/mdd.py | neka-nat/Transfer-Learning-Library | 1,474 | 12644716 | """
@author: <NAME>
@contact: <EMAIL>
"""
from typing import Optional, List, Dict, Tuple, Callable
import torch.nn as nn
import torch.nn.functional as F
import torch
from dalib.modules.grl import WarmStartGradientReverseLayer
class MarginDisparityDiscrepancy(nn.Module):
r"""The margin disparity discrepancy (MDD)... |
openapi_python_client/schema/openapi_schema_pydantic/security_scheme.py | oterrier/openapi-python-client | 172 | 12644749 | from typing import Optional
from pydantic import AnyUrl, BaseModel, Field
from .oauth_flows import OAuthFlows
class SecurityScheme(BaseModel):
"""
Defines a security scheme that can be used by the operations.
Supported schemes are HTTP authentication,
an API key (either as a header, a cookie paramet... |
adanet/autoensemble/common.py | Mario-Kart-Felix/adanet | 3,323 | 12644756 | <reponame>Mario-Kart-Felix/adanet
"""Common utilities for AutoEnsemblers.
Copyright 2019 The AdaNet 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
https://www.ap... |
readthedocs/core/utils/general.py | mforbes/readthedocs.org | 2,092 | 12644761 | from django.shortcuts import get_object_or_404
from readthedocs.builds.models import Version
from readthedocs.storage import build_environment_storage
def wipe_version_via_slugs(version_slug, project_slug):
"""Wipes the given version of a given project."""
version = get_object_or_404(
Version,
... |
txdav/base/propertystore/test/test_none.py | backwardn/ccs-calendarserver | 462 | 12644807 | ##
# Copyright (c) 2010-2017 Apple 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.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable l... |
poco/drivers/osx/sdk/OSXUI.py | koyoki/Poco | 1,444 | 12644854 | # coding=utf-8
import time
import base64
import zlib
import re
import pyautogui
import atomac
import operator
from pynput.keyboard import Controller
from poco.sdk.std.rpc.controller import StdRpcEndpointController
from poco.sdk.std.rpc.reactor import StdRpcReactor
from poco.utils.net.transport.tcp import TcpSocket
fro... |
mars/serialization/serializables/__init__.py | hxri/mars | 2,413 | 12644886 | <gh_stars>1000+
# Copyright 1999-2021 Alibaba Group Holding Ltd.
#
# 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 app... |
awacs/redshift_data.py | michael-k/awacs | 358 | 12644901 | # Copyright (c) 2012-2021, <NAME> <<EMAIL>>
# All rights reserved.
#
# See LICENSE file for full license.
from .aws import Action as BaseAction
from .aws import BaseARN
service_name = "Amazon Redshift Data API"
prefix = "redshift-data"
class Action(BaseAction):
def __init__(self, action: str = None) -> None:
... |
preprocessing/detect_landmarks70.py | enviromachinebeast/head2head | 206 | 12644918 | import os
from skimage import io
from skimage.color import rgb2gray
import numpy as np
import dlib
import argparse
import collections
from tqdm import tqdm
import cv2
import matplotlib.pyplot as plt
IMG_EXTENSIONS = ['.png']
def is_image_file(filename):
return any(filename.endswith(extension) for extension in IMG... |
sdk/python/pulumi_aws/serverlessrepository/get_application.py | chivandikwa/pulumi-aws | 260 | 12644924 | # 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! ***
import warnings
import pulumi
import pulumi.runtime
from typing import Any, Mapping, Optional, Sequence, Union, overload
from .. import... |
src/python/twitter/common/reviewboard/reviewboard.py | zhouyijiaren/commons | 1,143 | 12644927 | from __future__ import print_function
__author__ = '<NAME>'
import base64
import cookielib
import mimetools
import os
import getpass
import json
import sys
import urllib2
from urlparse import urljoin
from urlparse import urlparse
VERSION = '0.8-precommit'
class APIError(Exception):
pass
class RepositoryInfo:
... |
operational_analysis/methods/quality_check_automation.py | eumiro/OpenOA | 123 | 12644931 | import numpy as np
import matplotlib.pyplot as plt
import pandas as pd
import h5pyd
import dateutil
from pyproj import Proj
from operational_analysis.toolkits import timeseries
from operational_analysis.toolkits import filters
from operational_analysis.toolkits import power_curve
from operational_analysis import logge... |
examples/multi_tabs_navigate.py | anbuhckr/pychrome | 542 | 12644953 | <reponame>anbuhckr/pychrome
#! /usr/bin/env python
# -*- coding: utf-8 -*-
"""
require chrome version >= 61.0.3119.0
headless mode
"""
import time
import pychrome
class EventHandler(object):
def __init__(self, browser, tab):
self.browser = browser
self.tab = tab
self.start_frame = None
... |
boto3_type_annotations_with_docs/boto3_type_annotations/logs/paginator.py | cowboygneox/boto3_type_annotations | 119 | 12644970 | <reponame>cowboygneox/boto3_type_annotations
from typing import Dict
from typing import List
from botocore.paginate import Paginator
class DescribeDestinations(Paginator):
def paginate(self, DestinationNamePrefix: str = None, PaginationConfig: Dict = None) -> Dict:
"""
Creates an iterator that wil... |
gwd/select_anchors.py | kazakh-shai/kaggle-global-wheat-detection | 136 | 12644998 | import numpy as np
import torch
from gwd.eda.kmeans import kmeans
from mmdet.core.anchor import AnchorGenerator, build_anchor_generator
def main():
anchor_generator_cfg = dict(type="AnchorGenerator", scales=[8], ratios=[0.5, 1.0, 2.0], strides=[4, 8, 16, 32, 64])
anchor_generator: AnchorGenerator = build_anc... |
public-engines/iris-h2o-automl/marvin_iris_h2o_automl/data_handler/acquisitor_and_cleaner.py | guialba/incubator-marvin | 101 | 12645008 | #!/usr/bin/env python
# coding=utf-8
"""AcquisitorAndCleaner engine action.
Use this module to add the project main code.
"""
from .._compatibility import six
from .._logging import get_logger
from marvin_python_toolbox.engine_base import EngineBaseDataHandler
__all__ = ['AcquisitorAndCleaner']
logger = get_logg... |
Median.py | RijuDasgupta9116/LintCode | 321 | 12645017 | """
Given a unsorted array with integers, find the median of it.
A median is the middle number of the array after it is sorted.
If there are even numbers in the array, return the N/2-th number after sorted.
Example
Given [4, 5, 1, 2, 3], return 3
Given [7, 9, 4, 5], return 5
Challenge
O(n) time.
"""
__author__ = '... |
tests/integration/test_client_report.py | timfish/relay | 123 | 12645026 | <filename>tests/integration/test_client_report.py
import pytest
from queue import Empty
from datetime import datetime, timezone, timedelta
def test_client_reports(relay, mini_sentry):
config = {
"outcomes": {
"emit_outcomes": True,
"batch_size": 1,
"batch_interval": 1,
... |
test_flops.py | kevin-ssy/ViP | 107 | 12645065 | <reponame>kevin-ssy/ViP<gh_stars>100-1000
"""FLOPS/Params Measuring Script
Copyright 2021 <NAME>
"""
import yaml
import torch
import models
import argparse
import timm.models
from timm.models import create_model
from utils.flop_count.flop_count import flop_count
parser = argparse.ArgumentParser('vis')
parser.add_ar... |
src/core/tests/frontend/paddle/test_models/gen_scripts/generate_lower_version.py | ryanloney/openvino-1 | 1,127 | 12645080 | # Copyright (C) 2018-2022 Intel Corporation
# SPDX-License-Identifier: Apache-2.0
import paddle
import numpy as np
import os
import sys
from paddle.fluid.proto import framework_pb2
paddle.enable_static()
inp_blob = np.random.randn(1, 3, 4, 4).astype(np.float32)
print(sys.path)
main_program = paddle.static.Program()
... |
debug/do_inject.py | fosterrath-mila/myia | 222 | 12645099 | """Inject functionality in all modules, only import for debugging purposes."""
from .inject import inject_suite
inject_suite()
|
src/resource-graph/azext_resourcegraph/_help.py | haroonf/azure-cli-extensions | 207 | 12645100 | # --------------------------------------------------------------------------------------------
# Copyright (c) Microsoft Corporation. All rights reserved.
# Licensed under the MIT License. See License.txt in the project root for license information.
# --------------------------------------------------------------------... |
ai_safety_gridworlds/tests/distributional_shift_test.py | AicyDC/ai-safety-gridworlds | 532 | 12645121 | <reponame>AicyDC/ai-safety-gridworlds
# Copyright 2018 The AI Safety Gridworlds 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/lice... |
ironic/db/sqlalchemy/alembic/versions/9ef41f07cb58_add_node_history_table.py | yanndegat/ironic | 350 | 12645145 | # Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the License. You may obtain
# a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# d... |
lsfm/__init__.py | a78239636/lsfm-lzr | 437 | 12645160 | from .landmark import landmark_mesh
from .visualize import visualize_nicp_result
from .correspond import correspond_mesh
from ._version import get_versions
__version__ = get_versions()['version']
del get_versions
def landmark_and_correspond_mesh(mesh, verbose=False):
# Don't touch the original mesh
mesh = mes... |
tests/test_tracks.py | oaxiom/NucleoATAC | 101 | 12645165 | <reponame>oaxiom/NucleoATAC
from unittest import TestCase
import numpy as np
from pyatac.chunkmat2d import FragmentMat2D
from pyatac.chunk import ChunkList
from pyatac.bias import InsertionBiasTrack
from pyatac.tracks import InsertionTrack, Track
class Test_Ins(TestCase):
"""test that conversion of readmat to in... |
FWCore/ParameterSet/python/MessageLogger.py | malbouis/cmssw | 852 | 12645177 | <filename>FWCore/ParameterSet/python/MessageLogger.py
#import FWCore.ParameterSet.Config as cms
from .Types import *
from .Modules import Service
_category = optional.untracked.PSetTemplate(
reportEvery = untracked.int32(1),
limit = optional.untracked.int32,
timespan = optional.untracked.int32
)
_destinat... |
v0.5/training/keyword_spotting/eval_quantized_model.py | PhilippvK/tiny | 148 | 12645203 | <filename>v0.5/training/keyword_spotting/eval_quantized_model.py
import tensorflow as tf
import os
import numpy as np
import argparse
import get_dataset as kws_data
import kws_util
def predict(interpreter, data):
# Get input and output tensors.
input_details = interpreter.get_input_details()
output_details = ... |
moto/cloudtrail/responses.py | gtourkas/moto | 5,460 | 12645214 | """Handles incoming cloudtrail requests, invokes methods, returns responses."""
import json
from moto.core.responses import BaseResponse
from .models import cloudtrail_backends
from .exceptions import InvalidParameterCombinationException
class CloudTrailResponse(BaseResponse):
"""Handler for CloudTrail requests ... |
preprocess/preprocess_features.py | hdchieh/hcrn-videoqa | 111 | 12645221 | import argparse, os
import h5py
from scipy.misc import imresize
import skvideo.io
from PIL import Image
import torch
from torch import nn
import torchvision
import random
import numpy as np
from models import resnext
from datautils import utils
from datautils import tgif_qa
from datautils import msrvtt_qa
from dataut... |
build_scripts/CompileLibsodium-Linux.py | HUSKI3/Neblio-Node | 138 | 12645258 | import os
from subprocess import call
import sys
import re
import multiprocessing as mp
import string
import urllib
import shutil
version = "1.0.18-stable"
def is_python3_or_higher():
return sys.version_info.major >= 3
def get_libsodium_filename(ver):
return "libsodium-" + ver + ".tar.gz"
def get_libsodium... |
healthcareai/tests/test_dataframe_filters.py | iEvidently/healthcareai-py | 263 | 12645264 | import pandas as pd
import numpy as np
import unittest
import healthcareai.common.filters as filters
from healthcareai.common.healthcareai_error import HealthcareAIError
class TestIsDataframe(unittest.TestCase):
def test_is_dataframe(self):
df = pd.DataFrame({
'category': ['a', 'b', 'c'],
... |
recipes/Python/578080_Libreenect_OpenKinect_Minimum_Value_Joystick/recipe-578080.py | tdiprima/code | 2,023 | 12645281 | <gh_stars>1000+
#!/usr/bin/env python
"""
Kinect Demo using minimum values from the depth image.
@Author = <NAME>
@Date = 17 March, 2012
@Version = 1.1
@Filename = KinectJoystickMin.py
"""
from freenect import sync_get_depth as get_depth, sync_get_video as get_video, init, close_device, open_device, set_led
imp... |
src/genie/libs/parser/iosxe/show_l2fib.py | balmasea/genieparser | 204 | 12645334 | <reponame>balmasea/genieparser
''' show_l2fib.py
IOSXE parsers for the following show commands:
* show l2fib path-list {id}
* show l2fib path-list detail
* show l2fib bridge-domain {bd_id} port
* show l2fib bridge-domain {bd_id} address unicast {mac_addr}
Copyright (c) 2021 by Cisco Systems, Inc.
All... |
model/node.py | leoriohope/RandWireNN | 757 | 12645340 | <gh_stars>100-1000
import torch
import torch.nn as nn
import torch.nn.functional as F
from .sep_conv import SeparableConv2d
class NodeOp(nn.Module):
def __init__(self, in_degree, in_channel, out_channel, stride):
super(NodeOp, self).__init__()
self.single = (in_degree == 1)
if not self.si... |
timy/settings.py | pnpnpn/timy | 300 | 12645347 | <reponame>pnpnpn/timy<gh_stars>100-1000
class TrackingMode(object):
PRINTING, LOGGING = range(0, 2)
TRACKING = True
TRACKING_MODE = TrackingMode.PRINTING
class TimyConfig(object):
DEFAULT_IDENT = 'Timy'
def __init__(self, tracking=TRACKING, tracking_mode=TRACKING_MODE):
self.tracking = tracking... |
prefixspan/closed.py | avijit1258/PrefixSpan-py | 285 | 12645361 | <reponame>avijit1258/PrefixSpan-py
#! /usr/bin/env python3
from .localtyping import Optional, Set, Matches, DB, Pattern, List
def __reversescan(db: DB, patt: List[Optional[int]], matches: Matches):
def islocalclosed(previtem: Optional[int]) -> bool:
closeditems: Set[int] = set()
for k, (i, endpo... |
hammer/deployContract_example_web3.py | brave-experiments/chainhammer | 110 | 12645364 | <reponame>brave-experiments/chainhammer<gh_stars>100-1000
# taken from
# http://web3py.readthedocs.io/en/stable/contracts.html#contract-deployment-example
#
# then repaired:
# see issue 808 https://github.com/ethereum/web3.py/issues/808
# and extended
#
# and quorum-bugfixed, see
# https://github.com/ethereum/web3.py/i... |
models/FreeAnchor/builder.py | shouwangzhe134/simpledet | 3,195 | 12645374 | from __future__ import division
from __future__ import print_function
import math
import mxnext as X
from models.retinanet.builder import RetinaNetHead
class FreeAnchorRetinaNet(object):
def __init__(self):
pass
@staticmethod
def get_train_symbol(backbone, neck, head):
gt_bbox = X.var("... |
tests/utils/test_text.py | PyCN/pulsar | 1,410 | 12645406 | '''Tests the tools and utilities in pulsar.utils.'''
import unittest
from pulsar.utils.log import lazy_string
@lazy_string
def blabla(n):
return 'AAAAAAAAAAAAAAAAAAAA %s' % n
class TestTextUtils(unittest.TestCase):
def testLazy(self):
r = blabla(3)
self.assertEqual(r.value, None)
v... |
ldap_connector.py | shellster/LDAPPER | 163 | 12645429 | import datetime
import json
import logging
import queue
import re
import threading
import time
import ldap3
import OpenSSL
from impacket.ldap import ldap
import utilities
"""
WARNING:
If you try to borrow this code, please be aware:
Neither LDAP connector is thread safe!
Impacket library may not be thread safe, more... |
python/slalom/models.py | LukeZheZhu/slalom | 128 | 12645467 | import tensorflow as tf
import keras.backend as K
from keras.applications.vgg16 import VGG16
from keras.applications.vgg19 import VGG19
from keras.applications.mobilenet import MobileNet
from python.slalom.resnet import ResNet50
from python.slalom.resnet2 import ResNet34 as ResNet2_34, ResNet50 as ResNet2_50, ResNet101... |
examples/security_demo.py | Michae1Weiss/spectree | 183 | 12645491 | <gh_stars>100-1000
from flask import Flask
from pydantic import BaseModel
from spectree import SecurityScheme, SpecTree
class Req(BaseModel):
name: str
security_schemes = [
SecurityScheme(
name="PartnerID",
data={"type": "apiKey", "name": "partner-id", "in": "header"},
),
SecuritySc... |
Python3/451.py | rakhi2001/ecom7 | 854 | 12645548 | __________________________________________________________________________________________________
sample 32 ms submission
class Solution:
def frequencySort(self, s: str) -> str:
a = set(s)
a = [a*s.count(a) for a in a]
a = sorted(a, key = lambda x: len(x), reverse = True)
return ''... |
tensorflow_model_optimization/python/core/quantization/keras/layers/conv_batchnorm_test_utils.py | ptesan777/model-optimization | 848 | 12645568 | <filename>tensorflow_model_optimization/python/core/quantization/keras/layers/conv_batchnorm_test_utils.py
# Copyright 2019 The TensorFlow 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... |
runtime/java_heap.py | 5A59/Zvm | 485 | 12645582 | # coding=utf-8
class JavaHeap:
def __init__(self):
pass
|
contrib/tools/python/src/Lib/plat-aix3/IN.py | HeyLey/catboost | 6,989 | 12645586 | <reponame>HeyLey/catboost
# Generated by h2py from /usr/include/netinet/in.h
# Included from net/nh.h
# Included from sys/machine.h
LITTLE_ENDIAN = 1234
BIG_ENDIAN = 4321
PDP_ENDIAN = 3412
BYTE_ORDER = BIG_ENDIAN
DEFAULT_GPR = 0xDEADBEEF
MSR_EE = 0x8000
MSR_PR = 0x4000
MSR_FP = 0x2000
MSR_ME = 0x1000
MSR_FE = 0x0800
... |
examples/jbnmr_examples/s2_s3_1d_plotting/plot_1d_pipe_time.py | genematx/nmrglue | 150 | 12645589 | <filename>examples/jbnmr_examples/s2_s3_1d_plotting/plot_1d_pipe_time.py<gh_stars>100-1000
import nmrglue as ng
import matplotlib.pyplot as plt
# read in the data from a NMRPipe file
dic, data = ng.pipe.read("test.fid")
# make a unit conversion object for the axis
uc = ng.pipe.make_uc(dic, data)
# plot the spectrum
... |
tests/conftest.py | Jyrno42/pytest-cookies | 134 | 12645595 | # -*- coding: utf-8 -*-
import collections
import json
import pytest
pytest_plugins = "pytester"
@pytest.fixture(name="cookiecutter_template")
def fixture_cookiecutter_template(tmpdir):
template = tmpdir.ensure("cookiecutter-template", dir=True)
template_config = collections.OrderedDict(
[("repo_n... |
mpunet/image/queue/base_queue.py | alexsosn/MultiPlanarUNet | 156 | 12645597 | <filename>mpunet/image/queue/base_queue.py
import numpy as np
from mpunet.logging.default_logger import ScreenLogger
class BaseQueue:
"""
The base queue object defines the Queue API and stores basic attributes
used across all queue objects
The BaseQueue should normally not be initialized directly.
... |
Testing/TestDICOMPython.py | mwestphal/vtk-dicom | 171 | 12645605 | #! /usr/bin/env python2
import sys
import vtk
try:
import vtkDICOM
except ImportError:
# for backwards compabilitity, before VTK 9
import vtkDICOMPython
vtkDICOM = vtkDICOMPython
# put everything into the vtk namespace
for a in dir(vtkDICOM):
if a[0] != '_':
setattr(vtk, a, getattr(vtkDIC... |
matchzoo/preprocessors/bert_preprocessor.py | baajur/MatchZoo | 2,209 | 12645607 | <reponame>baajur/MatchZoo<gh_stars>1000+
"""Bert Preprocessor."""
from tqdm import tqdm
from . import units
from .chain_transform import chain_transform
from matchzoo import DataPack
from matchzoo.engine.base_preprocessor import BasePreprocessor
from .build_vocab_unit import built_bert_vocab_unit
from .build... |
src/assortment/config_assortment.py | AbhinavGopal/ts_tutorial | 290 | 12645639 | """Specify the jobs to run via config file.
Product assortment exeperiment (Figure 7.2).
"""
import collections
import functools
import numpy as np
from base.config_lib import Config
from base.experiment import ExperimentNoAction
from assortment.agent_assortment import TSAssortment, GreedyAssortment, EpsilonGreedyAss... |
tests/integration/events/v1/test_event_type.py | BrimmingDev/twilio-python | 1,362 | 12645659 | # coding=utf-8
r"""
This code was generated by
\ / _ _ _| _ _
| (_)\/(_)(_|\/| |(/_ v1.0.0
/ /
"""
from tests import IntegrationTestCase
from tests.holodeck import Request
from twilio.base.exceptions import TwilioException
from twilio.http.response import Response
class EventTypeTestCase(Integra... |
spikeinterface/extractors/neoextractors/mearec.py | khl02007/spikeinterface | 116 | 12645661 | from .neobaseextractor import NeoBaseRecordingExtractor, NeoBaseSortingExtractor
import probeinterface as pi
class MEArecRecordingExtractor(NeoBaseRecordingExtractor):
"""
Class for reading data from a MEArec simulated data.
Parameters
----------
file_path: str
locs_2d: bool
"""
m... |
recipes/Python/578191_Extract_Multiple_TAR_Files_/recipe-578191.py | tdiprima/code | 2,023 | 12645692 | <reponame>tdiprima/code<filename>recipes/Python/578191_Extract_Multiple_TAR_Files_/recipe-578191.py
import os
import sys
import tarfile
def main():
total = untar(sys.argv[1:])
if total:
args = total, total > 1 and 's were' or ' was'
sys.stdout.write('Report: %s file%s untared.' % args)
else... |
samsung_problems/problem_1.py | loftwah/Daily-Coding-Problem | 129 | 12645709 | <gh_stars>100-1000
"""This problem was asked by Samsung.
A group of houses is connected to the main water plant by means of a set of pipes.
A house can either be connected by a set of pipes extending directly to the plant,
or indirectly by a pipe to a nearby house which is otherwise connected.
For example, here is ... |
romp/lib/dataset/preprocess/h36m_extract_frames.py | jjandnn/ROMP | 385 | 12645712 | <reponame>jjandnn/ROMP
import h5py
import sys
import os
import cv2
import numpy as np
import glob
import pickle
import sys
subject_list = ['S1', 'S5', 'S6', 'S7', 'S8', 'S9', 'S11']
cam_dict = {'54138969': 0, '55011271': 1, '58860488': 2, '60457274': 3}
def extract_imgs(subject_id, src_folder, out_folder):
video_... |
venv/Lib/site-packages/win32/Demos/BackupSeek_streamheaders.py | ajayiagbebaku/NFL-Model | 150 | 12645724 | ## demonstrates using BackupSeek to enumerate data streams for a file
import win32file, win32api, win32con
from win32com import storagecon
import pythoncom, pywintypes
import struct, traceback
stream_types = {
win32con.BACKUP_DATA: "Standard data",
win32con.BACKUP_EA_DATA: "Extended attribute data",
win32c... |
sfaira/data/dataloaders/loaders/d10_1016_j_neuron_2019_06_011/human_brain_2019_dropseq_polioudakis_001.py | theislab/sfaira | 110 | 12645725 | import os
import pandas
import shutil
import zipfile
def load(data_dir, **kwargs):
age_dict = {
17: "17th week post-fertilization human stage",
18: "18th week post-fertilization human stage",
}
ct_dict = {
"End": "Endothelial",
"ExDp1": "Excitatory deep layer 1",
"E... |
modelchimp/migrations/0023_machinelearningmodel_epoch_durations.py | akarsh3007/modelchimp | 134 | 12645800 | # Generated by Django 2.0.6 on 2018-07-02 14:50
import django.contrib.postgres.fields.jsonb
from django.db import migrations
class Migration(migrations.Migration):
dependencies = [
('modelchimp', '0022_auto_20180625_1722'),
]
operations = [
migrations.AddField(
model_name='m... |
pyEX/studies/technicals/volume.py | sourcery-ai-bot/pyEX | 107 | 12645813 | <reponame>sourcery-ai-bot/pyEX
# *****************************************************************************
#
# Copyright (c) 2020, the pyEX authors.
#
# This file is part of the pyEX library, distributed under the terms of
# the Apache License 2.0. The full license can be found in the LICENSE file.
#
import pandas... |
tests/test_namespaces.py | commarla/python-nomad | 109 | 12645818 | import tests.common as common
import pytest
import responses
# integration tests was mocked. If you have an enterprise nomad please uncomenet ##### ENTERPRISE TEST #####
@responses.activate
def test_get_namespaces(nomad_setup):
responses.add(
responses.GET,
"http://{ip}:{port}/v1/namespaces".form... |
examples/issues/issue432_b.py | tgolsson/appJar | 666 | 12645828 | import sys
sys.path.append("../../")
from appJar import gui
def press(btn):
if btn == "ONE": app.selectFrame("stack", 0)
elif btn == "TWO": app.selectFrame("stack", 1)
with gui() as app:
with app.frameStack("stack"):
with app.frame():
app.label("In frame one")
with app.frame()... |
examples/digit-recognizer/__init__.py | sUeharaE4/mlcomp | 166 | 12645856 | <reponame>sUeharaE4/mlcomp
# flake8: noqa
from catalyst.dl import SupervisedRunner as Runner
from experiment import Experiment
from model import Net |
caliban/platform/notebook.py | Anon-Artist/caliban | 425 | 12645863 | #!/usr/bin/python
#
# Copyright 2020 Google LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or ag... |
Validation/RecoTau/Tools/SteerMultipleCompare.py | Purva-Chaudhari/cmssw | 852 | 12645871 | <filename>Validation/RecoTau/Tools/SteerMultipleCompare.py
#! /usr/bin/env python3
from __future__ import print_function
import sys
import os
import re
from ROOT import *
import MultipleCompare as MultipleCompare
__author__ = "<NAME> (<EMAIL>)"
__doc__ = """Script to execute multiple plotting commands via MultipleC... |
rl_agents/trainer/state_sampler.py | neskoc/rl-agents | 342 | 12645879 | <reponame>neskoc/rl-agents
from abc import abstractmethod
import numpy as np
class AbstractStateSampler(object):
@abstractmethod
def states_list(self):
"""
Get a list of relevant states from a problem state-space
:return: 2D array of vertically stacked state rows
"""
... |
language/common/utils/export_utils_test.py | Xtuden-com/language | 1,199 | 12645916 | # coding=utf-8
# Copyright 2018 The Google AI Language Team Authors.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by ... |
Hackerrank/Company Contests/Sears Finals/Problem E/test.py | VastoLorde95/Competitive-Programming | 170 | 12645935 | from math import *
from fractions import *
def solve(n):
ans = 0
for i in xrange(1, n+1):
if gcd(i,n) == 1:
ans += gcd(i-1, n)
return ans
for i in xrange(1,20):
s = 0
for j in xrange(1, i+1):
p = 1
t = j
while t > 0:
p *= t % 10
t /= 10
s += solve(p)
print i, s
|
tensorflow_graphics/rendering/tests/cpu_rasterization_backend_test.py | Liang813/graphics | 2,759 | 12645976 | # Copyright 2020 The TensorFlow 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 law or agreed to i... |
networks/sceneflow_field.py | google/dynamic-video-depth | 144 | 12646004 | <gh_stars>100-1000
# Copyright 2021 Google LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agre... |
{{cookiecutter.project_name}}/{{cookiecutter.app_name}}/api/resources/__init__.py | lieutdan13/cookiecutter-flask-restful | 719 | 12646058 | <filename>{{cookiecutter.project_name}}/{{cookiecutter.app_name}}/api/resources/__init__.py
from {{cookiecutter.app_name}}.api.resources.user import UserResource, UserList
__all__ = ["UserResource", "UserList"]
|
tests/packerlicious/test_builder_vmware.py | gnewson/packerlicious | 109 | 12646066 | import pytest
import packerlicious.builder as builder
class TestVMwareIsoBuilder(object):
def test_required_fields_missing(self):
b = builder.VMwareIso()
with pytest.raises(ValueError) as excinfo:
b.to_dict()
assert 'required' in str(excinfo.value)
def test_iso_checksum... |
examples/imdb/prepare.py | rsketine/neon | 4,415 | 12646078 | # ******************************************************************************
# Copyright 2014-2018 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.apa... |
datadog_checks_dev/datadog_checks/dev/tooling/commands/release/trello/tester_selector/cache.py | mchelen-gov/integrations-core | 663 | 12646088 | <filename>datadog_checks_dev/datadog_checks/dev/tooling/commands/release/trello/tester_selector/cache.py
# (C) Datadog, Inc. 2020-present
# All rights reserved
# Licensed under a 3-clause BSD style license (see LICENSE)
import json
import os
from datetime import datetime
from typing import Optional
from ....console i... |
tests/changes/api/test_cached_snapshot_cluster_details.py | vault-the/changes | 443 | 12646099 | <filename>tests/changes/api/test_cached_snapshot_cluster_details.py
from changes.testutils import APITestCase
import datetime
import mock
class CachedSnapshotClusterDetailsAPITestCase(APITestCase):
def setUp(self):
super(CachedSnapshotClusterDetailsAPITestCase, self).setUp()
self.mock_datetime = ... |
deepneuro/outputs/segmentation.py | ysuter/DeepNeuro | 113 | 12646136 | <reponame>ysuter/DeepNeuro
import numpy as np
from deepneuro.outputs.inference import ModelInference
from deepneuro.utilities.util import add_parameter, docker_print
class PatchesInference(ModelInference):
"""
"""
def load(self, kwargs):
""" Parameters
----------
patch_... |
topologies/models.py | cklewar/wistar | 152 | 12646153 | #
# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER
#
# Copyright (c) 2015 Juniper Networks, Inc.
# All rights reserved.
#
# Use is subject to license terms.
#
# 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... |
tomviz/python/Recon_tomopy_gridrec.py | sankhesh/tomviz | 284 | 12646167 | <gh_stars>100-1000
def transform(dataset, rot_center=0, tune_rot_center=True):
"""Reconstruct sinograms using the tomopy gridrec algorithm
Typically, a data exchange file would be loaded for this
reconstruction. This operation will attempt to perform
flat-field correction of the raw data using the dark... |
extras/python/XSVFDisassembler.py | franzbischoff/JTAG | 105 | 12646182 | #!/usr/bin/python
# coding: utf-8
#
# example:
# $ ./xsvf -c disasm ../xsvf/XC2C64A/idcode_simpler.xsvf
#
import JTAGTAP
import XSVFDecoder
class XSVFDisassembler(XSVFDecoder.XSVFDecoder):
"""
XSVF Disassembler
"""
@staticmethod
def add_arguments(p):
"""Adds the necessary arguments to th... |
Module2/Python_Data_Analysis_code/Chapter 6/joblib/ch6util/read_wav/func_code.py | vijaysharmapc/Python-End-to-end-Data-Analysis | 119 | 12646199 | # first line: 10
@memory.cache
def read_wav():
wav = dl.data.get_smashing_baby()
return wavfile.read(wav)
|
mistral/db/sqlalchemy/migration/alembic_migrations/versions/035_namespace_support_postgresql.py | shubhamdang/mistral | 205 | 12646203 | <reponame>shubhamdang/mistral
# Copyright 2019 OpenStack Foundation.
#
# 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... |
tljh/user_creating_spawner.py | consideRatio/the-littlest-jupyterhub | 741 | 12646220 | from tljh.normalize import generate_system_username
from tljh import user
from tljh import configurer
from systemdspawner import SystemdSpawner
from traitlets import Dict, Unicode, List
from jupyterhub_configurator.mixins import ConfiguratorSpawnerMixin
class CustomSpawner(SystemdSpawner):
"""
SystemdSpawner w... |
lib/model/train_val_memory.py | xctspring/iter-reason | 275 | 12646232 | from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
from model.config import cfg
from model.train_val import filter_roidb, SolverWrapper
from utils.timer import Timer
try:
import cPickle as pickle
except ImportError:
import pickle
import numpy as np
import ... |
tests/test_molecule.py | liudongliangHI/ProLIF | 123 | 12646320 | <reponame>liudongliangHI/ProLIF<filename>tests/test_molecule.py
import pytest
from MDAnalysis import SelectionError
from rdkit import Chem
from prolif.molecule import (Molecule,
pdbqt_supplier,
mol2_supplier,
sdf_supplier)
from proli... |
scripts/examples/OpenMV/32-modbus/modbus_rtu_slave.py | jiskra/openmv | 1,761 | 12646339 | <filename>scripts/examples/OpenMV/32-modbus/modbus_rtu_slave.py<gh_stars>1000+
import time
from pyb import UART
from modbus import ModbusRTU
uart = UART(3,115200, parity=None, stop=2, timeout=1, timeout_char=4)
modbus = ModbusRTU(uart, register_num=9999)
while(True):
if modbus.any():
modbus.handle(debug=Tr... |
adalm/incr_bpe/tokenizer.py | Sanster/unilm | 5,129 | 12646355 | # coding=utf-8
# Copyright 2018 The Tensor2Tensor Authors.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.