-
Notifications
You must be signed in to change notification settings - Fork 903
/
assignment_split_value_first.py
71 lines (60 loc) · 1.65 KB
/
assignment_split_value_first.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
# Don't parenthesize the value because the target's trailing comma forces it to split.
a[
aaaaaaa,
b,
] = cccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccc # comment
# Parenthesize the value, but don't duplicate the comment.
a[
aaaaaaa,
b
] = cccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccc # comment
# Format both as flat, but don't loos the comment.
a[
aaaaaaa,
b
] = bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb # comment
#######################################################
# Test the case where a parenthesized value now fits:
a[
aaaaaaa,
b
] = (
cccccccc # comment
)
# Doesn't use `BestFit` because the target always breaks because of the trailing comma
a[
aaaaaaa,
b,
] = (
cccccccc # comment
)
# Doesn't use `BestFit` because the target always breaks because of the trailing comma
# The group breaks because of its comments
a[
aaaaaaa,
b
] = (
# leading comment
b
) = (
cccccccc # comment
)
a[bbbbbbbbbbbbbbbbbb] = ccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccc
# Does not double-parenthesize tuples
(
first_item,
second_item,
) = some_looooooooong_module.some_loooooog_function_name(
first_argument, second_argument, third_argument
)
# Preserve parentheses around the first target
(
req["ticket"]["steps"]["step"][0]["tasks"]["task"]["fields"]["field"][
"access_request"
]["destinations"]["destination"][0]["ip_address"]
) = dst
(
req["ticket"]["steps"]["step"][0]["tasks"]["task"]["fields"]["field"][
"access_request"
]["destinations"]["destination"][0]["ip_address"]
) += dst