Skip to content

Commit

Permalink
fix: Correct typehint on Config.update_processor_class (#274)
Browse files Browse the repository at this point in the history
Fixes #273
  • Loading branch information
keelerm84 committed Mar 7, 2024
1 parent bffe2bb commit d386f9c
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 5 deletions.
9 changes: 5 additions & 4 deletions ldclient/config.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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,
Expand Down Expand Up @@ -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,
Expand Down Expand Up @@ -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
Expand Down
3 changes: 2 additions & 1 deletion ldclient/impl/integrations/test_data/test_data_source.py
Original file line number Diff line number Diff line change
@@ -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
Expand Down

0 comments on commit d386f9c

Please sign in to comment.