Skip to content

Commit ad73b17

Browse files
committed
shortened name matching condition
asd
1 parent 8c03eb6 commit ad73b17

2 files changed

Lines changed: 3 additions & 4 deletions

File tree

shopify_python/google_styleguide.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -271,8 +271,8 @@ def __lambda_func(self, node): # type: (astroid.Lambda) -> None
271271
"+": "pos"
272272
}
273273
preferred_operator_function = unary_operators.get(node.body.op)
274-
argname = node.args.args[0].name
275-
if preferred_operator_function and not isinstance(node.body.operand, astroid.BinOp) and argname is node.body.operand.name:
274+
name_match = node.args.args[0].name is node.body.operand.name
275+
if preferred_operator_function and not isinstance(node.body.operand, astroid.BinOp) and name_match:
276276
varname = node.body.operand.name
277277
lamfun = "lambda " + varname + ": " + node.body.op + " " + varname
278278
opfun = "operator." + preferred_operator_function

tests/shopify_python/test_google_styleguide.py

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -271,12 +271,11 @@ def binaryfnc():
271271
with self.assertNoMessages():
272272
self.walk(binary_pass2)
273273

274-
275274
# Binary Op Test 3: This will trigger a message
276275
binary_msg = binary_root.body[0].body[3].value.args[0]
277276
bin_message = pylint.testutils.Message('lambda-func', node=binary_msg.body, args={
278277
'op': 'operator.mul',
279278
'lamfun': 'lambda x, y: x * y'
280-
})
279+
})
281280
with self.assertAddsMessages(bin_message):
282281
self.walk(binary_msg)

0 commit comments

Comments
 (0)