Fix merge (changed reporting format)

This commit is contained in:
Robsdedude 2025-10-11 10:44:31 +02:00
parent 80ce1efbe0
commit 18e90f8b50
2 changed files with 304 additions and 296 deletions

View File

@ -1,427 +1,434 @@
--- ---
source: crates/ruff_linter/src/rules/flake8_pyi/mod.rs source: crates/ruff_linter/src/rules/flake8_pyi/mod.rs
--- ---
PYI041_3.py:23:15: PYI041 [*] Use `float` instead of `int | float` PYI041 [*] Use `float` instead of `int | float`
--> PYI041_3.py:23:15
| |
23 | def f0(arg1: "float | int") -> "None": 23 | def f0(arg1: "float | int") -> "None":
| ^^^^^^^^^^^ PYI041 | ^^^^^^^^^^^
24 | ... 24 | ...
| |
= help: Remove redundant type help: Remove redundant type
20 | ...
21 |
22 |
- def f0(arg1: "float | int") -> "None":
23 + def f0(arg1: "float") -> "None":
24 | ...
25 |
26 |
note: This is an unsafe fix and may change runtime behavior
Unsafe fix PYI041 [*] Use `complex` instead of `float | complex`
20 20 | ... --> PYI041_3.py:27:33
21 21 |
22 22 |
23 |-def f0(arg1: "float | int") -> "None":
23 |+def f0(arg1: "float") -> "None":
24 24 | ...
25 25 |
26 26 |
PYI041_3.py:27:33: PYI041 [*] Use `complex` instead of `float | complex`
| |
27 | def f1(arg1: "float", *, arg2: "float | list[str] | type[bool] | complex") -> "None": 27 | def f1(arg1: "float", *, arg2: "float | list[str] | type[bool] | complex") -> "None":
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ PYI041 | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
28 | ... 28 | ...
| |
= help: Remove redundant type help: Remove redundant type
24 | ...
25 |
26 |
- def f1(arg1: "float", *, arg2: "float | list[str] | type[bool] | complex") -> "None":
27 + def f1(arg1: "float", *, arg2: "list[str] | type[bool] | complex") -> "None":
28 | ...
29 |
30 |
note: This is an unsafe fix and may change runtime behavior
Unsafe fix PYI041 [*] Use `float` instead of `int | float`
24 24 | ... --> PYI041_3.py:31:31
25 25 |
26 26 |
27 |-def f1(arg1: "float", *, arg2: "float | list[str] | type[bool] | complex") -> "None":
27 |+def f1(arg1: "float", *, arg2: "list[str] | type[bool] | complex") -> "None":
28 28 | ...
29 29 |
30 30 |
PYI041_3.py:31:31: PYI041 [*] Use `float` instead of `int | float`
| |
31 | def f2(arg1: "int", /, arg2: "int | int | float") -> "None": 31 | def f2(arg1: "int", /, arg2: "int | int | float") -> "None":
| ^^^^^^^^^^^^^^^^^ PYI041 | ^^^^^^^^^^^^^^^^^
32 | ... 32 | ...
| |
= help: Remove redundant type help: Remove redundant type
28 | ...
29 |
30 |
- def f2(arg1: "int", /, arg2: "int | int | float") -> "None":
31 + def f2(arg1: "int", /, arg2: "float") -> "None":
32 | ...
33 |
34 |
note: This is an unsafe fix and may change runtime behavior
Unsafe fix PYI041 [*] Use `float` instead of `int | float`
28 28 | ... --> PYI041_3.py:35:29
29 29 |
30 30 |
31 |-def f2(arg1: "int", /, arg2: "int | int | float") -> "None":
31 |+def f2(arg1: "int", /, arg2: "float") -> "None":
32 32 | ...
33 33 |
34 34 |
PYI041_3.py:35:29: PYI041 [*] Use `float` instead of `int | float`
| |
35 | def f3(arg1: "int", *args: "Union[int | int | float]") -> "None": 35 | def f3(arg1: "int", *args: "Union[int | int | float]") -> "None":
| ^^^^^^^^^^^^^^^^^^^^^^^^ PYI041 | ^^^^^^^^^^^^^^^^^^^^^^^^
36 | ... 36 | ...
| |
= help: Remove redundant type help: Remove redundant type
32 | ...
33 |
34 |
- def f3(arg1: "int", *args: "Union[int | int | float]") -> "None":
35 + def f3(arg1: "int", *args: "float") -> "None":
36 | ...
37 |
38 |
note: This is an unsafe fix and may change runtime behavior
Unsafe fix PYI041 [*] Use `float` instead of `int | float`
32 32 | ... --> PYI041_3.py:39:25
33 33 |
34 34 |
35 |-def f3(arg1: "int", *args: "Union[int | int | float]") -> "None":
35 |+def f3(arg1: "int", *args: "float") -> "None":
36 36 | ...
37 37 |
38 38 |
PYI041_3.py:39:25: PYI041 [*] Use `float` instead of `int | float`
| |
39 | async def f4(**kwargs: "int | int | float") -> "None": 39 | async def f4(**kwargs: "int | int | float") -> "None":
| ^^^^^^^^^^^^^^^^^ PYI041 | ^^^^^^^^^^^^^^^^^
40 | ... 40 | ...
| |
= help: Remove redundant type help: Remove redundant type
36 | ...
37 |
38 |
- async def f4(**kwargs: "int | int | float") -> "None":
39 + async def f4(**kwargs: "float") -> "None":
40 | ...
41 |
42 |
note: This is an unsafe fix and may change runtime behavior
Unsafe fix PYI041 [*] Use `float` instead of `int | float`
36 36 | ... --> PYI041_3.py:43:29
37 37 |
38 38 |
39 |-async def f4(**kwargs: "int | int | float") -> "None":
39 |+async def f4(**kwargs: "float") -> "None":
40 40 | ...
41 41 |
42 42 |
PYI041_3.py:43:29: PYI041 [*] Use `float` instead of `int | float`
| |
43 | def f5(arg1: "int", *args: "Union[int, int, float]") -> "None": 43 | def f5(arg1: "int", *args: "Union[int, int, float]") -> "None":
| ^^^^^^^^^^^^^^^^^^^^^^ PYI041 | ^^^^^^^^^^^^^^^^^^^^^^
44 | ... 44 | ...
| |
= help: Remove redundant type help: Remove redundant type
40 | ...
41 |
42 |
- def f5(arg1: "int", *args: "Union[int, int, float]") -> "None":
43 + def f5(arg1: "int", *args: "float") -> "None":
44 | ...
45 |
46 |
note: This is an unsafe fix and may change runtime behavior
Unsafe fix PYI041 [*] Use `float` instead of `int | float`
40 40 | ... --> PYI041_3.py:47:29
41 41 |
42 42 |
43 |-def f5(arg1: "int", *args: "Union[int, int, float]") -> "None":
43 |+def f5(arg1: "int", *args: "float") -> "None":
44 44 | ...
45 45 |
46 46 |
PYI041_3.py:47:29: PYI041 [*] Use `float` instead of `int | float`
| |
47 | def f6(arg1: "int", *args: "Union[Union[int, int, float]]") -> "None": 47 | def f6(arg1: "int", *args: "Union[Union[int, int, float]]") -> "None":
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ PYI041 | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
48 | ... 48 | ...
| |
= help: Remove redundant type help: Remove redundant type
44 | ...
45 |
46 |
- def f6(arg1: "int", *args: "Union[Union[int, int, float]]") -> "None":
47 + def f6(arg1: "int", *args: "float") -> "None":
48 | ...
49 |
50 |
note: This is an unsafe fix and may change runtime behavior
Unsafe fix PYI041 [*] Use `float` instead of `int | float`
44 44 | ... --> PYI041_3.py:51:29
45 45 |
46 46 |
47 |-def f6(arg1: "int", *args: "Union[Union[int, int, float]]") -> "None":
47 |+def f6(arg1: "int", *args: "float") -> "None":
48 48 | ...
49 49 |
50 50 |
PYI041_3.py:51:29: PYI041 [*] Use `float` instead of `int | float`
| |
51 | def f7(arg1: "int", *args: "Union[Union[Union[int, int, float]]]") -> "None": 51 | def f7(arg1: "int", *args: "Union[Union[Union[int, int, float]]]") -> "None":
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ PYI041 | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
52 | ... 52 | ...
| |
= help: Remove redundant type help: Remove redundant type
48 | ...
49 |
50 |
- def f7(arg1: "int", *args: "Union[Union[Union[int, int, float]]]") -> "None":
51 + def f7(arg1: "int", *args: "float") -> "None":
52 | ...
53 |
54 |
note: This is an unsafe fix and may change runtime behavior
Unsafe fix PYI041 [*] Use `float` instead of `int | float`
48 48 | ... --> PYI041_3.py:55:29
49 49 |
50 50 |
51 |-def f7(arg1: "int", *args: "Union[Union[Union[int, int, float]]]") -> "None":
51 |+def f7(arg1: "int", *args: "float") -> "None":
52 52 | ...
53 53 |
54 54 |
PYI041_3.py:55:29: PYI041 [*] Use `float` instead of `int | float`
| |
55 | def f8(arg1: "int", *args: "Union[Union[Union[int | int | float]]]") -> "None": 55 | def f8(arg1: "int", *args: "Union[Union[Union[int | int | float]]]") -> "None":
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ PYI041 | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
56 | ... 56 | ...
| |
= help: Remove redundant type help: Remove redundant type
52 | ...
53 |
54 |
- def f8(arg1: "int", *args: "Union[Union[Union[int | int | float]]]") -> "None":
55 + def f8(arg1: "int", *args: "float") -> "None":
56 | ...
57 |
58 |
note: This is an unsafe fix and may change runtime behavior
Unsafe fix PYI041 [*] Use `complex` instead of `int | float | complex`
52 52 | ... --> PYI041_3.py:60:13
53 53 |
54 54 |
55 |-def f8(arg1: "int", *args: "Union[Union[Union[int | int | float]]]") -> "None":
55 |+def f8(arg1: "int", *args: "float") -> "None":
56 56 | ...
57 57 |
58 58 |
PYI041_3.py:60:13: PYI041 [*] Use `complex` instead of `int | float | complex`
| |
59 | def f9( 59 | def f9(
60 | arg: """Union[ # comment 60 | arg: """Union[ # comment
| _____________^ | _____________^
61 | | float, # another 61 | | float, # another
62 | | complex, int]""" 62 | | complex, int]"""
| |_____________________^ PYI041 | |_____________________^
63 | ) -> "None": 63 | ) -> "None":
64 | ... 64 | ...
| |
= help: Remove redundant type help: Remove redundant type
57 |
58 |
59 | def f9(
- arg: """Union[ # comment
- float, # another
- complex, int]"""
60 + arg: """complex"""
61 | ) -> "None":
62 | ...
63 |
note: This is an unsafe fix and may change runtime behavior
Unsafe fix PYI041 [*] Use `complex` instead of `int | float | complex`
57 57 | --> PYI041_3.py:68:9
58 58 |
59 59 | def f9(
60 |- arg: """Union[ # comment
61 |- float, # another
62 |- complex, int]"""
60 |+ arg: """complex"""
63 61 | ) -> "None":
64 62 | ...
65 63 |
PYI041_3.py:68:9: PYI041 [*] Use `complex` instead of `int | float | complex`
| |
66 | def f10( 66 | def f10(
67 | arg: """ 67 | arg: """
68 | / int | # comment 68 | / int | # comment
69 | | float | # another 69 | | float | # another
70 | | complex 70 | | complex
| |_______________^ PYI041 | |_______________^
71 | """ 71 | """
72 | ) -> "None": 72 | ) -> "None":
| |
= help: Remove redundant type help: Remove redundant type
65 |
66 | def f10(
67 | arg: """
- int | # comment
- float | # another
68 | complex
69 | """
70 | ) -> "None":
note: This is an unsafe fix and may change runtime behavior
Unsafe fix PYI041 [*] Use `complex` instead of `int | float | complex`
65 65 | --> PYI041_3.py:80:25
66 66 | def f10(
67 67 | arg: """
68 |- int | # comment
69 |- float | # another
70 68 | complex
71 69 | """
72 70 | ) -> "None":
PYI041_3.py:80:25: PYI041 [*] Use `complex` instead of `int | float | complex`
| |
78 | ... 78 | ...
79 | 79 |
80 | def bad(self, arg: "int | float | complex") -> "None": 80 | def bad(self, arg: "int | float | complex") -> "None":
| ^^^^^^^^^^^^^^^^^^^^^ PYI041 | ^^^^^^^^^^^^^^^^^^^^^
81 | ... 81 | ...
| |
= help: Remove redundant type help: Remove redundant type
77 | def good(self, arg: "int") -> "None":
78 | ...
79 |
- def bad(self, arg: "int | float | complex") -> "None":
80 + def bad(self, arg: "complex") -> "None":
81 | ...
82 |
83 | def bad2(self, arg: "int | Union[float, complex]") -> "None":
note: This is an unsafe fix and may change runtime behavior
Unsafe fix PYI041 [*] Use `complex` instead of `int | float | complex`
77 77 | def good(self, arg: "int") -> "None": --> PYI041_3.py:83:26
78 78 | ...
79 79 |
80 |- def bad(self, arg: "int | float | complex") -> "None":
80 |+ def bad(self, arg: "complex") -> "None":
81 81 | ...
82 82 |
83 83 | def bad2(self, arg: "int | Union[float, complex]") -> "None":
PYI041_3.py:83:26: PYI041 [*] Use `complex` instead of `int | float | complex`
| |
81 | ... 81 | ...
82 | 82 |
83 | def bad2(self, arg: "int | Union[float, complex]") -> "None": 83 | def bad2(self, arg: "int | Union[float, complex]") -> "None":
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^ PYI041 | ^^^^^^^^^^^^^^^^^^^^^^^^^^^
84 | ... 84 | ...
| |
= help: Remove redundant type help: Remove redundant type
80 | def bad(self, arg: "int | float | complex") -> "None":
81 | ...
82 |
- def bad2(self, arg: "int | Union[float, complex]") -> "None":
83 + def bad2(self, arg: "complex") -> "None":
84 | ...
85 |
86 | def bad3(self, arg: "Union[Union[float, complex], int]") -> "None":
note: This is an unsafe fix and may change runtime behavior
Unsafe fix PYI041 [*] Use `complex` instead of `int | float | complex`
80 80 | def bad(self, arg: "int | float | complex") -> "None": --> PYI041_3.py:86:26
81 81 | ...
82 82 |
83 |- def bad2(self, arg: "int | Union[float, complex]") -> "None":
83 |+ def bad2(self, arg: "complex") -> "None":
84 84 | ...
85 85 |
86 86 | def bad3(self, arg: "Union[Union[float, complex], int]") -> "None":
PYI041_3.py:86:26: PYI041 [*] Use `complex` instead of `int | float | complex`
| |
84 | ... 84 | ...
85 | 85 |
86 | def bad3(self, arg: "Union[Union[float, complex], int]") -> "None": 86 | def bad3(self, arg: "Union[Union[float, complex], int]") -> "None":
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ PYI041 | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
87 | ... 87 | ...
| |
= help: Remove redundant type help: Remove redundant type
83 | def bad2(self, arg: "int | Union[float, complex]") -> "None":
84 | ...
85 |
- def bad3(self, arg: "Union[Union[float, complex], int]") -> "None":
86 + def bad3(self, arg: "complex") -> "None":
87 | ...
88 |
89 | def bad4(self, arg: "Union[float | complex, int]") -> "None":
note: This is an unsafe fix and may change runtime behavior
Unsafe fix PYI041 [*] Use `complex` instead of `int | float | complex`
83 83 | def bad2(self, arg: "int | Union[float, complex]") -> "None": --> PYI041_3.py:89:26
84 84 | ...
85 85 |
86 |- def bad3(self, arg: "Union[Union[float, complex], int]") -> "None":
86 |+ def bad3(self, arg: "complex") -> "None":
87 87 | ...
88 88 |
89 89 | def bad4(self, arg: "Union[float | complex, int]") -> "None":
PYI041_3.py:89:26: PYI041 [*] Use `complex` instead of `int | float | complex`
| |
87 | ... 87 | ...
88 | 88 |
89 | def bad4(self, arg: "Union[float | complex, int]") -> "None": 89 | def bad4(self, arg: "Union[float | complex, int]") -> "None":
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^ PYI041 | ^^^^^^^^^^^^^^^^^^^^^^^^^^^
90 | ... 90 | ...
| |
= help: Remove redundant type help: Remove redundant type
86 | def bad3(self, arg: "Union[Union[float, complex], int]") -> "None":
87 | ...
88 |
- def bad4(self, arg: "Union[float | complex, int]") -> "None":
89 + def bad4(self, arg: "complex") -> "None":
90 | ...
91 |
92 | def bad5(self, arg: "int | (float | complex)") -> "None":
note: This is an unsafe fix and may change runtime behavior
Unsafe fix PYI041 [*] Use `complex` instead of `int | float | complex`
86 86 | def bad3(self, arg: "Union[Union[float, complex], int]") -> "None": --> PYI041_3.py:92:26
87 87 | ...
88 88 |
89 |- def bad4(self, arg: "Union[float | complex, int]") -> "None":
89 |+ def bad4(self, arg: "complex") -> "None":
90 90 | ...
91 91 |
92 92 | def bad5(self, arg: "int | (float | complex)") -> "None":
PYI041_3.py:92:26: PYI041 [*] Use `complex` instead of `int | float | complex`
| |
90 | ... 90 | ...
91 | 91 |
92 | def bad5(self, arg: "int | (float | complex)") -> "None": 92 | def bad5(self, arg: "int | (float | complex)") -> "None":
| ^^^^^^^^^^^^^^^^^^^^^^^ PYI041 | ^^^^^^^^^^^^^^^^^^^^^^^
93 | ... 93 | ...
| |
= help: Remove redundant type help: Remove redundant type
89 | def bad4(self, arg: "Union[float | complex, int]") -> "None":
90 | ...
91 |
- def bad5(self, arg: "int | (float | complex)") -> "None":
92 + def bad5(self, arg: "complex") -> "None":
93 | ...
94 |
95 |
note: This is an unsafe fix and may change runtime behavior
Unsafe fix PYI041 Use `float` instead of `int | float`
89 89 | def bad4(self, arg: "Union[float | complex, int]") -> "None": --> PYI041_3.py:99:24
90 90 | ...
91 91 |
92 |- def bad5(self, arg: "int | (float | complex)") -> "None":
92 |+ def bad5(self, arg: "complex") -> "None":
93 93 | ...
94 94 |
95 95 |
PYI041_3.py:99:24: PYI041 Use `float` instead of `int | float`
| |
97 | # fix must not yield runtime `None | None | ...` (TypeError) 97 | # fix must not yield runtime `None | None | ...` (TypeError)
98 | class Issue18298: 98 | class Issue18298:
99 | def f1(self, arg: "None | int | None | float" = None) -> "None": # PYI041 - no fix 99 | def f1(self, arg: "None | int | None | float" = None) -> "None": # PYI041 - no fix
| ^^^^^^^^^^^^^^^^^^^^^^^^^ PYI041 | ^^^^^^^^^^^^^^^^^^^^^^^^^
100 | pass 100 | pass
| |
= help: Remove redundant type help: Remove redundant type
PYI041_3.py:104:28: PYI041 [*] Use `float` instead of `int | float` PYI041 [*] Use `float` instead of `int | float`
--> PYI041_3.py:104:28
| |
102 | if TYPE_CHECKING: 102 | if TYPE_CHECKING:
103 | 103 |
104 | def f2(self, arg: "None | int | None | float" = None) -> "None": ... # PYI041 - with fix 104 | def f2(self, arg: "None | int | None | float" = None) -> "None": ... # PYI041 - with fix
| ^^^^^^^^^^^^^^^^^^^^^^^^^ PYI041 | ^^^^^^^^^^^^^^^^^^^^^^^^^
105 | 105 |
106 | else: 106 | else:
| |
= help: Remove redundant type help: Remove redundant type
101 |
102 | if TYPE_CHECKING:
103 |
- def f2(self, arg: "None | int | None | float" = None) -> "None": ... # PYI041 - with fix
104 + def f2(self, arg: "None | None | float" = None) -> "None": ... # PYI041 - with fix
105 |
106 | else:
107 |
note: This is an unsafe fix and may change runtime behavior
Unsafe fix PYI041 [*] Use `float` instead of `int | float`
101 101 | --> PYI041_3.py:111:24
102 102 | if TYPE_CHECKING:
103 103 |
104 |- def f2(self, arg: "None | int | None | float" = None) -> "None": ... # PYI041 - with fix
104 |+ def f2(self, arg: "None | None | float" = None) -> "None": ... # PYI041 - with fix
105 105 |
106 106 | else:
107 107 |
PYI041_3.py:111:24: PYI041 [*] Use `float` instead of `int | float`
| |
109 | pass 109 | pass
110 | 110 |
111 | def f3(self, arg: "None | float | None | int | None" = None) -> "None": # PYI041 - with fix 111 | def f3(self, arg: "None | float | None | int | None" = None) -> "None": # PYI041 - with fix
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ PYI041 | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
112 | pass 112 | pass
| |
= help: Remove redundant type help: Remove redundant type
108 | def f2(self, arg=None) -> "None":
109 | pass
110 |
- def f3(self, arg: "None | float | None | int | None" = None) -> "None": # PYI041 - with fix
111 + def f3(self, arg: "None | float | None | None" = None) -> "None": # PYI041 - with fix
112 | pass
113 |
114 |
note: This is an unsafe fix and may change runtime behavior
Unsafe fix PYI041 Use `complex` instead of `int | float | complex`
108 108 | def f2(self, arg=None) -> "None": --> PYI041_3.py:119:24
109 109 | pass
110 110 |
111 |- def f3(self, arg: "None | float | None | int | None" = None) -> "None": # PYI041 - with fix
111 |+ def f3(self, arg: "None | float | None | None" = None) -> "None": # PYI041 - with fix
112 112 | pass
113 113 |
114 114 |
PYI041_3.py:119:24: PYI041 Use `complex` instead of `int | float | complex`
| |
117 | ... 117 | ...
118 | 118 |
119 | def bad(self, arg: "int " "| float | com" "plex") -> "None": 119 | def bad(self, arg: "int " "| float | com" "plex") -> "None":
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ PYI041 | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
120 | ... 120 | ...
| |
= help: Remove redundant type help: Remove redundant type
PYI041_3.py:122:25: PYI041 Use `complex` instead of `int | float | complex` PYI041 Use `complex` instead of `int | float | complex`
--> PYI041_3.py:122:25
| |
120 | ... 120 | ...
121 | 121 |
122 | def bad2(self, arg: "int | Union[flo" "at, complex]") -> "None": 122 | def bad2(self, arg: "int | Union[flo" "at, complex]") -> "None":
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ PYI041 | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
123 | ... 123 | ...
| |
= help: Remove redundant type help: Remove redundant type
PYI041_3.py:125:25: PYI041 Use `complex` instead of `int | float | complex` PYI041 Use `complex` instead of `int | float | complex`
--> PYI041_3.py:125:25
| |
123 | ... 123 | ...
124 | 124 |
125 | def bad3(self, arg: "Union[Union[float, com" "plex], int]") -> "None": 125 | def bad3(self, arg: "Union[Union[float, com" "plex], int]") -> "None":
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ PYI041 | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
126 | ... 126 | ...
| |
= help: Remove redundant type help: Remove redundant type
PYI041_3.py:128:25: PYI041 Use `complex` instead of `int | float | complex` PYI041 Use `complex` instead of `int | float | complex`
--> PYI041_3.py:128:25
| |
126 | ... 126 | ...
127 | 127 |
128 | def bad4(self, arg: "Union[float | complex, in" "t ]") -> "None": 128 | def bad4(self, arg: "Union[float | complex, in" "t ]") -> "None":
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ PYI041 | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
129 | ... 129 | ...
| |
= help: Remove redundant type help: Remove redundant type
PYI041_3.py:131:25: PYI041 Use `complex` instead of `int | float | complex` PYI041 Use `complex` instead of `int | float | complex`
--> PYI041_3.py:131:25
| |
129 | ... 129 | ...
130 | 130 |
131 | def bad5(self, arg: "int | " 131 | def bad5(self, arg: "int | "
| _________________________^ | _________________________^
132 | | "(float | complex)") -> "None": 132 | | "(float | complex)") -> "None":
| |___________________________________________^ PYI041 | |___________________________________________^
133 | ... 133 | ...
| |
= help: Remove redundant type help: Remove redundant type
PYI041_3.py:135:25: PYI041 Use `complex` instead of `int | float | complex` PYI041 Use `complex` instead of `int | float | complex`
--> PYI041_3.py:135:25
| |
133 | ... 133 | ...
134 | 134 |
135 | def bad6(self, arg: "in\ 135 | def bad6(self, arg: "in\
| _________________________^ | _________________________^
136 | | t | (float | compl" "ex)") -> "None": 136 | | t | (float | compl" "ex)") -> "None":
| |_________________________^ PYI041 | |_________________________^
137 | ... 137 | ...
| |
= help: Remove redundant type help: Remove redundant type

View File

@ -1,70 +1,71 @@
--- ---
source: crates/ruff_linter/src/rules/flake8_pyi/mod.rs source: crates/ruff_linter/src/rules/flake8_pyi/mod.rs
--- ---
PYI041_4.py:4:11: PYI041 Use `float` instead of `int | float` PYI041 Use `float` instead of `int | float`
--> PYI041_4.py:4:11
| |
4 | def f1(a: "U" "no[int, fl" "oat, Foo]") -> "None": ... 4 | def f1(a: "U" "no[int, fl" "oat, Foo]") -> "None": ...
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ PYI041 | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^
5 | def f2(a: "Uno[int, float, Foo]") -> "None": ... 5 | def f2(a: "Uno[int, float, Foo]") -> "None": ...
6 | def f3(a: """Uno[int, float, Foo]""") -> "None": ... 6 | def f3(a: """Uno[int, float, Foo]""") -> "None": ...
| |
= help: Remove redundant type help: Remove redundant type
PYI041_4.py:5:12: PYI041 [*] Use `float` instead of `int | float` PYI041 [*] Use `float` instead of `int | float`
--> PYI041_4.py:5:12
| |
4 | def f1(a: "U" "no[int, fl" "oat, Foo]") -> "None": ... 4 | def f1(a: "U" "no[int, fl" "oat, Foo]") -> "None": ...
5 | def f2(a: "Uno[int, float, Foo]") -> "None": ... 5 | def f2(a: "Uno[int, float, Foo]") -> "None": ...
| ^^^^^^^^^^^^^^^^^^^^ PYI041 | ^^^^^^^^^^^^^^^^^^^^
6 | def f3(a: """Uno[int, float, Foo]""") -> "None": ... 6 | def f3(a: """Uno[int, float, Foo]""") -> "None": ...
7 | def f4(a: "Uno[in\ 7 | def f4(a: "Uno[in\
| |
= help: Remove redundant type help: Remove redundant type
2 |
3 |
4 | def f1(a: "U" "no[int, fl" "oat, Foo]") -> "None": ...
- def f2(a: "Uno[int, float, Foo]") -> "None": ...
5 + def f2(a: "Uno[float, Foo]") -> "None": ...
6 | def f3(a: """Uno[int, float, Foo]""") -> "None": ...
7 | def f4(a: "Uno[in\
8 | t, float, Foo]") -> "None": ...
note: This is an unsafe fix and may change runtime behavior
Unsafe fix PYI041 [*] Use `float` instead of `int | float`
2 2 | --> PYI041_4.py:6:14
3 3 |
4 4 | def f1(a: "U" "no[int, fl" "oat, Foo]") -> "None": ...
5 |-def f2(a: "Uno[int, float, Foo]") -> "None": ...
5 |+def f2(a: "Uno[float, Foo]") -> "None": ...
6 6 | def f3(a: """Uno[int, float, Foo]""") -> "None": ...
7 7 | def f4(a: "Uno[in\
8 8 | t, float, Foo]") -> "None": ...
PYI041_4.py:6:14: PYI041 [*] Use `float` instead of `int | float`
| |
4 | def f1(a: "U" "no[int, fl" "oat, Foo]") -> "None": ... 4 | def f1(a: "U" "no[int, fl" "oat, Foo]") -> "None": ...
5 | def f2(a: "Uno[int, float, Foo]") -> "None": ... 5 | def f2(a: "Uno[int, float, Foo]") -> "None": ...
6 | def f3(a: """Uno[int, float, Foo]""") -> "None": ... 6 | def f3(a: """Uno[int, float, Foo]""") -> "None": ...
| ^^^^^^^^^^^^^^^^^^^^ PYI041 | ^^^^^^^^^^^^^^^^^^^^
7 | def f4(a: "Uno[in\ 7 | def f4(a: "Uno[in\
8 | t, float, Foo]") -> "None": ... 8 | t, float, Foo]") -> "None": ...
| |
= help: Remove redundant type help: Remove redundant type
3 |
4 | def f1(a: "U" "no[int, fl" "oat, Foo]") -> "None": ...
5 | def f2(a: "Uno[int, float, Foo]") -> "None": ...
- def f3(a: """Uno[int, float, Foo]""") -> "None": ...
6 + def f3(a: """Uno[float, Foo]""") -> "None": ...
7 | def f4(a: "Uno[in\
8 | t, float, Foo]") -> "None": ...
note: This is an unsafe fix and may change runtime behavior
Unsafe fix PYI041 [*] Use `float` instead of `int | float`
3 3 | --> PYI041_4.py:7:11
4 4 | def f1(a: "U" "no[int, fl" "oat, Foo]") -> "None": ...
5 5 | def f2(a: "Uno[int, float, Foo]") -> "None": ...
6 |-def f3(a: """Uno[int, float, Foo]""") -> "None": ...
6 |+def f3(a: """Uno[float, Foo]""") -> "None": ...
7 7 | def f4(a: "Uno[in\
8 8 | t, float, Foo]") -> "None": ...
PYI041_4.py:7:11: PYI041 [*] Use `float` instead of `int | float`
| |
5 | def f2(a: "Uno[int, float, Foo]") -> "None": ... 5 | def f2(a: "Uno[int, float, Foo]") -> "None": ...
6 | def f3(a: """Uno[int, float, Foo]""") -> "None": ... 6 | def f3(a: """Uno[int, float, Foo]""") -> "None": ...
7 | def f4(a: "Uno[in\ 7 | def f4(a: "Uno[in\
| ___________^ | ___________^
8 | | t, float, Foo]") -> "None": ... 8 | | t, float, Foo]") -> "None": ...
| |_______________^ PYI041 | |_______________^
| |
= help: Remove redundant type help: Remove redundant type
4 | def f1(a: "U" "no[int, fl" "oat, Foo]") -> "None": ...
Unsafe fix 5 | def f2(a: "Uno[int, float, Foo]") -> "None": ...
4 4 | def f1(a: "U" "no[int, fl" "oat, Foo]") -> "None": ... 6 | def f3(a: """Uno[int, float, Foo]""") -> "None": ...
5 5 | def f2(a: "Uno[int, float, Foo]") -> "None": ... - def f4(a: "Uno[in\
6 6 | def f3(a: """Uno[int, float, Foo]""") -> "None": ... - t, float, Foo]") -> "None": ...
7 |-def f4(a: "Uno[in\ 7 + def f4(a: Uno[float, Foo]) -> "None": ...
8 |-t, float, Foo]") -> "None": ... note: This is an unsafe fix and may change runtime behavior
7 |+def f4(a: Uno[float, Foo]) -> "None": ...