mostly cosmetic, adding some type hints, and clarifying comments#16
mostly cosmetic, adding some type hints, and clarifying comments#16amirziai wants to merge 2 commits intosnap-stanford:masterfrom
Conversation
| self.__slices__ = None | ||
|
|
||
| @staticmethod | ||
| def collate(follow_batch=[], transform=None, **kwargs): |
There was a problem hiding this comment.
this pattern appears in a few places i think:
https://docs.python-guide.org/writing/gotchas/#mutable-default-arguments
There was a problem hiding this comment.
Hi,
Thanks for proposing this. It seems that it is not a bug because we want the users to pass in a list for follow_batch and if they don't pass in the list we will make the follow_batch an empty list. We are not going to append elements to the follow_batch as appears in the link.
There was a problem hiding this comment.
yea, def not a bug from what i can tell so it's minor. however, this pattern can lead to very tricky issues to debug and is generally advised against so wanted to point it out. no worries if you prefer it the way it is.
zechengz
left a comment
There was a problem hiding this comment.
Hi,
Thanks for your contribution! To approve your changes, I think you need to remove the nx.Graph type hints because we currently also support snapx graphs.
|
thanks @zechengz . i see, looks like what do you think about this: also again totally ok if you prefer it the way it is. adding the type hint makes it more clear for me when i'm reading the code but i understand if it's in the way. |
|
@zechengz lmk if you like the suggestion above, otherwise i can drop the type params and we can merge this. thanks! |
Sorry about the late reply. Thanks, it looks good to me. Yes, currently snapx is part of the the pypi package snap-stanford, which has a similar interface with the networkx. If you are interested, one example deepsnap supports snapx is https://github.com/snap-stanford/deepsnap/blob/master/examples/node_classification_cora.py |
|
thanks @zechengz , just made the change. lmk if you have any other feedback i should consider. |
No description provided.