Browse Source

PolygonalCircuit.__eq__: fix argument type hint

Fabian Peter Hammerle 3 năm trước cách đây
mục cha
commit
8b6cc31feb
1 tập tin đã thay đổi với 5 bổ sung2 xóa
  1. 5 2
      freesurfer_surface/__init__.py

+ 5 - 2
freesurfer_surface/__init__.py

@@ -130,9 +130,12 @@ class PolygonalCircuit:
             vertex_indices.rotate(1)
         return type(self)(vertex_indices)
 
-    def __eq__(self, other: "PolygonalCircuit") -> bool:
+    def __eq__(self, other: object) -> bool:
         # pylint: disable=protected-access
-        return self._normalize().vertex_indices == other._normalize().vertex_indices
+        return (
+            isinstance(other, PolygonalCircuit)
+            and self._normalize().vertex_indices == other._normalize().vertex_indices
+        )
 
     def __hash__(self) -> int:
         # pylint: disable=protected-access