@@ -861,19 +861,6 @@ async def _create_provider_evaluation_async(
861861 default_value : FlagValueType ,
862862 evaluation_context : EvaluationContext | None = None ,
863863 ) -> FlagEvaluationDetails [FlagValueType ]:
864- """
865- Resolve a flag asynchronously and validate the returned value.
866-
867- Provider-reported errors are returned unchanged. A type mismatch detected
868- by the client returns the caller's default with TYPE_MISMATCH error details.
869-
870- :param provider: the provider selected for this evaluation
871- :param flag_type: the requested flag type
872- :param flag_key: the key of the selected flag
873- :param default_value: fallback used for an unknown type or a type mismatch
874- :param evaluation_context: context passed to the provider
875- :return: evaluation details containing the resolved value or fallback
876- """
877864 get_details_callables_async : Mapping [FlagType , ResolveDetailsCallableAsync ] = {
878865 FlagType .BOOLEAN : provider .resolve_boolean_details_async ,
879866 FlagType .INTEGER : provider .resolve_integer_details_async ,
@@ -1004,17 +991,6 @@ def track(
1004991def _typecheck_flag_value (
1005992 value : typing .Any , flag_type : FlagType
1006993) -> OpenFeatureError | None :
1007- """
1008- Check a resolved value against the requested flag type without coercing it.
1009-
1010- Booleans are not integer flag values, even though bool subclasses int in
1011- Python. Other subclasses of the expected type remain valid.
1012-
1013- :param value: the value returned by the provider
1014- :param flag_type: the requested flag type
1015- :return: None for a matching value, TypeMismatchError for an incompatible
1016- value, or GeneralError for an unknown flag type
1017- """
1018994 type_map : TypeMap = {
1019995 FlagType .BOOLEAN : bool ,
1020996 FlagType .STRING : str ,
@@ -1025,6 +1001,7 @@ def _typecheck_flag_value(
10251001 py_type = type_map .get (flag_type )
10261002 if not py_type :
10271003 return GeneralError (error_message = "Unknown flag type" )
1004+ # bool subclasses int, but booleans are not integer flag values.
10281005 if not isinstance (value , py_type ) or (
10291006 flag_type == FlagType .INTEGER and isinstance (value , bool )
10301007 ):
0 commit comments