Open main menu

CDOT Wiki β

OPS435 A1 Usage Report Template

Revision as of 07:40, 4 November 2018 by Rchan (talk | contribs) (A1 Usage Report Template)

A1 Usage Report Template

Please note that the following listing contains some actual python codes, but mostly are pseudo code.

#!/usr/bin/env python3
'''
   authorship declaration

   __author__ Raymond Chan
   __date__ Feb 2018
   __version__ 1.0
 
   text to describe the purpose of this script
'''

import os 
import sys
import time

def menu(title,items,choice):
    ''' docstring for this function '''
    selection = ''
    while selection not in choice:
        print(title)
        print('=' * len(title))
        for item in items:
            print(item)
        selection = input('menu choice -->')
    return selection

def get_login_rec():
    ''' docstring for this fucntion
    get records from the last command
    filter out the unwanted records
    add filtered record to list (login_recs)'''
    return login_recs
 
def read_login_rec(filelist):
    ''' docstring for this function
    get records from given filelist
    open and read each file from the filelist
    filter out the unwanted records
    add filtered record to list (login_recs)''' 
    return login_rec

def cal_daily_usage(subject,login_recs):
    ''' docstring for this function
    check number of subjects in login_recs
    if less than 10, display subject selection menu
    for each subject, process daily usage
    dispaly daily usage'''
    return 0

def cal_weekly_usage(subject,login_recs):
    '''check number of subjects in login_recs
    if less than 10, display subject selection menu
    for each subject, process weekly usage
    display weekly usage'''
    return 0

def cal_monthly_usage(subject,login_recs):
    '''check numbe of subjects in login_recs
    if less than 10, display subject selection menu
    for each subject, process monthly usage
    display monthly usage'''
    return 0
     
if __name__ == '__main__':
    import argparse
    ....