reflex 0.6.8a2__py3-none-any.whl → 0.7.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.
- reflex/.templates/jinja/custom_components/pyproject.toml.jinja2 +1 -1
- reflex/.templates/jinja/web/pages/_app.js.jinja2 +7 -7
- reflex/.templates/jinja/web/pages/utils.js.jinja2 +2 -2
- reflex/.templates/web/components/reflex/radix_themes_color_mode_provider.js +1 -4
- reflex/.templates/web/utils/state.js +65 -36
- reflex/__init__.py +4 -17
- reflex/__init__.pyi +1 -2
- reflex/app.py +244 -109
- reflex/app_mixins/lifespan.py +9 -9
- reflex/app_mixins/middleware.py +6 -6
- reflex/app_module_for_backend.py +3 -7
- reflex/base.py +7 -7
- reflex/compiler/compiler.py +8 -0
- reflex/compiler/utils.py +35 -6
- reflex/components/base/bare.py +1 -1
- reflex/components/base/error_boundary.py +2 -1
- reflex/components/base/error_boundary.pyi +2 -1
- reflex/components/base/meta.py +2 -2
- reflex/components/base/strict_mode.py +10 -0
- reflex/components/base/strict_mode.pyi +57 -0
- reflex/components/component.py +38 -77
- reflex/components/core/banner.py +83 -4
- reflex/components/core/banner.pyi +86 -0
- reflex/components/core/breakpoints.py +3 -1
- reflex/components/core/client_side_routing.py +1 -1
- reflex/components/core/client_side_routing.pyi +1 -1
- reflex/components/core/cond.py +9 -10
- reflex/components/core/debounce.py +1 -1
- reflex/components/core/foreach.py +23 -3
- reflex/components/core/html.py +1 -1
- reflex/components/core/match.py +5 -5
- reflex/components/core/sticky.py +160 -0
- reflex/components/core/sticky.pyi +449 -0
- reflex/components/core/upload.py +2 -2
- reflex/components/datadisplay/code.py +5 -14
- reflex/components/datadisplay/dataeditor.py +7 -4
- reflex/components/datadisplay/logo.py +13 -8
- reflex/components/datadisplay/shiki_code_block.py +14 -9
- reflex/components/dynamic.py +22 -3
- reflex/components/el/constants/reflex.py +1 -1
- reflex/components/el/element.py +1 -1
- reflex/components/el/elements/forms.py +4 -4
- reflex/components/el/elements/forms.pyi +4 -4
- reflex/components/lucide/icon.py +46 -8
- reflex/components/lucide/icon.pyi +54 -0
- reflex/components/markdown/markdown.py +10 -8
- reflex/components/moment/moment.py +2 -2
- reflex/components/next/image.py +16 -4
- reflex/components/next/image.pyi +4 -2
- reflex/components/next/link.py +1 -1
- reflex/components/plotly/plotly.py +5 -5
- reflex/components/props.py +3 -3
- reflex/components/radix/__init__.pyi +1 -1
- reflex/components/radix/primitives/accordion.py +9 -5
- reflex/components/radix/primitives/accordion.pyi +3 -1
- reflex/components/radix/primitives/drawer.py +5 -2
- reflex/components/radix/primitives/drawer.pyi +4 -4
- reflex/components/radix/primitives/form.pyi +6 -6
- reflex/components/radix/primitives/progress.py +1 -1
- reflex/components/radix/primitives/slider.py +1 -1
- reflex/components/radix/themes/color_mode.py +11 -9
- reflex/components/radix/themes/components/alert_dialog.py +3 -0
- reflex/components/radix/themes/components/card.py +1 -1
- reflex/components/radix/themes/components/card.pyi +1 -1
- reflex/components/radix/themes/components/context_menu.py +5 -0
- reflex/components/radix/themes/components/dialog.py +3 -0
- reflex/components/radix/themes/components/dropdown_menu.py +5 -0
- reflex/components/radix/themes/components/hover_card.py +3 -0
- reflex/components/radix/themes/components/icon_button.py +2 -2
- reflex/components/radix/themes/components/icon_button.pyi +1 -0
- reflex/components/radix/themes/components/popover.py +3 -0
- reflex/components/radix/themes/components/radio_cards.py +2 -0
- reflex/components/radix/themes/components/radio_group.py +1 -1
- reflex/components/radix/themes/components/select.py +3 -0
- reflex/components/radix/themes/components/tabs.py +3 -0
- reflex/components/radix/themes/components/text_area.py +12 -0
- reflex/components/radix/themes/components/text_area.pyi +2 -0
- reflex/components/radix/themes/components/text_field.py +1 -1
- reflex/components/radix/themes/components/tooltip.py +3 -1
- reflex/components/radix/themes/components/tooltip.pyi +1 -0
- reflex/components/radix/themes/layout/__init__.pyi +1 -1
- reflex/components/radix/themes/layout/list.py +2 -2
- reflex/components/radix/themes/layout/stack.py +2 -2
- reflex/components/radix/themes/typography/link.py +1 -1
- reflex/components/radix/themes/typography/text.py +2 -2
- reflex/components/react_player/react_player.py +1 -1
- reflex/components/recharts/__init__.py +2 -0
- reflex/components/recharts/__init__.pyi +2 -0
- reflex/components/recharts/charts.py +15 -15
- reflex/components/recharts/general.py +19 -4
- reflex/components/recharts/general.pyi +55 -4
- reflex/components/recharts/polar.py +2 -2
- reflex/components/recharts/recharts.py +4 -4
- reflex/components/sonner/toast.py +15 -13
- reflex/components/sonner/toast.pyi +6 -6
- reflex/components/suneditor/editor.py +6 -4
- reflex/components/suneditor/editor.pyi +2 -2
- reflex/components/tags/iter_tag.py +3 -3
- reflex/components/tags/tag.py +25 -3
- reflex/config.py +48 -15
- reflex/constants/__init__.py +1 -0
- reflex/constants/base.py +4 -1
- reflex/constants/compiler.py +5 -2
- reflex/constants/config.py +8 -1
- reflex/constants/installer.py +9 -9
- reflex/constants/style.py +1 -1
- reflex/custom_components/custom_components.py +9 -7
- reflex/event.py +130 -161
- reflex/experimental/__init__.py +19 -11
- reflex/experimental/client_state.py +53 -28
- reflex/experimental/hooks.py +5 -5
- reflex/experimental/layout.py +8 -5
- reflex/experimental/layout.pyi +1 -1
- reflex/experimental/misc.py +3 -3
- reflex/istate/wrappers.py +1 -1
- reflex/middleware/hydrate_middleware.py +2 -2
- reflex/model.py +11 -6
- reflex/page.py +3 -3
- reflex/reflex.py +90 -19
- reflex/route.py +1 -1
- reflex/state.py +358 -401
- reflex/style.py +27 -3
- reflex/testing.py +29 -23
- reflex/utils/build.py +6 -2
- reflex/utils/codespaces.py +1 -4
- reflex/utils/compat.py +6 -5
- reflex/utils/console.py +52 -16
- reflex/utils/exceptions.py +76 -26
- reflex/utils/exec.py +69 -74
- reflex/utils/export.py +6 -1
- reflex/utils/format.py +7 -39
- reflex/utils/imports.py +2 -2
- reflex/utils/lazy_loader.py +7 -1
- reflex/utils/path_ops.py +28 -14
- reflex/utils/prerequisites.py +324 -65
- reflex/utils/processes.py +45 -32
- reflex/utils/pyi_generator.py +30 -25
- reflex/utils/registry.py +4 -4
- reflex/utils/serializers.py +1 -1
- reflex/utils/telemetry.py +5 -4
- reflex/utils/types.py +42 -18
- reflex/vars/base.py +650 -333
- reflex/vars/datetime.py +6 -7
- reflex/vars/dep_tracking.py +344 -0
- reflex/vars/function.py +11 -5
- reflex/vars/number.py +31 -43
- reflex/vars/object.py +63 -62
- reflex/vars/sequence.py +79 -67
- {reflex-0.6.8a2.dist-info → reflex-0.7.0a1.dist-info}/METADATA +7 -8
- {reflex-0.6.8a2.dist-info → reflex-0.7.0a1.dist-info}/RECORD +153 -149
- {reflex-0.6.8a2.dist-info → reflex-0.7.0a1.dist-info}/WHEEL +1 -1
- reflex/experimental/assets.py +0 -37
- {reflex-0.6.8a2.dist-info → reflex-0.7.0a1.dist-info}/LICENSE +0 -0
- {reflex-0.6.8a2.dist-info → reflex-0.7.0a1.dist-info}/entry_points.txt +0 -0
reflex/vars/sequence.py
CHANGED
|
@@ -6,7 +6,6 @@ import dataclasses
|
|
|
6
6
|
import inspect
|
|
7
7
|
import json
|
|
8
8
|
import re
|
|
9
|
-
import sys
|
|
10
9
|
import typing
|
|
11
10
|
from typing import (
|
|
12
11
|
TYPE_CHECKING,
|
|
@@ -15,7 +14,7 @@ from typing import (
|
|
|
15
14
|
List,
|
|
16
15
|
Literal,
|
|
17
16
|
NoReturn,
|
|
18
|
-
|
|
17
|
+
Sequence,
|
|
19
18
|
Tuple,
|
|
20
19
|
Type,
|
|
21
20
|
Union,
|
|
@@ -54,8 +53,11 @@ from .number import (
|
|
|
54
53
|
)
|
|
55
54
|
|
|
56
55
|
if TYPE_CHECKING:
|
|
56
|
+
from .base import BASE_TYPE, DATACLASS_TYPE, SQLA_TYPE
|
|
57
|
+
from .function import FunctionVar
|
|
57
58
|
from .object import ObjectVar
|
|
58
59
|
|
|
60
|
+
|
|
59
61
|
STRING_TYPE = TypeVar("STRING_TYPE", default=str)
|
|
60
62
|
|
|
61
63
|
|
|
@@ -66,7 +68,7 @@ class StringVar(Var[STRING_TYPE], python_types=str):
|
|
|
66
68
|
def __add__(self, other: StringVar | str) -> ConcatVarOperation: ...
|
|
67
69
|
|
|
68
70
|
@overload
|
|
69
|
-
def __add__(self, other: NoReturn) -> NoReturn: ...
|
|
71
|
+
def __add__(self, other: NoReturn) -> NoReturn: ... # pyright: ignore [reportOverlappingOverload]
|
|
70
72
|
|
|
71
73
|
def __add__(self, other: Any) -> ConcatVarOperation:
|
|
72
74
|
"""Concatenate two strings.
|
|
@@ -86,7 +88,7 @@ class StringVar(Var[STRING_TYPE], python_types=str):
|
|
|
86
88
|
def __radd__(self, other: StringVar | str) -> ConcatVarOperation: ...
|
|
87
89
|
|
|
88
90
|
@overload
|
|
89
|
-
def __radd__(self, other: NoReturn) -> NoReturn: ...
|
|
91
|
+
def __radd__(self, other: NoReturn) -> NoReturn: ... # pyright: ignore [reportOverlappingOverload]
|
|
90
92
|
|
|
91
93
|
def __radd__(self, other: Any) -> ConcatVarOperation:
|
|
92
94
|
"""Concatenate two strings.
|
|
@@ -106,7 +108,7 @@ class StringVar(Var[STRING_TYPE], python_types=str):
|
|
|
106
108
|
def __mul__(self, other: NumberVar | int) -> StringVar: ...
|
|
107
109
|
|
|
108
110
|
@overload
|
|
109
|
-
def __mul__(self, other: NoReturn) -> NoReturn: ...
|
|
111
|
+
def __mul__(self, other: NoReturn) -> NoReturn: ... # pyright: ignore [reportOverlappingOverload]
|
|
110
112
|
|
|
111
113
|
def __mul__(self, other: Any) -> StringVar:
|
|
112
114
|
"""Multiply the sequence by a number or an integer.
|
|
@@ -126,7 +128,7 @@ class StringVar(Var[STRING_TYPE], python_types=str):
|
|
|
126
128
|
def __rmul__(self, other: NumberVar | int) -> StringVar: ...
|
|
127
129
|
|
|
128
130
|
@overload
|
|
129
|
-
def __rmul__(self, other: NoReturn) -> NoReturn: ...
|
|
131
|
+
def __rmul__(self, other: NoReturn) -> NoReturn: ... # pyright: ignore [reportOverlappingOverload]
|
|
130
132
|
|
|
131
133
|
def __rmul__(self, other: Any) -> StringVar:
|
|
132
134
|
"""Multiply the sequence by a number or an integer.
|
|
@@ -211,7 +213,7 @@ class StringVar(Var[STRING_TYPE], python_types=str):
|
|
|
211
213
|
) -> BooleanVar: ...
|
|
212
214
|
|
|
213
215
|
@overload
|
|
214
|
-
def contains(
|
|
216
|
+
def contains( # pyright: ignore [reportOverlappingOverload]
|
|
215
217
|
self, other: NoReturn, field: StringVar | str | None = None
|
|
216
218
|
) -> NoReturn: ...
|
|
217
219
|
|
|
@@ -237,7 +239,7 @@ class StringVar(Var[STRING_TYPE], python_types=str):
|
|
|
237
239
|
def split(self, separator: StringVar | str = "") -> ArrayVar[List[str]]: ...
|
|
238
240
|
|
|
239
241
|
@overload
|
|
240
|
-
def split(self, separator: NoReturn) -> NoReturn: ...
|
|
242
|
+
def split(self, separator: NoReturn) -> NoReturn: ... # pyright: ignore [reportOverlappingOverload]
|
|
241
243
|
|
|
242
244
|
def split(self, separator: Any = "") -> ArrayVar[List[str]]:
|
|
243
245
|
"""Split the string.
|
|
@@ -256,7 +258,7 @@ class StringVar(Var[STRING_TYPE], python_types=str):
|
|
|
256
258
|
def startswith(self, prefix: StringVar | str) -> BooleanVar: ...
|
|
257
259
|
|
|
258
260
|
@overload
|
|
259
|
-
def startswith(self, prefix: NoReturn) -> NoReturn: ...
|
|
261
|
+
def startswith(self, prefix: NoReturn) -> NoReturn: ... # pyright: ignore [reportOverlappingOverload]
|
|
260
262
|
|
|
261
263
|
def startswith(self, prefix: Any) -> BooleanVar:
|
|
262
264
|
"""Check if the string starts with a prefix.
|
|
@@ -275,7 +277,7 @@ class StringVar(Var[STRING_TYPE], python_types=str):
|
|
|
275
277
|
def endswith(self, suffix: StringVar | str) -> BooleanVar: ...
|
|
276
278
|
|
|
277
279
|
@overload
|
|
278
|
-
def endswith(self, suffix: NoReturn) -> NoReturn: ...
|
|
280
|
+
def endswith(self, suffix: NoReturn) -> NoReturn: ... # pyright: ignore [reportOverlappingOverload]
|
|
279
281
|
|
|
280
282
|
def endswith(self, suffix: Any) -> BooleanVar:
|
|
281
283
|
"""Check if the string ends with a suffix.
|
|
@@ -294,7 +296,7 @@ class StringVar(Var[STRING_TYPE], python_types=str):
|
|
|
294
296
|
def __lt__(self, other: StringVar | str) -> BooleanVar: ...
|
|
295
297
|
|
|
296
298
|
@overload
|
|
297
|
-
def __lt__(self, other: NoReturn) -> NoReturn: ...
|
|
299
|
+
def __lt__(self, other: NoReturn) -> NoReturn: ... # pyright: ignore [reportOverlappingOverload]
|
|
298
300
|
|
|
299
301
|
def __lt__(self, other: Any):
|
|
300
302
|
"""Check if the string is less than another string.
|
|
@@ -314,7 +316,7 @@ class StringVar(Var[STRING_TYPE], python_types=str):
|
|
|
314
316
|
def __gt__(self, other: StringVar | str) -> BooleanVar: ...
|
|
315
317
|
|
|
316
318
|
@overload
|
|
317
|
-
def __gt__(self, other: NoReturn) -> NoReturn: ...
|
|
319
|
+
def __gt__(self, other: NoReturn) -> NoReturn: ... # pyright: ignore [reportOverlappingOverload]
|
|
318
320
|
|
|
319
321
|
def __gt__(self, other: Any):
|
|
320
322
|
"""Check if the string is greater than another string.
|
|
@@ -334,7 +336,7 @@ class StringVar(Var[STRING_TYPE], python_types=str):
|
|
|
334
336
|
def __le__(self, other: StringVar | str) -> BooleanVar: ...
|
|
335
337
|
|
|
336
338
|
@overload
|
|
337
|
-
def __le__(self, other: NoReturn) -> NoReturn: ...
|
|
339
|
+
def __le__(self, other: NoReturn) -> NoReturn: ... # pyright: ignore [reportOverlappingOverload]
|
|
338
340
|
|
|
339
341
|
def __le__(self, other: Any):
|
|
340
342
|
"""Check if the string is less than or equal to another string.
|
|
@@ -354,7 +356,7 @@ class StringVar(Var[STRING_TYPE], python_types=str):
|
|
|
354
356
|
def __ge__(self, other: StringVar | str) -> BooleanVar: ...
|
|
355
357
|
|
|
356
358
|
@overload
|
|
357
|
-
def __ge__(self, other: NoReturn) -> NoReturn: ...
|
|
359
|
+
def __ge__(self, other: NoReturn) -> NoReturn: ... # pyright: ignore [reportOverlappingOverload]
|
|
358
360
|
|
|
359
361
|
def __ge__(self, other: Any):
|
|
360
362
|
"""Check if the string is greater than or equal to another string.
|
|
@@ -596,7 +598,7 @@ _decode_var_pattern = re.compile(_decode_var_pattern_re, flags=re.DOTALL)
|
|
|
596
598
|
@dataclasses.dataclass(
|
|
597
599
|
eq=False,
|
|
598
600
|
frozen=True,
|
|
599
|
-
|
|
601
|
+
slots=True,
|
|
600
602
|
)
|
|
601
603
|
class LiteralStringVar(LiteralVar, StringVar[str]):
|
|
602
604
|
"""Base class for immutable literal string vars."""
|
|
@@ -718,7 +720,7 @@ class LiteralStringVar(LiteralVar, StringVar[str]):
|
|
|
718
720
|
@dataclasses.dataclass(
|
|
719
721
|
eq=False,
|
|
720
722
|
frozen=True,
|
|
721
|
-
|
|
723
|
+
slots=True,
|
|
722
724
|
)
|
|
723
725
|
class ConcatVarOperation(CachedVarOperation, StringVar[str]):
|
|
724
726
|
"""Representing a concatenation of literal string vars."""
|
|
@@ -780,7 +782,7 @@ class ConcatVarOperation(CachedVarOperation, StringVar[str]):
|
|
|
780
782
|
"""Create a var from a string value.
|
|
781
783
|
|
|
782
784
|
Args:
|
|
783
|
-
value: The values to concatenate.
|
|
785
|
+
*value: The values to concatenate.
|
|
784
786
|
_var_data: Additional hooks and imports associated with the Var.
|
|
785
787
|
|
|
786
788
|
Returns:
|
|
@@ -794,7 +796,8 @@ class ConcatVarOperation(CachedVarOperation, StringVar[str]):
|
|
|
794
796
|
)
|
|
795
797
|
|
|
796
798
|
|
|
797
|
-
ARRAY_VAR_TYPE = TypeVar("ARRAY_VAR_TYPE", bound=
|
|
799
|
+
ARRAY_VAR_TYPE = TypeVar("ARRAY_VAR_TYPE", bound=Sequence, covariant=True)
|
|
800
|
+
OTHER_ARRAY_VAR_TYPE = TypeVar("OTHER_ARRAY_VAR_TYPE", bound=Sequence)
|
|
798
801
|
|
|
799
802
|
OTHER_TUPLE = TypeVar("OTHER_TUPLE")
|
|
800
803
|
|
|
@@ -811,7 +814,7 @@ class ArrayVar(Var[ARRAY_VAR_TYPE], python_types=(list, tuple, set)):
|
|
|
811
814
|
def join(self, sep: StringVar | str = "") -> StringVar: ...
|
|
812
815
|
|
|
813
816
|
@overload
|
|
814
|
-
def join(self, sep: NoReturn) -> NoReturn: ...
|
|
817
|
+
def join(self, sep: NoReturn) -> NoReturn: ... # pyright: ignore [reportOverlappingOverload]
|
|
815
818
|
|
|
816
819
|
def join(self, sep: Any = "") -> StringVar:
|
|
817
820
|
"""Join the elements of the array.
|
|
@@ -858,7 +861,7 @@ class ArrayVar(Var[ARRAY_VAR_TYPE], python_types=(list, tuple, set)):
|
|
|
858
861
|
def __add__(self, other: ArrayVar[ARRAY_VAR_TYPE]) -> ArrayVar[ARRAY_VAR_TYPE]: ...
|
|
859
862
|
|
|
860
863
|
@overload
|
|
861
|
-
def __add__(self, other: NoReturn) -> NoReturn: ...
|
|
864
|
+
def __add__(self, other: NoReturn) -> NoReturn: ... # pyright: ignore [reportOverlappingOverload]
|
|
862
865
|
|
|
863
866
|
def __add__(self, other: Any) -> ArrayVar[ARRAY_VAR_TYPE]:
|
|
864
867
|
"""Concatenate two arrays.
|
|
@@ -887,6 +890,11 @@ class ArrayVar(Var[ARRAY_VAR_TYPE], python_types=(list, tuple, set)):
|
|
|
887
890
|
i: Literal[0, -2],
|
|
888
891
|
) -> NumberVar: ...
|
|
889
892
|
|
|
893
|
+
@overload
|
|
894
|
+
def __getitem__(
|
|
895
|
+
self: ArrayVar[Tuple[Any, bool]], i: Literal[1, -1]
|
|
896
|
+
) -> BooleanVar: ...
|
|
897
|
+
|
|
890
898
|
@overload
|
|
891
899
|
def __getitem__(
|
|
892
900
|
self: (
|
|
@@ -914,7 +922,7 @@ class ArrayVar(Var[ARRAY_VAR_TYPE], python_types=(list, tuple, set)):
|
|
|
914
922
|
|
|
915
923
|
@overload
|
|
916
924
|
def __getitem__(
|
|
917
|
-
self:
|
|
925
|
+
self: ARRAY_VAR_OF_LIST_ELEMENT[bool], i: int | NumberVar
|
|
918
926
|
) -> BooleanVar: ...
|
|
919
927
|
|
|
920
928
|
@overload
|
|
@@ -932,23 +940,12 @@ class ArrayVar(Var[ARRAY_VAR_TYPE], python_types=(list, tuple, set)):
|
|
|
932
940
|
self: ARRAY_VAR_OF_LIST_ELEMENT[str], i: int | NumberVar
|
|
933
941
|
) -> StringVar: ...
|
|
934
942
|
|
|
935
|
-
@overload
|
|
936
|
-
def __getitem__(
|
|
937
|
-
self: ARRAY_VAR_OF_LIST_ELEMENT[bool], i: int | NumberVar
|
|
938
|
-
) -> BooleanVar: ...
|
|
939
|
-
|
|
940
943
|
@overload
|
|
941
944
|
def __getitem__(
|
|
942
945
|
self: ARRAY_VAR_OF_LIST_ELEMENT[List[INNER_ARRAY_VAR]],
|
|
943
946
|
i: int | NumberVar,
|
|
944
947
|
) -> ArrayVar[List[INNER_ARRAY_VAR]]: ...
|
|
945
948
|
|
|
946
|
-
@overload
|
|
947
|
-
def __getitem__(
|
|
948
|
-
self: ARRAY_VAR_OF_LIST_ELEMENT[Set[INNER_ARRAY_VAR]],
|
|
949
|
-
i: int | NumberVar,
|
|
950
|
-
) -> ArrayVar[Set[INNER_ARRAY_VAR]]: ...
|
|
951
|
-
|
|
952
949
|
@overload
|
|
953
950
|
def __getitem__(
|
|
954
951
|
self: ARRAY_VAR_OF_LIST_ELEMENT[Tuple[KEY_TYPE, VALUE_TYPE]],
|
|
@@ -967,6 +964,24 @@ class ArrayVar(Var[ARRAY_VAR_TYPE], python_types=(list, tuple, set)):
|
|
|
967
964
|
i: int | NumberVar,
|
|
968
965
|
) -> ObjectVar[Dict[KEY_TYPE, VALUE_TYPE]]: ...
|
|
969
966
|
|
|
967
|
+
@overload
|
|
968
|
+
def __getitem__(
|
|
969
|
+
self: ARRAY_VAR_OF_LIST_ELEMENT[BASE_TYPE],
|
|
970
|
+
i: int | NumberVar,
|
|
971
|
+
) -> ObjectVar[BASE_TYPE]: ...
|
|
972
|
+
|
|
973
|
+
@overload
|
|
974
|
+
def __getitem__(
|
|
975
|
+
self: ARRAY_VAR_OF_LIST_ELEMENT[SQLA_TYPE],
|
|
976
|
+
i: int | NumberVar,
|
|
977
|
+
) -> ObjectVar[SQLA_TYPE]: ...
|
|
978
|
+
|
|
979
|
+
@overload
|
|
980
|
+
def __getitem__(
|
|
981
|
+
self: ARRAY_VAR_OF_LIST_ELEMENT[DATACLASS_TYPE],
|
|
982
|
+
i: int | NumberVar,
|
|
983
|
+
) -> ObjectVar[DATACLASS_TYPE]: ...
|
|
984
|
+
|
|
970
985
|
@overload
|
|
971
986
|
def __getitem__(self, i: int | NumberVar) -> Var: ...
|
|
972
987
|
|
|
@@ -987,7 +1002,7 @@ class ArrayVar(Var[ARRAY_VAR_TYPE], python_types=(list, tuple, set)):
|
|
|
987
1002
|
raise_unsupported_operand_types("[]", (type(self), type(i)))
|
|
988
1003
|
return array_item_operation(self, i)
|
|
989
1004
|
|
|
990
|
-
def length(self) -> NumberVar:
|
|
1005
|
+
def length(self) -> NumberVar[int]:
|
|
991
1006
|
"""Get the length of the array.
|
|
992
1007
|
|
|
993
1008
|
Returns:
|
|
@@ -1089,7 +1104,7 @@ class ArrayVar(Var[ARRAY_VAR_TYPE], python_types=(list, tuple, set)):
|
|
|
1089
1104
|
def __mul__(self, other: NumberVar | int) -> ArrayVar[ARRAY_VAR_TYPE]: ...
|
|
1090
1105
|
|
|
1091
1106
|
@overload
|
|
1092
|
-
def __mul__(self, other: NoReturn) -> NoReturn: ...
|
|
1107
|
+
def __mul__(self, other: NoReturn) -> NoReturn: ... # pyright: ignore [reportOverlappingOverload]
|
|
1093
1108
|
|
|
1094
1109
|
def __mul__(self, other: Any) -> ArrayVar[ARRAY_VAR_TYPE]:
|
|
1095
1110
|
"""Multiply the sequence by a number or integer.
|
|
@@ -1107,7 +1122,7 @@ class ArrayVar(Var[ARRAY_VAR_TYPE], python_types=(list, tuple, set)):
|
|
|
1107
1122
|
|
|
1108
1123
|
return repeat_array_operation(self, other)
|
|
1109
1124
|
|
|
1110
|
-
__rmul__ = __mul__
|
|
1125
|
+
__rmul__ = __mul__
|
|
1111
1126
|
|
|
1112
1127
|
@overload
|
|
1113
1128
|
def __lt__(self, other: ArrayVar[ARRAY_VAR_TYPE]) -> BooleanVar: ...
|
|
@@ -1239,26 +1254,18 @@ class ArrayVar(Var[ARRAY_VAR_TYPE], python_types=(list, tuple, set)):
|
|
|
1239
1254
|
|
|
1240
1255
|
LIST_ELEMENT = TypeVar("LIST_ELEMENT")
|
|
1241
1256
|
|
|
1242
|
-
ARRAY_VAR_OF_LIST_ELEMENT =
|
|
1243
|
-
ArrayVar[List[LIST_ELEMENT]],
|
|
1244
|
-
ArrayVar[Set[LIST_ELEMENT]],
|
|
1245
|
-
ArrayVar[Tuple[LIST_ELEMENT, ...]],
|
|
1246
|
-
]
|
|
1257
|
+
ARRAY_VAR_OF_LIST_ELEMENT = ArrayVar[Sequence[LIST_ELEMENT]]
|
|
1247
1258
|
|
|
1248
1259
|
|
|
1249
1260
|
@dataclasses.dataclass(
|
|
1250
1261
|
eq=False,
|
|
1251
1262
|
frozen=True,
|
|
1252
|
-
|
|
1263
|
+
slots=True,
|
|
1253
1264
|
)
|
|
1254
1265
|
class LiteralArrayVar(CachedVarOperation, LiteralVar, ArrayVar[ARRAY_VAR_TYPE]):
|
|
1255
1266
|
"""Base class for immutable literal array vars."""
|
|
1256
1267
|
|
|
1257
|
-
_var_value: Union[
|
|
1258
|
-
List[Union[Var, Any]],
|
|
1259
|
-
Set[Union[Var, Any]],
|
|
1260
|
-
Tuple[Union[Var, Any], ...],
|
|
1261
|
-
] = dataclasses.field(default_factory=list)
|
|
1268
|
+
_var_value: Sequence[Union[Var, Any]] = dataclasses.field(default=())
|
|
1262
1269
|
|
|
1263
1270
|
@cached_property_no_lock
|
|
1264
1271
|
def _cached_var_name(self) -> str:
|
|
@@ -1303,32 +1310,39 @@ class LiteralArrayVar(CachedVarOperation, LiteralVar, ArrayVar[ARRAY_VAR_TYPE]):
|
|
|
1303
1310
|
|
|
1304
1311
|
Returns:
|
|
1305
1312
|
The JSON representation of the var.
|
|
1313
|
+
|
|
1314
|
+
Raises:
|
|
1315
|
+
TypeError: If the array elements are not of type LiteralVar.
|
|
1306
1316
|
"""
|
|
1307
|
-
|
|
1308
|
-
|
|
1309
|
-
|
|
1310
|
-
|
|
1311
|
-
|
|
1312
|
-
|
|
1313
|
-
|
|
1317
|
+
elements = []
|
|
1318
|
+
for element in self._var_value:
|
|
1319
|
+
element_var = LiteralVar.create(element)
|
|
1320
|
+
if not isinstance(element_var, LiteralVar):
|
|
1321
|
+
raise TypeError(
|
|
1322
|
+
f"Array elements must be of type LiteralVar, not {type(element_var)}"
|
|
1323
|
+
)
|
|
1324
|
+
elements.append(element_var.json())
|
|
1325
|
+
|
|
1326
|
+
return "[" + ", ".join(elements) + "]"
|
|
1314
1327
|
|
|
1315
1328
|
@classmethod
|
|
1316
1329
|
def create(
|
|
1317
1330
|
cls,
|
|
1318
|
-
value:
|
|
1319
|
-
_var_type: Type[
|
|
1331
|
+
value: OTHER_ARRAY_VAR_TYPE,
|
|
1332
|
+
_var_type: Type[OTHER_ARRAY_VAR_TYPE] | None = None,
|
|
1320
1333
|
_var_data: VarData | None = None,
|
|
1321
|
-
) -> LiteralArrayVar[
|
|
1334
|
+
) -> LiteralArrayVar[OTHER_ARRAY_VAR_TYPE]:
|
|
1322
1335
|
"""Create a var from a string value.
|
|
1323
1336
|
|
|
1324
1337
|
Args:
|
|
1325
1338
|
value: The value to create the var from.
|
|
1339
|
+
_var_type: The type of the var.
|
|
1326
1340
|
_var_data: Additional hooks and imports associated with the Var.
|
|
1327
1341
|
|
|
1328
1342
|
Returns:
|
|
1329
1343
|
The var.
|
|
1330
1344
|
"""
|
|
1331
|
-
return
|
|
1345
|
+
return LiteralArrayVar(
|
|
1332
1346
|
_js_expr="",
|
|
1333
1347
|
_var_type=figure_out_type(value) if _var_type is None else _var_type,
|
|
1334
1348
|
_var_data=_var_data,
|
|
@@ -1355,7 +1369,7 @@ def string_split_operation(string: StringVar[Any], sep: StringVar | str = ""):
|
|
|
1355
1369
|
@dataclasses.dataclass(
|
|
1356
1370
|
eq=False,
|
|
1357
1371
|
frozen=True,
|
|
1358
|
-
|
|
1372
|
+
slots=True,
|
|
1359
1373
|
)
|
|
1360
1374
|
class ArraySliceOperation(CachedVarOperation, ArrayVar):
|
|
1361
1375
|
"""Base class for immutable string vars that are the result of a string slice operation."""
|
|
@@ -1592,7 +1606,7 @@ def array_range_operation(
|
|
|
1592
1606
|
The range of numbers.
|
|
1593
1607
|
"""
|
|
1594
1608
|
return var_operation_return(
|
|
1595
|
-
js_expression=f"Array.from({{ length: ({stop!s} - {start!s}) / {step!s} }}, (_, i) => {start!s} + i * {step!s})",
|
|
1609
|
+
js_expression=f"Array.from({{ length: Math.ceil(({stop!s} - {start!s}) / {step!s}) }}, (_, i) => {start!s} + i * {step!s})",
|
|
1596
1610
|
var_type=List[int],
|
|
1597
1611
|
)
|
|
1598
1612
|
|
|
@@ -1618,7 +1632,9 @@ def array_contains_field_operation(
|
|
|
1618
1632
|
|
|
1619
1633
|
|
|
1620
1634
|
@var_operation
|
|
1621
|
-
def array_contains_operation(
|
|
1635
|
+
def array_contains_operation(
|
|
1636
|
+
haystack: ArrayVar, needle: Any | Var
|
|
1637
|
+
) -> CustomVarOperationReturn[bool]:
|
|
1622
1638
|
"""Check if an array contains an element.
|
|
1623
1639
|
|
|
1624
1640
|
Args:
|
|
@@ -1653,15 +1669,11 @@ def repeat_array_operation(
|
|
|
1653
1669
|
)
|
|
1654
1670
|
|
|
1655
1671
|
|
|
1656
|
-
if TYPE_CHECKING:
|
|
1657
|
-
from .function import FunctionVar
|
|
1658
|
-
|
|
1659
|
-
|
|
1660
1672
|
@var_operation
|
|
1661
1673
|
def map_array_operation(
|
|
1662
1674
|
array: ArrayVar[ARRAY_VAR_TYPE],
|
|
1663
1675
|
function: FunctionVar,
|
|
1664
|
-
):
|
|
1676
|
+
) -> CustomVarOperationReturn[List[Any]]:
|
|
1665
1677
|
"""Map a function over an array.
|
|
1666
1678
|
|
|
1667
1679
|
Args:
|
|
@@ -1691,7 +1703,7 @@ def array_concat_operation(
|
|
|
1691
1703
|
"""
|
|
1692
1704
|
return var_operation_return(
|
|
1693
1705
|
js_expression=f"[...{lhs}, ...{rhs}]",
|
|
1694
|
-
var_type=Union[lhs._var_type, rhs._var_type],
|
|
1706
|
+
var_type=Union[lhs._var_type, rhs._var_type], # pyright: ignore [reportArgumentType]
|
|
1695
1707
|
)
|
|
1696
1708
|
|
|
1697
1709
|
|
|
@@ -1702,7 +1714,7 @@ class ColorVar(StringVar[Color], python_types=Color):
|
|
|
1702
1714
|
@dataclasses.dataclass(
|
|
1703
1715
|
eq=False,
|
|
1704
1716
|
frozen=True,
|
|
1705
|
-
|
|
1717
|
+
slots=True,
|
|
1706
1718
|
)
|
|
1707
1719
|
class LiteralColorVar(CachedVarOperation, LiteralVar, ColorVar):
|
|
1708
1720
|
"""Base class for immutable literal color vars."""
|
|
@@ -1,20 +1,19 @@
|
|
|
1
|
-
Metadata-Version: 2.
|
|
1
|
+
Metadata-Version: 2.3
|
|
2
2
|
Name: reflex
|
|
3
|
-
Version: 0.
|
|
3
|
+
Version: 0.7.0a1
|
|
4
4
|
Summary: Web apps in pure Python.
|
|
5
|
-
Home-page: https://reflex.dev
|
|
6
5
|
License: Apache-2.0
|
|
7
6
|
Keywords: web,framework
|
|
8
7
|
Author: Nikhil Rao
|
|
9
8
|
Author-email: nikhil@reflex.dev
|
|
10
|
-
Requires-Python: >=3.
|
|
9
|
+
Requires-Python: >=3.10,<4.0
|
|
11
10
|
Classifier: Development Status :: 4 - Beta
|
|
12
11
|
Classifier: License :: OSI Approved :: Apache Software License
|
|
13
12
|
Classifier: Programming Language :: Python :: 3
|
|
14
|
-
Classifier: Programming Language :: Python :: 3.9
|
|
15
13
|
Classifier: Programming Language :: Python :: 3.10
|
|
16
14
|
Classifier: Programming Language :: Python :: 3.11
|
|
17
15
|
Classifier: Programming Language :: Python :: 3.12
|
|
16
|
+
Classifier: Programming Language :: Python :: 3.13
|
|
18
17
|
Requires-Dist: alembic (>=1.11.1,<2.0)
|
|
19
18
|
Requires-Dist: build (>=1.0.3,<2.0)
|
|
20
19
|
Requires-Dist: charset-normalizer (>=3.3.2,<4.0)
|
|
@@ -32,8 +31,7 @@ Requires-Dist: python-engineio (!=4.6.0)
|
|
|
32
31
|
Requires-Dist: python-multipart (>=0.0.5,<0.1)
|
|
33
32
|
Requires-Dist: python-socketio (>=5.7.0,<6.0)
|
|
34
33
|
Requires-Dist: redis (>=4.3.5,<6.0)
|
|
35
|
-
Requires-Dist: reflex-
|
|
36
|
-
Requires-Dist: reflex-hosting-cli (>=0.1.29,<2.0)
|
|
34
|
+
Requires-Dist: reflex-hosting-cli (>=0.1.29)
|
|
37
35
|
Requires-Dist: rich (>=13.0.0,<14.0)
|
|
38
36
|
Requires-Dist: setuptools (>=75.0)
|
|
39
37
|
Requires-Dist: sqlmodel (>=0.0.14,<0.1)
|
|
@@ -47,6 +45,7 @@ Requires-Dist: wheel (>=0.42.0,<1.0)
|
|
|
47
45
|
Requires-Dist: wrapt (>=1.11.0,<2.0) ; python_version < "3.11"
|
|
48
46
|
Requires-Dist: wrapt (>=1.14.0,<2.0) ; python_version >= "3.11"
|
|
49
47
|
Project-URL: Documentation, https://reflex.dev/docs/getting-started/introduction
|
|
48
|
+
Project-URL: Homepage, https://reflex.dev
|
|
50
49
|
Project-URL: Repository, https://github.com/reflex-dev/reflex
|
|
51
50
|
Description-Content-Type: text/markdown
|
|
52
51
|
|
|
@@ -86,7 +85,7 @@ See our [architecture page](https://reflex.dev/blog/2024-03-21-reflex-architectu
|
|
|
86
85
|
|
|
87
86
|
## ⚙️ Installation
|
|
88
87
|
|
|
89
|
-
Open a terminal and run (Requires Python 3.
|
|
88
|
+
Open a terminal and run (Requires Python 3.10+):
|
|
90
89
|
|
|
91
90
|
```bash
|
|
92
91
|
pip install reflex
|