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

Function page

IPython/core/payloadpage.py:11–40  ·  view source on GitHub ↗

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)

Source from the content-addressed store, hash-verified

9
10
11def 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
43def install_payload_page():

Callers

nothing calls this directly

Calls 2

get_ipythonFunction · 0.90
write_payloadMethod · 0.80

Tested by

no test coverage detected