datastructures.pyi 34 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921
  1. from datetime import datetime
  2. from os import PathLike
  3. from typing import Any
  4. from typing import Callable
  5. from typing import Collection
  6. from typing import Dict
  7. from typing import FrozenSet
  8. from typing import Generic
  9. from typing import Hashable
  10. from typing import IO
  11. from typing import Iterable
  12. from typing import Iterator
  13. from typing import List
  14. from typing import Mapping
  15. from typing import NoReturn
  16. from typing import Optional
  17. from typing import overload
  18. from typing import Set
  19. from typing import Tuple
  20. from typing import Type
  21. from typing import TypeVar
  22. from typing import Union
  23. from _typeshed import SupportsKeysAndGetItem
  24. from _typeshed.wsgi import WSGIEnvironment
  25. from typing_extensions import Literal
  26. from typing_extensions import SupportsIndex
  27. K = TypeVar("K")
  28. V = TypeVar("V")
  29. T = TypeVar("T")
  30. D = TypeVar("D")
  31. _CD = TypeVar("_CD", bound="CallbackDict")
  32. def is_immutable(self: object) -> NoReturn: ...
  33. def iter_multi_items(
  34. mapping: Union[Mapping[K, Union[V, Iterable[V]]], Iterable[Tuple[K, V]]]
  35. ) -> Iterator[Tuple[K, V]]: ...
  36. class ImmutableListMixin(List[V]):
  37. _hash_cache: Optional[int]
  38. def __hash__(self) -> int: ... # type: ignore
  39. def __delitem__(self, key: Union[SupportsIndex, slice]) -> NoReturn: ...
  40. def __iadd__(self, other: t.Any) -> NoReturn: ... # type: ignore
  41. def __imul__(self, other: SupportsIndex) -> NoReturn: ...
  42. def __setitem__( # type: ignore
  43. self, key: Union[int, slice], value: V
  44. ) -> NoReturn: ...
  45. def append(self, value: V) -> NoReturn: ...
  46. def remove(self, value: V) -> NoReturn: ...
  47. def extend(self, values: Iterable[V]) -> NoReturn: ...
  48. def insert(self, pos: SupportsIndex, value: V) -> NoReturn: ...
  49. def pop(self, index: SupportsIndex = -1) -> NoReturn: ...
  50. def reverse(self) -> NoReturn: ...
  51. def sort(
  52. self, key: Optional[Callable[[V], Any]] = None, reverse: bool = False
  53. ) -> NoReturn: ...
  54. class ImmutableList(ImmutableListMixin[V]): ...
  55. class ImmutableDictMixin(Dict[K, V]):
  56. _hash_cache: Optional[int]
  57. @classmethod
  58. def fromkeys( # type: ignore
  59. cls, keys: Iterable[K], value: Optional[V] = None
  60. ) -> ImmutableDictMixin[K, V]: ...
  61. def _iter_hashitems(self) -> Iterable[Hashable]: ...
  62. def __hash__(self) -> int: ... # type: ignore
  63. def setdefault(self, key: K, default: Optional[V] = None) -> NoReturn: ...
  64. def update(self, *args: Any, **kwargs: V) -> NoReturn: ...
  65. def pop(self, key: K, default: Optional[V] = None) -> NoReturn: ... # type: ignore
  66. def popitem(self) -> NoReturn: ...
  67. def __setitem__(self, key: K, value: V) -> NoReturn: ...
  68. def __delitem__(self, key: K) -> NoReturn: ...
  69. def clear(self) -> NoReturn: ...
  70. class ImmutableMultiDictMixin(ImmutableDictMixin[K, V]):
  71. def _iter_hashitems(self) -> Iterable[Hashable]: ...
  72. def add(self, key: K, value: V) -> NoReturn: ...
  73. def popitemlist(self) -> NoReturn: ...
  74. def poplist(self, key: K) -> NoReturn: ...
  75. def setlist(self, key: K, new_list: Iterable[V]) -> NoReturn: ...
  76. def setlistdefault(
  77. self, key: K, default_list: Optional[Iterable[V]] = None
  78. ) -> NoReturn: ...
  79. def _calls_update(name: str) -> Callable[[UpdateDictMixin[K, V]], Any]: ...
  80. class UpdateDictMixin(Dict[K, V]):
  81. on_update: Optional[Callable[[UpdateDictMixin[K, V]], None]]
  82. def setdefault(self, key: K, default: Optional[V] = None) -> V: ...
  83. @overload
  84. def pop(self, key: K) -> V: ...
  85. @overload
  86. def pop(self, key: K, default: Union[V, T] = ...) -> Union[V, T]: ...
  87. def __setitem__(self, key: K, value: V) -> None: ...
  88. def __delitem__(self, key: K) -> None: ...
  89. def clear(self) -> None: ...
  90. def popitem(self) -> Tuple[K, V]: ...
  91. @overload
  92. def update(self, __m: SupportsKeysAndGetItem[K, V], **kwargs: V) -> None: ...
  93. @overload
  94. def update(self, __m: Iterable[Tuple[K, V]], **kwargs: V) -> None: ...
  95. @overload
  96. def update(self, **kwargs: V) -> None: ...
  97. class TypeConversionDict(Dict[K, V]):
  98. @overload
  99. def get(self, key: K, default: None = ..., type: None = ...) -> Optional[V]: ...
  100. @overload
  101. def get(self, key: K, default: D, type: None = ...) -> Union[D, V]: ...
  102. @overload
  103. def get(self, key: K, default: D, type: Callable[[V], T]) -> Union[D, T]: ...
  104. @overload
  105. def get(self, key: K, type: Callable[[V], T]) -> Optional[T]: ...
  106. class ImmutableTypeConversionDict(ImmutableDictMixin[K, V], TypeConversionDict[K, V]):
  107. def copy(self) -> TypeConversionDict[K, V]: ...
  108. def __copy__(self) -> ImmutableTypeConversionDict: ...
  109. class MultiDict(TypeConversionDict[K, V]):
  110. def __init__(
  111. self,
  112. mapping: Optional[
  113. Union[Mapping[K, Union[Iterable[V], V]], Iterable[Tuple[K, V]]]
  114. ] = None,
  115. ) -> None: ...
  116. def __getitem__(self, item: K) -> V: ...
  117. def __setitem__(self, key: K, value: V) -> None: ...
  118. def add(self, key: K, value: V) -> None: ...
  119. @overload
  120. def getlist(self, key: K) -> List[V]: ...
  121. @overload
  122. def getlist(self, key: K, type: Callable[[V], T] = ...) -> List[T]: ...
  123. def setlist(self, key: K, new_list: Iterable[V]) -> None: ...
  124. def setdefault(self, key: K, default: Optional[V] = None) -> V: ...
  125. def setlistdefault(
  126. self, key: K, default_list: Optional[Iterable[V]] = None
  127. ) -> List[V]: ...
  128. def items(self, multi: bool = False) -> Iterator[Tuple[K, V]]: ... # type: ignore
  129. def lists(self) -> Iterator[Tuple[K, List[V]]]: ...
  130. def values(self) -> Iterator[V]: ... # type: ignore
  131. def listvalues(self) -> Iterator[List[V]]: ...
  132. def copy(self) -> MultiDict[K, V]: ...
  133. def deepcopy(self, memo: Any = None) -> MultiDict[K, V]: ...
  134. @overload
  135. def to_dict(self) -> Dict[K, V]: ...
  136. @overload
  137. def to_dict(self, flat: Literal[False]) -> Dict[K, List[V]]: ...
  138. def update( # type: ignore
  139. self, mapping: Union[Mapping[K, Union[Iterable[V], V]], Iterable[Tuple[K, V]]]
  140. ) -> None: ...
  141. @overload
  142. def pop(self, key: K) -> V: ...
  143. @overload
  144. def pop(self, key: K, default: Union[V, T] = ...) -> Union[V, T]: ...
  145. def popitem(self) -> Tuple[K, V]: ...
  146. def poplist(self, key: K) -> List[V]: ...
  147. def popitemlist(self) -> Tuple[K, List[V]]: ...
  148. def __copy__(self) -> MultiDict[K, V]: ...
  149. def __deepcopy__(self, memo: Any) -> MultiDict[K, V]: ...
  150. class _omd_bucket(Generic[K, V]):
  151. prev: Optional[_omd_bucket]
  152. next: Optional[_omd_bucket]
  153. key: K
  154. value: V
  155. def __init__(self, omd: OrderedMultiDict, key: K, value: V) -> None: ...
  156. def unlink(self, omd: OrderedMultiDict) -> None: ...
  157. class OrderedMultiDict(MultiDict[K, V]):
  158. _first_bucket: Optional[_omd_bucket]
  159. _last_bucket: Optional[_omd_bucket]
  160. def __init__(self, mapping: Optional[Mapping[K, V]] = None) -> None: ...
  161. def __eq__(self, other: object) -> bool: ...
  162. def __getitem__(self, key: K) -> V: ...
  163. def __setitem__(self, key: K, value: V) -> None: ...
  164. def __delitem__(self, key: K) -> None: ...
  165. def keys(self) -> Iterator[K]: ... # type: ignore
  166. def __iter__(self) -> Iterator[K]: ...
  167. def values(self) -> Iterator[V]: ... # type: ignore
  168. def items(self, multi: bool = False) -> Iterator[Tuple[K, V]]: ... # type: ignore
  169. def lists(self) -> Iterator[Tuple[K, List[V]]]: ...
  170. def listvalues(self) -> Iterator[List[V]]: ...
  171. def add(self, key: K, value: V) -> None: ...
  172. @overload
  173. def getlist(self, key: K) -> List[V]: ...
  174. @overload
  175. def getlist(self, key: K, type: Callable[[V], T] = ...) -> List[T]: ...
  176. def setlist(self, key: K, new_list: Iterable[V]) -> None: ...
  177. def setlistdefault(
  178. self, key: K, default_list: Optional[Iterable[V]] = None
  179. ) -> List[V]: ...
  180. def update( # type: ignore
  181. self, mapping: Union[Mapping[K, V], Iterable[Tuple[K, V]]]
  182. ) -> None: ...
  183. def poplist(self, key: K) -> List[V]: ...
  184. @overload
  185. def pop(self, key: K) -> V: ...
  186. @overload
  187. def pop(self, key: K, default: Union[V, T] = ...) -> Union[V, T]: ...
  188. def popitem(self) -> Tuple[K, V]: ...
  189. def popitemlist(self) -> Tuple[K, List[V]]: ...
  190. def _options_header_vkw(
  191. value: str, kw: Mapping[str, Optional[Union[str, int]]]
  192. ) -> str: ...
  193. def _unicodify_header_value(value: Union[str, int]) -> str: ...
  194. HV = Union[str, int]
  195. class Headers(Dict[str, str]):
  196. _list: List[Tuple[str, str]]
  197. def __init__(
  198. self,
  199. defaults: Optional[
  200. Union[Mapping[str, Union[HV, Iterable[HV]]], Iterable[Tuple[str, HV]]]
  201. ] = None,
  202. ) -> None: ...
  203. @overload
  204. def __getitem__(self, key: str) -> str: ...
  205. @overload
  206. def __getitem__(self, key: int) -> Tuple[str, str]: ...
  207. @overload
  208. def __getitem__(self, key: slice) -> Headers: ...
  209. @overload
  210. def __getitem__(self, key: str, _get_mode: Literal[True] = ...) -> str: ...
  211. def __eq__(self, other: object) -> bool: ...
  212. @overload # type: ignore
  213. def get(self, key: str, default: str) -> str: ...
  214. @overload
  215. def get(self, key: str, default: Optional[str] = None) -> Optional[str]: ...
  216. @overload
  217. def get(
  218. self, key: str, default: Optional[T] = None, type: Callable[[str], T] = ...
  219. ) -> Optional[T]: ...
  220. @overload
  221. def getlist(self, key: str) -> List[str]: ...
  222. @overload
  223. def getlist(self, key: str, type: Callable[[str], T]) -> List[T]: ...
  224. def get_all(self, name: str) -> List[str]: ...
  225. def items( # type: ignore
  226. self, lower: bool = False
  227. ) -> Iterator[Tuple[str, str]]: ...
  228. def keys(self, lower: bool = False) -> Iterator[str]: ... # type: ignore
  229. def values(self) -> Iterator[str]: ... # type: ignore
  230. def extend(
  231. self,
  232. *args: Union[Mapping[str, Union[HV, Iterable[HV]]], Iterable[Tuple[str, HV]]],
  233. **kwargs: Union[HV, Iterable[HV]],
  234. ) -> None: ...
  235. @overload
  236. def __delitem__(self, key: Union[str, int, slice]) -> None: ...
  237. @overload
  238. def __delitem__(self, key: str, _index_operation: Literal[False]) -> None: ...
  239. def remove(self, key: str) -> None: ...
  240. @overload # type: ignore
  241. def pop(self, key: str, default: Optional[str] = None) -> str: ...
  242. @overload
  243. def pop(
  244. self, key: Optional[int] = None, default: Optional[Tuple[str, str]] = None
  245. ) -> Tuple[str, str]: ...
  246. def popitem(self) -> Tuple[str, str]: ...
  247. def __contains__(self, key: str) -> bool: ... # type: ignore
  248. def has_key(self, key: str) -> bool: ...
  249. def __iter__(self) -> Iterator[Tuple[str, str]]: ... # type: ignore
  250. def add(self, _key: str, _value: HV, **kw: HV) -> None: ...
  251. def _validate_value(self, value: str) -> None: ...
  252. def add_header(self, _key: str, _value: HV, **_kw: HV) -> None: ...
  253. def clear(self) -> None: ...
  254. def set(self, _key: str, _value: HV, **kw: HV) -> None: ...
  255. def setlist(self, key: str, values: Iterable[HV]) -> None: ...
  256. def setdefault(self, key: str, default: HV) -> str: ... # type: ignore
  257. def setlistdefault(self, key: str, default: Iterable[HV]) -> None: ...
  258. @overload
  259. def __setitem__(self, key: str, value: HV) -> None: ...
  260. @overload
  261. def __setitem__(self, key: int, value: Tuple[str, HV]) -> None: ...
  262. @overload
  263. def __setitem__(self, key: slice, value: Iterable[Tuple[str, HV]]) -> None: ...
  264. @overload
  265. def update(
  266. self, __m: SupportsKeysAndGetItem[str, HV], **kwargs: Union[HV, Iterable[HV]]
  267. ) -> None: ...
  268. @overload
  269. def update(
  270. self, __m: Iterable[Tuple[str, HV]], **kwargs: Union[HV, Iterable[HV]]
  271. ) -> None: ...
  272. @overload
  273. def update(self, **kwargs: Union[HV, Iterable[HV]]) -> None: ...
  274. def to_wsgi_list(self) -> List[Tuple[str, str]]: ...
  275. def copy(self) -> Headers: ...
  276. def __copy__(self) -> Headers: ...
  277. class ImmutableHeadersMixin(Headers):
  278. def __delitem__(self, key: Any, _index_operation: bool = True) -> NoReturn: ...
  279. def __setitem__(self, key: Any, value: Any) -> NoReturn: ...
  280. def set(self, _key: Any, _value: Any, **kw: Any) -> NoReturn: ...
  281. def setlist(self, key: Any, values: Any) -> NoReturn: ...
  282. def add(self, _key: Any, _value: Any, **kw: Any) -> NoReturn: ...
  283. def add_header(self, _key: Any, _value: Any, **_kw: Any) -> NoReturn: ...
  284. def remove(self, key: Any) -> NoReturn: ...
  285. def extend(self, *args: Any, **kwargs: Any) -> NoReturn: ...
  286. def update(self, *args: Any, **kwargs: Any) -> NoReturn: ...
  287. def insert(self, pos: Any, value: Any) -> NoReturn: ...
  288. def pop(self, key: Any = None, default: Any = ...) -> NoReturn: ...
  289. def popitem(self) -> NoReturn: ...
  290. def setdefault(self, key: Any, default: Any) -> NoReturn: ... # type: ignore
  291. def setlistdefault(self, key: Any, default: Any) -> NoReturn: ...
  292. class EnvironHeaders(ImmutableHeadersMixin, Headers):
  293. environ: WSGIEnvironment
  294. def __init__(self, environ: WSGIEnvironment) -> None: ...
  295. def __eq__(self, other: object) -> bool: ...
  296. def __getitem__( # type: ignore
  297. self, key: str, _get_mode: Literal[False] = False
  298. ) -> str: ...
  299. def __iter__(self) -> Iterator[Tuple[str, str]]: ... # type: ignore
  300. def copy(self) -> NoReturn: ...
  301. class CombinedMultiDict(ImmutableMultiDictMixin[K, V], MultiDict[K, V]): # type: ignore
  302. dicts: List[MultiDict[K, V]]
  303. def __init__(self, dicts: Optional[Iterable[MultiDict[K, V]]]) -> None: ...
  304. @classmethod
  305. def fromkeys(cls, keys: Any, value: Any = None) -> NoReturn: ...
  306. def __getitem__(self, key: K) -> V: ...
  307. @overload # type: ignore
  308. def get(self, key: K) -> Optional[V]: ...
  309. @overload
  310. def get(self, key: K, default: Union[V, T] = ...) -> Union[V, T]: ...
  311. @overload
  312. def get(
  313. self, key: K, default: Optional[T] = None, type: Callable[[V], T] = ...
  314. ) -> Optional[T]: ...
  315. @overload
  316. def getlist(self, key: K) -> List[V]: ...
  317. @overload
  318. def getlist(self, key: K, type: Callable[[V], T] = ...) -> List[T]: ...
  319. def _keys_impl(self) -> Set[K]: ...
  320. def keys(self) -> Set[K]: ... # type: ignore
  321. def __iter__(self) -> Set[K]: ... # type: ignore
  322. def items(self, multi: bool = False) -> Iterator[Tuple[K, V]]: ... # type: ignore
  323. def values(self) -> Iterator[V]: ... # type: ignore
  324. def lists(self) -> Iterator[Tuple[K, List[V]]]: ...
  325. def listvalues(self) -> Iterator[List[V]]: ...
  326. def copy(self) -> MultiDict[K, V]: ...
  327. @overload
  328. def to_dict(self) -> Dict[K, V]: ...
  329. @overload
  330. def to_dict(self, flat: Literal[False]) -> Dict[K, List[V]]: ...
  331. def __contains__(self, key: K) -> bool: ... # type: ignore
  332. def has_key(self, key: K) -> bool: ...
  333. class FileMultiDict(MultiDict[str, "FileStorage"]):
  334. def add_file(
  335. self,
  336. name: str,
  337. file: Union[FileStorage, str, IO[bytes]],
  338. filename: Optional[str] = None,
  339. content_type: Optional[str] = None,
  340. ) -> None: ...
  341. class ImmutableDict(ImmutableDictMixin[K, V], Dict[K, V]):
  342. def copy(self) -> Dict[K, V]: ...
  343. def __copy__(self) -> ImmutableDict[K, V]: ...
  344. class ImmutableMultiDict( # type: ignore
  345. ImmutableMultiDictMixin[K, V], MultiDict[K, V]
  346. ):
  347. def copy(self) -> MultiDict[K, V]: ...
  348. def __copy__(self) -> ImmutableMultiDict[K, V]: ...
  349. class ImmutableOrderedMultiDict( # type: ignore
  350. ImmutableMultiDictMixin[K, V], OrderedMultiDict[K, V]
  351. ):
  352. def _iter_hashitems(self) -> Iterator[Tuple[int, Tuple[K, V]]]: ...
  353. def copy(self) -> OrderedMultiDict[K, V]: ...
  354. def __copy__(self) -> ImmutableOrderedMultiDict[K, V]: ...
  355. class Accept(ImmutableList[Tuple[str, int]]):
  356. provided: bool
  357. def __init__(
  358. self, values: Optional[Union[Accept, Iterable[Tuple[str, float]]]] = None
  359. ) -> None: ...
  360. def _specificity(self, value: str) -> Tuple[bool, ...]: ...
  361. def _value_matches(self, value: str, item: str) -> bool: ...
  362. @overload # type: ignore
  363. def __getitem__(self, key: str) -> int: ...
  364. @overload
  365. def __getitem__(self, key: int) -> Tuple[str, int]: ...
  366. @overload
  367. def __getitem__(self, key: slice) -> Iterable[Tuple[str, int]]: ...
  368. def quality(self, key: str) -> int: ...
  369. def __contains__(self, value: str) -> bool: ... # type: ignore
  370. def index(self, key: str) -> int: ... # type: ignore
  371. def find(self, key: str) -> int: ...
  372. def values(self) -> Iterator[str]: ...
  373. def to_header(self) -> str: ...
  374. def _best_single_match(self, match: str) -> Optional[Tuple[str, int]]: ...
  375. def best_match(
  376. self, matches: Iterable[str], default: Optional[str] = None
  377. ) -> Optional[str]: ...
  378. @property
  379. def best(self) -> str: ...
  380. def _normalize_mime(value: str) -> List[str]: ...
  381. class MIMEAccept(Accept):
  382. def _specificity(self, value: str) -> Tuple[bool, ...]: ...
  383. def _value_matches(self, value: str, item: str) -> bool: ...
  384. @property
  385. def accept_html(self) -> bool: ...
  386. @property
  387. def accept_xhtml(self) -> bool: ...
  388. @property
  389. def accept_json(self) -> bool: ...
  390. def _normalize_lang(value: str) -> List[str]: ...
  391. class LanguageAccept(Accept):
  392. def _value_matches(self, value: str, item: str) -> bool: ...
  393. def best_match(
  394. self, matches: Iterable[str], default: Optional[str] = None
  395. ) -> Optional[str]: ...
  396. class CharsetAccept(Accept):
  397. def _value_matches(self, value: str, item: str) -> bool: ...
  398. _CPT = TypeVar("_CPT", str, int, bool)
  399. _OptCPT = Optional[_CPT]
  400. def cache_control_property(key: str, empty: _OptCPT, type: Type[_CPT]) -> property: ...
  401. class _CacheControl(UpdateDictMixin[str, _OptCPT], Dict[str, _OptCPT]):
  402. provided: bool
  403. def __init__(
  404. self,
  405. values: Union[Mapping[str, _OptCPT], Iterable[Tuple[str, _OptCPT]]] = (),
  406. on_update: Optional[Callable[[_CacheControl], None]] = None,
  407. ) -> None: ...
  408. @property
  409. def no_cache(self) -> Optional[bool]: ...
  410. @no_cache.setter
  411. def no_cache(self, value: Optional[bool]) -> None: ...
  412. @no_cache.deleter
  413. def no_cache(self) -> None: ...
  414. @property
  415. def no_store(self) -> Optional[bool]: ...
  416. @no_store.setter
  417. def no_store(self, value: Optional[bool]) -> None: ...
  418. @no_store.deleter
  419. def no_store(self) -> None: ...
  420. @property
  421. def max_age(self) -> Optional[int]: ...
  422. @max_age.setter
  423. def max_age(self, value: Optional[int]) -> None: ...
  424. @max_age.deleter
  425. def max_age(self) -> None: ...
  426. @property
  427. def no_transform(self) -> Optional[bool]: ...
  428. @no_transform.setter
  429. def no_transform(self, value: Optional[bool]) -> None: ...
  430. @no_transform.deleter
  431. def no_transform(self) -> None: ...
  432. def _get_cache_value(self, key: str, empty: Optional[T], type: Type[T]) -> T: ...
  433. def _set_cache_value(self, key: str, value: Optional[T], type: Type[T]) -> None: ...
  434. def _del_cache_value(self, key: str) -> None: ...
  435. def to_header(self) -> str: ...
  436. @staticmethod
  437. def cache_property(key: str, empty: _OptCPT, type: Type[_CPT]) -> property: ...
  438. class RequestCacheControl(ImmutableDictMixin[str, _OptCPT], _CacheControl):
  439. @property
  440. def max_stale(self) -> Optional[int]: ...
  441. @max_stale.setter
  442. def max_stale(self, value: Optional[int]) -> None: ...
  443. @max_stale.deleter
  444. def max_stale(self) -> None: ...
  445. @property
  446. def min_fresh(self) -> Optional[int]: ...
  447. @min_fresh.setter
  448. def min_fresh(self, value: Optional[int]) -> None: ...
  449. @min_fresh.deleter
  450. def min_fresh(self) -> None: ...
  451. @property
  452. def only_if_cached(self) -> Optional[bool]: ...
  453. @only_if_cached.setter
  454. def only_if_cached(self, value: Optional[bool]) -> None: ...
  455. @only_if_cached.deleter
  456. def only_if_cached(self) -> None: ...
  457. class ResponseCacheControl(_CacheControl):
  458. @property
  459. def public(self) -> Optional[bool]: ...
  460. @public.setter
  461. def public(self, value: Optional[bool]) -> None: ...
  462. @public.deleter
  463. def public(self) -> None: ...
  464. @property
  465. def private(self) -> Optional[bool]: ...
  466. @private.setter
  467. def private(self, value: Optional[bool]) -> None: ...
  468. @private.deleter
  469. def private(self) -> None: ...
  470. @property
  471. def must_revalidate(self) -> Optional[bool]: ...
  472. @must_revalidate.setter
  473. def must_revalidate(self, value: Optional[bool]) -> None: ...
  474. @must_revalidate.deleter
  475. def must_revalidate(self) -> None: ...
  476. @property
  477. def proxy_revalidate(self) -> Optional[bool]: ...
  478. @proxy_revalidate.setter
  479. def proxy_revalidate(self, value: Optional[bool]) -> None: ...
  480. @proxy_revalidate.deleter
  481. def proxy_revalidate(self) -> None: ...
  482. @property
  483. def s_maxage(self) -> Optional[int]: ...
  484. @s_maxage.setter
  485. def s_maxage(self, value: Optional[int]) -> None: ...
  486. @s_maxage.deleter
  487. def s_maxage(self) -> None: ...
  488. @property
  489. def immutable(self) -> Optional[bool]: ...
  490. @immutable.setter
  491. def immutable(self, value: Optional[bool]) -> None: ...
  492. @immutable.deleter
  493. def immutable(self) -> None: ...
  494. def csp_property(key: str) -> property: ...
  495. class ContentSecurityPolicy(UpdateDictMixin[str, str], Dict[str, str]):
  496. @property
  497. def base_uri(self) -> Optional[str]: ...
  498. @base_uri.setter
  499. def base_uri(self, value: Optional[str]) -> None: ...
  500. @base_uri.deleter
  501. def base_uri(self) -> None: ...
  502. @property
  503. def child_src(self) -> Optional[str]: ...
  504. @child_src.setter
  505. def child_src(self, value: Optional[str]) -> None: ...
  506. @child_src.deleter
  507. def child_src(self) -> None: ...
  508. @property
  509. def connect_src(self) -> Optional[str]: ...
  510. @connect_src.setter
  511. def connect_src(self, value: Optional[str]) -> None: ...
  512. @connect_src.deleter
  513. def connect_src(self) -> None: ...
  514. @property
  515. def default_src(self) -> Optional[str]: ...
  516. @default_src.setter
  517. def default_src(self, value: Optional[str]) -> None: ...
  518. @default_src.deleter
  519. def default_src(self) -> None: ...
  520. @property
  521. def font_src(self) -> Optional[str]: ...
  522. @font_src.setter
  523. def font_src(self, value: Optional[str]) -> None: ...
  524. @font_src.deleter
  525. def font_src(self) -> None: ...
  526. @property
  527. def form_action(self) -> Optional[str]: ...
  528. @form_action.setter
  529. def form_action(self, value: Optional[str]) -> None: ...
  530. @form_action.deleter
  531. def form_action(self) -> None: ...
  532. @property
  533. def frame_ancestors(self) -> Optional[str]: ...
  534. @frame_ancestors.setter
  535. def frame_ancestors(self, value: Optional[str]) -> None: ...
  536. @frame_ancestors.deleter
  537. def frame_ancestors(self) -> None: ...
  538. @property
  539. def frame_src(self) -> Optional[str]: ...
  540. @frame_src.setter
  541. def frame_src(self, value: Optional[str]) -> None: ...
  542. @frame_src.deleter
  543. def frame_src(self) -> None: ...
  544. @property
  545. def img_src(self) -> Optional[str]: ...
  546. @img_src.setter
  547. def img_src(self, value: Optional[str]) -> None: ...
  548. @img_src.deleter
  549. def img_src(self) -> None: ...
  550. @property
  551. def manifest_src(self) -> Optional[str]: ...
  552. @manifest_src.setter
  553. def manifest_src(self, value: Optional[str]) -> None: ...
  554. @manifest_src.deleter
  555. def manifest_src(self) -> None: ...
  556. @property
  557. def media_src(self) -> Optional[str]: ...
  558. @media_src.setter
  559. def media_src(self, value: Optional[str]) -> None: ...
  560. @media_src.deleter
  561. def media_src(self) -> None: ...
  562. @property
  563. def navigate_to(self) -> Optional[str]: ...
  564. @navigate_to.setter
  565. def navigate_to(self, value: Optional[str]) -> None: ...
  566. @navigate_to.deleter
  567. def navigate_to(self) -> None: ...
  568. @property
  569. def object_src(self) -> Optional[str]: ...
  570. @object_src.setter
  571. def object_src(self, value: Optional[str]) -> None: ...
  572. @object_src.deleter
  573. def object_src(self) -> None: ...
  574. @property
  575. def prefetch_src(self) -> Optional[str]: ...
  576. @prefetch_src.setter
  577. def prefetch_src(self, value: Optional[str]) -> None: ...
  578. @prefetch_src.deleter
  579. def prefetch_src(self) -> None: ...
  580. @property
  581. def plugin_types(self) -> Optional[str]: ...
  582. @plugin_types.setter
  583. def plugin_types(self, value: Optional[str]) -> None: ...
  584. @plugin_types.deleter
  585. def plugin_types(self) -> None: ...
  586. @property
  587. def report_to(self) -> Optional[str]: ...
  588. @report_to.setter
  589. def report_to(self, value: Optional[str]) -> None: ...
  590. @report_to.deleter
  591. def report_to(self) -> None: ...
  592. @property
  593. def report_uri(self) -> Optional[str]: ...
  594. @report_uri.setter
  595. def report_uri(self, value: Optional[str]) -> None: ...
  596. @report_uri.deleter
  597. def report_uri(self) -> None: ...
  598. @property
  599. def sandbox(self) -> Optional[str]: ...
  600. @sandbox.setter
  601. def sandbox(self, value: Optional[str]) -> None: ...
  602. @sandbox.deleter
  603. def sandbox(self) -> None: ...
  604. @property
  605. def script_src(self) -> Optional[str]: ...
  606. @script_src.setter
  607. def script_src(self, value: Optional[str]) -> None: ...
  608. @script_src.deleter
  609. def script_src(self) -> None: ...
  610. @property
  611. def script_src_attr(self) -> Optional[str]: ...
  612. @script_src_attr.setter
  613. def script_src_attr(self, value: Optional[str]) -> None: ...
  614. @script_src_attr.deleter
  615. def script_src_attr(self) -> None: ...
  616. @property
  617. def script_src_elem(self) -> Optional[str]: ...
  618. @script_src_elem.setter
  619. def script_src_elem(self, value: Optional[str]) -> None: ...
  620. @script_src_elem.deleter
  621. def script_src_elem(self) -> None: ...
  622. @property
  623. def style_src(self) -> Optional[str]: ...
  624. @style_src.setter
  625. def style_src(self, value: Optional[str]) -> None: ...
  626. @style_src.deleter
  627. def style_src(self) -> None: ...
  628. @property
  629. def style_src_attr(self) -> Optional[str]: ...
  630. @style_src_attr.setter
  631. def style_src_attr(self, value: Optional[str]) -> None: ...
  632. @style_src_attr.deleter
  633. def style_src_attr(self) -> None: ...
  634. @property
  635. def style_src_elem(self) -> Optional[str]: ...
  636. @style_src_elem.setter
  637. def style_src_elem(self, value: Optional[str]) -> None: ...
  638. @style_src_elem.deleter
  639. def style_src_elem(self) -> None: ...
  640. @property
  641. def worker_src(self) -> Optional[str]: ...
  642. @worker_src.setter
  643. def worker_src(self, value: Optional[str]) -> None: ...
  644. @worker_src.deleter
  645. def worker_src(self) -> None: ...
  646. provided: bool
  647. def __init__(
  648. self,
  649. values: Union[Mapping[str, str], Iterable[Tuple[str, str]]] = (),
  650. on_update: Optional[Callable[[ContentSecurityPolicy], None]] = None,
  651. ) -> None: ...
  652. def _get_value(self, key: str) -> Optional[str]: ...
  653. def _set_value(self, key: str, value: str) -> None: ...
  654. def _del_value(self, key: str) -> None: ...
  655. def to_header(self) -> str: ...
  656. class CallbackDict(UpdateDictMixin[K, V], Dict[K, V]):
  657. def __init__(
  658. self,
  659. initial: Optional[Union[Mapping[K, V], Iterable[Tuple[K, V]]]] = None,
  660. on_update: Optional[Callable[[_CD], None]] = None,
  661. ) -> None: ...
  662. class HeaderSet(Set[str]):
  663. _headers: List[str]
  664. _set: Set[str]
  665. on_update: Optional[Callable[[HeaderSet], None]]
  666. def __init__(
  667. self,
  668. headers: Optional[Iterable[str]] = None,
  669. on_update: Optional[Callable[[HeaderSet], None]] = None,
  670. ) -> None: ...
  671. def add(self, header: str) -> None: ...
  672. def remove(self, header: str) -> None: ...
  673. def update(self, iterable: Iterable[str]) -> None: ... # type: ignore
  674. def discard(self, header: str) -> None: ...
  675. def find(self, header: str) -> int: ...
  676. def index(self, header: str) -> int: ...
  677. def clear(self) -> None: ...
  678. def as_set(self, preserve_casing: bool = False) -> Set[str]: ...
  679. def to_header(self) -> str: ...
  680. def __getitem__(self, idx: int) -> str: ...
  681. def __delitem__(self, idx: int) -> None: ...
  682. def __setitem__(self, idx: int, value: str) -> None: ...
  683. def __contains__(self, header: str) -> bool: ... # type: ignore
  684. def __len__(self) -> int: ...
  685. def __iter__(self) -> Iterator[str]: ...
  686. class ETags(Collection[str]):
  687. _strong: FrozenSet[str]
  688. _weak: FrozenSet[str]
  689. star_tag: bool
  690. def __init__(
  691. self,
  692. strong_etags: Optional[Iterable[str]] = None,
  693. weak_etags: Optional[Iterable[str]] = None,
  694. star_tag: bool = False,
  695. ) -> None: ...
  696. def as_set(self, include_weak: bool = False) -> Set[str]: ...
  697. def is_weak(self, etag: str) -> bool: ...
  698. def is_strong(self, etag: str) -> bool: ...
  699. def contains_weak(self, etag: str) -> bool: ...
  700. def contains(self, etag: str) -> bool: ...
  701. def contains_raw(self, etag: str) -> bool: ...
  702. def to_header(self) -> str: ...
  703. def __call__(
  704. self,
  705. etag: Optional[str] = None,
  706. data: Optional[bytes] = None,
  707. include_weak: bool = False,
  708. ) -> bool: ...
  709. def __len__(self) -> int: ...
  710. def __iter__(self) -> Iterator[str]: ...
  711. def __contains__(self, item: str) -> bool: ... # type: ignore
  712. class IfRange:
  713. etag: Optional[str]
  714. date: Optional[datetime]
  715. def __init__(
  716. self, etag: Optional[str] = None, date: Optional[datetime] = None
  717. ) -> None: ...
  718. def to_header(self) -> str: ...
  719. class Range:
  720. units: str
  721. ranges: List[Tuple[int, Optional[int]]]
  722. def __init__(self, units: str, ranges: List[Tuple[int, Optional[int]]]) -> None: ...
  723. def range_for_length(self, length: Optional[int]) -> Optional[Tuple[int, int]]: ...
  724. def make_content_range(self, length: Optional[int]) -> Optional[ContentRange]: ...
  725. def to_header(self) -> str: ...
  726. def to_content_range_header(self, length: Optional[int]) -> Optional[str]: ...
  727. def _callback_property(name: str) -> property: ...
  728. class ContentRange:
  729. on_update: Optional[Callable[[ContentRange], None]]
  730. def __init__(
  731. self,
  732. units: Optional[str],
  733. start: Optional[int],
  734. stop: Optional[int],
  735. length: Optional[int] = None,
  736. on_update: Optional[Callable[[ContentRange], None]] = None,
  737. ) -> None: ...
  738. @property
  739. def units(self) -> Optional[str]: ...
  740. @units.setter
  741. def units(self, value: Optional[str]) -> None: ...
  742. @property
  743. def start(self) -> Optional[int]: ...
  744. @start.setter
  745. def start(self, value: Optional[int]) -> None: ...
  746. @property
  747. def stop(self) -> Optional[int]: ...
  748. @stop.setter
  749. def stop(self, value: Optional[int]) -> None: ...
  750. @property
  751. def length(self) -> Optional[int]: ...
  752. @length.setter
  753. def length(self, value: Optional[int]) -> None: ...
  754. def set(
  755. self,
  756. start: Optional[int],
  757. stop: Optional[int],
  758. length: Optional[int] = None,
  759. units: Optional[str] = "bytes",
  760. ) -> None: ...
  761. def unset(self) -> None: ...
  762. def to_header(self) -> str: ...
  763. class Authorization(ImmutableDictMixin[str, str], Dict[str, str]):
  764. type: str
  765. def __init__(
  766. self,
  767. auth_type: str,
  768. data: Optional[Union[Mapping[str, str], Iterable[Tuple[str, str]]]] = None,
  769. ) -> None: ...
  770. @property
  771. def username(self) -> Optional[str]: ...
  772. @property
  773. def password(self) -> Optional[str]: ...
  774. @property
  775. def realm(self) -> Optional[str]: ...
  776. @property
  777. def nonce(self) -> Optional[str]: ...
  778. @property
  779. def uri(self) -> Optional[str]: ...
  780. @property
  781. def nc(self) -> Optional[str]: ...
  782. @property
  783. def cnonce(self) -> Optional[str]: ...
  784. @property
  785. def response(self) -> Optional[str]: ...
  786. @property
  787. def opaque(self) -> Optional[str]: ...
  788. @property
  789. def qop(self) -> Optional[str]: ...
  790. def to_header(self) -> str: ...
  791. def auth_property(name: str, doc: Optional[str] = None) -> property: ...
  792. def _set_property(name: str, doc: Optional[str] = None) -> property: ...
  793. class WWWAuthenticate(UpdateDictMixin[str, str], Dict[str, str]):
  794. _require_quoting: FrozenSet[str]
  795. def __init__(
  796. self,
  797. auth_type: Optional[str] = None,
  798. values: Optional[Union[Mapping[str, str], Iterable[Tuple[str, str]]]] = None,
  799. on_update: Optional[Callable[[WWWAuthenticate], None]] = None,
  800. ) -> None: ...
  801. def set_basic(self, realm: str = ...) -> None: ...
  802. def set_digest(
  803. self,
  804. realm: str,
  805. nonce: str,
  806. qop: Iterable[str] = ("auth",),
  807. opaque: Optional[str] = None,
  808. algorithm: Optional[str] = None,
  809. stale: bool = False,
  810. ) -> None: ...
  811. def to_header(self) -> str: ...
  812. @property
  813. def type(self) -> Optional[str]: ...
  814. @type.setter
  815. def type(self, value: Optional[str]) -> None: ...
  816. @property
  817. def realm(self) -> Optional[str]: ...
  818. @realm.setter
  819. def realm(self, value: Optional[str]) -> None: ...
  820. @property
  821. def domain(self) -> HeaderSet: ...
  822. @property
  823. def nonce(self) -> Optional[str]: ...
  824. @nonce.setter
  825. def nonce(self, value: Optional[str]) -> None: ...
  826. @property
  827. def opaque(self) -> Optional[str]: ...
  828. @opaque.setter
  829. def opaque(self, value: Optional[str]) -> None: ...
  830. @property
  831. def algorithm(self) -> Optional[str]: ...
  832. @algorithm.setter
  833. def algorithm(self, value: Optional[str]) -> None: ...
  834. @property
  835. def qop(self) -> HeaderSet: ...
  836. @property
  837. def stale(self) -> Optional[bool]: ...
  838. @stale.setter
  839. def stale(self, value: Optional[bool]) -> None: ...
  840. @staticmethod
  841. def auth_property(name: str, doc: Optional[str] = None) -> property: ...
  842. class FileStorage:
  843. name: Optional[str]
  844. stream: IO[bytes]
  845. filename: Optional[str]
  846. headers: Headers
  847. _parsed_content_type: Tuple[str, Dict[str, str]]
  848. def __init__(
  849. self,
  850. stream: Optional[IO[bytes]] = None,
  851. filename: Optional[str] = None,
  852. name: Optional[str] = None,
  853. content_type: Optional[str] = None,
  854. content_length: Optional[int] = None,
  855. headers: Optional[Headers] = None,
  856. ) -> None: ...
  857. def _parse_content_type(self) -> None: ...
  858. @property
  859. def content_type(self) -> str: ...
  860. @property
  861. def content_length(self) -> int: ...
  862. @property
  863. def mimetype(self) -> str: ...
  864. @property
  865. def mimetype_params(self) -> Dict[str, str]: ...
  866. def save(
  867. self, dst: Union[str, PathLike, IO[bytes]], buffer_size: int = ...
  868. ) -> None: ...
  869. def close(self) -> None: ...
  870. def __bool__(self) -> bool: ...
  871. def __getattr__(self, name: str) -> Any: ...
  872. def __iter__(self) -> Iterator[bytes]: ...
  873. def __repr__(self) -> str: ...