parent
aafc21aa77
commit
78163939f1
@ -1417,8 +1417,10 @@ def run_transformer(
|
||||
|
||||
result.extend(transform_line(transformed_line, mode=mode, features=features))
|
||||
|
||||
features_set = set(features)
|
||||
if (
|
||||
transform.__class__.__name__ != "rhs"
|
||||
Feature.FORCE_OPTIONAL_PARENTHESES in features_set
|
||||
or transform.__class__.__name__ != "rhs"
|
||||
or not line.bracket_tracker.invisible
|
||||
or any(bracket.value for bracket in line.bracket_tracker.invisible)
|
||||
or line.contains_multiline_strings()
|
||||
@ -1435,7 +1437,7 @@ def run_transformer(
|
||||
|
||||
line_copy = line.clone()
|
||||
append_leaves(line_copy, line, line.leaves)
|
||||
features_fop = set(features) | {Feature.FORCE_OPTIONAL_PARENTHESES}
|
||||
features_fop = features_set | {Feature.FORCE_OPTIONAL_PARENTHESES}
|
||||
second_opinion = run_transformer(
|
||||
line_copy, transform, mode, features_fop, line_str=line_str
|
||||
)
|
||||
|
@ -17,6 +17,24 @@
|
||||
"a key in my dict": MyClass.some_attribute.first_call().second_call().third_call(some_args="some value")
|
||||
}
|
||||
|
||||
{
|
||||
'xxxxxx':
|
||||
xxxxxxxxxxxxxxxxxxx.xxxxxxxxxxxxxx(
|
||||
xxxxxxxxxxxxxx={
|
||||
'x':
|
||||
xxxxxxxxxxxxxxxxxxxxxxxxxx.xxxxxxxxxxxxxxxxxxxxxxxxxxxxx(
|
||||
xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx=(
|
||||
xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
|
||||
.xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx(
|
||||
xxxxxxxxxxxxx=xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
|
||||
.xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx(
|
||||
xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx={
|
||||
'x': x.xx,
|
||||
'x': x.x,
|
||||
}))))
|
||||
}),
|
||||
}
|
||||
|
||||
|
||||
# output
|
||||
|
||||
@ -51,3 +69,22 @@
|
||||
.third_call(some_args="some value")
|
||||
)
|
||||
}
|
||||
|
||||
{
|
||||
"xxxxxx": xxxxxxxxxxxxxxxxxxx.xxxxxxxxxxxxxx(
|
||||
xxxxxxxxxxxxxx={
|
||||
"x": xxxxxxxxxxxxxxxxxxxxxxxxxx.xxxxxxxxxxxxxxxxxxxxxxxxxxxxx(
|
||||
xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx=(
|
||||
xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx.xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx(
|
||||
xxxxxxxxxxxxx=xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx.xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx(
|
||||
xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx={
|
||||
"x": x.xx,
|
||||
"x": x.x,
|
||||
}
|
||||
)
|
||||
)
|
||||
)
|
||||
)
|
||||
}
|
||||
),
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user