11import threading
2- from typing import Any , List , Optional , Union
2+ from typing import Any , List , Mapping , Optional , Sequence , Union
33
44from ldclient .evaluation import EvaluationDetail
55from ldclient import LDClient , Config
66from ldclient .interfaces import DataSourceStatus , FlagChange , DataSourceState
77from openfeature .evaluation_context import EvaluationContext
88from openfeature .exception import ErrorCode , ProviderFatalError
9- from openfeature .flag_evaluation import FlagResolutionDetails , FlagType , Reason
9+ from openfeature .flag_evaluation import FlagResolutionDetails , FlagType , FlagValueType , Reason
1010from openfeature .hook import Hook
1111from openfeature .provider .metadata import Metadata
1212from openfeature .provider import AbstractProvider
@@ -133,7 +133,9 @@ def resolve_float_details(
133133 def resolve_object_details (
134134 self ,
135135 flag_key : str ,
136- default_value : Union [dict , list ],
136+ default_value : Union [
137+ Sequence [FlagValueType ], Mapping [str , FlagValueType ]
138+ ],
137139 evaluation_context : Optional [EvaluationContext ] = None ,
138140 ) -> FlagResolutionDetails [Union [dict , list ]]:
139141 """Resolves the flag value for the provided flag key as a list or dictionary"""
@@ -154,15 +156,15 @@ def __resolve_value(self, flag_type: FlagType, flag_key: str, default_value: Any
154156 resolved_value = self .__validate_and_cast_value (flag_type , result .value )
155157 if resolved_value is None :
156158 return self .__mismatched_type_details (default_value )
157-
159+
158160 resolved_detail = EvaluationDetail (
159161 value = resolved_value ,
160162 variation_index = result .variation_index ,
161163 reason = result .reason ,
162164 )
163-
165+
164166 return self .__details_converter .to_resolution_details (resolved_detail )
165-
167+
166168 def __validate_and_cast_value (self , flag_type : FlagType , value : Any ):
167169 """Serializes the raw flag value to the expected type based on flag_type."""
168170 if flag_type == FlagType .BOOLEAN and isinstance (value , bool ):
@@ -175,7 +177,7 @@ def __validate_and_cast_value(self, flag_type: FlagType, value: Any):
175177 return float (value )
176178 elif flag_type == FlagType .OBJECT and isinstance (value , (dict , list )):
177179 return value
178- return None
180+ return None
179181
180182 @staticmethod
181183 def __mismatched_type_details (default_value : Any ) -> FlagResolutionDetails :
0 commit comments