From e8ed8c53653c6a4aa46264281d007df5e47821df Mon Sep 17 00:00:00 2001 From: Bob Mottram Date: Mon, 15 Jul 2024 20:56:25 +0100 Subject: [PATCH] Less indentation --- newsdaemon.py | 15 ++++++++------- posts.py | 11 ++++++----- 2 files changed, 14 insertions(+), 12 deletions(-) diff --git a/newsdaemon.py b/newsdaemon.py index 854bc3080..fb1dba0d8 100644 --- a/newsdaemon.py +++ b/newsdaemon.py @@ -883,13 +883,14 @@ def run_newswire_daemon(base_dir: str, httpd, time.sleep(10) # if a new blog post has been created then stop # waiting and recalculate the newswire - if os.path.isfile(refresh_filename): - try: - os.remove(refresh_filename) - except OSError: - print('EX: run_newswire_daemon unable to delete ' + - str(refresh_filename)) - break + if not os.path.isfile(refresh_filename): + continue + try: + os.remove(refresh_filename) + except OSError: + print('EX: run_newswire_daemon unable to delete ' + + str(refresh_filename)) + break def run_newswire_watchdog(project_version: str, httpd) -> None: diff --git a/posts.py b/posts.py index b3d36af63..3c521337b 100644 --- a/posts.py +++ b/posts.py @@ -201,11 +201,12 @@ def no_of_followers_on_domain(base_dir: str, handle: str, try: with open(filename, 'r', encoding='utf-8') as fp_followers: for follower_handle in fp_followers: - if '@' in follower_handle: - follower_domain = follower_handle.split('@')[1] - follower_domain = remove_eol(follower_domain) - if domain == follower_domain: - ctr += 1 + if '@' not in follower_handle: + continue + follower_domain = follower_handle.split('@')[1] + follower_domain = remove_eol(follower_domain) + if domain == follower_domain: + ctr += 1 except OSError as exc: print('EX: no_of_followers_on_domain unable to read ' + filename + ' ' + str(exc))