Method: pylint.checkers.base.docstring_checker._infer_dunder_doc_attribute
Calls: 2731, Exceptions: 2729, Paths: 3Back
Path 1: 2729 calls (1.0)
FunctionDef (1328) ClassDef (940) Module (422) AsyncFunctionDef (39)
None (2729)
KeyError (2729)
1def _infer_dunder_doc_attribute(
2 node: nodes.Module | nodes.ClassDef | nodes.FunctionDef,
3) -> str | None:
4 # Try to see if we have a `__doc__` attribute.
5 try:
6 docstring = node["__doc__"]
7 except KeyError:
8 return None
9
10 docstring = utils.safe_infer(docstring)
11 if not docstring:
12 return None
13 if not isinstance(docstring, nodes.Const):
14 return None
15 return str(docstring.value)
Path 2: 1 calls (0.0)
ClassDef (1)
None (1)
1def _infer_dunder_doc_attribute(
2 node: nodes.Module | nodes.ClassDef | nodes.FunctionDef,
3) -> str | None:
4 # Try to see if we have a `__doc__` attribute.
5 try:
6 docstring = node["__doc__"]
7 except KeyError:
8 return None
9
10 docstring = utils.safe_infer(docstring)
11 if not docstring:
12 return None
13 if not isinstance(docstring, nodes.Const):
14 return None
15 return str(docstring.value)
Path 3: 1 calls (0.0)
ClassDef (1)
'This one' (1)
1def _infer_dunder_doc_attribute(
2 node: nodes.Module | nodes.ClassDef | nodes.FunctionDef,
3) -> str | None:
4 # Try to see if we have a `__doc__` attribute.
5 try:
6 docstring = node["__doc__"]
7 except KeyError:
8 return None
9
10 docstring = utils.safe_infer(docstring)
11 if not docstring:
12 return None
13 if not isinstance(docstring, nodes.Const):
14 return None
15 return str(docstring.value)