]> 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:

Remove u prefix if unicode_literals is present (#199)
[etc/vim.git] / tests / comments2.py
1 # Please keep __all__ alphabetized within each category.
2
3 __all__ = [
4     # Super-special typing primitives.
5     'Any',
6     'Callable',
7     'ClassVar',
8
9     # ABCs (from collections.abc).
10     'AbstractSet',  # collections.abc.Set.
11     'ByteString',
12     'Container',
13
14     # Concrete collection types.
15     'Counter',
16     'Deque',
17     'Dict',
18     'DefaultDict',
19     'List',
20     'Set',
21     'FrozenSet',
22     'NamedTuple',  # Not really a type.
23     'Generator',
24 ]
25
26 if 'PYTHON' in os.environ:
27     add_compiler(compiler_from_env())
28 else:
29     # for compiler in compilers.values():
30          # add_compiler(compiler)
31     add_compiler(compilers[(7.0, 32)])
32     # add_compiler(compilers[(7.1, 64)])
33
34 # Comment before function.
35 def inline_comments_in_brackets_ruin_everything():
36     if typedargslist:
37         parameters.children = [
38             parameters.children[0],  # (1
39             body,
40             parameters.children[-1],  # )1
41         ]
42     else:
43         parameters.children = [
44             parameters.children[0],  # (2 what if this was actually long
45             body,
46             parameters.children[-1],  # )2
47         ]
48     if (self._proc is not None
49             # has the child process finished?
50             and self._returncode is None
51             # the child process has finished, but the
52             # transport hasn't been notified yet?
53             and self._proc.poll() is None):
54         pass
55     # no newline before or after
56     short = [
57      # one
58      1,
59      # two
60      2]
61
62     # no newline after
63     call(arg1, arg2, """
64 short
65 """, arg3=True)
66
67     ############################################################################
68
69     call2(
70     #short
71     arg1,
72     #but
73     arg2,
74     #multiline
75     """
76 short
77 """,
78     # yup
79     arg3=True)
80     lcomp = [
81         element  # yup
82         for element in collection  # yup
83         if element is not None  # right
84     ]
85     lcomp2 = [
86         # hello
87         element
88         # yup
89         for element in collection
90         # right
91         if element is not None
92     ]
93     lcomp3 = [
94         # This one is actually too long to fit in a single line.
95         element.split('\n', 1)[0]
96         # yup
97         for element in collection.select_elements()
98         # right
99         if element is not None
100     ]
101     while True:
102         if False:
103             continue
104
105             # and round and round we go
106         # and round and round we go
107
108    # let's return
109     return Node(
110         syms.simple_stmt,
111         [
112             Node(statement, result),
113             Leaf(token.NEWLINE, '\n'),  # FIXME: \r\n?
114         ],
115     )
116
117
118 #######################
119 ### SECTION COMMENT ###
120 #######################
121
122
123 instruction()
124
125 # END COMMENTS
126 # MORE END COMMENTS
127
128
129 # output
130
131
132 # Please keep __all__ alphabetized within each category.
133
134 __all__ = [
135     # Super-special typing primitives.
136     "Any",
137     "Callable",
138     "ClassVar",
139     # ABCs (from collections.abc).
140     "AbstractSet",  # collections.abc.Set.
141     "ByteString",
142     "Container",
143     # Concrete collection types.
144     "Counter",
145     "Deque",
146     "Dict",
147     "DefaultDict",
148     "List",
149     "Set",
150     "FrozenSet",
151     "NamedTuple",  # Not really a type.
152     "Generator",
153 ]
154
155 if "PYTHON" in os.environ:
156     add_compiler(compiler_from_env())
157 else:
158     # for compiler in compilers.values():
159     # add_compiler(compiler)
160     add_compiler(compilers[(7.0, 32)])
161     # add_compiler(compilers[(7.1, 64)])
162
163 # Comment before function.
164 def inline_comments_in_brackets_ruin_everything():
165     if typedargslist:
166         parameters.children = [
167             parameters.children[0], body, parameters.children[-1]  # (1  # )1
168         ]
169     else:
170         parameters.children = [
171             parameters.children[0],  # (2 what if this was actually long
172             body,
173             parameters.children[-1],  # )2
174         ]
175     if (
176         self._proc is not None
177         # has the child process finished?
178         and self._returncode is None
179         # the child process has finished, but the
180         # transport hasn't been notified yet?
181         and self._proc.poll() is None
182     ):
183         pass
184     # no newline before or after
185     short = [
186         # one
187         1,
188         # two
189         2,
190     ]
191
192     # no newline after
193     call(
194         arg1,
195         arg2,
196         """
197 short
198 """,
199         arg3=True,
200     )
201
202     ############################################################################
203
204     call2(
205         # short
206         arg1,
207         # but
208         arg2,
209         # multiline
210         """
211 short
212 """,
213         # yup
214         arg3=True,
215     )
216     lcomp = [
217         element for element in collection if element is not None  # yup  # yup  # right
218     ]
219     lcomp2 = [
220         # hello
221         element
222         # yup
223         for element in collection
224         # right
225         if element is not None
226     ]
227     lcomp3 = [
228         # This one is actually too long to fit in a single line.
229         element.split("\n", 1)[0]
230         # yup
231         for element in collection.select_elements()
232         # right
233         if element is not None
234     ]
235     while True:
236         if False:
237             continue
238
239             # and round and round we go
240         # and round and round we go
241
242     # let's return
243     return Node(
244         syms.simple_stmt,
245         [Node(statement, result), Leaf(token.NEWLINE, "\n")],  # FIXME: \r\n?
246     )
247
248
249 #######################
250 ### SECTION COMMENT ###
251 #######################
252
253
254 instruction()
255
256 # END COMMENTS
257 # MORE END COMMENTS