gvsig-scripting / org.gvsig.scripting / trunk / org.gvsig.scripting / org.gvsig.scripting.app / org.gvsig.scripting.app.mainplugin / src / main / resources-plugin / scripting / lib / pylint / test / input / func_bad_cont_dictcomp_py27.py @ 745
History | View | Annotate | Download (1003 Bytes)
1 |
"""Bad continuations in dictionary comprehensions."""
|
---|---|
2 |
|
3 |
__revision__ = 0
|
4 |
|
5 |
# Dictionary comprehensions should not require extra indentation when breaking
|
6 |
# before the 'for', which is not part of the value
|
7 |
C1 = {'key{}'.format(x): 'value{}'.format(x) |
8 |
for x in range(3)} |
9 |
|
10 |
C2 = {'key{}'.format(x): 'value{}'.format(x) for x in |
11 |
range(3)} |
12 |
|
13 |
# Dictionary comprehensions with multiple loops broken in different places
|
14 |
C3 = {x*y: (x, y) for x in range(3) for y in range(3)} |
15 |
|
16 |
C4 = {x*y: (x, y) |
17 |
for x in range(3) for y in range(3)} |
18 |
|
19 |
C5 = {x*y: (x, y) for x
|
20 |
in range(3) for y in range(3)} |
21 |
|
22 |
C6 = {x*y: (x, y) for x in range(3) |
23 |
for y in range(3)} |
24 |
|
25 |
C7 = {key: |
26 |
key ** 2
|
27 |
for key in range(10)} |
28 |
|
29 |
C8 = { |
30 |
key: key ** 2
|
31 |
for key in range(10)} |
32 |
|
33 |
# Misaligned cases for dict comprehensions
|
34 |
C9 = {'key{}'.format(x): 'value{}'.format(x) |
35 |
for x in range(3)} # [bad-continuation] |
36 |
|
37 |
C9 = {'key{}'.format(x): 'value{}'.format(x) |
38 |
for x in range(3)} # [bad-continuation] |