remove misc changes
This commit is contained in:
parent
efd1eac6d6
commit
e9ccbaaf5e
@ -29,11 +29,11 @@ def validate_field_name(bases: List[Type["BaseModel"]], field_name: str) -> None
|
||||
for base in bases:
|
||||
if not reload and getattr(base, field_name, None):
|
||||
pass
|
||||
except TypeError as e:
|
||||
except TypeError as te:
|
||||
raise VarNameError(
|
||||
f'State var "{field_name}" in {base} has been shadowed by a substate var; '
|
||||
f'use a different field name instead".'
|
||||
) from e
|
||||
) from te
|
||||
|
||||
|
||||
# monkeypatch pydantic validate_field_name method to skip validating
|
||||
|
@ -590,6 +590,7 @@ def no_args_event_spec() -> Tuple[()]:
|
||||
stop_propagation = EventChain(events=[], args_spec=no_args_event_spec).stop_propagation
|
||||
prevent_default = EventChain(events=[], args_spec=no_args_event_spec).prevent_default
|
||||
|
||||
|
||||
T = TypeVar("T")
|
||||
U = TypeVar("U")
|
||||
|
||||
@ -1290,10 +1291,10 @@ def call_event_handler(
|
||||
compare_result = typehint_issubclass(
|
||||
args_types_without_vars[i], type_hints_of_provided_callback[arg]
|
||||
)
|
||||
except TypeError as e:
|
||||
except TypeError as te:
|
||||
raise TypeError(
|
||||
f"Could not compare types {args_types_without_vars[i]} and {type_hints_of_provided_callback[arg]} for argument {arg} of {event_callback.fn.__qualname__} provided for {key}."
|
||||
) from e
|
||||
) from te
|
||||
|
||||
if compare_result:
|
||||
type_match_found[arg] = True
|
||||
@ -1877,6 +1878,7 @@ class LambdaEventCallback(Protocol[Unpack[P]]):
|
||||
|
||||
ARGS = TypeVarTuple("ARGS")
|
||||
|
||||
|
||||
LAMBDA_OR_STATE = TypeAliasType(
|
||||
"LAMBDA_OR_STATE",
|
||||
LambdaEventCallback[Unpack[ARGS]] | EventCallback[Unpack[ARGS]],
|
||||
@ -1899,6 +1901,7 @@ EventType = TypeAliasType(
|
||||
"EventType", ItemOrList[IndividualEventType[Unpack[ARGS]]], type_params=(ARGS,)
|
||||
)
|
||||
|
||||
|
||||
if TYPE_CHECKING:
|
||||
from reflex.state import BaseState
|
||||
|
||||
|
@ -474,10 +474,10 @@ def _issubclass(cls: GenericType, cls_check: GenericType, instance: Any = None)
|
||||
# Check if the types match.
|
||||
try:
|
||||
return cls_check_base == Any or issubclass(cls_base, cls_check_base)
|
||||
except TypeError as e:
|
||||
except TypeError as te:
|
||||
# These errors typically arise from bad annotations and are hard to
|
||||
# debug without knowing the type that we tried to compare.
|
||||
raise TypeError(f"Invalid type for issubclass: {cls_base}") from e
|
||||
raise TypeError(f"Invalid type for issubclass: {cls_base}") from te
|
||||
|
||||
|
||||
def does_obj_satisfy_typed_dict(obj: Any, cls: GenericType) -> bool:
|
||||
|
Loading…
Reference in New Issue
Block a user