Print a string, piping through a pager. This version ignores the screen_lines and pager_cmd arguments and uses IPython's payload system instead. Parameters ---------- strng : str or mime-dict Text to page, or a mime-type keyed dict of already formatted data. start :
(strng, start=0, screen_lines=0, pager_cmd=None)
| 9 | |
| 10 | |
| 11 | def page(strng, start=0, screen_lines=0, pager_cmd=None): |
| 12 | """Print a string, piping through a pager. |
| 13 | |
| 14 | This version ignores the screen_lines and pager_cmd arguments and uses |
| 15 | IPython's payload system instead. |
| 16 | |
| 17 | Parameters |
| 18 | ---------- |
| 19 | strng : str or mime-dict |
| 20 | Text to page, or a mime-type keyed dict of already formatted data. |
| 21 | |
| 22 | start : int |
| 23 | Starting line at which to place the display. |
| 24 | """ |
| 25 | |
| 26 | # Some routines may auto-compute start offsets incorrectly and pass a |
| 27 | # negative value. Offset to 0 for robustness. |
| 28 | start = max(0, start) |
| 29 | shell = get_ipython() |
| 30 | |
| 31 | if isinstance(strng, dict): |
| 32 | data = strng |
| 33 | else: |
| 34 | data = {'text/plain' : strng} |
| 35 | payload = dict( |
| 36 | source='page', |
| 37 | data=data, |
| 38 | start=start, |
| 39 | ) |
| 40 | shell.payload_manager.write_payload(payload) |
| 41 | |
| 42 | |
| 43 | def install_payload_page(): |
nothing calls this directly
no test coverage detected