@@ -712,7 +712,7 @@ def get_bool(self, feature_name: str, default: bool = False) -> bool:
712712
713713 :return: the boolean value of the dyanimc config if it is active/exists, :code:`default` parameter otherwise.
714714 """
715- return self ._get_dynamic_config_value (feature_name , default , bool )
715+ return self ._get_dynamic_config_value (feature_name , default , bool , self . _internal . get_bool )
716716
717717 def get_int (self , feature_name : str , default : int = 0 ) -> int :
718718 """Fetch a Dynamic Configuration of int type.
@@ -724,7 +724,7 @@ def get_int(self, feature_name: str, default: int = 0) -> int:
724724
725725 :return: the int value of the dyanimc config if it is active/exists, :code:`default` parameter otherwise.
726726 """
727- return self ._get_dynamic_config_value (feature_name , default , int )
727+ return self ._get_dynamic_config_value (feature_name , default , int , self . _internal . get_int )
728728
729729 def get_float (self , feature_name : str , default : float = 0.0 ) -> float :
730730 """Fetch a Dynamic Configuration of float type.
@@ -736,7 +736,7 @@ def get_float(self, feature_name: str, default: float = 0.0) -> float:
736736
737737 :return: the float value of the dyanimc config if it is active/exists, :code:`default` parameter otherwise.
738738 """
739- return self ._get_dynamic_config_value (feature_name , default , float )
739+ return self ._get_dynamic_config_value (feature_name , default , float , self . _internal . get_float )
740740
741741 def get_string (self , feature_name : str , default : str = "" ) -> str :
742742 """Fetch a Dynamic Configuration of string type.
@@ -748,7 +748,7 @@ def get_string(self, feature_name: str, default: str = "") -> str:
748748
749749 :return: the string value of the dyanimc config if it is active/exists, :code:`default` parameter otherwise.
750750 """
751- return self ._get_dynamic_config_value (feature_name , default , str )
751+ return self ._get_dynamic_config_value (feature_name , default , str , self . _internal . get_string )
752752
753753 def get_map (self , feature_name : str , default : Optional [dict ] = None ) -> Optional [dict ]:
754754 """Fetch a Dynamic Configuration of map type.
@@ -760,7 +760,7 @@ def get_map(self, feature_name: str, default: Optional[dict] = None) -> Optional
760760
761761 :return: the map value of the dyanimc config if it is active/exists, :code:`default` parameter otherwise.
762762 """
763- return self ._get_dynamic_config_value (feature_name , default , dict )
763+ return self ._get_dynamic_config_value (feature_name , default , dict , self . _internal . get_map )
764764
765765 def get_all_dynamic_configs (self ) -> List [Dict [str , Any ]]:
766766 """Return a list of dynamic configuration dicts in this format:
@@ -819,6 +819,7 @@ def _get_dynamic_config_value(
819819 feature_name : str ,
820820 default : Any ,
821821 dc_type : Type [T ],
822+ get_fn : Callable ,
822823 ) -> T :
823824 if self ._internal is None :
824825 logger .error ("rs_decider is None--did not initialize." )
@@ -827,9 +828,7 @@ def _get_dynamic_config_value(
827828 ctx = self ._decider_context .to_dict ()
828829
829830 try :
830- value = eval (f"self._internal.get_{ dc_type .__name__ } " )(
831- feature_name = feature_name , context = ctx
832- )
831+ value = get_fn (feature_name = feature_name , context = ctx )
833832 except FeatureNotFoundException as exc :
834833 warnings .warn (str (exc ))
835834 return default
0 commit comments