Changes

Jump to: navigation, search

OPS435 Assignment 2 for Section A

1,184 bytes added, 11:04, 12 July 2021
Submission Guidelines and Process
== Clone Your Repo (ASAP) ==
The first step will be to clone the Assignment 1 2 repository. The invite link will be provided to you by your professor. The repo <b>You will contain need a check script, a README filefree GitHub account to complete this assignment.</b> If you already have an existing GitHub account, and the file where you will enter your codemay use it.
The repo will contain a check script, a README file, and the file where you will enter your code. == The First Milestone (due February 14July 26) ==
For the first milestone you will have two functions to complete.
* <code>call_du_sub</code> will take one argument and return a list. The argument is a target directory. The function will use <code>subprocess.Popen</code> to run the command <b>du -d l <target_directory></b>.
To test with the check script, run the following:
<code>python3 checkA1checkA2.py -f -v TestPercent</code><code>python3 checkA2.py -f -v TestDuSub</code>
== Second Milestone (due February 21August 2) ==For the second milestone you will have one two more function functions to complete.
* <code>create_dir_dict</code> will take your list from <code>call_du_sub</code> and return a dictionary.
** Every item in your list should create a key in your dictionary.
To run the check script, enter the following:
<code>python checkA1checkA2.py -f -v TestDirDict</code> * You will be using a module in the standard library called <b>Argparse</b>. This will help handle more complex sets of options and arguments than simply using sys.argv. ** Refer to the argparse documentation to complete the <code>parse_command_args</code> function. At minimum, your assignment should handle the following options and arguments: *** -h will print a usage message. This will automatically be created by argparse itself, you will not need to implement this. However, refer carefully to the sample output and ensure that your help message matches the required output. *** -H will print file sizes in Human readable format. For example, 1024 bytes will be printed as 1K, 1024 kilobytes will be printed as 1M, and so on.  *** -l <number> will set the maximum length of the bar graph. The default should be 20 character. This option will require an option argument that is an integer. *** Your script will also require one positional argument which contains the target directory for scanning.
== Minimum Viable Product ==
Once you have achieved the Milestones, you will have to do the following to get a minimum viable product:
* In your <code>if __name__ == '__main__'</code> block, you will have to check command line arguments.
** If the user has entered no command line argument, use the current directory.
** If the user has entered more than one argument, or their argument isn't a valid directory, print an error message.
** Otherwise, the argument will be your target directory.
* Call <code>call_du_sub</code> with the target directory.
* Pass the return value from that function to <code>create_dir_dict</code>
* Format the output in a way that is easy to read.
* Add colour to the output.
* Include files in the output.
* Include a threshold, so that results that are less than a user-specified size get excluded from results.
* Add more error checking, print a usage message to the user.
* Convert bytes to a human-readable format. NOTE: This doesn't have to be 100% accurate to get marks.
* Accept more options from the user.
* Sort the output by percentage, or by filename.
It is expected that the additional features you provided should be useful, non-trivial, they should not require super-user privileges and should not require the installation of additional packages to work. (ie: I shouldn't have to run pip to make your assignment work).
== The Assignment (due March 7August 6, 11:59pm) ==* Be sure to make your final commit before the deadline.Don't forget to also use <code>git push</code> to push your code into the online repository!
* Then, copy the contents of your <b>duim.py</b> file into a Word document, and submit it to Blackboard. <i>I will use GitHub to evaluate your deadline, but submitting to Blackboard tells me that you wish to be evaluated.</i>

Navigation menu