max_stars_repo_path stringlengths 3 269 | max_stars_repo_name stringlengths 4 119 | max_stars_count int64 0 191k | id stringlengths 1 7 | content stringlengths 6 1.05M | score float64 0.23 5.13 | int_score int64 0 5 |
|---|---|---|---|---|---|---|
deckhand/barbican/cache.py | airshipit/deckhand | 2 | 35500 | # Copyright 2018 AT&T Intellectual Property. All other 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... | 2.015625 | 2 |
stormreplay/analyzer.py | karlgluck/heroes-of-the-storm-replay-parser | 31 | 35501 | import os
import reader
import json
# todo: get this logger from elsewhere
from celery.utils.log import get_task_logger
log = get_task_logger(__name__)
defaultFieldMappings = [
### SET
(['info','protocol'], 'getReplayProtocolVersion'),
(['info','bytes'], 'getReplayFileByteSize'),
(['info','gameloops'], '... | 2.0625 | 2 |
sktime/_contrib/_plot_path.py | Vasudeva-bit/sktime | 0 | 35502 | # -*- coding: utf-8 -*-
import matplotlib.colors as colorplt
import matplotlib.pyplot as plt
import numpy as np
from sktime.distances._distance import distance_alignment_path, pairwise_distance
gray_cmap = colorplt.LinearSegmentedColormap.from_list("", ["#c9cacb", "white"])
def _path_mask(cost_matrix, path, ax, the... | 2.421875 | 2 |
utils/rtutil.py | RT-Team/RT-Lib | 0 | 35503 | # RT Ext - Useful Util
# 注意:普通のエクステンションとは違います。
import asyncio
from json import dumps
from time import time
import discord
from aiofile import async_open
from discord.ext import commands, tasks
class RtUtil(commands.Cog):
def __init__(self, bot):
self.bot = bot
self.data = {
"list_emb... | 2.5625 | 3 |
asclepias_broker/events/cli.py | ChiaraBi/asclepias-broker | 0 | 35504 | <filename>asclepias_broker/events/cli.py
# -*- coding: utf-8 -*-
#
# Copyright (C) 2018 CERN.
#
# Asclepias Broker is free software; you can redistribute it and/or modify it
# under the terms of the MIT License; see LICENSE file for more details.
"""Events CLI."""
from __future__ import absolute_import, print_functio... | 1.867188 | 2 |
test/noise_transformation_test.py | DecodEPFL/eiv-grid-id | 1 | 35505 | import numpy as np
import pytest
from src.models.noise_transformation import average_true_var_real, average_true_var_imag, average_true_cov, \
average_true_noise_covariance, naive_noise_covariance
test_cases_real_variance = [
(2 - 3j, 0, 0, 0),
(0, 1, 1, np.exp(-2) * (2 * np.cosh(2) - np.cosh(1))),
(2... | 2.140625 | 2 |
forherobj_app/urls.py | chaitphani/ForHerObj-repo | 0 | 35506 | <filename>forherobj_app/urls.py
from django.urls import path
from . import views
urlpatterns = [
path('', views.home, name='home'),
path('login', views.login_fun, name='login'),
path('signup', views.signup, name='signup'),
path('logout', views.logout, name='logout'),
] | 1.914063 | 2 |
1138_05_19-nmea.py | nchaparr/Geospatial-Analysis-with-Python | 0 | 35507 | <filename>1138_05_19-nmea.py
"""Parse NMEA GPS strings"""
from pynmea.streamer import NMEAStream
nmeaFile = open("nmea.txt")
nmea_stream = NMEAStream(stream_obj=nmeaFile)
next_data = nmea_stream.get_objects()
nmea_objects = []
while next_data:
nmea_objects += next_data
next_data = nmea_stream.get_objects()
... | 3.28125 | 3 |
languages/python/src/concepts/P104_Decorators_ClassBasedDecorators.py | vikash-india/DeveloperNotes2Myself | 2 | 35508 | <filename>languages/python/src/concepts/P104_Decorators_ClassBasedDecorators.py
# Description: Class Based Decorators
"""
### Note
* If you want to maintain some sort of state and/or just make your code more confusing, use class based decorators.
"""
class ClassBasedDecorator(object):
def __init__(self, functio... | 3.78125 | 4 |
2. Programming Fundamentals With Python (May 2021)/08. Exercise - Lists Basics/09_hello_france.py | kzborisov/SoftUni | 1 | 35509 | <reponame>kzborisov/SoftUni<filename>2. Programming Fundamentals With Python (May 2021)/08. Exercise - Lists Basics/09_hello_france.py
# Task 09. Hello, France
def validate_price(items_and_prices):
item = items_and_prices.split('->')[0]
prices = float(items_and_prices.split('->')[1])
if item == 'Clothes' a... | 4.1875 | 4 |
main.py | itsjoel/migrate-following-python | 1 | 35510 | """Finds out all the people you need to follow to follow all the same people as another user. Then, optionally, follows them for you."""
import configparser
import csv
import errno
import os
import tweepy
from tqdm import tqdm
#Useful Constants
PATH_TO_TARGET_CSV = "./output/targetfriends.csv"
PATH_TO_USER... | 3.046875 | 3 |
Code/classification_system/data_visualisation/frequent_ngrams.py | sxd942/fascist_text_classification | 0 | 35511 | <filename>Code/classification_system/data_visualisation/frequent_ngrams.py<gh_stars>0
import pandas as pd
import matplotlib.pyplot as plt
from nltk import ngrams
from preprocessing.preprocess import remove_stopwords
"""
frequent_ngrams.py was used to generate bar plots of most frequently used
bi and trigrams from the f... | 3.703125 | 4 |
tests/util/test_doWaitWebRequest.py | unt-libraries/codalib | 0 | 35512 | <reponame>unt-libraries/codalib<filename>tests/util/test_doWaitWebRequest.py
from unittest.mock import Mock
from urllib.error import URLError
from codalib import util
def test_is_sucessful(monkeypatch):
"""
Verifies the return value from a successful call to
doWaitWebRequest.
"""
response = Mock(... | 2.90625 | 3 |
setup.py | giuse/brutelogger | 1 | 35513 | # Thanks `https://github.com/pypa/sampleproject`!!
from setuptools import setup, find_packages
from os import path
here = path.abspath(path.dirname(__file__))
with open(path.join(here, 'VERSION'), 'r', encoding='utf-8') as f:
version = f.read().strip()
with open(path.join(here, 'README.md'), 'r', encoding='utf-8') ... | 1.640625 | 2 |
stream.py | seweithotroyman/twips | 0 | 35514 | # -*- coding: utf-8 -*-
"""
Created on Wed Jun 26 19:39:00 2019
@author: hehehe
"""
from __future__ import absolute_import, print_function
from tweepy import OAuthHandler, Stream, StreamListener
#Buat API Twitter di link berikut https://developer.twitter.com/en/apps
consumer_key = "masukkan consumer_key"
consumer_s... | 3.3125 | 3 |
collatz.py | hansperu/pands-problems-2020-hp | 0 | 35515 | <filename>collatz.py
#ask user to enter a positive value (pedir al usuario que ingrese un valor positivo)
a = int(input("please enter a positive integer: "))
#if value entered is negative print "not a positive number" and stop (si el valor introducido es una impresion negativa "no es un número positivo" y se detiene)
... | 4.34375 | 4 |
core/vswitch_controller_pxp.py | shreyagupta30/vineperf | 9 | 35516 | <filename>core/vswitch_controller_pxp.py
# Copyright 2016-2018 Intel Corporation., Tieto
#
# 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
#
# U... | 2.28125 | 2 |
gofest/gofest.py | yamikaitou/rotom | 0 | 35517 | <reponame>yamikaitou/rotom
from redbot.core import commands, Config, checks
import discord
from discord.ext import tasks
import random
import math
from datetime import datetime
class GoFest(commands.Cog):
def __init__(self, bot):
self.bot = bot
self.contest.start()
@commands.is_owner()
@... | 2.328125 | 2 |
NLP_Flask/app/data_manage_api/__init__.py | Gxy-2001/NLPPlat | 0 | 35518 | from flask import Blueprint
api = Blueprint("data_manage_api", __name__)
from . import data_venation
from . import operator_manage
from . import model_manage
from . import resource_manage
from . import pipeline_manage
from . import trainedmodel_manage
| 1.375 | 1 |
cfg_exporter/exports/py_export.py | dong50252409/cfg_exporter | 3 | 35519 | import os
import typing
import cfg_exporter.custom as custom
from cfg_exporter.const import DataType
from cfg_exporter.const import TEMPLATE_EXTENSION
from cfg_exporter.exports.base.export import BaseExport
from cfg_exporter.lang_template import lang
from cfg_exporter.tables.base.type import DefaultValue
EXTENSION = ... | 2.09375 | 2 |
app/state.py | AnsGoo/cronJob | 11 | 35520 | from typing import Any
from starlette.datastructures import State
class DefaultState:
state = State()
def get(self,key:str, value: Any = None) -> Any:
if hasattr(self.state, key):
return getattr(self.state, key)
else:
if not value:
raise Exception('st... | 3.203125 | 3 |
venv/lib/python2.7/site-packages/sklearn/metrics/__init__.py | bopopescu/fbserver | 0 | 35521 | """
The :mod:`sklearn.metrics` module includes score functions, performance metrics
and pairwise metrics and distance computations.
"""
from .metrics import (accuracy_score,
average_precision_score,
auc,
roc_auc_score,
classificati... | 1.804688 | 2 |
dacman/plugins/csv/__init__.py | yocheah/dac-man | 0 | 35522 | <reponame>yocheah/dac-man
from pathlib import Path
from collections import defaultdict
import numpy as np
try:
import pandas as pd
except ImportError:
from dacman.core.utils import dispatch_import_error
dispatch_import_error(module_name='pandas', plugin_name='CSV')
from dacman.compare import base
try:
... | 2.328125 | 2 |
tests/customs_test.py | Mario-Kart-Felix/deeptrain | 16 | 35523 | # -*- coding: utf-8 -*-
import os
import sys
# ensure `tests` directory path is on top of Python's module search
filedir = os.path.dirname(__file__)
sys.path.insert(0, filedir)
while filedir in sys.path[1:]:
sys.path.pop(sys.path.index(filedir)) # avoid duplication
import pytest
import numpy as np
from copy impor... | 2.046875 | 2 |
pluginsmanager/model/lv2/lilvlib.py | SpotlightKid/PluginsManager | 9 | 35524 | """
File copy from https://github.com/moddevices/lilvlib
"""
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
# ------------------------------------------------------------------------------------------------------------
# Imports
import json
import lilv
import os
from math import fmod
# -----------------------------... | 2.421875 | 2 |
scripts/save_hitoffsets.py | abraker95/ultimate_osu_analyzer | 23 | 35525 |
import os
'''
This script takes a beatmap file and a bunch of replays, calculates hitoffsets for each replay and saves them
to a *.csv file. This script works for std gamemode only.
'''
class SaveHitoffsets():
def create_dir(self, dir_path):
if not os.path.exists(dir_path):
try: os.mkdir(dir_... | 3.109375 | 3 |
theme_clean/__manifest__.py | YnievesDotNetTeam/addons | 0 | 35526 | {
'name': 'Clean Theme',
'description': 'Clean Theme',
'category': 'Theme/Services',
'summary': 'Corporate, Business, Tech, Services',
'sequence': 120,
'version': '2.0',
'author': '<NAME>.',
'depends': ['theme_common', 'website_animate'],
'data': [
'views/assets.xml',
... | 0.945313 | 1 |
yt/fields/field_exceptions.py | neutrinoceros2/yt | 0 | 35527 | <reponame>neutrinoceros2/yt<gh_stars>0
class ValidationException(Exception):
pass
class NeedsGridType(ValidationException):
def __init__(self, ghost_zones=0, fields=None):
self.ghost_zones = ghost_zones
self.fields = fields
def __str__(self):
return f"({self.ghost_zones}, {self.fi... | 2.625 | 3 |
sanejs/sanejs.py | Lookyloo/sanejs | 2 | 35528 | <reponame>Lookyloo/sanejs<gh_stars>1-10
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
import logging
import hashlib
import json
import time
from redis import Redis
from git import Repo # type: ignore
from .helpers import get_homedir, get_socket_path
"""
sha: set of libname|version|fullpath
libname|version: hash o... | 1.976563 | 2 |
fsm/tests/test_fsm.py | romeech/fsm-mixin | 0 | 35529 | import pytest
from mixins.fsm import FinalStateMachineMixin
MSG_START = 'start'
MSG_COMPLETE = 'complete'
MSG_BREAK = 'break'
MSG_RESTART = 'repair'
MSG_UNREGISTERED = 'unknown'
class SampleTask(FinalStateMachineMixin):
STATE_NEW = 'new'
STATE_RUNNING = 'running'
STATE_READY = 'ready'
STATE_FAILED =... | 2.09375 | 2 |
mt5_correlation/gui/__init__.py | jamiecash/mt5-correlation | 10 | 35530 | from mt5_correlation.gui.mdi import CorrelationMDIFrame
| 1.0625 | 1 |
dftparse/wien2k/refract_parser.py | CitrineInformatics/dft-parser | 1 | 35531 | from ..core import BlockParser
def _parse_refraction(line, lines):
"""Parse Energy [eV] ref_ind_xx ref_ind_zz extinct_xx extinct_zz"""
split_line = line.split()
energy = float(split_line[0])
ref_ind_xx = float(split_line[1])
ref_ind_zz = float(split_line[2])
extinct_xx = float(split... | 3.296875 | 3 |
prompts/prompt_scorer.py | GpNico/bert_semantics | 0 | 35532 | <gh_stars>0
import numpy as np
import pickle
import tqdm
import os
import torch
from prompts.prompt_material import DETS_LIST, CONTENT_STRUCTS_PREFIX_LIST, CONTENT_STRUCTS_MIDDLE_LIST, CONTENT_STRUCTS_SUFFIX_LIST, TRANSFORMATIONS, LOGICAL_PREFIXES_LIST, LOGICAL_STRUCTS_LW_LIST
######################################... | 2.15625 | 2 |
common/util/data.py | minkefusiji/TimeSeriesAnalysisPlugin | 0 | 35533 | import requests
import json
import os
import sys
import shutil
from .azureblob import AzureBlob
from .azuretable import AzureTable
from .timeutil import get_time_offset, str_to_dt, dt_to_str
from .series import Series
from .constant import STATUS_SUCCESS, STATUS_FAIL
from telemetry import log
# To get the meta of a ... | 2.265625 | 2 |
src/thespian/sourcetree/__init__.py | mtttech/yari-dnd | 1 | 35534 | <filename>src/thespian/sourcetree/__init__.py
from .dnd5e import dnd5e_sources
class SourceTree:
backgrounds: object = dnd5e_sources["backgrounds"]
classes: object = dnd5e_sources["classes"]
feats: object = dnd5e_sources["feats"]
metrics: object = dnd5e_sources["metrics"]
races: object = dnd5e_sou... | 1.539063 | 2 |
controllerconfig/controllerconfig/controllerconfig/common/log.py | etaivan/stx-config | 0 | 35535 | <reponame>etaivan/stx-config
#
# Copyright (c) 2014 Wind River Systems, Inc.
#
# SPDX-License-Identifier: Apache-2.0
#
"""
Logging
"""
import logging
import logging.handlers
_loggers = {}
def get_logger(name):
""" Get a logger or create one """
if name not in _loggers:
_loggers[name] = logging.ge... | 2.1875 | 2 |
rastervision/command/train_command.py | AirbusAerial/raster-vision | 2 | 35536 | import click
from rastervision.command import Command
class TrainCommand(Command):
def __init__(self, task):
self.task = task
def run(self, tmp_dir=None):
if not tmp_dir:
tmp_dir = self.get_tmp_dir()
msg = 'Training model...'
click.echo(click.style(msg, fg='green'... | 2.703125 | 3 |
htools/magics.py | hdmamin/htools | 1 | 35537 | import inspect
from IPython.core.interactiveshell import InteractiveShell
from IPython.core.magic import cell_magic, magics_class, Magics
from IPython.core.magic_arguments import (argument, magic_arguments,
parse_argstring)
import warnings
from htools.meta import timebox
@ma... | 2.65625 | 3 |
tests/test_msal.py | narongdejsrn/django-rest-framework-msal | 3 | 35538 | <filename>tests/test_msal.py
#!/usr/bin/env python
# -*- coding: utf-8 -*-
"""
test-msal
------------
Tests for MSAL Connection
"""
from django.test import TestCase
from drf_msal_jwt.utils import build_auth_url
class TestMSAL(TestCase):
def setUp(self):
pass
def test_login_url(self):
log... | 2.015625 | 2 |
server/athenian/api/auth.py | athenianco/athenian-api | 9 | 35539 | import asyncio
from datetime import datetime, timedelta
import functools
from http import HTTPStatus
import logging
import os
import pickle
from random import random
import re
import struct
from typing import Any, Callable, Coroutine, Dict, List, Optional, Sequence, Tuple
import warnings
import aiohttp.web
from aiohtt... | 1.71875 | 2 |
expon/utils/git.py | hi-zhenyu/expon | 0 | 35540 |
import subprocess
def check_working_tree():
try:
subprocess.check_output(['git', 'diff', '--exit-code'])
except subprocess.CalledProcessError as e:
print('called process error')
out_bytes = e.output # Output generated before error
code = e.returncode # Return code
... | 2.53125 | 3 |
tests/dictionary/test_jmdict.py | DennisMerkus/omniglot | 0 | 35541 | <gh_stars>0
import unittest
import pytest
from omniglot.jpn.jmdict.convert import create_JMDict_database_entries
from omniglot.jpn.jmdict.extract import convert_to_JSON
from omnilingual import PartOfSpeech
from .test_jmdict_entries import entry_America, entry_batsuichi
class TestJMDict(unittest.TestCase):
@pyt... | 2.3125 | 2 |
algorithms/TrackR-CNN/mots_tools/mots_common/images_to_txt.py | Diego-Barbulo/TrackR-CNN | 1 | 35542 | <filename>algorithms/TrackR-CNN/mots_tools/mots_common/images_to_txt.py
import sys
from mots_common.io import load_sequences, load_seqmap, write_sequences
if __name__ == "__main__":
if len(sys.argv) != 4:
print("Usage: python images_to_txt.py gt_img_folder gt_txt_output_folder seqmap")
sys.exit(1)
... | 2.53125 | 3 |
assets/migrations/0014_auto_20161105_1739.py | stewardshiptools/stewardshiptools | 0 | 35543 | # -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('assets', '0013_metadocumentasset_metadocumentsecureasset'),
]
operations = [
migrations.AlterField(
model_name='... | 1.4375 | 1 |
pythontuts/nestedlists.py | antfarmar/hackerrank | 1 | 35544 | #import sys
#file = sys.stdin
file = open( r".\data\nestedlists.txt" )
data = file.read().strip().split()[1:]
records = [ [data[i], float(data[i+1])] for i in range(0, len(data), 2) ]
print(records)
low = min([r[1] for r in records])
dif = min([r[1] - low for r in records if r[1] != low])
print(dif)
names = [ r[0] for... | 3.265625 | 3 |
src/koala/logging.py | hugovk/koala | 4 | 35545 | # -*- coding: utf-8 -*-
"""
Logging configuration functions
"""
from logbook import NullHandler, FileHandler, NestedSetup
from logbook.more import ColorizedStderrHandler
from logbook.queues import ThreadedWrapperHandler
def logging_options(parser):
"""Add cli options for logging to parser"""
LOG_LEVELS = ("cr... | 2.59375 | 3 |
build/lib/abp/adaptives/dqn/__init__.py | LinearZoetrope/abp | 0 | 35546 | <filename>build/lib/abp/adaptives/dqn/__init__.py
from .adaptive import DQNAdaptive
| 1.085938 | 1 |
test/testfiles.py | mvz/vb2py | 2 | 35547 | from testframework import *
import os
import vb2py.utils
PATH = vb2py.utils.rootPath()
# << File tests >> (1 of 14)
# Open with Input
tests.append((r"""
Open "%s" For Input As #3
Input #3, a
Input #3, b
Input #3, c, d, e
Input #3, f, g
Close #3
""" % vb2py.utils.relativePath("test/testread.txt"), {'a' : 'Can you hear ... | 2.609375 | 3 |
Reinforcement_Learning/gym-environments/setup.py | SpencerPao/ComputerVision | 1 | 35548 | <reponame>SpencerPao/ComputerVision
from setuptools import setup
setup(name='gym_dinorun',
version='0.1',
install_requires=['gym', 'selenium', 'numpy', 'pillow', 'pyvirtualdisplay', 'matplotlib']
)
| 1.046875 | 1 |
openstack_dashboard/test/api_tests/cinder_tests.py | dreamhost/horizon | 3 | 35549 | # vim: tabstop=4 shiftwidth=4 softtabstop=4
# Copyright 2012 Red Hat, Inc.
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the License. You may obtain
# a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
#... | 1.804688 | 2 |
admin-portal/queues/apps.py | oakbani/ksdp-portal | 0 | 35550 | <gh_stars>0
from django.apps import AppConfig
class QueuesConfig(AppConfig):
default_auto_field = "django.db.models.BigAutoField"
name = "queues"
| 1.296875 | 1 |
tests/test_cron.py | acuros/noopy | 11 | 35551 | <filename>tests/test_cron.py
import pytest
from noopy.cron.rule import RateEventRule, BaseEventRule, TimeEventRule
from noopy.decorators import cron
@pytest.fixture
def rate_5_mins_rule():
return RateEventRule('5MinsRateRule', value=5)
@pytest.fixture
def time_5pm_rule():
return TimeEventRule('5pmRule', '*... | 2.15625 | 2 |
eCommerce/DoorDash/accountChecker.py | MiyakoYakota/PythonCheckers | 5 | 35552 | <gh_stars>1-10
import requests
import random
import json
from multiprocessing import Pool # Multi-Threading
from multiprocessing import freeze_support # Windows Support
requests.packages.urllib3.disable_warnings()
accounts = [line.rstrip('\n') for line in open("combo.txt", 'r')]
proxies = [line.rstrip('\n') for line ... | 2.40625 | 2 |
Day1/solution.py | pbragapassarelli/Advent-of-Code-2020 | 0 | 35553 | <filename>Day1/solution.py
import numpy as np
data_file = 'input.txt'
def parse_input(input_data_file):
with open(input_data_file, 'r') as input_data_file:
input_data = input_data_file.read()
lines = input_data.split('\n')
item_count = len(lines) - 1
items = []
for i in range(0... | 3.734375 | 4 |
analysis/log_analysis/check_util.py | leozz37/makani | 1,178 | 35554 | # Copyright 2020 Makani Technologies LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to... | 2.3125 | 2 |
resource/views.py | madre/PersonalWeb | 0 | 35555 | <filename>resource/views.py<gh_stars>0
#coding=utf-8
"""
__create_time__ = '13-10-18'
__author__ = 'Madre'
"""
from django.shortcuts import get_object_or_404
from django.views.generic import ListView, DetailView
from resource.models import Resource, Topic
class ResourceListView(ListView):
context_obj... | 2.15625 | 2 |
tools/dota/dota_image.py | liuyanyi/mmdetection | 0 | 35556 | <reponame>liuyanyi/mmdetection<filename>tools/dota/dota_image.py
import os
from argparse import ArgumentParser
from mmdet.apis import (inference_detector,
init_detector)
def parse_args():
parser = ArgumentParser()
parser.add_argument('img_dir', help='Image file folder')
parser.add... | 2.453125 | 2 |
tx/tx_builder/bitcoin/cust_claim.py | fakecoinbase/boltlabs-incslashlibzkchannels | 68 | 35557 | # p2wsh input (2-of-2 multisig)
# p2wpkh output
import argparse
import hashlib
import ecdsa
def dSHA256(data):
hash_1 = hashlib.sha256(data).digest()
hash_2 = hashlib.sha256(hash_1).digest()
return hash_2
def hash160(s):
'''sha256 followed by ripemd160'''
return hashlib.new('ripemd160', hashlib.s... | 2.890625 | 3 |
api/api/model/ApiOperations.py | pampi9/api-handler | 0 | 35558 | class ApiOperations:
"""
Class to extract defined parts from the OpenApiSpecs definition json
"""
def __init__(self, resource, parts=None):
"""
Extract defined parts out of paths/<endpoint> (resource) in the OpenApiSpecs definition
:param resource: source to be extracted from
... | 2.8125 | 3 |
test03.py | akim0919/Feedback | 0 | 35559 | b = 10; c = 20;
a=b+c;
print(a) | 2.3125 | 2 |
nessus_download_merge_and_upload.py | jfbethlehem/Scripts | 0 | 35560 | <reponame>jfbethlehem/Scripts
#!/usr/bin/env python
# requires python3
#ensure destpath exists and url, merged_folder_id, username and password are correct
#redhat: scl enable rh-python34 -- python3 /root/nessus_download_merge_and_upload.py
#debian: python3 /root/nessus_download_merge_and_upload.py
import requests,... | 2 | 2 |
examples/generate_index.py | WilliamIX/BioCRNPyler | 2 | 35561 | <reponame>WilliamIX/BioCRNPyler<filename>examples/generate_index.py
import sys
import inspect
import biocrnpyler
from os import listdir
from os.path import isfile
from os.path import join
# Get lists of bioCRNpyler objects of different types
species = [
(n, o) for (n, o) in inspect.getmembers(sys.modules["biocrnpy... | 2.28125 | 2 |
src/datamgr/datamanager/collection/common/process_nodes/datamodel.py | Chromico/bk-base | 84 | 35562 | <filename>src/datamgr/datamanager/collection/common/process_nodes/datamodel.py
# -*- coding: utf-8 -*-
"""
Tencent is pleased to support the open source community by making BK-BASE 蓝鲸基础平台 available.
Copyright (C) 2021 THL A29 Limited, a Tencent company. All rights reserved.
BK-BASE 蓝鲸基础平台 is licensed under the MIT Lic... | 1.296875 | 1 |
tilescraper.py | azaroth42/iiif-harvester | 2 | 35563 | <filename>tilescraper.py<gh_stars>1-10
from PIL import Image
import json, StringIO, requests
import time
import robotparser
import re
import sys
host = "http://dlss-dev-azaroth.stanford.edu/"
service = host + "services/iiif/f1rc/"
resp = requests.get(service + "info.json")
js = json.loads(resp.text)
h = js['height']
... | 2.703125 | 3 |
lab09/fusion_gui.py | chinesefirewall/Robotics | 1 | 35564 | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
This file imports your code from localization_logic.py and uses class Visualisation from visualisation.py.
Additionally, it imports code from sensor_fusion.py file.
You can change the code at your own risk!
"""
import easygopigo3 as go
import signal
import pyqtgraph a... | 2.328125 | 2 |
api/mira/api_config.py | tnc-ca-geo/animl-ml | 1 | 35565 | <filename>api/mira/api_config.py
"""
MIRA API config
"""
MODELS = [
{
"endpoint_name": "mira-large",
"classes": ["fox", "skunk", "empty"]
},
{
"endpoint_name": "mira-small",
"classes": ["rodent", "empty"]
}
]
HEADERS = {
"Access-Control-Allow-Origin": "*",
"Access-Control-Allow-Headers":... | 1.0625 | 1 |
examples/gpio.py | nzsmith1/CapableRobot_USBHub_Driver | 16 | 35566 | import os, sys, inspect, logging, time
lib_folder = os.path.join(os.path.split(inspect.getfile( inspect.currentframe() ))[0], '..')
lib_load = os.path.realpath(os.path.abspath(lib_folder))
if lib_load not in sys.path:
sys.path.insert(0, lib_load)
import capablerobot_usbhub
hub = capablerobot_usbhub.USBHub()
##... | 2.21875 | 2 |
AdventOfCode2019/day05.py | Matematik411/Advent-of-Code-Practice | 0 | 35567 | class Int_code:
def __init__(self, s, inputs):
memory = {}
nrs = map(int, s.split(","))
for i, x in enumerate(nrs):
memory[i] = x
self.memory = memory
self.inputs = inputs
def set(self, i, x):
self.memory[i] = x
def one(self, a, b, c, mod... | 3.3125 | 3 |
src/misc/exceptions.py | KirtusJ/BirdBot | 0 | 35568 | from discord.ext import commands
class NotOwner(commands.CheckFailure):
pass
class NotModerator(commands.CheckFailure):
pass
class Blacklisted(commands.CheckFailure):
pass | 1.945313 | 2 |
setup.py | HurricaneLabs/python-pycinga | 4 | 35569 | from setuptools import setup
# Get the long description by reading the README
try:
readme_content = open("README.rst").read()
except Exception as e:
readme_content = ""
# Create the actual setup method
setup(
name="pycinga",
version="1.0.0",
description="Python library to write Icinga plugins.",
... | 1.5625 | 2 |
fluorelax/fluorelax.py | darianyang/fluorelax | 0 | 35570 | """
Main call.
TODO:
- parallize the mda processing portion? (dask)
"""
import numpy as np
import matplotlib.pyplot as plt
import MDAnalysis as mda
from command_line import create_cmd_arguments, handle_command_line
from calc_relax import Calc_19F_Relaxation
from calc_fh_dists import Calc_FH_Dists
from plot_relax imp... | 2.234375 | 2 |
neural/neural.py | pqn/neural | 2 | 35571 | <reponame>pqn/neural
#!/usr/bin/env python
# -*- coding: utf-8 -*-
from __future__ import division
import numpy as np
from scipy.optimize import fmin_bfgs
class NeuralNetwork:
"""A simple neural network."""
def __init__(self, hidden_layers=(25,), reg_lambda=0, num_labels=2):
"""Instantiates the class... | 3.4375 | 3 |
tests/test_beacon_client.py | HikaruG/spectroscope | 0 | 35572 | <reponame>HikaruG/spectroscope
import unittest
from unittest.mock import Mock, call
from ethereumapis.v1alpha1 import beacon_chain_pb2, validator_pb2
from spectroscope.clients.beacon_client import BeaconChainStreamer
from spectroscope.model import ChainTimestamp, Event, ValidatorIdentity
from spectroscope.model.update... | 2.125 | 2 |
src/box.py | ertugrullKara/GarbageDetector | 1 | 35573 | import numpy as np
class BoundBox:
"""
Adopted from https://github.com/thtrieu/darkflow/blob/master/darkflow/utils/box.py
"""
def __init__(self, obj_prob, probs=None, box_coord=[float() for i in range(4)]):
self.x, self.y = float(box_coord[0]), float(box_coord[1])
self.w, self.h =... | 2.734375 | 3 |
cplusplus/level1_single_api/4_op_dev/1_custom_op/cmake/util/insert_op_info.py | Dedederek/samples | 5 | 35574 | # -*- coding: utf-8 -*-
"""
Created on Feb 28 20:56:45 2020
Copyright (c) Huawei Technologies Co., Ltd. 2019. All rights reserved.
"""
import json
import os
import sys
if __name__ == '__main__':
if len(sys.argv) != 3:
print(sys.argv)
print('argv error, inert_op_info.py your_op_file lib_op_file')
... | 2.5625 | 3 |
tests/contour_extractors/test_utils.py | yamathcy/motif | 21 | 35575 | <reponame>yamathcy/motif
"""Tests for motif/contour_extractors/utils.py
"""
import unittest
import numpy as np
from motif.contour_extractors import utils
class TestPeakStreamHelper(unittest.TestCase):
def setUp(self):
self.S = np.array([
[0, 0, 0],
[1, 0, 5],
[0, 0.002... | 2.234375 | 2 |
unit_workaround.py | ltfish/nose2 | 0 | 35576 | <reponame>ltfish/nose2
"""
Python 2.7 Multiprocessing Unittest workaround.
=====================================================================
Due the manner in which multiprocessing is handled on windows
and the fact that __main__.py are actually called __main__
This workaround bypasses the fact that the calling un... | 2.03125 | 2 |
test/test_application.py | ChreSyr/baopig | 0 | 35577 | import unittest
import docs as bp
class ApplicationClassTest(unittest.TestCase):
def setUp(self):
self.app = bp.Application()
def test_set_fps(self):
self.app.set_fps(30)
self.assertEqual(self.app.fps, 30)
self.app.set_fps(60)
self.assertEqual(self.app.fps, 60)
if _... | 2.828125 | 3 |
lib/googlecloudsdk/gcloud/sdktools/root/info.py | IsaacHuang/google-cloud-sdk | 0 | 35578 | <reponame>IsaacHuang/google-cloud-sdk
# Copyright 2013 Google Inc. All Rights Reserved.
"""A command that prints out information about your gcloud environment."""
import os
import StringIO
import sys
import textwrap
from googlecloudsdk.calliope import base
from googlecloudsdk.core import config
from googlecloudsdk.c... | 2.9375 | 3 |
api/admin_urls.py | chenxiaoli/auth21 | 0 | 35579 | # -*- coding: utf-8 -*-
from django.conf.urls import include, url
from .user_admin_views import UserAdminListViewSet
user_admin_list=UserAdminListViewSet.as_view({
"get":"get"
})
urlpatterns = (
url(r'^user$', user_admin_list, name='user-admin-list'),
)
| 1.757813 | 2 |
kubernetes_typed/client/models/v1_empty_dir_volume_source.py | nikhiljha/kubernetes-typed | 22 | 35580 | <filename>kubernetes_typed/client/models/v1_empty_dir_volume_source.py<gh_stars>10-100
# Code generated by `typeddictgen`. DO NOT EDIT.
"""V1EmptyDirVolumeSourceDict generated type."""
from typing import TypedDict
V1EmptyDirVolumeSourceDict = TypedDict(
"V1EmptyDirVolumeSourceDict",
{
"medium": str,
... | 1.632813 | 2 |
omstools/RNAseq/lncRNA/classify/get_gene_cat_v3.py | bioShaun/OM004script | 0 | 35581 | import pandas as pd
import numpy as np
import click
import os
PRIORITY = ('Read-through', 'Protein coding',
'Pseudogene', 'TUCP', 'lncrna', 'lncRNA', 'other', 'ncRNA,other')
type_map = {
'other': 'lncRNA',
'ncRNA,other': 'lncRNA',
'lncrna': 'lncRNA',
'protein_coding': 'Protein coding',
... | 2.4375 | 2 |
awsf_cwl_v1/split_num.py | pkerpedjiev/tibanna | 0 | 35582 | #!/usr/bin/python
import sys
import csv
def split_num(n, M):
# n : original number
# M : max size for split range
nsplit = n//M
if nsplit*M < n:
nsplit += 1
ninterval = n//nsplit
ncum = 1
end = 0
res = []
while end < n:
start = ncum
ncum += ninterval
... | 3.5625 | 4 |
bcbio/picard/metrics.py | a113n/bcbio-nextgen | 418 | 35583 | <reponame>a113n/bcbio-nextgen
# Back compatibility -- use broad subdirectory for new code
from bcbio.broad.metrics import *
| 0.996094 | 1 |
databases/loja.py | danielicapui/programa-o-avancada | 0 | 35584 | from utills import *
conn,cur=start("loja")
produtos_p="produto_id integer primary key autoincrement,nome text,valor real,categoria_id integer,constraint fk_categorias foreign key (categoria_id) references categorias(categoria_id)"
criarTabela("categorias","categoria_id integer primary key, categoria text")
criarTabela... | 2.90625 | 3 |
bbb/templatetags/is_bbb_mod.py | cmd-ev/voctoconf | 21 | 35585 | from django import template
register = template.Library()
@register.filter
def is_bbb_mod(room, user):
return room.is_moderator(user)
| 1.828125 | 2 |
main/qtdashboard/obsolete/grab_handle.py | Hijtec/Breach_rides_elevator | 1 | 35586 | <gh_stars>1-10
# This Python file uses the following encoding: utf-8
import cv2
from multiprocessing import shared_memory
import numpy as np
import time
class Video:
def __init__(self, id, camera_number):
"""Initializes the class and calls its methods."""
self.id = id
... | 3.03125 | 3 |
analysis/config/config_UltraLegacy18.py | cms-btv-pog/jet-tagging-sf | 3 | 35587 | # -*- coding: utf-8 -*-
import scinum as sn
import numpy as np
def create_config(base_cfg):
# setup the config for 2018 data
from analysis.config.campaign_UltraLegacy18 import campaign as campaign_UltraLegacy18
from analysis.config.jet_tagging_sf import ch_ee, ch_emu, ch_mumu, ch_e, ch_mu
cfg = base_c... | 1.828125 | 2 |
TD3_based_DRL/TD3IARL.py | wujingda/Human-in-the-loop-Deep-Reinforcement-Learning-Hug-DRL- | 8 | 35588 | <reponame>wujingda/Human-in-the-loop-Deep-Reinforcement-Learning-Hug-DRL-
'''
This algorithm is a IA-RL implementation on off-policy TD3 algorithm, to check the original IA-RL algorithm
you can refer to https://arxiv.org/abs/1811.06187.
Since it is a baseline algorithm, the descriptions are mostly omitted, please visit... | 2.390625 | 2 |
qihu.py | Yumore/getapks | 2 | 35589 | #!/usr/bin/evn python
# jojo_xia
import os
import re
import socket
from urllib import request
from urllib.error import ContentTooShortError
import apk_info
import data_utils
import file_utils
socket.setdefaulttimeout(30)
class qihu:
def __init__(self):
self.url_list = []
self.apk_list = []
... | 2.34375 | 2 |
src/py_call.py | Lucien-MG/htools | 0 | 35590 | <filename>src/py_call.py<gh_stars>0
#/bin/python3
import os
import subprocess
# Const:
with open("config",'r') as conf:
VENV_A = conf.read()
PYTHON="python"
PYTHON3_VENV_A = os.path.join(VENV_A, "bin", "python3")
PIP=""
PIP_VENV_A= os.path.join(VENV_A, "bin", "pip3")
# Functions:
def python_call(argv):
su... | 2.625 | 3 |
dramkit/_tmp/utils_lottery.py | Genlovy-Hoo/dramkit | 0 | 35591 | <filename>dramkit/_tmp/utils_lottery.py
# -*- coding: utf-8 -*-
import os
import time
import numpy as np
import pandas as pd
def get_1bet_nums(n, Pmax, Pmin=1, **kwargs):
'''
随机生成一注号码
Parameters
----------
n: 一注号码的个数
Pmax: 备选号码最大值
Pmin: 备选号码最小值
Returns
-------
bet_nums: 随机选中... | 2.6875 | 3 |
src/negotiating_agent/venv/lib/python3.8/site-packages/geniusweb/bidspace/AllBidsList.py | HahaBill/CollaborativeAI | 1 | 35592 | <gh_stars>1-10
from typing import Dict, List
from tudelft.utilities.immutablelist.AbstractImmutableList import AbstractImmutableList
from tudelft.utilities.immutablelist.ImmutableList import ImmutableList
from tudelft.utilities.immutablelist.Outer import Outer
from geniusweb.issuevalue.Bid import Bid
from geniusweb.i... | 2.546875 | 3 |
broker/jobs/tests/handover.py | yiu31802/ave | 17 | 35593 | # Copyright (C) 2013 Sony Mobile Communications AB.
# All rights, including trade secret rights, reserved.
import json
import time
import traceback
from ave.network.process import Process
from ave.network.exceptions import *
from ave.broker._broker import validate_serialized, RemoteBroker, Broker
from ave.brok... | 1.820313 | 2 |
app/v1/core/auth/__init__.py | speduardo/flask-boilerplate | 1 | 35594 | <filename>app/v1/core/auth/__init__.py
from flask import jsonify
from flask_jwt_extended import JWTManager
from app.v1.messages import MSG_INVALID_CREDENTIALS, MSG_TOKEN_EXPIRED
from app.v1.modules.users.daos import UserDAO
jwt = JWTManager()
def init_app(app, **kwargs):
# pylint: disable=unused-argument
"... | 2.28125 | 2 |
plogical/CyberCPLogFileWriter.py | uzairAK/serverom-panel | 0 | 35595 | import subprocess
import time
import socket
import os
import smtplib
class CyberCPLogFileWriter:
fileName = "/home/cyberpanel/error-logs.txt"
@staticmethod
def SendEmail(sender, receivers, message, subject=None, type=None):
try:
smtpPath = '/home/cyberpanel/smtpDetails'
if... | 2.515625 | 3 |
tensorflow-extensions/dataset/__init__.py | king-michael/tensorflow-extensions | 0 | 35596 | from .NumpyDataset import NumpyDataset | 1.023438 | 1 |
register_classes.py | Iherrbenza/SMB100A_Python | 0 | 35597 | <reponame>Iherrbenza/SMB100A_Python
# @Date: 2020-04-05T14:08:33+10:00
# @Last modified time: 2020-04-08T18:40:22+10:00
from labscript_devices import register_classes
register_classes(
'SMB100A',
BLACS_tab='labscript_devices.SMB100A.blacs_tabs.SMB100ATab',
runviewer_parser=None
)
| 1.328125 | 1 |
src/clophfit/old/fit_titration_global.py | darosio/ClopHfit | 0 | 35598 | #!/usr/bin/env python
"""Module for global fitting titrations (pH and cl) on 2 datasets
"""
import os
import sys
import argparse
import numpy as np
from lmfit import Parameters, Minimizer, minimize, conf_interval, report_fit
import pandas as pd
import matplotlib.pyplot as plt
# from scipy import optimize
def ci_repo... | 2.78125 | 3 |
gehomesdk/erd/converters/advantium/erd_advantium_cook_time_remaining_converter.py | warrenrees/gehome | 0 | 35599 | from datetime import timedelta
from typing import Optional
from ..abstract import ErdReadOnlyConverter
from ..primitives import *
from gehomesdk.erd.values.advantium import ErdAdvantiumCookTimeMinMax
class ErdAdvantiumCookTimeRemainingConverter(ErdReadOnlyConverter[Optional[timedelta]]):
def erd_decode(self, valu... | 2.40625 | 2 |