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

Function _make_text_stream

src/click/_compat.py:19–37  ·  view source on GitHub ↗
(
    stream: t.BinaryIO,
    encoding: str | None,
    errors: str | None,
    force_readable: bool = False,
    force_writable: bool = False,
)

Source from the content-addressed store, hash-verified

17
18
19def _make_text_stream(
20 stream: t.BinaryIO,
21 encoding: str | None,
22 errors: str | None,
23 force_readable: bool = False,
24 force_writable: bool = False,
25) -> t.TextIO:
26 if encoding is None:
27 encoding = get_best_encoding(stream)
28 if errors is None:
29 errors = "replace"
30 return _NonClosingTextIOWrapper(
31 stream,
32 encoding,
33 errors,
34 line_buffering=True,
35 force_readable=force_readable,
36 force_writable=force_writable,
37 )
38
39
40def is_ascii_encoding(encoding: str) -> bool:

Callers 1

Calls 2

get_best_encodingFunction · 0.85

Tested by

no test coverage detected