From c65a87481db49a901aafff4544e023df0d31355d Mon Sep 17 00:00:00 2001 From: Jelle Zijlstra Date: Mon, 6 Feb 2023 06:50:21 -0800 Subject: [PATCH] colorama: Preserve input type for `wrap_stream` (#9677) --- stubs/colorama/colorama/initialise.pyi | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/stubs/colorama/colorama/initialise.pyi b/stubs/colorama/colorama/initialise.pyi index b607956ca..25107f16a 100644 --- a/stubs/colorama/colorama/initialise.pyi +++ b/stubs/colorama/colorama/initialise.pyi @@ -1,8 +1,10 @@ from contextlib import AbstractContextManager -from typing import Any, TextIO +from typing import Any, TextIO, TypeVar from .ansitowin32 import StreamWrapper +_TextIOT = TypeVar("_TextIOT", bound=TextIO) + orig_stdout: TextIO | None orig_stderr: TextIO | None wrapped_stdout: TextIO | StreamWrapper @@ -16,6 +18,6 @@ def deinit() -> None: ... def colorama_text(*args: Any, **kwargs: Any) -> AbstractContextManager[None]: ... def reinit() -> None: ... def wrap_stream( - stream: TextIO, convert: bool | None, strip: bool | None, autoreset: bool, wrap: bool -) -> TextIO | StreamWrapper: ... + stream: _TextIOT, convert: bool | None, strip: bool | None, autoreset: bool, wrap: bool +) -> _TextIOT | StreamWrapper: ... def just_fix_windows_console() -> None: ...