From ddc5934a136b4507a70cd2a0f9ece5c68f193885 Mon Sep 17 00:00:00 2001 From: RGBCube Date: Fri, 1 Jul 2022 15:08:36 +0300 Subject: [PATCH] Make ratilimits never have a None value --- github/internals/http.py | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/github/internals/http.py b/github/internals/http.py index f9910e1..cdc679d 100644 --- a/github/internals/http.py +++ b/github/internals/http.py @@ -38,8 +38,8 @@ class RateLimits(NamedTuple): remaining: int used: int total: int - reset_time: Optional[datetime] - last_request: Optional[datetime] + reset_time: datetime + last_request: datetime # ====== STYLE GUIDE ===== # @@ -119,7 +119,7 @@ class HTTPClient: *, headers: Optional[Dict[str, str]] = None, auth: Optional[BasicAuth] = None, - ) -> Self: + ) -> HTTPClient: self = super(cls, cls).__new__(cls) headers = headers or {} @@ -132,7 +132,9 @@ class HTTPClient: self.__session = ClientSession(headers=headers, auth=auth) - self._rates = RateLimits(60, 0, 60, None, None) + time_0 = datetime.fromtimestamp(0) + + self._rates = RateLimits(60, 0, 60, time_0, time_0) self._last_ping = float("-inf") self._latency = 0