diff options
author | Markus Heiser <markus.heiser@darmarit.de> | 2024-03-10 15:33:23 +0100 |
---|---|---|
committer | Markus Heiser <markus.heiser@darmarIT.de> | 2024-03-10 15:56:50 +0100 |
commit | ce4aaf6cad9c0a57f5f12ef80ec4e1b45bcf87d4 (patch) | |
tree | fe4b88659f1c39e1026e42305119bbd326ca3fc9 /searxng_extra/update/update_wikidata_units.py | |
parent | 0ffec440b2d1146d4daf3f63a544aeb635a6e617 (diff) | |
download | searxng-ce4aaf6cad9c0a57f5f12ef80ec4e1b45bcf87d4.tar.gz searxng-ce4aaf6cad9c0a57f5f12ef80ec4e1b45bcf87d4.zip |
[mod] comprehensive revision of the searxng_extra/update/ scripts
- pylint all scripts
- fix some errors reported by pyright
- from searx.data import data_dir (Path.open)
- fix import from pygments.formatters.html
NOTE: none functional changes!
Signed-off-by: Markus Heiser <markus.heiser@darmarit.de>
Diffstat (limited to 'searxng_extra/update/update_wikidata_units.py')
-rwxr-xr-x | searxng_extra/update/update_wikidata_units.py | 9 |
1 files changed, 6 insertions, 3 deletions
diff --git a/searxng_extra/update/update_wikidata_units.py b/searxng_extra/update/update_wikidata_units.py index e999b6cfd..6a7ceb1b8 100755 --- a/searxng_extra/update/update_wikidata_units.py +++ b/searxng_extra/update/update_wikidata_units.py @@ -18,6 +18,9 @@ from os.path import join from searx import searx_dir from searx.engines import wikidata, set_loggers +from searx.data import data_dir + +DATA_FILE = data_dir / 'wikidata_units.json' set_loggers(wikidata, 'wikidata') @@ -58,9 +61,9 @@ def get_data(): def get_wikidata_units_filename(): - return join(join(searx_dir, "data"), "wikidata_units.json") + return join(join(searx_dir, "data"), "") if __name__ == '__main__': - with open(get_wikidata_units_filename(), 'w', encoding="utf8") as f: - json.dump(get_data(), f, indent=4, ensure_ascii=False) + with DATA_FILE.open('w', encoding="utf8") as f: + json.dump(get_data(), f, indent=4, sort_keys=True, ensure_ascii=False) |