69 lines
1.8 KiB
Python
69 lines
1.8 KiB
Python
import typing
|
|
from abc import abstractmethod
|
|
|
|
from openfeature.evaluation_context import EvaluationContext
|
|
from openfeature.flag_evaluation import FlagResolutionDetails
|
|
from openfeature.hook import Hook
|
|
from openfeature.provider.metadata import Metadata
|
|
|
|
|
|
class AbstractProvider:
|
|
def initialize(self, evaluation_context: EvaluationContext) -> None:
|
|
pass
|
|
|
|
def shutdown(self) -> None:
|
|
pass
|
|
|
|
@abstractmethod
|
|
def get_metadata(self) -> Metadata:
|
|
pass
|
|
|
|
@abstractmethod
|
|
def get_provider_hooks(self) -> typing.List[Hook]:
|
|
return []
|
|
|
|
@abstractmethod
|
|
def resolve_boolean_details(
|
|
self,
|
|
flag_key: str,
|
|
default_value: bool,
|
|
evaluation_context: typing.Optional[EvaluationContext] = None,
|
|
) -> FlagResolutionDetails[bool]:
|
|
pass
|
|
|
|
@abstractmethod
|
|
def resolve_string_details(
|
|
self,
|
|
flag_key: str,
|
|
default_value: str,
|
|
evaluation_context: typing.Optional[EvaluationContext] = None,
|
|
) -> FlagResolutionDetails[str]:
|
|
pass
|
|
|
|
@abstractmethod
|
|
def resolve_integer_details(
|
|
self,
|
|
flag_key: str,
|
|
default_value: int,
|
|
evaluation_context: typing.Optional[EvaluationContext] = None,
|
|
) -> FlagResolutionDetails[int]:
|
|
pass
|
|
|
|
@abstractmethod
|
|
def resolve_float_details(
|
|
self,
|
|
flag_key: str,
|
|
default_value: float,
|
|
evaluation_context: typing.Optional[EvaluationContext] = None,
|
|
) -> FlagResolutionDetails[float]:
|
|
pass
|
|
|
|
@abstractmethod
|
|
def resolve_object_details(
|
|
self,
|
|
flag_key: str,
|
|
default_value: typing.Union[dict, list],
|
|
evaluation_context: typing.Optional[EvaluationContext] = None,
|
|
) -> FlagResolutionDetails[typing.Union[dict, list]]:
|
|
pass
|