From 132efe16e1afc5a2bfe21f9fbe534fc0e0baa339 Mon Sep 17 00:00:00 2001 From: neingeist Date: Wed, 4 Sep 2024 21:49:42 +0200 Subject: [PATCH] =?UTF-8?q?=F0=9F=9A=A7=20find-junk:=20reformat?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- find-junk | 25 ++++++++++++++++--------- 1 file changed, 16 insertions(+), 9 deletions(-) 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()