File size: 4,840 Bytes
065fee7 |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 |
import abc
from typing import (
Generic,
Iterable,
Iterator,
Mapping,
MutableMapping,
TypeVar,
overload,
)
class istr(str): ...
upstr = istr
_S = str | istr
_T = TypeVar("_T")
_T_co = TypeVar("_T_co", covariant=True)
_D = TypeVar("_D")
class MultiMapping(Mapping[_S, _T_co]):
@overload
@abc.abstractmethod
def getall(self, key: _S) -> list[_T_co]: ...
@overload
@abc.abstractmethod
def getall(self, key: _S, default: _D) -> list[_T_co] | _D: ...
@overload
@abc.abstractmethod
def getone(self, key: _S) -> _T_co: ...
@overload
@abc.abstractmethod
def getone(self, key: _S, default: _D) -> _T_co | _D: ...
_Arg = (
Mapping[str, _T]
| Mapping[istr, _T]
| dict[str, _T]
| dict[istr, _T]
| MultiMapping[_T]
| Iterable[tuple[str, _T]]
| Iterable[tuple[istr, _T]]
)
class MutableMultiMapping(MultiMapping[_T], MutableMapping[_S, _T], Generic[_T]):
@abc.abstractmethod
def add(self, key: _S, value: _T) -> None: ...
@abc.abstractmethod
def extend(self, arg: _Arg[_T] = ..., **kwargs: _T) -> None: ...
@overload
@abc.abstractmethod
def popone(self, key: _S) -> _T: ...
@overload
@abc.abstractmethod
def popone(self, key: _S, default: _D) -> _T | _D: ...
@overload
@abc.abstractmethod
def popall(self, key: _S) -> list[_T]: ...
@overload
@abc.abstractmethod
def popall(self, key: _S, default: _D) -> list[_T] | _D: ...
class MultiDict(MutableMultiMapping[_T], Generic[_T]):
def __init__(self, arg: _Arg[_T] = ..., **kwargs: _T) -> None: ...
def copy(self) -> MultiDict[_T]: ...
def __getitem__(self, k: _S) -> _T: ...
def __setitem__(self, k: _S, v: _T) -> None: ...
def __delitem__(self, v: _S) -> None: ...
def __iter__(self) -> Iterator[_S]: ...
def __len__(self) -> int: ...
@overload
def getall(self, key: _S) -> list[_T]: ...
@overload
def getall(self, key: _S, default: _D) -> list[_T] | _D: ...
@overload
def getone(self, key: _S) -> _T: ...
@overload
def getone(self, key: _S, default: _D) -> _T | _D: ...
def add(self, key: _S, value: _T) -> None: ...
def extend(self, arg: _Arg[_T] = ..., **kwargs: _T) -> None: ...
@overload
def popone(self, key: _S) -> _T: ...
@overload
def popone(self, key: _S, default: _D) -> _T | _D: ...
@overload
def popall(self, key: _S) -> list[_T]: ...
@overload
def popall(self, key: _S, default: _D) -> list[_T] | _D: ...
class CIMultiDict(MutableMultiMapping[_T], Generic[_T]):
def __init__(self, arg: _Arg[_T] = ..., **kwargs: _T) -> None: ...
def copy(self) -> CIMultiDict[_T]: ...
def __getitem__(self, k: _S) -> _T: ...
def __setitem__(self, k: _S, v: _T) -> None: ...
def __delitem__(self, v: _S) -> None: ...
def __iter__(self) -> Iterator[_S]: ...
def __len__(self) -> int: ...
@overload
def getall(self, key: _S) -> list[_T]: ...
@overload
def getall(self, key: _S, default: _D) -> list[_T] | _D: ...
@overload
def getone(self, key: _S) -> _T: ...
@overload
def getone(self, key: _S, default: _D) -> _T | _D: ...
def add(self, key: _S, value: _T) -> None: ...
def extend(self, arg: _Arg[_T] = ..., **kwargs: _T) -> None: ...
@overload
def popone(self, key: _S) -> _T: ...
@overload
def popone(self, key: _S, default: _D) -> _T | _D: ...
@overload
def popall(self, key: _S) -> list[_T]: ...
@overload
def popall(self, key: _S, default: _D) -> list[_T] | _D: ...
class MultiDictProxy(MultiMapping[_T], Generic[_T]):
def __init__(self, arg: MultiMapping[_T] | MutableMultiMapping[_T]) -> None: ...
def copy(self) -> MultiDict[_T]: ...
def __getitem__(self, k: _S) -> _T: ...
def __iter__(self) -> Iterator[_S]: ...
def __len__(self) -> int: ...
@overload
def getall(self, key: _S) -> list[_T]: ...
@overload
def getall(self, key: _S, default: _D) -> list[_T] | _D: ...
@overload
def getone(self, key: _S) -> _T: ...
@overload
def getone(self, key: _S, default: _D) -> _T | _D: ...
class CIMultiDictProxy(MultiMapping[_T], Generic[_T]):
def __init__(self, arg: MultiMapping[_T] | MutableMultiMapping[_T]) -> None: ...
def __getitem__(self, k: _S) -> _T: ...
def __iter__(self) -> Iterator[_S]: ...
def __len__(self) -> int: ...
@overload
def getall(self, key: _S) -> list[_T]: ...
@overload
def getall(self, key: _S, default: _D) -> list[_T] | _D: ...
@overload
def getone(self, key: _S) -> _T: ...
@overload
def getone(self, key: _S, default: _D) -> _T | _D: ...
def copy(self) -> CIMultiDict[_T]: ...
def getversion(
md: MultiDict[_T] | CIMultiDict[_T] | MultiDictProxy[_T] | CIMultiDictProxy[_T],
) -> int: ...
|