mirror of https://gitlab.com/bashrc2/epicyon
Replace file operations with function
parent
92a33c4810
commit
2ba0064cc7
14
utils.py
14
utils.py
|
|
@ -826,18 +826,19 @@ def get_followers_of_person(base_dir: str,
|
||||||
continue
|
continue
|
||||||
if not os.path.isfile(filename):
|
if not os.path.isfile(filename):
|
||||||
continue
|
continue
|
||||||
try:
|
following_list: list[str] = \
|
||||||
with open(filename, 'r', encoding='utf-8') as fp_following:
|
load_list(filename,
|
||||||
for following_handle in fp_following:
|
'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)
|
following_handle2 = remove_eol(following_handle)
|
||||||
if following_handle2 != handle:
|
if following_handle2 != handle:
|
||||||
continue
|
continue
|
||||||
if account not in followers:
|
if account not in followers:
|
||||||
followers.append(account)
|
followers.append(account)
|
||||||
break
|
break
|
||||||
except OSError as exc:
|
|
||||||
print('EX: get_followers_of_person unable to read ' +
|
|
||||||
filename + ' ' + str(exc))
|
|
||||||
break
|
break
|
||||||
return followers
|
return followers
|
||||||
|
|
||||||
|
|
@ -1913,6 +1914,7 @@ def _delete_post_remove_replies(base_dir: str, nickname: str, domain: str,
|
||||||
load_list(replies_filename,
|
load_list(replies_filename,
|
||||||
'EX: _delete_post_remove_replies unable to read ' +
|
'EX: _delete_post_remove_replies unable to read ' +
|
||||||
replies_filename)
|
replies_filename)
|
||||||
|
if replies_list is not None:
|
||||||
for reply_id in replies_list:
|
for reply_id in replies_list:
|
||||||
reply_id_str: str = reply_id.replace('\n', '').replace('\r', '')
|
reply_id_str: str = reply_id.replace('\n', '').replace('\r', '')
|
||||||
reply_file: str = \
|
reply_file: str = \
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue