|
| 1 | +--- |
| 2 | +source: crates/ruff_linter/src/rules/flake8_pyi/mod.rs |
| 3 | +assertion_line: 117 |
| 4 | +--- |
| 5 | +PYI055.py:31:8: PYI055 [*] Multiple `type` members in a union. Combine them into one, e.g., `type[requests_mock.Mocker | httpretty | str]`. |
| 6 | + | |
| 7 | +29 | def func(): |
| 8 | +30 | # PYI055 |
| 9 | +31 | x: type[requests_mock.Mocker] | type[httpretty] | type[str] = requests_mock.Mocker |
| 10 | + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ PYI055 |
| 11 | +32 | y: Union[type[requests_mock.Mocker], type[httpretty], type[str]] = requests_mock.Mocker |
| 12 | + | |
| 13 | + = help: Combine multiple `type` members |
| 14 | + |
| 15 | +ℹ Safe fix |
| 16 | +28 28 | |
| 17 | +29 29 | def func(): |
| 18 | +30 30 | # PYI055 |
| 19 | +31 |- x: type[requests_mock.Mocker] | type[httpretty] | type[str] = requests_mock.Mocker |
| 20 | + 31 |+ x: type[requests_mock.Mocker | httpretty | str] = requests_mock.Mocker |
| 21 | +32 32 | y: Union[type[requests_mock.Mocker], type[httpretty], type[str]] = requests_mock.Mocker |
| 22 | +33 33 | |
| 23 | +34 34 | |
| 24 | + |
| 25 | +PYI055.py:32:8: PYI055 [*] Multiple `type` members in a union. Combine them into one, e.g., `type[Union[requests_mock.Mocker, httpretty, str]]`. |
| 26 | + | |
| 27 | +30 | # PYI055 |
| 28 | +31 | x: type[requests_mock.Mocker] | type[httpretty] | type[str] = requests_mock.Mocker |
| 29 | +32 | y: Union[type[requests_mock.Mocker], type[httpretty], type[str]] = requests_mock.Mocker |
| 30 | + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ PYI055 |
| 31 | + | |
| 32 | + = help: Combine multiple `type` members |
| 33 | + |
| 34 | +ℹ Safe fix |
| 35 | +29 29 | def func(): |
| 36 | +30 30 | # PYI055 |
| 37 | +31 31 | x: type[requests_mock.Mocker] | type[httpretty] | type[str] = requests_mock.Mocker |
| 38 | +32 |- y: Union[type[requests_mock.Mocker], type[httpretty], type[str]] = requests_mock.Mocker |
| 39 | + 32 |+ y: type[Union[requests_mock.Mocker, httpretty, str]] = requests_mock.Mocker |
| 40 | +33 33 | |
| 41 | +34 34 | |
| 42 | +35 35 | def func(): |
| 43 | + |
| 44 | +PYI055.py:39:8: PYI055 [*] Multiple `type` members in a union. Combine them into one, e.g., `type[Union[requests_mock.Mocker, httpretty, str]]`. |
| 45 | + | |
| 46 | +38 | # PYI055 |
| 47 | +39 | x: Union[type[requests_mock.Mocker], type[httpretty], type[str]] = requests_mock.Mocker |
| 48 | + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ PYI055 |
| 49 | + | |
| 50 | + = help: Combine multiple `type` members |
| 51 | + |
| 52 | +ℹ Safe fix |
| 53 | +36 36 | from typing import Union as U |
| 54 | +37 37 | |
| 55 | +38 38 | # PYI055 |
| 56 | +39 |- x: Union[type[requests_mock.Mocker], type[httpretty], type[str]] = requests_mock.Mocker |
| 57 | + 39 |+ x: type[Union[requests_mock.Mocker, httpretty, str]] = requests_mock.Mocker |
| 58 | +40 40 | |
| 59 | +41 41 | |
| 60 | +42 42 | def convert_union(union: UnionType) -> _T | None: |
| 61 | + |
| 62 | +PYI055.py:44:9: PYI055 [*] Multiple `type` members in a union. Combine them into one, e.g., `type[_T | Converter[_T]]`. |
| 63 | + | |
| 64 | +42 | def convert_union(union: UnionType) -> _T | None: |
| 65 | +43 | converters: tuple[ |
| 66 | +44 | type[_T] | type[Converter[_T]] | Converter[_T] | Callable[[str], _T], ... # PYI055 |
| 67 | + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ PYI055 |
| 68 | +45 | ] = union.__args__ |
| 69 | +46 | ... |
| 70 | + | |
| 71 | + = help: Combine multiple `type` members |
| 72 | + |
| 73 | +ℹ Safe fix |
| 74 | +41 41 | |
| 75 | +42 42 | def convert_union(union: UnionType) -> _T | None: |
| 76 | +43 43 | converters: tuple[ |
| 77 | +44 |- type[_T] | type[Converter[_T]] | Converter[_T] | Callable[[str], _T], ... # PYI055 |
| 78 | + 44 |+ type[_T | Converter[_T]] | Converter[_T] | Callable[[str], _T], ... # PYI055 |
| 79 | +45 45 | ] = union.__args__ |
| 80 | +46 46 | ... |
| 81 | +47 47 | |
| 82 | + |
| 83 | +PYI055.py:50:15: PYI055 [*] Multiple `type` members in a union. Combine them into one, e.g., `type[_T | Converter[_T]]`. |
| 84 | + | |
| 85 | +48 | def convert_union(union: UnionType) -> _T | None: |
| 86 | +49 | converters: tuple[ |
| 87 | +50 | Union[type[_T] | type[Converter[_T]] | Converter[_T] | Callable[[str], _T]], ... # PYI055 |
| 88 | + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ PYI055 |
| 89 | +51 | ] = union.__args__ |
| 90 | +52 | ... |
| 91 | + | |
| 92 | + = help: Combine multiple `type` members |
| 93 | + |
| 94 | +ℹ Safe fix |
| 95 | +47 47 | |
| 96 | +48 48 | def convert_union(union: UnionType) -> _T | None: |
| 97 | +49 49 | converters: tuple[ |
| 98 | +50 |- Union[type[_T] | type[Converter[_T]] | Converter[_T] | Callable[[str], _T]], ... # PYI055 |
| 99 | + 50 |+ Union[type[_T | Converter[_T]] | Converter[_T] | Callable[[str], _T]], ... # PYI055 |
| 100 | +51 51 | ] = union.__args__ |
| 101 | +52 52 | ... |
| 102 | +53 53 | |
| 103 | + |
| 104 | +PYI055.py:56:15: PYI055 [*] Multiple `type` members in a union. Combine them into one, e.g., `type[_T | Converter[_T]]`. |
| 105 | + | |
| 106 | +54 | def convert_union(union: UnionType) -> _T | None: |
| 107 | +55 | converters: tuple[ |
| 108 | +56 | Union[type[_T] | type[Converter[_T]]] | Converter[_T] | Callable[[str], _T], ... # PYI055 |
| 109 | + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ PYI055 |
| 110 | +57 | ] = union.__args__ |
| 111 | +58 | ... |
| 112 | + | |
| 113 | + = help: Combine multiple `type` members |
| 114 | + |
| 115 | +ℹ Safe fix |
| 116 | +53 53 | |
| 117 | +54 54 | def convert_union(union: UnionType) -> _T | None: |
| 118 | +55 55 | converters: tuple[ |
| 119 | +56 |- Union[type[_T] | type[Converter[_T]]] | Converter[_T] | Callable[[str], _T], ... # PYI055 |
| 120 | + 56 |+ Union[type[_T | Converter[_T]]] | Converter[_T] | Callable[[str], _T], ... # PYI055 |
| 121 | +57 57 | ] = union.__args__ |
| 122 | +58 58 | ... |
| 123 | + |
| 124 | + |
0 commit comments