From fde47b4b4f978f179b9dff34583cb2b99021f482 Mon Sep 17 00:00:00 2001 From: Andreas Backx Date: Sat, 9 Nov 2024 17:06:13 +0000 Subject: [PATCH] Fix issues previously type ignored. --- src/click/_compat.py | 2 +- src/click/_termui_impl.py | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/src/click/_compat.py b/src/click/_compat.py index 9e14ace5f..feb836628 100644 --- a/src/click/_compat.py +++ b/src/click/_compat.py @@ -129,7 +129,7 @@ def writable(self) -> bool: if x is not None: return t.cast(bool, x()) try: - self._stream.write("") # type: ignore + self._stream.write(b"") except Exception: try: self._stream.write(b"") diff --git a/src/click/_termui_impl.py b/src/click/_termui_impl.py index 24dec542e..a6c7e6b36 100644 --- a/src/click/_termui_impl.py +++ b/src/click/_termui_impl.py @@ -251,9 +251,9 @@ def render_progress(self) -> None: self.width = 0 clutter_length = term_len(self.format_progress_line()) new_width = max(0, shutil.get_terminal_size().columns - clutter_length) - if new_width < old_width: + if new_width < old_width and self.max_width is not None: buf.append(BEFORE_BAR) - buf.append(" " * self.max_width) # type: ignore + buf.append(" " * self.max_width) self.max_width = new_width self.width = new_width