1- from _typeshed import MaybeNone
2- from collections .abc import Iterable , Mapping
1+ from _typeshed import MaybeNone , SupportsItems , SupportsKeysAndGetItem
2+ from collections .abc import Container , Iterable
33from types import GenericAlias
44from typing import Any , Generic , TypeVar , overload
5- from typing_extensions import TypeAlias
65
76__all__ = ["CookieError" , "BaseCookie" , "SimpleCookie" ]
87
9- _DataType : TypeAlias = str | Mapping [str , str | Morsel [Any ]]
108_T = TypeVar ("_T" )
119
1210@overload
@@ -31,27 +29,24 @@ class Morsel(dict[str, Any], Generic[_T]):
3129 def set (self , key : str , val : str , coded_val : _T ) -> None : ...
3230 def setdefault (self , key : str , val : str | None = None ) -> str : ...
3331 # The dict update can also get a keywords argument so this is incompatible
34- @overload # type: ignore[override]
35- def update (self , values : Mapping [str , str ]) -> None : ...
36- @overload
37- def update (self , values : Iterable [tuple [str , str ]]) -> None : ...
32+ def update (self , values : Iterable [tuple [str , str ]] | SupportsKeysAndGetItem [str , str ]) -> None : ... # type: ignore[override]
3833 def isReservedKey (self , K : str ) -> bool : ...
39- def output (self , attrs : list [str ] | None = None , header : str = "Set-Cookie:" ) -> str : ...
34+ def output (self , attrs : Container [str ] | None = None , header : str = "Set-Cookie:" ) -> str : ...
4035 __str__ = output
41- def js_output (self , attrs : list [str ] | None = None ) -> str : ...
42- def OutputString (self , attrs : list [str ] | None = None ) -> str : ...
36+ def js_output (self , attrs : Container [str ] | None = None ) -> str : ...
37+ def OutputString (self , attrs : Container [str ] | None = None ) -> str : ...
4338 def __eq__ (self , morsel : object ) -> bool : ...
4439 def __setitem__ (self , K : str , V : Any ) -> None : ...
4540 def __class_getitem__ (cls , item : Any , / ) -> GenericAlias : ...
4641
4742class BaseCookie (dict [str , Morsel [_T ]], Generic [_T ]):
48- def __init__ (self , input : _DataType | None = None ) -> None : ...
43+ def __init__ (self , input : str | SupportsItems [ str , str | Morsel [ Any ]] | None = None ) -> None : ...
4944 def value_decode (self , val : str ) -> tuple [_T , str ]: ...
5045 def value_encode (self , val : _T ) -> tuple [str , str ]: ...
51- def output (self , attrs : list [str ] | None = None , header : str = "Set-Cookie:" , sep : str = "\r \n " ) -> str : ...
46+ def output (self , attrs : Container [str ] | None = None , header : str = "Set-Cookie:" , sep : str = "\r \n " ) -> str : ...
5247 __str__ = output
53- def js_output (self , attrs : list [str ] | None = None ) -> str : ...
54- def load (self , rawdata : _DataType ) -> None : ...
48+ def js_output (self , attrs : Container [str ] | None = None ) -> str : ...
49+ def load (self , rawdata : str | SupportsItems [ str , str | Morsel [ Any ]] ) -> None : ...
5550 def __setitem__ (self , key : str , value : str | Morsel [_T ]) -> None : ...
5651
5752class SimpleCookie (BaseCookie [str ]): ...
0 commit comments