Skip to content

Fix Mutable Default Arguments in Constructor And Correct Type Hints in Constructor #242

@EphraimHaber

Description

@EphraimHaber

The Watchers have some code that can lead to errors.

take LorWatcher.py as an example:

Using mutable objects (e.g., lists, dictionaries) as default arguments for parameters is generally considered a bad practice in Python. In this case, rate_limiter: RateLimiter = BasicRateLimiter() and deserializer: Deserializer = DictionaryDeserializer() could lead to unexpected behavior if you create multiple instances of the class. It's better to use None as the default value and handle the instantiation inside the __init__ method or use a constant or a function to provide the default value.
Type Hints: Using type hints (`api_key: str = None, timeout: int = None) is false and is marked as error.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions