[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>
This commit is contained in:
Markus Heiser 2024-03-10 15:33:23 +01:00 committed by Markus Heiser
parent 0ffec440b2
commit ce4aaf6cad
10 changed files with 51 additions and 61 deletions

View file

@ -144,9 +144,9 @@ def write_languages_file(sxng_tag_list):
item = (
sxng_tag,
sxng_locale.get_language_name().title(),
sxng_locale.get_language_name().title(), # type: ignore
sxng_locale.get_territory_name() or '',
sxng_locale.english_name.split(' (')[0],
sxng_locale.english_name.split(' (')[0] if sxng_locale.english_name else '',
UnicodeEscape(flag),
)
@ -154,7 +154,7 @@ def write_languages_file(sxng_tag_list):
language_codes = tuple(language_codes)
with open(languages_file, 'w', encoding='utf-8') as new_file:
with languages_file.open('w', encoding='utf-8') as new_file:
file_content = "{header} {language_codes}{footer}".format(
header=languages_file_header,
language_codes=pformat(language_codes, width=120, indent=4)[1:-1],