parent
7f60f3dbd7
commit
995e4ada14
@ -23,6 +23,7 @@
|
||||
blocks, except immediately before a docstring (#4130)
|
||||
- For stubs, fix logic to enforce empty line after nested classes with bodies (#4141)
|
||||
- Fix crash when using a walrus in a dictionary (#4155)
|
||||
- Fix unnecessary parentheses when wrapping long dicts (#4135)
|
||||
|
||||
### Configuration
|
||||
|
||||
|
@ -244,15 +244,14 @@ def visit_dictsetmaker(self, node: Node) -> Iterator[Line]:
|
||||
if node.children[i - 1].type == token.COLON:
|
||||
if (
|
||||
child.type == syms.atom
|
||||
and child.children[0].type == token.LPAR
|
||||
and child.children[0].type in OPENING_BRACKETS
|
||||
and not is_walrus_assignment(child)
|
||||
):
|
||||
if maybe_make_parens_invisible_in_atom(
|
||||
maybe_make_parens_invisible_in_atom(
|
||||
child,
|
||||
parent=node,
|
||||
remove_brackets_around_comma=False,
|
||||
):
|
||||
wrap_in_parentheses(node, child, visible=False)
|
||||
)
|
||||
else:
|
||||
wrap_in_parentheses(node, child, visible=False)
|
||||
yield from self.visit_default(node)
|
||||
|
@ -37,6 +37,26 @@
|
||||
}
|
||||
|
||||
|
||||
class Random:
|
||||
def func():
|
||||
random_service.status.active_states.inactive = (
|
||||
make_new_top_level_state_from_dict(
|
||||
{
|
||||
"topLevelBase": {
|
||||
"secondaryBase": {
|
||||
"timestamp": 1234,
|
||||
"latitude": 1,
|
||||
"longitude": 2,
|
||||
"actionTimestamp": Timestamp(
|
||||
seconds=1530584000, nanos=0
|
||||
).ToJsonString(),
|
||||
}
|
||||
},
|
||||
}
|
||||
)
|
||||
)
|
||||
|
||||
|
||||
# output
|
||||
|
||||
|
||||
@ -89,3 +109,21 @@
|
||||
}
|
||||
),
|
||||
}
|
||||
|
||||
|
||||
class Random:
|
||||
def func():
|
||||
random_service.status.active_states.inactive = (
|
||||
make_new_top_level_state_from_dict({
|
||||
"topLevelBase": {
|
||||
"secondaryBase": {
|
||||
"timestamp": 1234,
|
||||
"latitude": 1,
|
||||
"longitude": 2,
|
||||
"actionTimestamp": (
|
||||
Timestamp(seconds=1530584000, nanos=0).ToJsonString()
|
||||
),
|
||||
}
|
||||
},
|
||||
})
|
||||
)
|
||||
|
Loading…
Reference in New Issue
Block a user