diff options
author | Martin Fischer <martin@push-f.com> | 2022-01-05 19:46:00 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2022-01-05 19:46:00 +0100 |
commit | 160f3e022e1774f3a25a9f5e0cf36ec34976cdad (patch) | |
tree | 1f935d47da7f89298dc4882cfd875d0dea3e433e /searxng_extra/update/update_wikidata_units.py | |
parent | 9004e84b6e33c0a64fc6f4413734c9bdfdb118f6 (diff) | |
parent | 295876abaa93b8dea44dc0beaf8eb2596da69aed (diff) | |
download | searxng-160f3e022e1774f3a25a9f5e0cf36ec34976cdad.tar.gz searxng-160f3e022e1774f3a25a9f5e0cf36ec34976cdad.zip |
Merge pull request #683 from return42/fix-doc
Document & Pylint scripts in searxng_extra/update
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) |