4545 FlagResolutionDetails [typing .Union [dict , list ]],
4646 ],
4747]
48+ TypeMap = typing .Dict [
49+ FlagType ,
50+ typing .Union [
51+ typing .Type [bool ],
52+ typing .Type [int ],
53+ typing .Type [float ],
54+ typing .Type [str ],
55+ typing .Tuple [typing .Type [dict ], typing .Type [list ]],
56+ ],
57+ ]
4858
4959
5060@dataclass
5161class ClientMetadata :
52- name : str
62+ name : typing . Optional [ str ]
5363
5464
5565class OpenFeatureClient :
@@ -60,17 +70,17 @@ def __init__(
6070 provider : AbstractProvider ,
6171 context : typing .Optional [EvaluationContext ] = None ,
6272 hooks : typing .Optional [typing .List [Hook ]] = None ,
63- ):
73+ ) -> None :
6474 self .name = name
6575 self .version = version
6676 self .context = context or EvaluationContext ()
6777 self .hooks = hooks or []
6878 self .provider = provider
6979
70- def get_metadata (self ):
80+ def get_metadata (self ) -> ClientMetadata :
7181 return ClientMetadata (name = self .name )
7282
73- def add_hooks (self , hooks : typing .List [Hook ]):
83+ def add_hooks (self , hooks : typing .List [Hook ]) -> None :
7484 self .hooks = self .hooks + hooks
7585
7686 def get_boolean_value (
@@ -93,7 +103,7 @@ def get_boolean_details(
93103 default_value : bool ,
94104 evaluation_context : typing .Optional [EvaluationContext ] = None ,
95105 flag_evaluation_options : typing .Optional [FlagEvaluationOptions ] = None ,
96- ) -> FlagEvaluationDetails :
106+ ) -> FlagEvaluationDetails [ bool ] :
97107 return self .evaluate_flag_details (
98108 FlagType .BOOLEAN ,
99109 flag_key ,
@@ -122,7 +132,7 @@ def get_string_details(
122132 default_value : str ,
123133 evaluation_context : typing .Optional [EvaluationContext ] = None ,
124134 flag_evaluation_options : typing .Optional [FlagEvaluationOptions ] = None ,
125- ) -> FlagEvaluationDetails :
135+ ) -> FlagEvaluationDetails [ str ] :
126136 return self .evaluate_flag_details (
127137 FlagType .STRING ,
128138 flag_key ,
@@ -151,7 +161,7 @@ def get_integer_details(
151161 default_value : int ,
152162 evaluation_context : typing .Optional [EvaluationContext ] = None ,
153163 flag_evaluation_options : typing .Optional [FlagEvaluationOptions ] = None ,
154- ) -> FlagEvaluationDetails :
164+ ) -> FlagEvaluationDetails [ int ] :
155165 return self .evaluate_flag_details (
156166 FlagType .INTEGER ,
157167 flag_key ,
@@ -180,7 +190,7 @@ def get_float_details(
180190 default_value : float ,
181191 evaluation_context : typing .Optional [EvaluationContext ] = None ,
182192 flag_evaluation_options : typing .Optional [FlagEvaluationOptions ] = None ,
183- ) -> FlagEvaluationDetails :
193+ ) -> FlagEvaluationDetails [ float ] :
184194 return self .evaluate_flag_details (
185195 FlagType .FLOAT ,
186196 flag_key ,
@@ -195,7 +205,7 @@ def get_object_value(
195205 default_value : typing .Union [dict , list ],
196206 evaluation_context : typing .Optional [EvaluationContext ] = None ,
197207 flag_evaluation_options : typing .Optional [FlagEvaluationOptions ] = None ,
198- ) -> dict :
208+ ) -> typing . Union [ dict , list ] :
199209 return self .get_object_details (
200210 flag_key ,
201211 default_value ,
@@ -209,7 +219,7 @@ def get_object_details(
209219 default_value : typing .Union [dict , list ],
210220 evaluation_context : typing .Optional [EvaluationContext ] = None ,
211221 flag_evaluation_options : typing .Optional [FlagEvaluationOptions ] = None ,
212- ) -> FlagEvaluationDetails :
222+ ) -> FlagEvaluationDetails [ typing . Union [ dict , list ]] :
213223 return self .evaluate_flag_details (
214224 FlagType .OBJECT ,
215225 flag_key ,
@@ -225,7 +235,7 @@ def evaluate_flag_details(
225235 default_value : typing .Any ,
226236 evaluation_context : typing .Optional [EvaluationContext ] = None ,
227237 flag_evaluation_options : typing .Optional [FlagEvaluationOptions ] = None ,
228- ) -> FlagEvaluationDetails :
238+ ) -> FlagEvaluationDetails [ typing . Any ] :
229239 """
230240 Evaluate the flag requested by the user from the clients provider.
231241
@@ -335,7 +345,7 @@ def _create_provider_evaluation(
335345 flag_key : str ,
336346 default_value : typing .Any ,
337347 evaluation_context : typing .Optional [EvaluationContext ] = None ,
338- ) -> FlagEvaluationDetails :
348+ ) -> FlagEvaluationDetails [ typing . Any ] :
339349 """
340350 Encapsulated method to create a FlagEvaluationDetail from a specific provider.
341351
@@ -384,8 +394,8 @@ def _create_provider_evaluation(
384394 )
385395
386396
387- def _typecheck_flag_value (value , flag_type ) :
388- type_map = {
397+ def _typecheck_flag_value (value : typing . Any , flag_type : FlagType ) -> None :
398+ type_map : TypeMap = {
389399 FlagType .BOOLEAN : bool ,
390400 FlagType .STRING : str ,
391401 FlagType .OBJECT : (dict , list ),
0 commit comments