Riot-Watcher
Riot-Watcher copied to clipboard
Fix Mutable Default Arguments in Constructor And Correct Type Hints in Constructor
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.