@@ -5,9 +5,6 @@ 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
-
11
8
# Definitions of special type checking related constructs. Their definition
12
9
# are not used, so their value does not matter.
13
10
@@ -528,17 +525,16 @@ class Match(Generic[AnyStr]):
528
525
529
526
def expand (self , template : AnyStr ) -> AnyStr : ...
530
527
528
+ # TODO: The return for a group may be None, except if __group is 0 or not given.
531
529
@overload
532
- def group (self , __group : Literal [0 ] = ...) -> AnyStr : ...
533
- @overload
534
- def group (self , __group : Union [str , int ]) -> Optional [AnyStr ]: ...
530
+ def group (self , __group : Union [str , int ] = ...) -> AnyStr : ...
535
531
@overload
536
532
def group (
537
533
self ,
538
534
__group1 : Union [str , int ],
539
535
__group2 : Union [str , int ],
540
536
* groups : Union [str , int ],
541
- ) -> Tuple [Optional [ AnyStr ] , ...]: ...
537
+ ) -> Tuple [AnyStr , ...]: ...
542
538
543
539
def groups (self , default : AnyStr = ...) -> Sequence [AnyStr ]: ...
544
540
def groupdict (self , default : AnyStr = ...) -> dict [str , AnyStr ]: ...
0 commit comments