MCPcopy
hub / github.com/pallets/click / _nullpager

Function _nullpager

src/click/_termui_impl.py:637–653  ·  view source on GitHub ↗

Simply print unformatted text. This is the ultimate fallback. Don't close the output stream in this case, since it's coming from elsewhere rather than our internal helpers. The stream is wrapped in :class:`~click.utils.KeepOpenFile` so that, as a borrowed stream, it is not closed by

(
    stream: t.TextIO, color: bool | None = None
)

Source from the content-addressed store, hash-verified

635
636@contextlib.contextmanager
637def _nullpager(
638 stream: t.TextIO, color: bool | None = None
639) -> t.Iterator[tuple[t.TextIO, str, bool]]:
640 """Simply print unformatted text. This is the ultimate fallback. Don't close the
641 output stream in this case, since it's coming from elsewhere rather than our
642 internal helpers.
643
644 The stream is wrapped in :class:`~click.utils.KeepOpenFile` so that, as a
645 borrowed stream, it is not closed by a ``with`` block. The wrapper that
646 :func:`get_pager_file` builds around it is detached rather than closed.
647 """
648 encoding = get_best_encoding(stream)
649
650 if color is None:
651 color = False
652
653 yield KeepOpenFile(stream), encoding, color # type: ignore[misc]
654
655
656class Editor:

Callers 3

_pager_contextmanagerFunction · 0.85
_pipepagerFunction · 0.85
_tempfilepagerFunction · 0.85

Calls 2

get_best_encodingFunction · 0.85
KeepOpenFileClass · 0.85

Tested by

no test coverage detected