Skip to content

Commit d386f9c

Browse files
authored
fix: Correct typehint on Config.update_processor_class (#274)
Fixes #273
1 parent bffe2bb commit d386f9c

File tree

2 files changed

+7
-5
lines changed

2 files changed

+7
-5
lines changed

ldclient/config.py

+5-4
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55
"""
66

77
from typing import Optional, Callable, List, Set
8+
from threading import Event
89

910
from ldclient.feature_store import InMemoryFeatureStore
1011
from ldclient.impl.util import log, validate_application_info
@@ -155,7 +156,7 @@ def __init__(self,
155156
initial_reconnect_delay: float=1,
156157
defaults: dict={},
157158
send_events: Optional[bool]=None,
158-
update_processor_class: Optional[Callable[[str, 'Config', FeatureStore], UpdateProcessor]]=None,
159+
update_processor_class: Optional[Callable[['Config', FeatureStore, Event], UpdateProcessor]]=None,
159160
poll_interval: float=30,
160161
use_ldd: bool=False,
161162
feature_store: Optional[FeatureStore]=None,
@@ -218,8 +219,8 @@ def __init__(self,
218219
reset its set of known context keys.
219220
:param feature_requester_class: A factory for a FeatureRequester implementation taking the sdk key and config
220221
:param event_processor_class: A factory for an EventProcessor implementation taking the config
221-
:param update_processor_class: A factory for an UpdateProcessor implementation taking the sdk key,
222-
config, and FeatureStore implementation
222+
:param update_processor_class: A factory for an UpdateProcessor implementation taking the config, a FeatureStore
223+
implementation, and a threading `Event` to signal readiness.
223224
:param diagnostic_opt_out: Unless this field is set to True, the client will send
224225
some diagnostics data to the LaunchDarkly servers in order to assist in the development of future SDK
225226
improvements. These diagnostics consist of an initial payload containing some details of SDK in use,
@@ -342,7 +343,7 @@ def stream_uri(self):
342343
return self.__stream_uri + STREAM_FLAGS_PATH
343344

344345
@property
345-
def update_processor_class(self) -> Optional[Callable[[str, 'Config', FeatureStore], UpdateProcessor]]:
346+
def update_processor_class(self) -> Optional[Callable[['Config', FeatureStore, Event], UpdateProcessor]]:
346347
return self.__update_processor_class
347348

348349
@property

ldclient/impl/integrations/test_data/test_data_source.py

+2-1
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,12 @@
11
from ldclient.versioned_data_kind import FEATURES
2+
from ldclient.interfaces import UpdateProcessor
23

34
# This is the internal component that's created when you initialize an SDK instance that is using
45
# TestData. The TestData object manages the setup of the fake data, and it broadcasts the data
56
# through _TestDataSource to inject it into the SDK. If there are multiple SDK instances connected
67
# to a TestData, each has its own _TestDataSource.
78

8-
class _TestDataSource():
9+
class _TestDataSource(UpdateProcessor):
910

1011
def __init__(self, feature_store, test_data, ready):
1112
self._feature_store = feature_store

0 commit comments

Comments
 (0)