-
Notifications
You must be signed in to change notification settings - Fork 34
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
Fixes for newer astroid versions #101
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.
Thank you!!
@@ -88,6 +83,9 @@ def _visit_after_children(self, node, parent_token, token): | |||
first = token | |||
last = None | |||
for child in cast(Callable, self._iter_children)(node): | |||
# astroid slices have especially wrong positions, we don't want them to corrupt their parents. | |||
if util.is_empty_astroid_slice(child): |
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.
Might it be a better alternative to filter out empty slices in iter_children_astroid
in util.py
? (Perhaps that would be wrong, but seems this is done for some nodes already.)
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.
Just tried that, it didn't work. Other places need those child nodes to be included.
@@ -814,6 +819,10 @@ def assert_nodes_equal(self, t1, t2): | |||
else: | |||
self.assertEqual(type(t1), type(t2)) | |||
|
|||
if isinstance(t1, AstroidPosition): |
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.
Just checking that this is a separate kind of node and not a base class for everything in new astroid :)
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.
It's not a node, it's this:
class Position(NamedTuple):
"""Position with line and column information."""
lineno: int
col_offset: int
end_lineno: int
end_col_offset: int
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.
Excellent!
Fixes #70 and #79
astroid.node_classes
toastroid.nodes
.test_slices
.Position
when asserting equal astroid nodes.