reflex 0.7.4a0__py3-none-any.whl → 0.7.4a2__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/web/components/reflex/radix_themes_color_mode_provider.js +9 -1
- reflex/app.py +20 -2
- reflex/base.py +3 -3
- reflex/compiler/compiler.py +7 -4
- reflex/components/component.py +6 -3
- reflex/components/core/client_side_routing.py +3 -3
- reflex/components/core/cond.py +20 -12
- reflex/components/dynamic.py +2 -4
- reflex/components/lucide/icon.py +20 -27
- reflex/config.py +18 -18
- reflex/custom_components/custom_components.py +8 -3
- reflex/reflex.py +22 -4
- reflex/state.py +1 -0
- reflex/utils/exec.py +146 -64
- reflex/utils/prerequisites.py +93 -3
- reflex/utils/processes.py +51 -19
- reflex/vars/base.py +2 -38
- reflex/vars/datetime.py +10 -34
- reflex/vars/number.py +16 -112
- reflex/vars/sequence.py +99 -108
- {reflex-0.7.4a0.dist-info → reflex-0.7.4a2.dist-info}/METADATA +4 -2
- {reflex-0.7.4a0.dist-info → reflex-0.7.4a2.dist-info}/RECORD +25 -26
- reflex/app_module_for_backend.py +0 -33
- {reflex-0.7.4a0.dist-info → reflex-0.7.4a2.dist-info}/WHEEL +0 -0
- {reflex-0.7.4a0.dist-info → reflex-0.7.4a2.dist-info}/entry_points.txt +0 -0
- {reflex-0.7.4a0.dist-info → reflex-0.7.4a2.dist-info}/licenses/LICENSE +0 -0
reflex/vars/datetime.py
CHANGED
|
@@ -4,7 +4,7 @@ from __future__ import annotations
|
|
|
4
4
|
|
|
5
5
|
import dataclasses
|
|
6
6
|
from datetime import date, datetime
|
|
7
|
-
from typing import Any,
|
|
7
|
+
from typing import Any, TypeVar
|
|
8
8
|
|
|
9
9
|
from reflex.utils.exceptions import VarTypeError
|
|
10
10
|
from reflex.vars.number import BooleanVar
|
|
@@ -35,13 +35,7 @@ def raise_var_type_error():
|
|
|
35
35
|
class DateTimeVar(Var[DATETIME_T], python_types=(datetime, date)):
|
|
36
36
|
"""A variable that holds a datetime or date object."""
|
|
37
37
|
|
|
38
|
-
|
|
39
|
-
def __lt__(self, other: datetime_types) -> BooleanVar: ...
|
|
40
|
-
|
|
41
|
-
@overload
|
|
42
|
-
def __lt__(self, other: NoReturn) -> NoReturn: ... # pyright: ignore [reportOverlappingOverload]
|
|
43
|
-
|
|
44
|
-
def __lt__(self, other: Any):
|
|
38
|
+
def __lt__(self, other: datetime_types | DateTimeVar) -> BooleanVar:
|
|
45
39
|
"""Less than comparison.
|
|
46
40
|
|
|
47
41
|
Args:
|
|
@@ -54,13 +48,7 @@ class DateTimeVar(Var[DATETIME_T], python_types=(datetime, date)):
|
|
|
54
48
|
raise_var_type_error()
|
|
55
49
|
return date_lt_operation(self, other)
|
|
56
50
|
|
|
57
|
-
|
|
58
|
-
def __le__(self, other: datetime_types) -> BooleanVar: ...
|
|
59
|
-
|
|
60
|
-
@overload
|
|
61
|
-
def __le__(self, other: NoReturn) -> NoReturn: ... # pyright: ignore [reportOverlappingOverload]
|
|
62
|
-
|
|
63
|
-
def __le__(self, other: Any):
|
|
51
|
+
def __le__(self, other: datetime_types | DateTimeVar) -> BooleanVar:
|
|
64
52
|
"""Less than or equal comparison.
|
|
65
53
|
|
|
66
54
|
Args:
|
|
@@ -73,13 +61,7 @@ class DateTimeVar(Var[DATETIME_T], python_types=(datetime, date)):
|
|
|
73
61
|
raise_var_type_error()
|
|
74
62
|
return date_le_operation(self, other)
|
|
75
63
|
|
|
76
|
-
|
|
77
|
-
def __gt__(self, other: datetime_types) -> BooleanVar: ...
|
|
78
|
-
|
|
79
|
-
@overload
|
|
80
|
-
def __gt__(self, other: NoReturn) -> NoReturn: ... # pyright: ignore [reportOverlappingOverload]
|
|
81
|
-
|
|
82
|
-
def __gt__(self, other: Any):
|
|
64
|
+
def __gt__(self, other: datetime_types | DateTimeVar) -> BooleanVar:
|
|
83
65
|
"""Greater than comparison.
|
|
84
66
|
|
|
85
67
|
Args:
|
|
@@ -92,13 +74,7 @@ class DateTimeVar(Var[DATETIME_T], python_types=(datetime, date)):
|
|
|
92
74
|
raise_var_type_error()
|
|
93
75
|
return date_gt_operation(self, other)
|
|
94
76
|
|
|
95
|
-
|
|
96
|
-
def __ge__(self, other: datetime_types) -> BooleanVar: ...
|
|
97
|
-
|
|
98
|
-
@overload
|
|
99
|
-
def __ge__(self, other: NoReturn) -> NoReturn: ... # pyright: ignore [reportOverlappingOverload]
|
|
100
|
-
|
|
101
|
-
def __ge__(self, other: Any):
|
|
77
|
+
def __ge__(self, other: datetime_types | DateTimeVar) -> BooleanVar:
|
|
102
78
|
"""Greater than or equal comparison.
|
|
103
79
|
|
|
104
80
|
Args:
|
|
@@ -113,7 +89,7 @@ class DateTimeVar(Var[DATETIME_T], python_types=(datetime, date)):
|
|
|
113
89
|
|
|
114
90
|
|
|
115
91
|
@var_operation
|
|
116
|
-
def date_gt_operation(lhs:
|
|
92
|
+
def date_gt_operation(lhs: DateTimeVar | Any, rhs: DateTimeVar | Any):
|
|
117
93
|
"""Greater than comparison.
|
|
118
94
|
|
|
119
95
|
Args:
|
|
@@ -127,7 +103,7 @@ def date_gt_operation(lhs: Var | Any, rhs: Var | Any) -> CustomVarOperationRetur
|
|
|
127
103
|
|
|
128
104
|
|
|
129
105
|
@var_operation
|
|
130
|
-
def date_lt_operation(lhs:
|
|
106
|
+
def date_lt_operation(lhs: DateTimeVar | Any, rhs: DateTimeVar | Any):
|
|
131
107
|
"""Less than comparison.
|
|
132
108
|
|
|
133
109
|
Args:
|
|
@@ -141,7 +117,7 @@ def date_lt_operation(lhs: Var | Any, rhs: Var | Any) -> CustomVarOperationRetur
|
|
|
141
117
|
|
|
142
118
|
|
|
143
119
|
@var_operation
|
|
144
|
-
def date_le_operation(lhs:
|
|
120
|
+
def date_le_operation(lhs: DateTimeVar | Any, rhs: DateTimeVar | Any):
|
|
145
121
|
"""Less than or equal comparison.
|
|
146
122
|
|
|
147
123
|
Args:
|
|
@@ -155,7 +131,7 @@ def date_le_operation(lhs: Var | Any, rhs: Var | Any) -> CustomVarOperationRetur
|
|
|
155
131
|
|
|
156
132
|
|
|
157
133
|
@var_operation
|
|
158
|
-
def date_ge_operation(lhs:
|
|
134
|
+
def date_ge_operation(lhs: DateTimeVar | Any, rhs: DateTimeVar | Any):
|
|
159
135
|
"""Greater than or equal comparison.
|
|
160
136
|
|
|
161
137
|
Args:
|
|
@@ -172,7 +148,7 @@ def date_compare_operation(
|
|
|
172
148
|
lhs: DateTimeVar[DATETIME_T] | Any,
|
|
173
149
|
rhs: DateTimeVar[DATETIME_T] | Any,
|
|
174
150
|
strict: bool = False,
|
|
175
|
-
) -> CustomVarOperationReturn:
|
|
151
|
+
) -> CustomVarOperationReturn[bool]:
|
|
176
152
|
"""Check if the value is less than the other value.
|
|
177
153
|
|
|
178
154
|
Args:
|
reflex/vars/number.py
CHANGED
|
@@ -61,13 +61,7 @@ def raise_unsupported_operand_types(
|
|
|
61
61
|
class NumberVar(Var[NUMBER_T], python_types=(int, float)):
|
|
62
62
|
"""Base class for immutable number vars."""
|
|
63
63
|
|
|
64
|
-
|
|
65
|
-
def __add__(self, other: number_types) -> NumberVar: ...
|
|
66
|
-
|
|
67
|
-
@overload
|
|
68
|
-
def __add__(self, other: NoReturn) -> NoReturn: ... # pyright: ignore [reportOverlappingOverload]
|
|
69
|
-
|
|
70
|
-
def __add__(self, other: Any):
|
|
64
|
+
def __add__(self, other: number_types) -> NumberVar:
|
|
71
65
|
"""Add two numbers.
|
|
72
66
|
|
|
73
67
|
Args:
|
|
@@ -80,13 +74,7 @@ class NumberVar(Var[NUMBER_T], python_types=(int, float)):
|
|
|
80
74
|
raise_unsupported_operand_types("+", (type(self), type(other)))
|
|
81
75
|
return number_add_operation(self, +other)
|
|
82
76
|
|
|
83
|
-
|
|
84
|
-
def __radd__(self, other: number_types) -> NumberVar: ...
|
|
85
|
-
|
|
86
|
-
@overload
|
|
87
|
-
def __radd__(self, other: NoReturn) -> NoReturn: ... # pyright: ignore [reportOverlappingOverload]
|
|
88
|
-
|
|
89
|
-
def __radd__(self, other: Any):
|
|
77
|
+
def __radd__(self, other: number_types) -> NumberVar:
|
|
90
78
|
"""Add two numbers.
|
|
91
79
|
|
|
92
80
|
Args:
|
|
@@ -99,13 +87,7 @@ class NumberVar(Var[NUMBER_T], python_types=(int, float)):
|
|
|
99
87
|
raise_unsupported_operand_types("+", (type(other), type(self)))
|
|
100
88
|
return number_add_operation(+other, self)
|
|
101
89
|
|
|
102
|
-
|
|
103
|
-
def __sub__(self, other: number_types) -> NumberVar: ...
|
|
104
|
-
|
|
105
|
-
@overload
|
|
106
|
-
def __sub__(self, other: NoReturn) -> NoReturn: ... # pyright: ignore [reportOverlappingOverload]
|
|
107
|
-
|
|
108
|
-
def __sub__(self, other: Any):
|
|
90
|
+
def __sub__(self, other: number_types) -> NumberVar:
|
|
109
91
|
"""Subtract two numbers.
|
|
110
92
|
|
|
111
93
|
Args:
|
|
@@ -119,13 +101,7 @@ class NumberVar(Var[NUMBER_T], python_types=(int, float)):
|
|
|
119
101
|
|
|
120
102
|
return number_subtract_operation(self, +other)
|
|
121
103
|
|
|
122
|
-
|
|
123
|
-
def __rsub__(self, other: number_types) -> NumberVar: ...
|
|
124
|
-
|
|
125
|
-
@overload
|
|
126
|
-
def __rsub__(self, other: NoReturn) -> NoReturn: ... # pyright: ignore [reportOverlappingOverload]
|
|
127
|
-
|
|
128
|
-
def __rsub__(self, other: Any):
|
|
104
|
+
def __rsub__(self, other: number_types) -> NumberVar:
|
|
129
105
|
"""Subtract two numbers.
|
|
130
106
|
|
|
131
107
|
Args:
|
|
@@ -201,13 +177,7 @@ class NumberVar(Var[NUMBER_T], python_types=(int, float)):
|
|
|
201
177
|
|
|
202
178
|
return number_multiply_operation(+other, self)
|
|
203
179
|
|
|
204
|
-
|
|
205
|
-
def __truediv__(self, other: number_types) -> NumberVar: ...
|
|
206
|
-
|
|
207
|
-
@overload
|
|
208
|
-
def __truediv__(self, other: NoReturn) -> NoReturn: ... # pyright: ignore [reportOverlappingOverload]
|
|
209
|
-
|
|
210
|
-
def __truediv__(self, other: Any):
|
|
180
|
+
def __truediv__(self, other: number_types) -> NumberVar:
|
|
211
181
|
"""Divide two numbers.
|
|
212
182
|
|
|
213
183
|
Args:
|
|
@@ -221,13 +191,7 @@ class NumberVar(Var[NUMBER_T], python_types=(int, float)):
|
|
|
221
191
|
|
|
222
192
|
return number_true_division_operation(self, +other)
|
|
223
193
|
|
|
224
|
-
|
|
225
|
-
def __rtruediv__(self, other: number_types) -> NumberVar: ...
|
|
226
|
-
|
|
227
|
-
@overload
|
|
228
|
-
def __rtruediv__(self, other: NoReturn) -> NoReturn: ... # pyright: ignore [reportOverlappingOverload]
|
|
229
|
-
|
|
230
|
-
def __rtruediv__(self, other: Any):
|
|
194
|
+
def __rtruediv__(self, other: number_types) -> NumberVar:
|
|
231
195
|
"""Divide two numbers.
|
|
232
196
|
|
|
233
197
|
Args:
|
|
@@ -241,13 +205,7 @@ class NumberVar(Var[NUMBER_T], python_types=(int, float)):
|
|
|
241
205
|
|
|
242
206
|
return number_true_division_operation(+other, self)
|
|
243
207
|
|
|
244
|
-
|
|
245
|
-
def __floordiv__(self, other: number_types) -> NumberVar: ...
|
|
246
|
-
|
|
247
|
-
@overload
|
|
248
|
-
def __floordiv__(self, other: NoReturn) -> NoReturn: ... # pyright: ignore [reportOverlappingOverload]
|
|
249
|
-
|
|
250
|
-
def __floordiv__(self, other: Any):
|
|
208
|
+
def __floordiv__(self, other: number_types) -> NumberVar:
|
|
251
209
|
"""Floor divide two numbers.
|
|
252
210
|
|
|
253
211
|
Args:
|
|
@@ -261,13 +219,7 @@ class NumberVar(Var[NUMBER_T], python_types=(int, float)):
|
|
|
261
219
|
|
|
262
220
|
return number_floor_division_operation(self, +other)
|
|
263
221
|
|
|
264
|
-
|
|
265
|
-
def __rfloordiv__(self, other: number_types) -> NumberVar: ...
|
|
266
|
-
|
|
267
|
-
@overload
|
|
268
|
-
def __rfloordiv__(self, other: NoReturn) -> NoReturn: ... # pyright: ignore [reportOverlappingOverload]
|
|
269
|
-
|
|
270
|
-
def __rfloordiv__(self, other: Any):
|
|
222
|
+
def __rfloordiv__(self, other: number_types) -> NumberVar:
|
|
271
223
|
"""Floor divide two numbers.
|
|
272
224
|
|
|
273
225
|
Args:
|
|
@@ -281,13 +233,7 @@ class NumberVar(Var[NUMBER_T], python_types=(int, float)):
|
|
|
281
233
|
|
|
282
234
|
return number_floor_division_operation(+other, self)
|
|
283
235
|
|
|
284
|
-
|
|
285
|
-
def __mod__(self, other: number_types) -> NumberVar: ...
|
|
286
|
-
|
|
287
|
-
@overload
|
|
288
|
-
def __mod__(self, other: NoReturn) -> NoReturn: ... # pyright: ignore [reportOverlappingOverload]
|
|
289
|
-
|
|
290
|
-
def __mod__(self, other: Any):
|
|
236
|
+
def __mod__(self, other: number_types) -> NumberVar:
|
|
291
237
|
"""Modulo two numbers.
|
|
292
238
|
|
|
293
239
|
Args:
|
|
@@ -301,13 +247,7 @@ class NumberVar(Var[NUMBER_T], python_types=(int, float)):
|
|
|
301
247
|
|
|
302
248
|
return number_modulo_operation(self, +other)
|
|
303
249
|
|
|
304
|
-
|
|
305
|
-
def __rmod__(self, other: number_types) -> NumberVar: ...
|
|
306
|
-
|
|
307
|
-
@overload
|
|
308
|
-
def __rmod__(self, other: NoReturn) -> NoReturn: ... # pyright: ignore [reportOverlappingOverload]
|
|
309
|
-
|
|
310
|
-
def __rmod__(self, other: Any):
|
|
250
|
+
def __rmod__(self, other: number_types) -> NumberVar:
|
|
311
251
|
"""Modulo two numbers.
|
|
312
252
|
|
|
313
253
|
Args:
|
|
@@ -321,13 +261,7 @@ class NumberVar(Var[NUMBER_T], python_types=(int, float)):
|
|
|
321
261
|
|
|
322
262
|
return number_modulo_operation(+other, self)
|
|
323
263
|
|
|
324
|
-
|
|
325
|
-
def __pow__(self, other: number_types) -> NumberVar: ...
|
|
326
|
-
|
|
327
|
-
@overload
|
|
328
|
-
def __pow__(self, other: NoReturn) -> NoReturn: ... # pyright: ignore [reportOverlappingOverload]
|
|
329
|
-
|
|
330
|
-
def __pow__(self, other: Any):
|
|
264
|
+
def __pow__(self, other: number_types) -> NumberVar:
|
|
331
265
|
"""Exponentiate two numbers.
|
|
332
266
|
|
|
333
267
|
Args:
|
|
@@ -341,13 +275,7 @@ class NumberVar(Var[NUMBER_T], python_types=(int, float)):
|
|
|
341
275
|
|
|
342
276
|
return number_exponent_operation(self, +other)
|
|
343
277
|
|
|
344
|
-
|
|
345
|
-
def __rpow__(self, other: number_types) -> NumberVar: ...
|
|
346
|
-
|
|
347
|
-
@overload
|
|
348
|
-
def __rpow__(self, other: NoReturn) -> NoReturn: ... # pyright: ignore [reportOverlappingOverload]
|
|
349
|
-
|
|
350
|
-
def __rpow__(self, other: Any):
|
|
278
|
+
def __rpow__(self, other: number_types) -> NumberVar:
|
|
351
279
|
"""Exponentiate two numbers.
|
|
352
280
|
|
|
353
281
|
Args:
|
|
@@ -417,13 +345,7 @@ class NumberVar(Var[NUMBER_T], python_types=(int, float)):
|
|
|
417
345
|
"""
|
|
418
346
|
return number_trunc_operation(self)
|
|
419
347
|
|
|
420
|
-
|
|
421
|
-
def __lt__(self, other: number_types) -> BooleanVar: ...
|
|
422
|
-
|
|
423
|
-
@overload
|
|
424
|
-
def __lt__(self, other: NoReturn) -> NoReturn: ... # pyright: ignore [reportOverlappingOverload]
|
|
425
|
-
|
|
426
|
-
def __lt__(self, other: Any):
|
|
348
|
+
def __lt__(self, other: number_types) -> BooleanVar:
|
|
427
349
|
"""Less than comparison.
|
|
428
350
|
|
|
429
351
|
Args:
|
|
@@ -436,13 +358,7 @@ class NumberVar(Var[NUMBER_T], python_types=(int, float)):
|
|
|
436
358
|
raise_unsupported_operand_types("<", (type(self), type(other)))
|
|
437
359
|
return less_than_operation(+self, +other)
|
|
438
360
|
|
|
439
|
-
|
|
440
|
-
def __le__(self, other: number_types) -> BooleanVar: ...
|
|
441
|
-
|
|
442
|
-
@overload
|
|
443
|
-
def __le__(self, other: NoReturn) -> NoReturn: ... # pyright: ignore [reportOverlappingOverload]
|
|
444
|
-
|
|
445
|
-
def __le__(self, other: Any):
|
|
361
|
+
def __le__(self, other: number_types) -> BooleanVar:
|
|
446
362
|
"""Less than or equal comparison.
|
|
447
363
|
|
|
448
364
|
Args:
|
|
@@ -481,13 +397,7 @@ class NumberVar(Var[NUMBER_T], python_types=(int, float)):
|
|
|
481
397
|
return not_equal_operation(+self, +other)
|
|
482
398
|
return not_equal_operation(self, other)
|
|
483
399
|
|
|
484
|
-
|
|
485
|
-
def __gt__(self, other: number_types) -> BooleanVar: ...
|
|
486
|
-
|
|
487
|
-
@overload
|
|
488
|
-
def __gt__(self, other: NoReturn) -> NoReturn: ... # pyright: ignore [reportOverlappingOverload]
|
|
489
|
-
|
|
490
|
-
def __gt__(self, other: Any):
|
|
400
|
+
def __gt__(self, other: number_types) -> BooleanVar:
|
|
491
401
|
"""Greater than comparison.
|
|
492
402
|
|
|
493
403
|
Args:
|
|
@@ -500,13 +410,7 @@ class NumberVar(Var[NUMBER_T], python_types=(int, float)):
|
|
|
500
410
|
raise_unsupported_operand_types(">", (type(self), type(other)))
|
|
501
411
|
return greater_than_operation(+self, +other)
|
|
502
412
|
|
|
503
|
-
|
|
504
|
-
def __ge__(self, other: number_types) -> BooleanVar: ...
|
|
505
|
-
|
|
506
|
-
@overload
|
|
507
|
-
def __ge__(self, other: NoReturn) -> NoReturn: ... # pyright: ignore [reportOverlappingOverload]
|
|
508
|
-
|
|
509
|
-
def __ge__(self, other: Any):
|
|
413
|
+
def __ge__(self, other: number_types) -> BooleanVar:
|
|
510
414
|
"""Greater than or equal comparison.
|
|
511
415
|
|
|
512
416
|
Args:
|
reflex/vars/sequence.py
CHANGED
|
@@ -14,7 +14,6 @@ from typing import (
|
|
|
14
14
|
List,
|
|
15
15
|
Literal,
|
|
16
16
|
Mapping,
|
|
17
|
-
NoReturn,
|
|
18
17
|
Sequence,
|
|
19
18
|
Type,
|
|
20
19
|
TypeVar,
|
|
@@ -76,13 +75,7 @@ VALUE_TYPE = TypeVar("VALUE_TYPE")
|
|
|
76
75
|
class ArrayVar(Var[ARRAY_VAR_TYPE], python_types=(Sequence, set)):
|
|
77
76
|
"""Base class for immutable array vars."""
|
|
78
77
|
|
|
79
|
-
|
|
80
|
-
def join(self, sep: StringVar | str = "") -> StringVar: ...
|
|
81
|
-
|
|
82
|
-
@overload
|
|
83
|
-
def join(self, sep: NoReturn) -> NoReturn: ... # pyright: ignore [reportOverlappingOverload]
|
|
84
|
-
|
|
85
|
-
def join(self, sep: Any = "") -> StringVar:
|
|
78
|
+
def join(self, sep: StringVar | str = "") -> StringVar:
|
|
86
79
|
"""Join the elements of the array.
|
|
87
80
|
|
|
88
81
|
Args:
|
|
@@ -123,13 +116,7 @@ class ArrayVar(Var[ARRAY_VAR_TYPE], python_types=(Sequence, set)):
|
|
|
123
116
|
"""
|
|
124
117
|
return array_reverse_operation(self)
|
|
125
118
|
|
|
126
|
-
|
|
127
|
-
def __add__(self, other: ArrayVar[ARRAY_VAR_TYPE]) -> ArrayVar[ARRAY_VAR_TYPE]: ...
|
|
128
|
-
|
|
129
|
-
@overload
|
|
130
|
-
def __add__(self, other: NoReturn) -> NoReturn: ... # pyright: ignore [reportOverlappingOverload]
|
|
131
|
-
|
|
132
|
-
def __add__(self, other: Any) -> ArrayVar[ARRAY_VAR_TYPE]:
|
|
119
|
+
def __add__(self, other: ArrayVar[ARRAY_VAR_TYPE]) -> ArrayVar[ARRAY_VAR_TYPE]:
|
|
133
120
|
"""Concatenate two arrays.
|
|
134
121
|
|
|
135
122
|
Parameters:
|
|
@@ -352,13 +339,7 @@ class ArrayVar(Var[ARRAY_VAR_TYPE], python_types=(Sequence, set)):
|
|
|
352
339
|
"""
|
|
353
340
|
return array_pluck_operation(self, field)
|
|
354
341
|
|
|
355
|
-
|
|
356
|
-
def __mul__(self, other: NumberVar | int) -> ArrayVar[ARRAY_VAR_TYPE]: ...
|
|
357
|
-
|
|
358
|
-
@overload
|
|
359
|
-
def __mul__(self, other: NoReturn) -> NoReturn: ... # pyright: ignore [reportOverlappingOverload]
|
|
360
|
-
|
|
361
|
-
def __mul__(self, other: Any) -> ArrayVar[ARRAY_VAR_TYPE]:
|
|
342
|
+
def __mul__(self, other: NumberVar | int) -> ArrayVar[ARRAY_VAR_TYPE]:
|
|
362
343
|
"""Multiply the sequence by a number or integer.
|
|
363
344
|
|
|
364
345
|
Parameters:
|
|
@@ -603,13 +584,7 @@ STRING_TYPE = TypingExtensionsTypeVar("STRING_TYPE", default=str)
|
|
|
603
584
|
class StringVar(Var[STRING_TYPE], python_types=str):
|
|
604
585
|
"""Base class for immutable string vars."""
|
|
605
586
|
|
|
606
|
-
|
|
607
|
-
def __add__(self, other: StringVar | str) -> ConcatVarOperation: ...
|
|
608
|
-
|
|
609
|
-
@overload
|
|
610
|
-
def __add__(self, other: NoReturn) -> NoReturn: ... # pyright: ignore [reportOverlappingOverload]
|
|
611
|
-
|
|
612
|
-
def __add__(self, other: Any) -> ConcatVarOperation:
|
|
587
|
+
def __add__(self, other: StringVar | str) -> ConcatVarOperation:
|
|
613
588
|
"""Concatenate two strings.
|
|
614
589
|
|
|
615
590
|
Args:
|
|
@@ -623,13 +598,7 @@ class StringVar(Var[STRING_TYPE], python_types=str):
|
|
|
623
598
|
|
|
624
599
|
return ConcatVarOperation.create(self, other)
|
|
625
600
|
|
|
626
|
-
|
|
627
|
-
def __radd__(self, other: StringVar | str) -> ConcatVarOperation: ...
|
|
628
|
-
|
|
629
|
-
@overload
|
|
630
|
-
def __radd__(self, other: NoReturn) -> NoReturn: ... # pyright: ignore [reportOverlappingOverload]
|
|
631
|
-
|
|
632
|
-
def __radd__(self, other: Any) -> ConcatVarOperation:
|
|
601
|
+
def __radd__(self, other: StringVar | str) -> ConcatVarOperation:
|
|
633
602
|
"""Concatenate two strings.
|
|
634
603
|
|
|
635
604
|
Args:
|
|
@@ -643,13 +612,7 @@ class StringVar(Var[STRING_TYPE], python_types=str):
|
|
|
643
612
|
|
|
644
613
|
return ConcatVarOperation.create(other, self)
|
|
645
614
|
|
|
646
|
-
|
|
647
|
-
def __mul__(self, other: NumberVar | int) -> StringVar: ...
|
|
648
|
-
|
|
649
|
-
@overload
|
|
650
|
-
def __mul__(self, other: NoReturn) -> NoReturn: ... # pyright: ignore [reportOverlappingOverload]
|
|
651
|
-
|
|
652
|
-
def __mul__(self, other: Any) -> StringVar:
|
|
615
|
+
def __mul__(self, other: NumberVar | int) -> StringVar:
|
|
653
616
|
"""Multiply the sequence by a number or an integer.
|
|
654
617
|
|
|
655
618
|
Args:
|
|
@@ -663,13 +626,7 @@ class StringVar(Var[STRING_TYPE], python_types=str):
|
|
|
663
626
|
|
|
664
627
|
return (self.split() * other).join()
|
|
665
628
|
|
|
666
|
-
|
|
667
|
-
def __rmul__(self, other: NumberVar | int) -> StringVar: ...
|
|
668
|
-
|
|
669
|
-
@overload
|
|
670
|
-
def __rmul__(self, other: NoReturn) -> NoReturn: ... # pyright: ignore [reportOverlappingOverload]
|
|
671
|
-
|
|
672
|
-
def __rmul__(self, other: Any) -> StringVar:
|
|
629
|
+
def __rmul__(self, other: NumberVar | int) -> StringVar:
|
|
673
630
|
"""Multiply the sequence by a number or an integer.
|
|
674
631
|
|
|
675
632
|
Args:
|
|
@@ -762,17 +719,9 @@ class StringVar(Var[STRING_TYPE], python_types=str):
|
|
|
762
719
|
"""
|
|
763
720
|
return self.split().reverse().join()
|
|
764
721
|
|
|
765
|
-
@overload
|
|
766
722
|
def contains(
|
|
767
723
|
self, other: StringVar | str, field: StringVar | str | None = None
|
|
768
|
-
) -> BooleanVar:
|
|
769
|
-
|
|
770
|
-
@overload
|
|
771
|
-
def contains( # pyright: ignore [reportOverlappingOverload]
|
|
772
|
-
self, other: NoReturn, field: StringVar | str | None = None
|
|
773
|
-
) -> NoReturn: ...
|
|
774
|
-
|
|
775
|
-
def contains(self, other: Any, field: Any = None) -> BooleanVar:
|
|
724
|
+
) -> BooleanVar:
|
|
776
725
|
"""Check if the string contains another string.
|
|
777
726
|
|
|
778
727
|
Args:
|
|
@@ -790,13 +739,7 @@ class StringVar(Var[STRING_TYPE], python_types=str):
|
|
|
790
739
|
return string_contains_field_operation(self, other, field)
|
|
791
740
|
return string_contains_operation(self, other)
|
|
792
741
|
|
|
793
|
-
|
|
794
|
-
def split(self, separator: StringVar | str = "") -> ArrayVar[list[str]]: ...
|
|
795
|
-
|
|
796
|
-
@overload
|
|
797
|
-
def split(self, separator: NoReturn) -> NoReturn: ... # pyright: ignore [reportOverlappingOverload]
|
|
798
|
-
|
|
799
|
-
def split(self, separator: Any = "") -> ArrayVar[list[str]]:
|
|
742
|
+
def split(self, separator: StringVar | str = "") -> ArrayVar[list[str]]:
|
|
800
743
|
"""Split the string.
|
|
801
744
|
|
|
802
745
|
Args:
|
|
@@ -809,13 +752,7 @@ class StringVar(Var[STRING_TYPE], python_types=str):
|
|
|
809
752
|
raise_unsupported_operand_types("split", (type(self), type(separator)))
|
|
810
753
|
return string_split_operation(self, separator)
|
|
811
754
|
|
|
812
|
-
|
|
813
|
-
def startswith(self, prefix: StringVar | str) -> BooleanVar: ...
|
|
814
|
-
|
|
815
|
-
@overload
|
|
816
|
-
def startswith(self, prefix: NoReturn) -> NoReturn: ... # pyright: ignore [reportOverlappingOverload]
|
|
817
|
-
|
|
818
|
-
def startswith(self, prefix: Any) -> BooleanVar:
|
|
755
|
+
def startswith(self, prefix: StringVar | str) -> BooleanVar:
|
|
819
756
|
"""Check if the string starts with a prefix.
|
|
820
757
|
|
|
821
758
|
Args:
|
|
@@ -828,13 +765,7 @@ class StringVar(Var[STRING_TYPE], python_types=str):
|
|
|
828
765
|
raise_unsupported_operand_types("startswith", (type(self), type(prefix)))
|
|
829
766
|
return string_starts_with_operation(self, prefix)
|
|
830
767
|
|
|
831
|
-
|
|
832
|
-
def endswith(self, suffix: StringVar | str) -> BooleanVar: ...
|
|
833
|
-
|
|
834
|
-
@overload
|
|
835
|
-
def endswith(self, suffix: NoReturn) -> NoReturn: ... # pyright: ignore [reportOverlappingOverload]
|
|
836
|
-
|
|
837
|
-
def endswith(self, suffix: Any) -> BooleanVar:
|
|
768
|
+
def endswith(self, suffix: StringVar | str) -> BooleanVar:
|
|
838
769
|
"""Check if the string ends with a suffix.
|
|
839
770
|
|
|
840
771
|
Args:
|
|
@@ -847,13 +778,7 @@ class StringVar(Var[STRING_TYPE], python_types=str):
|
|
|
847
778
|
raise_unsupported_operand_types("endswith", (type(self), type(suffix)))
|
|
848
779
|
return string_ends_with_operation(self, suffix)
|
|
849
780
|
|
|
850
|
-
|
|
851
|
-
def __lt__(self, other: StringVar | str) -> BooleanVar: ...
|
|
852
|
-
|
|
853
|
-
@overload
|
|
854
|
-
def __lt__(self, other: NoReturn) -> NoReturn: ... # pyright: ignore [reportOverlappingOverload]
|
|
855
|
-
|
|
856
|
-
def __lt__(self, other: Any):
|
|
781
|
+
def __lt__(self, other: StringVar | str) -> BooleanVar:
|
|
857
782
|
"""Check if the string is less than another string.
|
|
858
783
|
|
|
859
784
|
Args:
|
|
@@ -867,13 +792,7 @@ class StringVar(Var[STRING_TYPE], python_types=str):
|
|
|
867
792
|
|
|
868
793
|
return string_lt_operation(self, other)
|
|
869
794
|
|
|
870
|
-
|
|
871
|
-
def __gt__(self, other: StringVar | str) -> BooleanVar: ...
|
|
872
|
-
|
|
873
|
-
@overload
|
|
874
|
-
def __gt__(self, other: NoReturn) -> NoReturn: ... # pyright: ignore [reportOverlappingOverload]
|
|
875
|
-
|
|
876
|
-
def __gt__(self, other: Any):
|
|
795
|
+
def __gt__(self, other: StringVar | str) -> BooleanVar:
|
|
877
796
|
"""Check if the string is greater than another string.
|
|
878
797
|
|
|
879
798
|
Args:
|
|
@@ -887,13 +806,7 @@ class StringVar(Var[STRING_TYPE], python_types=str):
|
|
|
887
806
|
|
|
888
807
|
return string_gt_operation(self, other)
|
|
889
808
|
|
|
890
|
-
|
|
891
|
-
def __le__(self, other: StringVar | str) -> BooleanVar: ...
|
|
892
|
-
|
|
893
|
-
@overload
|
|
894
|
-
def __le__(self, other: NoReturn) -> NoReturn: ... # pyright: ignore [reportOverlappingOverload]
|
|
895
|
-
|
|
896
|
-
def __le__(self, other: Any):
|
|
809
|
+
def __le__(self, other: StringVar | str) -> BooleanVar:
|
|
897
810
|
"""Check if the string is less than or equal to another string.
|
|
898
811
|
|
|
899
812
|
Args:
|
|
@@ -907,13 +820,7 @@ class StringVar(Var[STRING_TYPE], python_types=str):
|
|
|
907
820
|
|
|
908
821
|
return string_le_operation(self, other)
|
|
909
822
|
|
|
910
|
-
|
|
911
|
-
def __ge__(self, other: StringVar | str) -> BooleanVar: ...
|
|
912
|
-
|
|
913
|
-
@overload
|
|
914
|
-
def __ge__(self, other: NoReturn) -> NoReturn: ... # pyright: ignore [reportOverlappingOverload]
|
|
915
|
-
|
|
916
|
-
def __ge__(self, other: Any):
|
|
823
|
+
def __ge__(self, other: StringVar | str) -> BooleanVar:
|
|
917
824
|
"""Check if the string is greater than or equal to another string.
|
|
918
825
|
|
|
919
826
|
Args:
|
|
@@ -1683,6 +1590,8 @@ def _determine_value_of_array_index(
|
|
|
1683
1590
|
if t is not type(None)
|
|
1684
1591
|
]
|
|
1685
1592
|
)
|
|
1593
|
+
if origin_var_type is range:
|
|
1594
|
+
return int
|
|
1686
1595
|
if origin_var_type in [
|
|
1687
1596
|
Sequence,
|
|
1688
1597
|
Iterable,
|
|
@@ -1974,3 +1883,85 @@ class LiteralColorVar(CachedVarOperation, LiteralVar, ColorVar):
|
|
|
1974
1883
|
):
|
|
1975
1884
|
raise TypeError("Color is not a valid color.")
|
|
1976
1885
|
return f"var(--{color}-{'a' if alpha else ''}{shade})"
|
|
1886
|
+
|
|
1887
|
+
|
|
1888
|
+
class RangeVar(ArrayVar[Sequence[int]], python_types=range):
|
|
1889
|
+
"""Base class for immutable range vars."""
|
|
1890
|
+
|
|
1891
|
+
|
|
1892
|
+
@dataclasses.dataclass(
|
|
1893
|
+
eq=False,
|
|
1894
|
+
frozen=True,
|
|
1895
|
+
slots=True,
|
|
1896
|
+
)
|
|
1897
|
+
class LiteralRangeVar(CachedVarOperation, LiteralVar, RangeVar):
|
|
1898
|
+
"""Base class for immutable literal range vars."""
|
|
1899
|
+
|
|
1900
|
+
_var_value: range = dataclasses.field(default_factory=lambda: range(0))
|
|
1901
|
+
|
|
1902
|
+
@classmethod
|
|
1903
|
+
def create(
|
|
1904
|
+
cls,
|
|
1905
|
+
value: range,
|
|
1906
|
+
_var_type: Type[range] | None = None,
|
|
1907
|
+
_var_data: VarData | None = None,
|
|
1908
|
+
) -> RangeVar:
|
|
1909
|
+
"""Create a var from a string value.
|
|
1910
|
+
|
|
1911
|
+
Args:
|
|
1912
|
+
value: The value to create the var from.
|
|
1913
|
+
_var_type: The type of the var.
|
|
1914
|
+
_var_data: Additional hooks and imports associated with the Var.
|
|
1915
|
+
|
|
1916
|
+
Returns:
|
|
1917
|
+
The var.
|
|
1918
|
+
"""
|
|
1919
|
+
return cls(
|
|
1920
|
+
_js_expr="",
|
|
1921
|
+
_var_type=_var_type or range,
|
|
1922
|
+
_var_data=_var_data,
|
|
1923
|
+
_var_value=value,
|
|
1924
|
+
)
|
|
1925
|
+
|
|
1926
|
+
def __hash__(self) -> int:
|
|
1927
|
+
"""Get the hash of the var.
|
|
1928
|
+
|
|
1929
|
+
Returns:
|
|
1930
|
+
The hash of the var.
|
|
1931
|
+
"""
|
|
1932
|
+
return hash(
|
|
1933
|
+
(
|
|
1934
|
+
self.__class__.__name__,
|
|
1935
|
+
self._var_value.start,
|
|
1936
|
+
self._var_value.stop,
|
|
1937
|
+
self._var_value.step,
|
|
1938
|
+
)
|
|
1939
|
+
)
|
|
1940
|
+
|
|
1941
|
+
@cached_property_no_lock
|
|
1942
|
+
def _cached_var_name(self) -> str:
|
|
1943
|
+
"""The name of the var.
|
|
1944
|
+
|
|
1945
|
+
Returns:
|
|
1946
|
+
The name of the var.
|
|
1947
|
+
"""
|
|
1948
|
+
return f"Array.from({{ length: Math.ceil(({self._var_value.stop!s} - {self._var_value.start!s}) / {self._var_value.step!s}) }}, (_, i) => {self._var_value.start!s} + i * {self._var_value.step!s})"
|
|
1949
|
+
|
|
1950
|
+
@cached_property_no_lock
|
|
1951
|
+
def _cached_get_all_var_data(self) -> VarData | None:
|
|
1952
|
+
"""Get all the var data.
|
|
1953
|
+
|
|
1954
|
+
Returns:
|
|
1955
|
+
The var data.
|
|
1956
|
+
"""
|
|
1957
|
+
return self._var_data
|
|
1958
|
+
|
|
1959
|
+
def json(self) -> str:
|
|
1960
|
+
"""Get the JSON representation of the var.
|
|
1961
|
+
|
|
1962
|
+
Returns:
|
|
1963
|
+
The JSON representation of the var.
|
|
1964
|
+
"""
|
|
1965
|
+
return json.dumps(
|
|
1966
|
+
list(self._var_value),
|
|
1967
|
+
)
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: reflex
|
|
3
|
-
Version: 0.7.
|
|
3
|
+
Version: 0.7.4a2
|
|
4
4
|
Summary: Web apps in pure Python.
|
|
5
5
|
Project-URL: homepage, https://reflex.dev
|
|
6
6
|
Project-URL: repository, https://github.com/reflex-dev/reflex
|
|
@@ -23,7 +23,8 @@ Requires-Dist: build<2.0,>=1.0.3
|
|
|
23
23
|
Requires-Dist: charset-normalizer<4.0,>=3.3.2
|
|
24
24
|
Requires-Dist: distro<2.0,>=1.8.0; platform_system == 'Linux'
|
|
25
25
|
Requires-Dist: fastapi!=0.111.0,!=0.111.1,>=0.96.0
|
|
26
|
-
Requires-Dist:
|
|
26
|
+
Requires-Dist: granian[reload]>=2.0.0
|
|
27
|
+
Requires-Dist: gunicorn<24.0.0,>=23.0.0
|
|
27
28
|
Requires-Dist: httpx<1.0,>=0.25.1
|
|
28
29
|
Requires-Dist: jinja2<4.0,>=3.1.2
|
|
29
30
|
Requires-Dist: lazy-loader>=0.4
|
|
@@ -60,6 +61,7 @@ Description-Content-Type: text/markdown
|
|
|
60
61
|
[](https://badge.fury.io/py/reflex)
|
|
61
62
|

|
|
62
63
|
[](https://reflex.dev/docs/getting-started/introduction)
|
|
64
|
+
[](https://pepy.tech/projects/reflex)
|
|
63
65
|
[](https://discord.gg/T5WSbC2YtQ)
|
|
64
66
|
|
|
65
67
|
</div>
|