Skip to content

Commit

Permalink
Reintroduce flag_evaluation_options in client
Browse files Browse the repository at this point in the history
Signed-off-by: Manuel Schönlaub <manuel.schoenlaub@gmail.com>
  • Loading branch information
mschoenlaub committed Oct 7, 2022
1 parent 0ace3cd commit 2511976
Showing 1 changed file with 17 additions and 0 deletions.
17 changes: 17 additions & 0 deletions open_feature/open_feature_client.py
Original file line number Diff line number Diff line change
Expand Up @@ -43,103 +43,119 @@ def get_boolean_value(
key: str,
default_value: bool,
evaluation_context: EvaluationContext = None,
flag_evaluation_options: typing.Any = None,
) -> bool:
return self.evaluate_flag_details(
FlagType.BOOLEAN,
key,
default_value,
evaluation_context,
flag_evaluation_options,
).value

def get_boolean_details(
self,
key: str,
default_value: bool,
evaluation_context: EvaluationContext = None,
flag_evaluation_options: typing.Any = None,
) -> FlagEvaluationDetails:
return self.evaluate_flag_details(
FlagType.BOOLEAN,
key,
default_value,
evaluation_context,
flag_evaluation_options,
)

def get_string_value(
self,
key: str,
default_value: str,
evaluation_context: EvaluationContext = None,
flag_evaluation_options: typing.Any = None,
) -> str:
return self.evaluate_flag_details(
FlagType.STRING,
key,
default_value,
evaluation_context,
flag_evaluation_options,
).value

def get_string_details(
self,
key: str,
default_value: str,
evaluation_context: EvaluationContext = None,
flag_evaluation_options: typing.Any = None,
) -> FlagEvaluationDetails:
return self.evaluate_flag_details(
FlagType.STRING,
key,
default_value,
evaluation_context,
flag_evaluation_options,
)

def get_number_value(
self,
key: str,
default_value: Number,
evaluation_context: EvaluationContext = None,
flag_evaluation_options: typing.Any = None,
) -> Number:
return self.evaluate_flag_details(
FlagType.NUMBER,
key,
default_value,
evaluation_context,
flag_evaluation_options,
).value

def get_number_details(
self,
key: str,
default_value: Number,
evaluation_context: EvaluationContext = None,
flag_evaluation_options: typing.Any = None,
) -> FlagEvaluationDetails:
return self.evaluate_flag_details(
FlagType.NUMBER,
key,
default_value,
evaluation_context,
flag_evaluation_options,
)

def get_object_value(
self,
key: str,
default_value: dict,
evaluation_context: EvaluationContext = None,
flag_evaluation_options: typing.Any = None,
) -> dict:
return self.evaluate_flag_details(
FlagType.OBJECT,
key,
default_value,
evaluation_context,
flag_evaluation_options,
).value

def get_object_details(
self,
key: str,
default_value: dict,
evaluation_context: EvaluationContext = None,
flag_evaluation_options: typing.Any = None,
) -> FlagEvaluationDetails:
return self.evaluate_flag_details(
FlagType.OBJECT,
key,
default_value,
evaluation_context,
flag_evaluation_options,
)

def evaluate_flag_details(
Expand All @@ -148,6 +164,7 @@ def evaluate_flag_details(
key: str,
default_value: typing.Any,
evaluation_context: EvaluationContext = None,
flag_evaluation_options: typing.Any = None,
) -> FlagEvaluationDetails:
"""
Evaluate the flag requested by the user from the clients provider.
Expand Down

0 comments on commit 2511976

Please sign in to comment.