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

Function _is_binary_reader

src/click/_compat.py:151–157  ·  view source on GitHub ↗
(stream: t.IO[t.Any], default: bool = False)

Source from the content-addressed store, hash-verified

149
150
151def _is_binary_reader(stream: t.IO[t.Any], default: bool = False) -> bool:
152 try:
153 return isinstance(stream.read(0), bytes)
154 except Exception:
155 return default
156 # This happens in some cases where the stream was already
157 # closed. In this case, we assume the default.
158
159
160def _is_binary_writer(stream: t.IO[t.Any], default: bool = False) -> bool:

Callers 1

_find_binary_readerFunction · 0.85

Calls 1

readMethod · 0.80

Tested by

no test coverage detected