summaryrefslogtreecommitdiff
path: root/searxng_extra/update/update_wikidata_units.py
diff options
context:
space:
mode:
Diffstat (limited to 'searxng_extra/update/update_wikidata_units.py')
-rwxr-xr-xsearxng_extra/update/update_wikidata_units.py12
1 files changed, 10 insertions, 2 deletions
diff --git a/searxng_extra/update/update_wikidata_units.py b/searxng_extra/update/update_wikidata_units.py
index 43a872b1b..e999b6cfd 100755
--- a/searxng_extra/update/update_wikidata_units.py
+++ b/searxng_extra/update/update_wikidata_units.py
@@ -3,6 +3,13 @@
# lint: pylint
# pylint: disable=missing-module-docstring
+"""Fetch units from :origin:`searx/engines/wikidata.py` engine.
+
+Output file: :origin:`searx/data/wikidata_units.json` (:origin:`CI Update data
+... <.github/workflows/data-update.yml>`).
+
+"""
+
import json
import collections
@@ -54,5 +61,6 @@ def get_wikidata_units_filename():
return join(join(searx_dir, "data"), "wikidata_units.json")
-with open(get_wikidata_units_filename(), 'w', encoding="utf8") as f:
- json.dump(get_data(), f, indent=4, ensure_ascii=False)
+if __name__ == '__main__':
+ with open(get_wikidata_units_filename(), 'w', encoding="utf8") as f:
+ json.dump(get_data(), f, indent=4, ensure_ascii=False)