massive update, probably broken
[dotfiles/.git] / .config / coc / extensions / node_modules / coc-pyright / node_modules / pyright / dist / typeshed-fallback / stdlib / http / cookies.pyi
1 import sys
2 from typing import Any, Dict, Generic, Iterable, Mapping, TypeVar, Union, overload
3
4 if sys.version_info >= (3, 9):
5     from types import GenericAlias
6
7 _DataType = Union[str, Mapping[str, Union[str, Morsel[Any]]]]
8 _T = TypeVar("_T")
9
10 @overload
11 def _quote(str: None) -> None: ...
12 @overload
13 def _quote(str: str) -> str: ...
14 @overload
15 def _unquote(str: None) -> None: ...
16 @overload
17 def _unquote(str: str) -> str: ...
18
19 class CookieError(Exception): ...
20
21 class Morsel(Dict[str, Any], Generic[_T]):
22     value: str
23     coded_value: _T
24     key: str
25     def __init__(self) -> None: ...
26     if sys.version_info >= (3, 7):
27         def set(self, key: str, val: str, coded_val: _T) -> None: ...
28     else:
29         def set(self, key: str, val: str, coded_val: _T, LegalChars: str = ...) -> None: ...
30     def setdefault(self, key: str, val: str | None = ...) -> str: ...
31     # The dict update can also get a keywords argument so this is incompatible
32     @overload  # type: ignore
33     def update(self, values: Mapping[str, str]) -> None: ...
34     @overload
35     def update(self, values: Iterable[tuple[str, str]]) -> None: ...
36     def isReservedKey(self, K: str) -> bool: ...
37     def output(self, attrs: list[str] | None = ..., header: str = ...) -> str: ...
38     def js_output(self, attrs: list[str] | None = ...) -> str: ...
39     def OutputString(self, attrs: list[str] | None = ...) -> str: ...
40     if sys.version_info >= (3, 9):
41         def __class_getitem__(cls, item: Any) -> GenericAlias: ...
42
43 class BaseCookie(Dict[str, Morsel[_T]], Generic[_T]):
44     def __init__(self, input: _DataType | None = ...) -> None: ...
45     def value_decode(self, val: str) -> _T: ...
46     def value_encode(self, val: _T) -> str: ...
47     def output(self, attrs: list[str] | None = ..., header: str = ..., sep: str = ...) -> str: ...
48     def js_output(self, attrs: list[str] | None = ...) -> str: ...
49     def load(self, rawdata: _DataType) -> None: ...
50     def __setitem__(self, key: str, value: str | Morsel[_T]) -> None: ...
51
52 class SimpleCookie(BaseCookie[_T], Generic[_T]): ...