summaryrefslogtreecommitdiff
path: root/editor
diff options
context:
space:
mode:
authorRémi Verschelde <rverschelde@gmail.com>2022-09-30 17:44:39 +0200
committerRémi Verschelde <rverschelde@gmail.com>2022-09-30 17:44:39 +0200
commitef8834a6420e9e9141c48d230a0a312a3aa2597e (patch)
tree6d65a5230a794e33f5cce71979d34bcab9e8b352 /editor
parent28154b9a07d1eeb372e0757582dd913e2237da74 (diff)
parentc5bd2f9dce17f3e6bf7d9681243e2743633db6f0 (diff)
Merge pull request #64784 from yedpodtrzitko/yed/ci-add-mypy
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 = []