MCPcopy Create free account
hub / github.com/Kitware/VTK / __eq__

Method __eq__

Wrapping/Python/vtkmodules/util/data_model.py:182–205  ·  view source on GitHub ↗

Test dict-like equivalency.

(self, other: object)

Source from the content-addressed store, hash-verified

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())

Callers

nothing calls this directly

Calls 4

keysMethod · 0.95
typeEnum · 0.50
setFunction · 0.50
itemsMethod · 0.45

Tested by

no test coverage detected