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 |
|---|---|---|---|---|---|---|
donkeycar/tests/test_web_socket.py | wenxichen/donkeycar | 12 | 6600 |
from donkeycar.parts.web_controller.web import WebSocketCalibrateAPI
from functools import partial
from tornado import testing
import tornado.websocket
import tornado.web
import tornado.ioloop
import json
from unittest.mock import Mock
from donkeycar.parts.actuator import PWMSteering, PWMThrottle
class WebSocketCal... | 2.65625 | 3 |
misc/trac_plugins/IncludeMacro/includemacro/macros.py | weese/seqan | 1 | 6601 | <reponame>weese/seqan
# TracIncludeMacro macros
import re
import urllib2
from StringIO import StringIO
from trac.core import *
from trac.wiki.macros import WikiMacroBase
from trac.wiki.formatter import system_message
from trac.wiki.model import WikiPage
from trac.mimeview.api import Mimeview, get_mimetype, Context
fro... | 2.40625 | 2 |
packages/google/cloud/logging/client.py | rjcuevas/Email-Frontend-AngularJS- | 0 | 6602 | # Copyright 2016 Google Inc.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, ... | 1.476563 | 1 |
tests/test_core/test_graph_objs/test_instantiate_hierarchy.py | wwwidonja/changed_plotly | 0 | 6603 | from __future__ import absolute_import
from unittest import TestCase
import os
import importlib
import inspect
from plotly.basedatatypes import BasePlotlyType, BaseFigure
datatypes_root = "new_plotly/graph_objs"
datatype_modules = [
dirpath.replace("/", ".")
for dirpath, _, _ in os.walk(datatypes_root)
if... | 2.296875 | 2 |
mycli/packages/special/main.py | lyrl/mycli | 10,997 | 6604 | <gh_stars>1000+
import logging
from collections import namedtuple
from . import export
log = logging.getLogger(__name__)
NO_QUERY = 0
PARSED_QUERY = 1
RAW_QUERY = 2
SpecialCommand = namedtuple('SpecialCommand',
['handler', 'command', 'shortcut', 'description', 'arg_type', 'hidden',
'case_sensiti... | 2.359375 | 2 |
core/sample_fuzzer/data_generators/base.py | ShreyasTheOne/Super-Duper-Fuzzer | 0 | 6605 | <filename>core/sample_fuzzer/data_generators/base.py
from abc import ABC, abstractmethod
class BaseDataGenerator(ABC):
def __init__(self):
pass
@staticmethod
@abstractmethod
def generate(cls):
pass
| 2.359375 | 2 |
Mon_08_06/convert2.py | TungTNg/itc110_python | 0 | 6606 | # convert2.py
# A program to convert Celsius temps to Fahrenheit.
# This version issues heat and cold warnings.
def main():
celsius = float(input("What is the Celsius temperature? "))
fahrenheit = 9 / 5 * celsius + 32
print("The temperature is", fahrenheit, "degrees fahrenheit.")
if fahrenhei... | 4.1875 | 4 |
homeassistant/components/wolflink/__init__.py | basicpail/core | 11 | 6607 | """The Wolf SmartSet Service integration."""
from datetime import timedelta
import logging
from httpx import ConnectError, ConnectTimeout
from wolf_smartset.token_auth import InvalidAuth
from wolf_smartset.wolf_client import FetchFailed, ParameterReadError, WolfClient
from homeassistant.config_entries import ConfigEn... | 1.960938 | 2 |
src/levenshtein_distance.py | chunribu/python-algorithms | 0 | 6608 | <gh_stars>0
class LevenshteinDistance:
def solve(self, str_a, str_b):
a, b = str_a, str_b
dist = {(x,y):0 for x in range(len(a)) for y in range(len(b))}
for x in range(len(a)): dist[(x,-1)] = x+1
for y in range(len(b)): dist[(-1,y)] = y+1
dist[(-1,-1)] = 0
for i in ra... | 3.0625 | 3 |
pyapprox/benchmarks/test_spectral_diffusion.py | ConnectedSystems/pyapprox | 26 | 6609 | <gh_stars>10-100
import numpy as np
import unittest
from pyapprox.benchmarks.spectral_diffusion import (
kronecker_product_2d, chebyshev_derivative_matrix,
SteadyStateDiffusionEquation2D, SteadyStateDiffusionEquation1D
)
from pyapprox.univariate_polynomials.quadrature import gauss_jacobi_pts_wts_1D
import pyap... | 2.203125 | 2 |
torchdrug/layers/flow.py | wconnell/torchdrug | 772 | 6610 | import torch
from torch import nn
from torch.nn import functional as F
from torchdrug import layers
class ConditionalFlow(nn.Module):
"""
Conditional flow transformation from `Masked Autoregressive Flow for Density Estimation`_.
.. _Masked Autoregressive Flow for Density Estimation:
https://arxi... | 2.75 | 3 |
olctools/accessoryFunctions/metadataprinter.py | lowandrew/OLCTools | 1 | 6611 | <filename>olctools/accessoryFunctions/metadataprinter.py
#!/usr/bin/env python3
import logging
import json
import os
__author__ = 'adamkoziol'
class MetadataPrinter(object):
def printmetadata(self):
# Iterate through each sample in the analysis
for sample in self.metadata:
# Set the n... | 2.890625 | 3 |
mindware/estimators.py | aman-gupta-1995/Machine-Learning-Mindware | 27 | 6612 | import numpy as np
from sklearn.utils.multiclass import type_of_target
from mindware.base_estimator import BaseEstimator
from mindware.components.utils.constants import type_dict, MULTILABEL_CLS, IMG_CLS, TEXT_CLS, OBJECT_DET
from mindware.components.feature_engineering.transformation_graph import DataNode
class Clas... | 2.46875 | 2 |
AnimeSpider/spiders/AinmeLinkList.py | xiaowenwen1995/AnimeSpider | 7 | 6613 | # -*- coding: utf-8 -*-
import scrapy
import json
import os
import codecs
from AnimeSpider.items import AnimespiderItem
class AinmelinklistSpider(scrapy.Spider):
name = 'AinmeLinkList'
allowed_domains = ['bilibili.com']
start_urls = ['http://bilibili.com/']
def start_requests(self):
jsonpath ... | 2.8125 | 3 |
Module 1/Chapter 7/prog1.py | PacktPublishing/Raspberry-Pi-Making-Amazing-Projects-Right-from-Scratch- | 3 | 6614 | <reponame>PacktPublishing/Raspberry-Pi-Making-Amazing-Projects-Right-from-Scratch-
import cv2
print cv2.__version__
| 1.101563 | 1 |
setup.py | darlenew/pytest-testplan | 0 | 6615 | """Setup for pytest-testplan plugin."""
from setuptools import setup
setup(
name='pytest-testplan',
version='0.1.0',
description='A pytest plugin to generate a CSV test report.',
author='<NAME>',
author_email='<EMAIL>',
license='MIT',
py_modules=['pytest_testplan'],
install_requires=['... | 1.289063 | 1 |
examples/industrial_quality_inspection/train_yolov3.py | petr-kalinin/PaddleX | 1 | 6616 | <reponame>petr-kalinin/PaddleX
# 环境变量配置,用于控制是否使用GPU
# 说明文档:https://paddlex.readthedocs.io/zh_CN/develop/appendix/parameters.html#gpu
import os
os.environ['CUDA_VISIBLE_DEVICES'] = '0'
from paddlex.det import transforms
import paddlex as pdx
# 下载和解压铝材缺陷检测数据集
aluminum_dataset = 'https://bj.bcebos.com/paddlex/examples/i... | 2.296875 | 2 |
api/migrations/0004_auto_20210107_2032.py | bartoszper/Django-REST-API-movierater | 0 | 6617 | # Generated by Django 3.1.4 on 2021-01-07 19:32
from django.db import migrations, models
import django.db.models.deletion
class Migration(migrations.Migration):
dependencies = [
('api', '0003_auto_20210107_2010'),
]
operations = [
migrations.AlterField(
model_name='extrainfo... | 1.703125 | 2 |
wooey/migrations/0009_script_versioning.py | macdaliot/Wooey | 1 | 6618 | <gh_stars>1-10
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import models, migrations
import wooey.models.mixins
class Migration(migrations.Migration):
dependencies = [
('wooey', '0008_short_param_admin'),
]
operations = [
migrations.CreateModel(
... | 1.765625 | 2 |
vendor/munkireport/firewall/scripts/firewall.py | menamegaly/MR | 0 | 6619 | #!/usr/bin/python
"""
Firewall for munkireport.
By Tuxudo
Will return all details about how the firewall is configured
"""
import subprocess
import os
import sys
import platform
import re
import plistlib
import json
sys.path.insert(0,'/usr/local/munki')
sys.path.insert(0, '/usr/local/munkireport')
from munkilib impo... | 2.4375 | 2 |
cf_step/metrics.py | dpoulopoulos/cf_step | 25 | 6620 | <reponame>dpoulopoulos/cf_step<gh_stars>10-100
# AUTOGENERATED! DO NOT EDIT! File to edit: nbs/metrics.ipynb (unless otherwise specified).
__all__ = ['recall_at_k', 'precision_at_k']
# Cell
from typing import List
# Cell
def recall_at_k(predictions: List[int], targets: List[int], k: int = 10) -> float:
"""Comput... | 2.265625 | 2 |
bicycleparameters/period.py | sandertyu/Simple-Geometry-Plot | 20 | 6621 | <reponame>sandertyu/Simple-Geometry-Plot<filename>bicycleparameters/period.py
#!/usr/bin/env/ python
import os
from math import pi
import numpy as np
from numpy import ma
from scipy.optimize import leastsq
import matplotlib.pyplot as plt
from uncertainties import ufloat
# local modules
from .io import load_pendulum_... | 2.875 | 3 |
tectosaur2/analyze.py | tbenthompson/BIE_tutorials | 1 | 6622 | import time
import warnings
import matplotlib.pyplot as plt
import numpy as np
import sympy as sp
from .global_qbx import global_qbx_self
from .mesh import apply_interp_mat, gauss_rule, panelize_symbolic_surface, upsample
def find_dcutoff_refine(kernel, src, tol, plot=False):
# prep step 1: find d_cutoff and d_... | 1.8125 | 2 |
celery-getting-started/celeryconfig.py | hustbeta/python-examples | 0 | 6623 | <gh_stars>0
# -*- coding: utf-8 -*-
BROKER_URL = 'amqp://guest@localhost//'
CELERY_ACCEPT_CONTENT = ['json'],
CELERY_RESULT_BACKEND = 'amqp://guest@localhost//'
CELERY_RESULT_SERIALIZER = 'json'
CELERY_TASK_SERIALIZER = 'json'
CELERY_TIMEZONE = 'Asia/Shanghai'
CELERY_ENABLE_UTC = False
| 1.515625 | 2 |
smartnlp/utils/basic_log.py | msgi/nlp-tour | 1,559 | 6624 | import logging as log
class Log:
def __init__(self, level):
self.level = level
log.basicConfig(format='%(asctime)s - %(pathname)s[line:%(lineno)d] - %(levelname)s: %(message)s',
level=level)
self.log = log
def info(self, msg):
self.log.info(msg)
de... | 3.15625 | 3 |
people/losses-bkp.py | dluvizon/3d-pose-consensus | 5 | 6625 | <gh_stars>1-10
def structural_loss_dst68j3d(p_pred, v_pred):
v_pred = K.stop_gradient(v_pred)
def getlength(v):
return K.sqrt(K.sum(K.square(v), axis=-1))
"""Arms segments"""
joints_arms = p_pred[:, :, 16:37+1, :]
conf_arms = v_pred[:, :, 16:37+1]
diff_arms_r = joints_arms[:, :, 2:-... | 2.015625 | 2 |
Examples/IMAP/FilteringMessagesFromIMAPMailbox.py | Muzammil-khan/Aspose.Email-Python-Dotnet | 5 | 6626 | import aspose.email
from aspose.email.clients.imap import ImapClient
from aspose.email.clients import SecurityOptions
from aspose.email.clients.imap import ImapQueryBuilder
import datetime as dt
def run():
dataDir = ""
#ExStart: FetchEmailMessageFromServer
client = ImapClient("imap.gmail.com", 993, "user... | 2.640625 | 3 |
Python.FancyBear/settings.py | 010001111/Vx-Suites | 2 | 6627 | # Server UID
SERVER_UID = 45158729
# Setup Logging system #########################################
#
import os
from FileConsoleLogger import FileConsoleLogger
ServerLogger = FileConsoleLogger( os.path.join(os.path.dirname(os.path.abspath(__file__)), "_w3server.log") )
W3Logger = FileConsoleLogger( os.path.join(os.pa... | 1.8125 | 2 |
tools/fileinfo/features/certificates-info/test.py | HoundThe/retdec-regression-tests | 0 | 6628 | <gh_stars>0
from regression_tests import *
class Test1(Test):
settings = TestSettings(
tool='fileinfo',
input='8b280f2b7788520de214fa8d6ea32a30ebb2a51038381448939530fd0f7dfc16',
args='--json --verbose'
)
def test_certificates(self):
assert self.fileinfo.succeeded
... | 2.21875 | 2 |
app/darn.py | AmitSrourDev/darn | 0 | 6629 | import subprocess
def run(cmd):
subprocess.run(cmd.split(' '))
def ls():
subprocess.call(["ls", "-l"]) | 2.109375 | 2 |
virt/ansible-latest/lib/python2.7/site-packages/ansible/plugins/become/runas.py | lakhlaifi/RedHat-Ansible | 1 | 6630 | # -*- coding: utf-8 -*-
# Copyright: (c) 2018, Ansible Project
# GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt)
from __future__ import (absolute_import, division, print_function)
__metaclass__ = type
DOCUMENTATION = """
become: runas
short_description: Run As user
... | 1.703125 | 2 |
2017/lab_dh/utils.py | JustHitTheCore/ctf_workshops | 7 | 6631 | #!/usr/bin/env python
# -*- coding: utf-8 -*-
'''
~Gros
'''
from hashlib import sha256
import random
def add_padding(data, block_size=16):
"""add PKCS#7 padding"""
size = block_size - (len(data)%block_size)
return data+chr(size)*size
def strip_padding(data, block_size=16):
"""strip PKCS#7 padding"... | 3.21875 | 3 |
applications/cli/commands/model/tests/test_export.py | nparkstar/nauta | 390 | 6632 | #
# Copyright (c) 2019 Intel Corporation
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to... | 1.84375 | 2 |
var/spack/repos/builtin/packages/py-mdanalysis/package.py | LiamBindle/spack | 2,360 | 6633 | # Copyright 2013-2021 Lawrence Livermore National Security, LLC and other
# Spack Project Developers. See the top-level COPYRIGHT file for details.
#
# SPDX-License-Identifier: (Apache-2.0 OR MIT)
from spack import *
class PyMdanalysis(PythonPackage):
"""MDAnalysis is a Python toolkit to analyze molecular dynami... | 1.359375 | 1 |
lesley-byte/graphpressure.py | lesley-byte/enviroplus-python | 0 | 6634 | from requests import get
import matplotlib.pyplot as plt
import matplotlib.animation as animation
import datetime as dt
from bme280 import BME280
try:
from smbus2 import SMBus
except ImportError:
from smbus import SMBus
fig = plt.figure()
ax = fig.add_subplot(1, 1, 1)
xs = []
ys =[]
bus = SMBus(1)
bme280 = ... | 2.875 | 3 |
bootstrapvz/plugins/ova/tasks.py | brett-smith/bootstrap-vz | 0 | 6635 | <reponame>brett-smith/bootstrap-vz<gh_stars>0
from bootstrapvz.base import Task
from bootstrapvz.common import phases
from bootstrapvz.common.tasks import workspace
import os
import shutil
assets = os.path.normpath(os.path.join(os.path.dirname(__file__), 'assets'))
class CheckOVAPath(Task):
description = 'Checking ... | 2.34375 | 2 |
docs/conf.py | PhilippJunk/homelette | 0 | 6636 | <gh_stars>0
# Configuration file for the Sphinx documentation builder.
#
# This file only contains a selection of the most common options. For a full
# list see the documentation:
# https://www.sphinx-doc.org/en/master/usage/configuration.html
# -- Path setup -----------------------------------------------------------... | 1.703125 | 2 |
bytecode2ast/parsers/bases.py | Cologler/bytecode2ast-python | 0 | 6637 | <gh_stars>0
# -*- coding: utf-8 -*-
#
# Copyright (c) 2019~2999 - Cologler <<EMAIL>>
# ----------
# some object for parser
# ----------
from typing import List
import enum
import dis
from collections import defaultdict
class ID:
def __init__(self, name):
self._name = name # a name use to debug
def _... | 2.640625 | 3 |
netbox/extras/forms.py | orphanedgamboa/netbox | 1 | 6638 | <filename>netbox/extras/forms.py
from django import forms
from django.contrib.auth.models import User
from django.contrib.contenttypes.models import ContentType
from django.utils.safestring import mark_safe
from django.utils.translation import gettext as _
from dcim.models import DeviceRole, DeviceType, Platform, Regi... | 2.09375 | 2 |
unwarp_models.py | zgjslc/Film-Recovery-master1 | 0 | 6639 | import torch
import torch.nn as nn
import torch.nn.functional as F
from models.misc import modules
constrain_path = {
('threeD', 'normal'): (True, True, ''),
('threeD', 'depth'): (True, True, ''),
('normal', 'depth'): (True, True, ''),
('depth', 'normal'): (True, True, ''),
}
class UnwarpNet(nn.Modu... | 2.046875 | 2 |
endpoint/test_endpoint/update.py | pansila/Auto-Test-System | 14 | 6640 | <filename>endpoint/test_endpoint/update.py
import configparser
import os
import hashlib
import json
import shutil
import sys
import tempfile
import subprocess
import tarfile
import re
import stat
from functools import cmp_to_key
from contextlib import closing
from gzip import GzipFile
from pathlib import Path
from urll... | 2.125 | 2 |
lib/jbgp/jbgpneighbor.py | routedo/junos-pyez-example | 0 | 6641 | <gh_stars>0
"""
Query BGP neighbor table on a Juniper network device.
"""
import sys
from jnpr.junos import Device
from jnpr.junos.factory import loadyaml
def juniper_bgp_state(dev, bgp_neighbor):
"""
This function queries the BGP neighbor table on a Juniper network device.
dev = Juniper device connectio... | 2.390625 | 2 |
lib/cherrypy/cherrypy/test/test_sessionauthenticate.py | MiCHiLU/google_appengine_sdk | 790 | 6642 | <gh_stars>100-1000
import cherrypy
from cherrypy.test import helper
class SessionAuthenticateTest(helper.CPWebCase):
def setup_server():
def check(username, password):
# Dummy check_username_and_password function
if username != 'test' or password != 'password':
... | 2.453125 | 2 |
2021/day-12/solve.py | amochtar/adventofcode | 1 | 6643 | #!/usr/bin/env python
from typing import List
import aoc
from collections import defaultdict
@aoc.timing
def solve(inp: str, part2=False):
def find_path(current: str, path: List[str] = []):
if current == 'end':
yield path
return
for nxt in caves[current]:
if n... | 3.4375 | 3 |
PaddleCV/tracking/ltr/data/processing.py | suytingwan/models | 5 | 6644 | <gh_stars>1-10
import numpy as np
from ltr.data import transforms
import ltr.data.processing_utils as prutils
from pytracking.libs import TensorDict
class BaseProcessing:
""" Base class for Processing. Processing class is used to process the data returned by a dataset, before passing it
through the... | 3.09375 | 3 |
tqcli/config/config.py | Tranquant/tqcli | 0 | 6645 | <reponame>Tranquant/tqcli
import logging
from os.path import expanduser
#TQ_API_ROOT_URL = 'http://127.0.1.1:8090/dataset'
TQ_API_ROOT_URL = 'http://elb-tranquant-ecs-cluster-tqapi-1919110681.us-west-2.elb.amazonaws.com/dataset'
LOG_PATH = expanduser('~/tqcli.log')
# the chunk size must be at least 5MB for multipart ... | 2.21875 | 2 |
fqf_iqn_qrdqn/agent/base_agent.py | rainwangphy/fqf-iqn-qrdqn.pytorch | 0 | 6646 | <gh_stars>0
from abc import ABC, abstractmethod
import os
import numpy as np
import torch
from torch.utils.tensorboard import SummaryWriter
from fqf_iqn_qrdqn.memory import LazyMultiStepMemory, \
LazyPrioritizedMultiStepMemory
from fqf_iqn_qrdqn.utils import RunningMeanStats, LinearAnneaer
class BaseAgent(ABC):
... | 2.046875 | 2 |
Python/libraries/recognizers-date-time/recognizers_date_time/date_time/italian/timeperiod_extractor_config.py | felaray/Recognizers-Text | 0 | 6647 | # Copyright (c) Microsoft Corporation. All rights reserved.
# Licensed under the MIT License.
from typing import List, Pattern
from recognizers_text.utilities import RegExpUtility
from recognizers_text.extractor import Extractor
from recognizers_number.number.italian.extractors import ItalianIntegerExtractor
from .... | 2.25 | 2 |
quartet_condor.py | BotanyHunter/QuartetAnalysis | 0 | 6648 | <reponame>BotanyHunter/QuartetAnalysis
#quartet_condor.py
#version 2.0.2
import random, sys
def addToDict(d):
'''
Ensures each quartet has three concordance factors (CFs)
a dictionary d has less than three CFs, add CFs with the value 0 until there are three
Input: a dictionary containing CFs, a count... | 3.234375 | 3 |
src/profiles/forms.py | rahulroshan96/CloudVisual | 0 | 6649 | <gh_stars>0
from django import forms
from models import UserInputModel
class UserInputForm(forms.ModelForm):
class Meta:
model = UserInputModel
fields = ['user_input'] | 1.960938 | 2 |
tests_oval_graph/test_arf_xml_parser/test_arf_xml_parser.py | Honny1/oval-graph | 21 | 6650 | from pathlib import Path
import pytest
from oval_graph.arf_xml_parser.arf_xml_parser import ARFXMLParser
def get_arf_report_path(src="global_test_data/ssg-fedora-ds-arf.xml"):
return str(Path(__file__).parent.parent / src)
@pytest.mark.parametrize("rule_id, result", [
(
"xccdf_org.ssgproject.conte... | 2.15625 | 2 |
main.py | scottjr632/trump-twitter-bot | 0 | 6651 | import os
import logging
import argparse
import sys
import signal
import subprocess
from functools import wraps
from dotenv import load_dotenv
load_dotenv(verbose=True)
from app.config import configure_app
from app.bot import TrumpBotScheduler
from app.sentimentbot import SentimentBot
parser = argparse.ArgumentParse... | 2.140625 | 2 |
010-summation-of-primes.py | dendi239/euler | 0 | 6652 | #! /usr/bin/env python3
import itertools
import typing as tp
def primes() -> tp.Generator[int, None, None]:
primes_ = []
d = 2
while True:
is_prime = True
for p in primes_:
if p * p > d:
break
if d % p == 0:
is_prime = False
... | 3.9375 | 4 |
setup.py | letmaik/lensfunpy | 94 | 6653 | from setuptools import setup, Extension, find_packages
import subprocess
import errno
import re
import os
import shutil
import sys
import zipfile
from urllib.request import urlretrieve
import numpy
from Cython.Build import cythonize
isWindows = os.name == 'nt'
isMac = sys.platform == 'darwin'
is64Bit = sys.maxsize... | 1.78125 | 2 |
chapter_13/mailtools/__init__.py | bimri/programming_python | 0 | 6654 | <gh_stars>0
"The mailtools Utility Package"
'Initialization File'
"""
##################################################################################
mailtools package: interface to mail server transfers, used by pymail2, PyMailGUI,
and PyMailCGI; does loads, sends, parsing, composing, and deleting, with part
at... | 1.429688 | 1 |
TreeModelLib/BelowgroundCompetition/__init__.py | jvollhueter/pyMANGA-1 | 0 | 6655 | <reponame>jvollhueter/pyMANGA-1
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Created on Thu Nov 8 15:25:03 2018
@author: bathmann
"""
from .BelowgroundCompetition import BelowgroundCompetition
from .SimpleTest import SimpleTest
from .FON import FON
from .OGSWithoutFeedback import OGSWithoutFeedback
from .OGSLa... | 1.03125 | 1 |
server.py | SDelhey/websocket-chat | 0 | 6656 | <reponame>SDelhey/websocket-chat
from flask import Flask, render_template
from flask_socketio import SocketIO, send, emit
app = Flask(__name__)
app.config['SECRET_KEY'] = 'secret!'
socketio = SocketIO(app)
if __name__ == '__main__':
socketio.run(app) | 2.109375 | 2 |
services/postprocess/src/postprocess.py | hadarohana/myCosmos | 0 | 6657 | """
Post processing on detected objects
"""
import pymongo
from pymongo import MongoClient
import time
import logging
logging.basicConfig(format='%(levelname)s :: %(asctime)s :: %(message)s', level=logging.DEBUG)
from joblib import Parallel, delayed
import click
from xgboost_model.inference import run_inference, Postpr... | 2.375 | 2 |
model-optimizer/mo/front/common/partial_infer/multi_box_prior_test.py | calvinfeng/openvino | 0 | 6658 | <reponame>calvinfeng/openvino
"""
Copyright (C) 2018-2021 Intel Corporation
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by... | 1.359375 | 1 |
bin/mem_monitor.py | Samahu/ros-system-monitor | 68 | 6659 | <reponame>Samahu/ros-system-monitor<filename>bin/mem_monitor.py
#!/usr/bin/env python
############################################################################
# Copyright (C) 2009, <NAME>, Inc. #
# Copyright (C) 2013 by <NAME> #
# <EMAIL> ... | 1.28125 | 1 |
cmake/utils/gen-ninja-deps.py | stamhe/bitcoin-abc | 1,266 | 6660 | <filename>cmake/utils/gen-ninja-deps.py
#!/usr/bin/env python3
import argparse
import os
import subprocess
parser = argparse.ArgumentParser(description='Produce a dep file from ninja.')
parser.add_argument(
'--build-dir',
help='The build directory.',
required=True)
parser.add_argument(
'--base-dir',
... | 2.34375 | 2 |
src/webpy1/src/manage/checkPic.py | ptphp/PyLib | 1 | 6661 | <gh_stars>1-10
'''
Created on 2011-6-22
@author: dholer
'''
| 1.085938 | 1 |
tests/__init__.py | coleb/sendoff | 2 | 6662 | """Tests for the `sendoff` library."""
"""
The `sendoff` library tests validate the expected function of the library.
"""
| 0.894531 | 1 |
sysinv/sysinv/sysinv/sysinv/helm/garbd.py | Wind-River/starlingx-config | 0 | 6663 | #
# Copyright (c) 2018-2019 Wind River Systems, Inc.
#
# SPDX-License-Identifier: Apache-2.0
#
from sysinv.common import constants
from sysinv.common import exception
from sysinv.common import utils
from sysinv.helm import common
from sysinv.helm import base
class GarbdHelm(base.BaseHelm):
"""Class to encapsulat... | 1.828125 | 2 |
dataloader/frame_counter/frame_counter.py | aaron-zou/pretraining-twostream | 0 | 6664 | #!/usr/bin/env python
"""Generate frame counts dict for a dataset.
Usage:
frame_counter.py [options]
Options:
-h, --help Print help message
--root=<str> Path to root of dataset (should contain video folders that contain images)
[default: /vision/vision_users/azou/data/hmdb5... | 3.109375 | 3 |
Problem_30/main.py | jdalzatec/EulerProject | 1 | 6665 | total = 0
for n in range(1000, 1000000):
suma = 0
for i in str(n):
suma += int(i)**5
if (n == suma):
total += n
print(total) | 3.515625 | 4 |
armi/physics/fuelCycle/settings.py | celikten/armi | 1 | 6666 | <gh_stars>1-10
"""Settings for generic fuel cycle code."""
import re
import os
from armi.settings import setting
from armi.operators import settingsValidation
CONF_ASSEMBLY_ROTATION_ALG = "assemblyRotationAlgorithm"
CONF_ASSEM_ROTATION_STATIONARY = "assemblyRotationStationary"
CONF_CIRCULAR_RING_MODE = "circularRingM... | 2.296875 | 2 |
nl/predictor.py | jclosure/donkus | 1 | 6667 | <gh_stars>1-10
from nltk.corpus import gutenberg
from nltk import ConditionalFreqDist
from random import choice
#create the distribution object
cfd = ConditionalFreqDist()
## for each token count the current word given the previous word
prev_word = None
for word in gutenberg.words('austen-persuasion.txt'):
cfd[p... | 3.578125 | 4 |
eve/workers/pykmip/bin/run_server.py | mmg-3/cloudserver | 762 | 6668 | #!/usr/bin/env python
# Copyright (c) 2016 The Johns Hopkins University/Applied Physics Laboratory
# 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.ap... | 1.9375 | 2 |
tests/test_tempo_event.py | yokaze/crest-python | 0 | 6669 | #
# test_tempo_event.py
# crest-python
#
# Copyright (C) 2017 <NAME>
# Distributed under the MIT License.
#
import crest_loader
import unittest
from crest.events.meta import TempoEvent
class TestTempoEvent(unittest.TestCase):
def test_ctor(self):
TempoEvent()
TempoEvent(120)
def test_... | 2.421875 | 2 |
tensorflow_quantum/python/differentiators/__init__.py | PyJedi/quantum | 1,501 | 6670 | <gh_stars>1000+
# Copyright 2020 The TensorFlow Quantum 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
#
# Un... | 1.96875 | 2 |
tests/test_color_background.py | erykoff/redmapper | 17 | 6671 | <reponame>erykoff/redmapper
import unittest
import numpy.testing as testing
import numpy as np
import fitsio
import tempfile
import os
from redmapper import ColorBackground
from redmapper import ColorBackgroundGenerator
from redmapper import Configuration
class ColorBackgroundTestCase(unittest.TestCase):
"""
... | 2.5625 | 3 |
src/metpy/calc/basic.py | Exi666/MetPy | 0 | 6672 | # Copyright (c) 2008,2015,2016,2017,2018,2019 MetPy Developers.
# Distributed under the terms of the BSD 3-Clause License.
# SPDX-License-Identifier: BSD-3-Clause
"""Contains a collection of basic calculations.
These include:
* wind components
* heat index
* windchill
"""
import warnings
import numpy as np
from scip... | 3.234375 | 3 |
burl/core/api/views.py | wryfi/burl | 1 | 6673 | from rest_framework.response import Response
from rest_framework.decorators import api_view
from rest_framework.reverse import reverse
from rest_framework_simplejwt.tokens import RefreshToken
@api_view(['GET'])
def root(request, fmt=None):
return Response({
'v1': reverse('api_v1:root', request=request, fo... | 2.375 | 2 |
ITmeetups_back/api/serializers.py | RomulusGwelt/AngularProject | 3 | 6674 | from rest_framework import serializers
from .models import Post, Comment, Like
from django.contrib.auth.models import User
class CurrentUserSerializer(serializers.ModelSerializer):
class Meta:
model = User
fields = ('id', 'username', 'email')
class PostSerializer(serializers.ModelSerializer):
... | 2.34375 | 2 |
qurator/sbb_ned/embeddings/bert.py | qurator-spk/sbb_ned | 6 | 6675 | <reponame>qurator-spk/sbb_ned
from ..embeddings.base import Embeddings
from flair.data import Sentence
class BertEmbeddings(Embeddings):
def __init__(self, model_path,
layers="-1, -2, -3, -4", pooling_operation='first', use_scalar_mix=True, no_cuda=False, *args, **kwargs):
super(BertEm... | 2.015625 | 2 |
Arbitrage_Future/Arbitrage_Future/test.py | ronaldzgithub/CryptoArbitrage | 1 | 6676 | <reponame>ronaldzgithub/CryptoArbitrage<filename>Arbitrage_Future/Arbitrage_Future/test.py
# !/usr/local/bin/python
# -*- coding:utf-8 -*-
import YunBi
import CNBTC
import json
import threading
import Queue
import time
import logging
import numpy
import message
import random
open_platform = [True,True,True,True]
numpy.... | 2.171875 | 2 |
startuptweet.py | cudmore/startupnotify | 0 | 6677 | #!/usr/bin/python3
"""
Author: <NAME>
Date: 20181013
Purpose: Send a Tweet with IP and MAC address of a Raspberry Pi
Install:
pip3 install tweepy
Usage:
python3 startuptweet.py 'this is my tweet'
"""
import tweepy
import sys
import socket
import subprocess
from uuid import getnode as get_mac
from datetime import da... | 3.375 | 3 |
distributed/db.py | VW-Stephen/pySpiderScrape | 0 | 6678 | #!/usr/bin/python
from bs4 import BeautifulSoup
import sqlite3
class DB:
"""
Abstraction for the profile database
"""
def __init__(self, filename):
"""
Creates a new connection to the database
filename - The name of the database file to use
"""
self.Filename = ... | 3.390625 | 3 |
private/scripts/recheck-invalid-handles.py | bansal-shubham/stopstalk-deployment | 0 | 6679 | """
Copyright (c) 2015-2019 <NAME>(<EMAIL>), StopStalk
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy... | 1.914063 | 2 |
onnxmltools/convert/keras/_parse.py | gpminsuk/onnxmltools | 1 | 6680 | # -------------------------------------------------------------------------
# Copyright (c) Microsoft Corporation. All rights reserved.
# Licensed under the MIT License. See License.txt in the project root for
# license information.
# --------------------------------------------------------------------------
import te... | 2.421875 | 2 |
src/scenic/core/regions.py | cahartsell/Scenic | 0 | 6681 | """Objects representing regions in space."""
import math
import random
import itertools
import numpy
import scipy.spatial
import shapely.geometry
import shapely.ops
from scenic.core.distributions import Samplable, RejectionException, needsSampling
from scenic.core.lazy_eval import valueInContext
from scenic.core.vec... | 2.34375 | 2 |
orangery/cli/cutfill.py | mrahnis/orangery | 2 | 6682 | #!/usr/bin/env python
# -*- coding: utf-8 -*-
import sys
import logging
import time
import json
import click
import matplotlib.pyplot as plt
import orangery as o
from orangery.cli import defaults, util
from orangery.tools.plotting import get_scale_factor
@click.command(options_metavar='<options>')
@click.argument(... | 2.484375 | 2 |
src/ice_g2p/dictionaries.py | cadia-lvl/ice-g2p | 0 | 6683 | import os, sys
DICTIONARY_FILE = os.path.join(sys.prefix, 'dictionaries/ice_pron_dict_standard_clear.csv')
HEAD_FILE = os.path.join(sys.prefix, 'data/head_map.csv')
MODIFIER_FILE = os.path.join(sys.prefix, 'data/modifier_map.csv')
VOWELS_FILE = os.path.join(sys.prefix, 'data/vowels_sampa.txt')
CONS_CLUSTERS_FILE = os.p... | 3.109375 | 3 |
tests/test_annotations_notebook.py | jeromedockes/pylabelbuddy | 0 | 6684 | from pylabelbuddy import _annotations_notebook
def test_annotations_notebook(root, annotations_mock, dataset_mock):
nb = _annotations_notebook.AnnotationsNotebook(
root, annotations_mock, dataset_mock
)
nb.change_database()
assert nb.notebook.index(nb.notebook.select()) == 2
nb.go_to_annot... | 1.804688 | 2 |
py/solns/wordSearch/wordSearch.py | zcemycl/algoTest | 1 | 6685 | <reponame>zcemycl/algoTest
class Solution:
@staticmethod
def naive(board,word):
rows,cols,n = len(board),len(board[0]),len(word)
visited = set()
def dfs(i,j,k):
idf = str(i)+','+str(j)
if i<0 or j<0 or i>cols-1 or j>rows-1 or \
board[j][i]!=word[k]... | 3.46875 | 3 |
middleware/run.py | natedogg484/react-flask-authentication | 0 | 6686 | <reponame>natedogg484/react-flask-authentication
from flask import Flask
from flask_cors import CORS
from flask_restful import Api
from flask_sqlalchemy import SQLAlchemy
from flask_jwt_extended import JWTManager
app = Flask(__name__)
CORS(app)
api = Api(app)
app.config['SQLALCHEMY_DATABASE_URI'] = 'sqlite:///app.d... | 2.71875 | 3 |
Programas do Curso/Desafio 2.py | carvalhopedro22/Programas-em-python-cursos-e-geral- | 0 | 6687 | <filename>Programas do Curso/Desafio 2.py
nome = input('Qual o seu nome? ')
dia = input('Que dia do mês você nasceu? ')
mes = input('Qual o mês em que você nasceu? ')
ano = input('Qual o ano em que você nasceu? ')
print(nome, 'nasceu em', dia,'de',mes,'do ano',ano) | 4.15625 | 4 |
cmibs/cisco_vlan_membership_mib.py | prorevizor/noc | 84 | 6688 | # ----------------------------------------------------------------------
# CISCO-VLAN-MEMBERSHIP-MIB
# Compiled MIB
# Do not modify this file directly
# Run ./noc mib make-cmib instead
# ----------------------------------------------------------------------
# Copyright (C) 2007-2020 The NOC Project
# See LICENSE for de... | 1.507813 | 2 |
harbor/tests/test_unit.py | tdimnet/integrations-core | 663 | 6689 | # (C) Datadog, Inc. 2019-present
# All rights reserved
# Licensed under a 3-clause BSD style license (see LICENSE)
import pytest
from mock import MagicMock
from requests import HTTPError
from datadog_checks.base import AgentCheck
from datadog_checks.dev.http import MockResponse
from .common import HARBOR_COMPONENTS, ... | 2 | 2 |
M-SPRING/template/adapter.py | CN-UPB/SPRING | 3 | 6690 | # module for adapting templates on the fly if components are reused
# check that all reused components are defined consistently -> else: exception
def check_consistency(components):
for j1 in components:
for j2 in components: # compare all components
if j1 == j2 and j1.__dict__ != j2.__dict__: # same n... | 2.734375 | 3 |
column_completer.py | AllanLRH/column_completer | 0 | 6691 | <reponame>AllanLRH/column_completer
class ColumnCompleter(object):
"""Complete Pandas DataFrame column names"""
def __init__(self, df, space_filler='_', silence_warnings=False):
"""
Once instantiated with a Pandas DataFrame, it will expose the column
names as attributes which maps to t... | 3.265625 | 3 |
source/vsm-dashboard/vsm_dashboard/test/test_data/swift_data.py | ramkrsna/virtual-storage-manager | 172 | 6692 | # Copyright 2012 Nebula, Inc.
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the License. You may obtain
# a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agree... | 1.734375 | 2 |
cinder/backup/driver.py | liangintel/stx-cinder | 0 | 6693 | # Copyright (C) 2013 Deutsche Telekom AG
# 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... | 1.570313 | 2 |
__init__.py | ENDERZOMBI102/chained | 0 | 6694 | <reponame>ENDERZOMBI102/chained<filename>__init__.py<gh_stars>0
from .chainOpen import chainOpen
__all__ = [
'chainOpen'
] | 1.03125 | 1 |
code/reasoningtool/tests/QuerySciGraphTests.py | andrewsu/RTX | 31 | 6695 | import unittest
from QuerySciGraph import QuerySciGraph
class QuerySciGraphTestCase(unittest.TestCase):
def test_get_disont_ids_for_mesh_id(self):
disont_ids = QuerySciGraph.get_disont_ids_for_mesh_id('MESH:D005199')
known_ids = {'DOID:13636'}
self.assertSetEqual(disont_ids, known_ids)
... | 2.765625 | 3 |
ledis/cli.py | gianghta/Ledis | 0 | 6696 | from typing import Any
from ledis import Ledis
from ledis.exceptions import InvalidUsage
class CLI:
__slots__ = {"ledis", "commands"}
def __init__(self):
self.ledis = Ledis()
self.commands = {
"set": self.ledis.set,
"get": self.ledis.get,
"sadd": self.ledi... | 2.84375 | 3 |
ClosedLoopTF.py | nazhanshaberi/miniature-octo-barnacle | 0 | 6697 | #group 1: Question 1(b)
# A control system for positioning the head of a laser printer has the closed loop transfer function:
# !pip install control
import matplotlib.pyplot as plt
import control
a=10 #Value for a
b=50 #value for b
sys1 = control.tf(20*b,[1,20+a,b+20*a,20*b])
print('3rd order system transfer funct... | 3.734375 | 4 |
example_project/test_messages/bbcode_tags.py | bastiedotorg/django-precise-bbcode | 30 | 6698 | import re
from precise_bbcode.bbcode.tag import BBCodeTag
from precise_bbcode.tag_pool import tag_pool
color_re = re.compile(r'^([a-z]+|#[0-9abcdefABCDEF]{3,6})$')
class SubTag(BBCodeTag):
name = 'sub'
def render(self, value, option=None, parent=None):
return '<sub>%s</sub>' % value
class PreTag... | 2.53125 | 3 |
tests/test_vmtkScripts/test_vmtksurfacescaling.py | ramtingh/vmtk | 0 | 6699 | ## Program: VMTK
## Language: Python
## Date: January 10, 2018
## Version: 1.4
## Copyright (c) <NAME>, <NAME>, All rights reserved.
## See LICENSE file for details.
## This software is distributed WITHOUT ANY WARRANTY; without even
## the implied warranty of MERCHANTABILITY or FITNESS FOR A PAR... | 2 | 2 |