text stringlengths 0 1.05M | meta dict |
|---|---|
import hashlib
import os
import argparse
import sys
import shutil
def md5_for_file(f, block_size=2**20):
"""Generate a hash key from a file"""
md5 = hashlib.md5()
while True:
data = f.read(block_size)
if not data:
break
md5.update(data)
return md5.hexdigest()
if __name__ == '__mai... | {
"repo_name": "dawnsong/ANTs",
"path": "Utilities/ANTSMakeMD5SigFileAndMoveData.py",
"copies": "11",
"size": "2468",
"license": "bsd-3-clause",
"hash": 4425310765839724000,
"line_mean": 33.2777777778,
"line_max": 118,
"alpha_frac": 0.7034035656,
"autogenerated": false,
"ratio": 3.423023578363384,... |
__author__ = 'Hans-Werner Roitzsch'
__date__ = '2015-12-29'
from adapter.SensorAdapter import SensorAdapter
from controller.GPSController import GPSController
class GPSSensorAdapter(SensorAdapter):
def __init__(self):
self.last_values = {}
self.gpsc = GPSController()
try:
self.gpsc.start()
except:
... | {
"repo_name": "hwroitzsch/BikersLifeSaver",
"path": "src/nfz_module/adapter/GPSSensorAdapter.py",
"copies": "2",
"size": "1129",
"license": "mit",
"hash": 5748608065494157000,
"line_mean": 25.2558139535,
"line_max": 57,
"alpha_frac": 0.6988485385,
"autogenerated": false,
"ratio": 2.72705314009661... |
__author__ = 'Hans-Werner Roitzsch'
from controller.LEDController import LEDController
from controller.SpeakerController import SpeakerController
from model.WarningLevel import WarningLevel
from network.RESTCommunicator import RESTCommunicator
from adapter.GPSSensorAdapter import GPSSensorAdapter
from datetime import... | {
"repo_name": "hwroitzsch/BikersLifeSaver",
"path": "src/nfz_module/evaluator/SensorDataEvaluator.py",
"copies": "2",
"size": "2582",
"license": "mit",
"hash": 3271989484385252400,
"line_mean": 38.1212121212,
"line_max": 131,
"alpha_frac": 0.755228505,
"autogenerated": false,
"ratio": 3.479784366... |
__author__ = 'Hans-Werner Roitzsch'
class FoundationsFileReader:
def __init__(self):
self.attribute_count = 7
def read(self, file_path):
lines = []
lines_attributes = []
with open(file_path) as opened_file:
for index, line in enumerate(opened_file):
if True:
line_parts = line.split('\t', -1)
... | {
"repo_name": "hwroitzsch/DayLikeTodayClone",
"path": "app/src/FoundationsFileReader.py",
"copies": "1",
"size": "2003",
"license": "mit",
"hash": 5951897391040766000,
"line_mean": 36.0925925926,
"line_max": 77,
"alpha_frac": 0.5716425362,
"autogenerated": false,
"ratio": 3.105426356589147,
"co... |
__author__ = 'Hans-Werner Roitzsch'
class SeriesFileReader:
def __init__(self):
self.attribute_count = 8
def read(self, file_path):
lines = []
lines_attributes = []
with open(file_path) as opened_file:
for index, line in enumerate(opened_file):
if True:
line_parts = line.split('\t', -1)
l... | {
"repo_name": "hwroitzsch/DayLikeTodayClone",
"path": "app/src/SeriesFileReader.py",
"copies": "1",
"size": "2024",
"license": "mit",
"hash": -6000375680557546000,
"line_mean": 36.4814814815,
"line_max": 73,
"alpha_frac": 0.5750988142,
"autogenerated": false,
"ratio": 3.1282843894899535,
"confi... |
__author__ = 'Hans-Werner Roitzsch'
from datetime import datetime
import sched
import cv2 as opencv
import numpy as np
from config import *
from processor.SensorDataProcessor import SensorDataProcessor
from model.ProcessedCameraData import ProcessedCameraData
from writer.ImageFileWriter import ImageFileWriter
cl... | {
"repo_name": "hwroitzsch/BikersLifeSaver",
"path": "src/nfz_module/processor/CameraDataProcessor.py",
"copies": "1",
"size": "5726",
"license": "mit",
"hash": 3209740457285571600,
"line_mean": 35.8903225806,
"line_max": 143,
"alpha_frac": 0.6832808674,
"autogenerated": false,
"ratio": 2.86472945... |
__author__ = 'Hans-Werner Roitzsch'
import os, sys
import numpy as np
import cv2 as opencv
from scipy import ndimage
from datetime import datetime
from TimeFunction import TimeFunction
allowed_formats = ['png', 'jpg', 'jpeg']
# lower_blinker_hsv = np.uint8([260, 150, 220])
# upper_blinker_hsv = np.uint8([280, 220... | {
"repo_name": "hwroitzsch/BikersLifeSaver",
"path": "src/nfz_module/examples/LabelCount.py",
"copies": "2",
"size": "2910",
"license": "mit",
"hash": -1387229424367505000,
"line_mean": 26.9903846154,
"line_max": 131,
"alpha_frac": 0.6993127148,
"autogenerated": false,
"ratio": 2.833495618305745,
... |
__author__ = 'Hans-Werner Roitzsch'
import os, sys
import numpy as np
import cv2 as opencv
allowed_formats = ['png', 'jpg', 'jpeg']
class LabelCounting:
def __init__(self):
self.label_count = 0
def count_labels(self, masked_image):
contours = opencv.findContours(masked_image, mode=opencv.RETR_LIST, method=... | {
"repo_name": "hwroitzsch/BikersLifeSaver",
"path": "src/bike_module/examples/label_count.py",
"copies": "2",
"size": "1792",
"license": "mit",
"hash": 3882036051205243400,
"line_mean": 21.6962025316,
"line_max": 102,
"alpha_frac": 0.6908482143,
"autogenerated": false,
"ratio": 2.8810289389067525... |
__author__ = 'Hanxiang Huang'
from bottle import Bottle, template, static_file, request, response
import interface
from database import COMP249Db
from users import check_login, session_user, delete_session, generate_session
import datetime
application = Bottle()
@application.route('/')
def index():
"""Index of P... | {
"repo_name": "jasonkwh/studiospates-python",
"path": "main.py",
"copies": "1",
"size": "13289",
"license": "mit",
"hash": -4021700595285177300,
"line_mean": 56.5324675325,
"line_max": 345,
"alpha_frac": 0.6276619761,
"autogenerated": false,
"ratio": 3.490675072235356,
"config_test": false,
"... |
"""
Django settings for app project.
Generated by 'django-admin startproject' using Django 1.10.6.
For more information on this file, see
https://docs.djangoproject.com/en/1.10/topics/settings/
For the full list of settings and their values, see
https://docs.djangoproject.com/en/1.10/ref/settings/
"""
import os
... | {
"repo_name": "hchen1202/django-react",
"path": "app/app/settings.py",
"copies": "1",
"size": "4804",
"license": "mit",
"hash": 4822396827307479000,
"line_mean": 24.2894736842,
"line_max": 91,
"alpha_frac": 0.6725645296,
"autogenerated": false,
"ratio": 3.4095102909865154,
"config_test": false,... |
import sys
import time
import csv
from itertools import combinations
# Join n-item set itself and generate (n+1)-item set
# Then prune all the set that are not frequent
def join_prune(k):
rt = {}
if not any(k):
return
keys = k.keys()
if len(keys) < 2:
return
leng = len(keys[0])
candidates = []
for i in... | {
"repo_name": "HaoLyu/Association-rule-learning",
"path": "Apriori.py",
"copies": "1",
"size": "5139",
"license": "apache-2.0",
"hash": 3932627491811856000,
"line_mean": 24.0682926829,
"line_max": 129,
"alpha_frac": 0.6328079393,
"autogenerated": false,
"ratio": 2.7658772874058126,
"config_test... |
import sys
import time
import csv
from itertools import combinations
import operator
# FP-Tree Node
class Node(object):
def __init__(self, data):
self.data = data
self.parent = None
self.children = []
self.children_value = {}
def add_child(self, obj, val):
if len(self.children) < 1:
self.children.app... | {
"repo_name": "HaoLyu/Association-rule-learning",
"path": "FP_Tree.py",
"copies": "1",
"size": "6187",
"license": "apache-2.0",
"hash": -4924053903374756000,
"line_mean": 27.5115207373,
"line_max": 129,
"alpha_frac": 0.6620332956,
"autogenerated": false,
"ratio": 2.8173952641165756,
"config_tes... |
__author__ = 'hao'
import tornado.ioloop
import tornado.web
import tornado.websocket
clients = []
from time import sleep
class IndexHandler(tornado.web.RequestHandler):
@tornado.web.asynchronous
def get(request):
request.render("index.html")
class WebSocketChatHandler(tornado.websocket.WebSocketHandler):
de... | {
"repo_name": "xuhao1/Unreal-ROS-Plugin",
"path": "tools/websocketserver.py",
"copies": "1",
"size": "1616",
"license": "mit",
"hash": -3455626436515612700,
"line_mean": 26.406779661,
"line_max": 87,
"alpha_frac": 0.6819306931,
"autogenerated": false,
"ratio": 3.6478555304740405,
"config_test":... |
# Parts of this code were copied from NiTime:
# http://nipy.sourceforge.net/nitime
# Some parts were coped from MNE
import numpy as np
from scipy import fftpack, linalg, interpolate
import warnings
def sum_squared(X):
"""Compute norm of an array
Parameters
----------
X : array
Data whose no... | {
"repo_name": "haribharadwaj/ANLffr",
"path": "anlffr/dpss.py",
"copies": "2",
"size": "8615",
"license": "bsd-3-clause",
"hash": 8546015928299504000,
"line_mean": 31.6325757576,
"line_max": 79,
"alpha_frac": 0.5715612304,
"autogenerated": false,
"ratio": 3.269449715370019,
"config_test": false... |
__author__ = 'harihar'
import flask
from geo.core.main import Main
from geo.db.query import Select
mod = flask.Blueprint("global_summary", __name__)
db = None
MODULE_CONTENT = """
<table style="width: 90%">
<tr>
<td style="width: 70%">Number of {type_name} {db}:</td>
<td>{total}</td>
</... | {
"repo_name": "hariharshankar/pygeo",
"path": "geo/views/global_sumary.py",
"copies": "1",
"size": "3380",
"license": "mit",
"hash": -4553743949036208600,
"line_mean": 32.4653465347,
"line_max": 105,
"alpha_frac": 0.4899408284,
"autogenerated": false,
"ratio": 3.654054054054054,
"config_test": ... |
from splinter import Browser
from easygui import *
from sys import exit
from time import sleep
from re import sub
from os import path, makedirs
# Recursive function that does the actual scrapping
# @rtype: None
def recursive_scrapper():
if chrome.is_element_present_by_xpath(
"//div[contains(@class,... | {
"repo_name": "harish0507/GMapsScrapper",
"path": "GMaps_Scrapper_V3.py",
"copies": "1",
"size": "5317",
"license": "mit",
"hash": -5811886419929586000,
"line_mean": 44.4444444444,
"line_max": 118,
"alpha_frac": 0.5851043822,
"autogenerated": false,
"ratio": 3.819683908045977,
"config_test": fa... |
from splinter import Browser
from easygui import *
from sys import exit
from time import sleep
from re import sub
from os import path, makedirs
# Recursive function that does the actual scrapping
# @type flag: bool
# @rtype: None
def scrapper_recursion(flag):
if chrome.is_element_present_by_xpath(
"... | {
"repo_name": "harish0507/GMapsScrapper",
"path": "GMaps_Scrapper_V2.py",
"copies": "1",
"size": "5160",
"license": "mit",
"hash": -4901186908437742000,
"line_mean": 42.7288135593,
"line_max": 116,
"alpha_frac": 0.5813953488,
"autogenerated": false,
"ratio": 3.8478747203579418,
"config_test": f... |
import gspread
import numpy as np
import qrcode
import os
import shutil
import matplotlib.pyplot as plt
import matplotlib.image as mpimg
from pylab import *
# Change this as per your folder structure
utbiomelocation = "C:\\MyStuff\\UTLiftProject\\"
print "This is a protected google spreadsheet:"
print "Please enter UT... | {
"repo_name": "harish2rb/utbiome",
"path": "pythonscripts/readQRCODExccel.py",
"copies": "1",
"size": "4132",
"license": "mit",
"hash": -3131655856369634000,
"line_mean": 35.2456140351,
"line_max": 133,
"alpha_frac": 0.7190222652,
"autogenerated": false,
"ratio": 3.1067669172932333,
"config_tes... |
import time
import os
from reportlab.lib.enums import TA_JUSTIFY
from reportlab.lib.pagesizes import letter
import reportlab.platypus as rptplt
from reportlab.platypus import SimpleDocTemplate, Paragraph, Spacer, Image
from reportlab.lib.styles import getSampleStyleSheet, ParagraphStyle
from reportlab.lib.units import ... | {
"repo_name": "harish2rb/utbiome",
"path": "pythonscripts/makingqrcodePdf.py",
"copies": "1",
"size": "2469",
"license": "mit",
"hash": 889036097568715800,
"line_mean": 35.3088235294,
"line_max": 90,
"alpha_frac": 0.7294451195,
"autogenerated": false,
"ratio": 3.2701986754966885,
"config_test":... |
__author__ = 'harlov'
import requests
from django.conf import settings
import logging
import traceback
logger = logging.getLogger('eventflowng.profitplatofrm_connector')
from django.utils.translation import ugettext as _
class ProfitPlatformRequest():
STATUS_SUCCESS = 1
STATUS_PLATFORM_CONNECT_ERROR = -1
... | {
"repo_name": "TheProfitwareGroup/eventflow",
"path": "src/eventflowng/profitplatform_connector/ProfitPlatformRequest.py",
"copies": "1",
"size": "1627",
"license": "mit",
"hash": 8392832750818171000,
"line_mean": 38.7073170732,
"line_max": 118,
"alpha_frac": 0.6570374923,
"autogenerated": false,
... |
__author__ = 'Harmony Betancourt'
'''
Created for Design Patterns for Web Programming
Project: Madlib
Purpose: Create a mad lib that collects user information and populates the output
'''
'''
DICTIONARY of set strings, Greet User
'''
messages = {"greeting": "Welcome to the MadLibs Game!", "goodbye": "T... | {
"repo_name": "hb08/DPWP",
"path": "Betancourt_Harmony_Madlib/main.py",
"copies": "1",
"size": "2574",
"license": "mit",
"hash": 4650083486831222000,
"line_mean": 29.6428571429,
"line_max": 613,
"alpha_frac": 0.6223776224,
"autogenerated": false,
"ratio": 3.2748091603053435,
"config_test": fals... |
#import uasyncio.core as asyncio
import uasyncio as asyncio
from WaterPumps.pumps import pump
from WaterPumps.leds import triLed
from WaterPumps.pressure import pressureSensor
from WaterPumps.buttons import button
from WaterPumps.server_uasyncio import pumpServer
from WaterPumps.server_uasyncio import validCommand
fr... | {
"repo_name": "thetreerat/WaterPump",
"path": "Example_uasyncio/main.py",
"copies": "1",
"size": "2352",
"license": "mit",
"hash": -189273347353932960,
"line_mean": 29.1666666667,
"line_max": 97,
"alpha_frac": 0.806547619,
"autogenerated": false,
"ratio": 3.257617728531856,
"config_test": false... |
import machine
import time
try:
import lib.uasyncio.core as asyncio
except ImportError:
import uasyncio.core as asyncio
class pressureSensor(object):
""" Class for pressure sensor """
def __init__(self, pin=0, LowPressure=20, highPressure=150, cutoffPressure=170):
"""init a pressure sensor ... | {
"repo_name": "thetreerat/WaterPump",
"path": "WaterPumps/pressure.py",
"copies": "1",
"size": "3966",
"license": "mit",
"hash": -8887981064207430000,
"line_mean": 32.0583333333,
"line_max": 105,
"alpha_frac": 0.5559757943,
"autogenerated": false,
"ratio": 3.9899396378269616,
"config_test": fal... |
import machine
import time
try:
import uasyncio.core as asyncio
except ImportError:
import lib.uasyncio.core as asyncio
from WaterPumps.events import Event
from WaterPumps.validCommands import validCommand
flowCount =0
class flowMeter(object):
GALLON_LITTER = 0.264172
ADAFRUIT_1_2_PULSE_LITTER = 450
... | {
"repo_name": "thetreerat/WaterPump",
"path": "WaterPumps/flowMeters.py",
"copies": "1",
"size": "7249",
"license": "mit",
"hash": -4754323995601714000,
"line_mean": 38.1891891892,
"line_max": 153,
"alpha_frac": 0.5678024555,
"autogenerated": false,
"ratio": 3.982967032967033,
"config_test": fa... |
try:
import lib.uasyncio as asyncio
except ImportError:
import uasyncio as asyncio
from utime import time
from WaterPumps.events import Event
class button(object):
debounce_ms = 50
def __init__(self, pin, state=None, name='Test'):
""" init a button object"""
import machine
fro... | {
"repo_name": "thetreerat/WaterPump",
"path": "WaterPumps/buttons.py",
"copies": "1",
"size": "4977",
"license": "mit",
"hash": -1622092864419300000,
"line_mean": 37.5891472868,
"line_max": 140,
"alpha_frac": 0.5382760699,
"autogenerated": false,
"ratio": 4.286821705426356,
"config_test": false... |
try:
import lib.uasyncio as asyncio
except ImportError:
import uasyncio as asyncio
from utime import time
from WaterPumps.events import Event
import socket
import network
from WaterPumps.buttons import button
from WaterPumps.leds import triLed
pins = [4,5,12,13,14,15]
lakeButton = button(5, name='Lake B... | {
"repo_name": "thetreerat/WaterPump",
"path": "ExampleRemote/main.py",
"copies": "1",
"size": "1178",
"license": "mit",
"hash": -2597549451537809000,
"line_mean": 25.7954545455,
"line_max": 121,
"alpha_frac": 0.7674023769,
"autogenerated": false,
"ratio": 3.043927648578811,
"config_test": false... |
try:
import lib.uasyncio as asyncio
except ImportError:
import uasyncio as asyncio
from utime import time
from WaterPumps.events import Event
from WaterPumps.pumpRunData import pumpRunData
from WaterPumps.validCommands import validCommand
class pump(object):
def __init__(self, powerPin,startupTime=20, name... | {
"repo_name": "thetreerat/WaterPump",
"path": "WaterPumps/pumps.py",
"copies": "1",
"size": "7411",
"license": "mit",
"hash": -7635018958813565000,
"line_mean": 41.5977011494,
"line_max": 130,
"alpha_frac": 0.581433005,
"autogenerated": false,
"ratio": 3.9609834313201495,
"config_test": false,
... |
try:
import lib.uasyncio as asyncio
except ImportError:
import uasyncio as asyncio
try:
import logging
except ImportError:
import lib.logging as logging
from WaterPumps.flowMeters import flowMeter
from WaterPumps.flowMeters import callbackflow
from WaterPumps.pumps import pump
from WaterPumps.leds... | {
"repo_name": "thetreerat/WaterPump",
"path": "ExampleEvents/main.py",
"copies": "1",
"size": "3110",
"license": "mit",
"hash": 4913300381181664000,
"line_mean": 36.4819277108,
"line_max": 165,
"alpha_frac": 0.8180064309,
"autogenerated": false,
"ratio": 3.193018480492813,
"config_test": false,... |
try:
import lib.uasyncio.core as asyncio
except ImportError:
import uasyncio.core as asyncio
from WaterPumps.events import Event
from utime import time
class pumpServer(object):
"""Class for pumpserver using uasyncio"""
def __init__(self, host='', port=8888, name='Test Server'):
"""initilzed th... | {
"repo_name": "thetreerat/WaterPump",
"path": "WaterPumps/servers.py",
"copies": "1",
"size": "4145",
"license": "mit",
"hash": 2942951398876934000,
"line_mean": 32.6991869919,
"line_max": 115,
"alpha_frac": 0.5334137515,
"autogenerated": false,
"ratio": 4.381606765327696,
"config_test": false,... |
try:
import uasyncio.core as asyncio
except ImportError:
import lib.uasyncio.core as asyncio
class Event():
"""Class for Events"""
def __init__(self, lp=False,name='Name not defined',debug=False):
"""Inilized the Class Event"""
self._name = name
self.after = asyncio.sleep
... | {
"repo_name": "thetreerat/WaterPump",
"path": "WaterPumps/events.py",
"copies": "1",
"size": "1184",
"license": "mit",
"hash": -7925830674704733000,
"line_mean": 23.6666666667,
"line_max": 71,
"alpha_frac": 0.5523648649,
"autogenerated": false,
"ratio": 4.13986013986014,
"config_test": false,
... |
__author__ = 'Harold Solbrig'
# -*- coding: utf-8 -*-
import logging
if __name__ == '__main__':
logging.basicConfig()
_log = logging.getLogger(__name__)
import pyxb.binding.generate
import pyxb.utils.domutils
import os.path
xsd='''<?xml version="1.0" encoding="UTF-8"?>
<xs:schema xmlns:xs="http://www.w3.org/2001/... | {
"repo_name": "balanced/PyXB",
"path": "tests/trac/test-trac-0184.py",
"copies": "3",
"size": "1901",
"license": "apache-2.0",
"hash": -3598604259041143300,
"line_mean": 30.1639344262,
"line_max": 156,
"alpha_frac": 0.6149395055,
"autogenerated": false,
"ratio": 3.0416,
"config_test": true,
"... |
__author__ = 'HarperMain'
import numpy as np
from EuropeanGreeks import *
from scipy.stats import norm
import time
from numba import *
from numbapro import cuda
import math
@cuda.jit(argtypes=(double, double, double, double, double, double, double, double, double, double,
double, double, double, d... | {
"repo_name": "marioharper182/OptionsPricing",
"path": "PythonEngine/EuropeanFixedStrikeCUDA.py",
"copies": "1",
"size": "7086",
"license": "apache-2.0",
"hash": 1330573114645582000,
"line_mean": 33.9113300493,
"line_max": 136,
"alpha_frac": 0.604854643,
"autogenerated": false,
"ratio": 2.5307142... |
__author__ = 'HarperMain'
import numpy as np
from numpy import exp, log, sqrt
from scipy.stats import norm
class Vanilla(object):
def __init__(self, flag, S, K, r, v, T, div):
self.Vanilla = self.BlackSholes(flag, float(S),
float(K), float(r), float(v),
... | {
"repo_name": "marioharper182/OptionsPricing",
"path": "PythonEngine/VanillaClass.py",
"copies": "1",
"size": "1727",
"license": "apache-2.0",
"hash": -461265748745576900,
"line_mean": 32.2307692308,
"line_max": 105,
"alpha_frac": 0.5286624204,
"autogenerated": false,
"ratio": 2.79902755267423,
... |
__author__ = 'HarperMain'
import numpy as np
from numpy import exp, log, sqrt
class Vanilla(object):
def __init__(self, flag, S, K, r, v, T, div):
self.Vanilla = self.BlackSholes(flag, float(S),
float(K), float(r), float(v),
fl... | {
"repo_name": "marioharper182/OptionsPricing",
"path": "Gui/View/Engine_Vanilla.py",
"copies": "1",
"size": "1405",
"license": "apache-2.0",
"hash": 1774681621352971500,
"line_mean": 33.2926829268,
"line_max": 105,
"alpha_frac": 0.5160142349,
"autogenerated": false,
"ratio": 2.765748031496063,
... |
__author__ = 'HarperMain'
import numpy as np
from scipy.stats import binom
class AmericanOption(object):
def __init__(self, strike, X, rate, volatility, T, n):
self.strike = strike
self.X = X
self.rate = rate
self.volatility = volatility
self.T = T
self.n = float(n)... | {
"repo_name": "marioharper182/ComputationalMethodsFinance",
"path": "Homework2/Options_American.py",
"copies": "1",
"size": "1728",
"license": "apache-2.0",
"hash": 7505476391815641000,
"line_mean": 26.8870967742,
"line_max": 85,
"alpha_frac": 0.521412037,
"autogenerated": false,
"ratio": 3.2,
... |
__author__ = 'HarperMain'
import numpy as np
class American(object):
def __init__(self, flag, spot, strike, rate, sigma, expiry):
self.rate = rate = float(rate)
self.expiry = expiry = float(expiry)
self.spot = spot = float(spot)
self.strike = strike = float(strike)
self.si... | {
"repo_name": "marioharper182/OptionsPricing",
"path": "Gui/View/Engine_American.py",
"copies": "1",
"size": "2197",
"license": "apache-2.0",
"hash": 2024532859424402000,
"line_mean": 31.8059701493,
"line_max": 91,
"alpha_frac": 0.5416477014,
"autogenerated": false,
"ratio": 3.4221183800623054,
... |
__author__ = 'HarperMain'
import pandas as pd
from pandas.stats.ols import OLS as ols
import numpy as np
import os
from pylab import *
class HW2():
def __init__(self):
# self.Problem1()
# self.Problem3()
# self.Problem4()
self.Problem5()
def Problem1(self):
t = arange(0... | {
"repo_name": "marioharper182/Portfolio",
"path": "HW2/HW_Main.py",
"copies": "1",
"size": "2665",
"license": "apache-2.0",
"hash": 1663556807358250000,
"line_mean": 29.988372093,
"line_max": 104,
"alpha_frac": 0.5444652908,
"autogenerated": false,
"ratio": 3.018120045300113,
"config_test": fal... |
__author__ = 'HarperMain'
import wx
from wx.lib.pubsub import pub as Publisher
from title_icons import *
ID_VANILLA = wx.NewId()
ID_European = wx.NewId()
ID_Asian = wx.NewId()
ID_Lookback = wx.NewId()
ID_American = wx.NewId()
ID_Implied = wx.NewId()
def CreateBitmap(xpm):
bmp = eval(xpm).Bitmap
return bmp
cl... | {
"repo_name": "marioharper182/OptionsPricing",
"path": "Gui/View/pnlButtons.py",
"copies": "1",
"size": "3315",
"license": "apache-2.0",
"hash": 867477636599667700,
"line_mean": 39.4390243902,
"line_max": 150,
"alpha_frac": 0.6856711916,
"autogenerated": false,
"ratio": 3.19364161849711,
"confi... |
__author__ = 'HarperMain'
import wx
import sys
import logging
from wx import richtext
class consoleOutput(wx.Panel):
def __init__(self, parent):
wx.Panel.__init__(self, parent, id = wx.ID_ANY, pos = wx.DefaultPosition, size = wx.Size( 500,300 ), style = wx.TAB_TRAVERSAL )
self.logger = logging.get... | {
"repo_name": "marioharper182/OptionsPricing",
"path": "Gui/View/pnlConsole.py",
"copies": "1",
"size": "3075",
"license": "apache-2.0",
"hash": 7604276126042076000,
"line_mean": 25.747826087,
"line_max": 135,
"alpha_frac": 0.5473170732,
"autogenerated": false,
"ratio": 3.6476868327402134,
"con... |
__author__ = 'HarperMain'
from scipy.stats import norm
import numpy as np
# class EuropeanLookbackGreeks():
#
# def __init__(self, spot, strike, rate, dividend, sigma, expiry, t):
#
# self.spot = spot
# self.strike = strike
# self.rate = rate
# self.dividend = dividend
# se... | {
"repo_name": "marioharper182/OptionsPricing",
"path": "PythonEngine/EuropeanGreeks.py",
"copies": "1",
"size": "2182",
"license": "apache-2.0",
"hash": 762200468661978400,
"line_mean": 29.7464788732,
"line_max": 99,
"alpha_frac": 0.583868011,
"autogenerated": false,
"ratio": 2.724094881398252,
... |
__author__ = 'HarperMain'
from wx.lib.embeddedimage import PyEmbeddedImage
# --------------------------------------------------- #
# Some bitmaps for ribbon buttons
align_center = PyEmbeddedImage(
"iVBORw0KGgoAAAANSUhEUgAAABAAAAAPCAYAAADtc08vAAAABHNCSVQICAgIfAhkiAAAADpJ"
"REFUKJFjZGRiZqAEMFGkm4GBgQWZ8//f3//E... | {
"repo_name": "marioharper182/OptionsPricing",
"path": "Gui/View/Bitmaps.py",
"copies": "1",
"size": "10817",
"license": "apache-2.0",
"hash": -8441996348226716000,
"line_mean": 56.8502673797,
"line_max": 78,
"alpha_frac": 0.7385596746,
"autogenerated": false,
"ratio": 1.8934010152284264,
"conf... |
__author__ = 'HarperMain'
import numpy as np
from numpy import log, exp, sqrt
from scipy.stats import norm
from VanillaClass import Vanilla
class Prob3(object):
def __init__(self):
self.initialparameters()
self.Engine()
# A = self.EuroD1(self.spot, self.strike, self.rate, self.dividend, ... | {
"repo_name": "marioharper182/OptionsPricing",
"path": "PythonEngine/DynamicDeltaHedging.py",
"copies": "1",
"size": "3031",
"license": "apache-2.0",
"hash": -3918645544716758000,
"line_mean": 30.2577319588,
"line_max": 101,
"alpha_frac": 0.5826459914,
"autogenerated": false,
"ratio": 3.528521536... |
__author__ = 'HarperMain'
import numpy as np
from numpy import random as rand
from scipy.stats import binom
from numpy import zeros
class EuropeanOption(object):
def __init__(self, strike, X, rate, volatility, T, n):
self.strike = strike
self.X = X
self.rate = rate
self.volatility... | {
"repo_name": "marioharper182/ComputationalMethodsFinance",
"path": "Homework2/Homework2Main.py",
"copies": "1",
"size": "1662",
"license": "apache-2.0",
"hash": 5825886583957235000,
"line_mean": 27.186440678,
"line_max": 113,
"alpha_frac": 0.5583634176,
"autogenerated": false,
"ratio": 3.1007462... |
__author__ = 'HarperMain'
import numpy as np
from numpy import sqrt, exp, pi
from matplotlib import pyplot
class AsianOption(object):
def __init__(self, spot, rate, sigma, expiry, N, M, strike, flag):
self.matrixengine(float(spot), float(rate), float(sigma), float(expiry),
int(N)... | {
"repo_name": "marioharper182/OptionsPricing",
"path": "Gui/View/Engine_Asian.py",
"copies": "1",
"size": "1859",
"license": "apache-2.0",
"hash": 4453400602163355600,
"line_mean": 43.2619047619,
"line_max": 108,
"alpha_frac": 0.6083916084,
"autogenerated": false,
"ratio": 3.216262975778547,
"c... |
__author__ = 'HarperMain'
import numpy as np
import matplotlib.pyplot as plt
from numpy import sqrt, exp, pi
from matplotlib import pyplot
class EuropeanOption(object):
def __init__(self, spot, rate, sigma, expiry, N, M, strike, flag):
self.matrixengine(float(spot), float(rate), float(sigma), float(expiry... | {
"repo_name": "marioharper182/OptionsPricing",
"path": "Gui/View/Engine_European.py",
"copies": "1",
"size": "2106",
"license": "apache-2.0",
"hash": -7454902006588394000,
"line_mean": 38.7358490566,
"line_max": 108,
"alpha_frac": 0.5992402659,
"autogenerated": false,
"ratio": 3.2651162790697676,... |
__author__ = 'HarperMain'
import wx
from wx.lib.agw import ribbon as RB
from wx.lib.embeddedimage import PyEmbeddedImage
from Bitmaps import *
from title_icons import *
from pnlEuropean import PanelEuropean
from pnlWelcome import PanelWelcome
ID_CIRCLE = wx.ID_HIGHEST + 1
ID_CROSS = ID_CIRCLE + 1
ID_TRIANGLE = ID_CIR... | {
"repo_name": "marioharper182/OptionsPricing",
"path": "Gui/View/ApplicationFrame.py",
"copies": "1",
"size": "11319",
"license": "apache-2.0",
"hash": -4918416860143216000,
"line_mean": 40.4652014652,
"line_max": 141,
"alpha_frac": 0.6436964396,
"autogenerated": false,
"ratio": 3.139805825242718... |
__author__ = 'HarperMain'
import wx
import wx.lib.agw.aui as aui
from wx.lib.pubsub import pub as Publisher
from pnlWelcome import PanelWelcome
from pnlEuropean import PanelEuropean
from pnlButtons import PanelButtons
from pnlVanilla import PanelVanilla
from pnlAsian import PanelAsian
from pnlLookback import PanelLoo... | {
"repo_name": "marioharper182/OptionsPricing",
"path": "Gui/View/MainGui.py",
"copies": "1",
"size": "11342",
"license": "apache-2.0",
"hash": -6094599123423249000,
"line_mean": 37.4508474576,
"line_max": 106,
"alpha_frac": 0.4917122201,
"autogenerated": false,
"ratio": 4.265513350883791,
"conf... |
import requests
import json
import math
customerId = '5709786a319313dd1b438fd0'
apiKey = 'cf6fe22672e82008e57d304ac6e0d669'
#Get the amount of money in the food bank account
def getFoodAmount():
r = requests.get('http://api.reimaginebanking.com/accounts/57097f4a319313dd1b43b2bd?key=cf6fe22672e82008e57d304ac6e0d6... | {
"repo_name": "jerrrytan/bitcamp",
"path": "bitcamp/bitcampapp/banking.py",
"copies": "1",
"size": "1816",
"license": "mit",
"hash": -2736378906814973400,
"line_mean": 31.4285714286,
"line_max": 126,
"alpha_frac": 0.6921806167,
"autogenerated": false,
"ratio": 2.9290322580645163,
"config_test":... |
__author__ = 'Harrison'
from apps.myerp.models import ProductCategoryPrimary, ProductCategorySecondary
from apps.myerp.tools.tool import DjangoJSONEncoder, analysis_iterable_object
from erp.settings import DATA_DOCUMENTED_SETTINGS
import os
import json
#数据文件化处理器
DOC_Handler = dict()
def handler_register(h... | {
"repo_name": "HarrisonHDU/myerp",
"path": "apps/myerp/tools/dataDocumented.py",
"copies": "1",
"size": "2131",
"license": "mit",
"hash": -2508130068314599400,
"line_mean": 29.6290322581,
"line_max": 113,
"alpha_frac": 0.6100051046,
"autogenerated": false,
"ratio": 3.080188679245283,
"config_te... |
__author__ = 'Harsh Daftary'
try:
import requests
import json
except ImportError:
print("requests and json libraries are required, but not found.")
exit(1)
from functools import wraps
class ApiError(Exception):
pass
class GoDebianApi(object):
def __init__(self, host="http://go.debian.net/... | {
"repo_name": "ninjatrench/GoDebian_api",
"path": "GoDebian/api.py",
"copies": "1",
"size": "3025",
"license": "mit",
"hash": 7503418568776526000,
"line_mean": 28.0865384615,
"line_max": 136,
"alpha_frac": 0.5510743802,
"autogenerated": false,
"ratio": 4.076819407008086,
"config_test": false,
... |
# The problem is same as finding the hamiltonian path in the overlay graph
# which produces the shortest DNA
import networkx as nx
def read_fasta(in_file):
""" Reads the input and returns a dictionary of DNA inputs """
tags = []
strings = []
for line in in_file.readlines():
if line[0] == '>':... | {
"repo_name": "hargup/bioinformatics",
"path": "rosalind/long.py",
"copies": "1",
"size": "2285",
"license": "bsd-3-clause",
"hash": -385173244535082400,
"line_mean": 25.8823529412,
"line_max": 84,
"alpha_frac": 0.5925601751,
"autogenerated": false,
"ratio": 3.182451253481894,
"config_test": fa... |
'''
This script takes a single JSON file from the Trip Advisor reviews dataset.
(Link to dataset: http://times.cs.uiuc.edu/~wang296/Data). Refer to the
ipython notebook in the repo to understand the workflow.
Make sure the "data_file" variable is updated to the file chosen for review after
downloading the dataset.
... | {
"repo_name": "supercr7/topic-modeling-tripadv",
"path": "trip-advisor-lda.py",
"copies": "1",
"size": "3269",
"license": "mit",
"hash": 9117687291308538000,
"line_mean": 28.4504504505,
"line_max": 87,
"alpha_frac": 0.6173141634,
"autogenerated": false,
"ratio": 3.7879490150637314,
"config_test... |
__author__ = 'harsh'
def bin_search(sequence, left, right, key):
if not sequence:
return -1
if left >= right:
return -1
mid = left + (right - left)/2
if sequence[mid] == key:
return mid
else:
if sequence[left] < sequence[mid]:
if sequence[left] <= key < s... | {
"repo_name": "hs634/algorithms",
"path": "python/arrays/search_rotated_array.py",
"copies": "1",
"size": "1213",
"license": "mit",
"hash": 1859842430414488800,
"line_mean": 26.5909090909,
"line_max": 73,
"alpha_frac": 0.526793075,
"autogenerated": false,
"ratio": 3.5676470588235296,
"config_te... |
__author__ = 'harsh'
from collections import defaultdict
class Graph(object):
def __init__(self, x):
self.x = x
self.neighbors = []
class Solution(object):
def __init__(self):
self.visited = defaultdict(Graph)
def clone_graph(self, node):
assert isinstance(node, Graph)
... | {
"repo_name": "hs634/algorithms",
"path": "python/graphs/clone_graph.py",
"copies": "1",
"size": "1439",
"license": "mit",
"hash": -7246091469705697000,
"line_mean": 21.8412698413,
"line_max": 62,
"alpha_frac": 0.5726198749,
"autogenerated": false,
"ratio": 3.868279569892473,
"config_test": fal... |
__author__ = 'harsh'
from collections import defaultdict
class Queue(object):
def __init__(self):
self.items = []
def isEmpty(self):
return self.items == []
def enqueue(self, item):
self.items.insert(0, item)
def dequeue(self):
return self.items.pop()
def size(... | {
"repo_name": "hs634/algorithms",
"path": "python/graphs/transform_word_to_another.py",
"copies": "1",
"size": "1789",
"license": "mit",
"hash": 5391521140867764000,
"line_mean": 22.5394736842,
"line_max": 77,
"alpha_frac": 0.4935718278,
"autogenerated": false,
"ratio": 4.2595238095238095,
"con... |
__author__ = 'harsh'
#
# Hangman game
#
# -----------------------------------
import random
import string
WORDLIST_FILENAME = "words.txt" ## Download this txt file so that Hangman Could Guess a NUmber AT random
## https://courses.edx.org/asset-v1:MITx+6.00.1x_6+2T2015+type@asset+block/words.txt
## Make sure to hav... | {
"repo_name": "iharsh234/MIT6.00x",
"path": "PLAY-HANGMAN.py",
"copies": "1",
"size": "3004",
"license": "mit",
"hash": -4650001975892750000,
"line_mean": 25.8214285714,
"line_max": 105,
"alpha_frac": 0.611517976,
"autogenerated": false,
"ratio": 3.6062424969987994,
"config_test": false,
"has... |
__author__ = 'harsh'
import re
import sys
import random
import operator
import math
from nltk import clean_html, tokenize, PunktWordTokenizer
from collections import Counter, defaultdict
from itertools import tee, islice
def preprocess(file_contents, add_sent_markers=True):
"""
:rtype : object
:param fil... | {
"repo_name": "fa97/cs4740",
"path": "ngram/smoothing-ngram.py",
"copies": "1",
"size": "20067",
"license": "bsd-3-clause",
"hash": 3478952236316348000,
"line_mean": 33.8402777778,
"line_max": 110,
"alpha_frac": 0.6197737579,
"autogenerated": false,
"ratio": 3.3042977111806358,
"config_test": t... |
__author__ = 'harsh'
import re
import sys
import random
import operator
import nltk
from nltk import clean_html, tokenize, PunktWordTokenizer
from collections import Counter, defaultdict
def preprocess(file_contents, add_sent_markers=True):
raw = clean_html(file_contents)
raw = re.sub(r'\d+:\d+|\d+,\d+,|IsTr... | {
"repo_name": "hs634/cs4740",
"path": "assignment1/ngram.py",
"copies": "2",
"size": "7837",
"license": "bsd-3-clause",
"hash": 3102323613847182000,
"line_mean": 36.319047619,
"line_max": 109,
"alpha_frac": 0.6099272681,
"autogenerated": false,
"ratio": 2.9969407265774377,
"config_test": false,... |
__author__ = 'harsh'
LT = 0
GT = 1
def compare_ele(comp_type, ele1, ele2):
if comp_type == LT:
return ele1 < ele2
elif comp_type == GT:
return ele1 > ele2
raise Exception("Compare type Undefined")
def heapsort(lst, comp_type=LT):
"""
:param lst:
"""
#heapify
for sta... | {
"repo_name": "hs634/algorithms",
"path": "python/sortandsearch/heapsort.py",
"copies": "1",
"size": "2630",
"license": "mit",
"hash": 680659518927311400,
"line_mean": 22.0789473684,
"line_max": 83,
"alpha_frac": 0.4954372624,
"autogenerated": false,
"ratio": 3.0126002290950744,
"config_test": ... |
__author__ = 'harsh'
class BinHeap:
def __init__(self):
self.heapList = [0]
self.currentSize = 0
def percUp(self,i):
while i // 2 > 0:
if self.heapList[i] < self.heapList[i // 2]:
tmp = self.heapList[i // 2]
self.heapList[i // 2] = self.heap... | {
"repo_name": "hs634/algorithms",
"path": "python/sortandsearch/BinHeap.py",
"copies": "1",
"size": "1631",
"license": "mit",
"hash": 8404123478623755000,
"line_mean": 24.484375,
"line_max": 56,
"alpha_frac": 0.5144083384,
"autogenerated": false,
"ratio": 3.179337231968811,
"config_test": false... |
__author__ = 'harsh'
class CustomArray(object):
def __init__(self, arr):
assert isinstance(arr, list)
if arr is None:
self.arr = []
else:
self.arr = arr
def __rsearch__(self, lo, hi, key):
mid = lo + (hi - lo)/2
if hi < lo:
return -1... | {
"repo_name": "hs634/algorithms",
"path": "python/sortandsearch/sortandsearch.py",
"copies": "1",
"size": "2358",
"license": "mit",
"hash": -7570405528653578000,
"line_mean": 25.7954545455,
"line_max": 75,
"alpha_frac": 0.4329940628,
"autogenerated": false,
"ratio": 3.3928057553956834,
"config_... |
__author__ = 'harsh'
class Iterable(object):
def __init__(self,values):
self.values = values
self.location = 0
def __iter__(self):
return self
def next(self):
if self.location == len(self.values):
raise StopIteration
value = self.values[self.location]... | {
"repo_name": "hs634/algorithms",
"path": "python/misc/custom_iter.py",
"copies": "1",
"size": "1422",
"license": "mit",
"hash": -3443799162563286000,
"line_mean": 22.3278688525,
"line_max": 69,
"alpha_frac": 0.5098452883,
"autogenerated": false,
"ratio": 3.6555269922879177,
"config_test": fals... |
__author__ = 'harsh'
class QuickSort:
def __init__(self, arr):
self.arr = arr
def print_arr(self):
print "array is: {0}".format(self.arr)
def _quick_sort(self, lo, hi):
if lo < hi:
partition_pt = self.partition(lo, hi)
self._quick_sort(lo, partition_pt - 1... | {
"repo_name": "hs634/algorithms",
"path": "python/sortandsearch/quick_sort.py",
"copies": "1",
"size": "1490",
"license": "mit",
"hash": 5096898023520577000,
"line_mean": 21.9230769231,
"line_max": 71,
"alpha_frac": 0.4791946309,
"autogenerated": false,
"ratio": 3.065843621399177,
"config_test"... |
__author__ = 'harsh'
class Snippets(object):
@staticmethod
def main():
Snippets.convert_integer_to_binary(16)
Snippets.towers_of_hanoi(2)
Snippets.twenty_questions()
@staticmethod
def convert_integer_to_binary(num):
print "Running Binary to Integer Conversion Snippet ... | {
"repo_name": "hs634/algorithms",
"path": "python/misc/snippets.py",
"copies": "1",
"size": "1787",
"license": "mit",
"hash": 2543321083179397600,
"line_mean": 24.8985507246,
"line_max": 64,
"alpha_frac": 0.4734191382,
"autogenerated": false,
"ratio": 3.851293103448276,
"config_test": false,
... |
__author__ = 'harsh'
class Solution:
# @param words, a list of strings
# @param L, an integer
# @return a list of strings
def fullJustify(self, words, L):
begin, end = 0, 0
result = []
while begin < len(words):
words_len = 0
while end < len(words):
... | {
"repo_name": "hs634/algorithms",
"path": "python/strings/text_justification.py",
"copies": "1",
"size": "1553",
"license": "mit",
"hash": 4575387831227852000,
"line_mean": 31.375,
"line_max": 79,
"alpha_frac": 0.4436574372,
"autogenerated": false,
"ratio": 3.961734693877551,
"config_test": fal... |
__author__ = 'harsh'
class Stack(object):
"""
Simple Stack Implementation. Uses Python lists for storing
the elements in the stack.
"""
def __init__(self):
self.items = []
def push(self, item):
self.items.append(item)
def pop(self):
return self.items.pop()... | {
"repo_name": "hs634/algorithms",
"path": "python/arrays/stack_with_min.py",
"copies": "1",
"size": "2496",
"license": "mit",
"hash": 1281849371982414000,
"line_mean": 27.0561797753,
"line_max": 106,
"alpha_frac": 0.5929487179,
"autogenerated": false,
"ratio": 3.708766716196137,
"config_test": ... |
__author__ = 'harsh'
def kadanes(sequence):
start_index, end_index, sum_start = -1, -1, -1
maxsum, curr_sum = 0, 0
for i, k in enumerate(sequence):
curr_sum += k
if maxsum < curr_sum:
maxsum = curr_sum
start_index, end_index = sum_start, i
elif curr_sum < 0... | {
"repo_name": "hs634/algorithms",
"path": "python/DP/kadanes.py",
"copies": "1",
"size": "1571",
"license": "mit",
"hash": -1742173841255383000,
"line_mean": 25.6440677966,
"line_max": 62,
"alpha_frac": 0.4920432845,
"autogenerated": false,
"ratio": 2.5754098360655737,
"config_test": false,
"... |
__author__ = 'harsh'
def split_num(num_lst):
for i in xrange(len(num_lst) - 2, 0, -1):
if num_lst[i] < num_lst[i + 1]:
return i
return None
def next_higher_num(num):
if num <= 0:
return None
num_lst = list(str(num))
print num_lst
i = split_num(num_lst)
if i:
... | {
"repo_name": "hs634/algorithms",
"path": "python/company/yahoo_next_higher_even_num.py",
"copies": "1",
"size": "1109",
"license": "mit",
"hash": 6465615687069498000,
"line_mean": 20.7450980392,
"line_max": 87,
"alpha_frac": 0.5437330929,
"autogenerated": false,
"ratio": 2.9031413612565444,
"c... |
__author__ = 'harsh'
"""
Given a string S and a string T, find the minimum window in S which will
contain all the characters in T in complexity in O(n)
For example,
S = "ADOBECODEBANC"
T = "ABC"
Minimum window is "BANC".
Note:
If there is no such window in S that covers all characters in T, return the
emtpy string "".... | {
"repo_name": "hs634/algorithms",
"path": "python/strings/minimum_window_substring.py",
"copies": "1",
"size": "4008",
"license": "mit",
"hash": 3296533985593379000,
"line_mean": 30.8095238095,
"line_max": 80,
"alpha_frac": 0.620259481,
"autogenerated": false,
"ratio": 3.752808988764045,
"confi... |
__author__ = 'harsh'
'''
Given two words, determine if the first word, or any anagram of it, appears in consecutive characters of the second word.
For instance, tea appears as an anagram in the last three letters of slate, but let does not appear as an anagram in actor
even though all the letters of let a... | {
"repo_name": "hs634/algorithms",
"path": "python/strings/yahoo2.py",
"copies": "1",
"size": "1072",
"license": "mit",
"hash": 4758149857288592000,
"line_mean": 23.9534883721,
"line_max": 126,
"alpha_frac": 0.6119402985,
"autogenerated": false,
"ratio": 3.6094276094276094,
"config_test": false,... |
__author__ = 'harun'
from functions import sigmoid, derivative_sigmoid
from random import random
class SimpleNN():
"""
Mr. Spock pure logic mind
"""
def __init__(self, number_inputs, number_hidden_layers, number_outputs):
# network structure definitions
self.n_inputs = number_inputs
... | {
"repo_name": "Gryzone/NeuralNetwork",
"path": "NetworkCore/simplenn.py",
"copies": "1",
"size": "4624",
"license": "mit",
"hash": -330085976111988100,
"line_mean": 41.0454545455,
"line_max": 115,
"alpha_frac": 0.5501730104,
"autogenerated": false,
"ratio": 3.655335968379447,
"config_test": tru... |
__author__ = 'harun'
import random
import pyglet
from pyglet.gl import *
class DiamondSquareTerrain():
def __init__(self, iterations, seed, deviations, roughness, random=False):
self.iterations = iterations
self.seed = seed
self.deviations = deviations
self.roughness = roughness
... | {
"repo_name": "Gryzone/DiamondSquare_Python",
"path": "main.py",
"copies": "1",
"size": "5580",
"license": "mit",
"hash": -2924062840774060500,
"line_mean": 31.6374269006,
"line_max": 115,
"alpha_frac": 0.5209677419,
"autogenerated": false,
"ratio": 3.192219679633867,
"config_test": false,
"h... |
__author__ = 'hassaanaliw'
from flask import Blueprint, Response, redirect, url_for
from app import db
from app.posts.models import Posts
from flask.ext.login import current_user, login_required
posts = Blueprint('posts', __name__)
@posts.route('/like/<post_id>')
@login_required
def like(post_id):
post = Posts... | {
"repo_name": "hassaanaliw/flaskbook",
"path": "app/posts/views.py",
"copies": "1",
"size": "1244",
"license": "mit",
"hash": 2690204201841922000,
"line_mean": 24.9375,
"line_max": 56,
"alpha_frac": 0.6655948553,
"autogenerated": false,
"ratio": 3.064039408866995,
"config_test": false,
"has_n... |
__author__ = 'hassaanaliw'
'''
Includes several helper functions for the main app that are used a number of
times to avoid using code multiple times.
'''
from app.posts.models import Posts
from app.user.models import User
class Messages():
LOGIN_ERROR_MESSAGE = "Email/Password is Wrong. Please Try Again."
L... | {
"repo_name": "hassaanaliw/flaskbook",
"path": "app/helpers.py",
"copies": "1",
"size": "1376",
"license": "mit",
"hash": 2222008426512048600,
"line_mean": 30.2727272727,
"line_max": 96,
"alpha_frac": 0.7034883721,
"autogenerated": false,
"ratio": 3.7088948787061993,
"config_test": false,
"ha... |
__author__ = 'haukurk'
from components.emailserver.server import email_watcher
from components.smsinterpreter import sms
import asyncore
from utils.logger import logger
def component_proxy(message):
"""
Proxy between email component and sms interpreter.
Email component event returns an email.Message obje... | {
"repo_name": "haukurk/email-to-smsapi",
"path": "run.py",
"copies": "1",
"size": "1123",
"license": "mit",
"hash": -7694056177611550000,
"line_mean": 36.4666666667,
"line_max": 108,
"alpha_frac": 0.7025823687,
"autogenerated": false,
"ratio": 3.954225352112676,
"config_test": false,
"has_no_... |
__author__ = 'haukurk'
from functools import wraps
from flask import request, abort, Response
from restapi.components.auth.helpers import get_apiauth_object_by_key
from restapi import log, log_to_file
def match_api_keys(key, ip):
"""
Match API keys and discard ip
@param key: API key from request
@par... | {
"repo_name": "haukurk/flask-restapi-recipe",
"path": "restapi/components/auth/decorators.py",
"copies": "1",
"size": "1959",
"license": "mit",
"hash": 3074604673205195000,
"line_mean": 26.5915492958,
"line_max": 93,
"alpha_frac": 0.6273608984,
"autogenerated": false,
"ratio": 3.863905325443787,
... |
__author__ = 'haukurk'
from functools import wraps
def crossdomain(func, allow_origin=None, allow_headers=None, max_age=None):
"""
Enable CORS.
@param func: wrapped function
@param allow_origin: specify origin
@param allow_headers: allow headers
@param max_age: define max age
@return: fun... | {
"repo_name": "haukurk/flask-restapi-recipe",
"path": "restapi/utils/decorators.py",
"copies": "1",
"size": "1192",
"license": "mit",
"hash": -143741814359887460,
"line_mean": 28.825,
"line_max": 75,
"alpha_frac": 0.5704697987,
"autogenerated": false,
"ratio": 4.040677966101695,
"config_test": ... |
__author__ = 'haukurk'
from optparse import OptionParser, OptionGroup
from restapi.utils.validation import is_valid_ipv4
from restapi.components.auth.controllers import show_all_keys, generate_key, show_key, delete_key
usage = "usage: %prog [options] arg"
parser = OptionParser(usage)
group_auth = OptionGroup(parser... | {
"repo_name": "haukurk/flask-restapi-recipe",
"path": "manage.py",
"copies": "1",
"size": "1617",
"license": "mit",
"hash": 1396882435540260600,
"line_mean": 33.4255319149,
"line_max": 97,
"alpha_frac": 0.6165739023,
"autogenerated": false,
"ratio": 3.963235294117647,
"config_test": false,
"h... |
__author__ = 'haukurk'
from restapi import db
from restapi.components.auth.helpers import get_apiauth_object_by_ip, generate_hash_key, get_all_apiauth_object, \
get_apiauth_object_by_keyid
from restapi.components.auth.model import APIAuth
def generate_key(ip, desc):
"""
Generates a key for an IP address ... | {
"repo_name": "haukurk/flask-restapi-recipe",
"path": "restapi/components/auth/controllers.py",
"copies": "1",
"size": "1969",
"license": "mit",
"hash": -5746313454317740000,
"line_mean": 25.6081081081,
"line_max": 114,
"alpha_frac": 0.595226003,
"autogenerated": false,
"ratio": 3.303691275167785... |
__author__ = 'haukurk'
from restapi.modules.base import BaseModel, db
from marshmallow import Serializer, fields
class Cake(BaseModel):
"""
Cake class that defines how cake object are kept in the database.
"""
id = db.Column(db.Integer, primary_key=True)
cakename = db.Column(db.String(80), unique... | {
"repo_name": "haukurk/flask-restapi-recipe",
"path": "restapi/modules/cakes/models.py",
"copies": "1",
"size": "1336",
"license": "mit",
"hash": -5208161113296604000,
"line_mean": 28.7111111111,
"line_max": 115,
"alpha_frac": 0.624251497,
"autogenerated": false,
"ratio": 3.4344473007712084,
"c... |
__author__ = 'haukurk'
from xml.etree.ElementTree import Element, SubElement, tostring, ElementTree
def createCMxml(customer_id, username, password, tariff, sender_name, body, msisdn):
"""
<summary>
Creates a XML string according to the technical requirements of the CM MT gateway for sending a simple SMS... | {
"repo_name": "haukurk/email-to-smsapi",
"path": "utils/cmmt.py",
"copies": "1",
"size": "2013",
"license": "mit",
"hash": 8108002782864468000,
"line_mean": 29.0447761194,
"line_max": 126,
"alpha_frac": 0.6711376056,
"autogenerated": false,
"ratio": 3.7003676470588234,
"config_test": false,
"... |
__author__ = 'haukurk'
import copy
def filter_strings_nested_dict(node, search_term):
if isinstance(node, basestring):
print node
if node == search_term:
return node
else:
return None
else:
dupe_node = {}
for key, val in node.iteritems():
... | {
"repo_name": "haukurk/flask-restapi-recipe",
"path": "restapi/utils/filters.py",
"copies": "1",
"size": "2044",
"license": "mit",
"hash": 5477301134461729000,
"line_mean": 28.2142857143,
"line_max": 76,
"alpha_frac": 0.5097847358,
"autogenerated": false,
"ratio": 4.405172413793103,
"config_tes... |
__author__ = 'haukurk'
import math
from flask import Blueprint, jsonify, request
from restapi.utils.decorators import crossdomain
from restapi.modules import responses, errors, statuscodes
from restapi.components.auth.decorators import require_app_key
from restapi.modules.cakes.models import Cake, db, CakeSerializer
f... | {
"repo_name": "haukurk/flask-restapi-recipe",
"path": "restapi/modules/cakes/controllers.py",
"copies": "1",
"size": "3954",
"license": "mit",
"hash": -4060034315058639000,
"line_mean": 30.3888888889,
"line_max": 119,
"alpha_frac": 0.645928174,
"autogenerated": false,
"ratio": 3.8313953488372094,... |
__author__ = 'haukurk'
'''
Originally forked from https://github.com/shazow/apiclient MIT 2014
License: MIT
Haukur Kristinsson 2014
Licence: MIT
'''
import json
from urllib3 import connection_from_url
from urllib import urlencode
class APIClient(object): # New-Style Class inherits from object.
BASE_URL = 'h... | {
"repo_name": "haukurk/email-to-smsapi",
"path": "components/smsinterpreter/apiclient/base.py",
"copies": "1",
"size": "2827",
"license": "mit",
"hash": 883327824482495000,
"line_mean": 29.3978494624,
"line_max": 106,
"alpha_frac": 0.6370711001,
"autogenerated": false,
"ratio": 3.3937575030012006... |
__author__ = 'HayatoKimura'
from time import sleep
import telnetlib
class Conf:
conf_list=""
def __init__(self,user_name="",hostname="",password="",rawdata=None):
"""
:param user_name:[U[¼
:param hostname:zXg¼
:param password:pX[h
:param rawdata:±±ÉR... | {
"repo_name": "prprhyt/yamaha_config_checker",
"path": "checkconfigClass.py",
"copies": "1",
"size": "1367",
"license": "mit",
"hash": 1279182438658049500,
"line_mean": 28.7391304348,
"line_max": 73,
"alpha_frac": 0.4747622531,
"autogenerated": false,
"ratio": 2.559925093632959,
"config_test": ... |
__author__ = 'hayden'
import sys
import numpy as np
import skimage.io
from google.protobuf import text_format
import os
import utilities.paths as paths
os.environ['GLOG_minloglevel'] = '2' # Suppress most caffe output
# Make sure that caffe is on the python path:
caffe_root = paths.get_caffe_path() # this file is ex... | {
"repo_name": "HaydenFaulkner/phd",
"path": "caffe_code/cnns/utils.py",
"copies": "1",
"size": "6679",
"license": "mit",
"hash": 7733534854050478000,
"line_mean": 37.8313953488,
"line_max": 176,
"alpha_frac": 0.6237460698,
"autogenerated": false,
"ratio": 3.2172447013487475,
"config_test": fals... |
__author__ = 'hayden'
import json
import cv2
import cv2.cv as cv
x = json.load(open('/media/hayden/Storage/DATASETS/SPORT/TENNIS01/VID/AUSO_2014_M_SF_Nadal_Federer2.json'))
vid_id = '001'
points = []
max_ = 0
index = 0
for point in x['classes']['Point']:
index += 1
points.append([point['start'], point['end']]... | {
"repo_name": "HaydenFaulkner/phd",
"path": "tennis/json2indtxt.py",
"copies": "1",
"size": "1727",
"license": "mit",
"hash": 4256227212060431400,
"line_mean": 28.775862069,
"line_max": 128,
"alpha_frac": 0.5917776491,
"autogenerated": false,
"ratio": 2.8035714285714284,
"config_test": false,
... |
__author__ = 'hayden'
import json
import os
import pickle
import time
import cv2
import cv2.cv as cv
import numpy as np
import caffe_code.cnns.utils
TYPE = 2 # 1: HIT V SERVE V OTHER; 2: PLAYER 1 V PLAYER 2; 3: FOREHAND V BACKHAND
layers = ['pool4', 'pool5', 'fc6', 'fc7']
start = 500
end = 14700
fps = 1
frame_ind... | {
"repo_name": "HaydenFaulkner/phd",
"path": "tennis/label_feature_alignment.py",
"copies": "1",
"size": "6600",
"license": "mit",
"hash": -5377503029495012000,
"line_mean": 36.5,
"line_max": 187,
"alpha_frac": 0.5677272727,
"autogenerated": false,
"ratio": 3.1899468342194295,
"config_test": fal... |
__author__ = 'hayden'
import json
import os
import pickle
import cv2
import cv2.cv as cv
import numpy as np
def main():
layers = ['pool5', 'fc6', 'fc7']
vid_path = '/media/hayden/Storage/DATASETS/SPORT/TENNIS01/VID/'
labels_path = '/media/hayden/Storage/DATASETS/SPORT/TENNIS01/LABELS/RAW/'
video_nam... | {
"repo_name": "HaydenFaulkner/phd",
"path": "tennis/extract_raw_labels.py",
"copies": "1",
"size": "6805",
"license": "mit",
"hash": -1014623432434406400,
"line_mean": 37.6647727273,
"line_max": 166,
"alpha_frac": 0.5578251286,
"autogenerated": false,
"ratio": 3.0556802873821285,
"config_test":... |
__author__ = 'hayden'
import json
import os
import sys
import time
import cv2.cv as cv
from caffe_code.cnns import utils
from rnn import my_rnn
rnn_root = '/home/hayden/neuraltalk/' # this file is expected to be in {caffe_root}/examples
sys.path.insert(0, rnn_root)
import numpy as np
import cv2
#%matplotlib inli... | {
"repo_name": "HaydenFaulkner/phd",
"path": "graveyard/TestWinTennis.py",
"copies": "1",
"size": "7518",
"license": "mit",
"hash": 4966733819716736000,
"line_mean": 36.4029850746,
"line_max": 295,
"alpha_frac": 0.5849960096,
"autogenerated": false,
"ratio": 3.019277108433735,
"config_test": fal... |
__author__ = 'hayden'
import json
import skimage.io
import sys
import cv2
import numpy as np
import scipy.io
# Make sure that caffe is on the python path:
caffe_root = '/home/hayden/caffe-recurrent/' # this file is expected to be in {caffe_root}/examples
sys.path.insert(0, caffe_root + 'python')
import caffe
def ... | {
"repo_name": "HaydenFaulkner/phd",
"path": "caffe_code/get_features.py",
"copies": "1",
"size": "5026",
"license": "mit",
"hash": 965238135824668300,
"line_mean": 31.6363636364,
"line_max": 168,
"alpha_frac": 0.5951054517,
"autogenerated": false,
"ratio": 3.0872235872235874,
"config_test": fal... |
__author__ = 'hayden'
import json
x = json.load(open('/media/hayden/Storage/DATASETS/SPORT/TENNIS01/COMB_points_anns.json'))
#x = json.load(open('/media/hayden/Storage/DATASETS/SPORT/TENNIS01/VGG16_fc7_COMB_points_feats.json'))
# mappings
# f = open('/media/hayden/Storage/DATASETS/SPORT/TENNIS01/mappings.txt','w')... | {
"repo_name": "HaydenFaulkner/phd",
"path": "processing/image/renumber_imageid.py",
"copies": "1",
"size": "1191",
"license": "mit",
"hash": -2755379959179348500,
"line_mean": 25.4666666667,
"line_max": 102,
"alpha_frac": 0.6137699412,
"autogenerated": false,
"ratio": 2.3398821218074657,
"confi... |
__author__ = 'hayden'
import math
import pickle
import time
import cv2
import cv2.cv as cv
import numpy as np
import scipy
def main():
layers = ['pool5', 'fc6', 'fc7']
svm_model_version = '002'
nn_model_version = '004'
vid_path = '/media/hayden/Storage/DATASETS/SPORT/TENNIS01/VID/'
feat_path = '... | {
"repo_name": "HaydenFaulkner/phd",
"path": "graveyard/vis_svm_classifications.py",
"copies": "1",
"size": "35418",
"license": "mit",
"hash": -1991179636213105700,
"line_mean": 60.5965217391,
"line_max": 187,
"alpha_frac": 0.5575978316,
"autogenerated": false,
"ratio": 2.650452742647609,
"confi... |
__author__ = 'hayden'
import math
import sys
import time
from caffe_code.cnns import utils
from rnn import my_rnn
rnn_root = '/home/hayden/neuraltalk/' # this file is expected to be in {caffe_root}/examples
sys.path.insert(0, rnn_root)
import numpy as np
import cv2
#%matplotlib inline
# Make sure that caffe is o... | {
"repo_name": "HaydenFaulkner/phd",
"path": "graveyard/ChangeDetectorTestWin.py",
"copies": "1",
"size": "18322",
"license": "mit",
"hash": 7150735616236255000,
"line_mean": 47.7287234043,
"line_max": 526,
"alpha_frac": 0.5755921843,
"autogenerated": false,
"ratio": 2.8912734732523275,
"config_... |
__author__ = 'hayden'
import numpy as np
import cv2
import random
import json
DATASET = 'M-VAD'#MPIIMD#MVAD
TYPE = 'ALL'
sents=[]
vid_paths=[]
if DATASET == 'YT2T':
anns = json.load(open('/media/hayden/Storage/DATASETS/VIDEO/YT2T/ANNOTATIONS/COMB.json'))
elif DATASET == 'M-VAD':
anns = json.load(open('/medi... | {
"repo_name": "HaydenFaulkner/phd",
"path": "graveyard/gt_display.py",
"copies": "1",
"size": "2410",
"license": "mit",
"hash": 2133412824537478400,
"line_mean": 26.0898876404,
"line_max": 115,
"alpha_frac": 0.5912863071,
"autogenerated": false,
"ratio": 2.822014051522248,
"config_test": false,... |
__author__ = 'hayden'
import numpy as np
import pickle
import h5py
import math
import os
import random
layers = ['pool5']
model_version = '999'
splits_id = '001'
feat_path = '/media/hayden/Storage/DATASETS/SPORT/TENNIS01/FEATURES/VGG16/RAW/'
labels_path = '/media/hayden/Storage/DATASETS/SPORT/TENNIS01/LABELS/RAW/'
s... | {
"repo_name": "HaydenFaulkner/phd",
"path": "graveyard/write_cnn_test_problem.py",
"copies": "1",
"size": "6119",
"license": "mit",
"hash": 7920342085032616000,
"line_mean": 44,
"line_max": 172,
"alpha_frac": 0.6010786076,
"autogenerated": false,
"ratio": 2.656969170646982,
"config_test": true,... |
__author__ = 'hayden'
import numpy as np
import pickle
import h5py
import math
import os
layers = ['pool5']
model_version = '001'
splits_id = '001'
feat_path = '/media/hayden/Storage/DATASETS/SPORT/TENNIS01/FEATURES/VGG16/RAW/'
labels_path = '/media/hayden/Storage/DATASETS/SPORT/TENNIS01/LABELS/RAW/'
split_path = '/... | {
"repo_name": "HaydenFaulkner/phd",
"path": "tennis/write_cnn_train_test.py",
"copies": "1",
"size": "3459",
"license": "mit",
"hash": -9191404920539594000,
"line_mean": 41.7160493827,
"line_max": 150,
"alpha_frac": 0.6736050882,
"autogenerated": false,
"ratio": 2.948849104859335,
"config_test"... |
__author__ = 'hayden'
import pickle
import numpy as np
svm_model_version = '002'
nn_model_version = '004'
labels_path = '/media/hayden/Storage/DATASETS/SPORT/TENNIS01/LABELS/RAW/'
classifications_path = '/media/hayden/Storage/DATASETS/SPORT/TENNIS01/CLASSIFICATIONS/SVM/'+svm_model_version+'/'
video_name = 'AUSO_2014_... | {
"repo_name": "HaydenFaulkner/phd",
"path": "tennis/test_set_eval.py",
"copies": "1",
"size": "14497",
"license": "mit",
"hash": -8069938359224987000,
"line_mean": 35.7012658228,
"line_max": 167,
"alpha_frac": 0.4389183969,
"autogenerated": false,
"ratio": 3.2947727272727274,
"config_test": tru... |
__author__ = 'hayden'
import pickle
import os
import math
import numpy as np
import cv2
import random
import cv2.cv as cv
classifier_names = ['OTHERvHITvSERVE', 'NADALvFEDERER', 'FOREHANDvBACKHAND']
layers = ['RAW']#['RAW','pool5']
version = '007'
feat_path = '/media/hayden/Storage/DATASETS/SPORT/TENNIS01/FEATURES/VG... | {
"repo_name": "HaydenFaulkner/phd",
"path": "tennis/digit_data_prep.py",
"copies": "1",
"size": "6519",
"license": "mit",
"hash": -3449459621912560000,
"line_mean": 40.7948717949,
"line_max": 191,
"alpha_frac": 0.5125019175,
"autogenerated": false,
"ratio": 3.443740095087163,
"config_test": fal... |
__author__ = 'hayden'
import pickle
import time
import cv2
import cv2.cv as cv
import numpy as np
import caffe_code.cnns.utils
def main():
layers = ['pool5','fc6','fc7']
vid_path = '/media/hayden/Storage/DATASETS/SPORT/TENNIS01/VID/'
savepath = '/media/hayden/Storage/DATASETS/SPORT/TENNIS01/FEATURES/VG... | {
"repo_name": "HaydenFaulkner/phd",
"path": "tennis/extract_raw_features.py",
"copies": "1",
"size": "4771",
"license": "mit",
"hash": 6327409266450063000,
"line_mean": 39.0924369748,
"line_max": 300,
"alpha_frac": 0.5627750996,
"autogenerated": false,
"ratio": 3.3178025034770515,
"config_test"... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.