-
Notifications
You must be signed in to change notification settings - Fork 2
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Adding eq method to collection #41
base: pipeline
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -34,6 +34,18 @@ def __len__(self): | |
|
||
def __iter__(self): | ||
return iter(self.nodes.values()) | ||
|
||
def __eq__(self, other): | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Maybe add a preliminary check that the |
||
|
||
# The current implementation assumes that nodes in both graphs are connected with the same link number. | ||
for node_id in self.nodes: | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. also need to check that there are no extra nodes in |
||
if node_id in other.nodes.keys(): | ||
if self.nodes[node_id] != other.nodes[node_id]: | ||
return False | ||
else: | ||
return False | ||
|
||
Peyman-N marked this conversation as resolved.
Show resolved
Hide resolved
|
||
return True | ||
|
||
def add(self, *nodes): | ||
""" | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
also need to check equality
self._type_
andself.id
(if it is defined, i.e., forLinkedMetadata
, but not forEmbeddedMetadata
, and if it is not None)