@@ -3,7 +3,7 @@ from _typeshed import sentinel
33from collections .abc import Callable , Generator , Iterable , Sequence
44from re import Pattern
55from typing import IO , Any , Generic , Literal , NewType , NoReturn , Protocol , TypeVar , overload
6- from typing_extensions import Self , TypeAlias
6+ from typing_extensions import Self , TypeAlias , deprecated
77
88__all__ = [
99 "ArgumentParser" ,
@@ -339,11 +339,23 @@ class Action(_AttributeHolder):
339339
340340if sys .version_info >= (3 , 12 ):
341341 class BooleanOptionalAction (Action ):
342+ @overload
342343 def __init__ (
343344 self ,
344345 option_strings : Sequence [str ],
345346 dest : str ,
346- default : _T | str | None = None ,
347+ default : bool | None = None ,
348+ * ,
349+ required : bool = False ,
350+ help : str | None = None ,
351+ ) -> None : ...
352+ @overload
353+ @deprecated ("The `type`, `choices`, and `metavar` parameters are ignored and will be removed in Python 3.14." )
354+ def __init__ (
355+ self ,
356+ option_strings : Sequence [str ],
357+ dest : str ,
358+ default : _T | bool | None = None ,
347359 type : Callable [[str ], _T ] | FileType | None = sentinel ,
348360 choices : Iterable [_T ] | None = sentinel ,
349361 required : bool = False ,
@@ -353,11 +365,23 @@ if sys.version_info >= (3, 12):
353365
354366elif sys .version_info >= (3 , 9 ):
355367 class BooleanOptionalAction (Action ):
368+ @overload
369+ def __init__ (
370+ self ,
371+ option_strings : Sequence [str ],
372+ dest : str ,
373+ default : bool | None = None ,
374+ * ,
375+ required : bool = False ,
376+ help : str | None = None ,
377+ ) -> None : ...
378+ @overload
379+ @deprecated ("The `type`, `choices`, and `metavar` parameters are ignored and will be removed in Python 3.14." )
356380 def __init__ (
357381 self ,
358382 option_strings : Sequence [str ],
359383 dest : str ,
360- default : _T | str | None = None ,
384+ default : _T | bool | None = None ,
361385 type : Callable [[str ], _T ] | FileType | None = None ,
362386 choices : Iterable [_T ] | None = None ,
363387 required : bool = False ,
0 commit comments