fix version python 3.10

This commit is contained in:
Khaleel Al-Adhami 2025-01-17 14:31:49 -08:00
parent 270fcb996d
commit 0798cb8f60
3 changed files with 18 additions and 11 deletions

View File

@ -3,6 +3,8 @@
import textwrap
from typing import Any, List, cast
from typing_extensions import Unpack
from reflex.components.base import Fragment
from reflex.components.component import BaseComponent, Component, MemoizationLeaf
from reflex.utils import types
@ -10,7 +12,7 @@ from reflex.utils.exceptions import MatchTypeError
from reflex.vars.base import VAR_TYPE, Var
from reflex.vars.number import MatchOperation
CASE_TYPE = tuple[*tuple[Any, ...], Var[VAR_TYPE] | VAR_TYPE]
CASE_TYPE = tuple[Unpack[tuple[Any, ...]], Var[VAR_TYPE] | VAR_TYPE]
class Match(MemoizationLeaf):
@ -29,7 +31,9 @@ class Match(MemoizationLeaf):
def create(
cls,
cond: Any,
*cases: *tuple[*tuple[CASE_TYPE[VAR_TYPE], ...], Var[VAR_TYPE] | VAR_TYPE],
*cases: Unpack[
tuple[Unpack[tuple[CASE_TYPE[VAR_TYPE], ...]], Var[VAR_TYPE] | VAR_TYPE]
],
) -> Var[VAR_TYPE]:
"""Create a Match Component.

View File

@ -33,6 +33,7 @@ from typing_extensions import (
TypedDict,
TypeVar,
TypeVarTuple,
Unpack,
deprecated,
get_args,
get_origin,
@ -627,10 +628,10 @@ EVENT_U = TypeVar("EVENT_U")
Ts = TypeVarTuple("Ts")
class IdentityEventReturn(Generic[*Ts], Protocol):
class IdentityEventReturn(Generic[Unpack[Ts]], Protocol):
"""Protocol for an identity event return."""
def __call__(self, *values: *Ts) -> tuple[*Ts]:
def __call__(self, *values: Unpack[Ts]) -> tuple[Unpack[Ts]]:
"""Return the input values.
Args:
@ -656,13 +657,13 @@ def passthrough_event_spec(
@overload
def passthrough_event_spec(
*event_types: *tuple[Type[EVENT_T]],
) -> IdentityEventReturn[*tuple[Var[EVENT_T], ...]]: ...
*event_types: Unpack[tuple[Type[EVENT_T]]],
) -> IdentityEventReturn[Unpack[tuple[Var[EVENT_T], ...]]]: ...
def passthrough_event_spec( # pyright: ignore[reportInconsistentOverload]
*event_types: Type[EVENT_T],
) -> IdentityEventReturn[*tuple[Var[EVENT_T], ...]]:
) -> IdentityEventReturn[Unpack[tuple[Var[EVENT_T], ...]]]:
"""A helper function that returns the input event as output.
Args:

View File

@ -19,6 +19,8 @@ from typing import (
overload,
)
from typing_extensions import Unpack
from reflex.constants.base import Dirs
from reflex.utils.exceptions import PrimitiveUnserializableToJSON, VarTypeError
from reflex.utils.imports import ImportDict, ImportVar
@ -1069,11 +1071,11 @@ def ternary_operation(
return value
X = tuple[*tuple[Var, ...], str]
TUPLE_ENDS_IN_VAR = tuple[Unpack[tuple[Var[Any], ...]], Var[VAR_TYPE]]
TUPLE_ENDS_IN_VAR = tuple[*tuple[Var[Any], ...], Var[VAR_TYPE]]
TUPLE_ENDS_IN_VAR_RELAXED = tuple[*tuple[Var[Any] | Any, ...], Var[VAR_TYPE] | VAR_TYPE]
TUPLE_ENDS_IN_VAR_RELAXED = tuple[
Unpack[tuple[Var[Any] | Any, ...]], Var[VAR_TYPE] | VAR_TYPE
]
@dataclasses.dataclass(