diff options
author | Daniƫl van Noord <13665637+DanielNoord@users.noreply.github.com> | 2022-04-14 11:07:21 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2022-04-14 11:07:21 +0200 |
commit | 47e168cf607e2069b103fc466edfe1c6522e2fb2 (patch) | |
tree | 97d7b67b673d1147f4b8c9321b6247c117195060 /pylint/extensions/docparams.py | |
parent | 99ef057978e2ddd332bdd436fd5fd884deebdc53 (diff) | |
download | pylint-git-47e168cf607e2069b103fc466edfe1c6522e2fb2.tar.gz |
Use ``python-typing-update`` on ``pylint/extensions`` directory (#6308)
Diffstat (limited to 'pylint/extensions/docparams.py')
-rw-r--r-- | pylint/extensions/docparams.py | 23 |
1 files changed, 13 insertions, 10 deletions
diff --git a/pylint/extensions/docparams.py b/pylint/extensions/docparams.py index 2a9fa13f4..88f17253b 100644 --- a/pylint/extensions/docparams.py +++ b/pylint/extensions/docparams.py @@ -3,8 +3,11 @@ # Copyright (c) https://github.com/PyCQA/pylint/blob/main/CONTRIBUTORS.txt """Pylint plugin for checking in Sphinx, Google, or Numpy style docstrings.""" + +from __future__ import annotations + import re -from typing import TYPE_CHECKING, Optional, Set +from typing import TYPE_CHECKING import astroid from astroid import nodes @@ -366,10 +369,10 @@ class DocstringParameterChecker(BaseChecker): def _compare_missing_args( self, - found_argument_names: Set[str], + found_argument_names: set[str], message_id: str, - not_needed_names: Set[str], - expected_argument_names: Set[str], + not_needed_names: set[str], + expected_argument_names: set[str], warning_node: nodes.NodeNG, ) -> None: """Compare the found argument names with the expected ones and @@ -405,10 +408,10 @@ class DocstringParameterChecker(BaseChecker): def _compare_different_args( self, - found_argument_names: Set[str], + found_argument_names: set[str], message_id: str, - not_needed_names: Set[str], - expected_argument_names: Set[str], + not_needed_names: set[str], + expected_argument_names: set[str], warning_node: nodes.NodeNG, ) -> None: """Compare the found argument names with the expected ones and @@ -425,7 +428,7 @@ class DocstringParameterChecker(BaseChecker): :param warning_node: The node to be analyzed """ # Handle variadic and keyword args without asterisks - modified_expected_argument_names: Set[str] = set() + modified_expected_argument_names: set[str] = set() for name in expected_argument_names: if name.replace("*", "") in found_argument_names: modified_expected_argument_names.add(name.replace("*", "")) @@ -481,7 +484,7 @@ class DocstringParameterChecker(BaseChecker): doc: Docstring, arguments_node: astroid.Arguments, warning_node: astroid.NodeNG, - accept_no_param_doc: Optional[bool] = None, + accept_no_param_doc: bool | None = None, ): """Check that all parameters are consistent with the parameters mentioned in the parameter documentation (e.g. the Sphinx tags 'param' and 'type'). @@ -652,5 +655,5 @@ class DocstringParameterChecker(BaseChecker): ) -def register(linter: "PyLinter") -> None: +def register(linter: PyLinter) -> None: linter.register_checker(DocstringParameterChecker(linter)) |