Test dict-like equivalency.
(self, other: object)
| 180 | self.AddArray(arr) |
| 181 | |
| 182 | def __eq__(self, other: object) -> bool: |
| 183 | """Test dict-like equivalency.""" |
| 184 | # here we check if other is the same class or a subclass of self. |
| 185 | if not isinstance(other, type(self)): |
| 186 | return False |
| 187 | |
| 188 | if self is other: |
| 189 | return True |
| 190 | |
| 191 | """ |
| 192 | If numpy is not available, only check for identity without comparing contents of the data arrays |
| 193 | """ |
| 194 | if not NUMPY_AVAILABLE: |
| 195 | return False |
| 196 | |
| 197 | if set(self.keys()) != set(other.keys()): |
| 198 | return False |
| 199 | |
| 200 | # verify the value of the arrays |
| 201 | for key, value in other.items(): |
| 202 | if not numpy.array_equal(value, self[key]): |
| 203 | return False |
| 204 | |
| 205 | return True |
| 206 | |
| 207 | def __iter__(self): |
| 208 | return iter(self.keys()) |