If a docstring node is found in the body of the *node* parameter, return that docstring node, None otherwise. Logic mirrored from ``_PyAST_GetDocString``.
(self, node)
| 156 | self._precedences[node] = precedence |
| 157 | |
| 158 | def get_raw_docstring(self, node): |
| 159 | """If a docstring node is found in the body of the *node* parameter, |
| 160 | return that docstring node, None otherwise. |
| 161 | |
| 162 | Logic mirrored from ``_PyAST_GetDocString``.""" |
| 163 | if not isinstance( |
| 164 | node, (AsyncFunctionDef, FunctionDef, ClassDef, Module) |
| 165 | ) or len(node.body) < 1: |
| 166 | return None |
| 167 | node = node.body[0] |
| 168 | if not isinstance(node, Expr): |
| 169 | return None |
| 170 | node = node.value |
| 171 | if isinstance(node, Constant) and isinstance(node.value, str): |
| 172 | return node |
| 173 | |
| 174 | def get_type_comment(self, node): |
| 175 | comment = self._type_ignores.get(node.lineno) or node.type_comment |
no outgoing calls
no test coverage detected