forked from jan/fatamorgana
fix equality for things which may or may not be numpy arrays
This commit is contained in:
parent
411012079d
commit
e909aa958d
@ -1321,11 +1321,19 @@ class GridRepetition:
|
|||||||
return size
|
return size
|
||||||
|
|
||||||
def __eq__(self, other: Any) -> bool:
|
def __eq__(self, other: Any) -> bool:
|
||||||
return isinstance(other, type(self)) and \
|
if not isinstance(other, type(self)):
|
||||||
self.a_count == other.a_count and \
|
return False
|
||||||
self.b_count == other.b_count and \
|
if self.a_count != other.a_count or self.b_count != other.b_count:
|
||||||
self.a_vector == other.a_vector and \
|
return False
|
||||||
self.b_vector == other.b_vector
|
if any(self.a_vector[ii] != other.a_vector[ii] for ii in range(2)):
|
||||||
|
return False
|
||||||
|
if self.b_vector is None and other.b_vector is None:
|
||||||
|
return True
|
||||||
|
if self.b_vector is None or other.b_vector is None:
|
||||||
|
return False
|
||||||
|
if any(self.b_vector[ii] != other.b_vector[ii] for ii in range(2)):
|
||||||
|
return False
|
||||||
|
return True
|
||||||
|
|
||||||
def __repr__(self) -> str:
|
def __repr__(self) -> str:
|
||||||
return 'GridRepetition: ({} : {} | {} : {})'.format(self.a_count, self.a_vector,
|
return 'GridRepetition: ({} : {} | {} : {})'.format(self.a_count, self.a_vector,
|
||||||
|
Loading…
Reference in New Issue
Block a user