Less indentation

main
Bob Mottram 2025-06-02 13:20:39 +01:00
parent dcc112637c
commit 5df56efc49
1 changed files with 19 additions and 17 deletions

View File

@ -2982,23 +2982,25 @@ def _remove_send_block(base_dir: str, nickname: str, domain: str,
if not os.path.isfile(send_block_filename): if not os.path.isfile(send_block_filename):
return return
if text_in_file(inbox_url, send_block_filename, False): if not text_in_file(inbox_url, send_block_filename, False):
send_blocks_str = '' return
try:
with open(send_block_filename, 'r', send_blocks_str = ''
encoding='utf-8') as fp_blocks: try:
send_blocks_str = fp_blocks.read() with open(send_block_filename, 'r',
except OSError: encoding='utf-8') as fp_blocks:
print('EX: _remove_send_block unable to read ' + send_blocks_str = fp_blocks.read()
send_block_filename) except OSError:
send_blocks_str = send_blocks_str.replace(inbox_url, '') print('EX: _remove_send_block unable to read ' +
try: send_block_filename)
with open(send_block_filename, 'w+', send_blocks_str = send_blocks_str.replace(inbox_url, '')
encoding='utf-8') as fp_blocks: try:
fp_blocks.write(send_blocks_str) with open(send_block_filename, 'w+',
except OSError: encoding='utf-8') as fp_blocks:
print('EX: _remove_send_block unable to write ' + fp_blocks.write(send_blocks_str)
send_block_filename) except OSError:
print('EX: _remove_send_block unable to write ' +
send_block_filename)
def thread_send_post(session, post_json_str: str, federation_list: [], def thread_send_post(session, post_json_str: str, federation_list: [],