argparse: Use SupportsWrite instead of IO (#13324)

This commit is contained in:
Ali Hamdan
2024-12-30 02:12:13 +01:00
committed by GitHub
parent 5a10be14db
commit ce36fd4b8c

View File

@@ -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