1- from typing import Any , Mapping , MutableMapping , List , Union , Iterable
2- from typing import KeysView , ValuesView , ItemsView , Iterator , Tuple
3- from typing import overload , TypeVar , Generic , Optional
1+ from typing import (Mapping , MutableMapping , List , Union , Iterable ,
2+ Iterator , TypeVar , Generic , Tuple , Dict )
43
54
6- class istr (str ): ...
5+ class istr (str ):
6+ pass
7+
78
89upstr = istr
910
@@ -12,87 +13,86 @@ _S = Union[str, istr]
1213_T = TypeVar ('_T' )
1314
1415
15- class MultiMapping (Mapping [_S , _T ]):
16- def getall (self , key : _S , default : _T = ...) -> List [_T ]: ...
17- def getone (self , key : _S , default : _T = ...) -> _T : ...
16+ class MultiMapping (Mapping [_S , _T ], Generic [_T ]):
17+ def getall (self , key : _S , default : _T = ...) -> List [_T ]: ...
18+
19+ def getone (self , key : _S , default : _T = ...) -> _T : ...
20+
21+
22+ _Arg = Union [Mapping [_S , _T ],
23+ Dict [_S , _T ],
24+ MultiMapping [_T ],
25+ Iterable [Tuple [_S . _T ]]]
1826
1927
2028class MutableMultiMapping (MultiMapping [_T ],
21- MutableMapping [_S , _T ]):
29+ MutableMapping [_S , _T ],
30+ Generic [_T ]):
2231
2332 def add (self , key : _S , value : _T ) -> None : ...
2433
25- @overload
26- def extend (self , dct : MultiDict [_T ]) -> None : ...
27- @overload
28- def extend (self , map : Mapping [_S , _T ]) -> None : ...
29- @overload
30- def extend (self , iterable : Iterable [Tuple [_S , _T ]]) -> None : ...
34+ def extend (self , arg : _Arg = ..., ** kwargs : _T ) -> None : ...
3135
32- @overload
33- def popone (self , key : _S ) -> _T : ...
34- @overload
35- def popone (self , key : _S , default : _T = ...) -> _T : ...
36+ def popone (self , key : _S , default : _T = ...) -> _T : ...
3637
37- @overload
38- def popall (self , key : _S ) -> List [_T ]: ...
39- @overload
40- def popall (self , key : _S , default : _T = ...) -> List [_T ]: ...
38+ def popall (self , key : _S , default : _T = ...) -> List [_T ]: ...
4139
4240
43- class MultiDict (MutableMultiMapping [_T ]):
44- @overload
45- def __init__ (self ) -> None : ...
46- @overload
47- def __init__ (self , map : Mapping [_S , _T ]) -> None : ...
48- @overload
49- def __init__ (self , iterable : Iterable [Tuple [_S , _T ]]) -> None : ...
41+ class MultiDict (MutableMultiMapping [_T ], Generic [_T ]):
42+ def __init__ (self , arg : _Arg = ..., ** kwargs : _T ) -> None : ...
5043
5144 def copy (self ) -> MultiDict [_T ]: ...
5245
53-
5446 def __getitem__ (self , k : _S ) -> _T : ...
47+
5548 def __setitem__ (self , k : _S , v : _T ) -> None : ...
49+
5650 def __delitem__ (self , v : _S ) -> None : ...
51+
5752 def __iter__ (self ) -> Iterator [_S ]: ...
53+
5854 def __len__ (self ) -> int : ...
5955
6056
61- class CIMultiDict (MutableMultiMapping [_T ]):
62- @overload
63- def __init__ (self ) -> None : ...
64- @overload
65- def __init__ (self , map : Mapping [_S , _T ]) -> None : ...
66- @overload
67- def __init__ (self , iterable : Iterable [Tuple [_S , _T ]]) -> None : ...
57+ class CIMultiDict (MutableMultiMapping [_T ], Generic [_T ]):
58+ def __init__ (self , arg : _Arg = ..., ** kwargs : _T ) -> None : ...
6859
6960 def copy (self ) -> CIMultiDict [_T ]: ...
7061
7162 def __getitem__ (self , k : _S ) -> _T : ...
63+
7264 def __setitem__ (self , k : _S , v : _T ) -> None : ...
65+
7366 def __delitem__ (self , v : _S ) -> None : ...
67+
7468 def __iter__ (self ) -> Iterator [_S ]: ...
69+
7570 def __len__ (self ) -> int : ...
7671
7772
78- class MultiDictProxy (MultiMapping [_T ]):
73+ class MultiDictProxy (MultiMapping [_T ], Generic [ _T ] ):
7974 def __init__ (self , arg : Union [MultiMapping [_T ],
8075 MutableMultiMapping [_T ]]) -> None : ...
8176
8277 def copy (self ) -> MultiDictProxy [_T ]: ...
8378
8479 def __getitem__ (self , k : _S ) -> _T : ...
80+
8581 def __iter__ (self ) -> Iterator [_S ]: ...
82+
8683 def __len__ (self ) -> int : ...
8784
8885
89- class CIMultiDictProxy (MultiMapping [_T ]):
86+ class CIMultiDictProxy (MultiMapping [_T ], Generic [ _T ] ):
9087 def __init__ (self , arg : Union [MultiMapping [_T ],
9188 MutableMultiMapping [_T ]]) -> None : ...
89+
9290 def copy (self ) -> CIMultiDictProxy [_T ]: ...
9391
9492 def __getitem__ (self , k : _S ) -> _T : ...
93+
9594 def __iter__ (self ) -> Iterator [_S ]: ...
95+
9696 def __len__ (self ) -> int : ...
9797
9898
0 commit comments