Skip to content

Conversation

erikwright
Copy link
Contributor

@erikwright erikwright commented Jun 5, 2017

@cfournie PTAL. Solves the following:

[2017-06-03T04:28:19Z]   File "/app/.tox/pylint/src/pylint/pylint/utils.py", line 970, in walk
[2017-06-03T04:28:19Z]     cb(astroid)
[2017-06-03T04:28:19Z]   File "/app/.tox/pylint/lib/python3.5/site-packages/shopify_python/google_styleguide.py", line 145, in visit_lambda
[2017-06-03T04:28:19Z]     self.__lambda_func(node)
[2017-06-03T04:28:19Z]   File "/app/.tox/pylint/lib/python3.5/site-packages/shopify_python/google_styleguide.py", line 298, in __lambda_func
[2017-06-03T04:28:19Z]     operator = self.BINARY_OPERATORS[node.op]
[2017-06-03T04:28:19Z] KeyError: '&'

This change is Reviewable

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)
Copy link
Contributor

@cfournie cfournie Jun 5, 2017

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.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

unary_root = astroid.builder.parse("""
def unaryfnc():
unary_fail = map(lambda x: {}, [1, 2, 3, 4])
""".format(expression))
Copy link
Contributor

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.

Copy link
Contributor Author

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.

@erikwright erikwright changed the base branch from master to fix_binary_operator_lambda June 5, 2017 19:33
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants