384
edits
Changes
→Required Functions
== Required Functions ==
You will need to complete the functions inside the provided file called <code>duim.py</code>. The provided <code>checkA2checkA1.py</code> will be used to test these functions.
** '-d 1' specifies a <i>max depth</i> of 1. Your list shouldn't include files, just a list of subdirectories in the target directory.
** Your list should <u>not</u> contain newline characters.
** <b>max_length</b> refers to the total number of characters that the bar graph will be composed of. You can use equal signs <code>=</code> or any other character that makes sense, but the empty space <b>must be composed of spaces</b>, at least until you have passed the first milestone.
** The string returned by this function should only be composed of these two characters. For example, calling <code>percent_to_graph(50, 10)</code> should return:
'===== '
<b>Please note that the '' characters should <u>not</u> be part of the output, they are here to indicate that this is a string!</b>
** The list can be the list returned by <code>call_du_sub()</code>.
** The dictionary that you return should have the full directory name as <i>key</i>, and the number of bytes in the directory as the <i>value</i>. This value should be an integer. For example, using the example of <b>/usr/local/lib</b>, the function would return:
{'/usr/local/lib/heroku': 164028, '/usr/local/lib/python2.7': 11072, ...}
4. <code>get_max</code> should take a dictionary and the target directory as arguments, and it should return the total size of the target directory as an integer.
** The dictionary returned by <code>create_dir_dict</code> will be used for this function. When calculating the percentage for each subdirectory, you will need the total size of the target directory as the denominator. This function will return that value.
** There are many approaches you can take to get this number. Some approaches won't require the target directory as an argument, but pass it in anyway.
== Additional Functions ==