Debian Codegraph @

tests/data/cases/collections.py

raw
1 import core, time, a
2
3 from . import A, B, C
4
5 # keeps existing trailing comma
6 from foo import (
7 bar,
8 )
9
10 # also keeps existing structure
11 from foo import (
12 baz,
13 qux,
14 )
15
16 # `as` works as well
17 from foo import (
18 xyzzy as magic,
19 )
20
21 a = {1,2,3,}
22 b = {
23 1,2,
24 3}
25 c = {
26 1,
27 2,
28 3,
29 }
30 x = 1,
31 y = narf(),
32 nested = {(1,2,3),(4,5,6),}
33 nested_no_trailing_comma = {(1,2,3),(4,5,6)}
34 nested_long_lines = ["aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa", "bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb", "cccccccccccccccccccccccccccccccccccccccc", (1, 2, 3), "dddddddddddddddddddddddddddddddddddddddd"]
35 {"oneple": (1,),}
36 {"oneple": (1,)}
37 ['ls', 'lsoneple/%s' % (foo,)]
38 x = {"oneple": (1,)}
39 y = {"oneple": (1,),}
40 assert False, ("aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa wraps %s" % bar)
41
42 # looping over a 1-tuple should also not get wrapped
43 for x in (1,):
44 pass
45 for (x,) in (1,), (2,), (3,):
46 pass
47
48 [1, 2, 3,]
49
50 division_result_tuple = (6/2,)
51 print("foo %r", (foo.bar,))
52
53 if True:
54 IGNORED_TYPES_FOR_ATTRIBUTE_CHECKING = (
55 Config.IGNORED_TYPES_FOR_ATTRIBUTE_CHECKING
56 | {pylons.controllers.WSGIController}
57 )
58
59 if True:
60 ec2client.get_waiter('instance_stopped').wait(
61 InstanceIds=[instance.id],
62 WaiterConfig={
63 'Delay': 5,
64 })
65 ec2client.get_waiter("instance_stopped").wait(
66 InstanceIds=[instance.id],
67 WaiterConfig={"Delay": 5,},
68 )
69 ec2client.get_waiter("instance_stopped").wait(
70 InstanceIds=[instance.id], WaiterConfig={"Delay": 5,},
71 )
72
73 # output
74
75
76 import core, time, a
77
78 from . import A, B, C
79
80 # keeps existing trailing comma
81 from foo import (
82 bar,
83 )
84
85 # also keeps existing structure
86 from foo import (
87 baz,
88 qux,
89 )
90
91 # `as` works as well
92 from foo import (
93 xyzzy as magic,
94 )
95
96 a = {
97 1,
98 2,
99 3,
100 }
101 b = {1, 2, 3}
102 c = {
103 1,
104 2,
105 3,
106 }
107 x = (1,)
108 y = (narf(),)
109 nested = {
110 (1, 2, 3),
111 (4, 5, 6),
112 }
113 nested_no_trailing_comma = {(1, 2, 3), (4, 5, 6)}
114 nested_long_lines = [
115 "aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",
116 "bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb",
117 "cccccccccccccccccccccccccccccccccccccccc",
118 (1, 2, 3),
119 "dddddddddddddddddddddddddddddddddddddddd",
120 ]
121 {
122 "oneple": (1,),
123 }
124 {"oneple": (1,)}
125 ["ls", "lsoneple/%s" % (foo,)]
126 x = {"oneple": (1,)}
127 y = {
128 "oneple": (1,),
129 }
130 assert False, (
131 "aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa wraps %s"
132 % bar
133 )
134
135 # looping over a 1-tuple should also not get wrapped
136 for x in (1,):
137 pass
138 for (x,) in (1,), (2,), (3,):
139 pass
140
141 [
142 1,
143 2,
144 3,
145 ]
146
147 division_result_tuple = (6 / 2,)
148 print("foo %r", (foo.bar,))
149
150 if True:
151 IGNORED_TYPES_FOR_ATTRIBUTE_CHECKING = (
152 Config.IGNORED_TYPES_FOR_ATTRIBUTE_CHECKING
153 | {pylons.controllers.WSGIController}
154 )
155
156 if True:
157 ec2client.get_waiter("instance_stopped").wait(
158 InstanceIds=[instance.id],
159 WaiterConfig={
160 "Delay": 5,
161 },
162 )
163 ec2client.get_waiter("instance_stopped").wait(
164 InstanceIds=[instance.id],
165 WaiterConfig={
166 "Delay": 5,
167 },
168 )
169 ec2client.get_waiter("instance_stopped").wait(
170 InstanceIds=[instance.id],
171 WaiterConfig={
172 "Delay": 5,
173 },
174 )