diff options
author | Daniël van Noord <13665637+DanielNoord@users.noreply.github.com> | 2022-03-12 20:00:12 +0100 |
---|---|---|
committer | Daniël van Noord <13665637+DanielNoord@users.noreply.github.com> | 2022-03-15 09:35:54 +0100 |
commit | 849bdda236ec8024d9230ef4d300feb29b679fc6 (patch) | |
tree | 2a50afb4941a9ba3c5a2159a7637c76ca54823d0 /pylint/extensions/_check_docs_utils.py | |
parent | 12b33ee244f89e6d8880a5b4b45119d19fec9c47 (diff) | |
download | pylint-git-849bdda236ec8024d9230ef4d300feb29b679fc6.tar.gz |
Remove uses of ``NodeNG.doc`` in favour of ``doc_node``
Diffstat (limited to 'pylint/extensions/_check_docs_utils.py')
-rw-r--r-- | pylint/extensions/_check_docs_utils.py | 12 |
1 files changed, 7 insertions, 5 deletions
diff --git a/pylint/extensions/_check_docs_utils.py b/pylint/extensions/_check_docs_utils.py index 2e295ca11..ffda42cd3 100644 --- a/pylint/extensions/_check_docs_utils.py +++ b/pylint/extensions/_check_docs_utils.py @@ -25,7 +25,7 @@ """Utility methods for docstring checking.""" import re -from typing import List, Set, Tuple +from typing import List, Optional, Set, Tuple import astroid from astroid import nodes @@ -176,7 +176,9 @@ def possible_exc_types(node: nodes.NodeNG) -> Set[nodes.ClassDef]: return set() -def docstringify(docstring: str, default_type: str = "default") -> "Docstring": +def docstringify( + docstring: Optional[nodes.Const], default_type: str = "default" +) -> "Docstring": best_match = (0, DOCSTRING_TYPES.get(default_type, Docstring)(docstring)) for docstring_type in ( SphinxDocstring, @@ -208,9 +210,9 @@ class Docstring: # These methods are designed to be overridden # pylint: disable=no-self-use - def __init__(self, doc): - doc = doc or "" - self.doc = doc.expandtabs() + def __init__(self, doc: Optional[nodes.Const]) -> None: + docstring = doc.value if doc else "" + self.doc = docstring.expandtabs() def __repr__(self) -> str: return f"<{self.__class__.__name__}:'''{self.doc}'''>" |