Changes

Jump to: navigation, search

OPS435 Assignment 2 for Section C

416 bytes removed, 17:05, 25 March 2021
Suggested Process
<li> Run the script itself. Investigate argparse. <b>In the main block, print(args).</b> Experiment with the various options.
<li> Read the usage output in the docs, what option must you implement? Go ahead and implement it. <b>Commit the change.</b>
<li> Use the check script to check your work: <code>./checkA2.py -f -v TestHelp</code>. It should succeed.
<li> Investigate the <code>parse_for_user()</code> function, with the <code>usage_data_file</code>. <b>In main, call `parse_for_user()` with `output` as the argument. Investigate what's returned.</b>
<li> <code>parse_for_user()</code> should take the list of lines from the file, and instead return a list of usernames. <b>In main, print the title header and the output. Commit the change.</b>
<li> <b>Once you have `output` --> `parse_for_user()` --> correct output being printed, use if conditions to print only when `-l user` is in the command line arguments.</b>
<li> Test using <bcode>Continue committing these changes as your proceed./checkA2.py -f -v TestList</bcode><li> Implement . You should see some tests succeeding, but some failing. Use the check script to start implementing the same things as parse_for_user but functions needed for <codeb>parse_for_hosts-l host</codeb>. Use the user function to guide you. <li> Compare <b>Continue committing these changes as your output with the output belowproceed.<li/b> Write the `parse_for_daily()` function using the pseudocode given. This Your script should now be taking passing the list of lines from your file, and output a dictionary with start dates in DD/MM/YYYY format as the key and usage in seconds as the valueTestList tests.<li> <code> {'01/01/1980': 1200, '02/01/1980': 2400, '03/01/1980': 2200} </code>
<li> Once your `parse_for_daily()` function works, call it with the argparse options, and display the contents.
<li> Write (or modify) a function to do the same for remote hosts.
<li> Implement the outputting of the duration in HH:MM:SS instead of seconds. It's recommended you write a function to take in seconds and return a string. Call this when the `-s` option is absent. Make sure this is working with remote hosts as well. You should now have x of y tests passing.
<li> Finally, implement the `--monthly` option. Create a new function and get it working. start with seconds, then duration and make sure it works with remote as well.
<li> Perform last checks and document your code. Write **why** your code is doing what it does, rather than **what** it's doing. You should have 100% of tests succeeding.

Navigation menu