소스 검색

PolygonalCircuit.__eq__: fix argument type hint

Fabian Peter Hammerle 3 년 전
부모
커밋
8b6cc31feb
1개의 변경된 파일5개의 추가작업 그리고 2개의 파일을 삭제
  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