Check if attribute is IPython magic. Note that the source of the abstract syntax tree will already have been processed by IPython's TransformerManager().transform_cell.
(node: ast.expr)
| 340 | |
| 341 | |
| 342 | def _is_ipython_magic(node: ast.expr) -> TypeGuard[ast.Attribute]: |
| 343 | """Check if attribute is IPython magic. |
| 344 | |
| 345 | Note that the source of the abstract syntax tree |
| 346 | will already have been processed by IPython's |
| 347 | TransformerManager().transform_cell. |
| 348 | """ |
| 349 | return ( |
| 350 | isinstance(node, ast.Attribute) |
| 351 | and isinstance(node.value, ast.Call) |
| 352 | and isinstance(node.value.func, ast.Name) |
| 353 | and node.value.func.id == "get_ipython" |
| 354 | ) |
| 355 | |
| 356 | |
| 357 | def _get_str_args(args: list[ast.expr]) -> list[str]: |
no outgoing calls
no test coverage detected