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 |
|---|---|---|---|---|---|---|
rmtt_tracker/scripts/roi_tracker.py | cavayangtao/rmtt_ros | 0 | 19800 | #!/usr/bin/python3
# coding=utf-8
# 环境准备:pip install opencv_contrib_python
# 输入话题:tianbot_mini/image_raw/compressed
# 输出话题:roi
import sys
import os
import rospy
import sensor_msgs.msg
from cv_bridge import CvBridge
import cv2
import numpy as np
from sensor_msgs.msg import RegionOfInterest as ROI
from sensor_msgs.msg ... | 2.5 | 2 |
api-scanner/method_analysis_job.py | ybqdren/Python-JavaAPI-Scanner | 0 | 19801 | # -*- coding:utf-8 -*-
# @Author: ZhaoWen <<EMAIL>>
# @Date: 2021/1/2
# @GiteePath: https://gitee.com/openeuler2020/team-1186152014
from method_analysis_utils.scanner import get_scanner,token_type
import os
import logging.config
from method_analysis_utils.complier import get_complier
# 配置日志
logging.config.fileConfi... | 2.25 | 2 |
ksteta3pi/Consideredbkg/MC_12_11134011_MagUp.py | Williams224/davinci-scripts | 0 | 19802 | <gh_stars>0
#-- GAUDI jobOptions generated on Mon Jul 20 10:20:49 2015
#-- Contains event types :
#-- 11134011 - 42 files - 900254 events - 251.92 GBytes
#-- Extra information about the data processing phases:
#-- Processing Pass Step-125836
#-- StepId : 125836
#-- StepName : Stripping20-NoPrescalingFlagg... | 1.53125 | 2 |
pyqtree.py | GuillemHerrera/Pyqtree | 0 | 19803 | <filename>pyqtree.py
"""
# Pyqtree
Pyqtree is a pure Python spatial index for GIS or rendering usage.
It stores and quickly retrieves items from a 2x2 rectangular grid area,
and grows in depth and detail as more items are added.
The actual quad tree implementation is adapted from
[Matt Rasmussen's compbio library](htt... | 3.25 | 3 |
Day10/calci.py | viditvarshney/100DaysOfCode | 0 | 19804 | <reponame>viditvarshney/100DaysOfCode
from logo import logo
def add(n1, n2):
return n1 + n2
def multiply(n1, n2):
return n1 * n2
def subtract(n1, n2):
return n1 - n2
def divide(n1, n2):
return n1 / n2
symbols = ['+', '-', '/', '*']
operations = {'+': add, '-': subtract,
'*': mult... | 3.796875 | 4 |
shoptimizer_api/optimizers_builtin/condition_optimizer.py | leozz37/shoptimizer | 0 | 19805 | <filename>shoptimizer_api/optimizers_builtin/condition_optimizer.py
# coding=utf-8
# Copyright 2020 Google LLC.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/l... | 2.390625 | 2 |
setup.py | comradepopo/p4rmyknife | 0 | 19806 | try:
from setuptools import setup
except ImportError:
from distutils.core import setup
'description': 'P4rmyKnife - The Swiss Army Knife for P4',
'author': 'Assembla, Inc.',
'url': 'https://assembla.com/'
'author_email': '<EMAIL>',
'version': '0.1',
'install_requires': [],
'packages... | 1.351563 | 1 |
utilities/readProperties.py | harry-100/qa-automation-framework | 0 | 19807 | from configparser import RawConfigParser
config = RawConfigParser()
config.read("configuration/config.ini")
class ReadConfig():
@staticmethod
def getApplicationURL():
url = (config.get('common info', 'baseURL'))
return url
@staticmethod
def getUserName():
username = (config.get('common info', 'username'))... | 2.796875 | 3 |
tinyq/__init__.py | mozillazg/tinyq | 14 | 19808 | # -*- coding: utf-8 -*-
from tinyq.app import Application # noqa
__version__ = '0.3.0'
__author__ = 'mozillazg'
__license__ = 'MIT'
__copyright__ = 'Copyright (c) 2017 mozillazg'
| 1.125 | 1 |
henrietta/tests/__init__.py | zkbt/henrietta | 0 | 19809 | from .test_lightcurves import *
from .test_statistics import *
from .test_models import *
from .test_fitting import *
from .test_tools import *
from .test_photometry import *
from .test_tpf import *
from .test_imaging import *
from .test_photometry import *
| 0.960938 | 1 |
personas.py | Ulzahk/Practica-Python-CRUD | 0 | 19810 | <gh_stars>0
class Person:
def __init__(self, name, age):
self.name = name
self.age = age
def say_hello(self):
print('Hello, my name is {} and I am {} years old'.format(self.name, self.age))
if __name__ == '__main__':
person = Person('David', 34)
print('Age: {}'.format(per... | 3.703125 | 4 |
python/right_couch_move.py | ktmock13/PiCouch | 0 | 19811 | <reponame>ktmock13/PiCouch<filename>python/right_couch_move.py
import RPi.GPIO as GPIO
from time import sleep
import sys
#setup
GPIO.setmode(GPIO.BOARD)
openRelay=11
closeRelay=13
GPIO.setup(openRelay, GPIO.OUT)
GPIO.setup(closeRelay, GPIO.OUT)
#get cmd args
duration = float(sys.argv[1])
opening = sys.argv[2] in ['tr... | 2.734375 | 3 |
lib/python3.7/site-packages/dash_bootstrap_components/_components/Popover.py | dukuaris/Django | 0 | 19812 | # AUTO GENERATED FILE - DO NOT EDIT
from dash.development.base_component import Component, _explicitize_args
class Popover(Component):
"""A Popover component.
Keyword arguments:
- children (a list of or a singular dash component, string or number; optional): The children of this component
- id (string; optiona... | 2.3125 | 2 |
aries_cloudagent/wallet/tests/test_key_pair.py | kuraakhilesh8230/aries-cloudagent-python | 247 | 19813 | <reponame>kuraakhilesh8230/aries-cloudagent-python
from asynctest import TestCase as AsyncTestCase
import json
from ...storage.error import StorageNotFoundError
from ..util import bytes_to_b58
from ..key_type import KeyType
from ...core.in_memory import InMemoryProfile
from ...storage.in_memory import InMemoryStorage... | 2.0625 | 2 |
sonipy/scales/frequency.py | Sabrina-Knappe/sonipy | 22 | 19814 | from __future__ import print_function
import warnings
import numpy as np
C4 = 261.6 # Hz
piano_max = 4186.01 # Hz
piano_min = 27.5000 # Hz - not audible
__all__ = ['cent_per_value','get_f_min','get_f_max','FrequencyScale']
def cent_per_value(f_min, f_max, v_min, v_max):
"""
This function takes in a freque... | 3.0625 | 3 |
core_admin/des/ccd/daemon.py | linea-it/tno | 0 | 19815 | from apscheduler.schedulers.background import BackgroundScheduler
from des.ccd import start_pipeline
def download_queue():
start_pipeline()
scheduler = BackgroundScheduler()
scheduler.add_job(
download_queue,
'interval',
# minutes=1
seconds=20,
max_instances=1,
id='des_download_ccd'
)
... | 2.15625 | 2 |
calc-app/input_console.py | t4d-classes/python_10042021 | 0 | 19816 | <filename>calc-app/input_console.py
from common.input import input_int, input_float
def get_operand():
return input_float("Please enter an operand: ")
def get_command():
return input("Enter a command: ")
def get_history_entry_id():
return input_int("Please enter a history entry id: ")
def get_histor... | 2.734375 | 3 |
tools/stimgen/gen_recall.py | herenvarno/gsbn | 2 | 19817 | #!/usr/bin/env python
import os
import sys
import re
import math
import random
import matplotlib.pyplot as plt
import numpy as np
from google.protobuf import text_format
sys.path.append(os.path.dirname(os.path.realpath(__file__))+"/../../build")
import gsbn_pb2
if len(sys.argv) < 1:
print("Arguments wrong! Please r... | 2.078125 | 2 |
python/find_country/city.py | lukasjoc/scritps | 1 | 19818 | #!/usr/bin/env python3
from geopy.geocoders import Nominatim
locator = Nominatim(user_agent="getcity")
loc = locator.geocode("Munich")
print(loc.latitude, loc.longitude)
| 3.296875 | 3 |
bitio/src/microbit/repl/repl.py | hungjuchen/Atmosmakers | 85 | 19819 | <filename>bitio/src/microbit/repl/repl.py<gh_stars>10-100
# repl/repl.py
#
# A REPL interface to a micro:bit or similar device running MicroPython
# This is written on top of pyserial, however the dependency on pyserial
# is soft (as the serial instance is passed in as a constructor parameter
# and the detection of the... | 2.84375 | 3 |
lib/connection/RequestException.py | Karaya-12/Website-Dir-Scanner | 3 | 19820 | <gh_stars>1-10
class RequestException(Exception):
pass
| 0.9375 | 1 |
src/cocoannot/annotpreferred/models.py | coco-tasks/annotation-tool | 9 | 19821 | from django.contrib.auth.models import User
from django.db import models
from markdownx.models import MarkdownxField
class Category(models.Model):
"""
Represents a COCO category
"""
coco_id = models.IntegerField(unique=True, db_index=True)
name = models.CharField(max_length=50)
supercategory =... | 2.484375 | 2 |
data/meterpreter/meterpreter.py | codex8/metasploit-framework | 1 | 19822 | #!/usr/bin/python
import code
import ctypes
import os
import random
import select
import socket
import struct
import subprocess
import sys
import threading
has_windll = hasattr(ctypes, 'windll')
#
# Constants
#
PACKET_TYPE_REQUEST = 0
PACKET_TYPE_RESPONSE = 1
PACKET_TYPE_PLAIN_REQUEST = 10
PACKET_TYPE_PLAIN_RESPONSE ... | 2.078125 | 2 |
utils/dev/feature.py | brunocvs7/bot_detection_twitter_profile_features | 1 | 19823 | <gh_stars>1-10
from sklearn.preprocessing import MinMaxScaler
from sklearn.pipeline import Pipeline
from scipy.stats import chi2_contingency
from sklearn.compose import ColumnTransformer
from boruta import BorutaPy
from sklearn.ensemble import RandomForestClassifier
from sklearn.preprocessing import OrdinalEncoder
from... | 2.875 | 3 |
apiserver/apiserver/web/challenge.py | AlexParra03/Halite-III | 1 | 19824 | <gh_stars>1-10
"""
User challenge API endpoints - list user's challenges & issue new ones
"""
import datetime
import flask
import sqlalchemy
from .. import model, util
from . import match as match_api
from . import util as api_util
from .blueprint import web_api
def make_challenge_record(challenge, participants):
... | 2.609375 | 3 |
txtjokes/urls.py | paqman85/txtjokes | 1 | 19825 | <reponame>paqman85/txtjokes<filename>txtjokes/urls.py
from django.conf import settings
from django.contrib import admin
from django.urls import path, include
urlpatterns = [
path('txt-jokes-administratus/', admin.site.urls),
path('accounts/', include('allauth.urls')),
path('', include('pages.urls')),
]
| 1.734375 | 2 |
newsservice/requestnews.py | mohawk781/newsservice | 0 | 19826 | import json
from newsservice.models import News
from flask import (Blueprint, request)
bp = Blueprint('request', __name__)
@bp.route('/requestnews', methods=['GET', 'POST'])
def requestdb():
"""
This Method receives filter values as a JSON and uses these to make queries at the database.
It creates a Lis... | 3.109375 | 3 |
tests/test_lexer.py | movermeyer/rexlex | 0 | 19827 | import re
import unittest
from rexlex import Lexer
from rexlex.lexer.itemclass import get_itemclass
class TestableLexer(Lexer):
"""Test tuple state transitions including #pop."""
LOGLEVEL = None
re_skip = re.compile('\s+')
tokendefs = {
'root': [
('Root', 'a', 'bar'),
... | 2.921875 | 3 |
Engine/src/tests/algorithms/neuralnetwork/convolutional/conv_net_test.py | xapharius/HadoopML | 2 | 19828 | <filename>Engine/src/tests/algorithms/neuralnetwork/convolutional/conv_net_test.py
import unittest
import numpy as np
import utils.imageutils as imgutils
import utils.numpyutils as nputils
from algorithms.neuralnetwork.convolutional.conv_net import ConvNet
from datahandler.numerical.NumericalDataSet import NumericalD... | 2.875 | 3 |
docker/eXist-seed/app/connector.py | ThomasTos/Pogues-Back-Office | 0 | 19829 | <filename>docker/eXist-seed/app/connector.py
import requests
from requests.auth import HTTPBasicAuth
import sys
import os
from string import rfind
import base64
class XdbException(Exception):
'''Exist db connector exception'''
class Connector:
def __init__(self, url, user, password):
self.url = url
... | 2.609375 | 3 |
handy/2011722086_Assign3/main_app.py | HDNua/kwin | 2 | 19830 | # -*- coding: utf-8 -*-
"""
Created on Tue May 30 16:43:10 2017
☜☜☜☜☜☜★☆★☆★☆★☆ provided code ★☆★☆★☆★☆☞☞☞☞☞☞
@author: Minsooyeo
"""
import os
import matplotlib.image as mpimg
import matplotlib.pyplot as plt
from PIL import Image as im
import numpy as np
import utills as ut
import tensorflow as tf
sess = tf.InteractiveS... | 2.15625 | 2 |
ilrma.py | annie-gu/MVAE | 1 | 19831 | import numpy as np
from common import projection_back
EPS = 1e-9
def ilrma(mix, n_iter, n_basis=2, proj_back=True):
"""Implementation of ILRMA (Independent Low-Rank Matrix Analysis).
This algorithm is called ILRMA1 in http://d-kitamura.net/pdf/misc/AlgorithmsForIndependentLowRankMatrixAnalysis.pdf
It on... | 3 | 3 |
tests/routes/test_pages.py | Biosystems-Analytics-Lab/shellcast | 5 | 19832 | <filename>tests/routes/test_pages.py
import pytest
def test_index(client):
res = client.get('/')
assert res.status_code == 200
def test_about(client):
res = client.get('/about')
assert res.status_code == 200
def test_preferences(client):
res = client.get('/preferences')
assert res.status_code == 200
def... | 2.203125 | 2 |
Task -01/loop.py | kanzul12/cp19_voice_detector | 2 | 19833 | <gh_stars>1-10
num= int (input("enter number of rows="))
for i in range (1,num+1):
for j in range(1,num-i+1):
print (" ",end="")
for j in range(2 and 9):
print("2","9")
for i in range(1, 6):
for j in range(1, 10):
if i==5 or i+j==5 or j-i==4:
... | 3.703125 | 4 |
examples/racing/models/HyperNN.py | Chris-Carvelli/DeepNeuroevolution | 0 | 19834 | import random
import math
from functools import reduce
import torch
import torch.nn as nn
def random_z_v(z_dim, z_num):
# ret = np.random.normal(0.01, 1.0, z_dim * z_num)
return torch.distributions.normal.Normal(torch.zeros([z_num, z_dim]), 0.1).sample()
class HyperNN(nn.Module):
def __init__(self, obs_... | 2.5 | 2 |
O.py | duongnguyenkt11/data-realtime | 0 | 19835 | <reponame>duongnguyenkt11/data-realtime
from functools import reduce
from bokeh.plotting import figure, output_file, show
from bokeh.io import output_notebook
from CONSTANTS import *
from utilities import *
from bokeh.plotting import figure, output_file, show
import pandas as pd, numpy as np
ENVIRON = C.LOCAL
def mma... | 2.484375 | 2 |
project1/evaluation.py | DiscoBroccoli/logistic-regression-and-naive-Bayes-from-Scratch | 0 | 19836 | import numpy as np
import pandas as pd
import matplotlib.pyplot as plt
import seaborn as sns
# [0,0] = TN
# [1,1] = TP
# [0,1] = FP
# [1,0] = FN
# cm is a confusion matrix
# Accuracy: (TP + TN) / Total
def accuracy(cm: pd.DataFrame) -> float:
return (cm[0,0] + cm[1,1]) / cm.sum()
# Precision: TP / (TP + FP)
de... | 3.4375 | 3 |
LeetCode/0005_Longest_Palindromic_Substring.py | Achyut-sudo/PythonAlgorithms | 144 | 19837 | <filename>LeetCode/0005_Longest_Palindromic_Substring.py
'''
Problem:-
Given a string s, find the longest palindromic substring in s.
You may assume that the maximum length of s is 1000.
Example 1:
Input: "babad"
Output: "bab"
Note: "aba" is also a valid answer.
'''
class Solution:
def longestPalin... | 3.9375 | 4 |
pyimagesearch/utils/__init__.py | agoila/lisa-faster-R-CNN | 17 | 19838 | <reponame>agoila/lisa-faster-R-CNN
# import the necessary packages
from .agegenderhelper import AgeGenderHelper
from .imagenethelper import ImageNetHelper | 0.941406 | 1 |
pylibressl/cipher/onion.py | yl3dy/pylibressl | 2 | 19839 | <reponame>yl3dy/pylibressl
from .. import lib
from ..exceptions import *
from .. import _libressl
from .cipher import BaseCipher
from .auth import BaseCipherAuth
from .auth import GOST89_HMAC_Streebog512, AES256_GCM
ffi, clib = _libressl.ffi, _libressl.lib
class OnionCipher(object):
"""Onion ciphering."""
@cl... | 2.53125 | 3 |
tests/plots/density_estimate.py | bws428/ambiance | 18 | 19840 | <filename>tests/plots/density_estimate.py
import os
import numpy as np
import matplotlib.pyplot as plt
from ambiance import Atmosphere, CONST
HERE = os.path.abspath(os.path.dirname(__file__))
FILE_NAME = os.path.basename(__file__).replace('.py', '.png')
PATH_OUT = os.path.join(HERE, FILE_NAME)
def density_estimate(... | 2.65625 | 3 |
pkgs/numba-0.24.0-np110py27_0/lib/python2.7/site-packages/numba/tests/test_sets.py | wangyum/anaconda | 1 | 19841 | from __future__ import print_function
import numba.unittest_support as unittest
from numba.utils import PYVERSION
from .support import TestCase, enable_pyobj_flags
def build_set_usecase(*args):
ns = {}
src = """if 1:
def build_set():
return {%s}
""" % ', '.join(repr(arg) for arg in args)
... | 2.4375 | 2 |
docs/_static/rc4.py | Varbin/pep272-encryption | 1 | 19842 | from pep272_encryption import PEP272Cipher, MODE_ECB
block_size = 1
key_size = 0
def new(*args, **kwargs):
return RC4Cipher(*args, **kwargs)
class RC4Cipher(PEP272Cipher):
block_size = 1
key_size = 0
def __init__(self, key, mode=MODE_ECB, **kwargs):
if mode != MODE_ECB:
raise V... | 2.984375 | 3 |
Packages/mdpopups/st3/mdpopups/st_color_scheme_matcher.py | Michael-Villano/Sublime-setup | 49 | 19843 | """
color_scheme_matcher.
Licensed under MIT.
Copyright (C) 2012 <NAME> <<EMAIL>>
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... | 1.820313 | 2 |
hadoop/hadoop/node.py | DropletProbe/shellscripts | 0 | 19844 | import re
class Node:
def __init__(self, id, ip, hostname, type):
self.id = id
self.ip = ip
self.hostname = hostname
self.type = type
self.validate()
def validate(self):
self.illegal = False
if re.match("^(\d{1,3}\.){3}\d{1,3}$", self.ip):
... | 3.296875 | 3 |
Python/School/C7/q2.py | abdalrhmanyasser/Abdalrhman_Rep | 0 | 19845 | <filename>Python/School/C7/q2.py
from random import *
l = []
for i in range(50):
l.append(randint(1, 100))
print(l)
for i in range(len(l)):
l[i] **= 2
print(l) | 3.203125 | 3 |
code401challengespython/radix_sort/radix_sort.py | danhuyle508/data-structures-and-algorithms | 0 | 19846 | import math
def radix_sort(arr):
if arr != []:
bucket_size = 10
maxLength = False
temp = -1
placement = 1
while not maxLength:
maxLength = True
buckets = [list() for i in range( bucket_size )]
#empty the arr
for i in arr:
... | 3.515625 | 4 |
main_no_module.py | KMU-AELAB-AL/random | 0 | 19847 | <filename>main_no_module.py
import os
import random
import torch
import torch.nn as nn
import torch.optim as optim
from torch.utils.data import DataLoader
import torch.optim.lr_scheduler as lr_scheduler
from torch.utils.data.sampler import SubsetRandomSampler
from torchvision.datasets import CIFAR100, CIFAR10
from t... | 2.375 | 2 |
deployment_scripts/python/modules/deploy_mgmt.py | Nexenta/fuel-plugin-nexentaedge | 0 | 19848 | <gh_stars>0
import sys
from nexentaedge.utils import get_sid
from nexentaedge.nedgeConfigurator import NedgeMgmtConfigurator
from utils import get_iface_name_by_mac_from_list
from utils import get_deployment_config
def main():
# check nedge already installed and ready
if get_sid():
return
... | 1.914063 | 2 |
bookmarks/account/urls.py | dorotan/social | 0 | 19849 | from django.conf.urls import url
from django.contrib.auth import views as auth_views
from django.contrib.auth import views
from . import views
urlpatterns = [
#Custom login view
# url(r'^login/$', views.user_login, name='login'),
#Builtin login view
url(r'^login/$', auth_views.login, name='login'),
... | 1.890625 | 2 |
examples/twitter.py | alex/remoteobjects | 1 | 19850 | #!/usr/bin/env python
# Copyright (c) 2009 Six Apart Ltd.
# All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions are met:
#
# * Redistributions of source code must retain the above copyright notice,
# this lis... | 1.609375 | 2 |
droxi/drox/write.py | andydude/droxtools | 0 | 19851 | <gh_stars>0
#!/usr/bin/env python
# -*- coding: utf-8 -*-
#
# droxi
# Copyright (c) 2014, <NAME>, All rights reserved.
#
# This library ("it") is free software; it is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; you can redistribute it and/or modify it under the terms of the
# GNU Lesser... | 2.21875 | 2 |
hathor/transaction/aux_pow.py | mbnunes/hathor-core | 51 | 19852 | <reponame>mbnunes/hathor-core<filename>hathor/transaction/aux_pow.py
# Copyright 2021 Hathor Labs
#
# 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.28125 | 2 |
cortex/export/__init__.py | mvdoc/pycortex | 423 | 19853 | <filename>cortex/export/__init__.py
from .save_views import save_3d_views
from .panels import plot_panels
from ._default_params import (
params_inflatedless_lateral_medial_ventral,
params_flatmap_lateral_medial,
params_occipital_triple_view,
params_inflated_dorsal_lateral_medial_ventral,
)
__all__ = [
... | 1.429688 | 1 |
pyfr/plugins/dtstats.py | DengSonic/PyFR | 1 | 19854 | # -*- coding: utf-8 -*-
from pyfr.mpiutil import get_comm_rank_root
from pyfr.plugins.base import BasePlugin, init_csv
class DtStatsPlugin(BasePlugin):
name = 'dtstats'
systems = ['*']
formulations = ['std']
def __init__(self, intg, cfgsect, prefix):
super().__init__(intg, cfgsect, prefix)
... | 2.140625 | 2 |
scripts/cylindrical.py | NunchakusLei/Panoramas-with-image-stitching | 3 | 19855 | <gh_stars>1-10
# The source of this script is from:
# https://github.com/TejasNaikk/Image-Alignment-and-Panoramas/blob/master/main.py
import cv2
import numpy as np
import math
'''
Warp an image from cartesian coordinates (x, y) into cylindrical coordinates (theta, h)
Returns: (image, mask)
Mask is [0,255], and has 25... | 2.96875 | 3 |
fmt/pythonfmt/fmt.py | KarlRong/Safe-RL-for-Driving | 0 | 19856 | import math
import random
import numpy as np
import matplotlib as mpl
import matplotlib.pyplot as plt
from fmt.pythonfmt.doubleintegrator import filter_reachable, gen_trajectory, show_trajectory
from fmt.pythonfmt.world import World
def dist2(p, q):
return math.sqrt((p[1] - q[1]) ** 2 + (p[2] - q[2]) ** 2)
# FM... | 2.609375 | 3 |
algorithms/edit_distance.py | costincaraivan/cs-refresher | 1 | 19857 | # import unittest
import logging
from timeit import timeit
logging.basicConfig(level=logging.INFO)
def memoize(function):
cache = {}
def memo(*args):
if args not in cache:
cache[args] = function(*args)
return cache[args]
return memo
@memoize
def edit_distance_recursive(sou... | 3.03125 | 3 |
hybrid_cloud_patches/3rd_lib/python/pyvcloud-11/setup.py | Hybrid-Cloud/badam | 2 | 19858 | <gh_stars>1-10
# VMware vCloud Python SDK
# Copyright (c) 2014 VMware, 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... | 1.828125 | 2 |
net_utils.py | mfatihaktas/edge-load-balance | 0 | 19859 | from debug_utils import *
def run(node_l, cmd_l):
popens = {}
for i, n in enumerate(node_l):
popens[n] = n.popen(cmd_l[i])
log(DEBUG, "Started {}".format(n))
def run_masters(m_l):
run(m_l, ['./run.sh m {}'.format(i) for i in range(len(m_l))])
log(DEBUG, "done")
def run_workers(w_l):
run(w_l, ['./run.sh w {}... | 2.140625 | 2 |
auto.py | fabiaant/Automation-car-generator | 1 | 19860 | <reponame>fabiaant/Automation-car-generator<filename>auto.py<gh_stars>1-10
import random
options = {
"year": {
"start": 1946,
"end": 2020
},
"body": ["Sedan", "Wagon", "Hatchback", "Coupe", "SUV", "Utility", "MPV",
"Convertible", "Van"],
"engine_location": ["front", "mid", "rear"],
... | 3.203125 | 3 |
docs.bzl | es-ude/EmbeddedSystemsBuildScripts | 3 | 19861 | def _doxygen_archive_impl(ctx):
"""Generate a .tar.gz archive containing documentation using Doxygen.
Args:
name: label for the generated rule. The archive will be "%{name}.tar.gz".
doxyfile: configuration file for Doxygen, @@OUTPUT_DIRECTORY@@ will be replaced with the actual output dir
... | 2.21875 | 2 |
patches/reduceRNG.py | muffinjets/LADXR | 13 | 19862 | <reponame>muffinjets/LADXR
from assembler import ASM
def slowdownThreeOfAKind(rom):
rom.patch(0x06, 0x096B, ASM("ldh a, [$E7]\nand $0F"), ASM("ldh a, [$E7]\nand $3F"))
def fixHorseHeads(rom):
rom.patch(0x07, 0x3653, "00010400", "00010000")
| 1.9375 | 2 |
jvd/ida/ida.py | L1NNA/JARV1S-Disassembler | 7 | 19863 | import sys
import os
import json
import hashlib
import logging
import base64
import shutil
from concurrent.futures import ProcessPoolExecutor
from subprocess import Popen, PIPE, STDOUT
from jvd.disassembler import DisassemblerAbstract
import logging as log
import traceback
from jvd.utils import read_gz_js, write_gz_js,... | 1.945313 | 2 |
scanapi/variable_parser.py | barbosa/scanapi | 0 | 19864 | <gh_stars>0
from enum import Enum
import logging
import os
import re
import sys
import yaml
from scanapi.errors import BadConfigurationError, InvalidPythonCodeError
# Available imports to be used dinamically in the api spec
import datetime
import math
import random
import time
import uuid
logger = logging.getLogger(... | 2.625 | 3 |
python/londiste/setup.py | priitkustala/skytools-dev | 1 | 19865 | <filename>python/londiste/setup.py
#! /usr/bin/env python
"""Londiste setup and sanity checker.
"""
import sys, os, skytools
from pgq.cascade.admin import CascadeAdmin
__all__ = ['LondisteSetup']
class LondisteSetup(CascadeAdmin):
"""Londiste-specific admin commands."""
initial_db_name = 'node_db'
extr... | 1.976563 | 2 |
tests/tests.py | SherineAwad/ribofilio | 0 | 19866 | <reponame>SherineAwad/ribofilio
import pytest
import screed
import os
import sys
import numpy as np
import matplotlib.pyplot as plt
import cv2
import skimage.measure as measure
path = os.getcwd()
path = os.path.join(path,"src")
sys.path.append(path)
print(path)
import ribofilio as rb
def test_get_genes():
... | 2.140625 | 2 |
envoy.code.check/envoy/code/check/abstract/flake8.py | Nordix/pytooling | 0 | 19867 | <gh_stars>0
import io
import logging
import os
import pathlib
from functools import cached_property, lru_cache
from typing import List, Set, Tuple
from flake8.main.application import Application # type:ignore
from flake8 import ( # type:ignore
utils as flake8_utils,
checker as flake8_checker)
import abstra... | 2 | 2 |
szndaogen/data_access/manager_base.py | seznam/szndaogen | 3 | 19868 | <filename>szndaogen/data_access/manager_base.py
import typing
from ..tools.log import Logger
from .db import DBI
from .model_base import ModelBase
from ..config import Config
class ManagerException(BaseException):
pass
class ViewManagerBase:
MODEL_CLASS = ModelBase
def __init__(self, dbi: DBI = None)... | 2.4375 | 2 |
setup.py | may-ank/hocr-tools | 200 | 19869 | <filename>setup.py
#!/usr/bin/env python
__version__ = '1.3.0'
import glob
from setuptools import setup
setup(
name="hocr-tools",
version=__version__,
description='Advanced tools for hOCR integration',
author='<NAME>',
maintainer='<NAME>',
maintainer_email='<EMAIL>',
url='https://github.c... | 1.296875 | 1 |
src/reporter.py | serhankk/Device-Reporter | 0 | 19870 | # Imports
import socket
import subprocess
import os
import requests
# from prettytable import PrettyTable
import getpass
import CONFIG
def send_message(text):
try:
requests.post('https://slack.com/api/chat.postMessage', {
'token': CONFIG.SLACK_TOKEN,
'channel': CONFIG.SLACK_CHANNEL_INFO,
... | 2.421875 | 2 |
pyflarum/extensions.py | CWKevo/pyFlarum | 1 | 19871 | import typing as t
import warnings
from .error_handler import MissingExtensionError, MissingExtensionWarning
class ExtensionMixin:
"""
A base class for mixing in custom classes (extensions) into another classes.
"""
AUTHOR = "unknown"
NAME = "unknown"
ID = f"{AUTHOR}-{NAME}"
SOFT_... | 2.5 | 2 |
ComRISB/pyglib/pyglib/dft/eos.py | comscope/comsuite | 18 | 19872 | import numpy as np
import h5py
import pyglib.basic.units as units
import pyglib.basic.splot as splot
'''
Equation of state.
'''
def Murnaghan(parameters, vol):
'''
Given a vector of parameters and volumes, return a vector of energies.
equation From PRB 28,5480 (1983)
'''
E0 = parameters[0]
B0... | 3.3125 | 3 |
src/users/actions.py | josue0ghost/Python-and-MySQL-console-application | 0 | 19873 | <reponame>josue0ghost/Python-and-MySQL-console-application<filename>src/users/actions.py<gh_stars>0
import users.user as user
import grades.actions as grade
class Actions:
def signup(self):
print("Selected item: signup")
name = input("Your name: ")
lastname = input("Your last name: ")... | 3.828125 | 4 |
python/src/pdef/version.py | pdef/pdef-python | 2 | 19874 | <filename>python/src/pdef/version.py<gh_stars>1-10
# encoding: utf-8
'''Pdef version in a separate module to simplify setup.py.'''
__version__ = '1.2.0'
| 1.109375 | 1 |
hardhat/recipes/python/curtsies.py | stangelandcl/hardhat | 0 | 19875 | <filename>hardhat/recipes/python/curtsies.py
from .base import PipBaseRecipe
class CurtsiesRecipe(PipBaseRecipe):
def __init__(self, *args, **kwargs):
super(CurtsiesRecipe, self).__init__(*args, **kwargs)
self.sha256 = '431631b9c1417b2ae8156d0bb6d7c3ce' \
'0c97941413717ed6713... | 1.984375 | 2 |
topics/migrations/0001_initial.py | codingforentrepreneurs/Autogenerate-Django-Models- | 28 | 19876 | <gh_stars>10-100
# Generated by Django 3.1.3 on 2020-11-08 19:52
from django.db import migrations, models
class Migration(migrations.Migration):
initial = True
dependencies = [
]
operations = [
migrations.CreateModel(
name='Topics',
fields=[
('id', m... | 1.710938 | 2 |
utils.py | ChaosForge/shoot_tracer_test | 0 | 19877 | <gh_stars>0
import png
import numpy
import pprint
import math
import re
def gen_background(width, height, mag, b_col):
bg = numpy.zeros((width * mag, height * mag, 4), dtype=numpy.uint8)
for y in range(0, height * mag, mag):
for x in range(0, width * mag):
bg[y][x] = b_col
for... | 2.4375 | 2 |
draft/pendulum/cosine_prod/cosine_prod.py | krystophny/profit | 14 | 19878 | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Created on Thu Aug 27 23:58:37 2020
@author: manal
"""
import numpy as np
import GPy
from GPy.kern.src.stationary import Stationary
class Cosine_prod(Stationary):
"""
Cosine kernel:
Product of 1D Cosine kernels
.. math::
&k(x,x')_i = ... | 2.5625 | 3 |
tensorflowonspark/__init__.py | DerekRen/TensorFlowOnSpark | 1 | 19879 | import logging
logging.basicConfig(level=logging.INFO, format="%(asctime)s %(levelname)s (%(threadName)s-%(process)d) %(message)s")
__version__ = "2.2.0"
| 1.8125 | 2 |
783-minimum-distance-between-bst-nodes/783-minimum-distance-between-bst-nodes.py | hyeseonko/LeetCode | 2 | 19880 | # Definition for a binary tree node.
# class TreeNode:
# def __init__(self, val=0, left=None, right=None):
# self.val = val
# self.left = left
# self.right = right
class Solution:
def minDiffInBST(self, root: Optional[TreeNode]) -> int:
output=[]
stack=[root]
whil... | 3.53125 | 4 |
Contents/Code/__init__.py | RussianPlex/plex-tvkultura | 0 | 19881 | <reponame>RussianPlex/plex-tvkultura
PREFIX = "/video/tvkultura"
NAME = "TVKultura.Ru"
ICON = "tvkultura.png"
ART = "tvkultura.jpg"
BASE_URL = "https://tvkultura.ru/"
BRAND_URL = BASE_URL+"brand/"
# Channel initialization
def Start():
ObjectContainer.title1 = NAME
HTTP.Headers['User-Agent'] = 'Mozilla/5.0 (W... | 2.25 | 2 |
pexp/management/commands/p2cmd.py | bconstantin/django_polymorphic | 27 | 19882 | <reponame>bconstantin/django_polymorphic<filename>pexp/management/commands/p2cmd.py
# -*- coding: utf-8 -*-
"""
This module is a scratchpad for general development, testing & debugging
Well, even more so than pcmd.py. You best ignore p2cmd.py.
"""
import uuid
from django.core.management.base import NoArgsCommand
from ... | 2.265625 | 2 |
njunmt/utils/misc.py | whr94621/NJUNMT-tf | 1 | 19883 | <gh_stars>1-10
# Copyright 2017 Natural Language Processing Group, Nanjing University, <EMAIL>.
#
# 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.34375 | 2 |
src/manager.py | advancedbioimagingcenter/opticalaberrations | 0 | 19884 | import logging
import time
from pathlib import Path
from subprocess import call
import cli
def parse_args(args):
parser = cli.argparser()
subparsers = parser.add_subparsers(
help="Arguments for specific action.", dest="dtype"
)
subparsers.required = True
slurm = subparsers.add_parser("s... | 2.46875 | 2 |
src/aiographql/client/response.py | ehtec/aiographql-client | 18 | 19885 | from dataclasses import dataclass, field
from typing import Any, Dict, List
from aiographql.client.error import GraphQLError
from aiographql.client.request import GraphQLRequestContainer
@dataclass(frozen=True)
class GraphQLBaseResponse(GraphQLRequestContainer):
json: Dict[str, Any] = field(default_factory=dict)... | 2.765625 | 3 |
lib/utils/__init__.py | jwyang/C3Net.pytorch | 43 | 19886 | from .verbo import *
| 1.078125 | 1 |
Populating Next Right Pointers in Each Node II.py | quake0day/oj | 0 | 19887 | class Solution(object):
def connect(self, root):
"""
:type root: TreeLinkNode
:rtype: nothing
"""
if root == None:
return
p = root.next
while p:
if p.left != None:
p = p.left
break
elif p.righ... | 3.375 | 3 |
federatedml/feature/feature_selection/variance_coe_filter.py | yzjba/FATE | 32 | 19888 | <reponame>yzjba/FATE<gh_stars>10-100
#!/usr/bin/env python
# -*- coding: utf-8 -*-
#
# Copyright 2019 The FATE 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 ... | 2 | 2 |
hausa_text_corpus/tool.py | tunde99/AMMI-2020-SPEECH-COURSE | 1 | 19889 | <gh_stars>1-10
from collections import defaultdict
word_counts = defaultdict(int)
for w in open('runbun_ilimi/runbin_ilimi.txt', encoding="utf-8").read().split():
word_counts[w.lower()] += 1
totalCount = 0;
for w, c in word_counts.items():
totalCount += 1
print(totalCount) | 2.953125 | 3 |
S1/SI/S3/Test-Moteur-Elec-2/Test-Moteur-Elec/main.py | HerbeMalveillante/ecole | 0 | 19890 | # Fichier main de gestion des ressources du robot
from micropython import const
from machine import *
from DRV8833 import *
from BME280 import *
import pycom
import time
import os
# Variables globales pour moteurs et pont en H
DRV8833_Sleep_pin = "P20" # Pin SLEEP
DRV8833_AIN1 = "P22" # Entrée PWM moteu... | 2.421875 | 2 |
evaluators/weighted_cross_entropy.py | adgilbert/med-seg | 0 | 19891 | <gh_stars>0
import torch
import torch.nn.functional as F
from torch import nn as nn
from torch.autograd import Variable
# from https://github.com/wolny/pytorch-3dunet/blob/master/pytorch3dunet/unet3d/losses.py
def flatten(tensor):
"""Flattens a given tensor such that the channel axis is first.
The shapes ar... | 2.828125 | 3 |
AlgorithmsPractice/python/20_simple_Valid Parenthese.py | YangXiaoo/NoteBook | 58 | 19892 | '''
Given a string containing just the characters '(', ')', '{', '}', '[' and ']', determine if the input string is valid.
An input string is valid if:
Open brackets must be closed by the same type of brackets.
Open brackets must be closed in the correct order.
Note that an empty string is also considered valid.
Exa... | 4.1875 | 4 |
tests/test_verify_json_response.py | ambertide/flask-verify | 0 | 19893 | from json import dumps
from typing import Callable
from flask.json import jsonify
from flask.wrappers import Response
from flask_verify.verify_json import verify_json_response
from pytest import raises
@verify_json_response
def _view_function_response() -> Response:
"""
To test if an endpoint that already ret... | 2.953125 | 3 |
utils/loader.py | zhangcheng007/face_detection_base_on_mtcnn | 1 | 19894 | import numpy as np
import sys
import cv2
sys.path.append("../")
from utils.config import config
class TestLoader:
def __init__(self, imdb, batch_size=1, shuffle=False):
self.imdb = imdb
self.batch_size = batch_size
self.shuffle = shuffle
self.size = len(imdb)#num of data
... | 2.609375 | 3 |
wmata/rail/station.py | emma-k-alexandra/pywmata | 5 | 19895 | <gh_stars>1-10
"""MetroRail Station related structures
"""
from enum import Enum
from typing import Any, Optional
class Station(Enum):
"""A MetroRail Station
"""
A01 = "A01"
A02 = "A02"
A03 = "A03"
A04 = "A04"
A05 = "A05"
A06 = "A06"
A07 = "A07"
A08 = "A08"
A09 = "A09"
A... | 2.578125 | 3 |
tests/unit/core/test_models.py | uktrade/great-cms | 10 | 19896 | import time
from unittest import mock
import pytest
from django.contrib.auth.models import AnonymousUser
from django.core.exceptions import ValidationError
from django.db import IntegrityError
from django.http import Http404
from django.test import RequestFactory, TestCase
from django.urls import reverse
from wagtail.... | 1.851563 | 2 |
polyadcirc/run_framework/no_ibrun.py | tmiesse/PolyADCIRC | 5 | 19897 | # Copyright (C) 2013 <NAME>
"""
This file provides a mpirun work-around for clusters that do not have the ibrun
command.
"""
import os, stat
class random_manningsn(object):
"""
This class is an implementation of
:class:`polyadcirc.run_framework.random_manningsn` that provides a
``mpirun`` based work-a... | 2.515625 | 3 |
automated_codeforces_registration/auto_register.py | Asienwald/GCI-Fedora | 0 | 19898 | from selenium import webdriver
from selenium.webdriver.support.ui import WebDriverWait
from selenium.webdriver.support import expected_conditions as EC
import datetime as dt
import sys
import getpass
import re
def start_registration(handle, email, pwd1, pwd2):
print("Starting registration, browser opening shortly.... | 2.84375 | 3 |
3/redis.py | dyygtfx/python-in-action | 0 | 19899 | <filename>3/redis.py<gh_stars>0
#!/usr/local/bin/python
#coding=utf-8
#第 0003 题:将 0001 题生成的 200 个激活码(或者优惠券)保存到 Redis 非关系型数据库中。
import uuid
import redis
def create_code(num, length):
result = []
while True:
uuid_id = uuid.uuid1()
temp = str(uuid_id).replace('-', '')[:length]
if temp no... | 3.0625 | 3 |