Fixed file so it passes the linter

This commit is contained in:
jeffser 2024-08-04 20:28:27 -06:00
parent 44640b7e53
commit 634ac122d9

View File

@ -1,9 +1,17 @@
"""
Moves the descriptions of models to src/available_models_descriptions.py
so they can be translated
"""
import json import json
with open('src/available_models.json', 'r') as f:
data = json.load(f) if __name__ == "__main__":
results = 'descriptions = {\n' with open('src/available_models.json', 'r', encoding="utf-8") as f:
for key, value in data.items(): data = json.load(f)
results += f" '{key}': _(\"{value['description']}\"),\n" RESULTS = 'descriptions = {\n'
results += '}' for key, value in data.items():
with open('src/available_models_descriptions.py', 'w+') as f: RESULTS += f" '{key}': _(\"{value['description']}\"),\n"
f.write(results) RESULTS += '}'
with open('src/available_models_descriptions.py', 'w+', encoding="utf-8") as f:
f.write(results)