fix type anno

This commit is contained in:
blueloveTH 2024-12-14 17:16:15 +08:00
parent 6b332dbfbb
commit 2986c6268f
2 changed files with 6 additions and 6 deletions

View File

@ -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

View File

@ -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: