@@ -581,15 +581,15 @@ def __init__(
581
581
minmax_types = (int , float )
582
582
else :
583
583
minmax_types = (None ,)
584
- minmax_types = Optional [Union [minmax_types ]]
584
+ minmax_typehint = Optional [Union [minmax_types ]]
585
585
586
- self .min_value : minmax_types = kwargs .pop ("min_value" , None )
587
- self .max_value : minmax_types = kwargs .pop ("max_value" , None )
586
+ self .min_value : minmax_typehint = kwargs .pop ("min_value" , None )
587
+ self .max_value : minmax_typehint = kwargs .pop ("max_value" , None )
588
588
589
- if not isinstance (self .min_value , minmax_types . __args__ ) or self .min_value is None :
590
- raise TypeError (f"Expected { minmax_types } for min_value, got \" { type (self .min_value ).__name__ } \" " )
591
- if not isinstance (self .max_value , minmax_types . __args__ ) or self .max_value is None :
592
- raise TypeError (f"Expected { minmax_types } for max_value, got \" { type (self .max_value ).__name__ } \" " )
589
+ if not isinstance (self .min_value , minmax_typehint ) or self .min_value is None :
590
+ raise TypeError (f"Expected { minmax_type } for min_value, got \" { type (self .min_value ).__name__ } \" " )
591
+ if not isinstance (self .max_value , minmax_typehint ) or self .max_value is None :
592
+ raise TypeError (f"Expected { minmax_type } for max_value, got \" { type (self .max_value ).__name__ } \" " )
593
593
594
594
def to_dict (self ) -> Dict :
595
595
as_dict = {
@@ -1064,4 +1064,4 @@ def validate_chat_input_description(description: Any):
1064
1064
if len (description ) > 100 or len (description ) < 1 :
1065
1065
raise ValidationError (
1066
1066
"Description of a chat input command must be less than 100 characters and non empty."
1067
- )
1067
+ )
0 commit comments