MCPcopy Create free account
hub / github.com/ipython/ipython / capture

Method capture

IPython/core/magics/execution.py:1456–1465  ·  view source on GitHub ↗

run the cell, capturing stdout, stderr, and IPython's rich display() calls.

(self, line, cell)

Source from the content-addressed store, hash-verified

1454 )
1455 @cell_magic
1456 def capture(self, line, cell):
1457 """run the cell, capturing stdout, stderr, and IPython's rich display() calls."""
1458 args = magic_arguments.parse_argstring(self.capture, line)
1459 out = not args.no_stdout
1460 err = not args.no_stderr
1461 disp = not args.no_display
1462 with capture_output(out, err, disp) as io:
1463 self.shell.run_cell(cell)
1464 if args.output:
1465 self.shell.user_ns[args.output] = io
1466
1467def parse_breakpoint(text, current_file):
1468 '''Returns (file, line) for file:line and (current_file, line) for line'''

Callers

nothing calls this directly

Calls 3

capture_outputClass · 0.90
parse_argstringMethod · 0.80
run_cellMethod · 0.45

Tested by

no test coverage detected