diff --git a/src/riotwatcher/Handlers/RateLimit/OopsRateLimiter.py b/src/riotwatcher/Handlers/RateLimit/OopsRateLimiter.py index 957da9e..3469c8a 100644 --- a/src/riotwatcher/Handlers/RateLimit/OopsRateLimiter.py +++ b/src/riotwatcher/Handlers/RateLimit/OopsRateLimiter.py @@ -18,7 +18,7 @@ def __init__(self): def friendly_name(self) -> str: return self._friendly_name - def wait_until(self, region: str, endpoint_name: str, method_name: str) -> datetime: + def wait_until(self, region: str, endpoint_name: str, method_name: str) -> datetime.datetime: if self._retry_at is not None: if self._retry_at > datetime.datetime.now(): return self._retry_at diff --git a/src/riotwatcher/LolWatcher.py b/src/riotwatcher/LolWatcher.py index ad447e2..c923f3d 100644 --- a/src/riotwatcher/LolWatcher.py +++ b/src/riotwatcher/LolWatcher.py @@ -42,9 +42,9 @@ class LolWatcher: def __init__( self, - api_key: str = None, - timeout: int = None, - kernel_url: str = None, + api_key: str | None = None, + timeout: int | None = None, + kernel_url: str | None = None, rate_limiter: RateLimiter = BasicRateLimiter(), deserializer: Deserializer = DictionaryDeserializer(), default_status_v4: bool = False, diff --git a/src/riotwatcher/LorWatcher.py b/src/riotwatcher/LorWatcher.py index cdbee56..56c8821 100644 --- a/src/riotwatcher/LorWatcher.py +++ b/src/riotwatcher/LorWatcher.py @@ -24,10 +24,10 @@ class LorWatcher: def __init__( self, - api_key: str = None, - timeout: int = None, - rate_limiter: RateLimiter = BasicRateLimiter(), - deserializer: Deserializer = DictionaryDeserializer(), + api_key: str | None = None, + timeout: int | None = None, + rate_limiter: RateLimiter | None = None, + deserializer: Deserializer | None = None, ): """ Initialize a new instance of the LorWatcher class. @@ -42,8 +42,12 @@ def __init__( from the Riot Api. Default is Handlers.DictionaryDeserializer. """ - if not api_key: + if api_key is None: raise ValueError("api_key must be set!") + if rate_limiter is None: + rate_limiter = BasicRateLimiter() + if deserializer is None: + deserializer = DictionaryDeserializer() handler_chain = [ SanitationHandler(), diff --git a/src/riotwatcher/TftWatcher.py b/src/riotwatcher/TftWatcher.py index d2055e8..072b058 100644 --- a/src/riotwatcher/TftWatcher.py +++ b/src/riotwatcher/TftWatcher.py @@ -25,8 +25,8 @@ class TftWatcher: def __init__( self, - api_key: str = None, - timeout: int = None, + api_key: str | None = None, + timeout: int | None = None, rate_limiter: RateLimiter = BasicRateLimiter(), deserializer: Deserializer = DictionaryDeserializer(), ): @@ -43,7 +43,7 @@ def __init__( from the Riot Api. Default is Handlers.DictionaryDeserializer. """ - if not api_key: + if api_key is None: raise ValueError("api_key must be set!") handler_chain = [ diff --git a/src/riotwatcher/ValWatcher.py b/src/riotwatcher/ValWatcher.py index 5e10d86..c67fd0d 100644 --- a/src/riotwatcher/ValWatcher.py +++ b/src/riotwatcher/ValWatcher.py @@ -25,7 +25,7 @@ class ValWatcher: def __init__( self, api_key: str, - timeout: int = None, + timeout: int | None = None, rate_limiter: RateLimiter = BasicRateLimiter(), deserializer: Deserializer = DictionaryDeserializer(), ): diff --git a/src/riotwatcher/riotwatcher.py b/src/riotwatcher/riotwatcher.py index 75bbcb8..0300cae 100644 --- a/src/riotwatcher/riotwatcher.py +++ b/src/riotwatcher/riotwatcher.py @@ -25,7 +25,7 @@ class RiotWatcher: def __init__( self, api_key: str, - timeout: int = None, + timeout: int | None = None, rate_limiter: RateLimiter = BasicRateLimiter(), deserializer: Deserializer = DictionaryDeserializer(), ):