@@ -5,6 +5,9 @@ from abc import abstractmethod, ABCMeta
5
5
from types import CodeType , FrameType , TracebackType
6
6
import collections # Needed by aliases like DefaultDict, see mypy issue 2986
7
7
8
+ if sys .version_info < (3 , 8 ):
9
+ from typing_extensions import Literal
10
+
8
11
# Definitions of special type checking related constructs. Their definition
9
12
# are not used, so their value does not matter.
10
13
@@ -526,15 +529,16 @@ class Match(Generic[AnyStr]):
526
529
def expand (self , template : AnyStr ) -> AnyStr : ...
527
530
528
531
@overload
529
- def group (self , group1 : int = ...) -> AnyStr : ...
530
- @overload
531
- def group (self , group1 : str ) -> AnyStr : ...
532
+ def group (self , __group : Literal [0 ] = ...) -> AnyStr : ...
532
533
@overload
533
- def group (self , group1 : int , group2 : int ,
534
- * groups : int ) -> Sequence [AnyStr ]: ...
534
+ def group (self , __group : Union [str , int ]) -> Optional [AnyStr ]: ...
535
535
@overload
536
- def group (self , group1 : str , group2 : str ,
537
- * groups : str ) -> Sequence [AnyStr ]: ...
536
+ def group (
537
+ self ,
538
+ __group1 : Union [str , int ],
539
+ __group2 : Union [str , int ],
540
+ * groups : Union [str , int ],
541
+ ) -> Tuple [Optional [AnyStr ], ...]: ...
538
542
539
543
def groups (self , default : AnyStr = ...) -> Sequence [AnyStr ]: ...
540
544
def groupdict (self , default : AnyStr = ...) -> dict [str , AnyStr ]: ...
0 commit comments