]> git.madduck.net Git - etc/vim.git/blob - tests/expression.diff

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:

Open temporary files with utf-8 encoding (#126)
[etc/vim.git] / tests / expression.diff
1 --- <stdin>  (original)
2 +++ <stdin>  (formatted)
3 @@ -1,8 +1,8 @@
4  ...
5 -'some_string'
6 -b'\\xa3'
7 +"some_string"
8 +b"\\xa3"
9  Name
10  None
11  True
12  False
13  1
14 @@ -29,65 +29,74 @@
15  ~great
16  +value
17  -1
18  ~int and not v1 ^ 123 + v2 | True
19  (~int) and (not ((v1 ^ (123 + v2)) | True))
20 -flags & ~ select.EPOLLIN and waiters.write_task is not None
21 +flags & ~select.EPOLLIN and waiters.write_task is not None
22  lambda arg: None
23  lambda a=True: a
24  lambda a, b, c=True: a
25 -lambda a, b, c=True, *, d=(1 << v2), e='str': a
26 -lambda a, b, c=True, *vararg, d=(v1 << 2), e='str', **kwargs: a + b
27 +lambda a, b, c=True, *, d=(1 << v2), e="str": a
28 +lambda a, b, c=True, *vararg, d=(v1 << 2), e="str", **kwargs: a + b
29  1 if True else 2
30  str or None if True else str or bytes or None
31  (str or None) if True else (str or bytes or None)
32  str or None if (1 if True else 2) else str or bytes or None
33  (str or None) if (1 if True else 2) else (str or bytes or None)
34 -{'2.7': dead, '3.7': (long_live or die_hard)}
35 -{'2.7': dead, '3.7': (long_live or die_hard), **{'3.6': verygood}}
36 +{"2.7": dead, "3.7": (long_live or die_hard)}
37 +{"2.7": dead, "3.7": (long_live or die_hard), **{"3.6": verygood}}
38  {**a, **b, **c}
39 -{'2.7', '3.6', '3.7', '3.8', '3.9', ('4.0' if gilectomy else '3.10')}
40 -({'a': 'b'}, (True or False), (+value), 'string', b'bytes') or None
41 +{"2.7", "3.6", "3.7", "3.8", "3.9", ("4.0" if gilectomy else "3.10")}
42 +({"a": "b"}, (True or False), (+value), "string", b"bytes") or None
43  ()
44  (1,)
45  (1, 2)
46  (1, 2, 3)
47  []
48  [1, 2, 3, 4, 5, 6, 7, 8, 9, (10 or A), (11 or B), (12 or C)]
49 -[1, 2, 3,]
50 +[1, 2, 3]
51  {i for i in (1, 2, 3)}
52  {(i ** 2) for i in (1, 2, 3)}
53 -{(i ** 2) for i, _ in ((1, 'a'), (2, 'b'), (3, 'c'))}
54 +{(i ** 2) for i, _ in ((1, "a"), (2, "b"), (3, "c"))}
55  {((i ** 2) + j) for i in (1, 2, 3) for j in (1, 2, 3)}
56  [i for i in (1, 2, 3)]
57  [(i ** 2) for i in (1, 2, 3)]
58 -[(i ** 2) for i, _ in ((1, 'a'), (2, 'b'), (3, 'c'))]
59 +[(i ** 2) for i, _ in ((1, "a"), (2, "b"), (3, "c"))]
60  [((i ** 2) + j) for i in (1, 2, 3) for j in (1, 2, 3)]
61  {i: 0 for i in (1, 2, 3)}
62 -{i: j for i, j in ((1, 'a'), (2, 'b'), (3, 'c'))}
63 +{i: j for i, j in ((1, "a"), (2, "b"), (3, "c"))}
64  {a: b * 2 for a, b in dictionary.items()}
65  {a: b * -2 for a, b in dictionary.items()}
66 -{k: v for k, v in this_is_a_very_long_variable_which_will_cause_a_trailing_comma_which_breaks_the_comprehension}
67 +{
68 +    k: v
69 +    for k, v in this_is_a_very_long_variable_which_will_cause_a_trailing_comma_which_breaks_the_comprehension
70 +}
71  Python3 > Python2 > COBOL
72  Life is Life
73  call()
74  call(arg)
75 -call(kwarg='hey')
76 -call(arg, kwarg='hey')
77 -call(arg, another, kwarg='hey', **kwargs)
78 -call(this_is_a_very_long_variable_which_will_force_a_delimiter_split, arg, another, kwarg='hey', **kwargs)  # note: no trailing comma pre-3.6
79 +call(kwarg="hey")
80 +call(arg, kwarg="hey")
81 +call(arg, another, kwarg="hey", **kwargs)
82 +call(
83 +    this_is_a_very_long_variable_which_will_force_a_delimiter_split,
84 +    arg,
85 +    another,
86 +    kwarg="hey",
87 +    **kwargs
88 +)  # note: no trailing comma pre-3.6
89  call(*gidgets[:2])
90  call(**self.screen_kwargs)
91  lukasz.langa.pl
92  call.me(maybe)
93  1 .real
94  1.0 .real
95  ....__class__
96  list[str]
97  dict[str, int]
98  tuple[str, ...]
99 -tuple[str, int, float, dict[str, int],]
100 +tuple[str, int, float, dict[str, int]]
101  very_long_variable_name_filters: t.List[
102      t.Tuple[str, t.Union[str, t.List[t.Optional[str]]]],
103  ]
104  slice[0]
105  slice[0:1]
106 @@ -114,79 +123,113 @@
107  numpy[-(c + 1):, d]
108  numpy[:, l[-2]]
109  numpy[:, ::-1]
110  numpy[np.newaxis, :]
111  (str or None) if (sys.version_info[0] > (3,)) else (str or bytes or None)
112 -{'2.7': dead, '3.7': long_live or die_hard}
113 -{'2.7', '3.6', '3.7', '3.8', '3.9', '4.0' if gilectomy else '3.10'}
114 +{"2.7": dead, "3.7": long_live or die_hard}
115 +{"2.7", "3.6", "3.7", "3.8", "3.9", "4.0" if gilectomy else "3.10"}
116  [1, 2, 3, 4, 5, 6, 7, 8, 9, 10 or A, 11 or B, 12 or C]
117  (SomeName)
118  SomeName
119  (Good, Bad, Ugly)
120  (i for i in (1, 2, 3))
121  ((i ** 2) for i in (1, 2, 3))
122 -((i ** 2) for i, _ in ((1, 'a'), (2, 'b'), (3, 'c')))
123 +((i ** 2) for i, _ in ((1, "a"), (2, "b"), (3, "c")))
124  (((i ** 2) + j) for i in (1, 2, 3) for j in (1, 2, 3))
125  (*starred)
126 -{"id": "1","type": "type","started_at": now(),"ended_at": now() + timedelta(days=10),"priority": 1,"import_session_id": 1,**kwargs}  # no trailing comma, this file is not 3.6+
127 +{
128 +    "id": "1",
129 +    "type": "type",
130 +    "started_at": now(),
131 +    "ended_at": now() + timedelta(days=10),
132 +    "priority": 1,
133 +    "import_session_id": 1,
134 +    **kwargs
135 +}  # no trailing comma, this file is not 3.6+
136  a = (1,)
137  b = 1,
138  c = 1
139  d = (1,) + a + (2,)
140  e = (1,).count(1)
141 -what_is_up_with_those_new_coord_names = (coord_names + set(vars_to_create)) + set(vars_to_remove)
142 -what_is_up_with_those_new_coord_names = (coord_names | set(vars_to_create)) - set(vars_to_remove)
143 -result = session.query(models.Customer.id).filter(models.Customer.account_id == account_id, models.Customer.email == email_address).order_by(models.Customer.id.asc(),).all()
144 +what_is_up_with_those_new_coord_names = (coord_names + set(vars_to_create)) + set(
145 +    vars_to_remove
146 +)
147 +what_is_up_with_those_new_coord_names = (coord_names | set(vars_to_create)) - set(
148 +    vars_to_remove
149 +)
150 +result = session.query(models.Customer.id).filter(
151 +    models.Customer.account_id == account_id, models.Customer.email == email_address
152 +).order_by(
153 +    models.Customer.id.asc()
154 +).all()
155  Ø = set()
156  authors.łukasz.say_thanks()
157  
158 +
159  def gen():
160      yield from outside_of_generator
161 +
162      a = (yield)
163 +
164  
165  async def f():
166      await some.complicated[0].call(with_args=(True or (1 is not 1)))
167 -for x, in (1,), (2,), (3,): ...
168 -for y in (): ...
169 -for z in (i for i in (1, 2, 3)): ...
170 -for i in (call()): ...
171 -for j in (1 + (2 + 3)): ...
172 -while(this and that): ...
173 -if (
174 -    threading.current_thread() != threading.main_thread() and
175 -    threading.current_thread() != threading.main_thread() or
176 -    signal.getsignal(signal.SIGINT) != signal.default_int_handler
177 -):
178 -    return True
179 -if (
180 -    aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa |
181 -    aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
182 -):
183 -    return True
184 -if (
185 -    aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa &
186 -    aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
187 -):
188 -    return True
189 -if (
190 -    aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa +
191 -    aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
192 -):
193 -    return True
194 -if (
195 -    aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa -
196 -    aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
197 -):
198 -    return True
199 -if (
200 -    aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa *
201 -    aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
202 -):
203 -    return True
204 -if (
205 -    aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa /
206 -    aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
207 -):
208 -    return True
209 +
210 +
211 +for (x,) in (1,), (2,), (3,):
212 +    ...
213 +for y in ():
214 +    ...
215 +for z in (i for i in (1, 2, 3)):
216 +    ...
217 +for i in call():
218 +    ...
219 +for j in 1 + (2 + 3):
220 +    ...
221 +while this and that:
222 +    ...
223 +if (
224 +    threading.current_thread() != threading.main_thread()
225 +    and threading.current_thread() != threading.main_thread()
226 +    or signal.getsignal(signal.SIGINT) != signal.default_int_handler
227 +):
228 +    return True
229 +
230 +if (
231 +    aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
232 +    | aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
233 +):
234 +    return True
235 +
236 +if (
237 +    aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
238 +    & aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
239 +):
240 +    return True
241 +
242 +if (
243 +    aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
244 +    + aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
245 +):
246 +    return True
247 +
248 +if (
249 +    aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
250 +    - aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
251 +):
252 +    return True
253 +
254 +if (
255 +    aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
256 +    * aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
257 +):
258 +    return True
259 +
260 +if (
261 +    aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
262 +    / aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
263 +):
264 +    return True
265 +
266  last_call()
267  # standalone comment at ENDMARKER