From 8191e1a25390a8e912bf02b4e34ebe524412643c Mon Sep 17 00:00:00 2001 From: Markus Heiser Date: Sat, 1 Jan 2022 18:32:21 +0100 Subject: [PATCH] [fix] update_languages.py: generate code that passes CI File searx/languages.py, created by update_languages.py has to pass quality check from CI:: make format.python Signed-off-by: Markus Heiser --- searxng_extra/update/update_languages.py | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/searxng_extra/update/update_languages.py b/searxng_extra/update/update_languages.py index 3a172d5dc..f37345808 100755 --- a/searxng_extra/update/update_languages.py +++ b/searxng_extra/update/update_languages.py @@ -189,7 +189,7 @@ def write_languages_file(languages): "# -*- coding: utf-8 -*-", "# list of language codes", "# this file is generated automatically by utils/fetch_languages.py", - "language_codes =", + "language_codes = (\n", ) language_codes = [] @@ -212,8 +212,11 @@ def write_languages_file(languages): language_codes = tuple(language_codes) with open(languages_file, 'w') as new_file: - file_content = "{file_headers} \\\n{language_codes}".format( - file_headers='\n'.join(file_headers), language_codes=pformat(language_codes, indent=4) + file_content = "{file_headers} {language_codes},\n)\n".format( + # fmt: off + file_headers = '\n'.join(file_headers), + language_codes = pformat(language_codes, indent=4)[1:-1] + # fmt: on ) new_file.write(file_content) new_file.close()