]> git.madduck.net Git - etc/vim.git/blob - tests/data/simple_cases/empty_lines.py

madduck's git repository

Every one of the projects in this repository is available at the canonical URL git://git.madduck.net/madduck/pub/<projectpath> — see each project's metadata for the exact URL.

All patches and comments are welcome. Please squash your changes to logical commits before using git-format-patch and git-send-email to patches@git.madduck.net. If you'd read over the Git project's submission guidelines and adhered to them, I'd be especially grateful.

SSH access, as well as push access can be individually arranged.

If you use my repositories frequently, consider adding the following snippet to ~/.gitconfig and using the third clone URL listed for each project:

[url "git://git.madduck.net/madduck/"]
  insteadOf = madduck:

Bump peter-evans/create-or-update-comment from 3.0.1 to 3.0.2 (#3730)
[etc/vim.git] / tests / data / simple_cases / empty_lines.py
1 """Docstring."""
2
3
4 # leading comment
5 def f():
6     NO = ''
7     SPACE = ' '
8     DOUBLESPACE = '  '
9
10     t = leaf.type
11     p = leaf.parent  # trailing comment
12     v = leaf.value
13
14     if t in ALWAYS_NO_SPACE:
15         pass
16     if t == token.COMMENT:  # another trailing comment
17         return DOUBLESPACE
18
19
20     assert p is not None, f"INTERNAL ERROR: hand-made leaf without parent: {leaf!r}"
21
22
23     prev = leaf.prev_sibling
24     if not prev:
25         prevp = preceding_leaf(p)
26         if not prevp or prevp.type in OPENING_BRACKETS:
27
28
29             return NO
30
31
32         if prevp.type == token.EQUAL:
33             if prevp.parent and prevp.parent.type in {
34                 syms.typedargslist,
35                 syms.varargslist,
36                 syms.parameters,
37                 syms.arglist,
38                 syms.argument,
39             }:
40                 return NO
41
42         elif prevp.type == token.DOUBLESTAR:
43             if prevp.parent and prevp.parent.type in {
44                 syms.typedargslist,
45                 syms.varargslist,
46                 syms.parameters,
47                 syms.arglist,
48                 syms.dictsetmaker,
49             }:
50                 return NO
51
52 ###############################################################################
53 # SECTION BECAUSE SECTIONS
54 ###############################################################################
55
56 def g():
57     NO = ''
58     SPACE = ' '
59     DOUBLESPACE = '  '
60
61     t = leaf.type
62     p = leaf.parent
63     v = leaf.value
64
65     # Comment because comments
66
67     if t in ALWAYS_NO_SPACE:
68         pass
69     if t == token.COMMENT:
70         return DOUBLESPACE
71
72     # Another comment because more comments
73     assert p is not None, f'INTERNAL ERROR: hand-made leaf without parent: {leaf!r}'
74
75     prev = leaf.prev_sibling
76     if not prev:
77         prevp = preceding_leaf(p)
78
79         if not prevp or prevp.type in OPENING_BRACKETS:
80             # Start of the line or a bracketed expression.
81             # More than one line for the comment.
82             return NO
83
84         if prevp.type == token.EQUAL:
85             if prevp.parent and prevp.parent.type in {
86                 syms.typedargslist,
87                 syms.varargslist,
88                 syms.parameters,
89                 syms.arglist,
90                 syms.argument,
91             }:
92                 return NO
93
94
95 # output
96
97
98 """Docstring."""
99
100
101 # leading comment
102 def f():
103     NO = ""
104     SPACE = " "
105     DOUBLESPACE = "  "
106
107     t = leaf.type
108     p = leaf.parent  # trailing comment
109     v = leaf.value
110
111     if t in ALWAYS_NO_SPACE:
112         pass
113     if t == token.COMMENT:  # another trailing comment
114         return DOUBLESPACE
115
116     assert p is not None, f"INTERNAL ERROR: hand-made leaf without parent: {leaf!r}"
117
118     prev = leaf.prev_sibling
119     if not prev:
120         prevp = preceding_leaf(p)
121         if not prevp or prevp.type in OPENING_BRACKETS:
122             return NO
123
124         if prevp.type == token.EQUAL:
125             if prevp.parent and prevp.parent.type in {
126                 syms.typedargslist,
127                 syms.varargslist,
128                 syms.parameters,
129                 syms.arglist,
130                 syms.argument,
131             }:
132                 return NO
133
134         elif prevp.type == token.DOUBLESTAR:
135             if prevp.parent and prevp.parent.type in {
136                 syms.typedargslist,
137                 syms.varargslist,
138                 syms.parameters,
139                 syms.arglist,
140                 syms.dictsetmaker,
141             }:
142                 return NO
143
144
145 ###############################################################################
146 # SECTION BECAUSE SECTIONS
147 ###############################################################################
148
149
150 def g():
151     NO = ""
152     SPACE = " "
153     DOUBLESPACE = "  "
154
155     t = leaf.type
156     p = leaf.parent
157     v = leaf.value
158
159     # Comment because comments
160
161     if t in ALWAYS_NO_SPACE:
162         pass
163     if t == token.COMMENT:
164         return DOUBLESPACE
165
166     # Another comment because more comments
167     assert p is not None, f"INTERNAL ERROR: hand-made leaf without parent: {leaf!r}"
168
169     prev = leaf.prev_sibling
170     if not prev:
171         prevp = preceding_leaf(p)
172
173         if not prevp or prevp.type in OPENING_BRACKETS:
174             # Start of the line or a bracketed expression.
175             # More than one line for the comment.
176             return NO
177
178         if prevp.type == token.EQUAL:
179             if prevp.parent and prevp.parent.type in {
180                 syms.typedargslist,
181                 syms.varargslist,
182                 syms.parameters,
183                 syms.arglist,
184                 syms.argument,
185             }:
186                 return NO