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

Describe fix for #21 in README
[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     call2(
164         # short
165         arg1,
166         # but
167         arg2,
168         # multiline
169         """
170 short
171 """,
172         # yup
173         arg3=True,
174     )
175     lcomp = [
176         element for element in collection if element is not None  # yup  # yup  # right
177     ]
178     lcomp2 = [
179         # hello
180         element
181         # yup
182         for element in collection
183         # right
184         if element is not None
185     ]
186     lcomp3 = [
187         # This one is actually too long to fit in a single line.
188         element.split('\n', 1)[0]
189         # yup
190         for element in collection.select_elements()
191         # right
192         if element is not None
193     ]
194     return Node(
195         syms.simple_stmt,
196         [Node(statement, result), Leaf(token.NEWLINE, '\n')],  # FIXME: \r\n?
197     )
198
199
200 instruction()
201 # END COMMENTS
202 # MORE END COMMENTS