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

Function _wrap_io_open

src/click/_compat.py:358–368  ·  view source on GitHub ↗

Handles not passing ``encoding`` and ``errors`` in binary mode.

(
    file: str | os.PathLike[str] | int,
    mode: str,
    encoding: str | None,
    errors: str | None,
)

Source from the content-addressed store, hash-verified

356
357
358def _wrap_io_open(
359 file: str | os.PathLike[str] | int,
360 mode: str,
361 encoding: str | None,
362 errors: str | None,
363) -> t.IO[t.Any]:
364 """Handles not passing ``encoding`` and ``errors`` in binary mode."""
365 if "b" in mode:
366 return open(file, mode)
367
368 return open(file, mode, encoding=encoding, errors=errors)
369
370
371def open_stream(

Callers 1

open_streamFunction · 0.85

Calls 1

openFunction · 0.85

Tested by

no test coverage detected