diff options
author | Markus Heiser <markus.heiser@darmarit.de> | 2022-01-03 12:40:06 +0100 |
---|---|---|
committer | Markus Heiser <markus.heiser@darmarit.de> | 2022-01-05 16:09:40 +0100 |
commit | ffea5d8ef5540bc4be08b2b26e1819d5401f854d (patch) | |
tree | b2285d42d9ed6debec82ebd25fca31358a452794 /searxng_extra/update/update_wikidata_units.py | |
parent | b630c5d7bc0bf5a4281ad402bb32adc7f6ab257f (diff) | |
download | searxng-ffea5d8ef5540bc4be08b2b26e1819d5401f854d.tar.gz searxng-ffea5d8ef5540bc4be08b2b26e1819d5401f854d.zip |
[docs] add documentation for the scripts in searxng_extra/update
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 | 12 |
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) |