Removes any docstring in place. Args: node: The node to remove the docstring from. Returns: The modified node.
(
node: ast.Module | ast.ClassDef | ast.FunctionDef,
)
| 399 | |
| 400 | @staticmethod |
| 401 | def _remove_docstring( |
| 402 | node: ast.Module | ast.ClassDef | ast.FunctionDef, |
| 403 | ) -> ast.Module | ast.ClassDef | ast.FunctionDef: |
| 404 | """Removes any docstring in place. |
| 405 | |
| 406 | Args: |
| 407 | node: The node to remove the docstring from. |
| 408 | |
| 409 | Returns: |
| 410 | The modified node. |
| 411 | """ |
| 412 | if ( |
| 413 | node.body |
| 414 | and isinstance(node.body[0], ast.Expr) |
| 415 | and isinstance(node.body[0].value, ast.Constant) |
| 416 | ): |
| 417 | node.body.pop(0) |
| 418 | return node |
| 419 | |
| 420 | def visit_Module(self, node: ast.Module) -> ast.Module: |
| 421 | """Visit a Module node and remove docstring from body. |
no test coverage detected