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 |
|---|---|---|---|---|
llvm/utils/lit/tests/shtest-format.py | medismailben/llvm-project | 158 | 65269 | <gh_stars>100-1000
# Check the various features of the ShTest format.
#
# RUN: rm -f %t.xml
# RUN: not %{lit} -j 1 -v %{inputs}/shtest-format --xunit-xml-output %t.xml > %t.out
# RUN: FileCheck < %t.out %s
# RUN: FileCheck --check-prefix=XUNIT < %t.xml %s
# END.
# CHECK: -- Testing:
# CHECK: PASS: shtest-format :: a... |
.jenkins/pytorch/print_sccache_log.py | Hacky-DH/pytorch | 60,067 | 65303 | import sys
log_file_path = sys.argv[1]
with open(log_file_path) as f:
lines = f.readlines()
for line in lines:
# Ignore errors from CPU instruction set, symbol existing testing,
# or compilation error formatting
ignored_keywords = [
'src.c',
'CheckSymbolExists.c',
'test_compil... |
tests/fixers/test_commit_strategy.py | jsoref/lint-review | 271 | 65306 | <reponame>jsoref/lint-review<filename>tests/fixers/test_commit_strategy.py
from unittest import TestCase
from lintreview.fixers.commit_strategy import CommitStrategy
from lintreview.fixers.error import WorkflowError
from mock import patch, Mock, sentinel
from ..test_git import setup_repo, teardown_repo, clone_path
cl... |
acouchbase/tests/py34only.py | couchbase/couchbase-python-client | 189 | 65314 | import asyncio
from couchbase.asynchronous import AsyncSearchResult
from couchbase.asynchronous import AsyncAnalyticsResult
from .fixtures import asynct, AioTestCase
from couchbase.exceptions import CouchbaseException, SearchException, NotSupportedException
from unittest import SkipTest
import couchbase.search as SEAR... |
baseline_tokenization/javalang/test/test_java_8_syntax.py | greenmonn/code2seq | 2,151 | 65365 | <filename>baseline_tokenization/javalang/test/test_java_8_syntax.py
import unittest
from pkg_resources import resource_string
from .. import parse, parser, tree
def setup_java_class(content_to_add):
""" returns an example java class with the
given content_to_add contained within a method.
"""
tem... |
auctioning_platform/shipping/shipping/domain/value_objects/__init__.py | nhdinh/smp-modulith | 299 | 65393 | <reponame>nhdinh/smp-modulith
__all__ = ["ConsigneeId", "PackageStatus"]
from shipping.domain.value_objects.package_status import PackageStatus
ConsigneeId = int
|
navec/vocab.py | FreedomSlow/navec | 115 | 65395 |
from gzip import (
compress,
GzipFile
)
import numpy as np
from .record import Record
UNK = '<unk>'
PAD = '<pad>'
class Vocab(Record):
__attributes__ = ['words', 'counts']
def __init__(self, words, counts):
self.words = words
self.counts = counts
self.word_ids = {
... |
scripts/nick/import_pyEPR.py | mkxia57/pyEPR | 109 | 65429 | # -*- coding: utf-8 -*-
"""
Created on Tue Aug 22 11:21:01 2017
@author: Zlatko
"""
from pyEPR import *
if 0:
# Specify the HFSS project to be analyzed
project_info = ProjectInfo(r"X:\Simulation\\hfss\\KC\\")
project_info.project_name = '2013-12-03_9GHzCavity' # Name of the project file (string). "None... |
NX/catkin_ws/src/enet_ros/src/utils/transforms/data_augmentation.py | dlfdn9392/autonomous_driving_car_project | 199 | 65457 | import random
import numpy as np
import cv2
from utils.transforms.transforms import CustomTransform
class RandomFlip(CustomTransform):
def __init__(self, prob_x=0, prob_y=0):
"""
Arguments:
----------
prob_x: range [0, 1], probability to use horizontal flip, setting to 0 means dis... |
tests/manage/z_cluster/test_osd_heap_profile.py | annagitel/ocs-ci | 130 | 65465 | <filename>tests/manage/z_cluster/test_osd_heap_profile.py
import logging
import pytest
import time
import random
from ocs_ci.framework.testlib import (
ManageTest,
tier2,
skipif_ocs_version,
bugzilla,
skipif_external_mode,
)
from ocs_ci.ocs.resources.pod import get_ceph_tools_pod, get_osd_pods, get... |
head/__init__.py | NotMorven/cavaface.pytorch | 329 | 65467 | from head.metrics import *
from head.metrics_parallel import *
HEAD_DICT = {
"Softmax": Softmax,
"ArcFace": ArcFace,
"Combined": Combined,
"CosFace": CosFace,
"SphereFace": SphereFace,
"Am_softmax": Am_softmax,
"CurricularFace": CurricularFace,
"ArcNegFace": ArcNegFace,
"SVX": SVXSo... |
spartan/examples/ssvd/ssvd.py | GabrielWen/spartan | 156 | 65507 | import spartan
from spartan import core, expr, util, blob_ctx
import numpy as np
from .qr import qr
def svd(A, k=None):
"""
Stochastic SVD.
Parameters
----------
A : spartan matrix
Array to compute the SVD on, of shape (M, N)
k : int, optional
Number of singular values and vectors to compute.... |
setup/setup_database.py | Gui-Luz/Empire | 5,720 | 65515 | #!/usr/bin/env python
import sqlite3, os, string, hashlib, random
###################################################
#
# Default values for the config
#
###################################################
# Staging Key is set up via environmental variable
# or via command line. By setting RANDOM a randomly
# selec... |
egs/lj/local/preprocess_scripts/text/parse_pronounce.py | entn-at/efficient_tts | 111 | 65518 | <reponame>entn-at/efficient_tts<filename>egs/lj/local/preprocess_scripts/text/parse_pronounce.py
import os
from util import register
mandarin_initial_list = ["b", "ch", "c", "d", "f", "g", "h", "j", "k", "l",
"m", "n", "p", "q", "r", "sh", "s", "t", "x", "zh",
... |
python/dgllife/data/pcba.py | padr31/dgl-lifesci | 390 | 65533 | # -*- coding: utf-8 -*-
#
# Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
# SPDX-License-Identifier: Apache-2.0
#
# PCBA from MoleculeNet for the prediction of biological activities
import pandas as pd
from dgl.data.utils import get_download_dir, download, _get_dgl_url, extract_archive
from .csv... |
rl/agents/a2c/agent_test.py | jaejaywoo/pysc2-rl-agents | 138 | 65534 | from collections import namedtuple
import tensorflow as tf
import numpy as np
from rl.agents.a2c.agent import A2CAgent
TestArgType = namedtuple('ArgType', ['name'])
arg_type = TestArgType('arg')
A = np.array
class A2CAgentTest(tf.test.TestCase):
def test_compute_policy_log_probs(self):
from rl.agents.a2c.a... |
python/tvm/topi/cuda/nms.py | XiaoSong9905/tvm | 4,640 | 65541 | <reponame>XiaoSong9905/tvm
# 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
... |
languages/python/sqlalchemy-oso/sqlalchemy_oso/oso.py | connec/oso | 2,167 | 65548 | from oso import Oso
from .auth import register_models
class SQLAlchemyOso(Oso):
"""The central object to manage application policy state, e.g.
the policy data, and verify requests when using Oso with SQLAlchemy.
Supports SQLAlchemy-specific functionality, including data filtering.
Accepts a SQLAlch... |
stevedore/enabled.py | jaraco/stevedore | 133 | 65561 | # 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
# distributed u... |
se/vendor/kindleunpack/mobi_k8proc.py | vr8hub/tools | 985 | 65565 | <gh_stars>100-1000
#!/usr/bin/env python
# -*- coding: utf-8 -*-
# vim:ts=4:sw=4:softtabstop=4:smarttab:expandtab
from __future__ import unicode_literals, division, absolute_import, print_function
from .compatibility_utils import PY2, bstr, utf8_str
if PY2:
range = xrange
import os
import struct
# note: struc... |
third_party/WebKit/Source/devtools/scripts/optimize_png_images.py | google-ar/chromium | 777 | 65572 | <reponame>google-ar/chromium<filename>third_party/WebKit/Source/devtools/scripts/optimize_png_images.py
#!/usr/bin/env python
# Copyright (c) 2014 Google Inc. All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions ... |
tests/integration/actions/run/base.py | ekmixon/ansible-navigator | 134 | 65583 | <filename>tests/integration/actions/run/base.py
"""Base class for run interactive/stdout tests.
"""
import difflib
import json
import os
from typing import Optional
import pytest
from ..._interactions import SearchFor
from ..._interactions import Step
from ....defaults import FIXTURES_DIR
from ..._common import fixt... |
sdk/servicefabric/azure-mgmt-servicefabric/azure/mgmt/servicefabric/models/_models.py | rsdoherty/azure-sdk-for-python | 2,728 | 65588 | <filename>sdk/servicefabric/azure-mgmt-servicefabric/azure/mgmt/servicefabric/models/_models.py
# coding=utf-8
# --------------------------------------------------------------------------
# Copyright (c) Microsoft Corporation. All rights reserved.
# Licensed under the MIT License. See License.txt in the project root fo... |
examples/dataflow/chatbot/operations.py | agriyakhetarpal/dffml | 171 | 65606 | <reponame>agriyakhetarpal/dffml
import io
import re
import json
import tempfile
import contextlib
from aiohttp import ClientSession, ClientTimeout
from dffml.cli.cli import CLI
from dffml import op, config, Definition, BaseSecret
ACCESSTOKEN = Definition(name="access_token", primitive="str")
ROOMNAME = Definition(nam... |
tests/integration/runner.py | techjacker/systemdlogger | 102 | 65609 | import pytest
from unittest.mock import patch
import tests.fixtures.journal as FakeJournalExporter
from systemdlogger.elasticsearch import ElasticsearchLogger
@pytest.mark.parametrize(('config_path'), [
'tests/fixtures/config_es.json'
])
class TestRunner:
def setup_method(self, method):
""" setup any... |
sandbox/block_waveglow.py | Nijta/project-NN-Pytorch-scripts | 150 | 65612 | <reponame>Nijta/project-NN-Pytorch-scripts
#!/usr/bin/env python
"""
Building blocks for waveglow
"""
from __future__ import absolute_import
import sys
import numpy as np
import torch
import torch.nn as torch_nn
import torch.nn.functional as torch_nn_func
import torch.nn.init as torch_init
import sandbox.block_nn a... |
maml/apps/symbolic/_selectors.py | anooptp/maml | 161 | 65623 | <reponame>anooptp/maml
"""
Selectors
"""
import inspect
from collections import defaultdict
from itertools import combinations
from typing import List, Optional, Union, Dict, Callable
import numpy as np
from scipy.linalg import lstsq
from scipy.optimize import minimize, NonlinearConstraint
from sklearn.linear_model im... |
dev/Tools/Python/3.7.10/linux_x64/lib/python3.7/site-packages/pip/_vendor/html5lib/treewalkers/genshi.py | brianherrera/lumberyard | 1,738 | 65629 | from __future__ import absolute_import, division, unicode_literals
from genshi.core import QName
from genshi.core import START, END, XML_NAMESPACE, DOCTYPE, TEXT
from genshi.core import START_NS, END_NS, START_CDATA, END_CDATA, PI, COMMENT
from . import base
from ..constants import voidElements, name... |
configs/fcn/fcn_r50-d8_480x480_40k_pascal_context.py | weiyx16/mmsegmentation | 367 | 65650 | <filename>configs/fcn/fcn_r50-d8_480x480_40k_pascal_context.py
_base_ = [
'../_base_/models/fcn_r50-d8.py', '../_base_/datasets/pascal_context.py',
'../_base_/default_runtime.py', '../_base_/schedules/schedule_40k.py'
]
model = dict(
decode_head=dict(num_classes=60),
auxiliary_head=dict(num_classes=60),... |
tensorflow_probability/python/distributions/joint_distribution_auto_batched_test.py | jakee417/probability-1 | 3,670 | 65651 | # Copyright 2018 The TensorFlow Probability Authors.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law o... |
cupyx/scipy/special/_bessel.py | prkhrsrvstv1/cupy | 6,180 | 65658 | <filename>cupyx/scipy/special/_bessel.py
from cupy import _core
j0 = _core.create_ufunc(
'cupyx_scipy_special_j0', ('f->f', 'd->d'),
'out0 = j0(in0)',
doc='''Bessel function of the first kind of order 0.
.. seealso:: :meth:`scipy.special.j0`
''')
j1 = _core.create_ufunc(
'cupyx_scipy_speci... |
lectures/lecture00/code/helloWorldBroke.py | mateusza/Introduction-to-Python-Numerical-Analysis-for-Engineers-and-Scientist | 101 | 65668 | from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
print 'hello world' |
configs/irr/irrpwc_8x1_sfine_half_flyingthings3d_subset_384x768.py | hologerry/mmflow | 481 | 65672 | <reponame>hologerry/mmflow
_base_ = [
'../_base_/models/irrpwc.py',
'../_base_/datasets/flyingthings3d_subset_bi_with_occ_384x768.py',
'../_base_/schedules/schedule_s_fine_half.py',
'../_base_/default_runtime.py'
]
custom_hooks = [dict(type='EMAHook')]
data = dict(
train_dataloader=dict(
s... |
Python_Scripts/twitter/func_call.py | kaustubhsh/TIGMINT | 177 | 65673 | import sys
import base_func as base
import twint
from similar_hashtags import similar_hashtags
from top_mentions_hashtags import top_mentions_hashtags as mentions
def basic(username,search):
base.get_user_bio(username,search)
base.get_user_tweets(username,search,True)
def get_keyword(key,limit=100):
base... |
modules/search/search_config.py | 276793422/attack-website | 327 | 65686 | <filename>modules/search/search_config.py
module_name = "Search"
priority = 17 |
followbot/follower_blind.py | amjadmajid/rosbook | 442 | 65692 | <reponame>amjadmajid/rosbook<filename>followbot/follower_blind.py
#!/usr/bin/env python
# BEGIN ALL
import rospy
from sensor_msgs.msg import Image
import cv2, cv_bridge
from geometry_msgs.msg import Twist
class Follower:
def __init__(self):
self.bridge = cv_bridge.CvBridge()
cv2.namedWindow("window", 1)
... |
clai/server/searchlib/se_provider.py | cohmoti/clai | 391 | 65702 | #
# Copyright (C) 2020 IBM. All Rights Reserved.
#
# See LICENSE.txt file in the root directory
# of this source tree for licensing information.
#
import json
from typing import List, Dict
from clai.server.searchlib.providers import Provider
class StackExchange(Provider):
def __init__(self, name: str, descripti... |
tensorflow/python/estimator/export/export_output.py | DEVESHTARASIA/tensorflow | 384 | 65713 | # Copyright 2017 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 a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applica... |
catalyst/contrib/utils/swa.py | tadejsv/catalyst | 2,693 | 65743 | <gh_stars>1000+
from typing import List, Union
from collections import OrderedDict
import glob
import os
from pathlib import Path
import torch
def _load_weights(path: str) -> dict:
"""
Load weights of a model.
Args:
path: Path to model weights
Returns:
Weights
"""
weights = ... |
database/api/scores_old.py | aprilsanchez/ictf-framework | 110 | 65759 | <gh_stars>100-1000
# Scores old stuff
#
# Helper functions
#
# FIXME: use ticks instead, teams are either up for the whole tick or down for the whole tick
def _get_uptime_for_team(team_id, cursor):
"""Calculate the uptime for a team.
The uptime is normalized to 0 to 100. An uptime of 100 means the team was
... |
tools/pot/openvino/tools/pot/algorithms/quantization/accuracy_aware_common/utils.py | chccc1994/openvino | 2,406 | 65766 | # Copyright (C) 2020-2021 Intel Corporation
# SPDX-License-Identifier: Apache-2.0
from copy import deepcopy
from functools import partial
import numpy as np
import scipy
from addict import Dict
from ....algorithms.quantization import utils as eu
from ....engines.ac_engine import ACEngine
from ....graph.model_utils i... |
src/sage/combinat/root_system/coxeter_group.py | fchapoton/sage | 1,742 | 65771 | <reponame>fchapoton/sage
"""
Coxeter Groups
"""
#*****************************************************************************
# Copyright (C) 2010 <NAME> <nthiery at users.sf.net>
#
# Distributed under the terms of the GNU General Public License (GPL)
#
# http://www.gnu.org/licenses/
#*********... |
homeassistant/components/flick_electric/sensor.py | learn-home-automation/core | 22,481 | 65774 | <filename>homeassistant/components/flick_electric/sensor.py
"""Support for Flick Electric Pricing data."""
from datetime import timedelta
import logging
import async_timeout
from pyflick import FlickAPI, FlickPrice
from homeassistant.components.sensor import SensorEntity
from homeassistant.config_entries import Confi... |
omaha_server/crash/views.py | fiadm/omaha-server | 142 | 65789 | <filename>omaha_server/crash/views.py<gh_stars>100-1000
# coding: utf8
"""
This software is licensed under the Apache 2 license, quoted below.
Copyright 2014 Crystalnix 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 obt... |
spitfire/runtime/template.py | atubbs/spitfire | 385 | 65797 | <reponame>atubbs/spitfire<filename>spitfire/runtime/template.py<gh_stars>100-1000
# Copyright 2007 The Spitfire Authors. All Rights Reserved.
#
# Use of this source code is governed by a BSD-style
# license that can be found in the LICENSE file.
# an 'abstract' base class for a template, seems like a good idea for now... |
tests/test_router_register.py | ricfri/fastapi-users | 660 | 65812 | <reponame>ricfri/fastapi-users
from typing import Any, AsyncGenerator, Dict, cast
import httpx
import pytest
from fastapi import FastAPI, status
from fastapi_users.router import ErrorCode, get_register_router
from tests.conftest import User, UserCreate
@pytest.fixture
@pytest.mark.asyncio
async def test_app_client(... |
peewee__examples/serialization__model_to_dict__dict_to_model/main.py | DazEB2/SimplePyScripts | 117 | 65833 | <reponame>DazEB2/SimplePyScripts<filename>peewee__examples/serialization__model_to_dict__dict_to_model/main.py<gh_stars>100-1000
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
__author__ = 'ipetrash'
import datetime as DT
# pip install peewee
from peewee import *
from playhouse.shortcuts import model_to_dict, dict... |
voc_loader.py | abhi-kumar/blitznet | 331 | 65845 | import logging
import os
import numpy as np
import xml.etree.ElementTree as ET
from PIL import Image
from paths import DATASETS_ROOT
log = logging.getLogger()
VOC_CATS = ['__background__', 'aeroplane', 'bicycle', 'bird', 'boat', 'bottle',
'bus', 'car', 'cat', 'chair', 'cow', 'diningtable', 'dog', 'hors... |
src/skmultiflow/_demos/_test_adwin.py | denisesato/scikit-multiflow | 663 | 65846 | import numpy as np
from skmultiflow.drift_detection import ADWIN
def demo():
""" _test_adwin
In this demo, an ADWIN object evaluates a sequence of numbers corresponding to 2 distributions.
The ADWIN object indicates the indices where change is detected.
The first half of the data is a sequence ... |
paddlespeech/cli/stats/infer.py | jerryuhoo/PaddleSpeech | 1,379 | 65864 | <reponame>jerryuhoo/PaddleSpeech<gh_stars>1000+
# Copyright (c) 2021 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/l... |
tools/Vitis-AI-Quantizer/vai_q_pytorch/nndct_shared/utils/registry.py | hito0512/Vitis-AI | 848 | 65900 |
#
# Copyright 2019 Xilinx 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 law or agreed to in writi... |
aliyun-python-sdk-hbase/aliyunsdkhbase/request/v20190101/CreateClusterRequest.py | yndu13/aliyun-openapi-python-sdk | 1,001 | 65901 | <filename>aliyun-python-sdk-hbase/aliyunsdkhbase/request/v20190101/CreateClusterRequest.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. The ASF license... |
leetcode.com/python/876_Middle_of_the_Linked_List.py | vansh-tiwari/coding-interview-gym | 713 | 65911 | <gh_stars>100-1000
# Definition for singly-linked list.
# class ListNode(object):
# def __init__(self, x):
# self.val = x
# self.next = None
class Solution(object):
def middleNode(self, head):
"""
:type head: ListNode
:rtype: ListNode
"""
if not head:
... |
DQM/SiPixelPhase1Track/python/SiPixelPhase1TrackEfficiency_cfi.py | malbouis/cmssw | 852 | 65919 | import FWCore.ParameterSet.Config as cms
from DQMServices.Core.DQMEDHarvester import DQMEDHarvester
from DQM.SiPixelPhase1Common.HistogramManager_cfi import *
import DQM.SiPixelPhase1Common.TriggerEventFlag_cfi as trigger
SiPixelPhase1TrackEfficiencyValid = DefaultHistoTrack.clone(
name = "valid",
title = "Valid H... |
util/tlgen/elaborate.py | asb/opentitan | 1,375 | 65938 | # Copyright lowRISC contributors.
# Licensed under the Apache License, Version 2.0, see LICENSE for details.
# SPDX-License-Identifier: Apache-2.0
import logging as log
from .item import Node, NodeType
from .xbar import Xbar
def elaborate(xbar: Xbar) -> bool:
"""elaborate reads all nodes and edges then
cons... |
lassie/compat.py | idlesign/lassie | 354 | 65958 | <reponame>idlesign/lassie<gh_stars>100-1000
# -*- coding: utf-8 -*-
"""
lassie.compat
~~~~~~~~~~~~~
This module contains imports and declarations for seamless Python 2 and
Python 3 compatibility.
"""
import sys
_ver = sys.version_info
#: Python 2.x?
is_py2 = (_ver[0] == 2)
#: Python 3.x?
is_py3 = (_ver[0] == 3)
... |
photutils/detection/irafstarfinder.py | rosteen/photutils | 167 | 66003 | <gh_stars>100-1000
# Licensed under a 3-clause BSD style license - see LICENSE.rst
"""
This module implements the IRAFStarFinder class.
"""
import inspect
import warnings
from astropy.nddata import extract_array
from astropy.table import QTable
from astropy.utils import lazyproperty
import numpy as np
from .core impo... |
docs/generate_api_docs.py | mxmpl/pykaldi | 916 | 66004 | #!/usr/bin/env python
from __future__ import print_function
import argparse
import os
import pkgutil
import sys
from subprocess import check_call
import kaldi
parser = argparse.ArgumentParser(
description="Generates autosummary documentation for pykaldi.")
# parser.add_argument('--force', '-f', action='store_... |
alipay/aop/api/domain/ExRefRateInfoVO.py | snowxmas/alipay-sdk-python-all | 213 | 66024 | #!/usr/bin/env python
# -*- coding: utf-8 -*-
import json
from alipay.aop.api.constant.ParamConstants import *
class ExRefRateInfoVO(object):
def __init__(self):
self._currency_pair = None
self._datum_currency = None
self._price_type = None
self._pub_date = None
self._pub... |
pmca/usb/driver/windows/__init__.py | kratz00/Sony-PMCA-RE | 1,313 | 66034 | import re
def parseDeviceId(id):
match = re.search('(#|\\\\)vid_([a-f0-9]{4})&pid_([a-f0-9]{4})(&|#|\\\\)', id, re.IGNORECASE)
return [int(match.group(i), 16) if match else None for i in [2, 3]]
|
ufora/core/JsonPickle.py | ufora/ufora | 571 | 66038 | # Copyright 2015 Ufora 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 law or agreed to i... |
Chapter08/background_substraction_MOG.py | debojyoti007/OpenCV | 105 | 66043 | import cv2
import numpy as np
# Capture the input frame
def get_frame(cap, scaling_factor=0.5):
ret, frame = cap.read()
# Resize the frame
frame = cv2.resize(frame, None, fx=scaling_factor,
fy=scaling_factor, interpolation=cv2.INTER_AREA)
return frame
if __name__=='__main__'... |
idaes/surrogate/alamopy_depr/tests/examples.py | carldlaird/idaes-pse | 112 | 66054 | <reponame>carldlaird/idaes-pse
#!/usr/bin/python
#################################################################################
# The Institute for the Design of Advanced Energy Systems Integrated Platform
# Framework (IDAES IP) was produced under the DOE Institute for the
# Design of Advanced Energy Systems (IDAES)... |
src/cocoa/toga_cocoa/widgets/selection.py | luizoti/toga | 1,261 | 66056 | <reponame>luizoti/toga<gh_stars>1000+
from travertino.size import at_least
from toga_cocoa.libs import SEL, NSPopUpButton, objc_method
from .base import Widget
class TogaPopupButton(NSPopUpButton):
@objc_method
def onSelect_(self, obj) -> None:
if self.interface.on_select:
self.interface... |
src/wavegrad/learner.py | CookiePPP/wavegrad | 182 | 66057 | # Copyright 2020 LMNT, 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 law or ag... |
src/main/python/rlbot/agents/hivemind/drone_agent.py | VirxEC/RLBot | 408 | 66071 | <gh_stars>100-1000
import os
from rlbot.agents.base_independent_agent import BaseIndependentAgent
from rlbot.botmanager.helper_process_request import HelperProcessRequest
class DroneAgent(BaseIndependentAgent):
# Path to the hivemind helperprocess python file.
hive_path = None
# Bots with the same key wi... |
gryphon/data_service/exchange_volume_consumer.py | qiquanzhijia/gryphon | 1,109 | 66074 | <reponame>qiquanzhijia/gryphon
import pyximport; pyximport.install()
import json
import os
import subprocess
from delorean import epoch
from raven import Client
from gryphon.data_service.consts import *
from gryphon.data_service.queue_consumer import QueueConsumer
from gryphon.lib import session
from gryphon.lib.mod... |
theanets/layers/convolution.py | timgates42/theanets | 314 | 66078 | <reponame>timgates42/theanets
# -*- coding: utf-8 -*-
'''Convolutional layers "scan" over input data.'''
from __future__ import division
import numpy as np
import theano
import theano.tensor as TT
from . import base
from .. import util
__all__ = [
'Conv1',
'Conv2',
'Pool1',
'Pool2',
]
class Convo... |
s2s-ft/setup.py | Maria-philna/unilm | 5,129 | 66085 | <filename>s2s-ft/setup.py
from io import open
from setuptools import find_packages, setup
extras = {
'serving': ['pydantic', 'uvicorn', 'fastapi'],
'serving-tf': ['pydantic', 'uvicorn', 'fastapi'],
'serving-torch': ['pydantic', 'uvicorn', 'fastapi', 'torch']
}
extras['all'] = [package for package in extra... |
src/python/nimbusml/internal/entrypoints/_ensemblebinarydiversitymeasure_disagreementdiversitymeasure.py | michaelgsharp/NimbusML | 134 | 66094 | <gh_stars>100-1000
# - Generated by tools/entrypoint_compiler.py: do not edit by hand
"""
DisagreementDiversityMeasure
"""
from ..utils.entrypoints import Component
def disagreement_diversity_measure(
**params):
"""
**Description**
None
"""
entrypoint_name = 'DisagreementDiversityM... |
ocr/utils/beam_search.py | vee51/Hand | 435 | 66107 | <gh_stars>100-1000
# From https://github.com/githubharald/CTCDecoder
#
#MIT License
#Copyright (c) 2018 <NAME>
#Permission is hereby granted, free of charge, to any person obtaining a copy
#of this software and associated documentation files (the "Software"), to deal
#in the Software without restriction, including wi... |
saspy/sasexceptions.py | metllord/saspy | 317 | 66130 | <gh_stars>100-1000
#
# Copyright SAS Institute
#
# 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 a... |
crow/scripts/find_eigen.py | rinelson456/raven | 159 | 66168 | #!/bin/env python
from __future__ import division, print_function , unicode_literals, absolute_import
import os, sys, subprocess
crow_dir = os.path.dirname(os.path.dirname(os.path.abspath(__file__)))
eigen_cflags = ""
try:
has_pkg_eigen = subprocess.call(["pkg-config","--exists","eigen3"]) == 0
except:
has_pkg_... |
baal/utils/plot_utils.py | llv22/baal_tf2.4_mac | 575 | 66229 | <reponame>llv22/baal_tf2.4_mac<filename>baal/utils/plot_utils.py
from typing import List
import matplotlib.pyplot as plt
import numpy as np
BG_COLOR = "lavender"
FG_COLORS = [
"b",
"g",
"r",
"c",
"m",
"y",
"tab:orange",
"tab:purple",
"limegreen",
"yellow",
"tab:brown",
]
... |
test/test_util.py | westonsteimel/pip-audit | 447 | 66239 | <filename>test/test_util.py
from packaging.version import Version
import pip_audit._util as util
def test_python_version():
v = util.python_version()
assert v is not None
assert isinstance(v, Version)
|
fairseq/legacy_distributed_data_parallel.py | blufb/fairseq | 307 | 66256 | <gh_stars>100-1000
# Copyright (c) 2017-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. An additional grant of patent rights
# can be found in the PATENTS file in the same directory.
"""
A modified ... |
panoptic_mapping_utils/src/detectron2/create_detectron_predictions.py | YuePanEdward/panoptic_mapping | 101 | 66263 | #!/usr/bin/python
# export PYTHONPATH=/home/lukas/anaconda3/envs/detectron/bin/python
# import some common libraries
from genericpath import isdir
import numpy as np
import os
import json
import cv2
import time
import csv
import detectron2
from detectron2 import model_zoo
from detectron2.engine import DefaultPredicto... |
tests/hikari/impl/test_buckets.py | sabidib/hikari | 520 | 66301 | <filename>tests/hikari/impl/test_buckets.py
# -*- coding: utf-8 -*-
# Copyright (c) 2020 Nekokatt
# Copyright (c) 2021 davfsa
#
# 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 restric... |
networks.py | SubZero12556/Cats2dogs_ONNX | 2,519 | 66307 | <filename>networks.py
import torch
import torch.nn as nn
from torch.nn.parameter import Parameter
class ResnetGenerator(nn.Module):
def __init__(self, input_nc, output_nc, ngf=64, n_blocks=6, img_size=256, light=False):
assert(n_blocks >= 0)
super(ResnetGenerator, self).__init__()
... |
tests/softlearning/environments/adapters/robosuite_adapter_test.py | brickerino/tqc | 362 | 66322 | import unittest
import numpy as np
from .softlearning_env_test import AdapterTestClass
from softlearning.environments.adapters.robosuite_adapter import (
RobosuiteAdapter)
class TestRobosuiteAdapter(unittest.TestCase, AdapterTestClass):
# TODO(hartikainen): This is a terrible way of testing the envs.
# ... |
mhandle_content.py | zyhibook/igotolibrary | 171 | 66325 | #!/usr/bin/python
# -*- coding: UTF-8 -*-
# @filename:mhandle_content.py
# @author: wheee/qmppz
# @time:20190709
# @description: handle msg, python3
import configparser
import time
import random
import json
import os
import re
import requests
import sys
# sys.path.append("../..")
# import igotolibrary.mhandle_conten... |
twilio/rest/trusthub/v1/trust_products/trust_products_channel_endpoint_assignment.py | BrimmingDev/twilio-python | 1,362 | 66336 | <reponame>BrimmingDev/twilio-python
# coding=utf-8
r"""
This code was generated by
\ / _ _ _| _ _
| (_)\/(_)(_|\/| |(/_ v1.0.0
/ /
"""
from twilio.base import deserialize
from twilio.base import values
from twilio.base.instance_context import InstanceContext
from twilio.base.instance_resource impo... |
fastapi_sqlmodel_typer/routes/security.py | tzengwei/fastapi-sqlmodel-typer | 123 | 66342 | <filename>fastapi_sqlmodel_typer/routes/security.py
from datetime import timedelta
from fastapi import APIRouter, Depends, HTTPException, status
from fastapi.security import OAuth2PasswordRequestForm
from ..config import settings
from ..security import (
Token,
User,
authenticate_user,
create_access_t... |
systrace/systrace/tracing_controller.py | tingshao/catapult | 138 | 66347 | <gh_stars>100-1000
#!/usr/bin/env python
# Copyright 2016 The Chromium Authors. All rights reserved.
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
'''Tracing controller class. This class manages
multiple tracing agents and collects data from all of them. It also... |
edl/Library/gpt.py | koyuyesil/edl | 514 | 66348 | #!/usr/bin/python3
# -*- coding: utf-8 -*-
# (c) B.Kerler 2018-2021
import argparse
import os
import sys
import logging
from enum import Enum
from struct import unpack, pack
from binascii import hexlify
try:
from edl.Library.utils import LogBase, structhelper
except:
from utils import LogBase, structhelper
c... |
lib/matplotlib/pylab.py | jbbrokaw/matplotlib | 113 | 66367 | <gh_stars>100-1000
"""
This is a procedural interface to the matplotlib object-oriented
plotting library.
The following plotting commands are provided; the majority have
MATLAB |reg| [*]_ analogs and similar arguments.
.. |reg| unicode:: 0xAE
_Plotting commands
acorr - plot the autocorrelation function
annot... |
pymagnitude/third_party/allennlp/tests/models/esim_test.py | tpeng/magnitude | 1,520 | 66397 | # pylint: disable=no-self-use,invalid-name
from __future__ import division
from __future__ import absolute_import
import numpy
from numpy.testing import assert_almost_equal
from allennlp.common.testing import ModelTestCase
class TestESIM(ModelTestCase):
def setUp(self):
super(TestESIM, self).setUp()
... |
Exercise7/utils.py | camilodelvalle/machine-learning-coursera | 118 | 66401 | import sys
import numpy as np
from matplotlib import pyplot
from matplotlib.animation import FuncAnimation
import matplotlib as mpl
sys.path.append('..')
from submission import SubmissionBase
def displayData(X, example_width=None, figsize=(10, 10)):
"""
Displays 2D data in a nice grid.
Parameters
--... |
kivy/uix/carousel.py | Sentient07/kivy | 317 | 66404 | <reponame>Sentient07/kivy<filename>kivy/uix/carousel.py
'''
Carousel
========
.. versionadded:: 1.4.0
The :class:`Carousel` widget provides the classic mobile-friendly carousel view
where you can swipe between slides.
You can add any content to the carousel and use it horizontally or verticaly.
The carousel can displ... |
tests/modules/net_ilb/test_plan.py | IuryAlves/cloud-foundation-fabric | 203 | 66406 | # 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 agreed to in writing, ... |
astroquery/casda/tests/test_casda.py | gbrammer/astroquery | 577 | 66412 | # -*- coding: utf-8 -*
# Licensed under a 3-clause BSD style license - see LICENSE.rst
import pytest
import requests
import os
from astropy.coordinates import SkyCoord
import astropy.units as u
from astropy.table import Table, Column
from astropy.io.votable import parse
from astroquery import log
from astroquery.c... |
homeassistant/components/notify_events/const.py | tbarbette/core | 30,023 | 66417 | <filename>homeassistant/components/notify_events/const.py
"""Const for notify_events."""
DOMAIN = "notify_events"
|
utils/mean_values.py | SivagamiNambi/Pytorch3d | 162 | 66442 | # Source: https://github.com/kenshohara/3D-ResNets-PyTorch/blob/master/mean.py
def get_mean(norm_value=255, dataset='activitynet'):
# Below values are in RGB order
assert dataset in ['activitynet', 'kinetics', 'ucf101']
if dataset == 'activitynet':
return [114.7748/norm_value, 107.7354/norm_value... |
docs/introduction/codeexamples/googleProxy.py | tristanlatr/klein | 643 | 66447 | <reponame>tristanlatr/klein<gh_stars>100-1000
import treq
from klein import Klein
app = Klein()
@app.route("/", branch=True)
def google(request):
d = treq.get("https://www.google.com" + request.uri)
d.addCallback(treq.content)
return d
app.run("localhost", 8080)
|
pywick/datasets/tnt/transformdataset.py | achaiah/pywick | 408 | 66450 | <reponame>achaiah/pywick
from .dataset import Dataset
class TransformDataset(Dataset):
"""
Dataset which transforms a given dataset with a given function.
Given a function `transform`, and a `dataset`, `TransformDataset` applies
the function in an on-the-fly manner when querying a sample with
`__... |
mantraml/models/__init__.py | cclauss/mantra | 330 | 66451 | from .MantraModel import MantraModel |
tst/regression/scripts/utils/log_pipe.py | lucyundead/athena--fork | 174 | 66463 | """Provides LogPipe class to pipe output from subprocess to a log.
Adapted from https://codereview.stackexchange.com/questions/6567"""
import logging
import threading
import os
class LogPipe(threading.Thread):
def __init__(self, logger, level):
"""Setup the object with a logger and a loglevel and start th... |
modelci/types/models/pattern.py | Lionjump0723/ML-Model-CI | 170 | 66482 | #!/usr/bin/env python
# -*- coding: utf-8 -*-
"""
Author: USER
Email: <EMAIL>
Date: 2/24/2021
Basic patterns for creation of required components.
"""
import ast
import inspect
from enum import Enum
from typing import Type, Any, Union
from fastapi import Form
from fastapi.exceptions import RequestValidationError
from ... |
chapter-6/holdings/holdings/clients.py | wallacei/microservices-in-action-copy | 115 | 66568 | import logging
import requests
from tenacity import before_log, retry, stop_after_attempt
class MarketDataClient(object):
logger = logging.getLogger(__name__)
base_url = 'http://market-data:8000'
def _make_request(self, url):
response = requests.get(
f"{self.base_url}/{url}", header... |
holoviews/tests/plotting/bokeh/test_geomplot.py | TheoMathurin/holoviews | 864 | 66576 | from unittest import SkipTest
from holoviews.core import NdOverlay
from holoviews.core.util import pd
from holoviews.element import Segments
from .test_plot import TestBokehPlot, bokeh_renderer
try:
from bokeh.models import FactorRange
except:
pass
class TestSegmentPlot(TestBokehPlot):
def test_segmen... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.