]> git.madduck.net Git - etc/vim.git/blob - tests/comments2.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:

Don't remove single empty lines outside of bracketed expressions
[etc/vim.git] / tests / comments2.py
1 # Please keep __all__ alphabetized within each category.
2 __all__ = [
3     # Super-special typing primitives.
4     'Any',
5     'Callable',
6     'ClassVar',
7
8     # ABCs (from collections.abc).
9     'AbstractSet',  # collections.abc.Set.
10     'ByteString',
11     'Container',
12
13     # Concrete collection types.
14     'Counter',
15     'Deque',
16     'Dict',
17     'DefaultDict',
18     'List',
19     'Set',
20     'FrozenSet',
21     'NamedTuple',  # Not really a type.
22     'Generator',
23 ]
24
25 def inline_comments_in_brackets_ruin_everything():
26     if typedargslist:
27         parameters.children = [
28             parameters.children[0],  # (1
29             body,
30             parameters.children[-1],  # )1
31         ]
32     else:
33         parameters.children = [
34             parameters.children[0],  # (2 what if this was actually long
35             body,
36             parameters.children[-1],  # )2
37         ]
38     if (self._proc is not None
39             # has the child process finished?
40             and self._returncode is None
41             # the child process has finished, but the
42             # transport hasn't been notified yet?
43             and self._proc.poll() is None):
44         pass
45     short = [
46      # one
47      1,
48      # two
49      2]
50     call(arg1, arg2, """
51 short
52 """, arg3=True)
53
54     ############################################################################
55
56     call2(
57     #short
58     arg1,
59     #but
60     arg2,
61     #multiline
62     """
63 short
64 """,
65     # yup
66     arg3=True)
67     lcomp = [
68         element  # yup
69         for element in collection  # yup
70         if element is not None  # right
71     ]
72     lcomp2 = [
73         # hello
74         element
75         # yup
76         for element in collection
77         # right
78         if element is not None
79     ]
80     lcomp3 = [
81         # This one is actually too long to fit in a single line.
82         element.split('\n', 1)[0]
83         # yup
84         for element in collection.select_elements()
85         # right
86         if element is not None
87     ]
88     return Node(
89         syms.simple_stmt,
90         [
91             Node(statement, result),
92             Leaf(token.NEWLINE, '\n'),  # FIXME: \r\n?
93         ],
94     )
95
96 instruction()
97
98 # END COMMENTS
99 # MORE END COMMENTS
100
101
102 # output
103
104
105 # Please keep __all__ alphabetized within each category.
106 __all__ = [
107     # Super-special typing primitives.
108     'Any',
109     'Callable',
110     'ClassVar',
111     # ABCs (from collections.abc).
112     'AbstractSet',  # collections.abc.Set.
113     'ByteString',
114     'Container',
115     # Concrete collection types.
116     'Counter',
117     'Deque',
118     'Dict',
119     'DefaultDict',
120     'List',
121     'Set',
122     'FrozenSet',
123     'NamedTuple',  # Not really a type.
124     'Generator',
125 ]
126
127
128 def inline_comments_in_brackets_ruin_everything():
129     if typedargslist:
130         parameters.children = [
131             parameters.children[0], body, parameters.children[-1]  # (1  # )1
132         ]
133     else:
134         parameters.children = [
135             parameters.children[0],  # (2 what if this was actually long
136             body,
137             parameters.children[-1],  # )2
138         ]
139     if (
140         self._proc is not None
141         # has the child process finished?
142         and self._returncode is None
143         # the child process has finished, but the
144         # transport hasn't been notified yet?
145         and self._proc.poll() is None
146     ):
147         pass
148     short = [
149         # one
150         1,
151         # two
152         2,
153     ]
154     call(
155         arg1,
156         arg2,
157         """
158 short
159 """,
160         arg3=True,
161     )
162
163     ############################################################################
164     call2(
165         # short
166         arg1,
167         # but
168         arg2,
169         # multiline
170         """
171 short
172 """,
173         # yup
174         arg3=True,
175     )
176     lcomp = [
177         element for element in collection if element is not None  # yup  # yup  # right
178     ]
179     lcomp2 = [
180         # hello
181         element
182         # yup
183         for element in collection
184         # right
185         if element is not None
186     ]
187     lcomp3 = [
188         # This one is actually too long to fit in a single line.
189         element.split('\n', 1)[0]
190         # yup
191         for element in collection.select_elements()
192         # right
193         if element is not None
194     ]
195     return Node(
196         syms.simple_stmt,
197         [Node(statement, result), Leaf(token.NEWLINE, '\n')],  # FIXME: \r\n?
198     )
199
200
201 instruction()
202 # END COMMENTS
203 # MORE END COMMENTS