From c6ea3be71a9a742b4b3660847b1ccae2aba12d36 Mon Sep 17 00:00:00 2001 From: Ali Hamdan Date: Sat, 28 Dec 2024 22:27:06 +0100 Subject: [PATCH] argparse: Use SupportsWrite instead of IO --- stdlib/argparse.pyi | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/stdlib/argparse.pyi b/stdlib/argparse.pyi index 7ed10d07ff36..b9652ec5f75a 100644 --- a/stdlib/argparse.pyi +++ b/stdlib/argparse.pyi @@ -1,5 +1,5 @@ import sys -from _typeshed import sentinel +from _typeshed import SupportsWrite, sentinel from collections.abc import Callable, Generator, Iterable, Sequence from re import Pattern from typing import IO, Any, ClassVar, Final, Generic, NewType, NoReturn, Protocol, TypeVar, overload @@ -207,8 +207,8 @@ class ArgumentParser(_AttributeHolder, _ActionsContainer): help: str | None = None, metavar: str | None = None, ) -> _SubParsersAction[_ArgumentParserT]: ... - def print_usage(self, file: IO[str] | None = None) -> None: ... - def print_help(self, file: IO[str] | None = None) -> None: ... + def print_usage(self, file: SupportsWrite[str] | None = None) -> None: ... + def print_help(self, file: SupportsWrite[str] | None = None) -> None: ... def format_usage(self) -> str: ... def format_help(self) -> str: ... @overload @@ -254,7 +254,7 @@ class ArgumentParser(_AttributeHolder, _ActionsContainer): def _get_value(self, action: Action, arg_string: str) -> Any: ... def _check_value(self, action: Action, value: Any) -> None: ... def _get_formatter(self) -> HelpFormatter: ... - def _print_message(self, message: str, file: IO[str] | None = None) -> None: ... + def _print_message(self, message: str, file: SupportsWrite[str] | None = None) -> None: ... class HelpFormatter: # undocumented