MCPcopy Index your code
hub / github.com/python/cpython / tempfile_pager

Function tempfile_pager

Lib/_pyrepl/pager.py:165–175  ·  view source on GitHub ↗

Page through text by invoking a program on a temporary file.

(text: str, cmd: str, title: str = '')

Source from the content-addressed store, hash-verified

163
164
165def tempfile_pager(text: str, cmd: str, title: str = '') -> None:
166 """Page through text by invoking a program on a temporary file."""
167 import tempfile
168 with tempfile.TemporaryDirectory() as tempdir:
169 filename = os.path.join(tempdir, 'pydoc.out')
170 with open(filename, 'w', errors='backslashreplace',
171 encoding=os.device_encoding(0) if
172 sys.platform == 'win32' else None
173 ) as file:
174 file.write(text)
175 os.system(cmd + ' "' + filename + '"')

Callers 1

get_pagerFunction · 0.85

Calls 3

openFunction · 0.50
joinMethod · 0.45
writeMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…