From c5bd2f9dce17f3e6bf7d9681243e2743633db6f0 Mon Sep 17 00:00:00 2001 From: Jiri Suchan Date: Tue, 23 Aug 2022 22:21:46 +0900 Subject: ci: add Python static analysis check via mypy --- editor/editor_builders.py | 5 +---- editor/translations/extract.py | 7 ++++--- 2 files changed, 5 insertions(+), 7 deletions(-) (limited to 'editor') diff --git a/editor/editor_builders.py b/editor/editor_builders.py index e73fbc6107..696e3b64ec 100644 --- a/editor/editor_builders.py +++ b/editor/editor_builders.py @@ -9,6 +9,7 @@ import shutil import subprocess import tempfile import uuid +import zlib from platform_methods import subprocess_main @@ -28,7 +29,6 @@ def make_doc_header(target, source, env): buf = (docbegin + buf + docend).encode("utf-8") decomp_size = len(buf) - import zlib # Use maximum zlib compression level to further reduce file size # (at the cost of initial build times). @@ -88,9 +88,6 @@ def make_translations_header(target, source, env, category): g.write("#ifndef _{}_TRANSLATIONS_H\n".format(category.upper())) g.write("#define _{}_TRANSLATIONS_H\n".format(category.upper())) - import zlib - import os.path - sorted_paths = sorted(source, key=lambda path: os.path.splitext(os.path.basename(path))[0]) msgfmt_available = shutil.which("msgfmt") is not None diff --git a/editor/translations/extract.py b/editor/translations/extract.py index 07026baee2..cecdb3939d 100755 --- a/editor/translations/extract.py +++ b/editor/translations/extract.py @@ -8,6 +8,7 @@ import re import shutil import subprocess import sys +from typing import Dict, Tuple class Message: @@ -42,7 +43,7 @@ class Message: return "\n".join(lines) -messages_map = {} # (id, context) -> Message. +messages_map: Dict[Tuple[str, str], Message] = {} # (id, context) -> Message. line_nb = False @@ -51,11 +52,11 @@ for arg in sys.argv[1:]: print("Enabling line numbers in the context locations.") line_nb = True else: - os.sys.exit("Non supported argument '" + arg + "'. Aborting.") + sys.exit("Non supported argument '" + arg + "'. Aborting.") if not os.path.exists("editor"): - os.sys.exit("ERROR: This script should be started from the root of the git repo.") + sys.exit("ERROR: This script should be started from the root of the git repo.") matches = [] -- cgit v1.2.3