Skip to content

Commit 8235252

Browse files
authored
optparse: improve HelpFormatter annotations (#13278)
1 parent db3c2cf commit 8235252

File tree

1 file changed

+14
-4
lines changed

1 file changed

+14
-4
lines changed

stdlib/optparse.pyi

Lines changed: 14 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -62,9 +62,11 @@ class HelpFormatter:
6262
max_help_position: int
6363
option_strings: dict[Option, str]
6464
parser: OptionParser
65-
short_first: Incomplete
65+
short_first: bool | Literal[0, 1]
6666
width: int
67-
def __init__(self, indent_increment: int, max_help_position: int, width: int | None, short_first: int) -> None: ...
67+
def __init__(
68+
self, indent_increment: int, max_help_position: int, width: int | None, short_first: bool | Literal[0, 1]
69+
) -> None: ...
6870
def dedent(self) -> None: ...
6971
def expand_default(self, option: Option) -> str: ...
7072
def format_description(self, description: str | None) -> str: ...
@@ -83,14 +85,22 @@ class HelpFormatter:
8385

8486
class IndentedHelpFormatter(HelpFormatter):
8587
def __init__(
86-
self, indent_increment: int = 2, max_help_position: int = 24, width: int | None = None, short_first: int = 1
88+
self,
89+
indent_increment: int = 2,
90+
max_help_position: int = 24,
91+
width: int | None = None,
92+
short_first: bool | Literal[0, 1] = 1,
8793
) -> None: ...
8894
def format_heading(self, heading: str) -> str: ...
8995
def format_usage(self, usage: str) -> str: ...
9096

9197
class TitledHelpFormatter(HelpFormatter):
9298
def __init__(
93-
self, indent_increment: int = 0, max_help_position: int = 24, width: int | None = None, short_first: int = 0
99+
self,
100+
indent_increment: int = 0,
101+
max_help_position: int = 24,
102+
width: int | None = None,
103+
short_first: bool | Literal[0, 1] = 0,
94104
) -> None: ...
95105
def format_heading(self, heading: str) -> str: ...
96106
def format_usage(self, usage: str) -> str: ...

0 commit comments

Comments
 (0)