Skip to content

Commit db109c8

Browse files
author
Igor Drokin
committed
feat(up008): update snapshots
1 parent e3040dd commit db109c8

File tree

2 files changed

+412
-37
lines changed

2 files changed

+412
-37
lines changed

crates/ruff_linter/src/rules/pyupgrade/snapshots/ruff_linter__rules__pyupgrade__tests__UP008.py.snap

Lines changed: 211 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -146,25 +146,6 @@ help: Remove `super()` parameters
146146
95 | # see: https://github.com/astral-sh/ruff/issues/18684
147147
note: This is an unsafe fix and may change runtime behavior
148148

149-
UP008 [*] Use `super()` instead of `super(__class__, self)`
150-
--> UP008.py:107:23
151-
|
152-
105 | class C:
153-
106 | def f(self):
154-
107 | builtins.super(C, self)
155-
| ^^^^^^^^^
156-
|
157-
help: Remove `super()` parameters
158-
104 |
159-
105 | class C:
160-
106 | def f(self):
161-
- builtins.super(C, self)
162-
107 + builtins.super()
163-
108 |
164-
109 |
165-
110 | # see: https://github.com/astral-sh/ruff/issues/18533
166-
note: This is an unsafe fix and may change runtime behavior
167-
168149
UP008 [*] Use `super()` instead of `super(__class__, self)`
169150
--> UP008.py:113:14
170151
|
@@ -294,11 +275,222 @@ UP008 [*] Use `super()` instead of `super(__class__, self)`
294275
142 | def method3(self):
295276
143 | super(ExampleWithKeywords, self).some_method() # Should be fixed - no keywords
296277
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^
278+
144 |
279+
145 | # See: https://github.com/astral-sh/ruff/issues/19357
297280
|
298281
help: Remove `super()` parameters
299282
140 | super(ExampleWithKeywords, self, **{"kwarg": "value"}).some_method() # Should emit diagnostic but NOT be fixed
300283
141 |
301284
142 | def method3(self):
302285
- super(ExampleWithKeywords, self).some_method() # Should be fixed - no keywords
303286
143 + super().some_method() # Should be fixed - no keywords
287+
144 |
288+
145 | # See: https://github.com/astral-sh/ruff/issues/19357
289+
146 | # Must be detected
290+
note: This is an unsafe fix and may change runtime behavior
291+
292+
UP008 [*] Use `super()` instead of `super(__class__, self)`
293+
--> UP008.py:154:23
294+
|
295+
152 | def f(self):
296+
153 | if False: __class__ # Python injects __class__ into scope
297+
154 | builtins.super(ChildD1, self).f()
298+
| ^^^^^^^^^^^^^^^
299+
155 |
300+
156 | class ChildD2(ParentD):
301+
|
302+
help: Remove `super()` parameters
303+
151 | class ChildD1(ParentD):
304+
152 | def f(self):
305+
153 | if False: __class__ # Python injects __class__ into scope
306+
- builtins.super(ChildD1, self).f()
307+
154 + builtins.super().f()
308+
155 |
309+
156 | class ChildD2(ParentD):
310+
157 | def f(self):
311+
note: This is an unsafe fix and may change runtime behavior
312+
313+
UP008 [*] Use `super()` instead of `super(__class__, self)`
314+
--> UP008.py:159:23
315+
|
316+
157 | def f(self):
317+
158 | if False: super # Python injects __class__ into scope
318+
159 | builtins.super(ChildD2, self).f()
319+
| ^^^^^^^^^^^^^^^
320+
160 |
321+
161 | class ChildD3(ParentD):
322+
|
323+
help: Remove `super()` parameters
324+
156 | class ChildD2(ParentD):
325+
157 | def f(self):
326+
158 | if False: super # Python injects __class__ into scope
327+
- builtins.super(ChildD2, self).f()
328+
159 + builtins.super().f()
329+
160 |
330+
161 | class ChildD3(ParentD):
331+
162 | def f(self):
332+
note: This is an unsafe fix and may change runtime behavior
333+
334+
UP008 [*] Use `super()` instead of `super(__class__, self)`
335+
--> UP008.py:163:23
336+
|
337+
161 | class ChildD3(ParentD):
338+
162 | def f(self):
339+
163 | builtins.super(ChildD3, self).f()
340+
| ^^^^^^^^^^^^^^^
341+
164 | super # Python injects __class__ into scope
342+
|
343+
help: Remove `super()` parameters
344+
160 |
345+
161 | class ChildD3(ParentD):
346+
162 | def f(self):
347+
- builtins.super(ChildD3, self).f()
348+
163 + builtins.super().f()
349+
164 | super # Python injects __class__ into scope
350+
165 |
351+
166 | import builtins as builtins_alias
352+
note: This is an unsafe fix and may change runtime behavior
353+
354+
UP008 [*] Use `super()` instead of `super(__class__, self)`
355+
--> UP008.py:169:29
356+
|
357+
167 | class ChildD4(ParentD):
358+
168 | def f(self):
359+
169 | builtins_alias.super(ChildD4, self).f()
360+
| ^^^^^^^^^^^^^^^
361+
170 | super # Python injects __class__ into scope
362+
|
363+
help: Remove `super()` parameters
364+
166 | import builtins as builtins_alias
365+
167 | class ChildD4(ParentD):
366+
168 | def f(self):
367+
- builtins_alias.super(ChildD4, self).f()
368+
169 + builtins_alias.super().f()
369+
170 | super # Python injects __class__ into scope
370+
171 |
371+
172 | class ChildD5(ParentD):
372+
note: This is an unsafe fix and may change runtime behavior
373+
374+
UP008 [*] Use `super()` instead of `super(__class__, self)`
375+
--> UP008.py:176:23
376+
|
377+
174 | super = 1
378+
175 | super # Python injects __class__ into scope
379+
176 | builtins.super(ChildD5, self).f()
380+
| ^^^^^^^^^^^^^^^
381+
177 |
382+
178 | class ChildD6(ParentD):
383+
|
384+
help: Remove `super()` parameters
385+
173 | def f(self):
386+
174 | super = 1
387+
175 | super # Python injects __class__ into scope
388+
- builtins.super(ChildD5, self).f()
389+
176 + builtins.super().f()
390+
177 |
391+
178 | class ChildD6(ParentD):
392+
179 | def f(self):
393+
note: This is an unsafe fix and may change runtime behavior
394+
395+
UP008 [*] Use `super()` instead of `super(__class__, self)`
396+
--> UP008.py:182:23
397+
|
398+
180 | super: "Any"
399+
181 | __class__ # Python injects __class__ into scope
400+
182 | builtins.super(ChildD6, self).f()
401+
| ^^^^^^^^^^^^^^^
402+
183 |
403+
184 | class ChildD7(ParentD):
404+
|
405+
help: Remove `super()` parameters
406+
179 | def f(self):
407+
180 | super: "Any"
408+
181 | __class__ # Python injects __class__ into scope
409+
- builtins.super(ChildD6, self).f()
410+
182 + builtins.super().f()
411+
183 |
412+
184 | class ChildD7(ParentD):
413+
185 | def f(self):
414+
note: This is an unsafe fix and may change runtime behavior
415+
416+
UP008 [*] Use `super()` instead of `super(__class__, self)`
417+
--> UP008.py:188:23
418+
|
419+
186 | def x():
420+
187 | __class__ # Python injects __class__ into scope
421+
188 | builtins.super(ChildD7, self).f()
422+
| ^^^^^^^^^^^^^^^
423+
189 |
424+
190 | class ChildD8(ParentD):
425+
|
426+
help: Remove `super()` parameters
427+
185 | def f(self):
428+
186 | def x():
429+
187 | __class__ # Python injects __class__ into scope
430+
- builtins.super(ChildD7, self).f()
431+
188 + builtins.super().f()
432+
189 |
433+
190 | class ChildD8(ParentD):
434+
191 | def f(self):
435+
note: This is an unsafe fix and may change runtime behavior
436+
437+
UP008 [*] Use `super()` instead of `super(__class__, self)`
438+
--> UP008.py:195:23
439+
|
440+
193 | super = 1
441+
194 | super # Python injects __class__ into scope
442+
195 | builtins.super(ChildD8, self).f()
443+
| ^^^^^^^^^^^^^^^
444+
196 |
445+
197 | class ChildD9(ParentD):
446+
|
447+
help: Remove `super()` parameters
448+
192 | def x():
449+
193 | super = 1
450+
194 | super # Python injects __class__ into scope
451+
- builtins.super(ChildD8, self).f()
452+
195 + builtins.super().f()
453+
196 |
454+
197 | class ChildD9(ParentD):
455+
198 | def f(self):
456+
note: This is an unsafe fix and may change runtime behavior
457+
458+
UP008 [*] Use `super()` instead of `super(__class__, self)`
459+
--> UP008.py:202:23
460+
|
461+
200 | __class__ = 1
462+
201 | __class__ # Python injects __class__ into scope
463+
202 | builtins.super(ChildD9, self).f()
464+
| ^^^^^^^^^^^^^^^
465+
203 |
466+
204 | class ChildD10(ParentD):
467+
|
468+
help: Remove `super()` parameters
469+
199 | def x():
470+
200 | __class__ = 1
471+
201 | __class__ # Python injects __class__ into scope
472+
- builtins.super(ChildD9, self).f()
473+
202 + builtins.super().f()
474+
203 |
475+
204 | class ChildD10(ParentD):
476+
205 | def f(self):
477+
note: This is an unsafe fix and may change runtime behavior
478+
479+
UP008 [*] Use `super()` instead of `super(__class__, self)`
480+
--> UP008.py:209:23
481+
|
482+
207 | __class__ = 1
483+
208 | super # Python injects __class__ into scope
484+
209 | builtins.super(ChildD10, self).f()
485+
| ^^^^^^^^^^^^^^^^
486+
|
487+
help: Remove `super()` parameters
488+
206 | def x():
489+
207 | __class__ = 1
490+
208 | super # Python injects __class__ into scope
491+
- builtins.super(ChildD10, self).f()
492+
209 + builtins.super().f()
493+
210 |
494+
211 |
495+
212 | # Must be ignored
304496
note: This is an unsafe fix and may change runtime behavior

0 commit comments

Comments
 (0)