text stringlengths 0 1.05M | meta dict |
|---|---|
__author__ = 'Tauren'
from math import radians, sin, cos, atan2, sqrt, degrees, asin, pi
class GeoMath:
def __init__(self):
pass
@staticmethod
def haversine(lat1, lon1, lat2, lon2):
""" Calculate the great circle distance between two points
on the earth (specified in decimal deg... | {
"repo_name": "taurenk/PinPoint-Geocoder-Python",
"path": "app/geocoder/geomath.py",
"copies": "1",
"size": "3376",
"license": "mit",
"hash": -7625611858362531000,
"line_mean": 38.7294117647,
"line_max": 134,
"alpha_frac": 0.5693127962,
"autogenerated": false,
"ratio": 3.3163064833005893,
"conf... |
__author__ = 'Tauren'
from sqlalchemy.ext.declarative import declarative_base
from sqlalchemy import Column, Numeric, Integer, String, orm
from geoalchemy2 import Geometry
from binascii import unhexlify
from shapely import wkb, wkt
Base = declarative_base()
class Place(Base):
__tablename__ = 'place'
id = C... | {
"repo_name": "taurenk/PinPoint-Geocoder-Python",
"path": "app/models.py",
"copies": "1",
"size": "3930",
"license": "mit",
"hash": -6612861838122224000,
"line_mean": 29.9448818898,
"line_max": 112,
"alpha_frac": 0.582697201,
"autogenerated": false,
"ratio": 3.632162661737523,
"config_test": fa... |
__author__ = 'Tauren'
import logging
from app import db
from app.models import Place, AddrFeat, AddressResult
from .address import Address
from .address_parser import AddressParser
from .metaphone import meta
from .ranking import rank_city_candidates, rank_address_results
from sqlalchemy import text
from .geomath impo... | {
"repo_name": "taurenk/PinPoint-Geocoder-Python",
"path": "app/geocoder/geocoder.py",
"copies": "1",
"size": "7742",
"license": "mit",
"hash": 8137038965556494000,
"line_mean": 40.623655914,
"line_max": 120,
"alpha_frac": 0.6320072333,
"autogenerated": false,
"ratio": 3.65188679245283,
"config_... |
__author__ = 'Tauren'
import re
from app.geocoder.utils.regex import Regex
from app.geocoder.utils.standards import Standards
class AddressParser:
def __init__(self):
self.regex = Regex()
self.standards = Standards()
def parse_address_string(self, address):
address_string = address.... | {
"repo_name": "taurenk/PinPoint-Geocoder-Python",
"path": "app/geocoder/address_parser.py",
"copies": "1",
"size": "1920",
"license": "mit",
"hash": 80954653644290100,
"line_mean": 35.2452830189,
"line_max": 93,
"alpha_frac": 0.6291666667,
"autogenerated": false,
"ratio": 3.910386965376782,
"co... |
__author__ = 'Tauren'
import re
from app.geocoder.utils.standards import Standards
class Regex:
def __init__(self):
# Standard Regex from trial and error
self.number_regex = re.compile(r'^\d+[-]?(\w+)?')
self.po_regex = re.compile(r'(?:(PO BOX|P O BOX)\s(\d*[- ]?\d*))' )
self.i... | {
"repo_name": "taurenk/PinPoint-Geocoder-Python",
"path": "app/geocoder/utils/regex.py",
"copies": "1",
"size": "2168",
"license": "mit",
"hash": -2729018164036465700,
"line_mean": 35.15,
"line_max": 102,
"alpha_frac": 0.5535055351,
"autogenerated": false,
"ratio": 3.1882352941176473,
"config_t... |
__author__ = 'tauren'
from flask.ext.sqlalchemy import SQLAlchemy
from sqlalchemy.orm import backref
from passlib.apps import custom_app_context as pwd_context
from flask_login import UserMixin
from itsdangerous import URLSafeTimedSerializer
login_serializer = URLSafeTimedSerializer('SECRET KEY')
db = SQLAlchemy()
... | {
"repo_name": "taurenk/Flask-Angular-TaskList",
"path": "backend/app/models.py",
"copies": "1",
"size": "1432",
"license": "mit",
"hash": 8508299507825872000,
"line_mean": 27.64,
"line_max": 75,
"alpha_frac": 0.6843575419,
"autogenerated": false,
"ratio": 3.6345177664974617,
"config_test": fals... |
__author__ = 'Tauren'
class Standards:
def __init__(self):
pass
cardinals = {
'zero' : '0', 'one' : '1', 'two' : '2',
'three' : '3', 'four' : '4', 'five' : '5',
'six' : '6', 'seven' : '7', 'eight' : '8',
'nine' : '9', 'ten' : '10', 'eleven' : '11',
... | {
"repo_name": "taurenk/PinPoint-Geocoder-Python",
"path": "app/geocoder/utils/standards.py",
"copies": "1",
"size": "36441",
"license": "mit",
"hash": -2552653376292920300,
"line_mean": 30.9947322212,
"line_max": 94,
"alpha_frac": 0.3286408167,
"autogenerated": false,
"ratio": 2.882306414616784,
... |
__author__ = 'tayfun elmas'
import unittest
from setservice import *
class SetServerTests(unittest.TestCase):
########################################################
def test_contents_two_clients(self):
try:
HOST = "127.0.0.1"
PORT = 65333
service = set_service... | {
"repo_name": "mdsalman729/flexpret_project",
"path": "emulator/concurrit-poplsyntax/concurrit-poplsyntax/python/test3.py",
"copies": "1",
"size": "4460",
"license": "bsd-3-clause",
"hash": -7338790124517547000,
"line_mean": 27.0566037736,
"line_max": 64,
"alpha_frac": 0.4665919283,
"autogenerated"... |
__author__ = 'TBD'
class KellyCriterion:
def __init__(self):
self.initialized = True
def DetermineProbability(self, historyDiffs, predictedPrice, curPrice):
if(predictedPrice > curPrice):
ups = 0.0
for d in historyDiffs:
ups += (d < -1*(predictedP... | {
"repo_name": "dwdii/stockyPuck",
"path": "src/kellyCriterion.py",
"copies": "1",
"size": "1181",
"license": "mit",
"hash": 426851737761565800,
"line_mean": 27.1428571429,
"line_max": 77,
"alpha_frac": 0.5317527519,
"autogenerated": false,
"ratio": 3.797427652733119,
"config_test": false,
"ha... |
__author__ = 'tbeltramelli'
from AHomography import *
from Filtering import *
from UInteractive import *
class TextureMapper(AHomography):
_result = None
_texture = None
_map = None
_texture_position = None
def __init__(self, homography_output_path):
self._homography_output_path = homogr... | {
"repo_name": "tonybeltramelli/Graphics-And-Vision",
"path": "Projective-Geometry/tony/com.tonybeltramelli.homography/TextureMapper.py",
"copies": "1",
"size": "3740",
"license": "apache-2.0",
"hash": 8991014486084762000,
"line_mean": 35.6666666667,
"line_max": 120,
"alpha_frac": 0.6139037433,
"aut... |
__author__ = 'tbeltramelli'
from AHomography import *
class PersonTracker(AHomography):
_input = None
_data = None
_map = None
_counter = 0
_tracking_output_path = ""
def __init__(self, video_path, map_path, tracking_data_path, tracking_output_path, homography_output_path):
self._dat... | {
"repo_name": "tonybeltramelli/Graphics-And-Vision",
"path": "Projective-Geometry/tony/com.tonybeltramelli.homography/PersonTracker.py",
"copies": "1",
"size": "2086",
"license": "apache-2.0",
"hash": 5214550870064101000,
"line_mean": 28.3802816901,
"line_max": 111,
"alpha_frac": 0.5599232982,
"aut... |
__author__ = 'tbeltramelli'
from EpipolarGeometry import *
from StereoCameraCalibrator import *
from DepthMap import *
from Filtering import *
class StereoVision:
_result = None
_calibrator = None
_depth = None
media_path = None
output_path = None
def __init__(self, media_path, output_path)... | {
"repo_name": "tonybeltramelli/Graphics-And-Vision",
"path": "Stereo-Vision-System/tony/com.tonybeltramelli.stereo/StereoVision.py",
"copies": "1",
"size": "3488",
"license": "apache-2.0",
"hash": 7014009365394142000,
"line_mean": 41.5365853659,
"line_max": 113,
"alpha_frac": 0.6559633028,
"autogen... |
__author__ = 'tbeltramelli'
from scipy.cluster.vq import *
from UMedia import *
from Filtering import *
from RegionProps import *
from UMath import *
from UGraphics import *
import operator
class Eye:
_result = None
_right_template = None
_left_template = None
def __init__(self, right_corner_path, l... | {
"repo_name": "tonybeltramelli/Graphics-And-Vision",
"path": "Eye-Tracking-System/tony/com.tonybeltramelli.eyetracker/Eye.py",
"copies": "1",
"size": "7280",
"license": "apache-2.0",
"hash": -8946730078943528000,
"line_mean": 39,
"line_max": 132,
"alpha_frac": 0.5730769231,
"autogenerated": false,
... |
__author__ = 'tbeltramelli'
from UInteractive import *
from UMath import *
from Filtering import *
from UGraphics import *
class DepthMap:
_output_path = None
_left_img = None
_right_img = None
_min_disparity = -16
_block_size = 5
_disparity_map = None
def __init__(self, output_path):
... | {
"repo_name": "tonybeltramelli/Graphics-And-Vision",
"path": "Stereo-Vision-System/tony/com.tonybeltramelli.stereo/DepthMap.py",
"copies": "1",
"size": "3636",
"license": "apache-2.0",
"hash": 7070666506730677000,
"line_mean": 34.3106796117,
"line_max": 106,
"alpha_frac": 0.5836083608,
"autogenerat... |
__author__ = 'tbeltramelli'
from UInteractive import *
class AHomography:
_homography_output_path = None
_homography = None
def get_homography_all_from_mouse(self, images, n=4):
image_points = UInteractive.select_points_in_images(images, n)
points1 = np.array([[x, y] for (x, y) in image... | {
"repo_name": "tonybeltramelli/Graphics-And-Vision",
"path": "Projective-Geometry/tony/com.tonybeltramelli.homography/AHomography.py",
"copies": "1",
"size": "3485",
"license": "apache-2.0",
"hash": -6865628503248285000,
"line_mean": 34.5714285714,
"line_max": 86,
"alpha_frac": 0.5018651363,
"autog... |
__author__ = 'tbeltramelli'
from UInteractive import *
class EpipolarGeometry:
_points = []
_img = None
_raw_img = None
_fundamental_matrix = None
_epipole = None
_MAX_POINT_NUMBER = 16
is_ready = False
def __init__(self, img, define_manually=True):
self._img = copy(img)
... | {
"repo_name": "tonybeltramelli/Graphics-And-Vision",
"path": "Stereo-Vision-System/tony/com.tonybeltramelli.stereo/EpipolarGeometry.py",
"copies": "1",
"size": "3230",
"license": "apache-2.0",
"hash": -5300875349914761000,
"line_mean": 32.3092783505,
"line_max": 97,
"alpha_frac": 0.573993808,
"auto... |
__author__ = 'tbeltramelli'
from UMedia import *
from CameraCalibrator import *
from Filtering import *
from Camera import *
from UMath import *
from UGraphics import *
from AHomography import *
class AugmentedReality:
_video_path = None
_pattern = None
_camera_calibrator = None
_result = None
d... | {
"repo_name": "tonybeltramelli/Graphics-And-Vision",
"path": "Projective-Geometry/tony/com.tonybeltramelli.homography/AugmentedReality.py",
"copies": "1",
"size": "4346",
"license": "apache-2.0",
"hash": -5646114102894465000,
"line_mean": 39.2407407407,
"line_max": 130,
"alpha_frac": 0.6318453751,
... |
__author__ = 'tbeltramelli'
import base64
import cv2
import numpy as np
import re
class Preprocessing:
@staticmethod
def preprocess(base64img):
path = "temp.png"
with open(path, "wb") as img_file:
b64 = re.sub('^data:image/.+;base64,', '', base64img)
img_file.write(bas... | {
"repo_name": "amarco90/thug-cucumber",
"path": "backend/preprocessing.py",
"copies": "1",
"size": "1055",
"license": "mit",
"hash": -7707348489787726000,
"line_mean": 25.375,
"line_max": 66,
"alpha_frac": 0.5696682464,
"autogenerated": false,
"ratio": 2.997159090909091,
"config_test": false,
... |
__author__ = 'tbeltramelli'
import cv2
from pylab import *
class UGraphics(object):
@staticmethod
def hex_color_to_bgr(hexadecimal):
red = (hexadecimal & 0xFF0000) >> 16
green = (hexadecimal & 0xFF00) >> 8
blue = (hexadecimal & 0xFF)
return [blue, green, red]
@staticmeth... | {
"repo_name": "tonybeltramelli/Graphics-And-Vision",
"path": "Stereo-Vision-System/tony/com.tonybeltramelli.stereo/UGraphics.py",
"copies": "1",
"size": "1697",
"license": "apache-2.0",
"hash": -4795473183072474000,
"line_mean": 31.0188679245,
"line_max": 97,
"alpha_frac": 0.5869180907,
"autogenera... |
__author__ = 'tbeltramelli'
import cv2
from pylab import *
class UMedia:
@staticmethod
def get_image(path):
return cv2.imread(path)
@staticmethod
def load_video(path, callback):
cap = cv2.VideoCapture(path)
is_reading = True
while is_reading:
is_reading, ... | {
"repo_name": "tonybeltramelli/Graphics-And-Vision",
"path": "Projective-Geometry/tony/com.tonybeltramelli.homography/UMedia.py",
"copies": "1",
"size": "1523",
"license": "apache-2.0",
"hash": 4289628199506267000,
"line_mean": 25.275862069,
"line_max": 66,
"alpha_frac": 0.508864084,
"autogenerated... |
__author__ = 'tbeltramelli'
import cv2
from pylab import *
class UMedia(object):
@staticmethod
def get_image(path):
return cv2.imread(path)
@staticmethod
def load_video(path, callback):
cap = cv2.VideoCapture(path)
is_reading = True
while is_reading:
is_r... | {
"repo_name": "tonybeltramelli/Graphics-And-Vision",
"path": "Stereo-Vision-System/tony/com.tonybeltramelli.stereo/UMedia.py",
"copies": "1",
"size": "2462",
"license": "apache-2.0",
"hash": 7516562273644941000,
"line_mean": 24.9263157895,
"line_max": 66,
"alpha_frac": 0.4979691308,
"autogenerated"... |
__author__ = 'tbeltramelli'
import numpy as np
import math
from pylab import *
class UMath:
@staticmethod
def normalize(range_min, range_max, x, x_min, x_max):
return range_min + (((x - x_min) * (range_max - range_min)) / (x_max - x_min))
@staticmethod
def is_in_area(x, y, width, height):
... | {
"repo_name": "tonybeltramelli/Graphics-And-Vision",
"path": "Projective-Geometry/tony/com.tonybeltramelli.homography/UMath.py",
"copies": "1",
"size": "2192",
"license": "apache-2.0",
"hash": 7358978065825540000,
"line_mean": 27.1153846154,
"line_max": 114,
"alpha_frac": 0.4949817518,
"autogenerat... |
__author__ = 'tbeltramelli'
import numpy as np
import math
from pylab import *
class UMath(object):
@staticmethod
def normalize(range_min, range_max, x, x_min, x_max):
d = x_max - x_min
d = d if d > 0 else 1
return range_min + (((x - x_min) * (range_max - range_min)) / d)
@stati... | {
"repo_name": "tonybeltramelli/Graphics-And-Vision",
"path": "Stereo-Vision-System/tony/com.tonybeltramelli.stereo/UMath.py",
"copies": "1",
"size": "2243",
"license": "apache-2.0",
"hash": -100758146455335200,
"line_mean": 26.7037037037,
"line_max": 114,
"alpha_frac": 0.4921979492,
"autogenerated"... |
__author__ = 'tbeltramelli'
import numpy as np
import math
class UMath:
@staticmethod
def normalize(range_min, range_max, x, x_min, x_max):
return range_min + (((x - x_min) * (range_max - range_min)) / (x_max - x_min))
@staticmethod
def is_in_area(x, y, width, height):
return ((x > w... | {
"repo_name": "tonybeltramelli/Graphics-And-Vision",
"path": "Eye-Tracking-System/tony/com.tonybeltramelli.eyetracker/UMath.py",
"copies": "1",
"size": "1767",
"license": "apache-2.0",
"hash": -4677020243622547000,
"line_mean": 25.7878787879,
"line_max": 114,
"alpha_frac": 0.4527447651,
"autogenera... |
import simplegui
import random
#globals
CARD_COUNT = range(16)
card_list = []
exposed_list = []
CARD_WH = (50, 100) # card image dimensions
CARD_CENT = (CARD_WH[0] / 2, CARD_WH[1] / 2) # card image center source
selected_cards = {"current": None, "previous": None}
# helper function to initialize globals
def new_game... | {
"repo_name": "tblong/CodeSkulptor",
"path": "projects/P2_W5/Memory.py",
"copies": "1",
"size": "3004",
"license": "mit",
"hash": 4816247006210067000,
"line_mean": 27.619047619,
"line_max": 146,
"alpha_frac": 0.6311584554,
"autogenerated": false,
"ratio": 3.301098901098901,
"config_test": false... |
import simplegui
import random
# load card sprite - 936x384 - source: jfitz.com
CARD_SIZE = (72, 96)
CARD_CENTER = (36, 48)
card_images = simplegui.load_image("http://storage.googleapis.com/codeskulptor-assets/cards_jfitz.png")
CARD_BACK_SIZE = (72, 96)
CARD_BACK_CENTER = (36, 48)
card_back = simplegui.load_image("ht... | {
"repo_name": "tblong/CodeSkulptor",
"path": "projects/P2_W6/Blackjack.py",
"copies": "1",
"size": "6091",
"license": "mit",
"hash": -8024885825021779000,
"line_mean": 28.1435406699,
"line_max": 130,
"alpha_frac": 0.573304876,
"autogenerated": false,
"ratio": 3.157594608605495,
"config_test": f... |
import simplegui
import math
import random
# globals for user interface
WIDTH = 800
HEIGHT = 600
score = 0
lives = 3
time = 0
game_in_progress = False
MAX_ROCKS = 12
# Ship constants
SHIP_DIM = [90, 90]
SHIP_CEN = [SHIP_DIM[0] / 2, SHIP_DIM[1] / 2]
SHIP_RADUIS = 35
SHIP_ROCK_MIN_DISTANCE = SHIP_RADUIS * 4 # min rock... | {
"repo_name": "tblong/CodeSkulptor",
"path": "projects/P2_W8/SpaceShip code with explosions.py",
"copies": "1",
"size": "12454",
"license": "mit",
"hash": 2816123082213478000,
"line_mean": 29.8292079208,
"line_max": 166,
"alpha_frac": 0.6672555002,
"autogenerated": false,
"ratio": 2.7799107142857... |
# imports
import simplegui
# globals
time = 0 # time in tenths of seconds
success = 0
num_tries = 0
# define helper function format that converts time
# in tenths of seconds into formatted string A:BC.D
def format(t):
min = get_minute(t)
sec = get_seconds(t)
tenths = get_tenths(t)
return min + ":" +... | {
"repo_name": "tblong/CodeSkulptor",
"path": "projects/P1_W3/Stopwatch The Game.py",
"copies": "1",
"size": "1722",
"license": "mit",
"hash": -1582970117263087400,
"line_mean": 19.7469879518,
"line_max": 63,
"alpha_frac": 0.6271777003,
"autogenerated": false,
"ratio": 3.1654411764705883,
"confi... |
import simplegui
import random
import math
# initialize globals - pos and vel encode vertical info for paddles
WIDTH = 600
HEIGHT = 400
BALL_RADIUS = 20
PAD_WIDTH = 8
PAD_HEIGHT = 80
PAD_WH = PAD_DIM_ORIG = (PAD_WIDTH, PAD_HEIGHT)
HALF_PAD_WIDTH = PAD_WIDTH / 2
HALF_PAD_HEIGHT = PAD_HEIGHT / 2
PAD1_X = HALF_PA... | {
"repo_name": "tblong/CodeSkulptor",
"path": "projects/P1_W4/pong.py",
"copies": "1",
"size": "5573",
"license": "mit",
"hash": 2171341576900847400,
"line_mean": 34.0566037736,
"line_max": 156,
"alpha_frac": 0.6339493989,
"autogenerated": false,
"ratio": 2.930073606729758,
"config_test": false,... |
#imports
import simplegui
import random
import math
#globals
secret_number = 0
max_range = 100
num_guesses = 7
# helper function to start and restart the game
def new_game():
global secret_number
set_guesses()
secret_number = random.randrange(0, max_range)
print "New game. Range is from 0 to " + str(... | {
"repo_name": "tblong/CodeSkulptor",
"path": "projects/P1_W2/Guess the number.py",
"copies": "1",
"size": "1898",
"license": "mit",
"hash": -1290959486382609700,
"line_mean": 20.816091954,
"line_max": 73,
"alpha_frac": 0.6164383562,
"autogenerated": false,
"ratio": 3.4509090909090907,
"config_t... |
# Rock-paper-scissors-lizard-Spock
#
# The key idea of this program is to equate the strings
# "rock", "paper", "scissors", "lizard", "Spock" to numbers
# as follows:
#
# 0 - rock
# 1 - Spock
# 2 - paper
# 3 - lizard
# 4 - scissors
import random
def name_to_number(name):
if name == "rock":
return 0
e... | {
"repo_name": "tblong/CodeSkulptor",
"path": "projects/P1_W1/Rock-paper-scissors-lizard-Spock.py",
"copies": "1",
"size": "1526",
"license": "mit",
"hash": 1597437150160958200,
"line_mean": 19.3466666667,
"line_max": 59,
"alpha_frac": 0.5747051114,
"autogenerated": false,
"ratio": 3.2399150743099... |
__author__ = 'tbossert'
#!/usr/bin/python
import MySQLdb as mdb
import sys
from datetime import datetime, timedelta
bcon = mdb.connect(host = 'localhost', port = 3306, user = 'barbell', passwd = '10Reps f0r perf3Ction!', db = 'barbell')
#getEndDay = datetime.utcnow()
getStartDay = datetime.utcnow() - timedelta(days... | {
"repo_name": "tbossert/applicable-poisoned-integer",
"path": "ETL/daily.py",
"copies": "1",
"size": "2111",
"license": "mit",
"hash": 6469693274462640000,
"line_mean": 59.3142857143,
"line_max": 379,
"alpha_frac": 0.701089531,
"autogenerated": false,
"ratio": 3.1554559043348283,
"config_test":... |
__author__ = 'tbossert'
#!/usr/bin/python
import MySQLdb as mdb
import sys
from datetime import datetime, timedelta
zcon = mdb.connect(host = 'localhost', port = 3306, user = 'barbell', passwd = '10Reps f0r perf3Ction!', db = 'zunefit')
getEndHour = datetime.utcnow()
getStartHour = datetime.utcnow() - timedelta(hou... | {
"repo_name": "tbossert/applicable-poisoned-integer",
"path": "ETL/hourly-20130425.py",
"copies": "1",
"size": "4552",
"license": "mit",
"hash": -9016269054236314000,
"line_mean": 60.5135135135,
"line_max": 417,
"alpha_frac": 0.6902460457,
"autogenerated": false,
"ratio": 3.291395516992046,
"co... |
__author__ = 'tbruckhaus'
class NumberLetterCounts:
# Number letter counts
# Problem 17
#
# If the numbers 1 to 5 are written out in words: one, two, three, four, five,
# then there are 3 + 3 + 5 + 4 + 4 = 19 letters used in total.
#
# If all the numbers from 1 to 1000 (one thousand) inclu... | {
"repo_name": "bruckhaus/challenges",
"path": "python_challenges/project_euler/p017_number_letter_counts.py",
"copies": "1",
"size": "2950",
"license": "mit",
"hash": 1850876247534882600,
"line_mean": 37.3116883117,
"line_max": 110,
"alpha_frac": 0.5220338983,
"autogenerated": false,
"ratio": 3.8... |
__author__ = 'tbruckhaus'
class ReciprocalCycles:
"""
Reciprocal cycles
Problem 26
A unit fraction contains 1 in the numerator.
The decimal representation of the unit fractions with denominators 2 to 10 are given:
1/2 = 0.5
1/3 = 0.(3)
1/4 = 0.25
1/5 = 0.2... | {
"repo_name": "bruckhaus/challenges",
"path": "python_challenges/project_euler/p026_reciprocal_cycles.py",
"copies": "1",
"size": "1764",
"license": "mit",
"hash": 8442202010060977000,
"line_mean": 25.328358209,
"line_max": 111,
"alpha_frac": 0.5022675737,
"autogenerated": false,
"ratio": 3.61475... |
__author__ = 'tbruckhaus'
class ThousandDigitFibonacciNumber:
"""
1000-digit Fibonacci number
Problem 25
The Fibonacci sequence is defined by the recurrence relation:
Fn = Fn-1 + Fn-2, where F1 = 1 and F2 = 1.
Hence the first 12 terms will be:
F1 = 1
F2 = 1
F3 =... | {
"repo_name": "bruckhaus/challenges",
"path": "python_challenges/project_euler/p025_thousand_digit_fibonacci_number.py",
"copies": "1",
"size": "1069",
"license": "mit",
"hash": -2535509980060994600,
"line_mean": 19.9607843137,
"line_max": 81,
"alpha_frac": 0.5238540692,
"autogenerated": false,
"... |
"""\
This modules provides all non-visualization tools for advanced gene ranking and exploration of genes
"""
from typing import Optional, Collection
import pandas as pd
from anndata import AnnData
from sklearn import metrics
from scipy.sparse import issparse
from .. import logging as logg
from .._utils import select... | {
"repo_name": "theislab/scanpy",
"path": "scanpy/tools/_top_genes.py",
"copies": "1",
"size": "8248",
"license": "bsd-3-clause",
"hash": 6252411829847655000,
"line_mean": 36.6621004566,
"line_max": 114,
"alpha_frac": 0.6509456838,
"autogenerated": false,
"ratio": 3.984541062801932,
"config_test... |
__author__ = 'tchitchikov'
"""
A bubble sort will allow you to compare two elements in an array.
If the first value is larger than the next, it swaps positions.
Once it encounters a value larger than it, it stops.
Then go back to the beginning of the array and select the next element
Repeat the process until all elemen... | {
"repo_name": "tchitchikov/data_structures_and_algorithms",
"path": "sorting/bubble_sort.py",
"copies": "1",
"size": "1052",
"license": "apache-2.0",
"hash": 3324834903215648000,
"line_mean": 34.0666666667,
"line_max": 87,
"alpha_frac": 0.63878327,
"autogenerated": false,
"ratio": 3.7304964539007... |
__author__ = 'tchitchikov'
"""
An insert sort will allow you to compare a single element to multiple at once
The first value is inserted into the sorted portion, all others remain in
the unsorted portion. The next value is selected from the unsorted array and
compared against each value in the sorted array and inserted... | {
"repo_name": "tchitchikov/data_structures_and_algorithms",
"path": "sorting/insertion_sort.py",
"copies": "1",
"size": "1258",
"license": "apache-2.0",
"hash": -3635693184108629000,
"line_mean": 36,
"line_max": 95,
"alpha_frac": 0.6486486486,
"autogenerated": false,
"ratio": 4.058064516129032,
... |
__author__ = 'tdp'
from Decode.utils import isZeroBit
from Execute.utils import *
import operator as op
CPSR_Mask = 0b11111000111111110000001111011111
APSR_Mask = 0b11111000000111100000000000000000
class StandardInstructions:
def __init__(self, registers, process_mode, memory):
self.registers = registers... | {
"repo_name": "tdpearson/armdecode",
"path": "Execute/data_processing.py",
"copies": "1",
"size": "9439",
"license": "mit",
"hash": -7820733421057297000,
"line_mean": 30.8918918919,
"line_max": 131,
"alpha_frac": 0.5742133701,
"autogenerated": false,
"ratio": 4.1039130434782605,
"config_test": ... |
__author__ = 'tdp'
from .decoder_tools import instruction_decoder
default_encoding = "T1"
@instruction_decoder
class t16():
"""
Opcode:00xxxx = _shift_add_subtract_move_compare #a6-224
Opcode:010000 = _data_processing #a6-225
Opcode:010... | {
"repo_name": "tdpearson/armdecode",
"path": "Decode/t16_template.py",
"copies": "1",
"size": "8246",
"license": "mit",
"hash": 7954117729199281000,
"line_mean": 38.0805687204,
"line_max": 115,
"alpha_frac": 0.4316032016,
"autogenerated": false,
"ratio": 2.516325907842539,
"config_test": false,... |
__author__ = 'tdp'
from .decoder_tools import instruction_decoder
default_encoding = "T2"
@instruction_decoder
class t32():
"""
op1:01
op2:00xx0xx = _load_store_multiple
op2:00xx1xx = _load_store_dual_load_store_exclusive_table_branch
op2:01xxxxx = _data_processi... | {
"repo_name": "tdpearson/armdecode",
"path": "Decode/t32_template.py",
"copies": "1",
"size": "11317",
"license": "mit",
"hash": 1778359679977446400,
"line_mean": 26.5352798054,
"line_max": 104,
"alpha_frac": 0.5345939737,
"autogenerated": false,
"ratio": 2.9085068105885377,
"config_test": fals... |
__author__ = 'tdp'
from Decode.utils import getbit, ror as _decode_ror
class NotShifted(Exception):
pass
def lsl(args, psr, registers):
return (val << count) & ((1 << size) - 1)
def lsr(args, psr, registers):
return val >> count
def asr(args, psr, registers):
'''
:param args: Instruction Ar... | {
"repo_name": "tdpearson/armdecode",
"path": "Execute/utils.py",
"copies": "1",
"size": "2010",
"license": "mit",
"hash": -8659118945372699000,
"line_mean": 23.2168674699,
"line_max": 85,
"alpha_frac": 0.5930348259,
"autogenerated": false,
"ratio": 3.2057416267942584,
"config_test": false,
"h... |
__author__ = 'tdp'
from Decode.utils import signed_int, sign_extend
class Branching:
def __init__(self, registers, process_mode, memory):
self.registers = registers
self.process_mode = process_mode
self.memory = memory
def __getitem__(self, item):
return getattr(self, item)
... | {
"repo_name": "tdpearson/armdecode",
"path": "Execute/branching.py",
"copies": "1",
"size": "3243",
"license": "mit",
"hash": -6962036900200929000,
"line_mean": 38.0722891566,
"line_max": 129,
"alpha_frac": 0.4983040395,
"autogenerated": false,
"ratio": 3.4758842443729905,
"config_test": false,... |
__author__ = 'tdp'
from .utils import memory_access_read, memory_access_write
class LoadStore:
def __init__(self, registers, process_mode, memory):
self.registers = registers
self.process_mode = process_mode
self.memory = memory
def __getitem__(self, item):
return getattr(sel... | {
"repo_name": "tdpearson/armdecode",
"path": "Execute/load_store.py",
"copies": "1",
"size": "5698",
"license": "mit",
"hash": -2368312844248378000,
"line_mean": 28.832460733,
"line_max": 103,
"alpha_frac": 0.5954720955,
"autogenerated": false,
"ratio": 4.674323215750615,
"config_test": false,
... |
__author__ = 'tdp'
import re
import shlex
from inspect import cleandoc
from sys import modules
from functools import reduce
from itertools import product
from operator import or_
class instruction_decoder(object):
classes = {} # this is used for the lexer to test for class tokens
def __init__(self, cls):
... | {
"repo_name": "tdpearson/armdecode",
"path": "Decode/decoder_tools.py",
"copies": "1",
"size": "7281",
"license": "mit",
"hash": -1454635509825717000,
"line_mean": 32.2465753425,
"line_max": 115,
"alpha_frac": 0.5431946161,
"autogenerated": false,
"ratio": 3.9874041621029575,
"config_test": fal... |
__author__ = 'tdpreece'
__author__ = 'tdpreece'
import logging
import time
import json
from collections import OrderedDict
from .processing_rules import ProcessingRules
import stomp
logger = logging.getLogger('tdl.client')
logger.addHandler(logging.NullHandler())
class Client(object):
def __init__(self, hostnam... | {
"repo_name": "tdpreece/tdl-client-python",
"path": "src/tdl/client.py",
"copies": "1",
"size": "4929",
"license": "apache-2.0",
"hash": 6028652996970297000,
"line_mean": 36.3409090909,
"line_max": 123,
"alpha_frac": 0.5982958004,
"autogenerated": false,
"ratio": 4.241824440619621,
"config_test... |
__author__ = 'tdwilkinson'
from sunpy.instr.aia import Response
import matplotlib.pyplot as plt
import numpy as np
from astropy.table import Table, Column
import pandas as pd
path = '/Users/willbarnes/Documents/gsoc/aia_response/ssw_aia_response_data/'
# channel center and parameter list needed for loading in data
... | {
"repo_name": "wtbarnes/aia_response",
"path": "run_response.py",
"copies": "1",
"size": "5414",
"license": "mit",
"hash": -6196621847252043000,
"line_mean": 35.5810810811,
"line_max": 149,
"alpha_frac": 0.5838566679,
"autogenerated": false,
"ratio": 3.086659064994299,
"config_test": false,
"... |
__author__ = 'team-entaku'
import sys
import cv2
import numpy as np
import math
import matplotlib.pyplot as plt
import scipy.cluster.vq
import scipy.spatial.distance as distance
from chainer import computational_graph as c
from matplotlib.pyplot import show
from scipy.cluster.hierarchy import linkage, dendrogram, fclus... | {
"repo_name": "entaku/kusarigama",
"path": "src/sample_cnn_mnist.py",
"copies": "1",
"size": "1591",
"license": "mit",
"hash": -6517962894691784000,
"line_mean": 23.859375,
"line_max": 73,
"alpha_frac": 0.6681332495,
"autogenerated": false,
"ratio": 3.138067061143984,
"config_test": false,
"h... |
__author__ = 'team-entaku'
import cv2
import numpy as np
import numpy as np
import math
import matplotlib.pyplot as plt
import scipy.cluster.vq
import scipy.spatial.distance as distance
from chainer import computational_graph as c
from matplotlib.pyplot import show
from scipy.cluster.hierarchy import linkage, dendrog... | {
"repo_name": "entaku/kusarigama",
"path": "src/sample_ocr.py",
"copies": "1",
"size": "4599",
"license": "mit",
"hash": -5898954372958807000,
"line_mean": 29.66,
"line_max": 113,
"alpha_frac": 0.5011959122,
"autogenerated": false,
"ratio": 3.658711217183771,
"config_test": false,
"has_no_key... |
__author__ = 'team-entaku'
import cv2
import numpy as np
def process_mser(orig, delta, min_area, max_area, max_variation, min_diversity, max_evolution, area_threshold,
min_margin, edge_blur_size):
gray = cv2.cvtColor(orig, cv2.COLOR_BGR2GRAY)
mser = cv2.MSER(delta, min_area, max_area, max_va... | {
"repo_name": "entaku/kusarigama",
"path": "src/sample_video.py",
"copies": "1",
"size": "1933",
"license": "mit",
"hash": 5702195707817264000,
"line_mean": 27.4264705882,
"line_max": 110,
"alpha_frac": 0.5209518883,
"autogenerated": false,
"ratio": 3.3852889667250436,
"config_test": false,
"... |
__author__ = 'Team'
from sklearn.linear_model import LogisticRegression as scikitLR
from sklearn.linear_model import SGDClassifier as scikitSGD
from sklearn.ensemble import RandomForestClassifier as scikitRF
from sklearn.ensemble import ExtraTreesClassifier as scikitET
from sklearn.ensemble import AdaBoostClassifier a... | {
"repo_name": "dssg/education-college-public",
"path": "code/modeling/models/all_models.py",
"copies": "1",
"size": "4300",
"license": "mit",
"hash": 5415070172095116000,
"line_mean": 23.4318181818,
"line_max": 137,
"alpha_frac": 0.7095348837,
"autogenerated": false,
"ratio": 2.9291553133514987,
... |
__author__ = 'Tea'
import json
from factbook_mapping_query_types import StringQuery, NestedQuery, RegexQuery, CompleteQuery
class QueryBuilder:
def __init__(self):
self.unwrapped_query_items = []
self.nested_query_items = []
def with_independence_date(self, independence_date):
indepen... | {
"repo_name": "JDownloader/GEL-3014_Design3",
"path": "questionanswering/query_builder.py",
"copies": "1",
"size": "1738",
"license": "mit",
"hash": -3642340743535742000,
"line_mean": 37.6222222222,
"line_max": 114,
"alpha_frac": 0.6800920598,
"autogenerated": false,
"ratio": 3.7057569296375266,
... |
__author__ = 'TEB215'
# Input List: volts, resistance
# Output List: volts, resistance, watts, amps
# Function Real, Real input_values()
# Declare Real volts
# Declare Real resistance
#
# Display "Please enter volts:"
# Input volts
# Display "Please enter resistance:"
# Input resistance
# Return volts, ... | {
"repo_name": "nomad-mystic/nomadmystic",
"path": "fileSystem/school-projects/development/softwaredesignandcomputerlogiccis122/cis122lab2/python/trst_for_class.py",
"copies": "1",
"size": "3338",
"license": "mit",
"hash": 8147701819687585000,
"line_mean": 25.9193548387,
"line_max": 78,
"alpha_frac": ... |
__author__ = 'teddydestodes'
import mmap
import os
import struct
PIO_OFFSET = 0xfffff000
PIOA = 0x400
PIOB = 0x600
PIOC = 0x800
PIOD = 0xa00
PIO_PER = 0x0000 # PIO Enable Register
PIO_PDR = 0x0004 # PIO Disable Register
PIO_PSR = 0x0008 # PIO Status Register
PIO_OER = 0x0010 # PIO Enable Register
PIO_ODR = 0x0... | {
"repo_name": "TeddyDesTodes/pyflipdot",
"path": "pyflipdot/lawo/at91PIO.py",
"copies": "1",
"size": "5966",
"license": "bsd-3-clause",
"hash": 6006330884485843000,
"line_mean": 30.9037433155,
"line_max": 90,
"alpha_frac": 0.5985584982,
"autogenerated": false,
"ratio": 3.029964448958862,
"confi... |
__author__ = 'teddydestodes'
import os
import pickle
base_path = os.path.join(os.path.dirname(__file__), 'fontdata')
class Font(object):
def __init__(self, code, name, charmap=None):
self._code = code
self._name = name
if charmap is None:
self._charmap = []
else:
... | {
"repo_name": "TeddyDesTodes/pyflipdot",
"path": "pyflipdot/lawo/fonts.py",
"copies": "1",
"size": "1432",
"license": "bsd-3-clause",
"hash": -3468500535968939500,
"line_mean": 27.0980392157,
"line_max": 75,
"alpha_frac": 0.530726257,
"autogenerated": false,
"ratio": 3.7389033942558747,
"config... |
__author__ = 'teddydestodes'
import sys
import binascii
import socket
import select
import hashlib
class ApiRos:
"""Routeros api"""
def __init__(self, sk):
self.sk = sk
self.currenttag = 0
def login(self, username, pwd):
for repl, attrs in self.talk(["/login"]):
chal ... | {
"repo_name": "TeddyDesTodes/pyflipdot",
"path": "pyflipdot/plugins/mikrotik/__init__.py",
"copies": "1",
"size": "5309",
"license": "bsd-3-clause",
"hash": 3781473098376432600,
"line_mean": 27.2446808511,
"line_max": 95,
"alpha_frac": 0.4403842532,
"autogenerated": false,
"ratio": 3.544058744993... |
__author__ = 'teddy'
from app.extensions import db
from sqlalchemy_utils import ArrowType, ChoiceType
import arrow
from enum import Enum
class EventType(Enum):
"""Enum for different event types"""
off = 1
on = 2
hi = 3
low = 4
EventType.off.label = 'Off'
EventType.on.label = 'On'
EventType.hi.la... | {
"repo_name": "Teddy-Schmitz/temperature_admin",
"path": "models/event.py",
"copies": "1",
"size": "1382",
"license": "mit",
"hash": -125764467007295000,
"line_mean": 26.64,
"line_max": 103,
"alpha_frac": 0.6512301013,
"autogenerated": false,
"ratio": 3.745257452574526,
"config_test": false,
... |
# TZDIR hacks by Keith Waclena <k-waclena@uchicago.edu>
# http://www.lib.uchicago.edu/keith/
import os
# FreeBSD and Linux don't have the same ones... *sigh*
AlternateMap = {
"US/Pacific": "PST8PDT",
"US/Mountain": "MST7MDT",
"US/Central": "CST6CDT",
"US/Eastern": "EST5EDT",
"US/Hawaii": "Pacific/Honolulu"... | {
"repo_name": "jeske/csla",
"path": "pysrc/base/Zone.py",
"copies": "1",
"size": "5128",
"license": "bsd-2-clause",
"hash": 7519974740411675000,
"line_mean": 27.0218579235,
"line_max": 122,
"alpha_frac": 0.5963338534,
"autogenerated": false,
"ratio": 2.6918635170603675,
"config_test": false,
... |
__author__ = 'Ted Ralphs'
__maintainer__ = 'Ted Ralphs (ted@lehigh.edu)'
import random, sys, math
try:
from src.blimpy import PriorityQueue
except ImportError:
from coinor.blimpy import PriorityQueue
import time
from pulp import LpVariable, lpSum, LpProblem, LpMaximize, LpConstraint
from pulp import ... | {
"repo_name": "tkralphs/GrUMPy",
"path": "src/grumpy/BranchAndBound.py",
"copies": "1",
"size": "20137",
"license": "epl-1.0",
"hash": -7825673341613232000,
"line_mean": 44.6134259259,
"line_max": 89,
"alpha_frac": 0.4721160054,
"autogenerated": false,
"ratio": 3.9796442687747033,
"config_test"... |
__author__ = 'teemu kanstren'
from pysnmp.entity.rfc3413.oneliner import cmdgen
from enum import Enum
class OID:
def __init__(self, oid_id, oid_name, community, ip, port, target_name, type):
self.oid_id = oid_id
self.oid_name = oid_name
self.community = community
self.ip = ip
... | {
"repo_name": "mukatee/pypro",
"path": "src/pypro/snmp/oids/oid.py",
"copies": "1",
"size": "1854",
"license": "mit",
"hash": -5917662511817231000,
"line_mean": 31.5263157895,
"line_max": 86,
"alpha_frac": 0.6014023732,
"autogenerated": false,
"ratio": 3.5381679389312977,
"config_test": false,
... |
__author__ = 'teemu kanstren'
from pysnmp.entity.rfc3413.oneliner import cmdgen
#cpu load measures. a set of measures derived from reading several oid values, (system, user, nice, idle counters).
class CPULoadPrct:
def __init__(self, community, ip, port, target_name):
# sometimes the OID number sequence ... | {
"repo_name": "mukatee/pypro",
"path": "src/pypro/snmp/oids/cpu_load_prct.py",
"copies": "1",
"size": "5643",
"license": "mit",
"hash": 4777939518357325000,
"line_mean": 44.8780487805,
"line_max": 151,
"alpha_frac": 0.6053517632,
"autogenerated": false,
"ratio": 3.4984500929944202,
"config_test... |
__author__ = 'teemu kanstren'
from pysnmp.entity.rfc3413.oneliner import cmdgen
#ram used. a measure derived from reading two oid values, total ram in system and free ram in system.
class RamUsed:
def __init__(self, community, ip, port, target_name):
# sometimes the OID number sequence starts with "." whi... | {
"repo_name": "mukatee/pypro",
"path": "src/pypro/snmp/oids/ram_used.py",
"copies": "1",
"size": "3020",
"license": "mit",
"hash": -8988274097485469000,
"line_mean": 42.768115942,
"line_max": 125,
"alpha_frac": 0.6291390728,
"autogenerated": false,
"ratio": 3.700980392156863,
"config_test": fal... |
__author__ = 'teemu kanstren'
import argparse
import os
import csv
from influxdb import InfluxDBClient
from datetime import datetime
parser = argparse.ArgumentParser()
parser.add_argument("-db", "--database", help="Database name", default="_internal", nargs='?')
parser.add_argument("-ip", "--hostname", help="Database... | {
"repo_name": "mukatee/influxdb-dumper",
"path": "src/influx_csv_dumper.py",
"copies": "1",
"size": "2883",
"license": "mit",
"hash": -1123966406330440600,
"line_mean": 44.7619047619,
"line_max": 138,
"alpha_frac": 0.6309399931,
"autogenerated": false,
"ratio": 3.9277929155313354,
"config_test"... |
__author__ = 'teemu kanstren'
import json
import argparse
import os
from influxdb import InfluxDBClient
from datetime import datetime
parser = argparse.ArgumentParser()
parser.add_argument("-db", "--database", help="Database name", default="_internal", nargs='?')
parser.add_argument("-ip", "--hostname", help="Databas... | {
"repo_name": "mukatee/influxdb-dumper",
"path": "src/influx_json_dumper.py",
"copies": "1",
"size": "2606",
"license": "mit",
"hash": -4518890527869100500,
"line_mean": 44.7192982456,
"line_max": 138,
"alpha_frac": 0.6204911742,
"autogenerated": false,
"ratio": 4.003072196620583,
"config_test"... |
__author__ = 'teemu kanstren'
import os
import unittest
import shutil
import pkg_resources
from pypro.local.loggers.es_file_logger import ESFileLogger
from pypro import utils
import pypro.tests.t_assert as t_assert
import pypro.local.config as config
#weird regex syntax, pattern required, weird errors...
class Tes... | {
"repo_name": "mukatee/pypro",
"path": "src/pypro/tests/snmp/es_log_tests/es_log_tests.py",
"copies": "1",
"size": "4564",
"license": "mit",
"hash": -7767147677381628000,
"line_mean": 39.389380531,
"line_max": 105,
"alpha_frac": 0.5683610868,
"autogenerated": false,
"ratio": 2.7829268292682925,
... |
__author__ = 'teemu kanstren'
import time
from pysnmp.entity.rfc3413.oneliner import cmdgen
from pypro.snmp import config
class SNMPPoller:
def __init__(self, oid, snmp, loggers):
self.oid = oid
self.snmp = snmp
self.loggers = loggers
def poll(self):
oid = self.oid
# er... | {
"repo_name": "mukatee/pypro",
"path": "src/pypro/snmp/snmp_poller.py",
"copies": "1",
"size": "2462",
"license": "mit",
"hash": 6836743077739058000,
"line_mean": 44.5925925926,
"line_max": 119,
"alpha_frac": 0.5848903331,
"autogenerated": false,
"ratio": 3.719033232628399,
"config_test": true,... |
__author__ = 'teemu kanstren'
import time
import os
import unittest
import shutil
import inspect
from elasticsearch import Elasticsearch
import pkg_resources
from pypro.local.loggers.es_network_logger import ESNetLogger
from pypro import utils
import pypro.tests.t_assert as t_assert
import pypro.local.config as confi... | {
"repo_name": "mukatee/pypro",
"path": "src/pypro/tests/local/es_nw_tests/es_nw_tests.py",
"copies": "1",
"size": "12337",
"license": "mit",
"hash": -2593187952087731700,
"line_mean": 48.546184739,
"line_max": 125,
"alpha_frac": 0.5726675853,
"autogenerated": false,
"ratio": 2.959222835212281,
... |
__author__ = 'teemu kanstren'
import time
from pypro.local import config
import pypro.local.body_builder as bb
from pypro.head_builder import HeadBuilder
class KafkaLogger:
def __init__(self):
from kafka import SimpleProducer, KafkaClient
from kafka.common import LeaderNotAvailableError
... | {
"repo_name": "mukatee/pypro",
"path": "src/pypro/local/loggers/kafka_logger.py",
"copies": "1",
"size": "6637",
"license": "mit",
"hash": 7731761685613782000,
"line_mean": 45.0416666667,
"line_max": 131,
"alpha_frac": 0.6421783074,
"autogenerated": false,
"ratio": 3.563978494623656,
"config_te... |
__author__ = 'teemu kanstren'
import time
from pysnmp.entity.rfc3413.oneliner import cmdgen
import pypro.snmp.config as config
from pypro.snmp.loggers.es_network_logger import ESNetLogger
from pypro.snmp.loggers.es_file_logger import ESFileLogger
from pypro.snmp.loggers.csv_logger import CSVFileLogger
from pypro.snm... | {
"repo_name": "mukatee/pypro",
"path": "src/pypro/snmp/main.py",
"copies": "1",
"size": "1989",
"license": "mit",
"hash": -6332648855921315000,
"line_mean": 31.0806451613,
"line_max": 107,
"alpha_frac": 0.708396179,
"autogenerated": false,
"ratio": 3.2660098522167487,
"config_test": true,
"ha... |
__author__ = 'teemu kanstren'
import time
import psutil
from pypro.local import config
from pypro.local.loggers.csv_file_logger import CSVFileLogger
from pypro.local.proc_poller import ProcPoller
class MemPoller:
def __init__(self, proc_poller, loggers):
self.loggers = loggers
self.proc_poller ... | {
"repo_name": "mukatee/pypro",
"path": "src/pypro/local/mem_poller.py",
"copies": "1",
"size": "2519",
"license": "mit",
"hash": 4951545539357593000,
"line_mean": 32.1578947368,
"line_max": 91,
"alpha_frac": 0.5791980945,
"autogenerated": false,
"ratio": 3.875384615384615,
"config_test": false,... |
__author__ = 'teemu kanstren'
import time
import psutil
from pypro.local.loggers.csv_file_logger import CSVFileLogger
class IOPoller:
def __init__(self, loggers):
self.loggers = loggers
def poll_system(self, epoch):
#TODO: per NIC data
#TODO: disk data
net_counters = psutil... | {
"repo_name": "mukatee/pypro",
"path": "src/pypro/local/io_poller.py",
"copies": "1",
"size": "1178",
"license": "mit",
"hash": 6105343740320048000,
"line_mean": 28.475,
"line_max": 116,
"alpha_frac": 0.6273344652,
"autogenerated": false,
"ratio": 3.6134969325153374,
"config_test": false,
"ha... |
__author__ = 'teemu kanstren'
import time
import psutil
import pypro.local.config as config
from pypro.local.proc_poller import ProcPoller
from pypro.local.loggers.csv_file_logger import CSVFileLogger
from pypro.local.loggers.es_file_logger import ESFileLogger
class CPUPoller:
# process priority
trace_nice... | {
"repo_name": "mukatee/pypro",
"path": "src/pypro/local/cpu_poller.py",
"copies": "1",
"size": "3142",
"license": "mit",
"hash": -5397236523519826000,
"line_mean": 33.9111111111,
"line_max": 117,
"alpha_frac": 0.5903882877,
"autogenerated": false,
"ratio": 3.8223844282238444,
"config_test": fal... |
__author__ = 'teemu kanstren'
import time
import pypro.local.config as config
def session_info():
now = int(time.time()) * 1000
body = '{"description" : "started ('+ config.SESSION_NAME + ')"}'
return body
def cpu_sys(epoch, user_count, system_count, idle_count, percent):
"CPU metrics at system lev... | {
"repo_name": "mukatee/pypro",
"path": "src/pypro/local/body_builder.py",
"copies": "1",
"size": "3043",
"license": "mit",
"hash": -436188237694733950,
"line_mean": 46.546875,
"line_max": 128,
"alpha_frac": 0.5142951035,
"autogenerated": false,
"ratio": 2.911961722488038,
"config_test": false,
... |
__author__ = 'teemu kanstren'
#log into mysql? you can use create_db.sql file to create the schema
MYSQL_ENABLED = False
#log directly into elasticsearch (over the network)
ES_NW_ENABLED = True
#log to file using elasticsearch bulk format
ES_FILE_ENABLED = False
#log into a file using CSV format
CSV_ENABLED = True
#pr... | {
"repo_name": "mukatee/pypro",
"path": "src/pypro/local/config.py",
"copies": "1",
"size": "1164",
"license": "mit",
"hash": -3550084621144007700,
"line_mean": 26.0697674419,
"line_max": 102,
"alpha_frac": 0.7465635739,
"autogenerated": false,
"ratio": 3.27887323943662,
"config_test": false,
... |
__author__ = 'Teer'
# -*- coding: utf-8 -*-
# bbsSpider, Created on Oct, 2014
# version:
# author: chenqx @http://chenqx.github.com
# See more: http://doc.scrapy.org/en/latest/index.html
from scrapy.selector import Selector
from scrapy.http import Request
from scrapy.contrib.spiders import CrawlSpider
from scrapy.cont... | {
"repo_name": "euangelion666/Scrapy-test",
"path": "tutorial/tutorial/spiders/testSpider.py",
"copies": "1",
"size": "2227",
"license": "apache-2.0",
"hash": 4481530820471466000,
"line_mean": 40.2407407407,
"line_max": 116,
"alpha_frac": 0.6403233049,
"autogenerated": false,
"ratio": 3.3539156626... |
__author__ = 'tek tengu'
from socket import *
SCAN_PROTOCOL = "Scan Protocol"
SCAN_PROTOCOL_TCP = "TCP"
SCAN_PROTOCOL_UDP = "UDP"
STATUS_OPEN = "Open"
STATUS_CLOSED = "Closed"
results = {}
def scan(args, target, ports):
if(args.get(SCAN_PROTOCOL).equals(SCAN_PROTOCOL_TCP)):
doTCPScan(args, target, ports... | {
"repo_name": "tektengu/bdscan",
"path": "python/scanner.py",
"copies": "1",
"size": "3264",
"license": "apache-2.0",
"hash": 8439899150357882000,
"line_mean": 28.4054054054,
"line_max": 64,
"alpha_frac": 0.5579044118,
"autogenerated": false,
"ratio": 3.8949880668257757,
"config_test": false,
... |
from burp import IBurpExtender
from burp import IHttpListener
from burp import IProxyListener
from burp import IInterceptedProxyMessage
from burp import IContextMenuFactory
from javax.swing import JMenuItem
from java.awt.event import ActionListener
from java.io import PrintWriter
class BurpExtender(IBurpExtender,I... | {
"repo_name": "aurainfosec/burp-multi-browser-highlighting",
"path": "multi-browser.py",
"copies": "1",
"size": "2332",
"license": "mit",
"hash": -8368643589153293000,
"line_mean": 30.5135135135,
"line_max": 150,
"alpha_frac": 0.7534305317,
"autogenerated": false,
"ratio": 3.4446085672082716,
"... |
import inspect
import os.path as op
import numpy as np
from numpy.testing import (assert_array_almost_equal, assert_array_equal,
assert_equal)
import pytest
from scipy import linalg
import scipy.io
import mne
from mne import pick_types, Epochs, find_events, read_events
from mne.datasets.te... | {
"repo_name": "teonlamont/mne-python",
"path": "mne/io/kit/tests/test_kit.py",
"copies": "4",
"size": "10903",
"license": "bsd-3-clause",
"hash": 4864608544539952000,
"line_mean": 41.2596899225,
"line_max": 79,
"alpha_frac": 0.6155186646,
"autogenerated": false,
"ratio": 2.8997340425531917,
"co... |
import os.path as op
import warnings
from nose.tools import assert_equal, assert_true, assert_raises
import numpy as np
from numpy.testing import (assert_array_equal, assert_almost_equal,
assert_allclose, assert_array_almost_equal,
assert_array_less)
from mne.tes... | {
"repo_name": "jniediek/mne-python",
"path": "mne/channels/tests/test_montage.py",
"copies": "3",
"size": "12085",
"license": "bsd-3-clause",
"hash": -6601845814831132000,
"line_mean": 43.1058394161,
"line_max": 115,
"alpha_frac": 0.5930492346,
"autogenerated": false,
"ratio": 2.774334251606979,
... |
import os.path as op
import warnings
from nose.tools import assert_equal, assert_true, assert_raises
import numpy as np
from scipy.io import savemat
from numpy.testing import (assert_array_equal, assert_almost_equal,
assert_allclose, assert_array_almost_equal,
a... | {
"repo_name": "nicproulx/mne-python",
"path": "mne/channels/tests/test_montage.py",
"copies": "2",
"size": "19747",
"license": "bsd-3-clause",
"hash": 7826998580103428000,
"line_mean": 43.1767337808,
"line_max": 125,
"alpha_frac": 0.5691497443,
"autogenerated": false,
"ratio": 2.799404593138645,
... |
import os.path as op
import warnings
from nose.tools import assert_equal, assert_true
import numpy as np
from numpy.testing import (assert_array_equal, assert_almost_equal,
assert_allclose, assert_array_almost_equal)
from mne.channels.montage import read_montage, _set_montage, read_dig_mo... | {
"repo_name": "cmoutard/mne-python",
"path": "mne/channels/tests/test_montage.py",
"copies": "1",
"size": "8592",
"license": "bsd-3-clause",
"hash": -7349711151815665000,
"line_mean": 39.1495327103,
"line_max": 108,
"alpha_frac": 0.5715782123,
"autogenerated": false,
"ratio": 2.7814826804791193,
... |
import os.path as op
import numpy as np
from numpy.testing import (assert_array_almost_equal, assert_array_equal,
assert_equal, assert_allclose)
import pytest
from scipy import linalg
import scipy.io
import mne
from mne import pick_types, Epochs, find_events, read_events
from mne.datasets.... | {
"repo_name": "bloyl/mne-python",
"path": "mne/io/kit/tests/test_kit.py",
"copies": "11",
"size": "15595",
"license": "bsd-3-clause",
"hash": -8150581624968278000,
"line_mean": 42.9295774648,
"line_max": 146,
"alpha_frac": 0.6207758897,
"autogenerated": false,
"ratio": 2.8038475368572455,
"conf... |
from contextlib import nullcontext
from itertools import chain
import os
import os.path as op
import pytest
import numpy as np
from functools import partial
from string import ascii_lowercase
from numpy.testing import (assert_array_equal,
assert_allclose, assert_equal)
import matplotlib.p... | {
"repo_name": "drammock/mne-python",
"path": "mne/channels/tests/test_montage.py",
"copies": "1",
"size": "58235",
"license": "bsd-3-clause",
"hash": 1265565612402510600,
"line_mean": 36.7169689119,
"line_max": 122,
"alpha_frac": 0.5641796171,
"autogenerated": false,
"ratio": 2.778519967555704,
... |
__author__ = 'teo'
from bs4 import BeautifulSoup
import requests
import itertools
import sys
import re
sys.setrecursionlimit(1073741824)
'''
Used for testing, to be replaced with IO system
start = "http://archiveofourown.org/works/search?utf8=%E2%9C%93&work_search[query]=&work_search[title]=&work_search[creator]=&wor... | {
"repo_name": "teocollin1995/AO3-Data-Collector",
"path": "Current/main.py",
"copies": "1",
"size": "13713",
"license": "mit",
"hash": 2904584044458972000,
"line_mean": 32.205811138,
"line_max": 656,
"alpha_frac": 0.6113906512,
"autogenerated": false,
"ratio": 3.2024754787482483,
"config_test":... |
__author__ = 'terry'
import boto
import boto
import boto.s3
import os.path
import sys
from boto.s3.key import Key
# Fill these in - you get them when you sign up for S3
AWS_ACCESS_KEY_ID = 'AKIAJ55GGPKYFEXJIZ7Q'
AWS_ACCESS_KEY_SECRET = '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'
AWS_REGION = 'us-east-1'
bucket_name ... | {
"repo_name": "HampsteadLionsBaseball/website",
"path": "up_to_s3.py",
"copies": "1",
"size": "2140",
"license": "mit",
"hash": -1838482701152641500,
"line_mean": 26.4358974359,
"line_max": 90,
"alpha_frac": 0.6570093458,
"autogenerated": false,
"ratio": 3.1332357247437774,
"config_test": false... |
__author__ = 'tester'
from model.contact import Contact
from model.group import Group
from model.cont_in_group import Cont_in_Groups
import random
def test_remove_contact_to_group(app, db):
# preconditions
# if groups list is empty
if len(db.get_group_list()) == 0:
app.group.create(Group(name="te... | {
"repo_name": "EwgOskol/python_training",
"path": "test/test_remove_contact_from_group.py",
"copies": "1",
"size": "1619",
"license": "apache-2.0",
"hash": 9127684351147235000,
"line_mean": 40.5128205128,
"line_max": 107,
"alpha_frac": 0.6812847437,
"autogenerated": false,
"ratio": 3.113461538461... |
__author__ = 'tester'
from model.contact import Contact
import re
class ContactHelper:
def __init__(self, app):
self.app = app
def change_contact_field_value(self, field_name, text):
wd = self.app.wd
if text is not None:
wd.find_element_by_name(field_name).click()
... | {
"repo_name": "EwgOskol/python_training",
"path": "fixture/contact.py",
"copies": "1",
"size": "8648",
"license": "apache-2.0",
"hash": 6749370584427100000,
"line_mean": 43.3487179487,
"line_max": 169,
"alpha_frac": 0.6181776133,
"autogenerated": false,
"ratio": 3.492730210016155,
"config_test"... |
__author__ = 'tester'
from model.group import Group
import random
def test_modify_group_name(app, db, check_ui):
if len(db.get_group_list()) == 0:
app.group.create(Group(name="test"))
old_groups = db.get_group_list()
groupm = random.choice(old_groups)
groupn = Group(name="New group")
grou... | {
"repo_name": "EwgOskol/python_training",
"path": "test/test_modify_group.py",
"copies": "1",
"size": "1082",
"license": "apache-2.0",
"hash": 1662280481144151800,
"line_mean": 35.0666666667,
"line_max": 113,
"alpha_frac": 0.6524953789,
"autogenerated": false,
"ratio": 2.877659574468085,
"confi... |
__author__ = 'tester'
from model.group import Group
class GroupHelper:
def __init__(self, app):
self.app = app
def open_groups_page(self):
wd = self.app.wd
if not(wd.current_url.endswith("/group.php") and len(wd.find_elements_by_name("new")) > 0):
wd.find_element_by_link... | {
"repo_name": "EwgOskol/python_training",
"path": "fixture/group.py",
"copies": "1",
"size": "4024",
"license": "apache-2.0",
"hash": 1731305066222925000,
"line_mean": 31.4516129032,
"line_max": 99,
"alpha_frac": 0.5882206759,
"autogenerated": false,
"ratio": 3.454077253218884,
"config_test": f... |
__author__ = 'tester'
from pony.orm import *
from datetime import datetime
from model.group import Group
from model.contact import Contact
from pymysql.converters import decoders
class ORMFixture:
db = Database()
class ORMGroup(db.Entity):
_table_ = 'group_list'
id = PrimaryKey(int, column='... | {
"repo_name": "EwgOskol/python_training",
"path": "fixture/orm.py",
"copies": "1",
"size": "2484",
"license": "apache-2.0",
"hash": -9187916817547443000,
"line_mean": 39.7213114754,
"line_max": 126,
"alpha_frac": 0.6670692432,
"autogenerated": false,
"ratio": 3.6691285081240768,
"config_test": ... |
__author__ = 'tester'
#from selenium.webdriver.firefox.webdriver import WebDriver
from selenium import webdriver
from fixture.session import SessionHelper
from fixture.group import GroupHelper
from fixture.contact import ContactHelper
class Application:
def __init__(self, browser, base_url):
if browser =... | {
"repo_name": "EwgOskol/python_training",
"path": "fixture/application.py",
"copies": "1",
"size": "1117",
"license": "apache-2.0",
"hash": -8464305525242134,
"line_mean": 27.641025641,
"line_max": 65,
"alpha_frac": 0.6016114593,
"autogenerated": false,
"ratio": 4.1992481203007515,
"config_test... |
__author__ = 'tester'
from sys import maxsize
import re
class Contact:
def __init__(self, fname=None, lname=None, company=None, address=None, hm_page=None, id=None,
homephone=None, mobilephone=None, workphone=None, secondaryphone=None,
all_phones_from_home_page=None, email=None,... | {
"repo_name": "EwgOskol/python_training",
"path": "model/contact.py",
"copies": "1",
"size": "1381",
"license": "apache-2.0",
"hash": 8069541596278281000,
"line_mean": 33.525,
"line_max": 106,
"alpha_frac": 0.5713251267,
"autogenerated": false,
"ratio": 3.4611528822055138,
"config_test": false,... |
__author__ = 'tester'
import mysql.connector
from model.group import Group
from model.contact import Contact
from model.cont_in_group import Cont_in_Groups
class dbFixture:
def __init__(self, host, name, user, password):
self.host = host
self.name = name
self.user = user
self.pass... | {
"repo_name": "EwgOskol/python_training",
"path": "fixture/db.py",
"copies": "1",
"size": "3221",
"license": "apache-2.0",
"hash": -860056373899388900,
"line_mean": 39.7848101266,
"line_max": 149,
"alpha_frac": 0.5802545793,
"autogenerated": false,
"ratio": 3.9667487684729066,
"config_test": fa... |
__author__ = 'tester'
import re
# from random import randrange
from model.contact import Contact
def test_contact_info_on_home_page(app, db):
contact_from_db = list(sorted(db.get_contact_list(), key=Contact.id_or_max))
contact_from_home_page = list(sorted(app.contact.get_contact_list(), key=Contact.id_or_max... | {
"repo_name": "EwgOskol/python_training",
"path": "test/test_compare_contact_info.py",
"copies": "1",
"size": "2929",
"license": "apache-2.0",
"hash": 5770592971327583000,
"line_mean": 61.3191489362,
"line_max": 163,
"alpha_frac": 0.6322977125,
"autogenerated": false,
"ratio": 3.1060445387062567,... |
__author__ = 'tester'
import re
def test_phones_on_home_page(app):
contact_from_home_page = app.contact.get_contact_list()[0]
contact_from_edit_page = app.contact.get_contact_info_from_edit_page(0)
assert contact_from_home_page.all_phones_from_home_page == merge_phones_like_on_home_page(contact_from_edit... | {
"repo_name": "EwgOskol/python_training",
"path": "test/test_phones.py",
"copies": "1",
"size": "1242",
"license": "apache-2.0",
"hash": 4048537062423133000,
"line_mean": 40.4,
"line_max": 126,
"alpha_frac": 0.6682769726,
"autogenerated": false,
"ratio": 3.3031914893617023,
"config_test": false... |
__author__ = 'tester'
class SessionHelper:
def __init__(self, app):
self.app = app
def login(self, username, password):
wd = self.app.wd
wd.find_element_by_name("user").click()
wd.find_element_by_name("user").clear()
wd.find_element_by_name("user").send_keys("%s" % us... | {
"repo_name": "EwgOskol/python_training",
"path": "fixture/session.py",
"copies": "1",
"size": "1457",
"license": "apache-2.0",
"hash": -3968940015350741000,
"line_mean": 29.3541666667,
"line_max": 73,
"alpha_frac": 0.5628002745,
"autogenerated": false,
"ratio": 3.3648960739030023,
"config_test... |
__author__ = 'tfg'
def get_most_used(plist):
import os
f = os.getenv("SUIBASH_HOME") + "/" + os.getenv("SUIBASH_SHELL") + "_command_usage"
fd = open(f, 'r')
d = {}
for line in fd.readlines():
line = line[:-1]
if line in plist:
if line in d:
d[line] += 1
... | {
"repo_name": "ShakMR/suibash",
"path": "String/distance.py",
"copies": "1",
"size": "2414",
"license": "mit",
"hash": 5601913787388777000,
"line_mean": 32.5277777778,
"line_max": 115,
"alpha_frac": 0.4875724938,
"autogenerated": false,
"ratio": 2.908433734939759,
"config_test": false,
"has_n... |
__author__ = 'tflourenco'
#!/usr/bin/python
import re
from numpy import *
from pylab import *
from matplotlib import pyplot as plt
import scipy.interpolate as inter
from scipy.interpolate import interp1d
from matplotlib.ticker import FuncFormatter
from matplotlib.dates import DateFormatter
import csv
import sys
import ... | {
"repo_name": "TiagoLourenco/DataAnalisis",
"path": "sis.py",
"copies": "1",
"size": "12263",
"license": "unlicense",
"hash": 2876572454585778700,
"line_mean": 22.1396226415,
"line_max": 121,
"alpha_frac": 0.5978145641,
"autogenerated": false,
"ratio": 2.8203771849126036,
"config_test": false,
... |
__author__ = 'tgupta'
from mi.core.common import BaseEnum
import re
from mi.dataset.parser.common_regexes import \
END_OF_LINE_REGEX, \
ANY_CHARS_REGEX
# regex for identifying start of a header line
START_HEADER = r'\*'
# Time tuple corresponding to January 1st, 2000
JAN_1_2000 = (2000, 1, 1, 0, 0, 0, 0, 0,... | {
"repo_name": "JeffRoy/mi-dataset",
"path": "mi/dataset/parser/ctdbp_common.py",
"copies": "8",
"size": "1155",
"license": "bsd-2-clause",
"hash": -7096582074701328000,
"line_mean": 30.2432432432,
"line_max": 77,
"alpha_frac": 0.696969697,
"autogenerated": false,
"ratio": 3.2905982905982905,
"c... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.