Explorar o código

fix type anno

blueloveTH hai 1 ano
pai
achega
2986c6268f
Modificáronse 2 ficheiros con 6 adicións e 6 borrados
  1. 2 2
      python/collections.py
  2. 4 4
      python/datetime.py

+ 2 - 2
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

+ 4 - 4
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: