cache_control.pyi 3.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109
  1. from collections.abc import Callable
  2. from collections.abc import Iterable
  3. from collections.abc import Mapping
  4. from typing import TypeVar
  5. from .mixins import ImmutableDictMixin
  6. from .mixins import UpdateDictMixin
  7. T = TypeVar("T")
  8. _CPT = TypeVar("_CPT", str, int, bool)
  9. _OptCPT = _CPT | None
  10. def cache_control_property(key: str, empty: _OptCPT, type: type[_CPT]) -> property: ...
  11. class _CacheControl(UpdateDictMixin[str, _OptCPT], dict[str, _OptCPT]):
  12. provided: bool
  13. def __init__(
  14. self,
  15. values: Mapping[str, _OptCPT] | Iterable[tuple[str, _OptCPT]] = (),
  16. on_update: Callable[[_CacheControl], None] | None = None,
  17. ) -> None: ...
  18. @property
  19. def no_cache(self) -> bool | None: ...
  20. @no_cache.setter
  21. def no_cache(self, value: bool | None) -> None: ...
  22. @no_cache.deleter
  23. def no_cache(self) -> None: ...
  24. @property
  25. def no_store(self) -> bool | None: ...
  26. @no_store.setter
  27. def no_store(self, value: bool | None) -> None: ...
  28. @no_store.deleter
  29. def no_store(self) -> None: ...
  30. @property
  31. def max_age(self) -> int | None: ...
  32. @max_age.setter
  33. def max_age(self, value: int | None) -> None: ...
  34. @max_age.deleter
  35. def max_age(self) -> None: ...
  36. @property
  37. def no_transform(self) -> bool | None: ...
  38. @no_transform.setter
  39. def no_transform(self, value: bool | None) -> None: ...
  40. @no_transform.deleter
  41. def no_transform(self) -> None: ...
  42. def _get_cache_value(self, key: str, empty: T | None, type: type[T]) -> T: ...
  43. def _set_cache_value(self, key: str, value: T | None, type: type[T]) -> None: ...
  44. def _del_cache_value(self, key: str) -> None: ...
  45. def to_header(self) -> str: ...
  46. @staticmethod
  47. def cache_property(key: str, empty: _OptCPT, type: type[_CPT]) -> property: ...
  48. class RequestCacheControl(ImmutableDictMixin[str, _OptCPT], _CacheControl):
  49. @property
  50. def max_stale(self) -> int | None: ...
  51. @max_stale.setter
  52. def max_stale(self, value: int | None) -> None: ...
  53. @max_stale.deleter
  54. def max_stale(self) -> None: ...
  55. @property
  56. def min_fresh(self) -> int | None: ...
  57. @min_fresh.setter
  58. def min_fresh(self, value: int | None) -> None: ...
  59. @min_fresh.deleter
  60. def min_fresh(self) -> None: ...
  61. @property
  62. def only_if_cached(self) -> bool | None: ...
  63. @only_if_cached.setter
  64. def only_if_cached(self, value: bool | None) -> None: ...
  65. @only_if_cached.deleter
  66. def only_if_cached(self) -> None: ...
  67. class ResponseCacheControl(_CacheControl):
  68. @property
  69. def public(self) -> bool | None: ...
  70. @public.setter
  71. def public(self, value: bool | None) -> None: ...
  72. @public.deleter
  73. def public(self) -> None: ...
  74. @property
  75. def private(self) -> bool | None: ...
  76. @private.setter
  77. def private(self, value: bool | None) -> None: ...
  78. @private.deleter
  79. def private(self) -> None: ...
  80. @property
  81. def must_revalidate(self) -> bool | None: ...
  82. @must_revalidate.setter
  83. def must_revalidate(self, value: bool | None) -> None: ...
  84. @must_revalidate.deleter
  85. def must_revalidate(self) -> None: ...
  86. @property
  87. def proxy_revalidate(self) -> bool | None: ...
  88. @proxy_revalidate.setter
  89. def proxy_revalidate(self, value: bool | None) -> None: ...
  90. @proxy_revalidate.deleter
  91. def proxy_revalidate(self) -> None: ...
  92. @property
  93. def s_maxage(self) -> int | None: ...
  94. @s_maxage.setter
  95. def s_maxage(self, value: int | None) -> None: ...
  96. @s_maxage.deleter
  97. def s_maxage(self) -> None: ...
  98. @property
  99. def immutable(self) -> bool | None: ...
  100. @immutable.setter
  101. def immutable(self, value: bool | None) -> None: ...
  102. @immutable.deleter
  103. def immutable(self) -> None: ...