diff options
-rw-r--r-- | .pre-commit-config.yaml | 2 | ||||
-rw-r--r-- | pylint/__init__.py | 2 | ||||
-rw-r--r-- | pylint/checkers/__init__.py | 2 | ||||
-rw-r--r-- | pylint/checkers/similar.py | 2 | ||||
-rw-r--r-- | pylint/checkers/utils.py | 2 | ||||
-rw-r--r-- | pylint/config/argument.py | 4 | ||||
-rw-r--r-- | pylint/config/option.py | 2 | ||||
-rw-r--r-- | pylint/lint/pylinter.py | 2 | ||||
-rw-r--r-- | pylint/pyreverse/main.py | 3 | ||||
-rw-r--r-- | pylint/testutils/_primer/primer_run_command.py | 2 | ||||
-rw-r--r-- | pylint/typing.py | 3 | ||||
-rw-r--r-- | pylint/utils/ast_walker.py | 2 | ||||
-rw-r--r-- | requirements_test_pre_commit.txt | 2 | ||||
-rw-r--r-- | tests/conftest.py | 2 | ||||
-rw-r--r-- | tests/primer/test_primer_stdlib.py | 2 | ||||
-rw-r--r-- | tests/pyreverse/test_main.py | 4 | ||||
-rw-r--r-- | tests/test_self.py | 2 |
17 files changed, 19 insertions, 21 deletions
diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index f8b43cee1..c66d9ed81 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -101,7 +101,7 @@ repos: files: ^(doc/(.*/)*.*\.rst) additional_dependencies: [Sphinx==5.0.1] - repo: https://github.com/pre-commit/mirrors-mypy - rev: v0.982 + rev: v0.990 hooks: - id: mypy name: mypy diff --git a/pylint/__init__.py b/pylint/__init__.py index 8f1eaebe0..ab5fd42ab 100644 --- a/pylint/__init__.py +++ b/pylint/__init__.py @@ -57,7 +57,7 @@ def run_epylint(argv: Sequence[str] | None = None) -> NoReturn: EpylintRun(argv) -def run_pyreverse(argv: Sequence[str] | None = None) -> NoReturn: # type: ignore[misc] +def run_pyreverse(argv: Sequence[str] | None = None) -> NoReturn: """Run pyreverse. argv can be a sequence of strings normally supplied as arguments on the command line diff --git a/pylint/checkers/__init__.py b/pylint/checkers/__init__.py index 7e39c6877..ed641d8e5 100644 --- a/pylint/checkers/__init__.py +++ b/pylint/checkers/__init__.py @@ -127,7 +127,7 @@ def table_lines_from_stats( ) new_str = f"{new_value:.3f}" if isinstance(new_value, float) else str(new_value) old_str = f"{old_value:.3f}" if isinstance(old_value, float) else str(old_value) - lines.extend((value[0].replace("_", " "), new_str, old_str, diff_str)) + lines.extend((value[0].replace("_", " "), new_str, old_str, diff_str)) # type: ignore[arg-type] return lines diff --git a/pylint/checkers/similar.py b/pylint/checkers/similar.py index 32d2394f8..3b18ddbfd 100644 --- a/pylint/checkers/similar.py +++ b/pylint/checkers/similar.py @@ -382,7 +382,7 @@ class Similar: self.namespace.ignore_docstrings, self.namespace.ignore_imports, self.namespace.ignore_signatures, - line_enabled_callback=self.linter._is_one_message_enabled # type: ignore[attr-defined] + line_enabled_callback=self.linter._is_one_message_enabled if hasattr(self, "linter") else None, ) diff --git a/pylint/checkers/utils.py b/pylint/checkers/utils.py index 0e99b558a..b1b4c863b 100644 --- a/pylint/checkers/utils.py +++ b/pylint/checkers/utils.py @@ -287,7 +287,7 @@ def is_builtin_object(node: nodes.NodeNG) -> bool: def is_builtin(name: str) -> bool: """Return true if <name> could be considered as a builtin defined by python.""" - return name in builtins or name in SPECIAL_BUILTINS # type: ignore[attr-defined] + return name in builtins or name in SPECIAL_BUILTINS # type: ignore[operator] def is_defined_in_scope( diff --git a/pylint/config/argument.py b/pylint/config/argument.py index 6c4d10041..7a03d82b2 100644 --- a/pylint/config/argument.py +++ b/pylint/config/argument.py @@ -365,9 +365,9 @@ class _ExtendArgument(_DeprecationArgument): ) -> None: # The extend action is included in the stdlib from 3.8+ if PY38_PLUS: - action_class = argparse._ExtendAction # type: ignore[attr-defined] + action_class = argparse._ExtendAction else: - action_class = _ExtendAction + action_class = _ExtendAction # type: ignore[assignment] self.dest = dest """The destination of the argument.""" diff --git a/pylint/config/option.py b/pylint/config/option.py index 00e93fbc3..95248d6b1 100644 --- a/pylint/config/option.py +++ b/pylint/config/option.py @@ -193,7 +193,7 @@ class Option(optparse.Option): stacklevel=2, ) super().__init__(*opts, **attrs) - if hasattr(self, "hide") and self.hide: # type: ignore[attr-defined] + if hasattr(self, "hide") and self.hide: self.help = optparse.SUPPRESS_HELP def _check_choice(self) -> None: diff --git a/pylint/lint/pylinter.py b/pylint/lint/pylinter.py index 9965607d4..ac8dee3bc 100644 --- a/pylint/lint/pylinter.py +++ b/pylint/lint/pylinter.py @@ -403,7 +403,7 @@ class PyLinter( "bad-plugin-value", args=(modname, module_or_error), line=0 ) elif hasattr(module_or_error, "load_configuration"): - module_or_error.load_configuration(self) # type: ignore[union-attr] + module_or_error.load_configuration(self) # We re-set all the dictionary values to True here to make sure the dict # is pickle-able. This is only a problem in multiprocessing/parallel mode. diff --git a/pylint/pyreverse/main.py b/pylint/pyreverse/main.py index 010ce47e9..72429b41a 100644 --- a/pylint/pyreverse/main.py +++ b/pylint/pyreverse/main.py @@ -210,8 +210,7 @@ class Run(_ArgumentsManager, _ArgumentsProvider): options = OPTIONS name = "pyreverse" - # For mypy issue, see https://github.com/python/mypy/issues/10342 - def __init__(self, args: Sequence[str]) -> NoReturn: # type: ignore[misc] + def __init__(self, args: Sequence[str]) -> NoReturn: _ArgumentsManager.__init__(self, prog="pyreverse", description=__doc__) _ArgumentsProvider.__init__(self, self) diff --git a/pylint/testutils/_primer/primer_run_command.py b/pylint/testutils/_primer/primer_run_command.py index d2fce7793..cd17d6b1d 100644 --- a/pylint/testutils/_primer/primer_run_command.py +++ b/pylint/testutils/_primer/primer_run_command.py @@ -85,7 +85,7 @@ class RunCommand(PrimerCommand): try: Run(arguments, reporter=reporter) except SystemExit as e: - pylint_exit_code = int(e.code) + pylint_exit_code = int(e.code) # type: ignore[arg-type] readable_messages: str = output.getvalue() messages: list[OldJsonExport] = json.loads(readable_messages) fatal_msgs: list[Message] = [] diff --git a/pylint/typing.py b/pylint/typing.py index 282d14eda..d62618605 100644 --- a/pylint/typing.py +++ b/pylint/typing.py @@ -132,8 +132,7 @@ MessageDefinitionTuple = Union[ Tuple[str, str, str], Tuple[str, str, str, ExtraMessageOptions], ] -# Mypy doesn't support recursive types (yet), see https://github.com/python/mypy/issues/731 -DirectoryNamespaceDict = Dict[Path, Tuple[argparse.Namespace, "DirectoryNamespaceDict"]] # type: ignore[misc] +DirectoryNamespaceDict = Dict[Path, Tuple[argparse.Namespace, "DirectoryNamespaceDict"]] class GetProjectCallable(Protocol): diff --git a/pylint/utils/ast_walker.py b/pylint/utils/ast_walker.py index cc387d860..4d552d995 100644 --- a/pylint/utils/ast_walker.py +++ b/pylint/utils/ast_walker.py @@ -37,7 +37,7 @@ class ASTWalker: def _is_method_enabled(self, method: AstCallback) -> bool: if not hasattr(method, "checks_msgs"): return True - return any(self.linter.is_message_enabled(m) for m in method.checks_msgs) # type: ignore[attr-defined] + return any(self.linter.is_message_enabled(m) for m in method.checks_msgs) def add_checker(self, checker: BaseChecker) -> None: """Walk to the checker's dir and collect visit and leave methods.""" diff --git a/requirements_test_pre_commit.txt b/requirements_test_pre_commit.txt index 730c96bd1..06ffa73b1 100644 --- a/requirements_test_pre_commit.txt +++ b/requirements_test_pre_commit.txt @@ -5,4 +5,4 @@ flake8==5.0.4 flake8-bugbear==22.10.27 flake8-typing-imports==1.14.0 isort==5.10.1 -mypy==0.982 +mypy==0.990 diff --git a/tests/conftest.py b/tests/conftest.py index 04fab5762..a35e5cc14 100644 --- a/tests/conftest.py +++ b/tests/conftest.py @@ -30,7 +30,7 @@ def tests_directory() -> Path: @pytest.fixture def linter( checker: type[BaseChecker] | None, - register: Callable[[PyLinter], None], + register: Callable[[PyLinter], None] | None, enable: str | None, disable: str | None, reporter: type[BaseReporter], diff --git a/tests/primer/test_primer_stdlib.py b/tests/primer/test_primer_stdlib.py index 7496e67c8..0935c2c99 100644 --- a/tests/primer/test_primer_stdlib.py +++ b/tests/primer/test_primer_stdlib.py @@ -67,4 +67,4 @@ def test_primer_stdlib_no_crash( assert not out msg = f"Encountered {{}} during primer stlib test for {test_module_name}" assert ex.code != 32, msg.format("a crash") - assert ex.code % 2 == 0, msg.format("a message of category 'fatal'") + assert ex.code % 2 == 0, msg.format("a message of category 'fatal'") # type: ignore[operator] diff --git a/tests/pyreverse/test_main.py b/tests/pyreverse/test_main.py index bb580f4d8..4cc0573d6 100644 --- a/tests/pyreverse/test_main.py +++ b/tests/pyreverse/test_main.py @@ -151,7 +151,7 @@ def test_graphviz_unsupported_image_format(capsys: CaptureFixture) -> None: @mock.patch("pylint.pyreverse.main.sys.exit", new=mock.MagicMock()) def test_command_line_arguments_defaults(arg: str, expected_default: Any) -> None: """Test that the default arguments of all options are correct.""" - run = main.Run([TEST_DATA_DIR]) + run = main.Run([TEST_DATA_DIR]) # type: ignore[var-annotated] assert getattr(run.config, arg) == expected_default @@ -178,7 +178,7 @@ def test_class_command( Make sure that we append multiple --class arguments to one option destination. """ - runner = main.Run( + runner = main.Run( # type: ignore[var-annotated] [ "--class", "data.clientmodule_test.Ancestor", diff --git a/tests/test_self.py b/tests/test_self.py index 3b0fe572c..f2e99bf75 100644 --- a/tests/test_self.py +++ b/tests/test_self.py @@ -98,7 +98,7 @@ class MultiReporter(BaseReporter): def out(self) -> TextIO: # type: ignore[override] return self._reporters[0].out - @property # type: ignore[override] + @property def linter(self) -> PyLinter: return self._linter |