Skip to content

Commit

Permalink
optparse: improve HelpFormatter annotations (#13278)
Browse files Browse the repository at this point in the history
  • Loading branch information
hamdanal authored Dec 23, 2024
1 parent db3c2cf commit 8235252
Showing 1 changed file with 14 additions and 4 deletions.
18 changes: 14 additions & 4 deletions stdlib/optparse.pyi
Original file line number Diff line number Diff line change
Expand Up @@ -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: ...
Expand All @@ -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: ...
Expand Down

0 comments on commit 8235252

Please # to comment.