@@ -2,7 +2,7 @@ import enum
2
2
import sre_compile
3
3
import sre_constants
4
4
import sys
5
- from _typeshed import ReadableBuffer
5
+ from _typeshed import MaybeNone , ReadableBuffer
6
6
from collections .abc import Callable , Iterator , Mapping
7
7
from typing import Any , AnyStr , Generic , Literal , TypeVar , final , overload
8
8
from typing_extensions import TypeAlias
@@ -90,19 +90,19 @@ class Match(Generic[AnyStr]):
90
90
@overload
91
91
def group (self , group : Literal [0 ] = 0 , / ) -> AnyStr : ...
92
92
@overload
93
- def group (self , group : str | int , / ) -> AnyStr | Any : ...
93
+ def group (self , group : str | int , / ) -> AnyStr | MaybeNone : ...
94
94
@overload
95
- def group (self , group1 : str | int , group2 : str | int , / , * groups : str | int ) -> tuple [AnyStr | Any , ...]: ...
95
+ def group (self , group1 : str | int , group2 : str | int , / , * groups : str | int ) -> tuple [AnyStr | MaybeNone , ...]: ...
96
96
# Each item of groups()'s return tuple is either "AnyStr" or
97
97
# "AnyStr | None", depending on the pattern.
98
98
@overload
99
- def groups (self ) -> tuple [AnyStr | Any , ...]: ...
99
+ def groups (self ) -> tuple [AnyStr | MaybeNone , ...]: ...
100
100
@overload
101
101
def groups (self , default : _T ) -> tuple [AnyStr | _T , ...]: ...
102
102
# Each value in groupdict()'s return dict is either "AnyStr" or
103
103
# "AnyStr | None", depending on the pattern.
104
104
@overload
105
- def groupdict (self ) -> dict [str , AnyStr | Any ]: ...
105
+ def groupdict (self ) -> dict [str , AnyStr | MaybeNone ]: ...
106
106
@overload
107
107
def groupdict (self , default : _T ) -> dict [str , AnyStr | _T ]: ...
108
108
def start (self , group : int | str = 0 , / ) -> int : ...
@@ -114,7 +114,7 @@ class Match(Generic[AnyStr]):
114
114
@overload
115
115
def __getitem__ (self , key : Literal [0 ], / ) -> AnyStr : ...
116
116
@overload
117
- def __getitem__ (self , key : int | str , / ) -> AnyStr | Any : ...
117
+ def __getitem__ (self , key : int | str , / ) -> AnyStr | MaybeNone : ...
118
118
def __copy__ (self ) -> Match [AnyStr ]: ...
119
119
def __deepcopy__ (self , memo : Any , / ) -> Match [AnyStr ]: ...
120
120
if sys .version_info >= (3 , 9 ):
@@ -151,11 +151,11 @@ class Pattern(Generic[AnyStr]):
151
151
@overload
152
152
def fullmatch (self , string : AnyStr , pos : int = 0 , endpos : int = sys .maxsize ) -> Match [AnyStr ] | None : ...
153
153
@overload
154
- def split (self : Pattern [str ], string : str , maxsplit : int = 0 ) -> list [str | Any ]: ...
154
+ def split (self : Pattern [str ], string : str , maxsplit : int = 0 ) -> list [str | MaybeNone ]: ...
155
155
@overload
156
- def split (self : Pattern [bytes ], string : ReadableBuffer , maxsplit : int = 0 ) -> list [bytes | Any ]: ...
156
+ def split (self : Pattern [bytes ], string : ReadableBuffer , maxsplit : int = 0 ) -> list [bytes | MaybeNone ]: ...
157
157
@overload
158
- def split (self , string : AnyStr , maxsplit : int = 0 ) -> list [AnyStr | Any ]: ...
158
+ def split (self , string : AnyStr , maxsplit : int = 0 ) -> list [AnyStr | MaybeNone ]: ...
159
159
# return type depends on the number of groups in the pattern
160
160
@overload
161
161
def findall (self : Pattern [str ], string : str , pos : int = 0 , endpos : int = sys .maxsize ) -> list [Any ]: ...
@@ -270,11 +270,11 @@ def fullmatch(pattern: str | Pattern[str], string: str, flags: _FlagsType = 0) -
270
270
@overload
271
271
def fullmatch (pattern : bytes | Pattern [bytes ], string : ReadableBuffer , flags : _FlagsType = 0 ) -> Match [bytes ] | None : ...
272
272
@overload
273
- def split (pattern : str | Pattern [str ], string : str , maxsplit : int = 0 , flags : _FlagsType = 0 ) -> list [str | Any ]: ...
273
+ def split (pattern : str | Pattern [str ], string : str , maxsplit : int = 0 , flags : _FlagsType = 0 ) -> list [str | MaybeNone ]: ...
274
274
@overload
275
275
def split (
276
276
pattern : bytes | Pattern [bytes ], string : ReadableBuffer , maxsplit : int = 0 , flags : _FlagsType = 0
277
- ) -> list [bytes | Any ]: ...
277
+ ) -> list [bytes | MaybeNone ]: ...
278
278
@overload
279
279
def findall (pattern : str | Pattern [str ], string : str , flags : _FlagsType = 0 ) -> list [Any ]: ...
280
280
@overload
0 commit comments