MCPcopy
hub / github.com/psf/black / visit_Expr

Method visit_Expr

src/black/handle_ipynb_magics.py:401–410  ·  view source on GitHub ↗

Find cell magic, extract header and body.

(self, node: ast.Expr)

Source from the content-addressed store, hash-verified

399 self.cell_magic = cell_magic
400
401 def visit_Expr(self, node: ast.Expr) -> None:
402 """Find cell magic, extract header and body."""
403 if (
404 isinstance(node.value, ast.Call)
405 and _is_ipython_magic(node.value.func)
406 and node.value.func.attr == "run_cell_magic"
407 ):
408 args = _get_str_args(node.value.args)
409 self.cell_magic = CellMagic(name=args[0], params=args[1], body=args[2])
410 self.generic_visit(node)
411
412
413@dataclasses.dataclass(frozen=True)

Callers

nothing calls this directly

Calls 3

_is_ipython_magicFunction · 0.85
_get_str_argsFunction · 0.85
CellMagicClass · 0.85

Tested by

no test coverage detected