From 63db9afc76a2b1d1cc0600db76de8e6abc225bd9 Mon Sep 17 00:00:00 2001 From: Andreas Backx Date: Sat, 9 Nov 2024 01:25:11 +0000 Subject: [PATCH] Added _compat typing. --- src/click/_compat.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/click/_compat.py b/src/click/_compat.py index 9e14ace5f..6ef508c96 100644 --- a/src/click/_compat.py +++ b/src/click/_compat.py @@ -538,14 +538,14 @@ def auto_wrap_for_ansi(stream: t.TextIO, color: bool | None = None) -> t.TextIO: rv = t.cast(t.TextIO, ansi_wrapper.stream) _write = rv.write - def _safe_write(s): + def _safe_write(s: str) -> int: try: return _write(s) except BaseException: ansi_wrapper.reset_all() raise - rv.write = _safe_write + rv.write = _safe_write # type: ignore[method-assign] try: _ansi_stream_wrappers[stream] = rv