From 0ace3cd001ec99d687b84a3860e8ee443421b5bb Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Manuel=20Sch=C3=B6nlaub?= Date: Fri, 30 Sep 2022 14:48:11 -0600 Subject: [PATCH 1/3] Remove EvaluationOptions from method signatures MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Manuel Schönlaub --- open_feature/open_feature_client.py | 20 -------------------- open_feature/provider/no_op_provider.py | 5 ----- open_feature/provider/provider.py | 5 ----- 3 files changed, 30 deletions(-) diff --git a/open_feature/open_feature_client.py b/open_feature/open_feature_client.py index a3e33b66..fd15db2a 100644 --- a/open_feature/open_feature_client.py +++ b/open_feature/open_feature_client.py @@ -43,14 +43,12 @@ 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( @@ -58,14 +56,12 @@ def get_boolean_details( 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( @@ -73,14 +69,12 @@ def get_string_value( 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( @@ -88,14 +82,12 @@ def get_string_details( 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( @@ -103,14 +95,12 @@ def get_number_value( 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( @@ -118,14 +108,12 @@ def get_number_details( 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( @@ -133,14 +121,12 @@ def get_object_value( 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( @@ -148,14 +134,12 @@ def get_object_details( 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( @@ -164,7 +148,6 @@ 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. @@ -210,7 +193,6 @@ def evaluate_flag_details( key, default_value, merged_context, - flag_evaluation_options, ) after_hooks(type, hook_context, flag_evaluation, merged_hooks, None) @@ -237,7 +219,6 @@ def create_provider_evaluation( key: str, default_value: typing.Any, evaluation_context: EvaluationContext = None, - flag_evaluation_options: typing.Any = None, ) -> FlagEvaluationDetails: """ Encapsulated method to create a FlagEvaluationDetail from a specific provider. @@ -254,7 +235,6 @@ def create_provider_evaluation( key, default_value, evaluation_context, - flag_evaluation_options, ) if not self.provider: diff --git a/open_feature/provider/no_op_provider.py b/open_feature/provider/no_op_provider.py index b09d53be..d91395e7 100644 --- a/open_feature/provider/no_op_provider.py +++ b/open_feature/provider/no_op_provider.py @@ -1,4 +1,3 @@ -import typing from numbers import Number from open_feature.evaluation_context.evaluation_context import EvaluationContext @@ -18,7 +17,6 @@ def get_boolean_details( key: str, default_value: bool, evaluation_context: EvaluationContext = None, - flag_evaluation_options: typing.Any = None, ): return FlagEvaluationDetails( key=key, @@ -32,7 +30,6 @@ def get_string_details( key: str, default_value: str, evaluation_context: EvaluationContext = None, - flag_evaluation_options: typing.Any = None, ): return FlagEvaluationDetails( key=key, @@ -46,7 +43,6 @@ def get_number_details( key: str, default_value: Number, evaluation_context: EvaluationContext = None, - flag_evaluation_options: typing.Any = None, ): return FlagEvaluationDetails( key=key, @@ -60,7 +56,6 @@ def get_object_details( key: str, default_value: dict, evaluation_context: EvaluationContext = None, - flag_evaluation_options: typing.Any = None, ): return FlagEvaluationDetails( key=key, diff --git a/open_feature/provider/provider.py b/open_feature/provider/provider.py index 21421038..f3057039 100644 --- a/open_feature/provider/provider.py +++ b/open_feature/provider/provider.py @@ -1,4 +1,3 @@ -import typing from abc import abstractmethod from numbers import Number @@ -16,7 +15,6 @@ def get_boolean_details( key: str, default_value: bool, evaluation_context: EvaluationContext = EvaluationContext(), - flag_evaluation_options: typing.Any = None, ): pass @@ -26,7 +24,6 @@ def get_string_details( key: str, default_value: str, evaluation_context: EvaluationContext = EvaluationContext(), - flag_evaluation_options: typing.Any = None, ): pass @@ -36,7 +33,6 @@ def get_number_details( key: str, default_value: Number, evaluation_context: EvaluationContext = EvaluationContext(), - flag_evaluation_options: typing.Any = None, ): pass @@ -46,6 +42,5 @@ def get_object_details( key: str, default_value: dict, evaluation_context: EvaluationContext = EvaluationContext(), - flag_evaluation_options: typing.Any = None, ): pass From 25119766f9e477d7101fd8aed8ffb8f0523f59e4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Manuel=20Sch=C3=B6nlaub?= Date: Fri, 7 Oct 2022 09:53:04 -0600 Subject: [PATCH 2/3] Reintroduce flag_evaluation_options in client MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Manuel Schönlaub --- open_feature/open_feature_client.py | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/open_feature/open_feature_client.py b/open_feature/open_feature_client.py index fd15db2a..130d1bd7 100644 --- a/open_feature/open_feature_client.py +++ b/open_feature/open_feature_client.py @@ -43,12 +43,14 @@ 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( @@ -56,12 +58,14 @@ def get_boolean_details( 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( @@ -69,12 +73,14 @@ def get_string_value( 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( @@ -82,12 +88,14 @@ def get_string_details( 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( @@ -95,12 +103,14 @@ def get_number_value( 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( @@ -108,12 +118,14 @@ def get_number_details( 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( @@ -121,12 +133,14 @@ def get_object_value( 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( @@ -134,12 +148,14 @@ def get_object_details( 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( @@ -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. From 059ef20d8d1356b1bd3587ce5fb4ed857a11e771 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Manuel=20Sch=C3=B6nlaub?= Date: Fri, 7 Oct 2022 10:07:12 -0600 Subject: [PATCH 3/3] Remove superflous docstring MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Manuel Schönlaub --- open_feature/open_feature_client.py | 1 - 1 file changed, 1 deletion(-) diff --git a/open_feature/open_feature_client.py b/open_feature/open_feature_client.py index 130d1bd7..83c0b5ff 100644 --- a/open_feature/open_feature_client.py +++ b/open_feature/open_feature_client.py @@ -244,7 +244,6 @@ def create_provider_evaluation( :param key: the string key of the selected flag :param default_value: backup value returned if no result found by the provider :param evaluation_context: Information for the purposes of flag evaluation - :param flag_evaluation_options: Additional flag evaluation information :return: a FlagEvaluationDetails object with the fully evaluated flag from a provider """