The new woob repository is here: This gitlab will be removed soon.

Commit b8ec6e42 authored by Vincent A's avatar Vincent A

tools/hooks/ don't crash with {**foo}

A star-mapping in a dict returns a None key.
parent b862de3e
......@@ -101,7 +101,14 @@ def check_first_indent(self, node, attr):
if self.should_skip(node, attr):
first_elt_token = getattr(node, attr)[0].first_token
if getattr(node, attr)[0]:
first_elt_token = getattr(node, attr)[0].first_token
assert isinstance(node, ast.Dict) and attr == 'keys', "None node should only be in dict keys"
# a None node in ast.Dict.keys happens in case of **mapping
# use the tokens of the value then, nevermind the "**" tokens
first_elt_token = node.values[0].first_token
if first_elt_token.start[0] == node.first_token.start[0]:
'first element should start on a new line',
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment