Skip to content
Myr

remove _winconsole.WindowsChunkedWriter

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 6143675 · Browse files · 2 files+0 added−26 removed
This commit

State

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

Diff stats

2 files+0 added−26 removed

  • other:+0 added−26 removed

2 files+0 added−26 removed

modified:src/click/_compat.py-1 removed
597 unmodified lines
598 if rv is not None:599 return rv600 rv = wrapper_func()601 try:602 stream = src_func() # In case wrapper_func() modified the stream602 cache[stream] = rv603 except Exception:604 pass605 return rv
22 unmodified lines
modified:src/click/_winconsole.py-25 removed
208 unmodified lines
209 def __repr__(self):210 return f"<ConsoleStream name={self.name!r} encoding={self.encoding!r}>"211212213class WindowsChunkedWriter:214 """215 Wraps a stream (such as stdout), acting as a transparent proxy for all216 attribute access apart from method 'write()' which we wrap to write in217 limited chunks due to a Windows limitation on binary console streams.218 """219220 def __init__(self, wrapped):221 # double-underscore everything to prevent clashes with names of222 # attributes on the wrapped stream object.223 self.__wrapped = wrapped224225 def __getattr__(self, name):226 return getattr(self.__wrapped, name)227228 def write(self, text):229 total_to_write = len(text)230 written = 0231232 while written < total_to_write:233 to_write = min(total_to_write - written, MAX_BYTES_WRITTEN)234 self.__wrapped.write(text[written : written + to_write])235 written += to_write236237213def _get_text_stdin(buffer_stream: t.BinaryIO) -> t.TextIO:214 text_stream = _NonClosingTextIOWrapper(215 io.BufferedReader(_WindowsConsoleReader(STDIN_HANDLE)),216 "utf-16-le",
63 unmodified lines