1
1
-- -
2
2
source : crates / ruff_linter / src / rules / flake8_pyi / mod .rs
3
3
-- -
4
- PYI062 .py :5 :25 : PYI062 Duplicate literal member ` True`
4
+ PYI062 .py :5 :25 : PYI062 [ * ] Duplicate literal member ` True`
5
5
|
6
6
3 | import typing_extensions
7
7
4 |
@@ -10,8 +10,19 @@ PYI062.py:5:25: PYI062 Duplicate literal member `True`
10
10
6 |
11
11
7 | y : Literal [1 , print (" hello" ), 3 , Literal [4 , 1 ]] # PYI062 on the last 1
12
12
|
13
+ = help : Remove duplicates
13
14
14
- PYI062 .py :5 :31 : PYI062 Duplicate literal member ` False`
15
+ ℹ Safe fix
16
+ 2 2 | import typing as t
17
+ 3 3 | import typing_extensions
18
+ 4 4 |
19
+ 5 | - x : Literal [True , False , True , False ] # PYI062 twice here
20
+ 5 | + x : Literal [True , False ] # PYI062 twice here
21
+ 6 6 |
22
+ 7 7 | y : Literal [1 , print (" hello" ), 3 , Literal [4 , 1 ]] # PYI062 on the last 1
23
+ 8 8 |
24
+
25
+ PYI062 .py :5 :31 : PYI062 [* ] Duplicate literal member ` False`
15
26
|
16
27
3 | import typing_extensions
17
28
4 |
@@ -20,8 +31,19 @@ PYI062.py:5:31: PYI062 Duplicate literal member `False`
20
31
6 |
21
32
7 | y : Literal [1 , print (" hello" ), 3 , Literal [4 , 1 ]] # PYI062 on the last 1
22
33
|
34
+ = help : Remove duplicates
35
+
36
+ ℹ Safe fix
37
+ 2 2 | import typing as t
38
+ 3 3 | import typing_extensions
39
+ 4 4 |
40
+ 5 | - x : Literal [True , False , True , False ] # PYI062 twice here
41
+ 5 | + x : Literal [True , False ] # PYI062 twice here
42
+ 6 6 |
43
+ 7 7 | y : Literal [1 , print (" hello" ), 3 , Literal [4 , 1 ]] # PYI062 on the last 1
44
+ 8 8 |
23
45
24
- PYI062 .py :7 :45 : PYI062 Duplicate literal member ` 1`
46
+ PYI062 .py :7 :45 : PYI062 [ * ] Duplicate literal member ` 1`
25
47
|
26
48
5 | x : Literal [True , False , True , False ] # PYI062 twice here
27
49
6 |
@@ -30,8 +52,19 @@ PYI062.py:7:45: PYI062 Duplicate literal member `1`
30
52
8 |
31
53
9 | z : Literal [{1, 3, 5}, " foobar" , {1,3,5}] # PYI062 on the set literal
32
54
|
55
+ = help : Remove duplicates
33
56
34
- PYI062 .py :9 :33 : PYI062 Duplicate literal member ` { 1 , 3 , 5 } `
57
+ ℹ Safe fix
58
+ 4 4 |
59
+ 5 5 | x : Literal [True , False , True , False ] # PYI062 twice here
60
+ 6 6 |
61
+ 7 | - y : Literal [1 , print (" hello" ), 3 , Literal [4 , 1 ]] # PYI062 on the last 1
62
+ 7 | + y : Literal [1 , print (" hello" ), 3 , 4 ] # PYI062 on the last 1
63
+ 8 8 |
64
+ 9 9 | z : Literal [{1, 3, 5}, " foobar" , {1,3,5}] # PYI062 on the set literal
65
+ 10 10 |
66
+
67
+ PYI062 .py :9 :33 : PYI062 [* ] Duplicate literal member ` { 1 , 3 , 5 } `
35
68
|
36
69
7 | y : Literal [1 , print (" hello" ), 3 , Literal [4 , 1 ]] # PYI062 on the last 1
37
70
8 |
@@ -40,8 +73,19 @@ PYI062.py:9:33: PYI062 Duplicate literal member `{1, 3, 5}`
40
73
10 |
41
74
11 | Literal [1 , Literal [1 ]] # once
42
75
|
76
+ = help : Remove duplicates
77
+
78
+ ℹ Safe fix
79
+ 6 6 |
80
+ 7 7 | y : Literal [1 , print (" hello" ), 3 , Literal [4 , 1 ]] # PYI062 on the last 1
81
+ 8 8 |
82
+ 9 | - z : Literal [{1, 3, 5}, " foobar" , {1,3,5}] # PYI062 on the set literal
83
+ 9 | + z : Literal [{1, 3, 5}, " foobar" ] # PYI062 on the set literal
84
+ 10 10 |
85
+ 11 11 | Literal [1 , Literal [1 ]] # once
86
+ 12 12 | Literal [1 , 2 , Literal [1 , 2 ]] # twice
43
87
44
- PYI062 .py :11 :20 : PYI062 Duplicate literal member ` 1`
88
+ PYI062 .py :11 :20 : PYI062 [ * ] Duplicate literal member ` 1`
45
89
|
46
90
9 | z : Literal [{1, 3, 5}, " foobar" , {1,3,5}] # PYI062 on the set literal
47
91
10 |
@@ -50,26 +94,59 @@ PYI062.py:11:20: PYI062 Duplicate literal member `1`
50
94
12 | Literal [1 , 2 , Literal [1 , 2 ]] # twice
51
95
13 | Literal [1 , Literal [1 ], Literal [1 ]] # twice
52
96
|
97
+ = help : Remove duplicates
53
98
54
- PYI062 .py :12 :23 : PYI062 Duplicate literal member ` 1`
99
+ ℹ Safe fix
100
+ 8 8 |
101
+ 9 9 | z : Literal [{1, 3, 5}, " foobar" , {1,3,5}] # PYI062 on the set literal
102
+ 10 10 |
103
+ 11 | - Literal [1 , Literal [1 ]] # once
104
+ 11 | + Literal [1 ] # once
105
+ 12 12 | Literal [1 , 2 , Literal [1 , 2 ]] # twice
106
+ 13 13 | Literal [1 , Literal [1 ], Literal [1 ]] # twice
107
+ 14 14 | Literal [1 , Literal [2 ], Literal [2 ]] # once
108
+
109
+ PYI062 .py :12 :23 : PYI062 [* ] Duplicate literal member ` 1`
55
110
|
56
111
11 | Literal [1 , Literal [1 ]] # once
57
112
12 | Literal [1 , 2 , Literal [1 , 2 ]] # twice
58
113
| ^ PYI062
59
114
13 | Literal [1 , Literal [1 ], Literal [1 ]] # twice
60
115
14 | Literal [1 , Literal [2 ], Literal [2 ]] # once
61
116
|
117
+ = help : Remove duplicates
118
+
119
+ ℹ Safe fix
120
+ 9 9 | z : Literal [{1, 3, 5}, " foobar" , {1,3,5}] # PYI062 on the set literal
121
+ 10 10 |
122
+ 11 11 | Literal [1 , Literal [1 ]] # once
123
+ 12 | - Literal [1 , 2 , Literal [1 , 2 ]] # twice
124
+ 12 | + Literal [1 , 2 ] # twice
125
+ 13 13 | Literal [1 , Literal [1 ], Literal [1 ]] # twice
126
+ 14 14 | Literal [1 , Literal [2 ], Literal [2 ]] # once
127
+ 15 15 | t .Literal [1 , t .Literal [2 , t .Literal [1 ]]] # once
62
128
63
- PYI062 .py :12 :26 : PYI062 Duplicate literal member ` 2`
129
+ PYI062 .py :12 :26 : PYI062 [ * ] Duplicate literal member ` 2`
64
130
|
65
131
11 | Literal [1 , Literal [1 ]] # once
66
132
12 | Literal [1 , 2 , Literal [1 , 2 ]] # twice
67
133
| ^ PYI062
68
134
13 | Literal [1 , Literal [1 ], Literal [1 ]] # twice
69
135
14 | Literal [1 , Literal [2 ], Literal [2 ]] # once
70
136
|
137
+ = help : Remove duplicates
138
+
139
+ ℹ Safe fix
140
+ 9 9 | z : Literal [{1, 3, 5}, " foobar" , {1,3,5}] # PYI062 on the set literal
141
+ 10 10 |
142
+ 11 11 | Literal [1 , Literal [1 ]] # once
143
+ 12 | - Literal [1 , 2 , Literal [1 , 2 ]] # twice
144
+ 12 | + Literal [1 , 2 ] # twice
145
+ 13 13 | Literal [1 , Literal [1 ], Literal [1 ]] # twice
146
+ 14 14 | Literal [1 , Literal [2 ], Literal [2 ]] # once
147
+ 15 15 | t .Literal [1 , t .Literal [2 , t .Literal [1 ]]] # once
71
148
72
- PYI062 .py :13 :20 : PYI062 Duplicate literal member ` 1`
149
+ PYI062 .py :13 :20 : PYI062 [ * ] Duplicate literal member ` 1`
73
150
|
74
151
11 | Literal [1 , Literal [1 ]] # once
75
152
12 | Literal [1 , 2 , Literal [1 , 2 ]] # twice
@@ -78,8 +155,19 @@ PYI062.py:13:20: PYI062 Duplicate literal member `1`
78
155
14 | Literal [1 , Literal [2 ], Literal [2 ]] # once
79
156
15 | t .Literal [1 , t .Literal [2 , t .Literal [1 ]]] # once
80
157
|
158
+ = help : Remove duplicates
81
159
82
- PYI062 .py :13 :32 : PYI062 Duplicate literal member ` 1`
160
+ ℹ Safe fix
161
+ 10 10 |
162
+ 11 11 | Literal [1 , Literal [1 ]] # once
163
+ 12 12 | Literal [1 , 2 , Literal [1 , 2 ]] # twice
164
+ 13 | - Literal [1 , Literal [1 ], Literal [1 ]] # twice
165
+ 13 | + Literal [1 ] # twice
166
+ 14 14 | Literal [1 , Literal [2 ], Literal [2 ]] # once
167
+ 15 15 | t .Literal [1 , t .Literal [2 , t .Literal [1 ]]] # once
168
+ 16 16 | typing_extensions .Literal [1 , 1 , 1 ] # twice
169
+
170
+ PYI062 .py :13 :32 : PYI062 [* ] Duplicate literal member ` 1`
83
171
|
84
172
11 | Literal [1 , Literal [1 ]] # once
85
173
12 | Literal [1 , 2 , Literal [1 , 2 ]] # twice
@@ -88,8 +176,19 @@ PYI062.py:13:32: PYI062 Duplicate literal member `1`
88
176
14 | Literal [1 , Literal [2 ], Literal [2 ]] # once
89
177
15 | t .Literal [1 , t .Literal [2 , t .Literal [1 ]]] # once
90
178
|
179
+ = help : Remove duplicates
180
+
181
+ ℹ Safe fix
182
+ 10 10 |
183
+ 11 11 | Literal [1 , Literal [1 ]] # once
184
+ 12 12 | Literal [1 , 2 , Literal [1 , 2 ]] # twice
185
+ 13 | - Literal [1 , Literal [1 ], Literal [1 ]] # twice
186
+ 13 | + Literal [1 ] # twice
187
+ 14 14 | Literal [1 , Literal [2 ], Literal [2 ]] # once
188
+ 15 15 | t .Literal [1 , t .Literal [2 , t .Literal [1 ]]] # once
189
+ 16 16 | typing_extensions .Literal [1 , 1 , 1 ] # twice
91
190
92
- PYI062 .py :14 :32 : PYI062 Duplicate literal member ` 2`
191
+ PYI062 .py :14 :32 : PYI062 [ * ] Duplicate literal member ` 2`
93
192
|
94
193
12 | Literal [1 , 2 , Literal [1 , 2 ]] # twice
95
194
13 | Literal [1 , Literal [1 ], Literal [1 ]] # twice
@@ -98,17 +197,39 @@ PYI062.py:14:32: PYI062 Duplicate literal member `2`
98
197
15 | t .Literal [1 , t .Literal [2 , t .Literal [1 ]]] # once
99
198
16 | typing_extensions .Literal [1 , 1 , 1 ] # twice
100
199
|
200
+ = help : Remove duplicates
101
201
102
- PYI062 .py :15 :37 : PYI062 Duplicate literal member ` 1`
202
+ ℹ Safe fix
203
+ 11 11 | Literal [1 , Literal [1 ]] # once
204
+ 12 12 | Literal [1 , 2 , Literal [1 , 2 ]] # twice
205
+ 13 13 | Literal [1 , Literal [1 ], Literal [1 ]] # twice
206
+ 14 | - Literal [1 , Literal [2 ], Literal [2 ]] # once
207
+ 14 | + Literal [1 , 2 ] # once
208
+ 15 15 | t .Literal [1 , t .Literal [2 , t .Literal [1 ]]] # once
209
+ 16 16 | typing_extensions .Literal [1 , 1 , 1 ] # twice
210
+ 17 17 |
211
+
212
+ PYI062 .py :15 :37 : PYI062 [* ] Duplicate literal member ` 1`
103
213
|
104
214
13 | Literal [1 , Literal [1 ], Literal [1 ]] # twice
105
215
14 | Literal [1 , Literal [2 ], Literal [2 ]] # once
106
216
15 | t .Literal [1 , t .Literal [2 , t .Literal [1 ]]] # once
107
217
| ^ PYI062
108
218
16 | typing_extensions .Literal [1 , 1 , 1 ] # twice
109
219
|
220
+ = help : Remove duplicates
221
+
222
+ ℹ Safe fix
223
+ 12 12 | Literal [1 , 2 , Literal [1 , 2 ]] # twice
224
+ 13 13 | Literal [1 , Literal [1 ], Literal [1 ]] # twice
225
+ 14 14 | Literal [1 , Literal [2 ], Literal [2 ]] # once
226
+ 15 | - t .Literal [1 , t .Literal [2 , t .Literal [1 ]]] # once
227
+ 15 | + t .Literal [1 , 2 ] # once
228
+ 16 16 | typing_extensions .Literal [1 , 1 , 1 ] # twice
229
+ 17 17 |
230
+ 18 18 | # Ensure issue is only raised once , even on nested literals
110
231
111
- PYI062 .py :16 :30 : PYI062 Duplicate literal member ` 1`
232
+ PYI062 .py :16 :30 : PYI062 [ * ] Duplicate literal member ` 1`
112
233
|
113
234
14 | Literal [1 , Literal [2 ], Literal [2 ]] # once
114
235
15 | t .Literal [1 , t .Literal [2 , t .Literal [1 ]]] # once
@@ -117,8 +238,19 @@ PYI062.py:16:30: PYI062 Duplicate literal member `1`
117
238
17 |
118
239
18 | # Ensure issue is only raised once , even on nested literals
119
240
|
241
+ = help : Remove duplicates
120
242
121
- PYI062 .py :16 :33 : PYI062 Duplicate literal member ` 1`
243
+ ℹ Safe fix
244
+ 13 13 | Literal [1 , Literal [1 ], Literal [1 ]] # twice
245
+ 14 14 | Literal [1 , Literal [2 ], Literal [2 ]] # once
246
+ 15 15 | t .Literal [1 , t .Literal [2 , t .Literal [1 ]]] # once
247
+ 16 | - typing_extensions .Literal [1 , 1 , 1 ] # twice
248
+ 16 | + typing_extensions .Literal [1 ] # twice
249
+ 17 17 |
250
+ 18 18 | # Ensure issue is only raised once , even on nested literals
251
+ 19 19 | MyType = Literal [" foo" , Literal [True , False , True ], " bar" ] # PYI062
252
+
253
+ PYI062 .py :16 :33 : PYI062 [* ] Duplicate literal member ` 1`
122
254
|
123
255
14 | Literal [1 , Literal [2 ], Literal [2 ]] # once
124
256
15 | t .Literal [1 , t .Literal [2 , t .Literal [1 ]]] # once
@@ -127,12 +259,33 @@ PYI062.py:16:33: PYI062 Duplicate literal member `1`
127
259
17 |
128
260
18 | # Ensure issue is only raised once , even on nested literals
129
261
|
262
+ = help : Remove duplicates
263
+
264
+ ℹ Safe fix
265
+ 13 13 | Literal [1 , Literal [1 ], Literal [1 ]] # twice
266
+ 14 14 | Literal [1 , Literal [2 ], Literal [2 ]] # once
267
+ 15 15 | t .Literal [1 , t .Literal [2 , t .Literal [1 ]]] # once
268
+ 16 | - typing_extensions .Literal [1 , 1 , 1 ] # twice
269
+ 16 | + typing_extensions .Literal [1 ] # twice
270
+ 17 17 |
271
+ 18 18 | # Ensure issue is only raised once , even on nested literals
272
+ 19 19 | MyType = Literal [" foo" , Literal [True , False , True ], " bar" ] # PYI062
130
273
131
- PYI062 .py :19 :46 : PYI062 Duplicate literal member ` True`
274
+ PYI062 .py :19 :46 : PYI062 [ * ] Duplicate literal member ` True`
132
275
|
133
276
18 | # Ensure issue is only raised once , even on nested literals
134
277
19 | MyType = Literal [" foo" , Literal [True , False , True ], " bar" ] # PYI062
135
278
| ^^^^ PYI062
136
279
20 |
137
280
21 | n : Literal [" No" , " duplicates" , " here" , 1 , " 1" ]
138
281
|
282
+ = help : Remove duplicates
283
+
284
+ ℹ Safe fix
285
+ 16 16 | typing_extensions .Literal [1 , 1 , 1 ] # twice
286
+ 17 17 |
287
+ 18 18 | # Ensure issue is only raised once , even on nested literals
288
+ 19 | - MyType = Literal [" foo" , Literal [True , False , True ], " bar" ] # PYI062
289
+ 19 | + MyType = Literal [" foo" , True , False , " bar" ] # PYI062
290
+ 20 20 |
291
+ 21 21 | n : Literal [" No" , " duplicates" , " here" , 1 , " 1" ]
0 commit comments