-
Notifications
You must be signed in to change notification settings - Fork 13
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 unary operators and resilience against unrecognized operators #74
base: fix_binary_operator_lambda
Are you sure you want to change the base?
Conversation
@@ -295,10 +298,20 @@ def __lambda_func(self, node): # type: (astroid.Lambda) -> None | |||
elif isinstance(node.body, astroid.BinOp): | |||
if shopify_python.ast.count_tree_size(node.body) == 3 and len(node.args.args) == 2: | |||
node = node.body | |||
operator = self.BINARY_OPERATORS[node.op] | |||
operator = self.BINARY_OPERATORS.get(node.op, None) |
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'm not sure how to test this while implementing all operators.
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 is in fact covered by https://github.com/Shopify/shopify_python/pull/74/files#diff-91e31ad8c2d48b1c0d10cce924bc746eR293
unary_root = astroid.builder.parse(""" | ||
def unaryfnc(): | ||
unary_fail = map(lambda x: {}, [1, 2, 3, 4]) | ||
""".format(expression)) |
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.
These changes appear to be built upon #73; I assume that you'll rebase before merging.
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.
My apologies, forgot to set the base branch. It's updated now.
@cfournie PTAL. Solves the following:
This change is