max_stars_repo_path string | max_stars_repo_name string | max_stars_count int64 | id string | content string | add_param_types int64 | add_return_types int64 | add_class_field_types int64 | add_instance_field_types int64 | add_total int64 | add_error int64 |
|---|---|---|---|---|---|---|---|---|---|---|
logistic-regression/plot_binary_decision.py | eliben/deep-learning-samples | 183 | 1651748 | # Helper code to plot a binary decision region.
#
# <NAME> (http://eli.thegreenplace.net)
# This code is in the public domain
from __future__ import print_function
import matplotlib.pyplot as plt
import numpy as np
if __name__ == '__main__':
# Our input is (x,y) -- 2D. Output is the scalar y^ computed by the
... | 0 | 0 | 0 | 0 | 0 | 0 |
lmgtfy/admin.py | opendata/LMGTDFY | 120 | 1651773 | <reponame>opendata/LMGTDFY<gh_stars>100-1000
from django.contrib import admin
from lmgtfy.models import TLD
class TLDAdmin(admin.ModelAdmin):
pass
admin.site.register(TLD, TLDAdmin)
| 0 | 0 | 0 | 0 | 0 | 0 |
config.py | opconty/Transformer_STR | 215 | 1651780 | <gh_stars>100-1000
#-*- coding: utf-8 -*-
#'''
# @date: 2020/6/9 下午12:17
#
# @author: laygin
#
#'''
import os
import sys
import re
import string
from nicelogger import ColorLogger
logger = ColorLogger()
proj_dir = os.path.abspath(os.path.dirname(__file__))
if proj_dir not in sys.path:
sys.path.insert(0, proj_dir)... | 0 | 0 | 0 | 0 | 0 | 0 |
alipay/aop/api/domain/IntelligentGuideTradeDetail.py | antopen/alipay-sdk-python-all | 213 | 1651829 | #!/usr/bin/env python
# -*- coding: utf-8 -*-
from __future__ import annotations
import json
from alipay.aop.api.constant.ParamConstants import *
class IntelligentGuideTradeDetail(object):
def __init__(self):
self._card_type: None = None
self._customer_source: None = None
self._customer_... | 0 | 20 | 0 | 18 | 38 | 0 |
release/stubs.min/Tekla/Structures/ModelInternal_parts/CDelegateSetter.py | htlcnn/ironpython-stubs | 182 | 1651914 | <gh_stars>100-1000
class CDelegateSetter(object):
# no doc
@staticmethod
def SetInstanceForUnitTesting(cdelegate):
""" SetInstanceForUnitTesting(cdelegate: ICDelegate) """
pass
__all__=[
'__reduce_ex__',
'SetInstanceForUnitTesting',
]
| 0 | 0 | 0 | 0 | 0 | 0 |
lldb/packages/Python/lldbsuite/test/functionalities/ubsan/user-expression/TestUbsanUserExpression.py | medismailben/llvm-project | 765 | 1651928 | <gh_stars>100-1000
"""
Test that hitting a UBSan issue while running user expression doesn't break the evaluation.
"""
import lldb
from lldbsuite.test.lldbtest import *
from lldbsuite.test.decorators import *
import lldbsuite.test.lldbutil as lldbutil
class UbsanUserExpressionTestCase(TestBase):
mydir = TestBas... | 0 | 0 | 0 | 0 | 0 | 0 |
collection/accounts_post_2013.py | mihaivavram/twitterbots | 141 | 1651986 | <reponame>mihaivavram/twitterbots
from __future__ import absolute_import, print_function
from tweepy.streaming import StreamListener
from tweepy import OAuthHandler, Stream, API
from queue import Queue
from collection.tweets import extract_users
import os
import json
import logging
import time
logger = logging.getL... | 0 | 0 | 0 | 0 | 0 | 0 |
SimMuon/CSCDigitizer/python/cscDigiDump_cfi.py | ckamtsikis/cmssw | 852 | 1652032 | <filename>SimMuon/CSCDigitizer/python/cscDigiDump_cfi.py<gh_stars>100-1000
import FWCore.ParameterSet.Config as cms
cscDigiDump = cms.EDAnalyzer("CSCDigiDump",
wireDigiTag = cms.InputTag("muonCSCDigis","MuonCSCWireDigi"),
stripDigiTag = cms.InputTag("muonCSCDigis","MuonCSCStripDigi"),
comparatorDigiTag = c... | 0 | 0 | 0 | 0 | 0 | 0 |
example/orders/admin.py | prog32/django-getpaid | 220 | 1652078 | <reponame>prog32/django-getpaid
from django.contrib import admin
from . import models
@admin.register(models.CustomPayment)
class PaymentAdmin(admin.ModelAdmin):
list_display = (
"id",
"order_id",
"amount_required",
"currency",
"status",
"backend",
"created... | 0 | 0 | 0 | 0 | 0 | 0 |
test/engine/test_util.py | huggingface/neural-compressor | 172 | 1652130 | import unittest
import numpy as np
from neural_compressor.adaptor.engine_utils.util import collate_preds
class TestUtil(unittest.TestCase):
@classmethod
def setUpClass(self):
pass
@classmethod
def tearDownClass(self):
pass
def test_collate_preds(self):
fake_preds = np.rand... | 0 | 0 | 0 | 0 | 0 | 0 |
tests/ludwig/datasets/titanic/test_titanic_workflow.py | dantreiman/ludwig | 7,739 | 1652155 | import os
import tempfile
import zipfile
from shutil import copy
from unittest import mock
import pandas as pd
from ludwig.datasets.titanic import Titanic
class FakeTitanicDataset(Titanic):
def __init__(self, cache_dir):
super().__init__(cache_dir=cache_dir)
def test_download_titanic_dataset(tmpdir):
... | 0 | 0 | 0 | 0 | 0 | 0 |
posthog/migrations/0158_new_token_format.py | brave-care/posthog | 7,409 | 1652170 | <reponame>brave-care/posthog<filename>posthog/migrations/0158_new_token_format.py<gh_stars>1000+
# Generated by Django 3.1.8 on 2021-06-23 16:01
import django.core.validators
from django.db import migrations, models
import posthog.models.utils
class Migration(migrations.Migration):
dependencies = [
("p... | 0 | 0 | 0 | 0 | 0 | 0 |
src/byro/bookkeeping/migrations/0014_auto_20180707_1410.py | dnet/byro | 114 | 1652191 | # -*- coding: utf-8 -*-
# Generated by Django 1.11.13 on 2018-07-07 14:10
from __future__ import unicode_literals
from django.db import models, migrations
def delete_old_accounts(apps, schema_editor):
Account = apps.get_model("bookkeeping", "Account")
Account.objects.filter(
models.Q(account_categor... | 0 | 0 | 2 | 0 | 2 | 0 |
StockAnalysisSystem/core/Utility/AnalyzerUtility.py | SleepySoft/StockAnalysisSystem | 138 | 1652197 | from __future__ import annotations
import json
from collections import OrderedDict
import openpyxl
import pandas as pd
from .common import *
from .df_utility import *
from .time_utility import *
def methods_from_prob(prob: dict) -> []:
return methods_from_method_list(prob.get('methods', []))
def methods_from_... | 65 | 31 | 6 | 8 | 110 | 0 |
modules/google-earth-engine/docker/src/sepalinternal/landcover/decision_tree_converter.py | BuddyVolly/sepal | 153 | 1652247 | <filename>modules/google-earth-engine/docker/src/sepalinternal/landcover/decision_tree_converter.py<gh_stars>100-1000
def convert(decision_tree):
result = {}
def convert_key(tree, key):
current_key = 'key' + str(key)
value = {
'band': tree['primitive'],
'threshold': tree... | 0 | 0 | 0 | 0 | 0 | 0 |
tests/test_particle_swarm.py | miraaitsaada/Solid | 590 | 1652269 | from Solid.ParticleSwarm import ParticleSwarm
class Algorithm(ParticleSwarm):
"""
Tries to get a randomly-generated list to match [.1, .2, .3, .2, .1]
"""
def _objective(self, member) -> object:
return sum(abs(member[i] - [.1, .2, .3, .2, .1][i]) if (member[i] > 0 or member[i] < 0) else 1 for ... | 0 | 1 | 0 | 0 | 1 | 0 |
nose2/tests/functional/support/lib/layer_hooks_plugin.py | deeplow/nose2 | 637 | 1652279 | import six
from nose2 import events
class PrintFixture(events.Plugin):
alwaysOn: bool = True
def startLayerSetup(self, event):
six.print_("StartLayerSetup: {0}".format(event.layer))
def stopLayerSetup(self, event):
six.print_("StopLayerSetup: {0}".format(event.layer))
def startLaye... | 0 | 0 | 1 | 0 | 1 | 0 |
malaya_speech/train/model/stft/__init__.py | ishine/malaya-speech | 111 | 1652293 | <filename>malaya_speech/train/model/stft/__init__.py
from . import loss
| 0 | 0 | 0 | 0 | 0 | 0 |
scenarios/tests/same_location/scenario.py | isgeles/SMARTS | 554 | 1652322 | <filename>scenarios/tests/same_location/scenario.py
from pathlib import Path
from typing import Any, Tuple
import smarts.sstudio.types as types
from smarts.sstudio import gen_missions, gen_traffic
scenario = str(Path(__file__).parent)
patient_car = types.TrafficActor(
name="car",
)
shared_route = types.Route(
... | 0 | 0 | 0 | 0 | 0 | 0 |
Doc/includes/sqlite3/ctx_manager.py | pxeger/cpython | 52,316 | 1652333 | import sqlite3
con = sqlite3.connect(":memory:")
con.execute("create table lang (id integer primary key, name varchar unique)")
# Successful, con.commit() is called automatically afterwards
with con:
con.execute("insert into lang(name) values (?)", ("Python",))
# con.rollback() is called after the with block fin... | 0 | 0 | 0 | 0 | 0 | 0 |
demo/plot_wavelets.py | nigma/pywt | 101 | 1652368 | #!/usr/bin/env python
# -*- coding: utf-8 -*-
# Plot scaling and wavelet functions for db, sym, coif, bior and rbio families
import itertools
import pylab
import pywt
iterations = 5
plot_data = [
('db', (4, 3)),
('sym', (4, 3)),
('coif', (3, 2))
]
for family, (rows, cols) in plot_data:
f = pylab.... | 0 | 0 | 0 | 0 | 0 | 0 |
release/stubs.min/Tekla/Structures/ModelInternal_parts/dotHierarchicList_t.py | htlcnn/ironpython-stubs | 182 | 1652406 | class dotHierarchicList_t(object):
# no doc
aObjects: None = None
ModelFatherObject: None = None
nObjects: None = None
ObjectsLeftToGet: None = None
OperationType: None = None
| 0 | 0 | 5 | 0 | 5 | 0 |
Backend/mwall.py | adeagaoluwaseun/Voting | 764 | 1652416 | <gh_stars>100-1000
# Copyright Fortior Blockchain, LLLP 2021
# Apache License
# Imports
from algosdk.v2client import algod
from algosdk import account, mnemonic, transaction
from algosdk.future.transaction import AssetTransferTxn
# Put Algod Client address here
algod_address = "https://testnet-algorand.api.purestake... | 0 | 0 | 0 | 0 | 0 | 0 |
Programming Languages/Python/Theory/100_Python_Challenges/Section _1_Basic_Coding_Exercises/11. check if given year, month has Friday 13th.py | jaswinder9051998/Resources | 101 | 1652437 | <reponame>jaswinder9051998/Resources
"""
Write a function that accepts two arguments year and month, and then checks if the month has Friday the 13th.
Example:
year = 2020, month = 3
Expected output = True
"""
from datetime import datetime
def check_friday_13(yr, mon):
user_date = datetime(yr, mon, 13)
i... | 0 | 0 | 0 | 0 | 0 | 0 |
tests/unit/butterfree/validations/test_basic_validation.py | fossabot/butterfree | 208 | 1652438 | import pytest
from butterfree.validations import BasicValidation
class TestBasicValidation:
def test_validate_without_column_ts(self, feature_set_without_ts):
check = BasicValidation(feature_set_without_ts)
with pytest.raises(ValueError):
check.validate_column_ts()
def test_vali... | 0 | 0 | 0 | 0 | 0 | 0 |
scripts/py_featextr_server/python_generated/protocol/ttypes.py | prateeksingh0001/FlexNeuART | 101 | 1652469 | <gh_stars>100-1000
#
# Autogenerated by Thrift Compiler (0.12.0)
#
# DO NOT EDIT UNLESS YOU ARE SURE THAT YOU KNOW WHAT YOU ARE DOING
#
# options string: py
#
from thrift.Thrift import TType, TMessageType, TFrozenDict, TException, TApplicationException
from thrift.protocol.TProtocol import TProtocolException
from thr... | 0 | 0 | 0 | 0 | 0 | 0 |
tests/_site/apps/myapp/__init__.py | QueoLda/django-oscar | 4,639 | 1652472 | <filename>tests/_site/apps/myapp/__init__.py
default_app_config = 'tests._site.apps.myapp.apps.TestConfig'
| 0 | 0 | 0 | 0 | 0 | 0 |
minpy/array_variants/numpy/numpy_wrapper.py | yuhonghong66/minpy | 1,271 | 1652477 | <filename>minpy/array_variants/numpy/numpy_wrapper.py
#!/usr/bin/env python
# -*- coding: utf-8 -*-
"""Wrapper for NumPy namespace."""
from __future__ import absolute_import
from __future__ import print_function
import inspect
import numpy as np
def wrap_namespace(nspace, reg, prim_wrapper):
"""Register all func... | 0 | 0 | 0 | 0 | 0 | 0 |
tests/objects/test_boolobject.py | mswart/topaz | 241 | 1652590 | from ..base import BaseTopazTest
class TestTrueObject(BaseTopazTest):
def test_name(self, space):
space.execute("TrueClass")
def test_to_s(self, space):
w_res = space.execute("return true.to_s")
assert space.str_w(w_res) == "true"
def test_inspect(self, space):
w_res = sp... | 0 | 0 | 0 | 0 | 0 | 0 |
python_tools/rename_image_filenames.py | edward0im/Monocular-Visual-Odometry | 205 | 1652630 | <filename>python_tools/rename_image_filenames.py<gh_stars>100-1000
# Run this script, to rename all the images in dataset_dir (specified by config.yaml) to the required filenames.
import yaml # for loading .yaml file
import os # for getting/setting filenames
# Open config file
stream = open("config/config.yaml", "r"... | 0 | 0 | 0 | 0 | 0 | 0 |
tests/test_quantities/test_hess_max_ev.py | wx-b/cockpit | 367 | 1652637 | """Compare ``HessMaxEV`` quantity with ``torch.autograd``."""
import warnings
import pytest
from cockpit.quantities import HessMaxEV
from tests.test_quantities.settings import (
INDEPENDENT_RUNS,
INDEPENDENT_RUNS_IDS,
PROBLEMS,
PROBLEMS_IDS,
QUANTITY_KWARGS,
QUANTITY_KWARGS_IDS,
)
from tests.... | 0 | 1 | 0 | 0 | 1 | 0 |
test/units/test_oci_load_balancer_health_facts.py | slmjy/oci-ansible-modules | 106 | 1652656 | <filename>test/units/test_oci_load_balancer_health_facts.py
# Copyright (c) 2018, Oracle and/or its affiliates.
# This software is made available to you under the terms of the GPL 3.0 license or the Apache 2.0 license.
# GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt)
# Apache... | 0 | 0 | 0 | 0 | 0 | 0 |
examples/AITISA/load_model_from_pyg/gcn.py | zbmain/PGL | 1,389 | 1652661 | # 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/licenses/LICENSE-2.0
#
# Unless required by appli... | 3 | 3 | 0 | 0 | 6 | 0 |
setup.py | ascribe/transactions | 124 | 1652728 | <reponame>ascribe/transactions<gh_stars>100-1000
"""
transactions: Bitcoin for Humans
transactions is a small python library to easily create and push transactions
to the bitcoin network.
More information at https://github.com/ascribe/transactions
"""
import io
import os
import re
from setuptools import setup
def... | 0 | 0 | 0 | 0 | 0 | 0 |
rqalpha/mod/rqalpha_mod_sys_accounts/mod.py | LawrentChen/rqalpha | 5,263 | 1652746 | # -*- coding: utf-8 -*-
# 版权所有 2019 深圳米筐科技有限公司(下称“米筐科技”)
#
# 除非遵守当前许可,否则不得使用本软件。
#
# * 非商业用途(非商业用途指个人出于非商业目的使用本软件,或者高校、研究所等非营利机构出于教育、科研等目的使用本软件):
# 遵守 Apache License 2.0(下称“Apache 2.0 许可”),
# 您可以在以下位置获得 Apache 2.0 许可的副本:http://www.apache.org/licenses/LICENSE-2.0。
# 除非法律有要求或以书面形式达成协议,否则本软件分发时... | 1 | 0 | 0 | 0 | 1 | 0 |
template/exp_configs.py | haven-ai/haven-ai | 145 | 1652754 | <reponame>haven-ai/haven-ai
EXP_GROUPS = {}
EXP_GROUPS["mnist"] = []
for lr in [1, 1e-1, 1e-2, 1e-3, 1e-4, 1e-5]:
EXP_GROUPS["mnist"] += [{"lr": lr, "dataset": "visual", "model": "linear"}]
EXP_GROUPS["syn"] = []
for lr in [1, 1e-1, 1e-2, 1e-3, 1e-4, 1e-5]:
EXP_GROUPS["syn"] += [{"lr": lr, "dataset": "syn",... | 0 | 0 | 0 | 0 | 0 | 0 |
sdk/servicebus/azure-mgmt-servicebus/azure/mgmt/servicebus/v2015_08_01/models/_models_py3.py | rsdoherty/azure-sdk-for-python | 2,728 | 1652791 | # coding=utf-8
# --------------------------------------------------------------------------
# Copyright (c) Microsoft Corporation. All rights reserved.
# Licensed under the MIT License. See License.txt in the project root for license information.
# Code generated by Microsoft (R) AutoRest Code Generator.
# Changes may ... | 136 | 0 | 45 | 57 | 238 | 0 |
classification/train_index.py | JDAI-CV/LIO | 105 | 1652805 | #oding=utf-8
import os
import datetime
import pandas as pd
from dataset.dataset_index import collate_fn1, collate_fn2, dataset
import torch
import torch.nn as nn
import torch.utils.data as torchdata
from torchvision import datasets, models, transforms
from torchvision.models import resnet50
import torch.optim as optim
... | 0 | 0 | 0 | 0 | 0 | 0 |
Scripts/pull_web_blockly.py | idkook/blockly-ios | 417 | 1652809 | <reponame>idkook/blockly-ios
#!/usr/bin/python2.7
# Updates all required *_compressed.js files from web Blockly.
#
# Usage:
# ./pull_web_blockly
#
# Copyright 2017 Google Inc.
# https://developers.google.com/blockly/
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except ... | 0 | 0 | 0 | 0 | 0 | 0 |
PokerRL/rl/errors.py | MAWUT0R/PokerRL | 247 | 1652815 | # Copyright (c) 2019 <NAME>
class UnknownModeError(ValueError):
def __init__(self, var):
print("Mode", var, "is unknown")
| 0 | 0 | 0 | 0 | 0 | 0 |
symbol/symbol_aognet.py | xilaili/AOGNet | 148 | 1652844 | <reponame>xilaili/AOGNet
from .node import Tnode_Op, Onode_Op, Anode_Op
from .base import *
from aognet.aog.aog_1d import *
eps = 2e-5
def aog_unit(data, cfg, aog, in_channels, out_channels, stride=(1, 1), bn_mom=0.9, workspace=512, name=''):
def calculate_slices(dim, channels):
slices = [0] * dim
... | 0 | 0 | 0 | 0 | 0 | 0 |
OpenCLGA/evaluation/ant/python_ant_tsp.py | czarnobylu/OpenCLGA | 112 | 1652871 | #!/usr/bin/python3
import math
import numpy
import random
import sys
from OpenCLGA import utils
class PythonAntTSP():
def __init__(self, options):
self.__iterations = options['iterations']
self.__ants = options['ants']
# the option for pheromone affecting probability
self.__alpha =... | 0 | 4 | 0 | 0 | 4 | 0 |
platform_tools/android/bin/download_toolchains.py | quanganh2627/bytm-x64-L-w05-2015_external_chromium_org_third_party_skia | 5,964 | 1652875 | <gh_stars>1000+
#!/usr/bin/python
"""Download all toolchains for this platform.
This module downloads multiple tgz's.
"""
import download_utils
import sys
url = sys.argv[1]
filepath = sys.argv[2]
try:
download_utils.SyncURL(url, filepath)
exit(0)
except download_utils.HashError, e:
exit(1)
| 0 | 0 | 0 | 0 | 0 | 0 |
deepcrf/main.py | massongit/deep-crf | 174 | 1652885 | <reponame>massongit/deep-crf
#!/usr/bin/env python
# -*- coding: utf-8 -*-
import os
os.environ["CHAINER_SEED"] = "1234"
import random
import numpy as np
random.seed(1234)
np.random.seed(1234)
import chainer
from chainer import cuda
from chainer import optimizers
from chainer import serializers
import chainer.functi... | 0 | 0 | 0 | 0 | 0 | 0 |
crossword/exceptions.py | jmviz/xd | 179 | 1652906 | # -*- coding: utf-8 -*-
class CrosswordException(Exception):
pass
| 0 | 0 | 0 | 0 | 0 | 0 |
tasks/tts/ps.py | leminhnguyen/NATSpeech | 561 | 1652928 | <reponame>leminhnguyen/NATSpeech
import os
import torch
import torch.nn.functional as F
from torch import nn
from modules.tts.portaspeech.portaspeech import PortaSpeech
from tasks.tts.fs import FastSpeechTask
from utils.audio.align import mel2token_to_dur
from utils.commons.hparams import hparams
from utils.metrics.di... | 0 | 0 | 0 | 0 | 0 | 0 |
uliweb/contrib/clean/subcommands.py | timgates42/uliweb | 202 | 1652961 | import os
from optparse import make_option
from uliweb.core.commands import Command, get_answer
class DirCommand(Command):
name = 'dir'
args = 'directory [,...]'
help = 'Clear all files or file patterns in dirs.'
option_list = (
make_option('-e', '--extension', dest='extensions', action='append... | 0 | 0 | 0 | 0 | 0 | 0 |
openmdao/devtools/tests/mem_model.py | toddrme2178/OpenMDAO | 451 | 1652968 | <reponame>toddrme2178/OpenMDAO
from openmdao.api import Problem
from openmdao.test_suite.test_examples.beam_optimization.multipoint_beam_group import MultipointBeamGroup
def main():
E = 1.
L = 1.
b = 0.1
volume = 0.01
num_elements = 50 * 32
num_cp = 4
num_load_cases = 32
prob = Probl... | 0 | 0 | 0 | 0 | 0 | 0 |
ambari-server/src/test/python/TestServiceAdvisor.py | likenamehaojie/Apache-Ambari-ZH | 1,664 | 1653015 | '''
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 use this ... | 0 | 1 | 0 | 0 | 1 | 0 |
src/sys/pkg/scripts/merge_sysmgr_config.py | wwjiang007/fuchsia-1 | 210 | 1653022 | <reponame>wwjiang007/fuchsia-1<gh_stars>100-1000
#!/usr/bin/env python3.8
# Copyright 2019 The Fuchsia Authors. All rights reserved.
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
"""Merge sysmgr config files
This module defines a command line tool to merge multip... | 0 | 0 | 0 | 0 | 0 | 0 |
code/refinement_net/scripts/eval/Datasets/EvalOSVOSWorst.py | MTonyM/PReMVOS | 154 | 1653036 | import glob
import os
import random
import numpy as np
from scipy.misc import imread
from refinement_net.core.Measures import compute_measures_for_binary_segmentation_single_image, IOU
from refinement_net.datasets import DataKeys
from refinement_net.datasets.DAVIS import DAVIS
from refinement_net.datasets.Dataset imp... | 0 | 5 | 0 | 0 | 5 | 0 |
support/resnet-tensorflow-master/main.py | sjkim04/AlphaGOZero-python-tensorflow | 325 | 1653055 | <filename>support/resnet-tensorflow-master/main.py<gh_stars>100-1000
import tensorflow as tf
import tensorlayer as tl
from tensorlayer.layers import set_keep
import numpy as np
import resnet_model
import argparse
parser = argparse.ArgumentParser(description='Define parameters.')
parser.add_argument('--n_epoch', type=... | 0 | 0 | 0 | 0 | 0 | 0 |
is_integer_tutorial.py | NightmareQAQ/python-notes | 106 | 1653102 | <reponame>NightmareQAQ/python-notes
# ref. https://docs.python.org/3.6/library/stdtypes.html#float.is_integer
import unittest
'''
float.is_integer()
Return True if the float is an integer
'''
def check_is_integer(number):
result = float(number).is_integer()
return result
class TestCase(unittest.TestCase):... | 0 | 0 | 0 | 0 | 0 | 0 |
spektral/transforms/clustering_coefficient.py | JonaBecher/spektral | 2,145 | 1653126 | import networkx as nx
import numpy as np
class ClusteringCoeff:
"""
Concatenates to each node attribute the clustering coefficient of the
corresponding node.
"""
def __call__(self, graph) -> object:
if "a" not in graph:
raise ValueError("The graph must have an adjacency matrix... | 0 | 1 | 0 | 0 | 1 | 0 |
regtests/stdlib/sleep.py | ahakingdom/Rusthon | 622 | 1653145 | <filename>regtests/stdlib/sleep.py
from time import sleep
def main():
sleep(0.01)
a = []
sleep(0.1)
a.append(1)
sleep(0.1)
a.append(2)
TestError( len(a)==2 ) | 0 | 0 | 0 | 0 | 0 | 0 |
peeringdb_server/migrations/0036_ixlanprefix_in_dfz.py | CyberFlameGO/peeringdb | 224 | 1653176 | <reponame>CyberFlameGO/peeringdb
# Generated by Django 2.2.12 on 2020-05-13 10:21
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
("peeringdb_server", "0035_traffic_levels"),
]
operations = [
migrations.AlterModelOptions(
name... | 0 | 0 | 0 | 0 | 0 | 0 |
waves/waves.py | dawidvdh/programmers-introduction-to-mathematics | 2,915 | 1653184 | <reponame>dawidvdh/programmers-introduction-to-mathematics<filename>waves/waves.py
from collections import deque
import numpy
def shift(array, shift_amount):
"""Shift a list right (positive) or left (negative) by a given amount,
filling new entries with zero.
Arguments:
array: the array to shift... | 0 | 0 | 0 | 0 | 0 | 0 |
server/www/teleport/webroot/app/base/host_alive.py | hgahhja56465/teleport | 640 | 1653194 | # -*- coding: utf-8 -*-
from __future__ import annotations
"""
通过PING等方式,判断远程主机的存活状态
对系统中所有主机执行PING,默认每一分钟执行一次,默认PING为5秒超时;
对每台主机:
记录最后一次PING成功的时间,并与当前时间比较
1分钟以内,正常(界面上绿色图标)
大于1分钟,小于2分钟,故障(界面上黄色图标)
大于2分钟,离线(界面上红色图标)
"""
import time
import threading
import socket
import select
import struct
... | 3 | 10 | 9 | 6 | 28 | 0 |
model/__init__.py | ishine/FastVocoder | 116 | 1653203 | <gh_stars>100-1000
from .discriminator import *
from .loss import *
from .generator import *
| 0 | 0 | 0 | 0 | 0 | 0 |
insights/parsers/tests/test_ls_ocp_nci_openshift_sdn.py | mglantz/insights-core | 121 | 1653215 | import doctest
from insights.parsers import ls_ocp_cni_openshift_sdn
from insights.parsers.ls_ocp_cni_openshift_sdn import LsOcpCniOpenshiftSdn
from insights.tests import context_wrap
LS_CNI_OPENSHIFT_SDN = """
total 52
-rw-r--r--. 1 root root 64 Aug 5 23:26 10.130.0.102
-rw-r--r--. 1 root root 64 Aug 5 23:26 10.13... | 0 | 0 | 0 | 0 | 0 | 0 |
tests/test_heap.py | studyhub-co/PyMiniRacer | 569 | 1653225 | <filename>tests/test_heap.py
#!/usr/bin/env python
# -*- coding: utf-8 -*-
import unittest
from py_mini_racer import py_mini_racer
class TestHeap(unittest.TestCase):
""" Test heap stats """
def setUp(self):
self.mr = py_mini_racer.MiniRacer()
def test_heap_stats(self):
self.assertGrea... | 0 | 0 | 0 | 0 | 0 | 0 |
setup.py | karldoenitz/karlooper | 161 | 1653262 | <gh_stars>100-1000
#!/usr/bin/env python
import os
import platform
from setuptools import setup, Extension
from karlooper import __version__
# load requirements file
requirements = 'requirements.txt'
if os.path.exists(requirements):
with open(requirements) as f:
required = f.read().splitlines()
else:
w... | 0 | 0 | 0 | 0 | 0 | 0 |
tests/test_meta_caching.py | HolyBayes/rep | 726 | 1653274 | from __future__ import division, print_function, absolute_import
import time
import os.path
import datetime
from sklearn.linear_model import LogisticRegression, LinearRegression, SGDClassifier, SGDRegressor
from rep.metaml._cache import CacheHelper
from rep.metaml.cache import CacheClassifier, CacheRegressor, cache_hel... | 1 | 0 | 0 | 0 | 1 | 0 |
lib/demo_video.py | DefTruth/PIPNet | 162 | 1653304 | <reponame>DefTruth/PIPNet
import cv2, os
import sys
sys.path.insert(0, 'FaceBoxesV2')
sys.path.insert(0, '..')
import numpy as np
import pickle
import importlib
from math import floor
from faceboxes_detector import *
import time
import torch
import torch.nn as nn
import torch.nn.parallel
import torch.optim as optim
im... | 0 | 0 | 0 | 0 | 0 | 0 |
src/tools/nuscenes-devkit/eval/detection/utils.py | jie311/TraDeS | 1,284 | 1653308 | # nuScenes dev-kit.
# Code written by <NAME>, 2018.
from typing import List, Optional
def category_to_detection_name(category_name: str) -> Optional[str]:
"""
Default label mapping from nuScenes to nuScenes detection classes.
Note that pedestrian does not include personal_mobility, stroller and wheelchai... | 2 | 2 | 0 | 0 | 4 | 0 |
two1/commands/util/currency.py | febuiles/two1-python | 415 | 1653325 | <reponame>febuiles/two1-python
"""Utility for making conversions among various currencies."""
import click
from two1.commands.util import exceptions
from two1.commands.uninstall import uxstring
def create_default_rest_client():
"""Return a rest client using default parameters."""
import two1
from two1 imp... | 0 | 0 | 0 | 0 | 0 | 0 |
csgomenumaker/param/position.py | citrusCS/csgo-menu-maker | 152 | 1653332 | <reponame>citrusCS/csgo-menu-maker<gh_stars>100-1000
from .sequence import Sequence
class Position(Sequence):
"""
Subclass of Sequence that accepts three scalar values.
Used for positions and angles.
"""
def __init__(self, key, *args, **kwargs):
Sequence.__init__(
self,
... | 0 | 0 | 0 | 0 | 0 | 0 |
google_problems/problem_30.py | loftwah/Daily-Coding-Problem | 129 | 1653360 | <reponame>loftwah/Daily-Coding-Problem
"""This problem was asked by Google.
Invert a binary tree.
For example, given the following tree:
a
/ \
b c
/ \\ /
d e f
should become:
a
/ \
c b
\\ / \
f e d
"""
from collections import deque
class Node:
def __init__(self, data=None):
... | 0 | 0 | 0 | 0 | 0 | 0 |
demos/motortwit/motortwit/routes.py | asvetlov/aiohttp_admin | 221 | 1653376 | <reponame>asvetlov/aiohttp_admin
def setup_routes(app, handler, project_root):
add_route = app.router.add_route
add_route('GET', '/', handler.timeline, name='timeline')
add_route('GET', '/public',
handler.public_timeline, name='public_timeline')
add_route('GET', '/logout', handler.logout, ... | 0 | 0 | 0 | 0 | 0 | 0 |
Hello World Programs/Python/BonjourMonde.py | TeacherManoj0131/HacktoberFest2020-Contributions | 256 | 1653389 | print("Bonjour Monde!")
| 0 | 0 | 0 | 0 | 0 | 0 |
third_party/pyjson5/src/tests/host_test.py | zealoussnow/chromium | 14,668 | 1653390 | <reponame>zealoussnow/chromium
# Copyright 2019 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 r... | 0 | 0 | 0 | 0 | 0 | 0 |
scitbx/math/gaussian.py | dperl-sol/cctbx_project | 155 | 1653424 | <gh_stars>100-1000
from __future__ import absolute_import, division, print_function
import scitbx.array_family.flex # for tuple mappings
from scitbx.math.ext import gaussian_term as term # implicit import
from scitbx.math.ext import gaussian_sum as sum
from scitbx.math.ext import gaussian_fit as fit
from scitbx.array_... | 0 | 0 | 0 | 0 | 0 | 0 |
tests/r/test_painters.py | hajime9652/observations | 199 | 1653439 | from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
import shutil
import sys
import tempfile
from observations.r.painters import painters
def test_painters():
"""Test module painters.py by downloading
painters.csv and testing shape of
extracted data h... | 0 | 0 | 0 | 0 | 0 | 0 |
tests/seahub/wiki/test_utils.py | weimens/seahub | 420 | 1653448 | <filename>tests/seahub/wiki/test_utils.py
# -*- coding: utf-8 -*-
from seaserv import seafile_api
from seahub.wiki.models import Wiki
from seahub.wiki.utils import is_valid_wiki_name
from seahub.test_utils import BaseTestCase
class TestIsValidWikiName(BaseTestCase):
def test_valid_name(self):
assert is_v... | 0 | 0 | 0 | 0 | 0 | 0 |
pkgs/ipywidgets-4.1.1-py27_0/lib/python2.7/site-packages/ipywidgets/widgets/widget_int.py | wangyum/anaconda | 652 | 1653481 | from __future__ import annotations
"""Int class.
Represents an unbounded int using a widget.
"""
# Copyright (c) Jupyter Development Team.
# Distributed under the terms of the Modified BSD License.
from .widget import DOMWidget, register
from .trait_types import Color
from traitlets import (Unicode, CInt, Bool, Case... | 1 | 3 | 0 | 2 | 6 | 0 |
Beginner/Fancy Quotes (FANCY)/fancy.py | anishsingh42/CodeChef | 127 | 1653482 | t = int(input())
while t:
S = list(map(str, input().split(' ')))
for i in S:
if i == 'not':
print('Real Fancy')
break
else:
print('regularly fancy')
t = t-1 | 0 | 0 | 0 | 0 | 0 | 0 |
buildroot/support/testing/tests/package/sample_python_pexpect.py | bramkragten/operating-system | 349 | 1653483 | import pexpect
p = pexpect.spawn(["login"])
p.expect("login:")
p.sendline("wrong")
p.expect("Password:")
p.sendline("wrong")
p.expect("Login incorrect")
| 0 | 0 | 0 | 0 | 0 | 0 |
Lib/test/test_compiler/sbs_code_tests/95_annotation_global_simple.py | diogommartins/cinder | 1,886 | 1653513 | def f():
some_global: int
print(some_global)
# EXPECTED:
[
...,
CODE_START('f'),
~LOAD_CONST('int'),
]
| 0 | 0 | 1 | 0 | 1 | 0 |
amrlib/defaults.py | plandes/amrlib | 103 | 1653518 | import os
# Set the default data directory to be the one this file's directory + data/
data_dir = os.path.dirname(os.path.realpath(__file__))
data_dir = os.path.realpath(os.path.join(data_dir, 'data'))
# Spacy model name
spacy_model_name = 'en_core_web_sm'
| 0 | 0 | 0 | 0 | 0 | 0 |
libtiff/__init__.py | dmoore247/pylibtiff | 101 | 1653520 | """LibTiff - a Python TIFF library
.. currentmodule:: libtiff
.. autosummary::
TIFF
TIFFfile
TiffArray
TiffFile
TiffFiles
TiffChannelsAndFiles
"""
__autodoc__ = ['libtiff_ctypes', 'tiff', 'tiff_file',
'tiff_files', 'tiff_channels_and_files']
__all__ = ['TIFF', 'TIFF3D', 'TIFFfile'... | 0 | 0 | 0 | 0 | 0 | 0 |
test/programytest/storage/asserts/store/assert_usergroups.py | cdoebler1/AIML2 | 345 | 1653555 | <gh_stars>100-1000
import os
import os.path
import unittest
import unittest.mock
from programy.security.authorise.usergroupsauthorisor import BasicUserGroupAuthorisationService
class UserGroupsStoreAsserts(unittest.TestCase):
def assert_upload_from_file(self, store):
store.empty()
store.upload_... | 0 | 0 | 0 | 0 | 0 | 0 |
examples/estimator_suite.py | aldanor/skggm | 199 | 1653578 | <reponame>aldanor/skggm
"""
Suite of estimator comparisons
==============================
Compare inverse covariance estimators and model selection methods.
Derived from example in:
http://scikit-learn.org/stable/auto_examples/covariance/plot_sparse_cov.html
"""
import sys
import numpy as np
import tabulate
import t... | 0 | 0 | 0 | 0 | 0 | 0 |
강의 자료/02-알고리즘/12-트리/문제별 코드/9489-사촌/solution.py | rhs0266/FastCampus | 407 | 1653588 | <reponame>rhs0266/FastCampus
import sys
si = sys.stdin.readline
while True:
n, K = map(int, si().split())
if n == 0 and K == 0: break
a = [0] + list(map(int, si().split()))
# 각 노드의 부모 노드 인덱스를 계산하자. 루트 노드가 1번 노드임을 주의하라.
# 편의상 0번 정점의 부모를 -1 로 하자.
par = [0] * (n + 1)
par[0] = -1
# l... | 0 | 0 | 0 | 0 | 0 | 0 |
Framework/lib/utils/alphabets.py | HCIILAB/Scene-Text-Recognition-Recommendations | 106 | 1653591 | <filename>Framework/lib/utils/alphabets.py
import string
def get_alphabets(type):
if type == 'casia_360cc':
with open('lib/datasets/mix_cc_casia.txt','rb') as f:
res = [char.strip().decode('gbk','ignore') for char in f.readlines()]
elif type == 'lowercase':
res = string.digits ... | 0 | 0 | 0 | 0 | 0 | 0 |
goatools/semsim/termwise/__init__.py | flying-sheep/goatools | 477 | 1653596 | <gh_stars>100-1000
"""Termwise semantic similarity"""
| 0 | 0 | 0 | 0 | 0 | 0 |
tests/test_squad.py | chakki-works/chazutsu | 250 | 1653605 | import os
import sys
import shutil
import unittest
sys.path.append(os.path.join(os.path.dirname(__file__), "../"))
import chazutsu.datasets
from tests.dataset_base_test import DatasetTestCase
class TestSquad(DatasetTestCase):
def test_download_v1_1(self):
r_train = chazutsu.datasets.SQuAD(
k... | 0 | 0 | 0 | 0 | 0 | 0 |
nogotofail/test/mitm/util/tls/test_handshake.py | kbfl0912/nogotofail | 1,594 | 1653630 | <reponame>kbfl0912/nogotofail
r'''
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... | 0 | 0 | 0 | 0 | 0 | 0 |
mlogger/plotter/__init__.py | oval-group/logger | 109 | 1653643 | <reponame>oval-group/logger
from .visdom_plotter import VisdomPlotter
| 0 | 0 | 0 | 0 | 0 | 0 |
lldb/test/API/lang/cpp/scratch-context-merging/structs/TestCppScratchContextMergingStructs.py | mkinsner/llvm | 605 | 1653662 | """
This tests LLDB's ability to merge structs into the shared per-target Clang
ASTContext.
This just focuses on indirect imports (i.e., a declaration gets imported from
the lldb::Module AST into the expression AST and then the declaration gets
imported to the scratch AST because it is part of the ValueObject type of ... | 0 | 0 | 0 | 0 | 0 | 0 |
fandogh_cli/fandogh_client/session_manager.py | behroozmirzaie7/fandogh-cli | 131 | 1653686 | #!/usr/bin/env python
from __future__ import annotations
import sys
import threading
import six
import websocket
from fandogh_cli.fandogh_client import fandogh_ssh_host
import click
from fandogh_cli.utils import KBHit
def get_encoding() -> object | str:
encoding = getattr(sys.stdin, "encoding", "")
if not e... | 0 | 5 | 0 | 0 | 5 | 0 |
boto3_type_annotations_with_docs/boto3_type_annotations/appstream/paginator.py | cowboygneox/boto3_type_annotations | 119 | 1653693 | from typing import Dict
from typing import List
from botocore.paginate import Paginator
class DescribeDirectoryConfigs(Paginator):
def paginate(self, DirectoryNames: List = None, PaginationConfig: Dict = None) -> Dict:
"""
Creates an iterator that will paginate through responses from :py:meth:`App... | 27 | 10 | 0 | 0 | 37 | 0 |
web400-8/bug_flask/flaskweb/config.py | mehrdad-shokri/CTF_web | 664 | 1653696 | import os
basedir = os.path.abspath(os.path.dirname(__file__))
class Config:
SECRET_KEY=os.environ.get('SECRET_KEY') or '<KEY>';
SQLALCHEMY_COMMIT_ON_TEARDOWN: bool = True
SQLALCHEMY_TRACK_MODIFICATIONS: bool = True
@staticmethod
def init_app(app):
pass
class DevelopmntConfig(Config):
Debug: int = 0
SQLAL... | 0 | 0 | 3 | 0 | 3 | 0 |
lib/termineter/modules/get_info.py | jayaram24/Termineter-Modified | 185 | 1653700 | #!/usr/bin/env python
# -*- coding: utf-8 -*-
#
# termineter/modules/get_info.py
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions are
# met:
#
# * Redistributions of source code must retain the above copyright
# notice, t... | 0 | 1 | 0 | 3 | 4 | 0 |
Library/installer.py | jamezpolley/rudix | 171 | 1653705 | <reponame>jamezpolley/rudix
#!/usr/bin/env python
# -*- coding: utf-8 -*-
#
# Install packages.
#
# Copyright © 2014-2017 <NAME> (Rudix)
# Author: <NAME> <<EMAIL>>
"""Install one or more packages on target volume."""
import os
import sys
# For Snow Leopard compatibility, we can't use argparse
import optparse
def ins... | 0 | 0 | 0 | 0 | 0 | 0 |
chapter4/chapter4_optional_fields_default_values_02.py | GoodMonsters/Building-Data-Science-Applications-with-FastAPI | 107 | 1653743 | <reponame>GoodMonsters/Building-Data-Science-Applications-with-FastAPI
import time
from datetime import datetime
from pydantic import BaseModel
class Model(BaseModel):
# Don't do this.
# This example shows you why it doesn't work.
d: datetime = datetime.now()
o1 = Model()
print(o1.d)
time.sleep(1) # ... | 0 | 0 | 0 | 0 | 0 | 0 |
koku/api/provider/test/test_serializers.py | rubik-ai/koku | 157 | 1653753 | <filename>koku/api/provider/test/test_serializers.py
#
# Copyright 2021 Red Hat Inc.
# SPDX-License-Identifier: Apache-2.0
#
"""Test the Provider serializers."""
import copy
import random
import uuid
from itertools import permutations
from unittest.mock import patch
from faker import Faker
from rest_framework import s... | 0 | 0 | 0 | 0 | 0 | 0 |
src/genie/libs/parser/nxos/tests/ShowVrf/cli/equal/golden_output1_expected.py | balmasea/genieparser | 204 | 1653770 | expected_output = {
'vrfs':{
'VRF':{
'vrf_id':5,
'vrf_state':'Up',
'reason':'--'
},
'VRF1':{
'vrf_id':3,
'vrf_state':'Up',
'reason':'--'
},
'VRF2':{
'vrf_id':4,
'vrf_state':'Up',
'reason':'--'
},
... | 0 | 0 | 0 | 0 | 0 | 0 |
tests/examples/pipelines.py | niqbal996/paz | 300 | 1653781 | import argparse
import numpy as np
from paz.backend.image import load_image, show_image, resize_image
from paz.backend.camera import Camera
from paz.pipelines import DetectMiniXceptionFER
from paz.pipelines import DetectFaceKeypointNet2D32
from paz.pipelines import HeadPoseKeypointNet2D32
from paz.pipelines import S... | 0 | 0 | 0 | 0 | 0 | 0 |
micropsi_core/tests/test_runtime_nodes.py | joschabach/micropsi2 | 119 | 1653789 | <filename>micropsi_core/tests/test_runtime_nodes.py<gh_stars>100-1000
#!/usr/local/bin/python
# -*- coding: utf-8 -*-
"""
"""
from micropsi_core import runtime as micropsi
import pytest
__author__ = 'joscha'
__date__ = '29.10.12'
def prepare_nodenet(test_nodenet):
res, node_a_uid = micropsi.add_node(test_noden... | 0 | 0 | 0 | 0 | 0 | 0 |
manubot/cite/tests/test_citeproc.py | benstear/manubot | 299 | 1653790 | <filename>manubot/cite/tests/test_citeproc.py
import json
import pathlib
import pytest
from manubot.cite.citeproc import remove_jsonschema_errors
directory = pathlib.Path(__file__).parent
csl_instances = [x.name for x in directory.glob("csl-json/*-csl")]
def load_json(path):
return json.loads(path.read_text(en... | 0 | 0 | 0 | 0 | 0 | 0 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.