run the cell, capturing stdout, stderr, and IPython's rich display() calls.
(self, line, cell)
| 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() |
nothing calls this directly
no test coverage detected