From 20a24edaa88138fdd8d2ee071fdf2c12aa959909 Mon Sep 17 00:00:00 2001 From: Bob Mottram Date: Tue, 2 Jun 2020 10:05:55 +0100 Subject: [PATCH] Less indentation --- inbox.py | 26 ++++++++++++++------------ 1 file changed, 14 insertions(+), 12 deletions(-) diff --git a/inbox.py b/inbox.py index 51130f971..6458354e2 100644 --- a/inbox.py +++ b/inbox.py @@ -2233,14 +2233,15 @@ def clearQueueItems(baseDir: str, queue: []) -> None: for subdir, dirs, files in os.walk(baseDir + '/accounts'): for account in dirs: queueDir = baseDir + '/accounts/' + account + '/queue' - if os.path.isdir(queueDir): - for queuesubdir, queuedirs, queuefiles in os.walk(queueDir): - for qfile in queuefiles: - try: - os.remove(os.path.join(queueDir, qfile)) - ctr += 1 - except BaseException: - pass + if not os.path.isdir(queueDir): + continue + for queuesubdir, queuedirs, queuefiles in os.walk(queueDir): + for qfile in queuefiles: + try: + os.remove(os.path.join(queueDir, qfile)) + ctr += 1 + except BaseException: + pass if ctr > 0: print('Removed ' + str(ctr) + ' inbox queue items') @@ -2252,10 +2253,11 @@ def restoreQueueItems(baseDir: str, queue: []) -> None: for subdir, dirs, files in os.walk(baseDir + '/accounts'): for account in dirs: queueDir = baseDir + '/accounts/' + account + '/queue' - if os.path.isdir(queueDir): - for queuesubdir, queuedirs, queuefiles in os.walk(queueDir): - for qfile in queuefiles: - queue.append(os.path.join(queueDir, qfile)) + if not os.path.isdir(queueDir): + continue + for queuesubdir, queuedirs, queuefiles in os.walk(queueDir): + for qfile in queuefiles: + queue.append(os.path.join(queueDir, qfile)) if len(queue) > 0: print('Restored ' + str(len(queue)) + ' inbox queue items')