From b92ead9c9bc4353e1fc736d6ebd02f66c49007d4 Mon Sep 17 00:00:00 2001 From: Matthew Keeler Date: Wed, 6 Mar 2024 13:16:53 -0500 Subject: [PATCH] fix: Correct typehint on Config.update_processor_class --- ldclient/config.py | 9 +++++---- ldclient/impl/integrations/test_data/test_data_source.py | 3 ++- 2 files changed, 7 insertions(+), 5 deletions(-) diff --git a/ldclient/config.py b/ldclient/config.py index 25f0f849..f51ea42e 100644 --- a/ldclient/config.py +++ b/ldclient/config.py @@ -5,6 +5,7 @@ """ from typing import Optional, Callable, List, Set +from threading import Event from ldclient.feature_store import InMemoryFeatureStore from ldclient.impl.util import log, validate_application_info @@ -155,7 +156,7 @@ def __init__(self, initial_reconnect_delay: float=1, defaults: dict={}, send_events: Optional[bool]=None, - update_processor_class: Optional[Callable[[str, 'Config', FeatureStore], UpdateProcessor]]=None, + update_processor_class: Optional[Callable[['Config', FeatureStore, Event], UpdateProcessor]]=None, poll_interval: float=30, use_ldd: bool=False, feature_store: Optional[FeatureStore]=None, @@ -218,8 +219,8 @@ def __init__(self, reset its set of known context keys. :param feature_requester_class: A factory for a FeatureRequester implementation taking the sdk key and config :param event_processor_class: A factory for an EventProcessor implementation taking the config - :param update_processor_class: A factory for an UpdateProcessor implementation taking the sdk key, - config, and FeatureStore implementation + :param update_processor_class: A factory for an UpdateProcessor implementation taking the config, a FeatureStore + implementation, and a threading `Event` to signal readiness. :param diagnostic_opt_out: Unless this field is set to True, the client will send some diagnostics data to the LaunchDarkly servers in order to assist in the development of future SDK improvements. These diagnostics consist of an initial payload containing some details of SDK in use, @@ -342,7 +343,7 @@ def stream_uri(self): return self.__stream_uri + STREAM_FLAGS_PATH @property - def update_processor_class(self) -> Optional[Callable[[str, 'Config', FeatureStore], UpdateProcessor]]: + def update_processor_class(self) -> Optional[Callable[['Config', FeatureStore, Event], UpdateProcessor]]: return self.__update_processor_class @property diff --git a/ldclient/impl/integrations/test_data/test_data_source.py b/ldclient/impl/integrations/test_data/test_data_source.py index 36483a69..19e0cc4a 100644 --- a/ldclient/impl/integrations/test_data/test_data_source.py +++ b/ldclient/impl/integrations/test_data/test_data_source.py @@ -1,11 +1,12 @@ from ldclient.versioned_data_kind import FEATURES +from ldclient.interfaces import UpdateProcessor # This is the internal component that's created when you initialize an SDK instance that is using # TestData. The TestData object manages the setup of the fake data, and it broadcasts the data # through _TestDataSource to inject it into the SDK. If there are multiple SDK instances connected # to a TestData, each has its own _TestDataSource. -class _TestDataSource(): +class _TestDataSource(UpdateProcessor): def __init__(self, feature_store, test_data, ready): self._feature_store = feature_store