From 3c9d844cbe7b5fa793e1e6ef8d0b45e71d215ddd Mon Sep 17 00:00:00 2001 From: Frantisek Hrbata Date: Mon, 17 Aug 2026 16:56:14 +0200 Subject: [PATCH] style(ci): satisfy ruff on check_type_comments.py The previous commit touches tools/ci/check_type_comments.py, which brings the file into ruff's scope for the first time in a while and surfaces two pre-existing findings: A004 Import `exit` is shadowing a Python builtin F401 `typing.List` imported but unused Import sys and call sys.exit() rather than shadowing the builtin, which is also how master writes this file. List is used, but only inside `# type:` comments that ruff cannot see, so mark the import instead of dropping it: check_type_comments.py is not on tools/ci/mypy_ignore_list.txt, so mypy checks it under disallow_untyped_defs and the name has to resolve. No behaviour change. Verified with the pinned ruff 0.9.7 (check and format --check) and with mypy 1.19.1, and both exit paths of the script still behave as before. Signed-off-by: Frantisek Hrbata --- tools/ci/check_type_comments.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/tools/ci/check_type_comments.py b/tools/ci/check_type_comments.py index e6f2e8ca679..cc15b8f6feb 100755 --- a/tools/ci/check_type_comments.py +++ b/tools/ci/check_type_comments.py @@ -4,10 +4,10 @@ # SPDX-License-Identifier: Apache-2.0 import argparse import subprocess -from sys import exit +import sys try: - from typing import List + from typing import List # noqa: F401 except ImportError: # Only used for type annotations pass @@ -84,7 +84,7 @@ def main(): # type: () -> None print('mypy check failed for:') for file_name in type_issues: print('\t', file_name) - exit(1) + sys.exit(1) if __name__ == '__main__':