Skip to content

Commit aa07ae9

Browse files
authored
Merge branch 'main' into benchatt/pythongh-11990-more-argparse
2 parents 6fa9a04 + cf4678c commit aa07ae9

File tree

2 files changed

+74
-34
lines changed

2 files changed

+74
-34
lines changed

stdlib/@tests/stubtest_allowlists/py313.txt

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -37,10 +37,6 @@ _thread.start_new_thread
3737
_tkinter.TkappType.gettrace
3838
_tkinter.TkappType.settrace
3939
_tkinter.create
40-
argparse.Action.__init__
41-
argparse.BooleanOptionalAction.__init__
42-
argparse._AppendAction.__init__
43-
argparse._StoreAction.__init__
4440
argparse._StoreConstAction.__init__
4541
argparse._StoreFalseAction.__init__
4642
argparse._StoreTrueAction.__init__

stdlib/argparse.pyi

Lines changed: 74 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -318,51 +318,95 @@ class Action(_AttributeHolder):
318318
required: bool
319319
help: str | None
320320
metavar: str | tuple[str, ...] | None
321-
def __init__(
322-
self,
323-
option_strings: Sequence[str],
324-
dest: str,
325-
nargs: int | str | None = None,
326-
const: _T | None = None,
327-
default: _T | str | None = None,
328-
type: Callable[[str], _T] | FileType | None = None,
329-
choices: Iterable[_T] | None = None,
330-
required: bool = False,
331-
help: str | None = None,
332-
metavar: str | tuple[str, ...] | None = None,
333-
) -> None: ...
334-
def __call__(
335-
self, parser: ArgumentParser, namespace: Namespace, values: str | Sequence[Any] | None, option_string: str | None = None
336-
) -> None: ...
337-
if sys.version_info >= (3, 9):
338-
def format_usage(self) -> str: ...
339-
340-
if sys.version_info >= (3, 12):
341-
class BooleanOptionalAction(Action):
342-
@overload
321+
if sys.version_info >= (3, 13):
343322
def __init__(
344323
self,
345324
option_strings: Sequence[str],
346325
dest: str,
347-
default: bool | None = None,
348-
*,
326+
nargs: int | str | None = None,
327+
const: _T | None = None,
328+
default: _T | str | None = None,
329+
type: Callable[[str], _T] | FileType | None = None,
330+
choices: Iterable[_T] | None = None,
349331
required: bool = False,
350332
help: str | None = None,
333+
metavar: str | tuple[str, ...] | None = None,
334+
deprecated: bool = False,
351335
) -> None: ...
352-
@overload
353-
@deprecated("The `type`, `choices`, and `metavar` parameters are ignored and will be removed in Python 3.14.")
336+
else:
354337
def __init__(
355338
self,
356339
option_strings: Sequence[str],
357340
dest: str,
358-
default: _T | bool | None = None,
359-
type: Callable[[str], _T] | FileType | None = sentinel,
360-
choices: Iterable[_T] | None = sentinel,
341+
nargs: int | str | None = None,
342+
const: _T | None = None,
343+
default: _T | str | None = None,
344+
type: Callable[[str], _T] | FileType | None = None,
345+
choices: Iterable[_T] | None = None,
361346
required: bool = False,
362347
help: str | None = None,
363-
metavar: str | tuple[str, ...] | None = sentinel,
348+
metavar: str | tuple[str, ...] | None = None,
364349
) -> None: ...
365350

351+
def __call__(
352+
self, parser: ArgumentParser, namespace: Namespace, values: str | Sequence[Any] | None, option_string: str | None = None
353+
) -> None: ...
354+
if sys.version_info >= (3, 9):
355+
def format_usage(self) -> str: ...
356+
357+
if sys.version_info >= (3, 12):
358+
class BooleanOptionalAction(Action):
359+
if sys.version_info >= (3, 13):
360+
@overload
361+
def __init__(
362+
self,
363+
option_strings: Sequence[str],
364+
dest: str,
365+
default: bool | None = None,
366+
*,
367+
required: bool = False,
368+
help: str | None = None,
369+
deprecated: bool = False,
370+
) -> None: ...
371+
@overload
372+
@deprecated("The `type`, `choices`, and `metavar` parameters are ignored and will be removed in Python 3.14.")
373+
def __init__(
374+
self,
375+
option_strings: Sequence[str],
376+
dest: str,
377+
default: _T | bool | None = None,
378+
type: Callable[[str], _T] | FileType | None = sentinel,
379+
choices: Iterable[_T] | None = sentinel,
380+
required: bool = False,
381+
help: str | None = None,
382+
metavar: str | tuple[str, ...] | None = sentinel,
383+
deprecated: bool = False,
384+
) -> None: ...
385+
else:
386+
@overload
387+
def __init__(
388+
self,
389+
option_strings: Sequence[str],
390+
dest: str,
391+
default: bool | None = None,
392+
*,
393+
required: bool = False,
394+
help: str | None = None,
395+
) -> None: ...
396+
@overload
397+
@deprecated("The `type`, `choices`, and `metavar` parameters are ignored and will be removed in Python 3.14.")
398+
def __init__(
399+
self,
400+
option_strings: Sequence[str],
401+
dest: str,
402+
default: _T | bool | None = None,
403+
type: Callable[[str], _T] | FileType | None = sentinel,
404+
choices: Iterable[_T] | None = sentinel,
405+
required: bool = False,
406+
help: str | None = None,
407+
metavar: str | tuple[str, ...] | None = sentinel,
408+
) -> None: ...
409+
366410
elif sys.version_info >= (3, 9):
367411
class BooleanOptionalAction(Action):
368412
@overload

0 commit comments

Comments
 (0)