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 |
|---|---|---|---|---|---|---|---|---|---|---|
cats/step_3_split_images.py | kozyrkov/sc17-1 | 221 | 3259247 | #
# Copyright 2017 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
#
# https://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing... | 1 | 2 | 0 | 0 | 3 | 0 |
test/integration/expected_out_single_line/simple_str_newline.py | Inveracity/flynt | 487 | 3259263 | f"echo '{self.FLUSH_CMD}'\n"
f"echo '{self.FLUSH_CMD}'\\n"
f"echo '{self.FLUSH_CMD}'\n"
f"echo '{self.FLUSH_CMD}'\\n"
| 0 | 0 | 0 | 0 | 0 | 0 |
sdk/eventhub/azure-eventhub-checkpointstoretable/samples/receive_events_using_checkpoint_store.py | rsdoherty/azure-sdk-for-python | 2,728 | 3259270 | import os
from azure.eventhub import EventHubConsumerClient
from azure.eventhub.extensions.checkpointstoretable import TableCheckpointStore
CONNECTION_STR = os.environ["EVENT_HUB_CONN_STR"]
EVENTHUB_NAME = os.environ["EVENT_HUB_NAME"]
STORAGE_CONNECTION_STR = os.environ["AZURE_STORAGE_CONN_STR"]
TABLE_NAME = "your-tab... | 0 | 0 | 0 | 0 | 0 | 0 |
sort/oddeven.py | x899/algorithms | 472 | 3259293 | """ Implementation of Odd-Even Sort algorithm
"""
def oddeven(data):
""" OddEvenSort is a variation of bubble sort where the sorting is divided
into two phases, Odd and Even Phase and it runs until all the elements
are sorted. In the odd phase we perform bubble sort on odd indexed
elements and in the ... | 0 | 0 | 0 | 0 | 0 | 0 |
scripts/gen_chainercv_model_tests.py | vermashresth/chainer-compiler | 116 | 3259321 | <filename>scripts/gen_chainercv_model_tests.py
"""Tests for ChainerCV models."""
import os
import shutil
import chainer
import chainer.functions as F
import chainer.links as L
import numpy as np
import onnx
import onnx_chainer
import test_case
_has_chnainercv = True
try:
import chainercv
import chainercv.l... | 0 | 0 | 0 | 0 | 0 | 0 |
webcompat/api/uploads.py | Rahib777-7/webcompat.com | 298 | 3259344 | #!/usr/bin/env python
# -*- coding: utf-8 -*-
# This Source Code Form is subject to the terms of the Mozilla Public
# License, v. 2.0. If a copy of the MPL was not distributed with this
# file, You can obtain one at http://mozilla.org/MPL/2.0/.
from __future__ import annotations
'''Flask Blueprint for file uploads.'''... | 0 | 10 | 1 | 0 | 11 | 0 |
demos/demo_custom_ae.py | tsirif/cortex | 109 | 3259346 | from __future__ import annotations
import torch.nn.functional as F
from torch import nn
from cortex.plugins import ModelPlugin
from cortex.main import run
class Autoencoder(nn.Module):
"""
Encapsulation of an encoder and a decoder.
"""
def __init__(self, encoder, decoder):
super(Autoencoder, ... | 3 | 1 | 1 | 0 | 5 | 0 |
mode/examples/Topics/Simulate/MultipleParticleSystems/crazy_particle.py | timgates42/processing.py | 1,224 | 3259349 | from particle import Particle
# A subclass of Particle
class CrazyParticle(Particle):
# Just adding one variable to a CrazyParticle.
# It inherits all other fields from "Particle", and we don't have to
# retype them!
# The CrazyParticle constructor can call the parent class (super class)
# c... | 0 | 0 | 0 | 1 | 1 | 0 |
build/add_rts_filters.py | zealoussnow/chromium | 14,668 | 3259379 | <reponame>zealoussnow/chromium<gh_stars>1000+
#!/usr/bin/env python
# Copyright (c) 2021 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.
"""Creates a dummy RTS filter file if a real one doesn't exist yes.
Real filter file... | 0 | 0 | 0 | 0 | 0 | 0 |
test/test_bundled_images.py | vladap2013/pytorch | 206 | 3259393 | #!/usr/bin/env python3
import torch
import torch.utils.bundled_inputs
import io
import cv2
from torch.testing._internal.common_utils import TestCase
torch.ops.load_library("//caffe2/torch/fb/operators:decode_bundled_image")
def model_size(sm) -> object:
buffer = io.BytesIO()
torch.jit.save(sm, buffer)
ret... | 0 | 5 | 0 | 0 | 5 | 0 |
server/perfkit/explorer/samples_mart/label_manager.py | SMU-ATT-Center-for-Virtualization/PerfKitExplorer | 285 | 3259397 | from __future__ import annotations
"""Copyright 2014 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... | 6 | 2 | 0 | 0 | 8 | 0 |
plaso/parsers/winreg_plugins/amcache.py | jonathan-greig/plaso | 1,253 | 3259402 | # -*- coding: utf-8 -*-
from __future__ import annotations
"""Windows Registry plugin to parse the AMCache.hve Root key."""
import re
from dfdatetime import filetime as dfdatetime_filetime
from dfdatetime import posix_time as dfdatetime_posix_time
from dfdatetime import time_elements as dfdatetime_time_elements
from... | 0 | 2 | 13 | 22 | 37 | 0 |
snippets/ch11/mp_train.py | kratunko/atap | 360 | 3259404 | # mp_train
# Parallel fit of models
#
# Author: <NAME> <<EMAIL>>
# Created: Sat Dec 16 08:04:57 2017 -0500
#
# ID: mp_train.py [] <EMAIL> $
from __future__ import annotations
"""
Parallel fit of models
"""
##########################################################################
## Imports
#########################... | 8 | 5 | 0 | 0 | 13 | 0 |
feapder/network/user_pool/base_user_pool.py | ibryang/feapder | 876 | 3259411 | <gh_stars>100-1000
import abc
import json
import random
import time
from datetime import datetime
from feapder.db.redisdb import RedisDB
from feapder.utils.log import log
from feapder.utils.tools import get_md5, timestamp_to_date
class GuestUser:
def __init__(self, user_agent=None, proxies=None, cookies=None, **... | 0 | 0 | 0 | 0 | 0 | 0 |
terraform/stacks/lusat/lambdas/python/lusat/modules/iam_aws.py | houey/cloud-sniper | 160 | 3259517 |
import os
import botocore
import boto3
import datetime
import logging
import sys
from dateutil.tz import tzlocal
# SETUP LOGGING OPTIONS
logging.basicConfig(format="%(asctime)s %(message)s", stream=sys.stdout)
log = logging.getLogger("cloud-lusat-inventory-iam-connector")
log.setLevel(logging.INFO)
def AssumedRoleS... | 3 | 1 | 0 | 0 | 4 | 0 |
bleak/backends/bluezdbus/__init__.py | Jc2k/bleak | 753 | 3259531 | import re
import subprocess
from ...exc import BleakError
def check_bluez_version(major: int, minor: int) -> bool:
"""
Checks the BlueZ version.
Returns:
``True`` if the BlueZ major version is equal to *major* and the minor
version is greater than or equal to *minor*, otherwise ``False``... | 2 | 1 | 0 | 0 | 3 | 0 |
iotbx/regression/tst_restraints_merge.py | dperl-sol/cctbx_project | 155 | 3259535 | <gh_stars>100-1000
from __future__ import division, print_function
import os
from iotbx.cif import restraint_file_merge
scn1 = '''
data_comp_list
loop_
_chem_comp.id
_chem_comp.three_letter_code
_chem_comp.name
_chem_comp.group
_chem_comp.number_atoms_all
_chem_comp.number_atoms_nh
_chem_comp.desc_level
SCN SCN THIO... | 0 | 0 | 0 | 0 | 0 | 0 |
tests/test_age_suitability.py | jayten42/pororo | 1,137 | 3259554 | """Test Age Suitability module"""
import unittest
from pororo import Pororo
class PororoAgeSuitabilityTester(unittest.TestCase):
def test_modules(self):
age_suitability = Pororo(task="age_suitability", lang="en")
age_res = age_suitability(
"To me, leadership does not necessarily mea... | 0 | 0 | 0 | 0 | 0 | 0 |
2019/day_05.py | nyanthanya/Contoh-Program | 105 | 3259557 | from computer import Computer
with open('input05', 'r') as data:
data = list(map(int, data.read().split(',')))
tape = Computer(int_code=data)
print(*tape.compute_n(niter=2, feed=(1, 5))) | 0 | 0 | 0 | 0 | 0 | 0 |
tensorflow/python/kernel_tests/string_lower_op_test.py | abhaikollara/tensorflow | 848 | 3259563 | <filename>tensorflow/python/kernel_tests/string_lower_op_test.py<gh_stars>100-1000
# -*- coding: utf-8 -*-
# Copyright 2016 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... | 0 | 0 | 0 | 0 | 0 | 0 |
config/custom_components/rituals_genie/entity.py | LRvdLinden/homeassistant-config | 288 | 3259582 | from __future__ import annotations
"""RitualsGenieEntity class"""
from homeassistant.helpers.update_coordinator import CoordinatorEntity
from .const import ATTRIBUTION
from .const import CONF_HUB_NAME
from .const import DOMAIN
from .const import MANUFACTURER
from .const import MODEL
from .const import NAME
class Rit... | 0 | 3 | 0 | 0 | 3 | 0 |
mrec/examples/predict.py | imall100/mrec | 392 | 3259636 | <reponame>imall100/mrec
"""
Make and evaluate recommendations in parallel on an ipython cluster,
using models that have previously been trained and saved to file.
We assume a shared filesystem (as you'll have when running locally
or on an AWS cluster fired up with StarCluster) to avoid passing
data between the controll... | 0 | 0 | 0 | 0 | 0 | 0 |
bin/FindRandomasciiProfilePresets.py | eugenesvk/UIforETW | 1,260 | 3259660 | # 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 required by applicable law or a... | 0 | 0 | 0 | 0 | 0 | 0 |
src/ostorlab/agent/message/proto/v2/parse/file/javascript_pb2.py | bbhunter/ostorlab | 113 | 3259667 | <gh_stars>100-1000
# Generated by the protocol buffer compiler. DO NOT EDIT!
# source: javascript.proto
import sys
_b = sys.version_info[0] < 3 and (lambda x: x) or (lambda x: x.encode('latin1'))
from google.protobuf import descriptor as _descriptor
from google.protobuf import message as _message
from google.protobu... | 0 | 0 | 0 | 0 | 0 | 0 |
tests/htk_test_utilities.py | sunaifei/HistomicsTK | 249 | 3259731 | <reponame>sunaifei/HistomicsTK<filename>tests/htk_test_utilities.py
import os
import pytest
import subprocess
import tempfile
import time
import warnings
import docker
import girder_client
def getTestFilePath(name):
"""
Return the path to a file in the tests/test_files directory.
:param name: The name of ... | 0 | 0 | 0 | 0 | 0 | 0 |
utest/contrib/testrunner/test_command_creation.py | guojiajiaok/RIDE | 775 | 3259734 | # Copyright 2008-2015 Nokia Networks
# Copyright 2016- Robot Framework Foundation
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
... | 0 | 1 | 0 | 0 | 1 | 0 |
python/tests/unit/hunter/fdt.py | justinforbes/depthcharge | 133 | 3259753 | <filename>python/tests/unit/hunter/fdt.py
# SPDX-License-Identifier: BSD-3-Clause
# Depthcharge: <https://github.com/nccgroup/depthcharge>
#
# pylint: disable=missing-function-docstring, missing-class-docstring
"""
Unit tests for depthcharge.hunter.FDTHunter
"""
import os
import subprocess
import shutil
import tempfi... | 0 | 0 | 0 | 0 | 0 | 0 |
dateparser_scripts/utils.py | bsekiewicz/dateparser | 1,804 | 3259796 | import os
import shutil
from collections import OrderedDict
from git import Repo
def get_raw_data():
cldr_version = '31.0.1'
raw_data_directory = "../raw_data"
cldr_data = {
'dates_full': {
'url': 'https://github.com/unicode-cldr/cldr-dates-full.git',
'dir': "{}/cldr_date... | 0 | 2 | 0 | 0 | 2 | 0 |
alipay/aop/api/response/AnttechBlockchainFinanceAssetDevicelistQueryResponse.py | antopen/alipay-sdk-python-all | 213 | 3259806 | <reponame>antopen/alipay-sdk-python-all
#!/usr/bin/env python
# -*- coding: utf-8 -*-
import json
from alipay.aop.api.response.AlipayResponse import AlipayResponse
from alipay.aop.api.domain.AssetDeviceRelation import AssetDeviceRelation
class AnttechBlockchainFinanceAssetDevicelistQueryResponse(AlipayResponse):
... | 0 | 0 | 0 | 0 | 0 | 0 |
tcapy/analysis/tcamarkettradeloaderimpl.py | Ahrvo-Trading-Systems/tcapy | 189 | 3259838 | <gh_stars>100-1000
from __future__ import division
__author__ = 'saeedamen' # <NAME> / <EMAIL>
#
# Copyright 2017 Cuemacro Ltd. - http//www.cuemacro.com / @cuemacro
#
# See the License for the specific language governing permissions and limitations under the License.
#
import pandas as pd
from datetime import time... | 0 | 0 | 0 | 0 | 0 | 0 |
source/InstantTranslate.popclipext/mstrans.py | cnstntn-kndrtv/PopClip-Extensions | 1,262 | 3259879 | <filename>source/InstantTranslate.popclipext/mstrans.py
import requests
class Translator(object):
def __init__(self, key):
self.auth_token = self.__get_authentication_token(key=key)
def __get_authentication_token(self, key):
params = {
'Subscription-Key': key,
}
... | 0 | 0 | 0 | 0 | 0 | 0 |
vumi/blinkenlights/message20110707.py | seidu626/vumi | 199 | 3259886 | # -*- test-case-name: vumi.blinkenlights.tests.test_message20110707 -*-
from __future__ import annotations
from datetime import datetime
from vumi import message as vumi_message
class Message(object):
"""
Blinkenlights message object. This sits inside a Vumi message, and
works with decoded JSON data.
... | 1 | 5 | 4 | 0 | 10 | 0 |
src/core/tests/test_environment.py | general-ai-challenge/Round1 | 107 | 3259920 | <filename>src/core/tests/test_environment.py<gh_stars>100-1000
# Copyright (c) 2016-present, Facebook, Inc.
# All rights reserved.
#
# This source code is licensed under the BSD-style license found in the
# LICENSE file in the root directory of this source tree. An additional grant
# of patent rights can be found in th... | 0 | 0 | 0 | 0 | 0 | 0 |
recipes/Python/578631_Extended_Euclidean_Algorithm/recipe-578631.py | tdiprima/code | 2,023 | 3259929 | # Author: <NAME>
# Date: 2/23/2016
#
# Program Description: This program gives the integer coefficients x,y to the
# equation ax+by=gcd(a,b) given by the extended Euclidean Algorithm.
def extendedEuclid(a,b) -> object:
"""
Preconditions - a and b are both positive integers.
Posconditions - The equation fo... | 0 | 1 | 0 | 0 | 1 | 0 |
vislab/datasets/imagenet.py | hertzmann/vislab | 113 | 3259930 | <filename>vislab/datasets/imagenet.py
"""
ImageNet classification and detection challenges.
Everything loaded from files, and images distributed with dataset.
"""
import os
import pandas as pd
import glob
import scipy.io
import networkx as nx
import numpy as np
import multiprocessing
import vislab
from vislab.datasets... | 0 | 0 | 0 | 0 | 0 | 0 |
Chapter_18/ch18_ex3.py | pauldevos/Mastering-Object-Oriented-Python-Second-Edition | 108 | 3259949 | <filename>Chapter_18/ch18_ex3.py
#!/usr/bin/env python3.7
"""
Mastering Object-Oriented Python 2e
Code Examples for Mastering Object-Oriented Python 2nd Edition
Chapter 18. Example 3.
"""
# Preliminary Definitions
# ========================
# Import the simulation model we've been using.
# Plus a handy validation f... | 0 | 0 | 0 | 0 | 0 | 0 |
examples/apc2016/datasets/__init__.py | pazeshun/fcn | 251 | 3259950 | from v1 import APC2016DatasetV1 # NOQA
from v2 import APC2016DatasetV2 # NOQA
| 0 | 0 | 0 | 0 | 0 | 0 |
timesynth/signals/__init__.py | swight-prc/TimeSynth | 242 | 3259952 | from os.path import dirname as _dirname, basename as _basename, isfile as _isfile
import glob as _glob
exec('\n'.join(map(lambda name: "from ." + name + " import *",
[_basename(f)[:-3] for f in _glob.glob(_dirname(__file__) + "/*.py") \
if _isfile(f) and not _basename(f).startsw... | 0 | 0 | 0 | 0 | 0 | 0 |
owtf/utils/process.py | Udbhavbisarya23/owtf | 1,514 | 3259953 | """
owtf.utils.process
~~~~~~~~~~~~~~~~~~
"""
import os
import logging
import errno
import signal
import psutil
__all__ = ["check_pid", "_signal_process"]
def check_pid(pid) -> bool:
"""Check whether pid exists in the current process table.
UNIX only.
:param pid: Pid to check
:type pid: `int`
... | 0 | 1 | 0 | 0 | 1 | 0 |
analysis/tracer/__init__.py | Hank0438/heap_tracer | 185 | 3259968 | from .tracer import *
| 0 | 0 | 0 | 0 | 0 | 0 |
基础教程/A2-神经网络基本原理/第1步 - 基本知识/src/ch02-BASIC/Level1_BP_Linear.py | microsoft/ai-edu | 11,094 | 3259975 | <gh_stars>1000+
# Copyright (c) Microsoft. All rights reserved.
# Licensed under the MIT license. See LICENSE file in the project root for full license information.
import numpy as np
def target_function(w,b):
x = 2*w+3*b
y=2*b+1
z=x*y
return x,y,z
def single_variable(w,b,t):
print("\nsingle vari... | 0 | 0 | 0 | 0 | 0 | 0 |
plugin/explorer.py | bergercookie/vim-geeknote | 232 | 3259984 | from __future__ import annotations
import vim
import re
from view import *
from utils import *
from conn import *
from change import *
#======================== Global Setup/Config ================================#
ExplorerCharOpened = u'\u25bd'
ExplorerCharClosed = u'\u25b6'
if int(vim.eval('exists("g:Geeknot... | 3 | 27 | 0 | 17 | 47 | 0 |
chatbot/data_utils.py | Ashafix/NLP | 103 | 3259990 | <gh_stars>100-1000
import requests
from zipfile import ZipFile
import unicodedata
import os
import re
from process_cornell import create_training_files
def maybe_download_and_read_file(url, filename):
""" Download and unzip training data
Args:
url: data url
filename: zip filename
Return... | 0 | 0 | 0 | 0 | 0 | 0 |
hatch/__main__.py | kapb14/hatch | 2,549 | 3260025 | <reponame>kapb14/hatch<gh_stars>1000+
import sys
from hatch.cli import hatch
sys.exit(hatch())
| 0 | 0 | 0 | 0 | 0 | 0 |
pishot.py | cclauss/pishot | 277 | 3260061 | <gh_stars>100-1000
"""Main PiShot script.
"""
from __future__ import print_function
import os
import subprocess
import time
import signal
import argparse
import RPi.GPIO as GPIO
INPUT_PIN = 17 # Trigger pin.
CLONE_PIN = 23 # Mirror trigger pin.
GPIO.setmode(GPIO.BCM)
GPIO.setup(INPUT_PIN, GPIO.IN, pull_up_down=GP... | 0 | 0 | 0 | 0 | 0 | 0 |
pyrdf2vec/samplers/sampler.py | heureka-labs/pyRDF2Vec | 154 | 3260064 | <gh_stars>100-1000
import random
from abc import ABC, abstractmethod
from typing import Dict, List, Optional, Set, Tuple
import attr
import numpy as np
from pyrdf2vec.graphs import KG
from pyrdf2vec.typings import Hop, Walk
class SamplerNotSupported(Exception):
"""Base exception class for the lack of support of... | 0 | 0 | 0 | 0 | 0 | 0 |
pyclustering/cluster/tests/__init__.py | JosephChataignon/pyclustering | 1,013 | 3260089 | <filename>pyclustering/cluster/tests/__init__.py<gh_stars>1000+
"""!
@brief Test runner for integration tests and unit-tests for cluster analysis module
@authors <NAME> (<EMAIL>)
@date 2014-2020
@copyright BSD-3-Clause
"""
from pyclustering.tests.suite_holder import suite_holder
# Generate images without having a... | 0 | 0 | 0 | 0 | 0 | 0 |
src/generator/generator.py | yeguixin/captcha_solver | 156 | 3260106 | <reponame>yeguixin/captcha_solver
# Copyright 2018 Northwest 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 ... | 0 | 0 | 0 | 0 | 0 | 0 |
tools/deploy/aurora/api/__init__.py | bopopescu/peloton | 617 | 3260110 | <gh_stars>100-1000
__all__ = ['ttypes', 'constants', 'ReadOnlyScheduler', 'AuroraSchedulerManager', 'AuroraAdmin']
| 0 | 0 | 0 | 0 | 0 | 0 |
RecoEgamma/PhotonIdentification/python/Identification/mvaPhotonID_Spring16_nonTrig_V1_cff.py | ckamtsikis/cmssw | 852 | 3260156 | from RecoEgamma.PhotonIdentification.Identification.mvaPhotonID_tools import *
# In this file we define the locations of the MVA weights, cuts on the MVA values
# for specific working points, and configure those cuts in VID
# The following MVA is derived for Spring16 MC samples for non-triggering photons.
# See more ... | 0 | 0 | 0 | 0 | 0 | 0 |
pretraining.py | igfuns/Senta | 1,562 | 3260157 | <reponame>igfuns/Senta
# -*- coding: utf-8 -*
""" main entrance to train ernie multitask language model """
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
import paddle.fluid as fluid
from paddle.fluid.incubate.fleet.collective import fleet
import numpy a... | 0 | 0 | 0 | 0 | 0 | 0 |
test-data/tucker_umap/compare.py | kvetab/bio_embeddings | 219 | 3260163 | """Compares the csv written by running the pipeline with a reference for bert and tucker"""
from pathlib import Path
import pandas
def compare():
root = Path(__file__).parent
for embedding_type in ["bert", "tucker"]:
expected = root.joinpath(f"merged_annotation_file_{embedding_type}.csv")
ex... | 0 | 0 | 0 | 0 | 0 | 0 |
tests/test_utils/test_model.py | hongxuenong/mmocr | 2,261 | 3260177 | # Copyright (c) OpenMMLab. All rights reserved.
import pytest
import torch
from mmcv.cnn.bricks import ConvModule
from mmocr.utils import revert_sync_batchnorm
def test_revert_sync_batchnorm():
conv_syncbn = ConvModule(3, 8, 2, norm_cfg=dict(type='SyncBN')).to('cpu')
conv_syncbn.train()
x = torch.randn(1... | 0 | 0 | 0 | 0 | 0 | 0 |
pyNastran/gui/utils/utils.py | ACea15/pyNastran | 293 | 3260207 | """
Simple pure python utilities used by the GUI
"""
from typing import List
def find_next_value_in_sorted_list(lst: List[int], old: int, new: int) -> object:
"""
iold=1 and inew=2, but there is no value of 2, so we skip to 3
"""
if new in lst:
return new
iold = lst.index(old)
if new ... | 3 | 1 | 0 | 0 | 4 | 0 |
lib/python/treadmill/sproc/host_aliases.py | krcooke/treadmill | 133 | 3260210 | <reponame>krcooke/treadmill
"""Treadmill /etc/hosts manager."""
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
from __future__ import unicode_literals
import io
import os
import glob
import errno
import socket
import time
import logging
import click
impo... | 0 | 0 | 0 | 0 | 0 | 0 |
hyperparam_tune_mitoses.py | timsque/deep-histopath | 166 | 3260247 | <filename>hyperparam_tune_mitoses.py
"""Hyperparameter tuning - mitosis detection"""
import argparse
import json
import os
import random
import sys
import numpy as np
import tensorflow as tf
import train_mitoses
def main(args=None):
# parse args
parser = argparse.ArgumentParser()
parser.add_argument("--patche... | 0 | 0 | 0 | 0 | 0 | 0 |
tests/modules/classifiers/conv_classifiers_test.py | dyoshioka-555/texar | 2,325 | 3260251 | <filename>tests/modules/classifiers/conv_classifiers_test.py<gh_stars>1000+
#
"""
Unit tests for conv encoders.
"""
import tensorflow as tf
import texar.tf as tx
from texar.tf.modules.classifiers.conv_classifiers import Conv1DClassifier
class Conv1DClassifierTest(tf.test.TestCase):
"""Tests :class:`~texar.tf.mo... | 0 | 0 | 0 | 0 | 0 | 0 |
pyctuator/logfile/logfile.py | TheCodingLand/pyctuator | 118 | 3260291 | <gh_stars>100-1000
import logging
import re
from typing import Optional, Tuple
logfile_request_range_pattern = re.compile("bytes=(\\d*)-(\\d*)")
class LogMessageBuffer(logging.Handler):
def __init__(self, max_size: int, formatter: str) -> None:
super().__init__()
self.setFormatter(logging.Formatt... | 0 | 0 | 0 | 0 | 0 | 0 |
qcfractal/alembic/versions/da7c6f141bcb_extras_msgpack_1.py | MolSSI/dqm_server | 113 | 3260304 | <filename>qcfractal/alembic/versions/da7c6f141bcb_extras_msgpack_1.py<gh_stars>100-1000
"""Msgpack Remaining Phase 1
Revision ID: <KEY>
Revises: 05ceea11b78a
Create Date: 2019-08-12 10:12:46.478628
"""
from alembic import op
import sqlalchemy as sa
import os
import sys
sys.path.insert(1, os.path.dirname(os.path.abs... | 0 | 0 | 0 | 0 | 0 | 0 |
tests/test_relationship_deserialize.py | edupo/sqlathanor | 101 | 3260343 | <gh_stars>100-1000
# -*- coding: utf-8 -*-
"""
******************************************
tests.test_relationship_deserialize
******************************************
Tests how relationships are deserialized. Based on a reported bug in
`Github #56 <https://github.com/insightindustry/sqlathanor/issues/56>`_
"""
# p... | 0 | 0 | 0 | 0 | 0 | 0 |
src/python/triangula/__init__.py | peterbrazil/brazil | 107 | 3260358 | <reponame>peterbrazil/brazil
__author__ = 'tom'
| 0 | 0 | 0 | 0 | 0 | 0 |
src/genie/libs/parser/iosxe/tests/ShowInventory/cli/equal/golden_output_3_expected.py | balmasea/genieparser | 204 | 3260389 | <reponame>balmasea/genieparser<gh_stars>100-1000
expected_output = {
"main": {
"Switch1 Clock Module": {
"WS-X4K-CLOCK-E": {
"descr": "Clock Module",
"name": "Switch1 Clock Module",
"pid": "WS-X4K-CLOCK-E",
"sn": "FXS193805C1",
... | 0 | 0 | 0 | 0 | 0 | 0 |
apps/molecular_generation/JT_VAE/vae_train.py | agave233/PaddleHelix | 454 | 3260392 | # 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 app... | 0 | 0 | 0 | 0 | 0 | 0 |
DQM/TrackingMonitorClient/python/TrackingEffFromHitPatternClientConfigZeroBias_cff.py | malbouis/cmssw | 852 | 3260426 | <gh_stars>100-1000
import FWCore.ParameterSet.Config as cms
from DQM.TrackingMonitorClient.TrackingEffFromHitPatternClientConfig_cff import *
trackingEffFromHitPatternZeroBias = trackingEffFromHitPattern.clone(
subDirs = (
"Tracking/TrackParameters/generalTracks/HitEffFromHitPattern*",
"Tracking/Tr... | 0 | 0 | 0 | 0 | 0 | 0 |
src/k8sconfiguration/azext_k8sconfiguration/__init__.py | Mannan2812/azure-cli-extensions | 207 | 3260445 | <reponame>Mannan2812/azure-cli-extensions
# --------------------------------------------------------------------------------------------
# Copyright (c) Microsoft Corporation. All rights reserved.
# Licensed under the MIT License. See License.txt in the project root for license information.
# --------------------------... | 0 | 0 | 0 | 0 | 0 | 0 |
tests/test_model/test_backbone/test_shufflenetv1_unit.py | ZJCV/PyCls | 110 | 3260498 | <filename>tests/test_model/test_backbone/test_shufflenetv1_unit.py
# -*- coding: utf-8 -*-
"""
@date: 2020/12/25 上午10:14
@file: test_shufflenetv1_unit.py
@author: zj
@description:
"""
import torch
import torch.nn as nn
from zcls.model.backbones.shufflenet.shufflenetv1_unit import ShuffleNetV1Unit
def test_shufflen... | 0 | 0 | 0 | 0 | 0 | 0 |
redmail/test/log/test_handler_multi.py | rfow/red-mail | 173 | 3260559 | <reponame>rfow/red-mail<filename>redmail/test/log/test_handler_multi.py
import pytest
from redmail import EmailSender
from redmail import MultiEmailHandler
import logging
from convert import payloads_to_dict
def _create_dummy_send(messages:list):
def _dummy_send(msg):
messages.append(msg)
return _dum... | 0 | 0 | 0 | 0 | 0 | 0 |
dash-modebar.py | oriolmirosa/dash-recipes | 932 | 3260618 | import dash
import dash_core_components as dcc
import dash_html_components as html
app = dash.Dash()
app.layout = html.Div([
dcc.Graph(
id='my-graph',
figure={
'data': [{'x': [1, 2, 3]}]
},
config={
'modeBarButtonsToRemove': [
'sendDataToCloud',
'pan2d',
'zoomIn2d',
... | 0 | 0 | 0 | 0 | 0 | 0 |
examples/long_short.py | calumrussell/qstrader | 2,220 | 3260624 | <gh_stars>1000+
import os
import pandas as pd
import pytz
from qstrader.alpha_model.fixed_signals import FixedSignalsAlphaModel
from qstrader.asset.equity import Equity
from qstrader.asset.universe.static import StaticUniverse
from qstrader.data.backtest_data_handler import BacktestDataHandler
from qstrader.data.dail... | 0 | 0 | 0 | 0 | 0 | 0 |
tests/conftest.py | EdwardWooCN/bplustree | 760 | 3260632 | <reponame>EdwardWooCN/bplustree
import os
from unittest import mock
import pytest
filename = '/tmp/bplustree-testfile.index'
@pytest.fixture(autouse=True)
def clean_file():
if os.path.isfile(filename):
os.unlink(filename)
if os.path.isfile(filename + '-wal'):
os.unlink(filename + '-wal')
... | 0 | 0 | 0 | 0 | 0 | 0 |
regal/__init__.py | qiang123/regal | 432 | 3260651 | from regal.control import BaseInfo
__all__ = ['BaseInfo']
| 0 | 0 | 0 | 0 | 0 | 0 |
barbican-8.0.0/barbican/tests/common/test_hrefs.py | scottwedge/OpenStack-Stein | 177 | 3260696 | # Copyright (c) 2015, Cisco Systems
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in wri... | 0 | 0 | 0 | 0 | 0 | 0 |
tracardi/domain/storage_aggregate_result.py | bytepl/tracardi | 153 | 3260706 | <filename>tracardi/domain/storage_aggregate_result.py
from collections import defaultdict
from typing import Callable, Tuple, Any
class StorageAggregateResult:
def __init__(self, result=None, aggregate_key='key'):
if result is None:
self.total = 0
self.aggregations = []
... | 0 | 0 | 0 | 0 | 0 | 0 |
tests/parse/test_parse_hpo_terms.py | gmc-norr/scout | 111 | 3260717 | <filename>tests/parse/test_parse_hpo_terms.py
from scout.parse.hpo_terms import build_hpo_tree, get_incomplete_penetrance_genes
def test_build_hpo_tree(hpo_terms_handle):
"""Test function that creates the HPO terms tree from the HPO term lines"""
# GIVEN an HPO tree dictionary built out of the hp.obo file
... | 0 | 0 | 0 | 0 | 0 | 0 |
conScan.py | pbiernat/ripr | 338 | 3260735 | from __future__ import annotations
try:
from binaryninja import *
except:
print ("[!!] Not running in Binary Ninja")
try:
import r2pipe
except:
print ("[!!] Not running in Radare2")
from .analysis_engine import *
class ilVar(object):
def __hash__(self) -> object:
return self.var.__hash__()... | 0 | 4 | 0 | 2 | 6 | 0 |
experiment/darts.py | jsun94/nimble | 206 | 3260741 | <reponame>jsun94/nimble
# Code from https://github.com/quark0/darts
from collections import namedtuple
import torch
import torch.nn as nn
Genotype = namedtuple('Genotype', 'normal normal_concat reduce reduce_concat')
AmoebaNet = Genotype(
normal = [
('avg_pool_3x3', 0),
('max_pool_3x3', 1),
('sep_conv... | 0 | 0 | 0 | 0 | 0 | 0 |
00Python/day13/game_score.py | HaoZhang95/PythonAndMachineLearning | 937 | 3260742 | <reponame>HaoZhang95/PythonAndMachineLearning
import pygame, random
# 分数模块
class GameScore(object):
__cls_score = 0
def __init__(self, font_size):
# 设置字体的大小
self.font = pygame.font.SysFont("SimHei", font_size)
# render方法返回一个控件对象
self.text_obj = self.font.render("分数:0",1,(255,2... | 0 | 0 | 0 | 0 | 0 | 0 |
core/apps/capture_node_api/lib/search/check_offsetlist.py | near-feign/pcapdb | 244 | 3260766 | <reponame>near-feign/pcapdb<filename>core/apps/capture_node_api/lib/search/check_offsetlist.py<gh_stars>100-1000
import struct
import sys
OFFSET_FMT = 'Q'
file = open(sys.argv[1], 'rb')
offset_size = struct.calcsize(OFFSET_FMT)
last = 0
data = file.read(offset_size)
while len(data) == offset_size:
offset = str... | 0 | 0 | 0 | 0 | 0 | 0 |
yt/frontends/open_pmd/api.py | Xarthisius/yt | 360 | 3260800 | <filename>yt/frontends/open_pmd/api.py<gh_stars>100-1000
from . import tests
from .data_structures import OpenPMDDataset, OpenPMDGrid, OpenPMDHierarchy
from .fields import OpenPMDFieldInfo
from .io import IOHandlerOpenPMDHDF5
| 0 | 0 | 0 | 0 | 0 | 0 |
migrations/versions/664882eb4c78_remove_unique_constraint_on_ts_for_all_.py | danielsemkowicz/chia-monitor | 148 | 3260804 | <reponame>danielsemkowicz/chia-monitor
"""Remove unique constraint on ts for all tables
Revision ID: 664882eb4c78
Revises: <KEY>
Create Date: 2021-07-29 23:28:39.161379
"""
import sqlalchemy as sa
from alembic import op
# revision identifiers, used by Alembic.
revision = '<KEY>'
down_revision = '<KEY>'
branch_label... | 0 | 0 | 0 | 0 | 0 | 0 |
preprocess/common/align_text.py | ZhiyuanChen/TUPE | 225 | 3260808 | <reponame>ZhiyuanChen/TUPE
import sys
import re
for line in sys.stdin:
re.sub(r" n't\b", "n't", line)
re.sub(r" 's\b", "'s", line)
sys.stdout.write(line)
| 0 | 0 | 0 | 0 | 0 | 0 |
openbook_posts/migrations/0039_auto_20190812_1441.py | TamaraAbells/okuna-api | 164 | 3260809 | <gh_stars>100-1000
# Generated by Django 2.2.4 on 2019-08-12 12:41
from django.conf import settings
from django.db import migrations
class Migration(migrations.Migration):
dependencies = [
migrations.swappable_dependency(settings.AUTH_USER_MODEL),
('openbook_posts', '0038_postcommentusermention_... | 0 | 0 | 0 | 0 | 0 | 0 |
test/terra/pulse/controllers/test_pulse_controller.py | jakelishman/qiskit-aer | 313 | 3260824 | # 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/LICENSE-2.0.
#
# Any modifications or derivative wo... | 0 | 2 | 0 | 0 | 2 | 0 |
walter/maya/scripts/walter.py | all-in-one-of/OpenWalter | 187 | 3260836 | from __future__ import annotations
"""API to control Walter."""
# Copyright 2017 <NAME>. All rights reserved.
OVERRIDE_TRANSFORM = 'transform'
OVERRIDE_SHADER = 'shader'
OVERRIDE_DISPLACEMENT = 'displacement'
OVERRIDE_ATTRIBUTE = 'attribute'
class Walter(object):
"""
This object represents the Walter API. T... | 7 | 32 | 1 | 0 | 40 | 0 |
poet/console/application.py | sdispater/poet | 367 | 3260850 | # -*- coding: utf-8 -*-
from cleo import Application as BaseApplication
from .commands import (
AboutCommand,
CheckCommand,
InitCommand,
InstallCommand,
LockCommand,
PackageCommand,
PublishCommand,
RequireCommand,
SearchCommand,
UpdateCommand
)
from .commands.make import MakeSe... | 0 | 1 | 0 | 0 | 1 | 0 |
Android/ci.env.py | AgoraIO-Usecase/ChatRoom | 157 | 3260865 | #!/usr/bin/python
# -*- coding: UTF-8 -*-
import re
import os
import shutil
TARGET_LIBS_ZIP = "agora_sdk.zip"
TARGET_INTERNAL_FOLDER = "agora_sdk"
def main():
RTC_SDK_URL = ""
if "RTC_SDK_URL" in os.environ:
RTC_SDK_URL = os.environ["RTC_SDK_URL"]
RTM_SDK_URL = ""
if "RTM_SDK_URL" in os.envi... | 0 | 0 | 0 | 0 | 0 | 0 |
examples/privacy/membership_inference/example_vgg_cifar.py | hboshnak/mindarmour | 139 | 3260901 | <reponame>hboshnak/mindarmour
# Copyright 2020 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 ... | 0 | 0 | 0 | 0 | 0 | 0 |
boto3_type_annotations_with_docs/boto3_type_annotations/license_manager/paginator.py | cowboygneox/boto3_type_annotations | 119 | 3260958 | <gh_stars>100-1000
from typing import Dict
from typing import List
from botocore.paginate import Paginator
class ListAssociationsForLicenseConfiguration(Paginator):
def paginate(self, LicenseConfigurationArn: str, PaginationConfig: Dict = None) -> Dict:
"""
Creates an iterator that will paginate t... | 0 | 0 | 0 | 0 | 0 | 0 |
Chapter 10/10.11_reading_from_command_line.py | ACsBlack/Tkinter-GUI-Application-Development-Blueprints-Second-Edition | 120 | 3260960 | """
Code illustration: 10.11
Reading from the command line
Tkinter GUI Application Development Blueprints
"""
from tkinter import Tk, Text, END
from subprocess import Popen, PIPE
root = Tk()
text = Text(root)
text.pack()
# replace "ls" with "dir" in the next line on windows platform
with Popen(["ls"], stdout=PIPE, ... | 0 | 0 | 0 | 0 | 0 | 0 |
icevision/models/mmdet/common/bbox/two_stage/__init__.py | ai-fast-track/mantisshrimp | 580 | 3260993 | <reponame>ai-fast-track/mantisshrimp
from icevision.models.mmdet.common.bbox import *
from icevision.models.mmdet.common.bbox.two_stage.model import *
| 0 | 0 | 0 | 0 | 0 | 0 |
alipay/aop/api/response/AlipayBossFncInvoiceBatchqueryResponse.py | snowxmas/alipay-sdk-python-all | 213 | 3260997 | #!/usr/bin/env python
# -*- coding: utf-8 -*-
import json
from alipay.aop.api.response.AlipayResponse import AlipayResponse
from alipay.aop.api.domain.MultiCurrencyMoneyOpenApi import MultiCurrencyMoneyOpenApi
from alipay.aop.api.domain.ArInvoiceOpenApiResponse import ArInvoiceOpenApiResponse
class AlipayBossFncInvo... | 0 | 6 | 0 | 6 | 12 | 0 |
examples/test_examples.py | imoyao/apiflask | 423 | 3261007 | <filename>examples/test_examples.py<gh_stars>100-1000
import os
import sys
from importlib import reload
import pytest
full_examples = [
'basic',
'orm',
'cbv',
'openapi',
'blueprint_tags',
'base_response',
]
examples = full_examples + [
'pagination'
]
@pytest.fixture
def client(request):... | 0 | 0 | 0 | 0 | 0 | 0 |
femlib/constants.py | jzw0025/fem-with-python | 148 | 3261009 | <reponame>jzw0025/fem-with-python
import numpy as np
# Field types
SCALAR = 0
VECTOR = 1
TENSOR_3D = 2
NUM_TENSOR_3D = 6
TENSOR_3D_FULL = 3
NUM_TENSOR_3D_FULL = 9
ARRAY = 4
FIELD_TYPES = {SCALAR: 'scalar', VECTOR: 'vector', TENSOR_3D: 'tensor_3D',
TENSOR_3D_FULL: 'tensor_3D_full', ARRAY: 'array'}
def C... | 0 | 0 | 0 | 0 | 0 | 0 |
tests/test_extract_features_utils.py | blazejdolicki/vissl | 2,512 | 3261027 | <filename>tests/test_extract_features_utils.py<gh_stars>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 os
import unittest
from typing import Tuple
import numpy as np
from vissl.... | 0 | 0 | 0 | 0 | 0 | 0 |
applications/popart/deep_voice/text_utils.py | payoto/graphcore_examples | 260 | 3261096 | <gh_stars>100-1000
# Copyright (c) 2020 Graphcore Ltd. All rights reserved.
import numpy as np
from random import random
import re
import nltk
_pad = '_'
_eos = '~'
_characters = 'ABCDEFGHIJKLMNOPQRSTUVWXYZ!,-.:;? '
_arpabet_symbols = [
'AA', 'AA0', 'AA1', 'AA2', 'AE', 'AE0', 'AE1', 'AE2', 'AH', 'AH0',... | 0 | 0 | 0 | 0 | 0 | 0 |
tests/test_utils.py | IMULMUL/etl-parser | 104 | 3261108 | # -*- coding: utf-8 -*-
import unittest
from construct import Enum, Int8ul, CheckError
from etl.utils import check_enum
class TestUtilsModule(unittest.TestCase):
"""
Test all functions presents in the utils module
"""
def test_check_enum_ok(self):
"""
Test check enum function with val... | 0 | 0 | 0 | 0 | 0 | 0 |
reagent/training/cb/linucb_trainer.py | dmitryvinn/ReAgent | 1,156 | 3261111 | #!/usr/bin/env python3
# Copyright (c) Facebook, Inc. and its affiliates. All rights reserved.
import logging
from typing import Optional
import torch
from reagent.core.configuration import resolve_defaults
from reagent.core.types import CBInput
from reagent.gym.policies.policy import Policy
from reagent.models.linear... | 12 | 2 | 0 | 2 | 16 | 0 |
tvshow/admin.py | christopheduruisseau/Lilleflex | 212 | 3261112 | <gh_stars>100-1000
from django.contrib import admin
from .models import (Episode, Season, Show)
# Register your models here.
admin.site.register(Show)
admin.site.register(Season)
admin.site.register(Episode)
| 0 | 0 | 0 | 0 | 0 | 0 |
GPLT_Python/L1-036.py | upupming/algorithm | 107 | 3261113 | N = input().split()
print(int(N[0]) * int(N[-1]))
| 0 | 0 | 0 | 0 | 0 | 0 |
distar/model/alphastar/actor_critic.py | XinyuJing/DI-star | 267 | 3261114 | <reponame>XinyuJing/DI-star<gh_stars>100-1000
import os.path as osp
from collections import namedtuple, OrderedDict, defaultdict
from functools import reduce
import torch
import torch.nn as nn
from collections.abc import Sequence, Mapping
from .encoder import Encoder
from .policy import Policy
from .value import Value... | 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.