Skip to content

Commit 3f8a48f

Browse files
edgarrmondragonsrittauJelleZijlstra
authored
Add new Python 3.14 argparse.ArgumentParser constructor parameters (#13947)
These are - `suggest_on_error`, added by python/cpython#124456, made keyword-only by python/cpython#133302 - `color`, added by python/cpython#132323 Co-authored-by: Sebastian Rittau <[email protected]> Co-authored-by: Jelle Zijlstra <[email protected]>
1 parent d01b052 commit 3f8a48f

File tree

1 file changed

+32
-1
lines changed

1 file changed

+32
-1
lines changed

stdlib/argparse.pyi

+32-1
Original file line numberDiff line numberDiff line change
@@ -123,6 +123,11 @@ class ArgumentParser(_AttributeHolder, _ActionsContainer):
123123
fromfile_prefix_chars: str | None
124124
add_help: bool
125125
allow_abbrev: bool
126+
exit_on_error: bool
127+
128+
if sys.version_info >= (3, 14):
129+
suggest_on_error: bool
130+
color: bool
126131

127132
# undocumented
128133
_positionals: _ArgumentGroup
@@ -720,7 +725,33 @@ class _SubParsersAction(Action, Generic[_ArgumentParserT]):
720725

721726
# Note: `add_parser` accepts all kwargs of `ArgumentParser.__init__`. It also
722727
# accepts its own `help` and `aliases` kwargs.
723-
if sys.version_info >= (3, 13):
728+
if sys.version_info >= (3, 14):
729+
def add_parser(
730+
self,
731+
name: str,
732+
*,
733+
deprecated: bool = False,
734+
help: str | None = ...,
735+
aliases: Sequence[str] = ...,
736+
# Kwargs from ArgumentParser constructor
737+
prog: str | None = ...,
738+
usage: str | None = ...,
739+
description: str | None = ...,
740+
epilog: str | None = ...,
741+
parents: Sequence[_ArgumentParserT] = ...,
742+
formatter_class: _FormatterClass = ...,
743+
prefix_chars: str = ...,
744+
fromfile_prefix_chars: str | None = ...,
745+
argument_default: Any = ...,
746+
conflict_handler: str = ...,
747+
add_help: bool = ...,
748+
allow_abbrev: bool = ...,
749+
exit_on_error: bool = ...,
750+
suggest_on_error: bool = False,
751+
color: bool = False,
752+
**kwargs: Any, # Accepting any additional kwargs for custom parser classes
753+
) -> _ArgumentParserT: ...
754+
elif sys.version_info >= (3, 13):
724755
def add_parser(
725756
self,
726757
name: str,

0 commit comments

Comments
 (0)