Skip to content
Myr

remove _compat.get_strerror

Before adoption: this commit came in with the history the project adopted, so no landing records it.

authored by David Lord · committed by David Lord · parent 0103c95 · Browse files · 3 files+2 added−15 removed
This commit

State

Before adoption: this commit came in with the history the project adopted, so no landing records it.

Diff stats

3 files+2 added−15 removed

  • other:+2 added−15 removed

3 files+2 added−15 removed

modified:src/click/_compat.py-11 removed
364 unmodified lines
365 return rv366 return _force_correct_text_writer(sys.stderr, encoding, errors, force_writable=True)367368369def get_strerror(e: OSError, default: t.Optional[str] = None) -> str:370 if hasattr(e, "strerror"):371 msg = e.strerror372 else:373 if default is not None:374 msg = default375 else:376 msg = str(e)377 return msg378379369def _wrap_io_open(370 file: t.Union[str, os.PathLike, int],371 mode: str,372 encoding: t.Optional[str],
256 unmodified lines
modified:src/click/types.py+1 added-2 removed
5 unmodified lines
6from gettext import ngettext78from ._compat import _get_argv_encoding9from ._compat import get_filesystem_encoding10from ._compat import get_strerror10from ._compat import open_stream11from .exceptions import BadParameter12from .utils import LazyFile13from .utils import safecall
709 unmodified lines
723 ctx.call_on_close(safecall(f.flush))724725 return f726 except OSError as e: # noqa: B014728 self.fail(f"{os.fsdecode(value)!r}: {get_strerror(e)}", param, ctx)727 self.fail(f"{os.fsdecode(value)!r}: {e.strerror}", param, ctx)728729 def shell_complete(730 self, ctx: "Context", param: "Parameter", incomplete: str731 ) -> t.List["CompletionItem"]:
324 unmodified lines
modified:src/click/utils.py+1 added-2 removed
8 unmodified lines
9from ._compat import _find_binary_writer10from ._compat import auto_wrap_for_ansi11from ._compat import binary_streams12from ._compat import get_filesystem_encoding13from ._compat import get_strerror13from ._compat import open_stream14from ._compat import should_strip_ansi15from ._compat import strip_ansi16from ._compat import text_streams
136 unmodified lines
153 )154 except OSError as e: # noqa: E402155 from .exceptions import FileError156158 raise FileError(self.name, hint=get_strerror(e))157 raise FileError(self.name, hint=e.strerror)158 self._f = rv159 return rv160161 def close(self) -> None:
418 unmodified lines