From 8329e890745994403a910cb49a36b80e709ab961 Mon Sep 17 00:00:00 2001 From: Federico Bond Date: Sat, 3 Feb 2024 16:30:30 -0300 Subject: [PATCH] feat: make return value not optional in provider API functions Signed-off-by: Federico Bond --- openfeature/api.py | 4 ++-- openfeature/client.py | 5 ----- 2 files changed, 2 insertions(+), 7 deletions(-) diff --git a/openfeature/api.py b/openfeature/api.py index 92a7443e..8ce1945b 100644 --- a/openfeature/api.py +++ b/openfeature/api.py @@ -31,12 +31,12 @@ def set_provider(provider: FeatureProvider) -> None: provider.initialize(_evaluation_context) -def get_provider() -> typing.Optional[FeatureProvider]: +def get_provider() -> FeatureProvider: global _provider return _provider -def get_provider_metadata() -> typing.Optional[Metadata]: +def get_provider_metadata() -> Metadata: global _provider return _provider.get_metadata() diff --git a/openfeature/client.py b/openfeature/client.py index c76402fb..092290f8 100644 --- a/openfeature/client.py +++ b/openfeature/client.py @@ -25,7 +25,6 @@ error_hooks, ) from openfeature.provider import FeatureProvider -from openfeature.provider.no_op_provider import NoOpProvider logger = logging.getLogger("openfeature") @@ -374,10 +373,6 @@ def _create_provider_evaluation( evaluation_context, ) - if not self.provider: - logger.info("No provider configured, using no-op provider.") - self.provider = NoOpProvider() - get_details_callables: typing.Mapping[FlagType, GetDetailCallable] = { FlagType.BOOLEAN: self.provider.resolve_boolean_details, FlagType.INTEGER: self.provider.resolve_integer_details,