mirror of
https://github.com/davidhalter/typeshed.git
synced 2025-12-07 20:54:28 +08:00
argparse: fix error __init__, add BooleanOptionalAction for py39 (#4144)
This commit is contained in:
@@ -21,7 +21,8 @@ SUPPRESS: str
|
||||
ZERO_OR_MORE: str
|
||||
_UNRECOGNIZED_ARGS_ATTR: str # undocumented
|
||||
|
||||
class ArgumentError(Exception): ...
|
||||
class ArgumentError(Exception):
|
||||
def __init__(self, argument: Optional[Action], message: str) -> None: ...
|
||||
|
||||
# undocumented
|
||||
class _AttributeHolder:
|
||||
@@ -270,8 +271,8 @@ class Action(_AttributeHolder):
|
||||
option_strings: Sequence[Text],
|
||||
dest: Text,
|
||||
nargs: Optional[Union[int, Text]] = ...,
|
||||
const: Any = ...,
|
||||
default: Any = ...,
|
||||
const: Optional[_T] = ...,
|
||||
default: Union[_T, str, None] = ...,
|
||||
type: Optional[Union[Callable[[Text], _T], Callable[[str], _T], FileType]] = ...,
|
||||
choices: Optional[Iterable[_T]] = ...,
|
||||
required: bool = ...,
|
||||
@@ -283,6 +284,21 @@ class Action(_AttributeHolder):
|
||||
if sys.version_info >= (3, 9):
|
||||
def format_usage(self) -> str: ...
|
||||
|
||||
if sys.version_info >= (3, 9):
|
||||
class BooleanOptionalAction(Action):
|
||||
def __init__(
|
||||
self,
|
||||
option_strings: Sequence[str],
|
||||
dest: str,
|
||||
const: None = ..., # unused in implementation
|
||||
default: Union[_T, str, None] = ...,
|
||||
type: Optional[Union[Callable[[Text], _T], Callable[[str], _T], FileType]] = ...,
|
||||
choices: Optional[Iterable[_T]] = ...,
|
||||
required: bool = ...,
|
||||
help: Optional[Text] = ...,
|
||||
metavar: Optional[Union[Text, Tuple[Text, ...]]] = ...,
|
||||
) -> None: ...
|
||||
|
||||
class Namespace(_AttributeHolder):
|
||||
def __init__(self, **kwargs: Any) -> None: ...
|
||||
def __getattr__(self, name: Text) -> Any: ...
|
||||
|
||||
Reference in New Issue
Block a user