mirror of https://gitlab.com/bashrc2/epicyon
Replace appends with functions
parent
412e053abd
commit
be4a809f42
20
blocking.py
20
blocking.py
|
|
@ -1740,22 +1740,18 @@ def import_blocking_file(base_dir: str, nickname: str, domain: str,
|
||||||
if not append_blocks:
|
if not append_blocks:
|
||||||
return True
|
return True
|
||||||
|
|
||||||
try:
|
text = ''
|
||||||
with open(blocking_filename, 'a+', encoding='utf-8') as fp_blocks:
|
|
||||||
for new_block in append_blocks:
|
for new_block in append_blocks:
|
||||||
fp_blocks.write(new_block + '\n')
|
text += new_block + '\n'
|
||||||
except OSError:
|
append_string(text, blocking_filename,
|
||||||
print('EX: ' +
|
'EX: ' +
|
||||||
'unable to append imported blocks to ' +
|
'unable to append imported blocks to ' +
|
||||||
blocking_filename)
|
blocking_filename)
|
||||||
|
text = ''
|
||||||
try:
|
|
||||||
with open(blocking_reasons_filename, 'a+',
|
|
||||||
encoding='utf-8') as fp_blocks:
|
|
||||||
for new_reason in append_reasons:
|
for new_reason in append_reasons:
|
||||||
fp_blocks.write(new_reason + '\n')
|
text += new_reason + '\n'
|
||||||
except OSError:
|
append_string(text, blocking_reasons_filename,
|
||||||
print('EX: ' +
|
'EX: ' +
|
||||||
'unable to append imported block reasons to ' +
|
'unable to append imported block reasons to ' +
|
||||||
blocking_reasons_filename)
|
blocking_reasons_filename)
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue