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 |
|---|---|---|---|---|
3-2.Lattice_LSTM/train.py | techthiyanes/nlp-notebook | 136 | 12609649 | <filename>3-2.Lattice_LSTM/train.py<gh_stars>100-1000
# -*- coding: utf-8 -*-
import time
import torch
import torch.optim as optim
import matplotlib.pyplot as plt
import numpy as np
from model import LatticeLSTM
from load_data import char2idx, word2idx, label2idx, data_generator
character_size = len(char2idx)
word_siz... |
pynq/lib/pmod/pmod_grove_ear_hr.py | michalkouril/PYNQ | 1,537 | 12609651 | # Copyright (c) 2016, NECST Laboratory, Politecnico di Milano
# 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 source code must retain the above copyright not... |
terrascript/provider/gitlab.py | hugovk/python-terrascript | 507 | 12609712 | # terrascript/provider/gitlab.py
import terrascript
class gitlab(terrascript.Provider):
pass
__all__ = ["gitlab"]
|
rosie/rosie/chamber_of_deputies/tests/test_monthly_subquota_limit_classifier.py | vbarceloscs/serenata-de-amor | 3,001 | 12609713 | <reponame>vbarceloscs/serenata-de-amor<gh_stars>1000+
from unittest import TestCase
import numpy as np
import pandas as pd
from rosie.chamber_of_deputies.classifiers.monthly_subquota_limit_classifier import MonthlySubquotaLimitClassifier
class TestMonthlySubquotaLimitClassifier(TestCase):
'''Testing Monthly Sub... |
piptools/scripts/compile.py | m-mead/pip-tools | 4,085 | 12609805 | import itertools
import os
import shlex
import sys
import tempfile
from typing import IO, Any, BinaryIO, List, Optional, Tuple, Union, cast
import click
from click.utils import LazyFile, safecall
from pep517 import meta
from pip._internal.commands import create_command
from pip._internal.req import InstallRequirement
... |
kgat/models.py | QZx7/KernelGAT | 150 | 12609811 | import math
import torch
import torch.nn as nn
import torch.nn.functional as F
from torch.nn import BatchNorm1d, Linear, ReLU
from bert_model import BertForSequenceEncoder
from torch.autograd import Variable
import numpy as np
def kernal_mus(n_kernels):
"""
get the mu for each guassian kernel. Mu is the mid... |
tests/generator/test_scan.py | ForestCrazy/chia-blockchain-remote-plot | 11,902 | 12609821 | <reponame>ForestCrazy/chia-blockchain-remote-plot
from unittest import TestCase
from chia.full_node.bundle_tools import (
match_standard_transaction_at_any_index,
match_standard_transaction_exactly_and_return_pubkey,
)
from chia.util.byte_types import hexstr_to_bytes
gen1 = hexstr_to_bytes(
"ff01ffffffa00... |
cx_Freeze/samples/find_spec/dummypackage/dummymodule.py | lexa/cx_Freeze | 358 | 12609822 | print("Hi, I'm a module!")
raise Exception(
"This module-level exception should also not occur during freeze"
)
|
var/spack/repos/builtin/packages/bat/package.py | kkauder/spack | 2,360 | 12609834 | <filename>var/spack/repos/builtin/packages/bat/package.py<gh_stars>1000+
# 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 Bat(Package):
"""... |
tools/style_variable_generator/find_invalid_css_variables_test.py | mghgroup/Glide-Browser | 575 | 12609845 | # Copyright 2020 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.
from find_invalid_css_variables import FindInvalidCSSVariables
import unittest
class FindInvalidCSSVariablesTest(unittest.TestCase):
def testUnspecifie... |
examples/spot/wallet/trade_fee.py | Banging12/binance-connector-python | 512 | 12609847 | <reponame>Banging12/binance-connector-python<filename>examples/spot/wallet/trade_fee.py
#!/usr/bin/env python
import logging
from binance.spot import Spot as Client
from binance.lib.utils import config_logging
config_logging(logging, logging.DEBUG)
key = ""
secret = ""
spot_client = Client(key, secret)
logging.info... |
examples/gm_realtime.py | xf1688/czsc | 206 | 12609848 | <gh_stars>100-1000
# -*- coding: utf-8 -*-
"""
author: zengbin93
email: <EMAIL>
create_dt: 2021/12/13 17:48
describe: A股股票实盘仿真
环境变量设置说明:
strategy_id 掘金研究策略ID
account_id 账户ID
wx_key 企业微信群聊机器人Key
max_sym_pos 单仓位限制
path_gm_logs gm_logs的路... |
mayan/apps/authentication/__init__.py | eshbeata/open-paperless | 2,743 | 12609857 | from __future__ import unicode_literals
default_app_config = 'authentication.apps.AuthenticationApp'
|
03_regression/src/spark_kaggle_starter/logging_lib/MarkdownBuilder.py | austinfrazer/GWU_data_mining | 229 | 12609863 | import logging
import os
import io
from datetime import datetime
import boto3
from boto3.s3.transfer import S3Transfer
import botocore
import platform
class MarkdownBuilder(object):
"""
A class for logging code output and mathplotlib plots in aws s3. Only ONE
object should be instantiated for a script for ... |
depth/val_dlsm.py | zhaoxiaodong95/lsm | 255 | 12609893 | <reponame>zhaoxiaodong95/lsm
import argparse
import logging
import os.path as osp
import time
import numpy as np
import tensorflow as tf
from tqdm import tqdm
from config import SHAPENET_IM
from evaluate import eval_l1_err, print_depth_stats
from loader import pad_batch
from models import grid_nets, im_nets, model_dl... |
shutit_patterns/shutitfile.py | controlplaneio/shutit | 2,063 | 12609896 | <gh_stars>1000+
#!/usr/bin/env pythen
# The MIT License (MIT)
#
# Copyright (C) 2014 OpenBet Limited
#
# Permission is hereby granted, free of charge, to any person obtaining a copy of
# this software and associated documentation files (the "Software"), to deal in
# the Software without restriction, including without ... |
media/tools/constrained_network_server/cns_test.py | Scopetta197/chromium | 212 | 12609904 | #!/usr/bin/env python
# Copyright (c) 2012 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.
"""Tests for Constrained Network Server."""
import os
import signal
import subprocess
import tempfile
import time
import unittest
i... |
options.py | JungahYang/Deep3DFaceReconstruction | 1,424 | 12609918 | <filename>options.py
import numpy as np
import tensorflow as tf
import os
# training options
class Option():
def __init__(self,model_name=None,is_train=True):
#--------------------------------------------------------------------------------------
self.is_train = is_train
self.model_dir = 'result'
... |
rlschool/liftsim/environment/mansion/test_elevator.py | ANCL/QuadPPO | 169 | 12609936 | <reponame>ANCL/QuadPPO<filename>rlschool/liftsim/environment/mansion/test_elevator.py
# Copyright (c) 2018 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 Li... |
run_tests.py | datafaust/dejavu | 4,591 | 12609938 | import argparse
import logging
import time
from os import makedirs
from os.path import exists, join
from shutil import rmtree
import matplotlib.pyplot as plt
import numpy as np
from dejavu.tests.dejavu_test import (DejavuTest, autolabeldoubles,
generate_test_files, log_msg, set_s... |
tests/python/contrib/test_hexagon/test_run_unit_tests.py | shengxinhu/tvm | 4,640 | 12609939 | <filename>tests/python/contrib/test_hexagon/test_run_unit_tests.py<gh_stars>1000+
# 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 fi... |
homeassistant/components/xiaomi_miio/button.py | MrDelik/core | 30,023 | 12609955 | """Support for Xiaomi buttons."""
from __future__ import annotations
from dataclasses import dataclass
from typing import Any
from homeassistant.components.button import (
ButtonDeviceClass,
ButtonEntity,
ButtonEntityDescription,
)
from homeassistant.config_entries import ConfigEntry
from homeassistant.co... |
cli/src/commands/run_tests.py | erichiggins0/docsearch-scraper | 242 | 12609984 | <reponame>erichiggins0/docsearch-scraper
from .abstract_command import AbstractCommand
class RunTests(AbstractCommand):
def get_name(self):
return "test"
def get_description(self):
return "Run tests"
def get_options(self):
return [{"name": "docker",
"description"... |
examples/breathe_all.py | ceboxsell/LocalLifxLan | 464 | 12609986 | <reponame>ceboxsell/LocalLifxLan
#!/usr/bin/env python
# coding=utf-8
import sys
from copy import copy
from time import sleep, time
from lifxlan import LifxLAN
def main():
num_lights = None
if len(sys.argv) != 2:
print("\nDiscovery will go much faster if you provide the number of lights on your LAN:"... |
functest/perf_serial.py | Luvideria/lightmetrica-v3 | 101 | 12610000 | # ---
# jupyter:
# jupytext:
# formats: ipynb,py:light
# text_representation:
# extension: .py
# format_name: light
# format_version: '1.4'
# jupytext_version: 1.2.4
# kernelspec:
# display_name: Python 3
# language: python
# name: python3
# ---
# ## Performance testing ... |
flare/dft_interface/cp2k_util.py | aaronchen0316/flare | 144 | 12610001 | """
This module is used to call CP2K simulation and parse its output
The user need to supply a complete input script with ENERGY_FORCE or ENERGY runtype, and CELL, COORD blocks. Example scripts can be found in tests/test_files/cp2k_input...
The module will copy the input template to a new file with "_run" suffix,
edit... |
robot-server/robot_server/errors/error_responses.py | knownmed/opentrons | 235 | 12610013 | """JSON API errors and response models."""
from pydantic import BaseModel, Field
from pydantic.generics import GenericModel
from typing import Any, Dict, Generic, Optional, Sequence, Tuple, TypeVar
from robot_server.service.json_api import ResourceLinks
class ApiError(Exception):
"""An exception to throw when an... |
bindings/python/cntk/losses/tests/fmeasure_test.py | shyamalschandra/CNTK | 17,702 | 12610029 | <reponame>shyamalschandra/CNTK
# Copyright (c) Microsoft. All rights reserved.
# Licensed under the MIT license. See LICENSE.md file in the project root
# for full license information.
# ==============================================================================
"""
Unit tests for the fmeasure class.
"""
import n... |
Ch13/randomforest.py | jason-168/MLCode | 146 | 12610031 | <filename>Ch13/randomforest.py
# Code from Chapter 13 of Machine Learning: An Algorithmic Perspective (2nd Edition)
# by <NAME> (http://stephenmonika.net)
# You are free to use, change, or redistribute the code in any way you wish for
# non-commercial purposes, but please maintain the name of the original author.
# T... |
demucs/pretrained.py | KilianRuiz2B/demucs | 3,013 | 12610057 | # Copyright (c) Facebook, Inc. and its affiliates.
# All rights reserved.
#
# This source code is licensed under the license found in the
# LICENSE file in the root directory of this source tree.
# author: adefossez
import logging
from diffq import DiffQuantizer
import torch.hub
from .model import Demucs
from .tasne... |
src/sage/categories/posets.py | UCD4IDS/sage | 1,742 | 12610070 | <filename>src/sage/categories/posets.py
r"""
Posets
"""
#*****************************************************************************
# Copyright (C) 2011 <NAME> <nthiery at users.sf.net>
#
# Distributed under the terms of the GNU General Public License (GPL)
# http://www.gnu.org/licenses/
#********... |
tests/visualization_tests/test_optimization_history.py | captain-pool/optuna | 1,300 | 12610124 | <reponame>captain-pool/optuna<filename>tests/visualization_tests/test_optimization_history.py
import numpy as np
import pytest
from optuna.study import create_study
from optuna.trial import Trial
from optuna.visualization import plot_optimization_history
def test_target_is_none_and_study_is_multi_obj() -> None:
... |
falcon/util/sync.py | RioAtHome/falcon | 8,217 | 12610131 | import asyncio
from concurrent.futures import ThreadPoolExecutor
from functools import partial
from functools import wraps
import inspect
import os
from typing import Callable
__all__ = [
'async_to_sync',
'create_task',
'get_running_loop',
'runs_sync',
'sync_to_async',
'wrap_sync_to_async',
... |
configs/resnest/cascade_rcnn_s101_fpn_syncbn-backbone+head_mstrain-range_1x_coco.py | Brym-Gyimah/mmdetection | 20,190 | 12610148 | <reponame>Brym-Gyimah/mmdetection
_base_ = './cascade_rcnn_s50_fpn_syncbn-backbone+head_mstrain-range_1x_coco.py'
model = dict(
backbone=dict(
stem_channels=128,
depth=101,
init_cfg=dict(type='Pretrained',
checkpoint='open-mmlab://resnest101')))
|
scripts/data_convert/msmarco/convert_queries.py | gitter-badger/FlexNeuART | 101 | 12610154 | #!/usr/bin/env python
#
# Copyright 2014+ Carnegie Mellon University
#
# 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 b... |
sdk/python/lib/test/langhost/chained_failure/test_chained_failure.py | pcen/pulumi | 12,004 | 12610164 | <filename>sdk/python/lib/test/langhost/chained_failure/test_chained_failure.py
# Copyright 2016-2021, Pulumi 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.ap... |
image-classification/problem_unittests.py | WillenZh/deep-learning-project | 474 | 12610168 | <filename>image-classification/problem_unittests.py
import os
import numpy as np
import tensorflow as tf
import random
from unittest.mock import MagicMock
def _print_success_message():
print('Tests Passed')
def test_folder_path(cifar10_dataset_folder_path):
assert cifar10_dataset_folder_path is not None,\
... |
example/sparse/linear_classification/train.py | Vikas-kum/incubator-mxnet | 228 | 12610183 | <gh_stars>100-1000
# 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
# "Licen... |
samples/gray-scott/gs_jit.py | Ryoich/python_zero | 203 | 12610205 | <reponame>Ryoich/python_zero<gh_stars>100-1000
import matplotlib.pyplot as plt
from numba import jit
import numpy as np
# python gs_jit.py 1.91s user 0.16s system 119% cpu 1.736 total
@jit
def laplacian(ix, iy, s):
ts = 0.0
ts += s[ix-1, iy]
ts += s[ix+1, iy]
ts += s[ix, iy-1]
ts += s[ix, iy+1]
... |
transpyle/cpp/ast_generalizer.py | EraYaN/transpyle | 107 | 12610212 | """Generalizing C++ AST."""
import logging
import pprint
# import re
import typing as t
import xml.etree.ElementTree as ET
import horast
from static_typing.ast_manipulation import RecursiveAstTransformer
import typed_ast.ast3 as typed_ast3
from ..general import XmlAstGeneralizer
from ..general.exc import ContinueIte... |
pysrc/gen_chip_list.py | CrackerCat/xed | 1,261 | 12610213 | <filename>pysrc/gen_chip_list.py
#!/usr/bin/env python
# -*- python -*-
#BEGIN_LEGAL
#
#Copyright (c) 2019 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:/... |
rpython/rtyper/lltypesystem/llheap.py | jptomo/pypy-lang-scheme | 381 | 12610226 | # only for the LLInterpreter. Don't use directly.
from rpython.rtyper.lltypesystem.lltype import malloc, free, typeOf
from rpython.rtyper.lltypesystem.llmemory import weakref_create, weakref_deref
setfield = setattr
from operator import setitem as setarrayitem
from rpython.rlib.rgc import can_move, collect, add_memo... |
scripts/13_random_name_generator.py | Kirklin12/python-scripts | 2,076 | 12610290 | <reponame>Kirklin12/python-scripts
from random import choice
def random_name_generator(first, second, x):
"""
Generates random names.
Arguments:
- list of first names
- list of last names
- number of random names
"""
names = []
for i in range(x):
name... |
test/python/transpiler/aqc/test_aqc_plugin.py | Roshan-Thomas/qiskit-terra | 1,599 | 12610302 | <reponame>Roshan-Thomas/qiskit-terra<filename>test/python/transpiler/aqc/test_aqc_plugin.py
# This code is part of Qiskit.
#
# (C) Copyright IBM 2021.
#
# This code is licensed under the Apache License, Version 2.0. You may
# obtain a copy of this license in the LICENSE.txt file in the root directory
# of this source t... |
mainapp/migrations/0024_auto_20180815_2306.py | sndp487/rescuekerala | 657 | 12610329 | <filename>mainapp/migrations/0024_auto_20180815_2306.py<gh_stars>100-1000
# Generated by Django 2.1 on 2018-08-15 17:36
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
("mainapp", "0023_auto_20180815_1848"),
]
operations = [
migrations.Al... |
dataviz/politics_g7_police.py | Udzu/pudzu | 119 | 12610334 | from pudzu.charts import *
FONT = calibri
SCALE = 2.25
s = lambda i: round(i * SCALE)
FONTSIZE = s(16)
BIGFONT = s(18)
SMALLFONT = s(14)
SUBTITLEFONT = s(36)
TITLEFONT = s(40)
atlas = pd.read_csv("datasets/countries.csv").split_columns('country', "|").explode('country').set_index("country")
df = pd.read_c... |
scrapers/scrape_nw.py | brunis83/covid_19 | 485 | 12610362 | <reponame>brunis83/covid_19
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
import re
from bs4 import BeautifulSoup
import scrape_common as sc
import scrape_nw_common as snc
url, soup = snc.get_nw_page()
item = soup.find(text=re.compile('Anzahl F.lle')).find_parent('p')
assert item, f"Could not find title item in {ur... |
apitools/base/py/extra_types.py | SJ029626/apitools | 143 | 12610383 | <filename>apitools/base/py/extra_types.py<gh_stars>100-1000
#!/usr/bin/env python
#
# Copyright 2015 Google 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/... |
docassemble_webapp/docassemble/webapp/users/forms.py | Tucker-Eric/docassemble | 568 | 12610398 | <reponame>Tucker-Eric/docassemble<filename>docassemble_webapp/docassemble/webapp/users/forms.py
import sys
import re
from docassemble_flask_user.forms import RegisterForm, LoginForm, password_validator, unique_email_validator
from flask_wtf import FlaskForm
from wtforms import DateField, StringField, SubmitField, Valid... |
posthog/migrations/0116_session_recording_retention_period.py | avoajaugochukwu/posthog | 7,409 | 12610409 | <reponame>avoajaugochukwu/posthog<filename>posthog/migrations/0116_session_recording_retention_period.py
# Generated by Django 3.0.11 on 2021-01-25 11:38
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
("posthog", "0115_session_recording_viewed"),
]
... |
tests/test_cnn/test_weight_init.py | raoshenglong/mmcv | 3,748 | 12610417 | # Copyright (c) OpenMMLab. All rights reserved.
import random
from tempfile import TemporaryDirectory
import numpy as np
import pytest
import torch
from scipy import stats
from torch import nn
from mmcv.cnn import (Caffe2XavierInit, ConstantInit, KaimingInit, NormalInit,
PretrainedInit, TruncNor... |
src/cryptoadvance/specter/liquid/addresslist.py | aphex3k/specter-desktop | 683 | 12610439 | <reponame>aphex3k/specter-desktop
from ..addresslist import *
from embit.liquid.addresses import addr_decode, to_unconfidential
class LAddress(Address):
def __init__(self, *args, **kwargs):
super().__init__(*args, **kwargs)
self._unconfidential = to_unconfidential(self.address)
@property
... |
src/sphinx_autobuild/ignore.py | kianmeng/sphinx-autobuild | 264 | 12610511 | """Logic for ignoring paths."""
import fnmatch
import os
import re
def get_ignore(regular, regex_based):
"""Prepare the function that determines whether a path should be ignored."""
regular_patterns = regular
regex_based_patterns = [re.compile(r) for r in regex_based]
def ignore(path):
"""Det... |
class_26/strategies/martingle_spot_strategyV3.py | benbenlianghua/51kecheng | 121 | 12610512 | from howtrader.app.cta_strategy import (
CtaTemplate,
StopOrder,
TickData,
BarData,
TradeData,
OrderData
)
from howtrader.app.cta_strategy.engine import CtaEngine
from howtrader.trader.event import EVENT_TIMER
from howtrader.event import Event
from howtrader.trader.object import Status, Directi... |
tests/integration/test_account.py | varunbheemaiah/python-quickbooks | 234 | 12610513 | <reponame>varunbheemaiah/python-quickbooks
from datetime import datetime
from quickbooks.objects.account import Account
from tests.integration.test_base import QuickbooksTestCase
class AccountTest(QuickbooksTestCase):
def setUp(self):
super(AccountTest, self).setUp()
self.account_number = datetim... |
actions/close_list.py | martezr/stackstorm-trello | 164 | 12610524 | <filename>actions/close_list.py
from lib import action
class CloseListAction(action.BaseAction):
def run(self, list_id, board_id, api_key=None, token=None):
if api_key:
self._set_creds(api_key=api_key, token=token)
trello_list = self._client().get_board(board_id).get_list(list_id)
... |
doc/example1.py | ajschumacher/plac | 233 | 12610541 | <reponame>ajschumacher/plac<filename>doc/example1.py
# example1.py
def main(dsn):
"Do something with the database"
print("ok")
if __name__ == '__main__':
import sys
n = len(sys.argv[1:])
if n == 0:
sys.exit('usage: python %s dsn' % sys.argv[0])
elif n == 1:
main(sys.argv[1])
... |
iotbx/shelx/tst_hklf.py | whart222/cctbx_project | 155 | 12610588 | <reponame>whart222/cctbx_project
from __future__ import absolute_import, division, print_function
from iotbx.shelx import hklf
from cctbx.array_family import flex
from libtbx.test_utils import approx_equal
from libtbx.test_utils import Exception_expected, show_diff
from six.moves import cStringIO as StringIO
def exerc... |
srt_tools/utils.py | xl8-ai/srt | 285 | 12610614 | #!/usr/bin/env python
import argparse
import codecs
import srt
import logging
import sys
import itertools
import collections
import os
PROG_NAME = os.path.basename(sys.argv[0]).replace("-", " ", 1)
STDIN_BYTESTREAM = getattr(sys.stdin, "buffer", sys.stdin)
STDOUT_BYTESTREAM = getattr(sys.stdout, "buffer", sys.stdout... |
tests/terraform/checks/resource/aws/test_RDSClusterEncrypted.py | jamesholland-uk/checkov | 4,013 | 12610624 | import unittest
import hcl2
from checkov.terraform.checks.resource.aws.RDSClusterEncrypted import check
from checkov.common.models.enums import CheckResult
class TestRDSClusterEncrypted(unittest.TestCase):
def test_failure(self):
hcl_res = hcl2.loads("""
resource "aws_rds_global_cluster" "exa... |
pingo/examples/galileo_analog_bars.py | rbanffy/pingo | 116 | 12610636 | <filename>pingo/examples/galileo_analog_bars.py<gh_stars>100-1000
import pingo
import time
board = pingo.galileo.Galileo2()
pot = board.pins['A0']
pot.mode = pingo.ANALOG
def bar(pin):
print "*" * int(pin.ratio() * 70)
while True:
bar(pot)
time.sleep(0.05)
|
skyline/ionosphere/ionosphere.py | datastreaming/skyline-1 | 396 | 12610656 | from __future__ import division
import logging
import os
from os import kill, getpid, listdir
from os.path import join, isfile
from sys import version_info
# @modified 20191115 - Branch #3262: py3
# try:
# from Queue import Empty
# except:
# from queue import Empty
from time import time, sleep
from threading ... |
SoftLayer/CLI/block/__init__.py | dvzrv/softlayer-python | 126 | 12610658 | """Block Storage."""
|
Alfred/Alfred.alfredpreferences/workflows/user.workflow.5FE79F4C-9E12-42C8-9147-B4F1207AB4AE/defaults.py | rouxbuciu/prefs | 682 | 12610671 | #!/usr/bin/env python
# encoding: utf-8
#
# Copyright (c) 2017 <NAME> <<EMAIL>>
#
# MIT Licence. See http://opensource.org/licenses/MIT
#
# Created on 2017-07-16
#
"""defaults.py (save|delete) <dimensionality> <unit>
Save/delete default units for given dimensionality.
Usage:
defaults.py save <dimensionality> <un... |
tools/telemetry/telemetry/core/platform/profiler/oomkiller_profiler.py | nagineni/chromium-crosswalk | 231 | 12610682 | <reponame>nagineni/chromium-crosswalk<gh_stars>100-1000
# Copyright 2013 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.
import os
from telemetry.core import util
from telemetry.core.backends.chrome import android_browser... |
corpkit/keys.py | interrogator/corpk | 216 | 12610685 | <filename>corpkit/keys.py
"""corpkit: simple keyworder"""
from __future__ import print_function
from corpkit.constants import STRINGTYPE, PYTHON_VERSION
def keywords(target_corpus,
reference_corpus='bnc.p',
threshold=False,
selfdrop=True,
calc_all=True,
... |
fabtools/tests/test_oracle_jdk.py | timgates42/fabtools | 308 | 12610773 | <reponame>timgates42/fabtools
import mock
import unittest
class OracleJdkTestCase(unittest.TestCase):
@mock.patch('fabtools.oracle_jdk.get_arch')
def test_jdk_arch_for_x64_system(self, get_arch):
from fabtools.oracle_jdk import _required_jdk_arch
get_arch.return_value = 'x86_64'
s... |
src/biotite/application/sra/__init__.py | danijoo/biotite | 208 | 12610782 | <filename>src/biotite/application/sra/__init__.py<gh_stars>100-1000
# This source code is part of the Biotite package and is distributed
# under the 3-Clause BSD License. Please see 'LICENSE.rst' for further
# information.
"""
A subpackage for obtaining sequencing data from the *NCBI*
*sequence read archive* (SRA).
""... |
vul/13-JBoss-serialization-getshell.py | zx273983653/vulscan | 582 | 12610787 | #!/usr/bin/env python
# -*- coding: utf-8 -*-
"""
Copyright (c) 2014-2015 pocsuite developers (http://seebug.org)
See the file 'docs/COPYING' for copying permission
"""
#命令行
from pocsuite import pocsuite_cli
#验证模块
from pocsuite import pocsuite_verify
#攻击模块
from pocsuite import pocsuite_attack
#控制台模式
from pocsuite impo... |
python/tvm/topi/nn/dilate.py | XiaoSong9905/tvm | 4,640 | 12610792 | # Licensed to the Apache Software Foundation (ASF) under one
# or more contributor license agreements. See the NOTICE file
# distributed with this work for additional information
# regarding copyright ownership. The ASF licenses this file
# to you under the Apache License, Version 2.0 (the
# "License"); you may not u... |
models/transformer_block.py | Hanqer/T2T-ViT | 931 | 12610804 | # Copyright (c) [2012]-[2021] Shanghai Yitu Technology Co., Ltd.
#
# This source code is licensed under the Clear BSD License
# LICENSE file in the root directory of this file
# All rights reserved.
"""
Borrow from timm(https://github.com/rwightman/pytorch-image-models)
"""
import torch
import torch.nn as nn
import num... |
configs/detection/mpsr/voc/split1/mpsr_r101_fpn_2xb2_voc-split1_1shot-fine-tuning.py | BIGWangYuDong/mmfewshot | 376 | 12610807 | _base_ = [
'../../../_base_/datasets/two_branch/few_shot_voc.py',
'../../../_base_/schedules/schedule.py', '../../mpsr_r101_fpn.py',
'../../../_base_/default_runtime.py'
]
# classes splits are predefined in FewShotVOCDataset
# FewShotVOCDefaultDataset predefine ann_cfg for model reproducibility.
data = dict... |
test/algorithms/test_warm_start_qaoa.py | X-Libor/qiskit-optimization | 109 | 12610831 | <filename>test/algorithms/test_warm_start_qaoa.py
# This code is part of Qiskit.
#
# (C) Copyright IBM 2021.
#
# This code is licensed under the Apache License, Version 2.0. You may
# obtain a copy of this license in the LICENSE.txt file in the root directory
# of this source tree or at http://www.apache.org/licenses/L... |
official/nlp/modeling/ops/segment_extractor_test.py | akshit-protonn/models | 82,518 | 12610841 | <filename>official/nlp/modeling/ops/segment_extractor_test.py
# Copyright 2021 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.... |
main_test.py | HTTPArchive/httparchive.org | 269 | 12610843 | # Copyright 2015 Google 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 a... |
python/interpret_text/experimental/explanation.py | imatiach-msft/interpret-text | 277 | 12610855 | <filename>python/interpret_text/experimental/explanation.py
# ---------------------------------------------------------
# Copyright (c) Microsoft Corporation. All rights reserved.
# ---------------------------------------------------------
"""Defines the explanations that are returned from explaining models."""
impor... |
api/nodes/permissions.py | gaybro8777/osf.io | 628 | 12610860 | # -*- coding: utf-8 -*-
from rest_framework import permissions
from rest_framework import exceptions
from addons.base.models import BaseAddonSettings
from osf.models import (
AbstractNode,
Contributor,
DraftNode,
DraftRegistration,
Institution,
Node,
NodeRelation,
OSFGroup,
OSFUser,... |
s3tk/__init__.py | ankane/s3tk | 432 | 12610870 | # -*- coding: utf-8 -*-
import sys
import os.path
import json
import fnmatch
from collections import Counter, OrderedDict
import boto3
import botocore
import click
from joblib import Parallel, delayed
from clint.textui import colored, puts, indent
from .checks import AclCheck, PolicyCheck, PublicAccessCheck, LoggingCh... |
fugue_spark/_utils/convert.py | kvnkho/fugue | 547 | 12610878 | from typing import Any, Iterable, List, Tuple
import pyarrow as pa
import pyspark.sql as ps
import pyspark.sql.types as pt
try: # pyspark < 3
from pyspark.sql.types import from_arrow_type, to_arrow_type # type: ignore
# https://issues.apache.org/jira/browse/SPARK-29041
pt._acceptable_types[pt.BinaryTyp... |
homeassistant/components/demo/lock.py | mtarjoianu/core | 1,635 | 12610889 | <reponame>mtarjoianu/core
"""Demo lock platform that has two fake locks."""
from __future__ import annotations
import asyncio
from homeassistant.components.lock import LockEntity, LockEntityFeature
from homeassistant.config_entries import ConfigEntry
from homeassistant.const import (
STATE_JAMMED,
STATE_LOCKE... |
release/scripts/startup/bl_ui/properties_scene.py | gunslingster/CSC581-assignement1 | 365 | 12610890 | <reponame>gunslingster/CSC581-assignement1
# ##### BEGIN GPL LICENSE BLOCK #####
#
# This program is free software; you can redistribute it and/or
# modify it under the terms of the GNU General Public License
# as published by the Free Software Foundation; either version 2
# of the License, or (at your option) any ... |
python_uiautomator/ui_object.py | maksonlee/android-uiconductor | 113 | 12610898 | #!/usr/bin/python
#
# 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 ag... |
caffe2/python/build.py | Hacky-DH/pytorch | 60,067 | 12610923 |
import caffe2.python._import_c_extension as C
CAFFE2_NO_OPERATOR_SCHEMA = C.define_caffe2_no_operator_schema
build_options = C.get_build_options()
|
pylenium/performance.py | gleekzorp/pyleniumio | 169 | 12610925 | <filename>pylenium/performance.py
import logging
import time
from typing import Union, List, Optional
from pydantic import BaseModel, Field
from selenium.common.exceptions import TimeoutException
from selenium.webdriver.support.wait import WebDriverWait
def stopwatch(func):
""" Stopwatch Decorator.
Use this... |
mtdnn/common/tokenization_utils.py | microsoft/mt-dnn | 113 | 12610948 | <gh_stars>100-1000
# coding=utf-8
# Copyright (c) Microsoft. All rights reserved.
import json
from typing import Union
import numpy as np
from mtdnn.common.types import DataFormat, TaskType, TaskDefType
from mtdnn.tasks.config import get_task_obj
def load_task_data(
file_path_or_processed_data_list: Union[str, ... |
minihinch/gui/fonts/arial_50.py | aabbtree77/esp32-mqtt-experiments | 198 | 12610957 | # Code generated by font_to_py.py.
# Font: Arial.ttf Char set: 0123456789:
# Cmd: ./font_to_py.py Arial.ttf 50 arial_50.py -x -c 0123456789:
version = '0.33'
def height():
return 50
def baseline():
return 49
def max_width():
return 37
def hmap():
return True
def reverse():
return False
def mon... |
example/rnn/word_lm/module.py | Vikas-kum/incubator-mxnet | 228 | 12610958 | # Licensed to the Apache Software Foundation (ASF) under one
# or more contributor license agreements. See the NOTICE file
# distributed with this work for additional information
# regarding copyright ownership. The ASF licenses this file
# to you under the Apache License, Version 2.0 (the
# "License"); you may not u... |
ykdl/extractors/bilibili/live.py | SeaHOH/ykdl | 136 | 12610959 | # -*- coding: utf-8 -*-
from .._common import *
class BiliLive(Extractor):
name = 'Bilibili live (哔哩哔哩 直播)'
profile_2_id = {
'4K': '4K',
'原画': 'OG',
'蓝光': 'BD',
'超清': 'TD',
'高清': 'HD',
'流畅': 'SD'
}
def prepare(self):
info = MediaInfo(self.na... |
terrascript/spotinst/r.py | hugovk/python-terrascript | 507 | 12610971 | # terrascript/spotinst/r.py
|
cms/management/commands/cms.py | devyntk/django-cms | 5,659 | 12610973 | <reponame>devyntk/django-cms<gh_stars>1000+
from collections import OrderedDict
import cms
from .subcommands.base import SubcommandsCommand
from .subcommands.check import CheckInstallation
from .subcommands.copy import CopyCommand
from .subcommands.delete_orphaned_plugins import DeleteOrphanedPluginsCommand
from .sub... |
cloudmarker/events/rdbmsenforcetlsevent.py | TinLe/cloudmarker | 208 | 12610980 | """RDBMS Enforce TLS/SSL Event.
This module defines the :class:`RDBMSEnforceTLSEvent` class that
identifies RDBMS servers which have TLS/SSL connection enforcement
disabled. This plugin works on the properties found in the ``com``
bucket of ``rdbms`` records.
"""
import logging
from cloudmarker import util
_log =... |
tests/test_all_notebooks.py | maulanailyasy/miepythonscot | 104 | 12610987 | <reponame>maulanailyasy/miepythonscot<gh_stars>100-1000
# pylint: disable=invalid-name
"""
This file is intended to be the target of a pytest run.
It will recursively find all .ipynb files in the current directory, ignoring
directories that start with . and any files matching patterins found in the file
.testignore
... |
test/cts/tool/CTSConverter/src/nn/specs/V1_1/pad_float_1_relaxed.mod.py | zhaoming0/webml-polyfill | 255 | 12611011 | <reponame>zhaoming0/webml-polyfill<gh_stars>100-1000
#
# Copyright (C) 2018 The Android Open Source Project
#
# 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... |
scratchpad/save_subtitles.py | Outflier/PyAV | 965 | 12611015 | """
As you can see, the subtitle API needs some work.
"""
import os
import sys
import pprint
from PIL import Image
from av import open
if not os.path.exists('subtitles'):
os.makedirs('subtitles')
video = open(sys.argv[1])
streams = [s for s in video.streams if s.type == b'subtitle']
if not streams:
pr... |
fastapi_sqlalchemy/exceptions.py | cancan101/fastapi-sqlalchemy | 419 | 12611017 | <filename>fastapi_sqlalchemy/exceptions.py
class MissingSessionError(Exception):
"""Excetion raised for when the user tries to access a database session before it is created."""
def __init__(self):
msg = """
No session found! Either you are not currently in a request context,
or you nee... |
tsne/_bh_sne.py | WiscEvan/tsne | 404 | 12611027 | import numpy as np
import scipy.linalg as la
from bh_sne import BH_SNE
def bh_sne(
data,
pca_d=None,
d=2,
perplexity=30.0,
theta=0.5,
random_state=None,
copy_data=False,
verbose=False,
):
"""
Run Barnes-Hut T-SNE on _data_.
@param data The data.
@param pca_d ... |
AppPkg/Applications/Python/Python-2.7.2/Lib/json/tests/test_indent.py | CEOALT1/RefindPlusUDK | 2,757 | 12611029 | import textwrap
from StringIO import StringIO
from json.tests import PyTest, CTest
class TestIndent(object):
def test_indent(self):
h = [['blorpie'], ['whoops'], [], 'd-shtaeou', 'd-nthiouh', 'i-vhbjkhnth',
{'nifty': 87}, {'field': 'yes', 'morefield': False} ]
expect = text... |
torchrecipes/audio/source_separation/loss/utils.py | facebookresearch/recipes | 161 | 12611036 | <filename>torchrecipes/audio/source_separation/loss/utils.py
# Copyright (c) Meta Platforms, Inc. and affiliates.
#
# This source code is licensed under the BSD-style license found in the
# LICENSE file in the root directory of this source tree.
#!/usr/bin/env python3
# pyre-strict
import math
from itertools import ... |
config/__init__.py | Neuralearn/PAN.pytorch | 419 | 12611071 | # -*- coding: utf-8 -*-
# @Time : 2019/8/23 21:50
# @Author : zhoujun |
src/twisted/internet/_glibbase.py | giadram/twisted | 4,612 | 12611080 | <reponame>giadram/twisted
# -*- test-case-name: twisted.internet.test -*-
# Copyright (c) Twisted Matrix Laboratories.
# See LICENSE for details.
"""
This module provides base support for Twisted to interact with the glib/gtk
mainloops.
The classes in this module should not be used directly, but rather you should
imp... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.