1
1
-- -
2
2
source : crates / ruff / src / rules / flake8_pyi / mod .rs
3
3
-- -
4
- PYI051 .pyi :4 :18 : PYI051 ` Literal["foo"]` is redundant in an union with ` str`
4
+ PYI051 .pyi :4 :18 : PYI051 ` Literal["foo"]` is redundant in a union with ` str`
5
5
|
6
6
2 | from typing import Literal , TypeAlias , Union
7
7
3 |
@@ -11,16 +11,25 @@ PYI051.pyi:4:18: PYI051 `Literal["foo"]` is redundant in an union with `str`
11
11
6 | C : TypeAlias = typing .Union [Literal [5 ], int , typing .Union [Literal [" foo" ], str ]]
12
12
|
13
13
14
- PYI051 .pyi :5 :37 : PYI051 ` Literal[b"bar", b"foo" ]` is redundant in an union with ` bytes`
14
+ PYI051 .pyi :5 :37 : PYI051 ` Literal[b"bar"]` is redundant in a union with ` bytes`
15
15
|
16
16
4 | A : str | Literal [" foo" ]
17
17
5 | B : TypeAlias = typing .Union [Literal [b " bar" , b " foo" ], bytes , str ]
18
- | ^^^^^^^^^^^^^^ PYI051
18
+ | ^^^^^^ PYI051
19
19
6 | C : TypeAlias = typing .Union [Literal [5 ], int , typing .Union [Literal [" foo" ], str ]]
20
20
7 | D : TypeAlias = typing .Union [Literal [b " str_bytes" , 42 ], bytes , int ]
21
21
|
22
22
23
- PYI051 .pyi :6 :37 : PYI051 ` Literal[5]` is redundant in an union with ` int`
23
+ PYI051 .pyi :5 :45 : PYI051 ` Literal[b"foo"]` is redundant in a union with ` bytes`
24
+ |
25
+ 4 | A : str | Literal [" foo" ]
26
+ 5 | B : TypeAlias = typing .Union [Literal [b " bar" , b " foo" ], bytes , str ]
27
+ | ^^^^^^ PYI051
28
+ 6 | C : TypeAlias = typing .Union [Literal [5 ], int , typing .Union [Literal [" foo" ], str ]]
29
+ 7 | D : TypeAlias = typing .Union [Literal [b " str_bytes" , 42 ], bytes , int ]
30
+ |
31
+
32
+ PYI051 .pyi :6 :37 : PYI051 ` Literal[5]` is redundant in a union with ` int`
24
33
|
25
34
4 | A : str | Literal [" foo" ]
26
35
5 | B : TypeAlias = typing .Union [Literal [b " bar" , b " foo" ], bytes , str ]
@@ -29,7 +38,7 @@ PYI051.pyi:6:37: PYI051 `Literal[5]` is redundant in an union with `int`
29
38
7 | D : TypeAlias = typing .Union [Literal [b " str_bytes" , 42 ], bytes , int ]
30
39
|
31
40
32
- PYI051 .pyi :6 :67 : PYI051 ` Literal["foo"]` is redundant in an union with ` str`
41
+ PYI051 .pyi :6 :67 : PYI051 ` Literal["foo"]` is redundant in a union with ` str`
33
42
|
34
43
4 | A : str | Literal [" foo" ]
35
44
5 | B : TypeAlias = typing .Union [Literal [b " bar" , b " foo" ], bytes , str ]
@@ -38,7 +47,7 @@ PYI051.pyi:6:67: PYI051 `Literal["foo"]` is redundant in an union with `str`
38
47
7 | D : TypeAlias = typing .Union [Literal [b " str_bytes" , 42 ], bytes , int ]
39
48
|
40
49
41
- PYI051 .pyi :7 :37 : PYI051 ` Literal[b"str_bytes"]` is redundant in an union with ` bytes`
50
+ PYI051 .pyi :7 :37 : PYI051 ` Literal[b"str_bytes"]` is redundant in a union with ` bytes`
42
51
|
43
52
5 | B : TypeAlias = typing .Union [Literal [b " bar" , b " foo" ], bytes , str ]
44
53
6 | C : TypeAlias = typing .Union [Literal [5 ], int , typing .Union [Literal [" foo" ], str ]]
@@ -48,7 +57,7 @@ PYI051.pyi:7:37: PYI051 `Literal[b"str_bytes"]` is redundant in an union with `b
48
57
9 | def func (x : complex | Literal [1J ], y : Union [Literal [3.14 ], float ]): ...
49
58
|
50
59
51
- PYI051 .pyi :7 :51 : PYI051 ` Literal[42]` is redundant in an union with ` int`
60
+ PYI051 .pyi :7 :51 : PYI051 ` Literal[42]` is redundant in a union with ` int`
52
61
|
53
62
5 | B : TypeAlias = typing .Union [Literal [b " bar" , b " foo" ], bytes , str ]
54
63
6 | C : TypeAlias = typing .Union [Literal [5 ], int , typing .Union [Literal [" foo" ], str ]]
@@ -58,7 +67,7 @@ PYI051.pyi:7:51: PYI051 `Literal[42]` is redundant in an union with `int`
58
67
9 | def func (x : complex | Literal [1J ], y : Union [Literal [3.14 ], float ]): ...
59
68
|
60
69
61
- PYI051 .pyi :9 :31 : PYI051 ` Literal[1J]` is redundant in an union with ` complex`
70
+ PYI051 .pyi :9 :31 : PYI051 ` Literal[1J]` is redundant in a union with ` complex`
62
71
|
63
72
7 | D : TypeAlias = typing .Union [Literal [b " str_bytes" , 42 ], bytes , int ]
64
73
8 |
@@ -68,7 +77,7 @@ PYI051.pyi:9:31: PYI051 `Literal[1J]` is redundant in an union with `complex`
68
77
11 | # OK
69
78
|
70
79
71
- PYI051 .pyi :9 :53 : PYI051 ` Literal[3.14]` is redundant in an union with ` float`
80
+ PYI051 .pyi :9 :53 : PYI051 ` Literal[3.14]` is redundant in a union with ` float`
72
81
|
73
82
7 | D : TypeAlias = typing .Union [Literal [b " str_bytes" , 42 ], bytes , int ]
74
83
8 |
0 commit comments