-
Notifications
You must be signed in to change notification settings - Fork 11
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
Fix bug in Node.__repr__ #233
Conversation
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.
thanks for fixing this!
i think you've missed some occurrences of _inputs
, added comments inline
cgp/node.py
Outdated
@@ -79,7 +79,7 @@ def idx(self) -> int: | |||
def __repr__(self) -> str: | |||
return ( | |||
f"{self.__class__.__name__}(idx: {self.idx}, active: {self._active}, " | |||
f"arity: {self._arity}, inputs {self._inputs}, output {self._output})" | |||
f"arity: {self._arity}, inputs {self._inputs}" |
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.
e.g., here
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.
beautiful, thanks! ✨ 👍
i've added two minor comments that you are free to address or ignore. but please squash/rebase before merging
@@ -173,7 +173,7 @@ def _determine_active_nodes(self) -> Dict[int, Set[Node]]: | |||
continue | |||
active_nodes_by_hidden_column_idx[self._hidden_column_idx(node.idx)].add(node) | |||
|
|||
for i in node.inputs: | |||
for i in node.input_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.
when reading this line, i would prefer something like for input_idx in node.input_node_indices
, i.e., renaming input_nodes
-> input_node_indices
or this overdoing it? ;)
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.
I think this is overdoing it. ;-)
@@ -12,16 +12,16 @@ def test_inputs_are_cut_to_match_arity(): | |||
|
|||
""" | |||
idx = 0 |
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.
idx = 0 | |
node_idx = 0 |
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.
I think this is unrelated to this PR and the class member is called idx
anyway.
Remove _output from repr string of Node class Rename _inputs to _input_nodes for better clarity Add test of CartesianGraph.__repr__ function Add test for __repr__ of 3 example nodes Co-authored-by: Jakob Jordan <[email protected]>
a769ec3
to
10d76c2
Compare
This PR fixes #232 by following the suggestions of @jakobj in the ticket: