Commit 06c7ba4 1 parent 1ac8f02 commit 06c7ba4 Copy full SHA for 06c7ba4
File tree 3 files changed +12
-5
lines changed
components/radix/themes/components
3 files changed +12
-5
lines changed Original file line number Diff line number Diff line change 7
7
from reflex .components .component import Component
8
8
from reflex .components .core .breakpoints import Responsive
9
9
from reflex .event import EventHandler , passthrough_event_spec
10
+ from reflex .utils .types import typehint_issubclass
10
11
from reflex .vars .base import Var
11
12
12
13
from ..base import LiteralAccentColor , RadixThemesComponent
@@ -96,7 +97,7 @@ def create(
96
97
width = props .pop ("width" , "100%" )
97
98
98
99
if isinstance (default_value , Var ):
99
- if issubclass (default_value ._var_type , ( int , float ) ):
100
+ if typehint_issubclass (default_value ._var_type , int | float ):
100
101
default_value = [default_value ]
101
102
102
103
elif isinstance (default_value , (int , float )):
Original file line number Diff line number Diff line change 37
37
EventHandlerArgTypeMismatchError ,
38
38
MissingAnnotationError ,
39
39
)
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
+ )
41
46
from reflex .vars import VarData
42
47
from reflex .vars .base import LiteralVar , Var
43
48
from reflex .vars .function import (
@@ -424,7 +429,7 @@ def create(
424
429
return value
425
430
elif isinstance (value , EventVar ):
426
431
value = [value ]
427
- elif issubclass (value ._var_type , (EventChain , EventSpec )):
432
+ elif safe_issubclass (value ._var_type , (EventChain , EventSpec )):
428
433
return cls .create (
429
434
value = value .guess_type (),
430
435
args_spec = args_spec ,
Original file line number Diff line number Diff line change 23
23
VarValueError ,
24
24
)
25
25
from reflex .utils .imports import ImportDict , ImportVar
26
+ from reflex .utils .types import safe_issubclass
26
27
27
28
from .base import (
28
29
CustomVarOperationReturn ,
@@ -524,15 +525,15 @@ def _is_strict_float(self) -> bool:
524
525
Returns:
525
526
bool: True if the number is a float.
526
527
"""
527
- return issubclass (self ._var_type , float )
528
+ return safe_issubclass (self ._var_type , float )
528
529
529
530
def _is_strict_int (self ) -> bool :
530
531
"""Check if the number is an int.
531
532
532
533
Returns:
533
534
bool: True if the number is an int.
534
535
"""
535
- return issubclass (self ._var_type , int )
536
+ return safe_issubclass (self ._var_type , int )
536
537
537
538
def __format__ (self , format_spec : str ) -> str :
538
539
"""Format the number.
You can’t perform that action at this time.
0 commit comments