MCPcopy Index your code
hub / github.com/ipython/ipython / capture

Method capture

IPython/core/magics/execution.py:1587–1599  ·  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

1585 )
1586 @cell_magic
1587 def capture(self, line, cell):
1588 """run the cell, capturing stdout, stderr, and IPython's rich display() calls."""
1589 args = magic_arguments.parse_argstring(self.capture, line)
1590 out = not args.no_stdout
1591 err = not args.no_stderr
1592 disp = not args.no_display
1593 with capture_output(out, err, disp) as io:
1594 self.shell.run_cell(cell)
1595 if DisplayHook.semicolon_at_end_of_expression(cell):
1596 if args.output in self.shell.user_ns:
1597 del self.shell.user_ns[args.output]
1598 elif args.output:
1599 self.shell.user_ns[args.output] = io
1600
1601 @skip_doctest
1602 @magic_arguments.magic_arguments()

Callers

nothing calls this directly

Calls 4

capture_outputClass · 0.90
parse_argstringMethod · 0.80
run_cellMethod · 0.45

Tested by

no test coverage detected