|
11 | 11 | from openfeature.hook import Hook |
12 | 12 | from openfeature.track import TrackingEventDetails |
13 | 13 |
|
| 14 | +from ._protocols import InternalHookProvider |
14 | 15 | from .metadata import Metadata |
15 | 16 |
|
16 | 17 | if typing.TYPE_CHECKING: |
@@ -137,38 +138,6 @@ def track( |
137 | 138 | ) -> None: ... |
138 | 139 |
|
139 | 140 |
|
140 | | -@typing.runtime_checkable |
141 | | -class InternalHookProvider(typing.Protocol): |
142 | | - """Protocol for providers that manage their own provider hook execution. |
143 | | -
|
144 | | - Providers implementing this protocol (e.g. MultiProvider) handle provider |
145 | | - hook lifecycle internally. The client will skip its own provider hook |
146 | | - invocations and instead delegate to the provider via the set/reset methods. |
147 | | -
|
148 | | - The registry will also use get_status() from this protocol instead of its |
149 | | - own internal status tracking for providers that implement it. |
150 | | -
|
151 | | - Implementations must set ``_is_internal_hook_provider = True`` as a class |
152 | | - attribute. This marker is checked alongside ``isinstance`` to avoid false |
153 | | - positives from duck-typed objects (e.g. ``Mock``). |
154 | | - """ |
155 | | - |
156 | | - _is_internal_hook_provider: typing.ClassVar[bool] |
157 | | - |
158 | | - def uses_internal_provider_hooks(self) -> bool: ... |
159 | | - |
160 | | - def set_internal_provider_hook_runtime( |
161 | | - self, |
162 | | - flag_type: typing.Any, |
163 | | - client_metadata: typing.Any, |
164 | | - hook_hints: typing.Any, |
165 | | - ) -> typing.Any: ... |
166 | | - |
167 | | - def reset_internal_provider_hook_runtime(self, token: typing.Any) -> None: ... |
168 | | - |
169 | | - def get_status(self) -> ProviderStatus: ... |
170 | | - |
171 | | - |
172 | 141 | class AbstractProvider(FeatureProvider): |
173 | 142 | def __init__(self, *args: typing.Any, **kwargs: typing.Any) -> None: |
174 | 143 | # this makes sure to invoke the parent of `FeatureProvider` -> `object` |
|
0 commit comments