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_locales.py | |
| parent | 0ffec440b2d1146d4daf3f63a544aeb635a6e617 (diff) | |
[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_locales.py')
| -rwxr-xr-x | searxng_extra/update/update_locales.py | 14 |
1 files changed, 7 insertions, 7 deletions
diff --git a/searxng_extra/update/update_locales.py b/searxng_extra/update/update_locales.py index d97a5dd88..4b8f6222c 100755 --- a/searxng_extra/update/update_locales.py +++ b/searxng_extra/update/update_locales.py @@ -1,4 +1,5 @@ #!/usr/bin/env python +# lint: pylint # SPDX-License-Identifier: AGPL-3.0-or-later """Update locale names in :origin:`searx/data/locales.json` used by :ref:`searx.locales` @@ -6,12 +7,12 @@ - :py:obj:`searx.locales.RTL_LOCALES` - :py:obj:`searx.locales.LOCALE_NAMES` """ +# pylint: disable=invalid-name from __future__ import annotations from typing import Set import json from pathlib import Path -import os import babel import babel.languages @@ -61,7 +62,7 @@ def main(): "RTL_LOCALES": sorted(RTL_LOCALES), } - with open(LOCALE_DATA_FILE, 'w', encoding='utf-8') as f: + with LOCALE_DATA_FILE.open('w', encoding='utf-8') as f: json.dump(content, f, indent=2, sort_keys=True, ensure_ascii=False) @@ -84,11 +85,10 @@ def get_locale_descr(locale: babel.Locale, tr_locale): return native_language return native_language + ' (' + english_language + ')' - else: - result = native_language + ', ' + native_territory + ' (' + english_language - if english_territory: - return result + ', ' + english_territory + ')' - return result + ')' + result = native_language + ', ' + native_territory + ' (' + english_language + if english_territory: + return result + ', ' + english_territory + ')' + return result + ')' def _get_locale_descr(locale: babel.Locale, tr_locale: str) -> tuple[str, str]: |