reflex 0.5.10a3__py3-none-any.whl → 0.6.0a1__py3-none-any.whl

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.

Potentially problematic release.


This version of reflex might be problematic. Click here for more details.

Files changed (237) hide show
  1. reflex/.templates/jinja/web/pages/utils.js.jinja2 +4 -4
  2. reflex/.templates/jinja/web/utils/context.js.jinja2 +1 -1
  3. reflex/.templates/jinja/web/utils/theme.js.jinja2 +1 -1
  4. reflex/__init__.py +3 -2
  5. reflex/__init__.pyi +2 -2
  6. reflex/app.py +43 -9
  7. reflex/base.py +3 -2
  8. reflex/compiler/compiler.py +6 -6
  9. reflex/compiler/utils.py +5 -3
  10. reflex/components/base/app_wrap.py +2 -4
  11. reflex/components/base/app_wrap.pyi +17 -17
  12. reflex/components/base/bare.py +7 -4
  13. reflex/components/base/body.pyi +17 -17
  14. reflex/components/base/document.pyi +81 -81
  15. reflex/components/base/error_boundary.py +10 -8
  16. reflex/components/base/error_boundary.pyi +20 -19
  17. reflex/components/base/fragment.pyi +17 -17
  18. reflex/components/base/head.pyi +33 -33
  19. reflex/components/base/link.pyi +34 -33
  20. reflex/components/base/meta.pyi +65 -65
  21. reflex/components/base/script.py +2 -1
  22. reflex/components/base/script.pyi +21 -20
  23. reflex/components/component.py +116 -145
  24. reflex/components/core/banner.py +59 -60
  25. reflex/components/core/banner.pyi +86 -150
  26. reflex/components/core/client_side_routing.py +2 -1
  27. reflex/components/core/client_side_routing.pyi +34 -33
  28. reflex/components/core/clipboard.py +2 -2
  29. reflex/components/core/clipboard.pyi +19 -18
  30. reflex/components/core/cond.py +21 -44
  31. reflex/components/core/debounce.py +6 -8
  32. reflex/components/core/debounce.pyi +19 -18
  33. reflex/components/core/foreach.py +5 -14
  34. reflex/components/core/html.pyi +18 -17
  35. reflex/components/core/match.py +36 -43
  36. reflex/components/core/upload.py +32 -25
  37. reflex/components/core/upload.pyi +84 -73
  38. reflex/components/datadisplay/code.py +55 -28
  39. reflex/components/datadisplay/code.pyi +20 -17
  40. reflex/components/datadisplay/dataeditor.py +17 -11
  41. reflex/components/datadisplay/dataeditor.pyi +34 -33
  42. reflex/components/el/__init__.py +0 -1
  43. reflex/components/el/__init__.pyi +0 -11
  44. reflex/components/el/element.pyi +17 -17
  45. reflex/components/el/elements/__init__.py +1 -7
  46. reflex/components/el/elements/__init__.pyi +1 -15
  47. reflex/components/el/elements/base.pyi +18 -17
  48. reflex/components/el/elements/forms.py +24 -31
  49. reflex/components/el/elements/forms.pyi +237 -236
  50. reflex/components/el/elements/inline.pyi +450 -449
  51. reflex/components/el/elements/media.py +0 -21
  52. reflex/components/el/elements/media.pyi +338 -337
  53. reflex/components/el/elements/metadata.py +3 -2
  54. reflex/components/el/elements/metadata.pyi +98 -97
  55. reflex/components/el/elements/other.pyi +114 -113
  56. reflex/components/el/elements/scripts.pyi +50 -49
  57. reflex/components/el/elements/sectioning.pyi +242 -241
  58. reflex/components/el/elements/tables.pyi +162 -161
  59. reflex/components/el/elements/typography.pyi +242 -241
  60. reflex/components/gridjs/datatable.py +13 -14
  61. reflex/components/gridjs/datatable.pyi +34 -33
  62. reflex/components/lucide/icon.py +2 -126
  63. reflex/components/lucide/icon.pyi +34 -142
  64. reflex/components/markdown/markdown.py +30 -35
  65. reflex/components/markdown/markdown.pyi +29 -32
  66. reflex/components/moment/moment.pyi +19 -18
  67. reflex/components/next/base.pyi +17 -17
  68. reflex/components/next/image.py +0 -4
  69. reflex/components/next/image.pyi +20 -19
  70. reflex/components/next/link.pyi +18 -17
  71. reflex/components/next/video.pyi +18 -17
  72. reflex/components/plotly/plotly.py +16 -28
  73. reflex/components/plotly/plotly.pyi +36 -35
  74. reflex/components/props.py +21 -10
  75. reflex/components/radix/__init__.pyi +1 -1
  76. reflex/components/radix/primitives/__init__.pyi +0 -1
  77. reflex/components/radix/primitives/accordion.py +7 -8
  78. reflex/components/radix/primitives/accordion.pyi +117 -116
  79. reflex/components/radix/primitives/base.pyi +34 -33
  80. reflex/components/radix/primitives/drawer.pyi +169 -168
  81. reflex/components/radix/primitives/form.pyi +168 -167
  82. reflex/components/radix/primitives/progress.pyi +82 -81
  83. reflex/components/radix/primitives/slider.pyi +84 -83
  84. reflex/components/radix/themes/base.py +8 -4
  85. reflex/components/radix/themes/base.pyi +114 -113
  86. reflex/components/radix/themes/color_mode.py +12 -21
  87. reflex/components/radix/themes/color_mode.pyi +67 -67
  88. reflex/components/radix/themes/components/__init__.pyi +1 -0
  89. reflex/components/radix/themes/components/alert_dialog.pyi +118 -117
  90. reflex/components/radix/themes/components/aspect_ratio.pyi +18 -17
  91. reflex/components/radix/themes/components/avatar.pyi +18 -17
  92. reflex/components/radix/themes/components/badge.pyi +18 -17
  93. reflex/components/radix/themes/components/button.pyi +18 -17
  94. reflex/components/radix/themes/components/callout.pyi +82 -81
  95. reflex/components/radix/themes/components/card.pyi +18 -17
  96. reflex/components/radix/themes/components/checkbox.py +2 -3
  97. reflex/components/radix/themes/components/checkbox.pyi +53 -52
  98. reflex/components/radix/themes/components/checkbox_cards.pyi +34 -33
  99. reflex/components/radix/themes/components/checkbox_group.pyi +34 -33
  100. reflex/components/radix/themes/components/context_menu.pyi +140 -139
  101. reflex/components/radix/themes/components/data_list.py +5 -0
  102. reflex/components/radix/themes/components/data_list.pyi +71 -65
  103. reflex/components/radix/themes/components/dialog.pyi +121 -120
  104. reflex/components/radix/themes/components/dropdown_menu.pyi +142 -141
  105. reflex/components/radix/themes/components/hover_card.pyi +68 -67
  106. reflex/components/radix/themes/components/icon_button.py +2 -1
  107. reflex/components/radix/themes/components/icon_button.pyi +18 -17
  108. reflex/components/radix/themes/components/inset.pyi +18 -17
  109. reflex/components/radix/themes/components/popover.pyi +73 -72
  110. reflex/components/radix/themes/components/progress.pyi +18 -17
  111. reflex/components/radix/themes/components/radio.pyi +18 -17
  112. reflex/components/radix/themes/components/radio_cards.pyi +35 -34
  113. reflex/components/radix/themes/components/radio_group.py +35 -31
  114. reflex/components/radix/themes/components/radio_group.pyi +73 -66
  115. reflex/components/radix/themes/components/scroll_area.pyi +18 -17
  116. reflex/components/radix/themes/components/segmented_control.pyi +35 -34
  117. reflex/components/radix/themes/components/select.py +2 -1
  118. reflex/components/radix/themes/components/select.pyi +155 -154
  119. reflex/components/radix/themes/components/separator.py +2 -3
  120. reflex/components/radix/themes/components/separator.pyi +18 -17
  121. reflex/components/radix/themes/components/skeleton.pyi +18 -17
  122. reflex/components/radix/themes/components/slider.py +2 -1
  123. reflex/components/radix/themes/components/slider.pyi +20 -19
  124. reflex/components/radix/themes/components/spinner.pyi +18 -17
  125. reflex/components/radix/themes/components/switch.pyi +19 -18
  126. reflex/components/radix/themes/components/table.pyi +114 -113
  127. reflex/components/radix/themes/components/tabs.pyi +84 -83
  128. reflex/components/radix/themes/components/text_area.pyi +21 -20
  129. reflex/components/radix/themes/components/text_field.py +0 -79
  130. reflex/components/radix/themes/components/text_field.pyi +57 -63
  131. reflex/components/radix/themes/components/tooltip.pyi +21 -20
  132. reflex/components/radix/themes/layout/base.pyi +18 -17
  133. reflex/components/radix/themes/layout/box.pyi +18 -17
  134. reflex/components/radix/themes/layout/center.pyi +18 -17
  135. reflex/components/radix/themes/layout/container.py +2 -3
  136. reflex/components/radix/themes/layout/container.pyi +18 -17
  137. reflex/components/radix/themes/layout/flex.pyi +18 -17
  138. reflex/components/radix/themes/layout/grid.pyi +18 -17
  139. reflex/components/radix/themes/layout/list.py +5 -4
  140. reflex/components/radix/themes/layout/list.pyi +86 -85
  141. reflex/components/radix/themes/layout/section.py +2 -3
  142. reflex/components/radix/themes/layout/section.pyi +18 -17
  143. reflex/components/radix/themes/layout/spacer.pyi +18 -17
  144. reflex/components/radix/themes/layout/stack.pyi +50 -49
  145. reflex/components/radix/themes/typography/blockquote.pyi +18 -17
  146. reflex/components/radix/themes/typography/code.pyi +18 -17
  147. reflex/components/radix/themes/typography/heading.pyi +18 -17
  148. reflex/components/radix/themes/typography/link.pyi +18 -17
  149. reflex/components/radix/themes/typography/text.pyi +114 -113
  150. reflex/components/react_player/audio.pyi +34 -33
  151. reflex/components/react_player/react_player.pyi +34 -33
  152. reflex/components/react_player/video.pyi +34 -33
  153. reflex/components/recharts/cartesian.py +23 -19
  154. reflex/components/recharts/cartesian.pyi +297 -296
  155. reflex/components/recharts/charts.py +6 -5
  156. reflex/components/recharts/charts.pyi +179 -178
  157. reflex/components/recharts/general.py +8 -7
  158. reflex/components/recharts/general.pyi +82 -81
  159. reflex/components/recharts/polar.py +14 -13
  160. reflex/components/recharts/polar.pyi +76 -75
  161. reflex/components/recharts/recharts.pyi +33 -33
  162. reflex/components/sonner/toast.py +30 -33
  163. reflex/components/sonner/toast.pyi +27 -25
  164. reflex/components/suneditor/editor.py +2 -1
  165. reflex/components/suneditor/editor.pyi +27 -26
  166. reflex/components/tags/iter_tag.py +16 -16
  167. reflex/components/tags/tag.py +8 -10
  168. reflex/constants/base.py +3 -1
  169. reflex/constants/event.py +1 -0
  170. reflex/event.py +89 -79
  171. reflex/experimental/__init__.py +25 -6
  172. reflex/experimental/client_state.py +34 -58
  173. reflex/experimental/hooks.py +13 -18
  174. reflex/experimental/layout.py +5 -5
  175. reflex/experimental/layout.pyi +84 -83
  176. reflex/{experimental/vars → ivars}/__init__.py +0 -1
  177. reflex/ivars/base.py +2180 -0
  178. reflex/ivars/function.py +200 -0
  179. reflex/ivars/number.py +1137 -0
  180. reflex/ivars/object.py +564 -0
  181. reflex/ivars/sequence.py +1601 -0
  182. reflex/model.py +22 -0
  183. reflex/reflex.py +4 -0
  184. reflex/state.py +388 -73
  185. reflex/style.py +52 -34
  186. reflex/testing.py +8 -3
  187. reflex/utils/exceptions.py +12 -0
  188. reflex/utils/exec.py +0 -14
  189. reflex/utils/format.py +74 -223
  190. reflex/utils/net.py +43 -0
  191. reflex/utils/path_ops.py +13 -1
  192. reflex/utils/prerequisites.py +46 -26
  193. reflex/utils/pyi_generator.py +5 -4
  194. reflex/utils/serializers.py +13 -31
  195. reflex/utils/types.py +44 -9
  196. reflex/vars.py +127 -2230
  197. {reflex-0.5.10a3.dist-info → reflex-0.6.0a1.dist-info}/METADATA +4 -6
  198. reflex-0.6.0a1.dist-info/RECORD +384 -0
  199. reflex/.templates/apps/demo/.gitignore +0 -4
  200. reflex/.templates/apps/demo/assets/favicon.ico +0 -0
  201. reflex/.templates/apps/demo/assets/github.svg +0 -10
  202. reflex/.templates/apps/demo/assets/icon.svg +0 -37
  203. reflex/.templates/apps/demo/assets/logo.svg +0 -68
  204. reflex/.templates/apps/demo/assets/paneleft.svg +0 -13
  205. reflex/.templates/apps/demo/code/__init__.py +0 -1
  206. reflex/.templates/apps/demo/code/demo.py +0 -127
  207. reflex/.templates/apps/demo/code/pages/__init__.py +0 -7
  208. reflex/.templates/apps/demo/code/pages/chatapp.py +0 -31
  209. reflex/.templates/apps/demo/code/pages/datatable.py +0 -360
  210. reflex/.templates/apps/demo/code/pages/forms.py +0 -257
  211. reflex/.templates/apps/demo/code/pages/graphing.py +0 -253
  212. reflex/.templates/apps/demo/code/pages/home.py +0 -56
  213. reflex/.templates/apps/demo/code/sidebar.py +0 -178
  214. reflex/.templates/apps/demo/code/state.py +0 -22
  215. reflex/.templates/apps/demo/code/states/form_state.py +0 -40
  216. reflex/.templates/apps/demo/code/states/pie_state.py +0 -47
  217. reflex/.templates/apps/demo/code/styles.py +0 -68
  218. reflex/.templates/apps/demo/code/webui/__init__.py +0 -0
  219. reflex/.templates/apps/demo/code/webui/components/__init__.py +0 -4
  220. reflex/.templates/apps/demo/code/webui/components/chat.py +0 -118
  221. reflex/.templates/apps/demo/code/webui/components/loading_icon.py +0 -19
  222. reflex/.templates/apps/demo/code/webui/components/modal.py +0 -56
  223. reflex/.templates/apps/demo/code/webui/components/navbar.py +0 -70
  224. reflex/.templates/apps/demo/code/webui/components/sidebar.py +0 -66
  225. reflex/.templates/apps/demo/code/webui/state.py +0 -146
  226. reflex/.templates/apps/demo/code/webui/styles.py +0 -88
  227. reflex/experimental/vars/base.py +0 -583
  228. reflex/experimental/vars/function.py +0 -290
  229. reflex/experimental/vars/number.py +0 -1458
  230. reflex/experimental/vars/object.py +0 -804
  231. reflex/experimental/vars/sequence.py +0 -1764
  232. reflex/utils/watch.py +0 -96
  233. reflex/vars.pyi +0 -218
  234. reflex-0.5.10a3.dist-info/RECORD +0 -413
  235. {reflex-0.5.10a3.dist-info → reflex-0.6.0a1.dist-info}/LICENSE +0 -0
  236. {reflex-0.5.10a3.dist-info → reflex-0.6.0a1.dist-info}/WHEEL +0 -0
  237. {reflex-0.5.10a3.dist-info → reflex-0.6.0a1.dist-info}/entry_points.txt +0 -0
reflex/utils/watch.py DELETED
@@ -1,96 +0,0 @@
1
- """General utility functions."""
2
-
3
- import contextlib
4
- import os
5
- import shutil
6
- import time
7
-
8
- from watchdog.events import FileSystemEvent, FileSystemEventHandler
9
- from watchdog.observers import Observer
10
-
11
- from reflex.constants import Dirs
12
- from reflex.utils.prerequisites import get_web_dir
13
-
14
-
15
- class AssetFolderWatch:
16
- """Asset folder watch class."""
17
-
18
- def __init__(self, root):
19
- """Initialize the Watch Class.
20
-
21
- Args:
22
- root: root path of the public.
23
- """
24
- self.path = str(root / Dirs.APP_ASSETS)
25
- self.event_handler = AssetFolderHandler(root)
26
-
27
- def start(self):
28
- """Start watching asset folder."""
29
- self.observer = Observer()
30
- self.observer.schedule(self.event_handler, self.path, recursive=True)
31
- self.observer.start()
32
-
33
-
34
- class AssetFolderHandler(FileSystemEventHandler):
35
- """Asset folder event handler."""
36
-
37
- def __init__(self, root):
38
- """Initialize the AssetFolderHandler Class.
39
-
40
- Args:
41
- root: root path of the public.
42
- """
43
- super().__init__()
44
- self.root = root
45
-
46
- def on_modified(self, event: FileSystemEvent):
47
- """Event handler when a file or folder was modified.
48
-
49
- This is called every time after a file is created, modified and deleted.
50
-
51
- Args:
52
- event: Event information.
53
- """
54
- dest_path = self.get_dest_path(event.src_path)
55
-
56
- # wait 1 sec for fully saved
57
- time.sleep(1)
58
-
59
- if os.path.isfile(event.src_path):
60
- with contextlib.suppress(PermissionError):
61
- shutil.copyfile(event.src_path, dest_path)
62
- if os.path.isdir(event.src_path):
63
- if os.path.exists(dest_path):
64
- shutil.rmtree(dest_path)
65
- with contextlib.suppress(PermissionError):
66
- shutil.copytree(event.src_path, dest_path)
67
-
68
- def on_deleted(self, event: FileSystemEvent):
69
- """Event hander when a file or folder was deleted.
70
-
71
- Args:
72
- event: Event infomation.
73
- """
74
- dest_path = self.get_dest_path(event.src_path)
75
-
76
- if os.path.isfile(dest_path):
77
- # when event is about a file, pass
78
- # this will be deleted at on_modified function
79
- return
80
-
81
- if os.path.exists(dest_path):
82
- shutil.rmtree(dest_path)
83
-
84
- def get_dest_path(self, src_path: str) -> str:
85
- """Get public file path.
86
-
87
- Args:
88
- src_path: The asset file path.
89
-
90
- Returns:
91
- The public file path.
92
- """
93
- return src_path.replace(
94
- str(self.root / Dirs.APP_ASSETS),
95
- str(self.root / get_web_dir() / Dirs.PUBLIC),
96
- )
reflex/vars.pyi DELETED
@@ -1,218 +0,0 @@
1
- """Generated with stubgen from mypy, then manually edited, do not regen."""
2
-
3
- from __future__ import annotations
4
-
5
- import datetime
6
- from dataclasses import dataclass
7
- from types import FunctionType
8
- from typing import (
9
- Any,
10
- Callable,
11
- Dict,
12
- Iterable,
13
- List,
14
- Optional,
15
- Set,
16
- Tuple,
17
- Type,
18
- Union,
19
- _GenericAlias, # type: ignore
20
- overload,
21
- )
22
-
23
- from _typeshed import Incomplete
24
-
25
- from reflex import constants as constants
26
- from reflex.base import Base as Base
27
- from reflex.state import BaseState as BaseState
28
- from reflex.state import State as State
29
- from reflex.utils import console as console
30
- from reflex.utils import format as format
31
- from reflex.utils import types as types
32
- from reflex.utils.imports import ImmutableParsedImportDict, ImportDict, ParsedImportDict
33
-
34
- USED_VARIABLES: Incomplete
35
-
36
- def get_unique_variable_name() -> str: ...
37
- def _encode_var(value: Var) -> str: ...
38
-
39
- _global_vars: Dict[int, Var]
40
-
41
- def _decode_var(value: str) -> tuple[VarData, str]: ...
42
- def _extract_var_data(value: Iterable) -> list[VarData | None]: ...
43
-
44
- class VarData(Base):
45
- state: str = ""
46
- imports: Union[ImportDict, ParsedImportDict] = {}
47
- hooks: Dict[str, None] = {}
48
- interpolations: List[Tuple[int, int]] = []
49
- @classmethod
50
- def merge(cls, *others: ImmutableVarData | VarData | None) -> VarData | None: ...
51
-
52
- class ImmutableVarData:
53
- state: str = ""
54
- imports: ImmutableParsedImportDict = tuple()
55
- hooks: Tuple[str, ...] = tuple()
56
- def __init__(
57
- self,
58
- state: str = "",
59
- imports: ImportDict | ParsedImportDict | None = None,
60
- hooks: dict[str, None] | None = None,
61
- ) -> None: ...
62
- @classmethod
63
- def merge(
64
- cls, *others: ImmutableVarData | VarData | None
65
- ) -> ImmutableVarData | None: ...
66
-
67
- def _decode_var_immutable(value: str) -> tuple[ImmutableVarData, str]: ...
68
-
69
- class Var:
70
- _var_name: str
71
- _var_type: Type
72
- _var_is_local: bool = False
73
- _var_is_string: bool = False
74
- _var_full_name_needs_state_prefix: bool = False
75
- _var_data: VarData | None = None
76
- @classmethod
77
- def create(
78
- cls,
79
- value: Any,
80
- _var_is_local: bool = True,
81
- _var_is_string: bool | None = None,
82
- _var_data: VarData | None = None,
83
- ) -> Optional[Var]: ...
84
- @classmethod
85
- def create_safe(
86
- cls,
87
- value: Any,
88
- _var_is_local: bool = True,
89
- _var_is_string: bool | None = None,
90
- _var_data: VarData | None = None,
91
- ) -> Var: ...
92
- @classmethod
93
- def __class_getitem__(cls, type_: Type) -> _GenericAlias: ...
94
- def _replace(self, merge_var_data=None, **kwargs: Any) -> BaseVar: ...
95
- def equals(self, other: Var) -> bool: ...
96
- def to_string(self) -> Var: ...
97
- def __hash__(self) -> int: ...
98
- def __format__(self, format_spec: str) -> str: ...
99
- def __getitem__(self, i: Any) -> Var: ...
100
- def __getattribute__(self, name: str) -> Var: ...
101
- def operation(
102
- self,
103
- op: str = ...,
104
- other: Optional[Var] = ...,
105
- type_: Optional[Type] = ...,
106
- flip: bool = ...,
107
- fn: Optional[str] = ...,
108
- ) -> Var: ...
109
- def compare(self, op: str, other: Var) -> Var: ...
110
- def __invert__(self) -> Var: ...
111
- def __neg__(self) -> Var: ...
112
- def __abs__(self) -> Var: ...
113
- def length(self) -> Var: ...
114
- def __eq__(self, other: Var) -> Var: ...
115
- def __ne__(self, other: Var) -> Var: ...
116
- def __gt__(self, other: Var) -> Var: ...
117
- def __ge__(self, other: Var) -> Var: ...
118
- def __lt__(self, other: Var) -> Var: ...
119
- def __le__(self, other: Var) -> Var: ...
120
- def __add__(self, other: Var) -> Var: ...
121
- def __radd__(self, other: Var) -> Var: ...
122
- def __sub__(self, other: Var) -> Var: ...
123
- def __rsub__(self, other: Var) -> Var: ...
124
- def __mul__(self, other: Var) -> Var: ...
125
- def __rmul__(self, other: Var) -> Var: ...
126
- def __pow__(self, other: Var) -> Var: ...
127
- def __rpow__(self, other: Var) -> Var: ...
128
- def __truediv__(self, other: Var) -> Var: ...
129
- def __rtruediv__(self, other: Var) -> Var: ...
130
- def __floordiv__(self, other: Var) -> Var: ...
131
- def __mod__(self, other: Var) -> Var: ...
132
- def __rmod__(self, other: Var) -> Var: ...
133
- def __and__(self, other: Var) -> Var: ...
134
- def __rand__(self, other: Var) -> Var: ...
135
- def __or__(self, other: Var) -> Var: ...
136
- def __ror__(self, other: Var) -> Var: ...
137
- def __contains__(self, _: Any) -> Var: ...
138
- def contains(self, other: Any, field: Union[Var, None] = None) -> Var: ...
139
- def reverse(self) -> Var: ...
140
- def foreach(self, fn: Callable) -> Var: ...
141
- @classmethod
142
- def range(
143
- cls,
144
- v1: Var | int = 0,
145
- v2: Var | int | None = None,
146
- step: Var | int | None = None,
147
- ) -> Var: ...
148
- def to(self, type_: Type) -> Var: ...
149
- def as_ref(self) -> Var: ...
150
- @property
151
- def _var_full_name(self) -> str: ...
152
- def _var_set_state(self, state: Type[BaseState] | str) -> Any: ...
153
- def _get_all_var_data(self) -> VarData: ...
154
- def json(self) -> str: ...
155
-
156
- @dataclass(eq=False)
157
- class BaseVar(Var):
158
- _var_name: str
159
- _var_type: Any
160
- _var_is_local: bool = False
161
- _var_is_string: bool = False
162
- _var_full_name_needs_state_prefix: bool = False
163
- _var_data: VarData | None = None
164
- def __hash__(self) -> int: ...
165
- def get_default_value(self) -> Any: ...
166
- def get_setter_name(self, include_state: bool = ...) -> str: ...
167
- def get_setter(self) -> Callable[[BaseState, Any], None]: ...
168
-
169
- @dataclass(init=False)
170
- class ComputedVar(Var):
171
- _var_cache: bool
172
- fget: FunctionType
173
- @property
174
- def _cache_attr(self) -> str: ...
175
- def __get__(self, instance, owner): ...
176
- def _deps(self, objclass: Type, obj: Optional[FunctionType] = ...) -> Set[str]: ...
177
- def _replace(self, merge_var_data=None, **kwargs: Any) -> ComputedVar: ...
178
- def mark_dirty(self, instance) -> None: ...
179
- def needs_update(self, instance) -> bool: ...
180
- def _determine_var_type(self) -> Type: ...
181
- @overload
182
- def __init__(
183
- self,
184
- fget: Callable[[BaseState], Any],
185
- **kwargs,
186
- ) -> None: ...
187
- @overload
188
- def __init__(self, func) -> None: ...
189
-
190
- @overload
191
- def computed_var(
192
- fget: Callable[[BaseState], Any] | None = None,
193
- initial_value: Any | types.Unset = types.Unset(),
194
- cache: bool = False,
195
- deps: Optional[List[Union[str, Var]]] = None,
196
- auto_deps: bool = True,
197
- interval: Optional[Union[datetime.timedelta, int]] = None,
198
- **kwargs,
199
- ) -> Callable[[Callable[[Any], Any]], ComputedVar]: ...
200
- @overload
201
- def computed_var(fget: Callable[[Any], Any]) -> ComputedVar: ...
202
- @overload
203
- def cached_var(
204
- fget: Callable[[BaseState], Any] | None = None,
205
- initial_value: Any | types.Unset = types.Unset(),
206
- deps: Optional[List[Union[str, Var]]] = None,
207
- auto_deps: bool = True,
208
- interval: Optional[Union[datetime.timedelta, int]] = None,
209
- **kwargs,
210
- ) -> Callable[[Callable[[Any], Any]], ComputedVar]: ...
211
- @overload
212
- def cached_var(fget: Callable[[Any], Any]) -> ComputedVar: ...
213
-
214
- class CallableVar(BaseVar):
215
- def __init__(self, fn: Callable[..., BaseVar]): ...
216
- def __call__(self, *args, **kwargs) -> BaseVar: ...
217
-
218
- def get_uuid_string_var() -> Var: ...