@@ -17,7 +17,7 @@ class istr(str): ...
17
17
18
18
upstr = istr
19
19
20
- _S = TypeVar ( "_S" , str , istr )
20
+ _S = Union [ str , istr ]
21
21
22
22
_T = TypeVar ("_T" )
23
23
@@ -39,17 +39,16 @@ class MultiMapping(Mapping[_S, _T_co]):
39
39
@abc .abstractmethod
40
40
def getone (self , key : _S , default : _D ) -> Union [_T_co , _D ]: ...
41
41
42
- _Arg = Union [
43
- Mapping [_S , _T ], Dict [_S , _T ], MultiMapping [_S , _T ], Iterable [Tuple [_S , _T ]]
44
- ]
42
+ _Arg = Union [Mapping [str , _T ], Mapping [istr , _T ],
43
+ Dict [str , _T ], Dict [istr , _T ],
44
+ MultiMapping [_T ],
45
+ Iterable [Tuple [str , _T ]], Iterable [Tuple [istr , _T ]]]
45
46
46
- class MutableMultiMapping (
47
- MultiMapping [_S , _T ], MutableMapping [_S , _T ], Generic [_S , _T ]
48
- ):
47
+ class MutableMultiMapping (MultiMapping [_T ], MutableMapping [_S , _T ], Generic [_T ]):
49
48
@abc .abstractmethod
50
49
def add (self , key : _S , value : _T ) -> None : ...
51
50
@abc .abstractmethod
52
- def extend (self , arg : _Arg [_S , _T ] = ..., ** kwargs : _T ) -> None : ...
51
+ def extend (self , arg : _Arg [_T ] = ..., ** kwargs : _T ) -> None : ...
53
52
@overload
54
53
@abc .abstractmethod
55
54
def popone (self , key : _S ) -> _T : ...
@@ -63,8 +62,8 @@ class MutableMultiMapping(
63
62
@abc .abstractmethod
64
63
def popall (self , key : _S , default : _D ) -> Union [List [_T ], _D ]: ...
65
64
66
- class MultiDict (MutableMultiMapping [str , _T ]):
67
- def __init__ (self , arg : _Arg [_S , _T ] = ..., ** kwargs : _T ) -> None : ...
65
+ class MultiDict (MutableMultiMapping [_T ], Generic [ _T ]):
66
+ def __init__ (self , arg : _Arg [_T ] = ..., ** kwargs : _T ) -> None : ...
68
67
def copy (self ) -> MultiDict [_T ]: ...
69
68
def __getitem__ (self , k : _S ) -> _T : ...
70
69
def __setitem__ (self , k : _S , v : _T ) -> None : ...
@@ -80,7 +79,7 @@ class MultiDict(MutableMultiMapping[str, _T]):
80
79
@overload
81
80
def getone (self , key : _S , default : _D ) -> Union [_T , _D ]: ...
82
81
def add (self , key : _S , value : _T ) -> None : ...
83
- def extend (self , arg : _Arg [_S , _T ] = ..., ** kwargs : _T ) -> None : ...
82
+ def extend (self , arg : _Arg [_T ] = ..., ** kwargs : _T ) -> None : ...
84
83
@overload
85
84
def popone (self , key : _S ) -> _T : ...
86
85
@overload
@@ -90,8 +89,8 @@ class MultiDict(MutableMultiMapping[str, _T]):
90
89
@overload
91
90
def popall (self , key : _S , default : _D ) -> Union [List [_T ], _D ]: ...
92
91
93
- class CIMultiDict (MutableMultiMapping [istr , _T ]):
94
- def __init__ (self , arg : _Arg [_S , _T ] = ..., ** kwargs : _T ) -> None : ...
92
+ class CIMultiDict (MutableMultiMapping [_T ], Generic [ _T ]):
93
+ def __init__ (self , arg : _Arg [_T ] = ..., ** kwargs : _T ) -> None : ...
95
94
def copy (self ) -> CIMultiDict [_T ]: ...
96
95
def __getitem__ (self , k : _S ) -> _T : ...
97
96
def __setitem__ (self , k : _S , v : _T ) -> None : ...
@@ -107,7 +106,7 @@ class CIMultiDict(MutableMultiMapping[istr, _T]):
107
106
@overload
108
107
def getone (self , key : _S , default : _D ) -> Union [_T , _D ]: ...
109
108
def add (self , key : _S , value : _T ) -> None : ...
110
- def extend (self , arg : _Arg [_S , _T ] = ..., ** kwargs : _T ) -> None : ...
109
+ def extend (self , arg : _Arg [_T ] = ..., ** kwargs : _T ) -> None : ...
111
110
@overload
112
111
def popone (self , key : _S ) -> _T : ...
113
112
@overload
@@ -117,9 +116,9 @@ class CIMultiDict(MutableMultiMapping[istr, _T]):
117
116
@overload
118
117
def popall (self , key : _S , default : _D ) -> Union [List [_T ], _D ]: ...
119
118
120
- class MultiDictProxy (MultiMapping [str , _T ]):
119
+ class MultiDictProxy (MultiMapping [_T ], Generic [ _T ]):
121
120
def __init__ (
122
- self , arg : Union [MultiDict [_T ], MultiDictProxy [_T ]]
121
+ self , arg : Union [MultiMapping [_T ], MutableMultiMapping [_T ]]
123
122
) -> None : ...
124
123
def copy (self ) -> MultiDict [_T ]: ...
125
124
def __getitem__ (self , k : _S ) -> _T : ...
@@ -134,11 +133,10 @@ class MultiDictProxy(MultiMapping[str, _T]):
134
133
@overload
135
134
def getone (self , key : _S , default : _D ) -> Union [_T , _D ]: ...
136
135
137
- class CIMultiDictProxy (MultiMapping [istr , _T ]):
136
+ class CIMultiDictProxy (MultiMapping [_T ], Generic [ _T ]):
138
137
def __init__ (
139
- self , arg : Union [CIMultiDict [_T ], CIMultiDictProxy [_T ]]
138
+ self , arg : Union [MultiMapping [_T ], MutableMultiMapping [_T ]]
140
139
) -> None : ...
141
- def copy (self ) -> CIMultiDict [_T ]: ...
142
140
def __getitem__ (self , k : _S ) -> _T : ...
143
141
def __iter__ (self ) -> Iterator [_S ]: ...
144
142
def __len__ (self ) -> int : ...
@@ -150,12 +148,8 @@ class CIMultiDictProxy(MultiMapping[istr, _T]):
150
148
def getone (self , key : _S ) -> _T : ...
151
149
@overload
152
150
def getone (self , key : _S , default : _D ) -> Union [_T , _D ]: ...
151
+ def copy (self ) -> CIMultiDict [_T ]: ...
153
152
154
153
def getversion (
155
- md : Union [
156
- MultiDict [_T ],
157
- CIMultiDict [_T ],
158
- MultiDictProxy [_T ],
159
- CIMultiDictProxy [_T ],
160
- ]
154
+ md : Union [MultiDict [_T ], CIMultiDict [_T ], MultiDictProxy [_T ], CIMultiDictProxy [_T ]]
161
155
) -> int : ...
0 commit comments