From a46f71bb703dd8ada77e5eaf2a0b05d741d39bbf Mon Sep 17 00:00:00 2001 From: josibake Date: Tue, 24 Aug 2021 18:05:43 +0200 Subject: [PATCH] lint: enable mypy checking for missing imports MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Achieve this by adding some ignore, and making data/ importable. Co-authored-by: João Barbosa --- contrib/devtools/security-check.py | 2 +- contrib/devtools/symbol-check.py | 2 +- test/functional/combine_logs.py | 2 +- test/functional/data/__init__.py | 0 test/functional/test_runner.py | 2 +- test/lint/lint-python.sh | 2 +- 6 files changed, 5 insertions(+), 5 deletions(-) create mode 100644 test/functional/data/__init__.py diff --git a/contrib/devtools/security-check.py b/contrib/devtools/security-check.py index c374de4b55a..ef421aebb10 100755 --- a/contrib/devtools/security-check.py +++ b/contrib/devtools/security-check.py @@ -10,7 +10,7 @@ Otherwise the exit status will be 1 and it will log which executables failed whi import sys from typing import List -import lief +import lief #type:ignore def check_ELF_RELRO(binary) -> bool: ''' diff --git a/contrib/devtools/symbol-check.py b/contrib/devtools/symbol-check.py index 158b6fa0ffc..136a9b70c1e 100755 --- a/contrib/devtools/symbol-check.py +++ b/contrib/devtools/symbol-check.py @@ -13,7 +13,7 @@ Example usage: import sys from typing import List, Dict -import lief +import lief #type:ignore # temporary constant, to be replaced with lief.ELF.ARCH.RISCV # https://github.com/lief-project/LIEF/pull/562 diff --git a/test/functional/combine_logs.py b/test/functional/combine_logs.py index 00f2833f55b..71dfb4c01ab 100755 --- a/test/functional/combine_logs.py +++ b/test/functional/combine_logs.py @@ -188,7 +188,7 @@ def print_logs_plain(log_events, colors): def print_logs_html(log_events): """Renders the iterator of log events into html.""" try: - import jinja2 + import jinja2 #type:ignore except ImportError: print("jinja2 not found. Try `pip install jinja2`") sys.exit(1) diff --git a/test/functional/data/__init__.py b/test/functional/data/__init__.py new file mode 100644 index 00000000000..e69de29bb2d diff --git a/test/functional/test_runner.py b/test/functional/test_runner.py index c5f08b27f25..d6f61bfbffe 100755 --- a/test/functional/test_runner.py +++ b/test/functional/test_runner.py @@ -40,7 +40,7 @@ except UnicodeDecodeError: CROSS = "x " CIRCLE = "o " -if os.name != 'nt' or sys.getwindowsversion() >= (10, 0, 14393): +if os.name != 'nt' or sys.getwindowsversion() >= (10, 0, 14393): #type:ignore if os.name == 'nt': import ctypes kernel32 = ctypes.windll.kernel32 # type: ignore diff --git a/test/lint/lint-python.sh b/test/lint/lint-python.sh index c448fa6f9a6..3d22407fd16 100755 --- a/test/lint/lint-python.sh +++ b/test/lint/lint-python.sh @@ -102,7 +102,7 @@ if ! PYTHONWARNINGS="ignore" flake8 --ignore=B,C,E,F,I,N,W --select=$(IFS=","; e EXIT_CODE=1 fi -if ! mypy --ignore-missing-imports --show-error-codes $(git ls-files "test/functional/*.py" "contrib/devtools/*.py"); then +if ! mypy --show-error-codes $(git ls-files "test/functional/*.py" "contrib/devtools/*.py"); then EXIT_CODE=1 fi