summaryrefslogtreecommitdiff
path: root/editor
diff options
context:
space:
mode:
authorJiri Suchan <yed@vanyli.net>2022-08-23 22:21:46 +0900
committerJiri Suchan <yed@vanyli.net>2022-09-30 19:03:17 +0700
commitc5bd2f9dce17f3e6bf7d9681243e2743633db6f0 (patch)
tree5cc835252cc999d086deaf05f3821ef3ce9e37e8 /editor
parentf47979f0874b2ca6134e71575fbb359c6cc5ced0 (diff)
ci: add Python static analysis check via mypy
Diffstat (limited to 'editor')
-rw-r--r--editor/editor_builders.py5
-rwxr-xr-xeditor/translations/extract.py7
2 files changed, 5 insertions, 7 deletions
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 = []