Less indentation

main
Bob Mottram 2025-05-31 12:10:28 +01:00
parent f0db978b8f
commit 1158e6b65c
1 changed files with 17 additions and 16 deletions

View File

@ -1810,21 +1810,22 @@ def remove_post_from_index(post_url: str, debug: bool,
print('EX: remove_post_from_index unable to read ' + print('EX: remove_post_from_index unable to read ' +
index_file + ' ' + str(exc)) index_file + ' ' + str(exc))
if lines: if not lines:
try: return
with open(index_file, 'w+', try:
encoding='utf-8') as fp_mod2: with open(index_file, 'w+',
for line in lines: encoding='utf-8') as fp_mod2:
if line.strip("\n").strip("\r") != post_id: for line in lines:
fp_mod2.write(line) if line.strip("\n").strip("\r") != post_id:
continue fp_mod2.write(line)
if debug: continue
print('DEBUG: removed ' + post_id + if debug:
' from index ' + index_file) print('DEBUG: removed ' + post_id +
except OSError as exc: ' from index ' + index_file)
print('EX: ' + except OSError as exc:
'remove_post_from_index unable to write ' + print('EX: ' +
index_file + ' ' + str(exc)) 'remove_post_from_index unable to write ' +
index_file + ' ' + str(exc))
def remove_moderation_post_from_index(base_dir: str, post_url: str, def remove_moderation_post_from_index(base_dir: str, post_url: str,
@ -2433,7 +2434,7 @@ def no_of_active_accounts_monthly(base_dir: str, months: int) -> bool:
return account_ctr return account_ctr
def copytree(src: str, dst: str, symlinks: str, ignore: bool): def copytree(src: str, dst: str, symlinks: str, ignore: bool) -> None:
"""Copy a directory """Copy a directory
""" """
for item in os.listdir(src): for item in os.listdir(src):