Ejemplo n.º 1
0
def create_post_more(name):
    devices = get_data()
    deviceSNID = request.forms.get('snid')
    if name == 'phone':
        devicePhone = request.forms.get('phone-number')
        for value in devices.values():
            if value['SNID'] == deviceSNID:
                value['Phone Number'] == 'devicePhone'
        write_data(devices)
        redirect('/')
    elif name == 'pc':
        deviceIP = request.forms.get('ip_address')
        deviceMAC = request.forms.get('mac_address')
        deviceOS = request.forms.get('operating_system')
        for value in devices.values():
            if value['SNID'] == deviceSNID:
                value['IP'] = deviceIP
                value['MAC'] = deviceMAC
                value['Operating System'] = deviceOS
        write_data(devices)
        redirect('/')
    elif name == 'software':
        deviceLicense = request.forms.get('license')
        deviceExpiry = request.forms.get('expiry_date')
        for value in devices.values():
            if value['SNID'] == deviceSNID:
                value['License'] = deviceLicense
                value['Expiry Date'] = deviceExpiry
        write_data(devices)
        redirect('/')
    else:
        redirect('/')
Ejemplo n.º 2
0
def update_labs():
    update_file()
    labs = get_data()
    collection.delete_many({})
    collection.insert_many(labs)

    return collection
Ejemplo n.º 3
0
def create_post():
    deviceType = request.forms.get('type')
    deviceSNID = request.forms.get('snid')
    deviceModel = request.forms.get('model')
    devicePurchaseDate = request.forms.get('purchase-date')
    deviceCost = request.forms.get('cost')
    deviceDependsOn = request.forms.get('depends-on')
    deviceAssignedTo = request.forms.get('assigned-to')
    devicePhysicalLocation = request.forms.get('physical-location')
    deviceStatus = request.forms.get('status')
    deviceName = deviceSNID
    devices = get_data()
    devices[deviceName] = {}
    devices[deviceName]['Type'] = deviceType
    devices[deviceName]['SNID'] = deviceSNID
    devices[deviceName]['Model'] = deviceModel
    devices[deviceName]['Purchase Date'] = devicePurchaseDate
    devices[deviceName]['Cost'] = deviceCost
    devices[deviceName]['Depends On'] = deviceDependsOn
    devices[deviceName]['Assigned To'] = deviceAssignedTo
    devices[deviceName]['Physical Location'] = devicePhysicalLocation
    devices[deviceName]['Status'] = deviceStatus
    write_data(devices)
    if 'software' in deviceType.lower():
        redirect('/create/software/' + deviceSNID)
    elif 'desktop' in deviceType.lower():
        redirect('/create/pc/' + deviceSNID)
    elif 'laptop' in deviceType.lower():
        redirect('/create/pc/' + deviceSNID)
    elif 'phone' in deviceType.lower():
        redirect('/create/phone/' + deviceSNID)
    else:
        redirect('/')
Ejemplo n.º 4
0
def create_get():
    devices = get_data().keys()
    staff = get_people()['staff']
    teachers = get_people()['teachers']
    students = get_people()['students']
    locations = get_location()
    dataFields = ['Router','Switch','Barrix','Software - Individual', 'Software - Subscription','Hub','Desktop Computer','Laptop','Projector','Speakers','Television - CRT', 'Television - LCD', 'Phone', 'DVD Player', 'VCR', 'Printer', 'Other']
    return template('generate', dataFields=dataFields, devices=devices, staff=staff, teachers=teachers, students=students, locations=locations)
Ejemplo n.º 5
0
def peerread_to_df(load=False):
    if load:
        with open('{}/data/processed/df_data.csv'.format(path),
                  'r',
                  encoding='utf-8') as f:
            papers = pd.read_csv(f, sep='\t', index_col=0)
    else:
        papers = processing.get_data(path)
        with open('{}/data/processed/df_data.csv'.format(path),
                  'w',
                  encoding='utf-8') as f:
            papers.to_csv(f, sep='\t')
    return papers
Ejemplo n.º 6
0
]

validation_files = []
training_files = []
test_files = []
for i in range(len(filenames)):
    if i == 3 or i == 6:
        validation_files.append(filenames[i])
        continue
    if i == 9 or i == 12:
        test_files.append(filenames[i])
        continue

    training_files.append(filenames[i])

training_data, labels = get_data(training_files)
validation_data, val_labels = get_data(validation_files)
test_data, test_labels = get_data(test_files)

labels.update(val_labels)
labels.update(test_labels)

partition = {
    'train': training_data,
    'validation': validation_data,
    'test': test_data
}
#labels = {'180313_0_1' : 57.08444, '180313_0_2' :75.627174, '180313_0_0' : 73.48143 }
#labels = {'180313_0_1' : 1, '180313_0_2' :0, '180313_0_0' : 1 }
#[57.08444 , 75.627174, 73.48143]
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Created on Sun Jan 28 21:44:15 2018

@author: hu
"""

from __future__ import print_function, division
from builtins import range

import numpy as np
import data_processing
from processing import get_data

X, Y, _, _ = get_data()

# randomly initialize weights
M = 5
D = X.shape[1]
K = len(set(Y))
W1 = np.random.randn(D, M)
b1 = np.zeros(M)
W2 = np.random.randn(M, K)
b2 = np.zeros(K)


# make predictions
def softmax(a):
    expA = np.exp(a)
    return expA / expA.sum(axis=1, keepdims=True)
Ejemplo n.º 8
0
def index():
    data = get_data()
    data = OrderedDict(sorted(data.items(), key=lambda t: t[0]))
    return template('home',data=data)
Ejemplo n.º 9
0
def search_rest():
    searched = request.query.search
    whileLoop = 0
    while whileLoop == 0:
        name = request.query.name
        if name == "":
            name = False
        snid = request.query.snid
        if snid == "":
            snid = False
        deviceType = request.query.type
        if deviceType == "":
            deviceType = False
        model = request.query.model
        if model == "":
            model = False
        ip = request.query.ip
        if ip == "":
            ip = False
        mac = request.query.mac
        if mac == "":
            mac = False
        purchase_date = request.query.purchase_date
        if purchase_date == "":
            purchase_date = False
        worth = request.query.worth
        if worth == "":
            worth = False
        age = request.query.age
        if age == "":
            age = False
        license = request.query.license
        if license == "":
            license = False
        cost = request.query.cost
        if cost == "":
            cost = False
        os = request.query.os
        if os == "":
            os = False
        location = request.query.location
        if location == "":
            location = False
        phone_type = request.query.phone_type
        if phone_type == "":
            phone_type = False
        phone_no = request.query.phone_no
        if phone_no == "":
            phone_no = False
        depend = request.query.depend
        if depend == "":
            depend = False
        assign = request.query.assign
        if assign == "":
            assign = False
        status = request.query.status
        if status == "":
            status = False
        expiry_date = request.query.expiry_date
        if expiry_date == "":
            expiry_date = False
        comments = request.query.comments
        if comments == "":
            comments = False
        dictOut = {"Name": name, "SNID": snid, "Type": deviceType, "Model": model, "IP": ip, "MAC": mac, "Purchase Date": purchase_date, "Current Worth": worth, "Age": age, "License": license, "Cost": cost, "Operating System": os, "Physical Location": location, "Phone Type": phone_type, "Phone Number": phone_no, "Depends On": depend, "Assigned To": assign, "Status": status, "Expiry Date": expiry_date, "General Comments": comments}
        results = match_results(dictOut, get_data())
        whileLoop = 1
    return template('search', results=results, data=get_data(), searched=searched)