MCPcopy Create free account
hub / github.com/RT-Thread/env-windows / tempfilepager

Function tempfilepager

tools/python-3.11.9-amd64/Lib/pydoc.py:1705–1715  ·  view source on GitHub ↗

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

(text, cmd)

Source from the content-addressed store, hash-verified

1703 pass
1704
1705def tempfilepager(text, cmd):
1706 """Page through text by invoking a program on a temporary file."""
1707 import tempfile
1708 with tempfile.TemporaryDirectory() as tempdir:
1709 filename = os.path.join(tempdir, 'pydoc.out')
1710 with open(filename, 'w', errors='backslashreplace',
1711 encoding=os.device_encoding(0) if
1712 sys.platform == 'win32' else None
1713 ) as file:
1714 file.write(text)
1715 os.system(cmd + ' "' + filename + '"')
1716
1717def _escape_stdout(text):
1718 # Escape non-encodable characters to avoid encoding errors later

Callers 1

getpagerFunction · 0.85

Calls 4

systemMethod · 0.80
openFunction · 0.70
joinMethod · 0.45
writeMethod · 0.45

Tested by

no test coverage detected