mirror of
https://github.com/pocketpy/pocketpy
synced 2025-10-20 11:30:18 +00:00
fix type anno
This commit is contained in:
parent
6b332dbfbb
commit
2986c6268f
@ -35,7 +35,7 @@ class deque(Generic[T]):
|
|||||||
_capacity: int
|
_capacity: int
|
||||||
|
|
||||||
def __init__(self, iterable: Iterable[T] = None):
|
def __init__(self, iterable: Iterable[T] = None):
|
||||||
self._data = [None] * 8 # initial capacity
|
self._data = [None] * 8 # type: ignore
|
||||||
self._head = 0
|
self._head = 0
|
||||||
self._tail = 0
|
self._tail = 0
|
||||||
self._capacity = len(self._data)
|
self._capacity = len(self._data)
|
||||||
@ -98,7 +98,7 @@ class deque(Generic[T]):
|
|||||||
def clear(self):
|
def clear(self):
|
||||||
i = self._head
|
i = self._head
|
||||||
while i != self._tail:
|
while i != self._tail:
|
||||||
self._data[i] = None
|
self._data[i] = None # type: ignore
|
||||||
i = (i + 1) % self._capacity
|
i = (i + 1) % self._capacity
|
||||||
self._head = 0
|
self._head = 0
|
||||||
self._tail = 0
|
self._tail = 0
|
||||||
|
@ -9,12 +9,12 @@ class timedelta:
|
|||||||
def __repr__(self):
|
def __repr__(self):
|
||||||
return f"datetime.timedelta(days={self.days}, seconds={self.seconds})"
|
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):
|
if not isinstance(other, timedelta):
|
||||||
return NotImplemented
|
return NotImplemented
|
||||||
return (self.days, self.seconds) == (other.days, other.seconds)
|
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):
|
if not isinstance(other, timedelta):
|
||||||
return NotImplemented
|
return NotImplemented
|
||||||
return (self.days, self.seconds) != (other.days, other.seconds)
|
return (self.days, self.seconds) != (other.days, other.seconds)
|
||||||
@ -40,10 +40,10 @@ class date:
|
|||||||
return op(self.month, other.month)
|
return op(self.month, other.month)
|
||||||
return op(self.day, other.day)
|
return op(self.day, other.day)
|
||||||
|
|
||||||
def __eq__(self, other: 'date') -> bool:
|
def __eq__(self, other) -> bool:
|
||||||
return self.__cmp(other, operator.eq)
|
return self.__cmp(other, operator.eq)
|
||||||
|
|
||||||
def __ne__(self, other: 'date') -> bool:
|
def __ne__(self, other) -> bool:
|
||||||
return self.__cmp(other, operator.ne)
|
return self.__cmp(other, operator.ne)
|
||||||
|
|
||||||
def __lt__(self, other: 'date') -> bool:
|
def __lt__(self, other: 'date') -> bool:
|
||||||
|
Loading…
x
Reference in New Issue
Block a user