Skip to content

Commit

Permalink
Merge pull request #173 from rayosborn/fix-link-equality
Browse files Browse the repository at this point in the history
Add function to check link equality
  • Loading branch information
rayosborn authored Jun 28, 2022
2 parents 4a808ff + c0a16fd commit 8b56504
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions src/nexusformat/nexus/tree.py
Original file line number Diff line number Diff line change
Expand Up @@ -5232,6 +5232,14 @@ def __setitem__(self, idx, value):
else:
self.nxlink.__setitem__(idx, value)

def __eq__(self, other):
"""Return True if two linked objects share the same target."""
if isinstance(other, NXlink):
return ((self._target == other._target) and
(self._filename == other._filename))
else:
return False

def __deepcopy__(self, memo={}):
"""Return a deep copy of the link containing the target information."""
obj = self
Expand Down

0 comments on commit 8b56504

Please sign in to comment.