2
0
mirror of https://github.com/inventree/InvenTree.git synced 2025-06-16 20:15:44 +00:00

pylint checks

This commit is contained in:
Matthias Mair
2024-08-20 00:26:32 +02:00
parent c197358ce4
commit 8a163237ac
24 changed files with 54 additions and 46 deletions

View File

@ -618,7 +618,7 @@ def export_records(
print('Running data post-processing step...')
# Post-process the file, to remove any "permissions" specified for a user or group
with open(tmpfile) as f_in:
with open(tmpfile, encoding='utf-8') as f_in:
data = json.loads(f_in.read())
data_out = []
@ -641,7 +641,7 @@ def export_records(
data_out.append(entry)
# Write the processed data to file
with open(target, 'w') as f_out:
with open(target, 'w', encoding='utf-8') as f_out:
f_out.write(json.dumps(data_out, indent=2))
print('Data export completed')
@ -684,7 +684,7 @@ def import_records(
# Pre-process the data, to remove any "permissions" specified for a user or group
datafile = f'{target}.data.json'
with open(target) as f_in:
with open(target, encoding='utf-8') as f_in:
try:
data = json.loads(f_in.read())
except json.JSONDecodeError as exc:
@ -714,11 +714,11 @@ def import_records(
print(entry)
# Write the auth file data
with open(authfile, 'w') as f_out:
with open(authfile, 'w', encoding='utf-8') as f_out:
f_out.write(json.dumps(auth_data, indent=2))
# Write the processed data to the tmp file
with open(datafile, 'w') as f_out:
with open(datafile, 'w', encoding='utf-8') as f_out:
f_out.write(json.dumps(load_data, indent=2))
excludes = content_excludes(allow_auth=False)
@ -888,8 +888,8 @@ def test_translations(c):
last_string = ''
# loop through input file lines
with open(file_path) as file_org:
with open(new_file_path, 'w') as file_new:
with open(file_path, encoding='utf-8') as file_org:
with open(new_file_path, 'w', encoding='utf-8') as file_new:
for line in file_org:
if line.startswith('msgstr "'):
# write output -> replace regex matches with x in the read in (multi)string