From 2986c6268f334dabaa289587d3b6fc05f731715a Mon Sep 17 00:00:00 2001 From: blueloveTH Date: Sat, 14 Dec 2024 17:16:15 +0800 Subject: [PATCH] fix type anno --- python/collections.py | 4 ++-- python/datetime.py | 8 ++++---- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/python/collections.py b/python/collections.py index da12c5cd..6e7cdc35 100644 --- a/python/collections.py +++ b/python/collections.py @@ -35,7 +35,7 @@ class deque(Generic[T]): _capacity: int def __init__(self, iterable: Iterable[T] = None): - self._data = [None] * 8 # initial capacity + self._data = [None] * 8 # type: ignore self._head = 0 self._tail = 0 self._capacity = len(self._data) @@ -98,7 +98,7 @@ class deque(Generic[T]): def clear(self): i = self._head while i != self._tail: - self._data[i] = None + self._data[i] = None # type: ignore i = (i + 1) % self._capacity self._head = 0 self._tail = 0 diff --git a/python/datetime.py b/python/datetime.py index ce5a35ed..d1379e5f 100644 --- a/python/datetime.py +++ b/python/datetime.py @@ -9,12 +9,12 @@ class timedelta: def __repr__(self): return f"datetime.timedelta(days={self.days}, seconds={self.seconds})" - def __eq__(self, other: 'timedelta') -> bool: + def __eq__(self, other) -> bool: if not isinstance(other, timedelta): return NotImplemented return (self.days, self.seconds) == (other.days, other.seconds) - def __ne__(self, other: 'timedelta') -> bool: + def __ne__(self, other) -> bool: if not isinstance(other, timedelta): return NotImplemented return (self.days, self.seconds) != (other.days, other.seconds) @@ -40,10 +40,10 @@ class date: return op(self.month, other.month) return op(self.day, other.day) - def __eq__(self, other: 'date') -> bool: + def __eq__(self, other) -> bool: return self.__cmp(other, operator.eq) - def __ne__(self, other: 'date') -> bool: + def __ne__(self, other) -> bool: return self.__cmp(other, operator.ne) def __lt__(self, other: 'date') -> bool: