File tree Expand file tree Collapse file tree 3 files changed +12
-5
lines changed
components/radix/themes/components Expand file tree Collapse file tree 3 files changed +12
-5
lines changed Original file line number Diff line number Diff line change 77from reflex .components .component import Component
88from reflex .components .core .breakpoints import Responsive
99from reflex .event import EventHandler , passthrough_event_spec
10+ from reflex .utils .types import typehint_issubclass
1011from reflex .vars .base import Var
1112
1213from ..base import LiteralAccentColor , RadixThemesComponent
@@ -96,7 +97,7 @@ def create(
9697 width = props .pop ("width" , "100%" )
9798
9899 if isinstance (default_value , Var ):
99- if issubclass (default_value ._var_type , ( int , float ) ):
100+ if typehint_issubclass (default_value ._var_type , int | float ):
100101 default_value = [default_value ]
101102
102103 elif isinstance (default_value , (int , float )):
Original file line number Diff line number Diff line change 3737 EventHandlerArgTypeMismatchError ,
3838 MissingAnnotationError ,
3939)
40- from reflex .utils .types import ArgsSpec , GenericType , typehint_issubclass
40+ from reflex .utils .types import (
41+ ArgsSpec ,
42+ GenericType ,
43+ safe_issubclass ,
44+ typehint_issubclass ,
45+ )
4146from reflex .vars import VarData
4247from reflex .vars .base import LiteralVar , Var
4348from reflex .vars .function import (
@@ -424,7 +429,7 @@ def create(
424429 return value
425430 elif isinstance (value , EventVar ):
426431 value = [value ]
427- elif issubclass (value ._var_type , (EventChain , EventSpec )):
432+ elif safe_issubclass (value ._var_type , (EventChain , EventSpec )):
428433 return cls .create (
429434 value = value .guess_type (),
430435 args_spec = args_spec ,
Original file line number Diff line number Diff line change 2323 VarValueError ,
2424)
2525from reflex .utils .imports import ImportDict , ImportVar
26+ from reflex .utils .types import safe_issubclass
2627
2728from .base import (
2829 CustomVarOperationReturn ,
@@ -524,15 +525,15 @@ def _is_strict_float(self) -> bool:
524525 Returns:
525526 bool: True if the number is a float.
526527 """
527- return issubclass (self ._var_type , float )
528+ return safe_issubclass (self ._var_type , float )
528529
529530 def _is_strict_int (self ) -> bool :
530531 """Check if the number is an int.
531532
532533 Returns:
533534 bool: True if the number is an int.
534535 """
535- return issubclass (self ._var_type , int )
536+ return safe_issubclass (self ._var_type , int )
536537
537538 def __format__ (self , format_spec : str ) -> str :
538539 """Format the number.
You can’t perform that action at this time.
0 commit comments