optparse: improve HelpFormatter annotations (#13278)

This commit is contained in:
Ali Hamdan
2024-12-23 01:18:20 +01:00
committed by GitHub
parent db3c2cf69d
commit 82352521bf

View File

@@ -62,9 +62,11 @@ class HelpFormatter:
max_help_position: int
option_strings: dict[Option, str]
parser: OptionParser
short_first: Incomplete
short_first: bool | Literal[0, 1]
width: int
def __init__(self, indent_increment: int, max_help_position: int, width: int | None, short_first: int) -> None: ...
def __init__(
self, indent_increment: int, max_help_position: int, width: int | None, short_first: bool | Literal[0, 1]
) -> None: ...
def dedent(self) -> None: ...
def expand_default(self, option: Option) -> str: ...
def format_description(self, description: str | None) -> str: ...
@@ -83,14 +85,22 @@ class HelpFormatter:
class IndentedHelpFormatter(HelpFormatter):
def __init__(
self, indent_increment: int = 2, max_help_position: int = 24, width: int | None = None, short_first: int = 1
self,
indent_increment: int = 2,
max_help_position: int = 24,
width: int | None = None,
short_first: bool | Literal[0, 1] = 1,
) -> None: ...
def format_heading(self, heading: str) -> str: ...
def format_usage(self, usage: str) -> str: ...
class TitledHelpFormatter(HelpFormatter):
def __init__(
self, indent_increment: int = 0, max_help_position: int = 24, width: int | None = None, short_first: int = 0
self,
indent_increment: int = 0,
max_help_position: int = 24,
width: int | None = None,
short_first: bool | Literal[0, 1] = 0,
) -> None: ...
def format_heading(self, heading: str) -> str: ...
def format_usage(self, usage: str) -> str: ...