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

Function page_file

IPython/core/page.py:268–285  ·  view source on GitHub ↗

Page a file, using an optional pager command and starting line.

(fname, start=0, pager_cmd=None)

Source from the content-addressed store, hash-verified

266
267
268def page_file(fname, start=0, pager_cmd=None):
269 """Page a file, using an optional pager command and starting line.
270 """
271
272 pager_cmd = get_pager_cmd(pager_cmd)
273 pager_cmd += ' ' + get_pager_start(pager_cmd,start)
274
275 try:
276 if os.environ['TERM'] in ['emacs','dumb']:
277 raise EnvironmentError
278 system(pager_cmd + ' ' + fname)
279 except:
280 try:
281 if start > 0:
282 start -= 1
283 page(open(fname, encoding="utf-8").read(), start)
284 except:
285 print('Unable to show file',repr(fname))
286
287
288def get_pager_cmd(pager_cmd=None):

Callers

nothing calls this directly

Calls 5

systemFunction · 0.90
get_pager_cmdFunction · 0.85
get_pager_startFunction · 0.85
readMethod · 0.80
pageFunction · 0.70

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…