1
1
from typing import (
2
2
Any , Callable , Dict , Generator , Iterable , List , IO , NoReturn , Optional ,
3
- Pattern , Sequence , Text , Tuple , Type , Union , TypeVar , overload
3
+ Pattern , Protocol , Sequence , Text , Tuple , Type , Union , TypeVar , overload
4
4
)
5
5
import sys
6
6
@@ -77,11 +77,14 @@ class _ActionsContainer:
77
77
def _handle_conflict_error (self , action : Action , conflicting_actions : Iterable [Tuple [Text , Action ]]) -> NoReturn : ...
78
78
def _handle_conflict_resolve (self , action : Action , conflicting_actions : Iterable [Tuple [Text , Action ]]) -> None : ...
79
79
80
+ class _FormatterClass (Protocol ):
81
+ def __call__ (self , prog : str ) -> HelpFormatter : ...
82
+
80
83
class ArgumentParser (_AttributeHolder , _ActionsContainer ):
81
84
prog : _Text
82
85
usage : Optional [_Text ]
83
86
epilog : Optional [_Text ]
84
- formatter_class : Type [ HelpFormatter ]
87
+ formatter_class : _FormatterClass
85
88
fromfile_prefix_chars : Optional [_Text ]
86
89
add_help : bool
87
90
@@ -100,7 +103,7 @@ class ArgumentParser(_AttributeHolder, _ActionsContainer):
100
103
description : Optional [str ] = ...,
101
104
epilog : Optional [str ] = ...,
102
105
parents : Sequence [ArgumentParser ] = ...,
103
- formatter_class : Type [ HelpFormatter ] = ...,
106
+ formatter_class : _FormatterClass = ...,
104
107
prefix_chars : str = ...,
105
108
fromfile_prefix_chars : Optional [str ] = ...,
106
109
argument_default : Optional [str ] = ...,
@@ -114,7 +117,7 @@ class ArgumentParser(_AttributeHolder, _ActionsContainer):
114
117
description : Optional [Text ] = ...,
115
118
epilog : Optional [Text ] = ...,
116
119
parents : Sequence [ArgumentParser ] = ...,
117
- formatter_class : Type [ HelpFormatter ] = ...,
120
+ formatter_class : _FormatterClass = ...,
118
121
prefix_chars : Text = ...,
119
122
fromfile_prefix_chars : Optional [Text ] = ...,
120
123
argument_default : Optional [Text ] = ...,
0 commit comments