mirror of
https://github.com/davidhalter/typeshed.git
synced 2026-05-04 12:35:49 +08:00
Add new Python 3.14 argparse.ArgumentParser constructor parameters (#13947)
These are - `suggest_on_error`, added by https://github.com/python/cpython/pull/124456, made keyword-only by https://github.com/python/cpython/pull/133302 - `color`, added by https://github.com/python/cpython/pull/132323 Co-authored-by: Sebastian Rittau <srittau@rittau.biz> Co-authored-by: Jelle Zijlstra <jelle.zijlstra@gmail.com>
This commit is contained in:
committed by
GitHub
parent
d01b052dad
commit
3f8a48f6cc
+32
-1
@@ -123,6 +123,11 @@ class ArgumentParser(_AttributeHolder, _ActionsContainer):
|
||||
fromfile_prefix_chars: str | None
|
||||
add_help: bool
|
||||
allow_abbrev: bool
|
||||
exit_on_error: bool
|
||||
|
||||
if sys.version_info >= (3, 14):
|
||||
suggest_on_error: bool
|
||||
color: bool
|
||||
|
||||
# undocumented
|
||||
_positionals: _ArgumentGroup
|
||||
@@ -720,7 +725,33 @@ class _SubParsersAction(Action, Generic[_ArgumentParserT]):
|
||||
|
||||
# Note: `add_parser` accepts all kwargs of `ArgumentParser.__init__`. It also
|
||||
# accepts its own `help` and `aliases` kwargs.
|
||||
if sys.version_info >= (3, 13):
|
||||
if sys.version_info >= (3, 14):
|
||||
def add_parser(
|
||||
self,
|
||||
name: str,
|
||||
*,
|
||||
deprecated: bool = False,
|
||||
help: str | None = ...,
|
||||
aliases: Sequence[str] = ...,
|
||||
# Kwargs from ArgumentParser constructor
|
||||
prog: str | None = ...,
|
||||
usage: str | None = ...,
|
||||
description: str | None = ...,
|
||||
epilog: str | None = ...,
|
||||
parents: Sequence[_ArgumentParserT] = ...,
|
||||
formatter_class: _FormatterClass = ...,
|
||||
prefix_chars: str = ...,
|
||||
fromfile_prefix_chars: str | None = ...,
|
||||
argument_default: Any = ...,
|
||||
conflict_handler: str = ...,
|
||||
add_help: bool = ...,
|
||||
allow_abbrev: bool = ...,
|
||||
exit_on_error: bool = ...,
|
||||
suggest_on_error: bool = False,
|
||||
color: bool = False,
|
||||
**kwargs: Any, # Accepting any additional kwargs for custom parser classes
|
||||
) -> _ArgumentParserT: ...
|
||||
elif sys.version_info >= (3, 13):
|
||||
def add_parser(
|
||||
self,
|
||||
name: str,
|
||||
|
||||
Reference in New Issue
Block a user