From 019ae1c536c26c5ed6662dbddad4d12736c7f5be Mon Sep 17 00:00:00 2001 From: Daniel Otto de Mentock Date: Fri, 4 Feb 2022 11:43:35 +0100 Subject: [PATCH] adjusted typecheck in __eq__ and __ne__ functions --- python/damask/_orientation.py | 6 ++---- python/damask/_rotation.py | 6 ++---- 2 files changed, 4 insertions(+), 8 deletions(-) diff --git a/python/damask/_orientation.py b/python/damask/_orientation.py index 4817ddb6f..2221af8a4 100644 --- a/python/damask/_orientation.py +++ b/python/damask/_orientation.py @@ -148,7 +148,7 @@ class Orientation(Rotation,Crystal): """ if not isinstance(other, Orientation): - return NotImplemented + raise NotImplementedError matching_type = self.family == other.family and \ self.lattice == other.lattice and \ self.parameters == other.parameters @@ -165,9 +165,7 @@ class Orientation(Rotation,Crystal): Orientation to check for equality. """ - eq = self.__eq__(other) - if not isinstance(eq, bool): - return eq + self.__eq__(other) return np.logical_not(self==other) diff --git a/python/damask/_rotation.py b/python/damask/_rotation.py index d40b48669..5efaf9d9e 100644 --- a/python/damask/_rotation.py +++ b/python/damask/_rotation.py @@ -124,7 +124,7 @@ class Rotation: """ if not isinstance(other, Rotation): - return NotImplemented + raise NotImplementedError return np.logical_or(np.all(self.quaternion == other.quaternion,axis=-1), np.all(self.quaternion == -1.0*other.quaternion,axis=-1)) @@ -139,9 +139,7 @@ class Rotation: Rotation to check for inequality. """ - eq = self.__eq__(other) - if not isinstance(eq, bool): - return eq + self.__eq__(other) return np.logical_not(self==other)