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 |
|---|---|---|---|---|
tests/common/test_op/ascend/leaky_relu.py | tianjiashuo/akg | 286 | 9599329 | <gh_stars>100-1000
# Copyright 2020-2021 Huawei Technologies Co., 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... |
gis4wrf/core/program.py | XavierCLL/gis4wrf | 111 | 9599332 | from typing import Optional, List, Iterable, Tuple, Any
import os
import sys
import platform
import subprocess
import multiprocessing
import time
from gis4wrf.core.util import export
from gis4wrf.core.errors import UserError, UnsupportedError
def get_startup_info():
# This is a function instead of a global becaus... |
cnvlib/__init__.py | sridhar0605/cnvkit | 342 | 9599338 | from skgenome.tabio import write
from ._version import __version__
from .cmdutil import read_cna as read
from .commands import *
from .diagram import create_diagram as do_diagram
|
tests/api/test_client.py | sobolevn/paasta | 1,711 | 9599339 | <filename>tests/api/test_client.py
# Copyright 2015-2016 Yelp 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 ap... |
utils/copy_framework_template.py | RajkumarQxf2/qxf2-page-object-model | 207 | 9599347 | """
This script would copy the required framework files from the input source to the input destination given by the user.
1. Copy files from POM to the newly created destination directory.
2. Verify if the destination directory is created and create the sub-folder to copy files from POM\Conf.
3. Verify if the destinati... |
var/spack/repos/builtin/packages/hal/package.py | kkauder/spack | 2,360 | 9599368 | # Copyright 2013-2021 Lawrence Livermore National Security, LLC and other
# Spack Project Developers. See the top-level COPYRIGHT file for details.
#
# SPDX-License-Identifier: (Apache-2.0 OR MIT)
from spack import *
class Hal(MakefilePackage):
"""HAL is a structure to efficiently store and index multiple
g... |
packages/pyright-internal/src/tests/samples/function8.py | martindemello/pyright | 4,391 | 9599379 | # This sample verifies that functions are treated as though they
# derive from object.
from typing import Callable, Union, overload
@overload
def func1(a: str) -> str:
...
@overload
def func1(a: int) -> int:
...
def func1(a: Union[str, int]) -> Union[str, int]:
...
def func2(a: Union[str, int]) -> ... |
example/scale-on-tweet/evaluate.py | c3-e/custom-pod-autoscaler | 209 | 9599422 | <filename>example/scale-on-tweet/evaluate.py
# Copyright 2020 The Custom Pod Autoscaler 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... |
beacon_chain/utils/blake.py | muta6150/beacon_chain | 217 | 9599427 | <gh_stars>100-1000
try:
from hashlib import blake2b
except Exception:
from pyblake2 import blake2b
def blake(x):
return blake2b(x).digest()[:32]
|
kge/model/complex.py | alexgaskell10/encoded_kge | 516 | 9599500 | import torch
from kge import Config, Dataset
from kge.model.kge_model import RelationalScorer, KgeModel
class ComplExScorer(RelationalScorer):
r"""Implementation of the ComplEx KGE scorer.
Reference: <NAME>, <NAME>, <NAME>, <NAME> and
<NAME>: Complex Embeddings for Simple Link Prediction. ICML 2016.
... |
Rewards/rewards.py | adeagaoluwaseun/Voting | 764 | 9599519 | <filename>Rewards/rewards.py
#Choice Coin Governance Rewards Code.
#Proposed rates: up to 5 million Choice committed: 20 percent, 10 million Choice: 15 percent, 12 million Choice: 12.5%
from algosdk import account, encoding, mnemonic,algod
from algosdk.future.transaction import AssetTransferTxn, PaymentTxn, AssetConfig... |
panphon/test/test_panphon_methods.py | giddudink/panphon | 116 | 9599543 | <gh_stars>100-1000
# -*- coding: utf-8 -*-
from __future__ import print_function, unicode_literals, division, absolute_import
import unittest
import panphon._panphon as panphon
class TestFeatureTableAPI(unittest.TestCase):
def setUp(self):
self.ft = panphon.FeatureTable()
def test_fts(self):
... |
walrus/tests/cache.py | pavel-francirek/walrus | 1,039 | 9599548 | <gh_stars>1000+
import datetime
from walrus.tests.base import WalrusTestCase
from walrus.tests.base import db
cache = db.cache(name='test.cache')
@cache.cached(timeout=60)
def now(seed=None):
return datetime.datetime.now()
class Clock(object):
@cache.cached_property()
def now(self):
return da... |
simdeblur/model/loss/perceptual_loss.py | ljzycmd/SimDeblur | 190 | 9599589 | """ ************************************************
* fileName: perceptual_loss.py
* desc: Perceptual loss using vggnet with conv1_2, conv2_2, conv3_3 feature,
before relu layer.
* author: mingdeng_cao
* date: 2021/07/09 11:08
* last revised: None
************************************************ """
import ... |
resources/cipher_suite_grabber.py | berney/TLS-Attacker | 593 | 9599594 | #!/usr/bin/env python2
import sys
import re
import datetime
import hashlib
import optparse
import urllib2
# cheers Dirk :)
url = 'https://testssl.sh/mapping-rfc.txt'
for line in urllib2.urlopen(url):
cipher = line.split()
print cipher[1]+'(0'+cipher[0]+'),'
|
InteractiveHtmlBom/dialog/settings_dialog.py | instalator/InteractiveHtmlBom | 2,101 | 9599595 | <filename>InteractiveHtmlBom/dialog/settings_dialog.py
import os
import re
import wx
import wx.grid
from . import dialog_base
def pop_error(msg):
wx.MessageBox(msg, 'Error', wx.OK | wx.ICON_ERROR)
class SettingsDialog(dialog_base.SettingsDialogBase):
def __init__(self, extra_data_func, extra_data_wildcard... |
gooey/gui/components/widgets/__init__.py | Jacke/Gooey | 13,430 | 9599622 | from __future__ import absolute_import
from .textfield import TextField
from .textarea import Textarea
from .password import PasswordField
from .command import CommandField
from .dropdown import Dropdown
from .listbox import Listbox
from .checkbox import CheckBox
from .checkbox import BlockCheckbox
from .cou... |
indy_node/test/claim_def/test_send_get_claim_def.py | Rob-S/indy-node | 627 | 9599641 | import json
import pytest
from indy.anoncreds import issuer_create_and_store_credential_def
from indy.ledger import build_get_cred_def_request, build_cred_def_request
from plenum.common.exceptions import RequestNackedException
from plenum.common.constants import TXN_METADATA, TXN_METADATA_ID
from plenum.test.helper i... |
modeling/backbones/resnet.py | yihui-he2020/epipolar-transformers | 360 | 9599665 | import logging
import os
import torch
import torch.nn as nn
import torch.utils.model_zoo as model_zoo
from modeling.layers.epipolar import Epipolar
from modeling import registry
from core import cfg
from .basic_batch import find_tensor_peak_batch
from utils.logger import setup_logger
from utils.model_serialization imp... |
tests/template_tests/test_origin.py | KaushikSathvara/django | 61,676 | 9599672 | <filename>tests/template_tests/test_origin.py
import os
from unittest import TestCase
from django.template import Engine
from .utils import TEMPLATE_DIR
class OriginTestCase(TestCase):
def setUp(self):
self.engine = Engine(dirs=[TEMPLATE_DIR])
def test_origin_compares_equal(self):
a = self.... |
autogl/module/nas/estimator/one_shot.py | THUMNLab/AutoGL | 824 | 9599683 | <filename>autogl/module/nas/estimator/one_shot.py
import torch.nn as nn
import torch.nn.functional as F
from . import register_nas_estimator
from ..space import BaseSpace
from .base import BaseEstimator
@register_nas_estimator("oneshot")
class OneShotEstimator(BaseEstimator):
"""
One shot estimator.
Use... |
dpkt/ospf.py | Vito-Swift/dpkt | 924 | 9599724 | # $Id: ospf.py 23 2006-11-08 15:45:33Z dugsong $
# -*- coding: utf-8 -*-
"""Open Shortest Path First."""
from __future__ import absolute_import
from . import dpkt
AUTH_NONE = 0
AUTH_PASSWORD = 1
AUTH_CRYPTO = 2
class OSPF(dpkt.Packet):
"""Open Shortest Path First.
TODO: Longer class information....
At... |
DockerENT/docker_plugins/docker_file_info.py | laozhudetui/DockerENT | 125 | 9599744 | """Docker file-system-info scan plugin."""
from DockerENT.utils import utils
import docker
import logging
import json
_log = logging.getLogger(__name__)
_plugin_name_ = 'files-info'
def scan(container, output_queue, audit=False, audit_queue=None):
"""Docker file-system-info plugin scan.
:param container: ... |
examples/MMPT/scripts/video_feature_extractor/shard_feature.py | Shiguang-Guo/fairseq | 16,259 | 9599753 | # Copyright (c) Facebook, Inc. and its affiliates.
#
# This source code is licensed under the MIT license found in the
# LICENSE file in the root directory of this source tree.
import numpy as np
import os
import pickle
from mmpt.utils import ShardedTensor
class Shard(object):
def __init__(
self,
... |
src/exporter.py | spankratov/celery-exporter | 132 | 9599754 | <reponame>spankratov/celery-exporter
# pylint: disable=protected-access,,attribute-defined-outside-init
import re
from celery import Celery
from loguru import logger
from prometheus_client import CollectorRegistry, Counter, Gauge, Histogram
from .http_server import start_http_server
class Exporter:
state = None... |
alipay/aop/api/domain/InsApplication.py | snowxmas/alipay-sdk-python-all | 213 | 9599761 | #!/usr/bin/env python
# -*- coding: utf-8 -*-
import json
from alipay.aop.api.constant.ParamConstants import *
from alipay.aop.api.domain.InsObject import InsObject
from alipay.aop.api.domain.InsPerson import InsPerson
class InsApplication(object):
def __init__(self):
self._biz_data = None
self.... |
reingold_actual.py | MrWater98/pymag-trees | 149 | 9599774 | class DrawTree(object):
def __init__(self, tree, depth=-1):
self.x = -1
self.y = depth
self.tree = tree
self.children = [DrawTree(t) for t in tree]
self.thread = None
self.offset = 0
def left(self):
return self.thread or len(self.children) and self.child... |
examples/plotting/file/slider.py | g-parki/bokeh | 15,193 | 9599786 | ''' An interactive plot of the ``sin`` function. This example demonstrates
adding widgets and ``CustomJS`` callbacks that can update a plot.
.. bokeh-example-metadata::
:apis: bokeh.plotting.Figure.line, bokeh.layouts.column, bokeh.layouts.row, bokeh.models.callbacks.CustomJS, bokeh.models.widgets.sliders.Slider
... |
openaerostruct/aerodynamics/functionals.py | lamkina/OpenAeroStruct | 114 | 9599800 | <filename>openaerostruct/aerodynamics/functionals.py
import openmdao.api as om
from openaerostruct.aerodynamics.lift_drag import LiftDrag
from openaerostruct.aerodynamics.coeffs import Coeffs
from openaerostruct.aerodynamics.total_lift import TotalLift
from openaerostruct.aerodynamics.total_drag import TotalDrag
f... |
vilya/models/npull.py | mubashshirjamal/code | 1,582 | 9599803 | # -*- coding: utf-8 -*-
import os
import logging
logging.getLogger().setLevel(logging.DEBUG)
from datetime import datetime
from vilya.libs.props import PropsMixin
from vilya.libs.model import BaseModel, ModelField
from vilya.libs.store import cache, store
from vilya.models.consts import PULL_REF_H, PULL_REF_M
from vi... |
examples/python/bufr_ecc-869.py | dvuckovic/eccodes | 103 | 9599837 | # This program was automatically generated with bufr_dump -Epython
# and then edited to add the bitmap.
# See ECC-869
from __future__ import print_function
import sys
import traceback
from eccodes import *
OUTPUT_FILENAME = "outfile_ecc_869_test.bufr"
VERBOSE = 1 # verbose error reporting
def bufr_encode():
... |
atlas/foundations_authentication/src/integration/test_keycloak_integration.py | DeepLearnI/atlas | 296 | 9599848 | import json
from foundations_spec import Spec, set_up, ConditionalReturn, let_now, set_up_class
from foundations_authentication.authentication_client import (
AuthenticationClient,
keycloak_client,
)
import subprocess
from foundations_contrib.utils import wait_for_condition
import requests
from typing import ... |
Graphs/FindTheNearestClone.py | akashksinghal/interview-preparation-kit | 175 | 9599868 | <reponame>akashksinghal/interview-preparation-kit
#!/bin/python3
import math
import os
import random
import re
import sys
import collections
# Complete the findShortest function below.
#
# For the weighted graph, <name>:
#
# 1. The number of nodes is <name>_nodes.
# 2. The number of edges is <name>_edge... |
src/data/agedb2pack.py | alwaysqi/insightface | 269 | 9599871 | <reponame>alwaysqi/insightface
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
#import mxnet as mx
#from mxnet import ndarray as nd
import argparse
import cv2
import pickle
import numpy as np
import sys
from scipy import misc
import os
import tensorflow as tf... |
build/fuchsia/test_runner.py | zipated/src | 2,151 | 9599876 | <filename>build/fuchsia/test_runner.py
#!/usr/bin/env python
#
# Copyright 2018 The Chromium Authors. All rights reserved.
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
"""Deploys and runs a test package on a Fuchsia target."""
import argparse
import json
import... |
library/inky/phat.py | fsargent/inky | 402 | 9599893 | <filename>library/inky/phat.py
"""
`Inky pHAT`_ class and methods.
A getting started `tutorial`_ for the Inky pHAT is available on the pimoroni website.
The `pinout`_ for the Inky pHAT is documented on pinout.xyz
.. _`Inky pHAT`: https://shop.pimoroni.com/products/inky-phat
.. _`tutorial`: https://learn.pimoroni.com... |
apps/jobbrowser/src/jobbrowser/apis/history.py | yetsun/hue | 5,079 | 9599905 | #!/usr/bin/env python
# Licensed to Cloudera, Inc. under one
# or more contributor license agreements. See the NOTICE file
# distributed with this work for additional information
# regarding copyright ownership. Cloudera, Inc. licenses this file
# to you under the Apache License, Version 2.0 (the
# "License"); you ma... |
tests/test_transactional_consumer.py | hirnimeshrampuresoftware/aiokafka | 731 | 9599948 | import asyncio
from ._testutil import (
KafkaIntegrationTestCase, run_until_complete, kafka_versions
)
from aiokafka.producer import AIOKafkaProducer
from aiokafka.consumer import AIOKafkaConsumer
from aiokafka.structs import TopicPartition
from aiokafka.util import create_task
from aiokafka.errors import (
... |
actions/demo1.py | mayneyao/NotionPlus- | 171 | 9599955 | from . import action
import requests
@action('test_action')
def test_action(obj):
obj.name = "完成了一项自动化后台任务"
@action('change_tags')
def changetags(obj):
obj.tags = ['测试1']
@action('get_current_playing_music')
def get_current_playing_music(obj):
r = requests.get('https://api.gine.me/currently_playing')... |
mediapipe/framework/tool/mediapipe_graph.bzl | nyankichi820/mediapipe | 17,242 | 9599966 | """Provides BUILD macros for MediaPipe graphs.
mediapipe_binary_graph() converts a graph from text format to serialized binary
format.
Example:
mediapipe_binary_graph(
name = "make_graph_binarypb",
graph = "//mediapipe/framework/tool/testdata:test_graph",
output_name = "test.binarypb",
deps = [
... |
alipay/aop/api/response/KoubeiQualityTestShieldTestcaseQueryResponse.py | antopen/alipay-sdk-python-all | 213 | 9599968 | #!/usr/bin/env python
# -*- coding: utf-8 -*-
import json
from alipay.aop.api.response.AlipayResponse import AlipayResponse
from alipay.aop.api.domain.TestCaseDomain import TestCaseDomain
class KoubeiQualityTestShieldTestcaseQueryResponse(AlipayResponse):
def __init__(self):
super(KoubeiQualityTestShiel... |
modules/dbnd/src/dbnd/_core/task_run/task_run_ctrl.py | ipattarapong/dbnd | 224 | 9599970 | import typing
from dbnd._core.task_ctrl.task_ctrl import TaskSubCtrl
if typing.TYPE_CHECKING:
from dbnd._core.task_run.task_run import TaskRun
from dbnd._core.task_run.task_sync_ctrl import TaskSyncCtrl
class TaskRunCtrl(TaskSubCtrl):
def __init__(self, task_run):
# type: (TaskRun)-> None
... |
rllib/offline/__init__.py | 77loopin/ray | 21,382 | 9599971 | from ray.rllib.offline.io_context import IOContext
from ray.rllib.offline.json_reader import JsonReader
from ray.rllib.offline.json_writer import JsonWriter
from ray.rllib.offline.output_writer import OutputWriter, NoopOutput
from ray.rllib.offline.input_reader import InputReader
from ray.rllib.offline.mixed_input impo... |
src/chords2midi/c2m.py | DrMichaelPetter/free-midi-chords | 560 | 11000003 | # c2m.py - chords2midi
import argparse
import errno
import os
import pychord
import time
import traceback
from midiutil import MIDIFile
from mingus.core.progressions import to_chords, determine
import mingus.core.notes as notes
####################################################################
# Data
#############... |
public-engines/kaggle-titanic-engine/tests/prediction/test_prediction_preparator.py | tallandroid/incubator-marvin | 101 | 11000030 | #!/usr/bin/env python
# coding=utf-8
try:
import mock
except ImportError:
import unittest.mock as mock
from marvin_titanic_engine.prediction import PredictionPreparator
def test_execute(mocked_params):
message = {"Age": 50, "Pclass": 3, "Sex": 0}
ac = PredictionPreparator()
ac.execute(input_m... |
PhysicsTools/PatExamples/test/analyzeTopSelection_cfg.py | ckamtsikis/cmssw | 852 | 11000031 | <reponame>ckamtsikis/cmssw<gh_stars>100-1000
import FWCore.ParameterSet.Config as cms
## Define the process
process = cms.Process("Top")
## Define the input sample
process.source = cms.Source("PoolSource",
fileNames = cms.untracked.vstring(
'file:patTuple.root'
)
)
## restrict the number of events for testing... |
Z - Tool Box/LaZagne/Windows/lazagne/softwares/databases/squirrel.py | dfirpaul/Active-Directory-Exploitation-Cheat-Sheet-1 | 1,290 | 11000034 | <gh_stars>1000+
# -*- coding: utf-8 -*-
import os
from xml.etree.cElementTree import ElementTree
from lazagne.config.constant import constant
from lazagne.config.module_info import ModuleInfo
class Squirrel(ModuleInfo):
def __init__(self):
ModuleInfo.__init__(self, name='squirrel', category='databases')... |
Alignment/LaserAlignment/python/LaserAlignmentT0Producer_cfi.py | ckamtsikis/cmssw | 852 | 11000051 | import FWCore.ParameterSet.Config as cms
# LaserAlignmentT0Producer (AlCaRECO producer for the LAS data running on T0)
#
# VPSet DigiProducersList is a list of all
# possible input digi products as defined in:
# EventFilter/SiStripRawToDigiModule/plugins/SiStripRawToDigiModule.cc
#
# The additional DigiType has to be ... |
growth-marketing-churn-analyses/more/dfops.py | DanielMabadeje/Artificial-Intelligence-Deep-Learning-Machine-Learning-Tutorials | 3,266 | 11000083 | from util import query_to_df,vectorize
from churndata import *
from sqlalchemy import *
import numpy as np
from datetime import datetime,timedelta
from sklearn.linear_model import LogisticRegression
from sqlalchemy.orm import sessionmaker
from sqlalchemy import func
from util import occurred_in_last_k_days
db = create... |
parsers/GT.py | electricitymap/electricitymap-contrib | 143 | 11000164 | <filename>parsers/GT.py
#!/usr/bin/env python3
"""Parse Guatemalan electricity data from the Administrador del Mercado
Mayorista (AMM) API.
"""
# Standard library imports
import collections
import logging
# Third-party library imports
import arrow
import requests
# Local library imports
from parsers.lib import vali... |
tests/openxml/wordprocessing/test_run.py | botzill/pydocx | 127 | 11000170 | # coding: utf-8
from __future__ import (
absolute_import,
print_function,
unicode_literals,
)
from unittest import TestCase
from pydocx.openxml.wordprocessing import Run
class RunTestCase(TestCase):
def test_can_instantiate_empty_object(self):
run = Run()
assert run
def test_eff... |
migrations/versions/256ab638deaa_filecoverage_build_i.py | vault-the/changes | 443 | 11000179 | """FileCoverage.build_id => job_id
Revision ID: 256ab638deaa
Revises: <PASSWORD>
Create Date: 2013-12-26 01:47:50.855439
"""
# revision identifiers, used by Alembic.
revision = '256ab638deaa'
down_revision = '3<PASSWORD>'
from alembic import op
def upgrade():
op.execute('ALTER TABLE filecoverage RENAME COLUMN... |
fiber/init.py | agrimrules/fiber | 1,010 | 11000203 | <filename>fiber/init.py<gh_stars>1000+
# Copyright 2020 Uber Technologies, 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 r... |
tests/test_cliparser.py | shmuelamar/cbox | 164 | 11000214 | import pytest
import cbox
from cbox import cliparser
@pytest.mark.parametrize('docstring,help_msg, params', [
(
'this is a function\n that is doing something.\n \n :param int x: bla\n :param str y: x\n ', # noqa
'this is a function\nthat is doing something.',
{'x': ('int',... |
py/load_firmware.py | Stadicus/bitbox02-firmware | 119 | 11000235 | <reponame>Stadicus/bitbox02-firmware
#!/usr/bin/env python3
# Copyright 2019 Shift Cryptosecurity AG
#
# 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... |
Geometry/MuonNumbering/python/muonNumberingInitialization_cfi.py | ckamtsikis/cmssw | 852 | 11000239 | <gh_stars>100-1000
import FWCore.ParameterSet.Config as cms
MuonNumberingInitialization = cms.ESProducer("MuonNumberingInitialization")
|
xonsh/xoreutils/__init__.py | hemna/xonsh | 7,986 | 11000282 | # amalgamate
# amalgamate end
|
AutotestWebD/all_models_for_ui/models/__init__.py | yangjourney/sosotest | 422 | 11000284 | <reponame>yangjourney/sosotest<filename>AutotestWebD/all_models_for_ui/models/__init__.py
from all_models_for_ui.models.C0001_ui_globals import *
from all_models_for_ui.models.C0002_ui_pageobject import *
|
tests/pybaseball/test_team_pitching.py | reddigari/pybaseball | 650 | 11000316 | <filename>tests/pybaseball/test_team_pitching.py
from typing import Callable
import pandas as pd
import pytest
import requests
from pybaseball.team_pitching import team_pitching
@pytest.fixture()
def sample_html(get_data_file_contents: Callable) -> str:
return get_data_file_contents('team_pitching.html')
@pyt... |
CMSIS/DSP/PythonWrapper/cmsisdsp/datatype.py | DavidLesnjak/CMSIS_5 | 2,293 | 11000433 | import cmsisdsp.fixedpoint as f
import numpy as np
F64 = 64
F32 = 32
F16 = 16
Q31 = 31
Q15 = 15
Q7 = 7
class UnknownCMSISDSPDataType(Exception):
pass
def convert(samples,format):
if format==Q31:
return(f.toQ31(np.array(samples)))
if format==Q15:
return(f.toQ15(np.array(samples)))
if f... |
structures/AthenaTrailRow.py | houey/SkyWrapper | 106 | 11000435 | from structures.UserIdentity import UserIdentity
import json
COLUMN_PARSERS = {"useridentity": UserIdentity}
class AthenaTrailRow(object):
def __init__(self, raw_row):
self.raw_row = raw_row
self.data = {}
self.__parse_raw_row()
def __parse_raw_row(self):
for column_name in se... |
tensorwatch/mpl/pie_chart.py | lesteve/tensorwatch | 3,453 | 11000473 | # Copyright (c) Microsoft Corporation.
# Licensed under the MIT license.
from .base_mpl_plot import BaseMplPlot
from .. import image_utils
from .. import utils
import numpy as np
class PieChart(BaseMplPlot):
def init_stream_plot(self, stream_vis, autopct=None, colormap=None, color=None,
shadow=None, ... |
rules/rbe_repo.bzl | jgertm/continuous-integration | 198 | 11000488 | <filename>rules/rbe_repo.bzl
def _available_bazel_versions(manifests):
bazel_versions = []
for manifest in manifests:
bazel_versions.append("'{}'".format(manifest["bazel_version"]))
return ", ".join(bazel_versions)
def _available_toolchain_names(manifest):
names = []
for toolchain in manife... |
dataprofiler/profilers/helpers/__init__.py | gautomdas/DataProfiler | 690 | 11000496 | <gh_stars>100-1000
from .report_helpers import calculate_quantiles, _prepare_report |
extra_tests/snippets/recursion.py | tai271828/RustPython | 11,058 | 11000500 | <gh_stars>1000+
from testutils import assert_raises
class Foo(object):
pass
Foo.__repr__ = Foo.__str__
foo = Foo()
# Since the default __str__ implementation calls __repr__ and __repr__ is
# actually __str__, str(foo) should raise a RecursionError.
assert_raises(RecursionError, str, foo)
|
skinematics/tests/positive_rotations.py | stes/scikit-kinematics | 103 | 11000526 | <filename>skinematics/tests/positive_rotations.py
"""
This file can be used to test quaterion viewers.
author: <NAME>
date: Jan-2018
ver: 0.1
"""
import numpy as np
import skinematics as skin
def make_positive_rotations():
'''Generate a quaternion that rotates to the left, down, and CW'''
phi =... |
playtime/lesson04_csvtolist.py | govex/python-lessons | 425 | 11000563 | # Challenge level: Beginner
# Goal: Using the code from Lesson 3: File handling and dictionaries, create a function that will open a CSV file and return the result as a nested list. |
utils/datasets.py | AK391/anycost-gan | 692 | 11000581 | <reponame>AK391/anycost-gan
from torchvision import datasets, transforms
import torchvision.transforms.functional as F
from PIL import Image
import random
class NativeDataset(datasets.ImageFolder):
def __getitem__(self, index):
return super(NativeDataset, self).__getitem__(index)[0] # only return the ima... |
reproductions/offline/discrete_cql.py | Mohan-Zhang-u/d3rlpy | 565 | 11000609 | <reponame>Mohan-Zhang-u/d3rlpy
import argparse
import d3rlpy
from sklearn.model_selection import train_test_split
def main():
parser = argparse.ArgumentParser()
parser.add_argument('--dataset', type=str, default='breakout-medium-v0')
parser.add_argument('--seed', type=int, default=1)
parser.add_argume... |
Python/IO/FreezeClock.py | piovezan/SOpt | 148 | 11000623 | import datetime
import time
time_tuple = time.localtime(time.time())
while True:
win_set_time(time_tuple)
time.sleep(1) # espera 1 segundo
def win_set_time(time_tuple):
import pywin32
dayOfWeek = datetime.datetime(time_tuple).isocalendar()[2]
pywin32.SetSystemTime(time_tuple[:2] + (dayOfWeek,) + t... |
tensorflow/models/Folding.py | lynetcha/completion3d | 171 | 11000756 | <reponame>lynetcha/completion3d<gh_stars>100-1000
import tensorflow as tf
from net_util import mlp_conv
from net_util import chamfer, emd
from common import num_params, create_pcn_encoder, create_multigpu_model
import numpy as np
def Folding_setup(args):
args.odir = 'results/%s/Folding_%s' % (args.dataset, args.di... |
test/dlc_tests/sanity/test_telemetry.py | johnbensnyder/deep-learning-containers | 383 | 11000781 | import time
import pytest
from test import test_utils
from test.test_utils import ec2 as ec2_utils
from test.test_utils import ecs as ecs_utils
@pytest.mark.usefixtures("sagemaker", "huggingface")
@pytest.mark.model("N/A")
@pytest.mark.processor("gpu")
@pytest.mark.integration("telemetry")
@pytest.mark.parametrize(... |
ansys/mapdl/core/mapdl_grpc.py | akaszynski/pyansys | 194 | 11000785 | """gRPC specific class and methods for the MAPDL gRPC client """
import re
from warnings import warn
import shutil
import threading
import weakref
import io
import time
import os
import socket
from functools import wraps
import tempfile
import subprocess
import grpc
import numpy as np
from tqdm import tqdm
from grpc.... |
form_designer/contrib/exporters/__init__.py | driesdesmet/django-form-designer | 113 | 11000786 | <reponame>driesdesmet/django-form-designer
from form_designer import settings
from form_designer.templatetags.friendly import friendly
from django.db.models import Count
from django.utils.translation import ugettext as _
from django.utils.encoding import smart_str
class ExporterBase(object):
def __init__(self, m... |
app/apiv2/email.py | itworxs/suite | 890 | 11000788 | import datetime
from flask import render_template, url_for
from app.helpers import get_default_tz
from app.models import User, RoleToUser, Organization, Location
from app.limiters import ShiftChangeNotificationLimiter, AvailableShiftsNotificationLimiter
from app.constants import SUDO_EXTERNAL_NAME, SUDO_EXTERNAL_EMAIL
... |
test/functional/wallet_import_rescan.py | apokalyzr/bitcoin | 65,371 | 11000801 | <gh_stars>1000+
#!/usr/bin/env python3
# Copyright (c) 2014-2021 The Bitcoin Core developers
# Distributed under the MIT software license, see the accompanying
# file COPYING or http://www.opensource.org/licenses/mit-license.php.
"""Test wallet import RPCs.
Test rescan behavior of importaddress, importpubkey, importpr... |
lib/utils/uiutils.py | robin-raymond/ArcticTypescript | 117 | 11000805 | <reponame>robin-raymond/ArcticTypescript
# coding=utf8
# ##################################################### MEMBER PREFIXES ########
PREFIXES = {
'method': u'○',
'property': u'●',
'class':u'♦',
'interface':u'◊',
'keyword':u'∆',
'constructor':u'■',
'variable': u'V',
'public':u'[pub]... |
examples/pybullet/examples/inverted_pendulum_tendon_actuation.py | felipeek/bullet3 | 9,136 | 11000809 | """
https://valerolab.org/
PID control of an inverted pendulum actuated by strings.
"""
import pybullet as p
import time
import math as m
import numpy as np
import pybullet_data
import matplotlib.pyplot as plt
p.connect(p.GUI)
plane = p.loadURDF("plane.urdf")
"""____________________________________________________... |
tests/widget_styles/test_checkbutton.py | dmalves/ttkbootstrap | 406 | 11000817 | <gh_stars>100-1000
import tkinter as tk
import ttkbootstrap as ttk
from random import choice
from ttkbootstrap import utility
utility.enable_high_dpi_awareness()
DARK = 'superhero'
LIGHT = 'flatly'
def create_checkbutton_test(bootstyle, style, name):
frame = ttk.Frame(padding=10)
# title
title = ttk.Labe... |
scripts/deployment/deploy_staking_logic.py | jccf091/Sovryn-smart-contracts | 108 | 11000818 | <reponame>jccf091/Sovryn-smart-contracts<gh_stars>100-1000
from brownie import *
import time
import json
import csv
import math
def main():
thisNetwork = network.show_active()
# == Load config ====================================================================================================================... |
data/seg/preprocess/pascal_aug/pascal_aug_generator.py | qrsforever/torchcv | 171 | 11000819 | <filename>data/seg/preprocess/pascal_aug/pascal_aug_generator.py
#!/usr/bin/env python
# -*- coding:utf-8 -*-
# Author: <NAME>(<EMAIL>)
# COCO det data generator.
import os
import argparse
import shutil
from tqdm import tqdm
import scipy.io
from PIL import Image
LABEL_DIR = 'label'
IMAGE_DIR = 'image'
class Pasca... |
fairseq/data/language_pair_dataset.py | alexshuang/fairseq | 490 | 11000822 | <gh_stars>100-1000
# Copyright (c) Facebook, Inc. and its affiliates.
#
# This source code is licensed under the MIT license found in the
# LICENSE file in the root directory of this source tree.
import logging
import numpy as np
import torch
from . import data_utils, FairseqDataset
logger = logging.getLogger(__na... |
util/tlm/conf/tlm_elastic_slave.py | hyu-iot/gem5 | 765 | 11000825 | <reponame>hyu-iot/gem5<filename>util/tlm/conf/tlm_elastic_slave.py
# Copyright (c) 2016, University of Kaiserslautern
# All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions are
# met:
#
# 1. Redistributions of so... |
tests_app/tests/functional/cache/decorators/urls.py | sanjaymsh/drf-extensions | 1,172 | 11000844 | from django.conf.urls import url
from .views import HelloView
urlpatterns = [
url(r'^hello/$', HelloView.as_view(), name='hello'),
]
|
gramex/pptgen/__init__.py | NAnnamalai/gramex | 130 | 11000847 | '''PPTGen module.'''
import io
import os
import sys
import copy
import json
import collections
import six
from pptx import Presentation
from pptx.shapes.shapetree import SlideShapes
from orderedattrdict import AttrDict
import pandas as pd
import gramex.data
import gramex.cache
from gramex.config import merge
from grame... |
url_filter/filtersets/base.py | Highpolar-Softwares/django-url-filter | 303 | 11000850 | # -*- coding: utf-8 -*-
from __future__ import absolute_import, print_function, unicode_literals
import abc
import re
from collections import defaultdict
from copy import deepcopy
import six
from cached_property import cached_property
from django.core.exceptions import ValidationError
from django.core.validators impor... |
part_manager-master/db.py | Farhan27sadik/AccSoft | 136 | 11000868 | import sqlite3
class Database:
def __init__(self, db):
self.conn = sqlite3.connect(db)
self.cur = self.conn.cursor()
self.cur.execute(
"CREATE TABLE IF NOT EXISTS parts (id INTEGER PRIMARY KEY, part text, customer text, retailer text, price text)")
self.conn.commit()
... |
manimlib/mobject/types/dot_cloud.py | manim-kindergarten/manim | 114 | 11000874 | import numpy as np
import moderngl
from manimlib.constants import GREY_C
from manimlib.constants import YELLOW
from manimlib.constants import ORIGIN
from manimlib.mobject.types.point_cloud_mobject import PMobject
from manimlib.utils.iterables import resize_preserving_order
DEFAULT_DOT_RADIUS = 0.05
DEFAULT_GLOW_DOT_... |
examples/AdAccountCampaignsPostMAIDPA.py | MyrikLD/facebook-python-business-sdk | 576 | 11000884 | <gh_stars>100-1000
# Copyright 2014 Facebook, Inc.
# You are hereby granted a non-exclusive, worldwide, royalty-free license to
# use, copy, modify, and distribute this software in source code or binary
# form for use in connection with the web services and APIs provided by
# Facebook.
# As with any software that int... |
venv/Lib/site-packages/nipype/interfaces/nipy/preprocess.py | richung99/digitizePlots | 585 | 11000889 | <filename>venv/Lib/site-packages/nipype/interfaces/nipy/preprocess.py
# -*- coding: utf-8 -*-
import os
import nibabel as nb
import numpy as np
from ...utils.filemanip import split_filename, fname_presuffix
from .base import NipyBaseInterface, have_nipy
from ..base import (
TraitedSpec,
traits,
BaseInter... |
binance_f/impl/utils/apisignature.py | ArtemMartus/Binance_Futures_python | 640 | 11000898 | import base64
import hashlib
import hmac
import datetime
from urllib import parse
import urllib.parse
from binance_f.exception.binanceapiexception import BinanceApiException
def create_signature(secret_key, builder):
if secret_key is None or secret_key == "":
raise BinanceApiException(BinanceAp... |
common/vision/datasets/imagenet_sketch.py | billzhonggz/Transfer-Learning-Library | 1,474 | 11000899 | """
@author: <NAME>
@contact: <EMAIL>
"""
from typing import Optional
import os
from torchvision.datasets.imagenet import ImageNet
from .imagelist import ImageList
from ._util import download as download_data, check_exits
class ImageNetSketch(ImageList):
"""ImageNet-Sketch Dataset.
Args:
... |
ex50_vi/curses_test.py | techieguy007/learn-more-python-the-hard-way-solutions | 466 | 11000906 | import curses
import time
import sys
from curses.textpad import Textbox, rectangle
from ed import ed
file_to_edit = sys.argv[1]
buffer = ed.Buffer(file_name=file_to_edit)
def command(stdscr, repl_y, repl_x):
stdscr.addstr(repl_y, 0, ":")
editwin = curses.newwin(1, repl_x - 1, repl_y, repl_x + 2)
editwin.r... |
athena/api_library/user_api.py | ddugovic/hey-athena-client | 336 | 11000914 | <reponame>ddugovic/hey-athena-client
"""
A simple API to retrieve user info
"""
from athena.classes.api import Api
from athena.classes.input_field import InputField
class UserApi(Api):
def __init__(self):
self.save_data = [
InputField('username', require=True),
I... |
Lib/test/test_hashlib.py | leepro/unladen-swallow | 2,293 | 11000916 | # Test hashlib module
#
# $Id: test_hashlib.py 66496 2008-09-18 01:22:16Z benjamin.peterson $
#
# Copyright (C) 2005 <NAME> (<EMAIL>)
# Licensed to PSF under a Contributor Agreement.
#
import hashlib
import unittest
from test import test_support
from test.test_support import _4G, precisionbigmemtest
def hexstr(s)... |
pymagnitude/third_party/allennlp/semparse/contexts/__init__.py | tpeng/magnitude | 1,520 | 11000917 | <gh_stars>1000+
from __future__ import absolute_import
from allennlp.semparse.contexts.table_question_knowledge_graph import TableQuestionKnowledgeGraph
|
floss/render/json.py | harelon/flare-floss | 2,067 | 11000925 | <gh_stars>1000+
import json
import datetime
import dataclasses
from floss.results import ResultDocument
class FlossJSONEncoder(json.JSONEncoder):
"""
serializes FLOSS data structures into JSON.
specifically:
- dataclasses into their dict representation
- datetimes to ISO8601 strings
"""
... |
windows/PyNaCl-0.3.0-py2.7-win32.egg/nacl/bindings/crypto_box.py | iTechsTR/OpenBazaar-Installer | 152 | 11000926 | <reponame>iTechsTR/OpenBazaar-Installer
# Copyright 2013 <NAME> and individual contributors
#
# 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
#
# ... |
src/lib/models/utils.py | fuqichen1998/MHT | 132 | 11000936 | # ------------------------------------------------------------------------------
# Copyright (c) Microsoft Corporation. All rights reserved.
# Licensed under the MIT License.
# ------------------------------------------------------------------------------
from __future__ import absolute_import
from __future__ import d... |
mor_speech_corpus/mor_speech_corpus.py | FarisHijazi/klaam | 119 | 11000953 | """Arabic Speech Corpus"""
from __future__ import absolute_import, division, print_function
import os
import datasets
_CITATION = """
"""
_DESCRIPTION = """\
```python
import soundfile as sf
def map_to_array(batch):
speech_array, _ = sf.read(batch["file"])
batch["speech"] = speech_array
return batc... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.