Open main menu

CDOT Wiki β

Changes

OPS435 A1 Usage Report Template

1,711 bytes removed, 07:40, 4 November 2018
A1 Usage Report Template
<pre>
#!/usr/bin/env python3
#'''# authorship declaration## Author: __author__ Raymond Chan# Date: __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:
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__':
# retrieve command line argument  # set menu and submenu display text menu_title = 'Usage Report - Main Menu' menu_items = [] menu_items.append('d) Diaily Usage Report') menu_items.append('w) Weekly Usage Report')import argparse menu_items.append('m) Monthly Usage Report') menu_items.append('q) Quit') menu_options = ['d','w','m','q']  dumenu_title = 'Daily Usage Report Menu' dumenu_items = [] dumenu_items.append('u) By User') dumenu_items.append('h) By Remote Host') dumenu_items.append('r) Return to Main Menu') dumenu_options = ['u','h','r']  wumenu_title = 'Weekly Usage Report Menu' wumenu_items = [] wumenu_items.append('u) By User') wumenu_items.append('h) By Remote Host') wumenu_items.append('r) Return to Main Menu') wumenu_options = ['u','h','r']  mumenu_title = 'Monthly Usage Report Menu' mumenu_items = [] mumenu_items.append('u) By User') mumenu_items.append('h) By Remote Host') mumenu_items.append('r) Return to Main Menu') mumenu_options = ['u','h','r']  menu_selected = '' while menu_selected != 'q': menu_selected = menu(menu_title,menu_items,menu_options) print('You have selected:', menu_selected)  if menu_selected == 'd': dumenu_selected = '' while dumenu_selected != 'r': dumenu_selected = menu(dumenu_title,dumenu_items,dumenu_options) print('You have selected:',dumenu_selected) if dumenu_selected == 'u': print('Call Daily Usage Report by User.')  if dumenu_selected == 'h': print('Call Daily Usage Report by Remote host.')  if menu_selected == 'w': print('Call Weekly Usage report menu and submenu')  if menu_selected == 'm': print('Call Monthly Usage report menu and submenu')  print('Thank you for using this Python program.')
</pre>
1,760
edits