reflex 0.7.1a4__py3-none-any.whl → 0.7.1.post1__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/app.py +7 -4
- reflex/state.py +27 -6
- reflex/utils/prerequisites.py +1 -36
- {reflex-0.7.1a4.dist-info → reflex-0.7.1.post1.dist-info}/METADATA +1 -1
- {reflex-0.7.1a4.dist-info → reflex-0.7.1.post1.dist-info}/RECORD +8 -8
- {reflex-0.7.1a4.dist-info → reflex-0.7.1.post1.dist-info}/WHEEL +1 -1
- {reflex-0.7.1a4.dist-info → reflex-0.7.1.post1.dist-info}/LICENSE +0 -0
- {reflex-0.7.1a4.dist-info → reflex-0.7.1.post1.dist-info}/entry_points.txt +0 -0
reflex/app.py
CHANGED
|
@@ -986,12 +986,15 @@ class App(MiddlewareMixin, LifespanMixin):
|
|
|
986
986
|
|
|
987
987
|
def _setup_sticky_badge(self):
|
|
988
988
|
"""Add the sticky badge to the app."""
|
|
989
|
-
|
|
990
|
-
|
|
991
|
-
|
|
989
|
+
from reflex.components.component import memo
|
|
990
|
+
|
|
991
|
+
@memo
|
|
992
|
+
def memoized_badge():
|
|
992
993
|
sticky_badge = sticky()
|
|
993
994
|
sticky_badge._add_style_recursive({})
|
|
994
|
-
|
|
995
|
+
return sticky_badge
|
|
996
|
+
|
|
997
|
+
self.app_wraps[(0, "StickyBadge")] = lambda _: memoized_badge()
|
|
995
998
|
|
|
996
999
|
def _apply_decorated_pages(self):
|
|
997
1000
|
"""Add @rx.page decorated pages to the app.
|
reflex/state.py
CHANGED
|
@@ -1397,6 +1397,29 @@ class BaseState(Base, ABC, extra=pydantic.Extra.allow):
|
|
|
1397
1397
|
for substate in self.substates.values():
|
|
1398
1398
|
substate.reset()
|
|
1399
1399
|
|
|
1400
|
+
@classmethod
|
|
1401
|
+
@functools.lru_cache
|
|
1402
|
+
def _is_client_storage(cls, prop_name_or_field: str | ModelField) -> bool:
|
|
1403
|
+
"""Check if the var is a client storage var.
|
|
1404
|
+
|
|
1405
|
+
Args:
|
|
1406
|
+
prop_name_or_field: The name of the var or the field itself.
|
|
1407
|
+
|
|
1408
|
+
Returns:
|
|
1409
|
+
Whether the var is a client storage var.
|
|
1410
|
+
"""
|
|
1411
|
+
if isinstance(prop_name_or_field, str):
|
|
1412
|
+
field = cls.get_fields().get(prop_name_or_field)
|
|
1413
|
+
else:
|
|
1414
|
+
field = prop_name_or_field
|
|
1415
|
+
return field is not None and (
|
|
1416
|
+
isinstance(field.default, ClientStorageBase)
|
|
1417
|
+
or (
|
|
1418
|
+
isinstance(field.type_, type)
|
|
1419
|
+
and issubclass(field.type_, ClientStorageBase)
|
|
1420
|
+
)
|
|
1421
|
+
)
|
|
1422
|
+
|
|
1400
1423
|
def _reset_client_storage(self):
|
|
1401
1424
|
"""Reset client storage base vars to their default values."""
|
|
1402
1425
|
# Client-side storage is reset during hydrate so that clearing cookies
|
|
@@ -1404,10 +1427,7 @@ class BaseState(Base, ABC, extra=pydantic.Extra.allow):
|
|
|
1404
1427
|
fields = self.get_fields()
|
|
1405
1428
|
for prop_name in self.base_vars:
|
|
1406
1429
|
field = fields[prop_name]
|
|
1407
|
-
if
|
|
1408
|
-
isinstance(field.type_, type)
|
|
1409
|
-
and issubclass(field.type_, ClientStorageBase)
|
|
1410
|
-
):
|
|
1430
|
+
if self._is_client_storage(field):
|
|
1411
1431
|
setattr(self, prop_name, copy.deepcopy(field.default))
|
|
1412
1432
|
|
|
1413
1433
|
# Recursively reset the substate client storage.
|
|
@@ -2331,8 +2351,9 @@ class UpdateVarsInternalState(State):
|
|
|
2331
2351
|
for var, value in vars.items():
|
|
2332
2352
|
state_name, _, var_name = var.rpartition(".")
|
|
2333
2353
|
var_state_cls = State.get_class_substate(state_name)
|
|
2334
|
-
|
|
2335
|
-
|
|
2354
|
+
if var_state_cls._is_client_storage(var_name):
|
|
2355
|
+
var_state = await self.get_state(var_state_cls)
|
|
2356
|
+
setattr(var_state, var_name, value)
|
|
2336
2357
|
|
|
2337
2358
|
|
|
2338
2359
|
class OnLoadInternalState(State):
|
reflex/utils/prerequisites.py
CHANGED
|
@@ -23,7 +23,7 @@ import zipfile
|
|
|
23
23
|
from datetime import datetime
|
|
24
24
|
from pathlib import Path
|
|
25
25
|
from types import ModuleType
|
|
26
|
-
from typing import
|
|
26
|
+
from typing import Callable, List, NamedTuple, Optional
|
|
27
27
|
from urllib.parse import urlparse
|
|
28
28
|
|
|
29
29
|
import httpx
|
|
@@ -2025,38 +2025,3 @@ def get_user_tier():
|
|
|
2025
2025
|
if authenticated_token[0]
|
|
2026
2026
|
else "anonymous"
|
|
2027
2027
|
)
|
|
2028
|
-
|
|
2029
|
-
|
|
2030
|
-
def check_config_option_in_tier(
|
|
2031
|
-
option_name: str,
|
|
2032
|
-
allowed_tiers: list[str],
|
|
2033
|
-
fallback_value: Any,
|
|
2034
|
-
help_link: str | None = None,
|
|
2035
|
-
):
|
|
2036
|
-
"""Check if a config option is allowed for the authenticated user's current tier.
|
|
2037
|
-
|
|
2038
|
-
Args:
|
|
2039
|
-
option_name: The name of the option to check.
|
|
2040
|
-
allowed_tiers: The tiers that are allowed to use the option.
|
|
2041
|
-
fallback_value: The fallback value if the option is not allowed.
|
|
2042
|
-
help_link: The help link to show to a user that is authenticated.
|
|
2043
|
-
"""
|
|
2044
|
-
config = get_config()
|
|
2045
|
-
current_tier = get_user_tier()
|
|
2046
|
-
|
|
2047
|
-
if current_tier == "anonymous":
|
|
2048
|
-
the_remedy = (
|
|
2049
|
-
"You are currently logged out. Run `reflex login` to access this option."
|
|
2050
|
-
)
|
|
2051
|
-
else:
|
|
2052
|
-
the_remedy = (
|
|
2053
|
-
f"Your current subscription tier is `{current_tier}`. "
|
|
2054
|
-
f"Please upgrade to {allowed_tiers} to access this option. "
|
|
2055
|
-
)
|
|
2056
|
-
if help_link:
|
|
2057
|
-
the_remedy += f"See {help_link} for more information."
|
|
2058
|
-
|
|
2059
|
-
if current_tier not in allowed_tiers:
|
|
2060
|
-
console.warn(f"Config option `{option_name}` is restricted. {the_remedy}")
|
|
2061
|
-
setattr(config, option_name, fallback_value)
|
|
2062
|
-
config._set_persistent(**{option_name: fallback_value})
|
|
@@ -40,7 +40,7 @@ reflex/__init__.py,sha256=64HB9b6MKesl3Yv6aZMsozdMKKpgnxirKk-aeN45UYY,10341
|
|
|
40
40
|
reflex/__init__.pyi,sha256=j4ZkO-mKKw5dFBhJVbaOg7AlncO-JCckV2cHENPiLG0,11303
|
|
41
41
|
reflex/__main__.py,sha256=6cVrGEyT3j3tEvlEVUatpaYfbB5EF3UVY-6vc_Z7-hw,108
|
|
42
42
|
reflex/admin.py,sha256=_3pkkauMiTGJJ0kwAEBnsUWAgZZ_1WNnCaaObbhpmUI,374
|
|
43
|
-
reflex/app.py,sha256=
|
|
43
|
+
reflex/app.py,sha256=TdRgsg9M4NvuBla4C5XpIsSUlYyNil-RcwZCs_n96-s,68894
|
|
44
44
|
reflex/app_mixins/__init__.py,sha256=Oegz3-gZLP9p2OAN5ALNbsgxuNQfS6lGZgQA8cc-9mQ,137
|
|
45
45
|
reflex/app_mixins/lifespan.py,sha256=Xs5KiidoyO921oaBuEg7zaR8B1_SPYDZLouel6u9PRo,3298
|
|
46
46
|
reflex/app_mixins/middleware.py,sha256=lB8I67SEbqcJhp3aqMLZFIZekCYKeMby-Ph2sedIYJI,3349
|
|
@@ -365,7 +365,7 @@ reflex/page.py,sha256=lbI5Sd4RzZadPV6cYBSNRDIlNlRwEnOv1snF2RGKH04,2392
|
|
|
365
365
|
reflex/py.typed,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
366
366
|
reflex/reflex.py,sha256=O1TKYq4HdGLdVOP9X6zG7jtrux77yExBVkGOnMYjjCQ,19380
|
|
367
367
|
reflex/route.py,sha256=nn_hJwtQdjiqH_dHXfqMGWKllnyPQZTSR-KWdHDhoOs,4210
|
|
368
|
-
reflex/state.py,sha256=
|
|
368
|
+
reflex/state.py,sha256=xN7jjZfqFKg2vgoLv5FvTuyz117P1sZEz0ZhEmC5emo,141073
|
|
369
369
|
reflex/style.py,sha256=VZvLiBq0KEznu5AdYEQbjy3BUmiscTrGABUbDfiMlHo,13045
|
|
370
370
|
reflex/testing.py,sha256=NukmgpkB70naGllLWBQTqm8XE2XBUxkpywBYFCpMwyc,35762
|
|
371
371
|
reflex/utils/__init__.py,sha256=y-AHKiRQAhk2oAkvn7W8cRVTZVK625ff8tTwvZtO7S4,24
|
|
@@ -382,7 +382,7 @@ reflex/utils/imports.py,sha256=8lTJ8qCJlMUlQnZssOv0l2nntuTfGfLsLqkJAS5JTbA,3974
|
|
|
382
382
|
reflex/utils/lazy_loader.py,sha256=-3DcwIqHNft2fb1ikgDYAMiEwNfbiWfrTBAf1gEVX2o,1367
|
|
383
383
|
reflex/utils/net.py,sha256=0Yd9OLK8R_px2sqnqrDkTky6hYHtG2pEDvvilOjDfjc,1219
|
|
384
384
|
reflex/utils/path_ops.py,sha256=Sio_pZ9-dqu6pAPUkO_JA9ONXDsyLGKWOVRoA-dCrec,7903
|
|
385
|
-
reflex/utils/prerequisites.py,sha256=
|
|
385
|
+
reflex/utils/prerequisites.py,sha256=26lc0TVBFzdVcwl_Zja95xCC2k5UKP9Qx2Nr2FrLONU,65403
|
|
386
386
|
reflex/utils/processes.py,sha256=tvYVIJgxBLboCVMYLnQYeNNIFr2cwufdWNZEOxpC4qw,13527
|
|
387
387
|
reflex/utils/pyi_generator.py,sha256=6BVJ1KrLH8WvfYjBVm5-zjI6-Zdhzngp5ubkixsCIl4,41240
|
|
388
388
|
reflex/utils/redir.py,sha256=bmQGAgoNWwySeLRQTpoMpmKInwIOCW77wkXT61fwcj8,1868
|
|
@@ -398,8 +398,8 @@ reflex/vars/function.py,sha256=r5NFBsueqiaRkM0F1Zp2lqWYMvWBhbNwyf5F9jrEC9A,14794
|
|
|
398
398
|
reflex/vars/number.py,sha256=a0Qq_xM3v4Lcjm8l9Yg6ESRITUOnzgWADNmfvv4tmGI,27871
|
|
399
399
|
reflex/vars/object.py,sha256=jfvxtrklztDtbD2zgNVNCZZE6X6HQMB6yJHPhtb0hUo,15033
|
|
400
400
|
reflex/vars/sequence.py,sha256=_A1By3COdoTt9o5WM2odYsWf1twTv8Depf0kgHLdhGQ,54276
|
|
401
|
-
reflex-0.7.
|
|
402
|
-
reflex-0.7.
|
|
403
|
-
reflex-0.7.
|
|
404
|
-
reflex-0.7.
|
|
405
|
-
reflex-0.7.
|
|
401
|
+
reflex-0.7.1.post1.dist-info/LICENSE,sha256=dw3zLrp9f5ObD7kqS32vWfhcImfO52PMmRqvtxq_YEE,11358
|
|
402
|
+
reflex-0.7.1.post1.dist-info/METADATA,sha256=xp1KajJDWaKoUb3e0ripnv34kY2IAnfQ8WlgZgs278o,11989
|
|
403
|
+
reflex-0.7.1.post1.dist-info/WHEEL,sha256=b4K_helf-jlQoXBBETfwnf4B04YC67LOev0jo4fX5m8,88
|
|
404
|
+
reflex-0.7.1.post1.dist-info/entry_points.txt,sha256=H1Z5Yat_xJfy0dRT1Frk2PkO_p41Xy7fCKlj4FcdL9o,44
|
|
405
|
+
reflex-0.7.1.post1.dist-info/RECORD,,
|
|
File without changes
|
|
File without changes
|