-
Notifications
You must be signed in to change notification settings - Fork 166
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
Add MatMul operator to patchedast #497
Conversation
Hi @eivindjahren, I wasn't able to replicate the issue, but this PR should fix this issue. Let me know if you would be able to test this branch, or when 1.3.0 is released. |
Unfortunately it doesn't seem to fix the problem as the name of the operator is The following regression test (when added to def test_matmul_node(self):
source = (
"import numpy as np\n"
"a=np.array([[1,2]])\n"
"b=np.array([[1],[2]])\n"
"a @ b\n"
)
ast_frag = patchedast.get_patched_ast(source, True)
checker = _ResultChecker(self, ast_frag)
checker.check_children("BinOp", ["Name", " ", "@", " ", "Name"]) I think you probably can skip the import and use of numpy by just using lists. As I understand it, that would just result in a runtime error where it is discovered that |
rope/refactor/patchedast.py
Outdated
@@ -277,6 +277,7 @@ def _child_nodes(self, nodes, separator): | |||
"Div": "/", | |||
"Mod": "%", | |||
"Pow": "**", | |||
"MatMul": "@", |
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.
Should be "MatMult": "@",
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.
Fixed now
The bug is fixed now!🎉 I prefer to add a regression test with every bug-fix. I find its a good way to grow test coverage. The test I pasted above should suffice. But its just my preference and you call the shots 🔫 , so feel free to just ignore that :P |
7f911f2
to
b1b6a0a
Compare
Nice 👍 |
Description
Fix issue with parsing code with MatMul operator.
Fixes #496
Checklist (delete if not relevant):