Replace file operations with function

main
bashrc 2026-04-28 22:45:01 +01:00
parent 92a33c4810
commit 2ba0064cc7
1 changed files with 25 additions and 23 deletions

View File

@ -826,18 +826,19 @@ def get_followers_of_person(base_dir: str,
continue
if not os.path.isfile(filename):
continue
try:
with open(filename, 'r', encoding='utf-8') as fp_following:
for following_handle in fp_following:
following_list: list[str] = \
load_list(filename,
'EX: get_followers_of_person unable to read ' +
filename + ' [ex]')
if following_list is None:
continue
for following_handle in following_list:
following_handle2 = remove_eol(following_handle)
if following_handle2 != handle:
continue
if account not in followers:
followers.append(account)
break
except OSError as exc:
print('EX: get_followers_of_person unable to read ' +
filename + ' ' + str(exc))
break
return followers
@ -1913,6 +1914,7 @@ def _delete_post_remove_replies(base_dir: str, nickname: str, domain: str,
load_list(replies_filename,
'EX: _delete_post_remove_replies unable to read ' +
replies_filename)
if replies_list is not None:
for reply_id in replies_list:
reply_id_str: str = reply_id.replace('\n', '').replace('\r', '')
reply_file: str = \