Skip to content

update_processor_class has wrong types #364

@drinchev

Description

@drinchev

Is this a support request?

No

Describe the bug

When using Files.new_data_source as a update_processor_class with my Config, as mentioned in the example, mypy throws an error :

error: Argument "update_processor_class" to "Config" has incompatible type "object"; expected "Callable[[Config, FeatureStore, Event], UpdateProcessor] | None"  [arg-type]

I believe this is due to the wrong types being specified in either update_processor_class or the return type of new_data_source.

class Files:
"""Provides factory methods for integrations with filesystem data."""
@staticmethod
def new_data_source(paths: List[str], auto_update: bool = False, poll_interval: float = 1, force_polling: bool = False) -> object:
"""Provides a way to use local files as a source of feature flag state. This would typically be
used in a test environment, to operate using a predetermined feature flag state without an
actual LaunchDarkly connection.
To use this component, call ``new_data_source``, specifying the file path(s) of your data file(s)
in the ``paths`` parameter; then put the value returned by this method into the ``update_processor_class``
property of your LaunchDarkly client configuration (:class:`ldclient.config.Config`).
::
from ldclient.integrations import Files
data_source = Files.new_data_source(paths=[ myFilePath ])
config = Config(update_processor_class=data_source)

@property
def update_processor_class(self) -> Optional[Callable[['Config', FeatureStore, Event], UpdateProcessor]]:
return self.__update_processor_class

Expected behavior
There should be no type error when using the method as in the documentation.

SDK version
9.12.0

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions