diff --git a/find-junk b/find-junk index 7910e7e..adac0b8 100755 --- a/find-junk +++ b/find-junk @@ -8,19 +8,26 @@ import os import os.path import sys -M = 1024*1024 +M = 1024 * 1024 def junk_dirs(): """Return directories which potentially contain junk""" - for d in ['~/tmp', '~/.local/share/Trash', '~/rpmbuild', '~/RPM', - '~/.cache/tracker', '~/.local/share/apt-dater/history']: + static_junk_dirs = [ + "~/tmp", + "~/.local/share/Trash", + "~/rpmbuild", + "~/RPM", + "~/.cache/tracker", + "~/.local/share/apt-dater/history", + ] + for d in static_junk_dirs: d = os.path.expanduser(d) if os.path.exists(d): yield d - for d, _, _ in os.walk(os.path.expanduser('~')): - if d.endswith('.sync/Archive'): + for d, _, _ in os.walk(os.path.expanduser("~")): + if d.endswith(".sync/Archive"): yield d @@ -49,17 +56,17 @@ def main(): if os.path.isdir(d): du_d = du(d) - if du_d < 5*M: + if du_d < 5 * M: continue - if du_d > 100*M: + if du_d > 100 * M: fore = Fore.RED - elif du_d > 50*M: + elif du_d > 50 * M: fore = Fore.YELLOW else: fore = Fore.RESET - print(fore + str(du_d//M) + 'M\t' + d + Fore.RESET) + print(fore + str(du_d // M) + "M\t" + d + Fore.RESET) main()