File tree 2 files changed +8
-16
lines changed
2 files changed +8
-16
lines changed Original file line number Diff line number Diff line change 2
2
3
3
4
4
class FlagType (Enum ):
5
- BOOLEAN = 1
6
- STRING = 2
7
- OBJECT = 3
8
- FLOAT = 4
9
- INTEGER = 5
5
+ BOOLEAN = bool
6
+ STRING = str
7
+ OBJECT = dict
8
+ FLOAT = float
9
+ INTEGER = int
Original file line number Diff line number Diff line change @@ -336,19 +336,11 @@ def _create_provider_evaluation(
336
336
337
337
value = get_details_callable (* args )
338
338
339
- if flag_type in NUMERIC_TYPES :
340
- value .value = self ._convert_numeric_types (flag_type , value .value )
339
+ self ._check_flag_type (flag_type , value .value )
341
340
342
341
return value
343
342
344
343
@staticmethod
345
- def _convert_numeric_types (flag_type : FlagType , current_value ):
346
- converter = {
347
- FlagType .FLOAT : float ,
348
- FlagType .INTEGER : int ,
349
- }.get (flag_type )
350
-
351
- try :
352
- return converter (current_value )
353
- except ValueError :
344
+ def _check_flag_type (flag_type : FlagType , current_value ):
345
+ if not isinstance (current_value , flag_type .value ):
354
346
raise TypeMismatchError ()
You can’t perform that action at this time.
0 commit comments