Skip to content

Commit

Permalink
optparse: Fix OptionParser types (#13339)
Browse files Browse the repository at this point in the history
  • Loading branch information
hamdanal authored Jan 19, 2025
1 parent 9f90182 commit af00613
Showing 1 changed file with 15 additions and 18 deletions.
33 changes: 15 additions & 18 deletions stdlib/optparse.pyi
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
import builtins
from _typeshed import Incomplete, MaybeNone
from _typeshed import MaybeNone, SupportsWrite
from abc import abstractmethod
from collections.abc import Callable, Iterable, Mapping, Sequence
from typing import IO, Any, AnyStr, ClassVar, Literal, NoReturn, overload
from typing import Any, ClassVar, Literal, NoReturn, overload
from typing_extensions import Self

__all__ = [
Expand Down Expand Up @@ -274,13 +274,13 @@ class OptionParser(OptionContainer):
def _add_version_option(self) -> None: ...
def _create_option_list(self) -> None: ...
def _get_all_options(self) -> list[Option]: ...
def _get_args(self, args: Iterable[Incomplete]) -> list[Incomplete]: ...
def _get_args(self, args: list[str] | None) -> list[str]: ...
def _init_parsing_state(self) -> None: ...
def _match_long_opt(self, opt: str) -> str: ...
def _populate_option_list(self, option_list: Iterable[Option], add_help: bool = True) -> None: ...
def _process_args(self, largs: list[Incomplete], rargs: list[Incomplete], values: Values) -> None: ...
def _process_long_opt(self, rargs: list[Incomplete], values) -> None: ...
def _process_short_opts(self, rargs: list[Incomplete], values) -> None: ...
def _populate_option_list(self, option_list: Iterable[Option] | None, add_help: bool = True) -> None: ...
def _process_args(self, largs: list[str], rargs: list[str], values: Values) -> None: ...
def _process_long_opt(self, rargs: list[str], values: Values) -> None: ...
def _process_short_opts(self, rargs: list[str], values: Values) -> None: ...
@overload
def add_option_group(self, opt_group: OptionGroup, /) -> OptionGroup: ...
@overload
Expand All @@ -299,14 +299,11 @@ class OptionParser(OptionContainer):
def get_prog_name(self) -> str: ...
def get_usage(self) -> str: ...
def get_version(self) -> str: ...
@overload
def parse_args(self, args: None = None, values: Values | None = None) -> tuple[Values, list[str]]: ...
@overload
def parse_args(self, args: Sequence[AnyStr], values: Values | None = None) -> tuple[Values, list[AnyStr]]: ...
def print_usage(self, file: IO[str] | None = None) -> None: ...
def print_help(self, file: IO[str] | None = None) -> None: ...
def print_version(self, file: IO[str] | None = None) -> None: ...
def set_default(self, dest, value) -> None: ...
def set_defaults(self, **kwargs) -> None: ...
def set_process_default_values(self, process) -> None: ...
def set_usage(self, usage: str) -> None: ...
def parse_args(self, args: list[str] | None = None, values: Values | None = None) -> tuple[Values, list[str]]: ...
def print_usage(self, file: SupportsWrite[str] | None = None) -> None: ...
def print_help(self, file: SupportsWrite[str] | None = None) -> None: ...
def print_version(self, file: SupportsWrite[str] | None = None) -> None: ...
def set_default(self, dest: str, value: Any) -> None: ... # default value can be "any" type
def set_defaults(self, **kwargs: Any) -> None: ... # default values can be "any" type
def set_process_default_values(self, process: bool) -> None: ...
def set_usage(self, usage: str | None) -> None: ...

0 comments on commit af00613

Please sign in to comment.