---
source: crates/ruff_linter/src/rules/flake8_pyi/mod.rs
---
PYI055.py:31:8: PYI055 [*] Multiple `type` members in a union. Combine them into one, e.g., `type[requests_mock.Mocker | httpretty | str]`.
   |
29 | def func():
30 |     # PYI055
31 |     x: type[requests_mock.Mocker] | type[httpretty] | type[str] = requests_mock.Mocker
   |        ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ PYI055
32 |     y: Union[type[requests_mock.Mocker], type[httpretty], type[str]] = requests_mock.Mocker
   |
   = help: Combine multiple `type` members

ℹ Safe fix
28 28 | 
29 29 | def func():
30 30 |     # PYI055
31    |-    x: type[requests_mock.Mocker] | type[httpretty] | type[str] = requests_mock.Mocker
   31 |+    x: type[requests_mock.Mocker | httpretty | str] = requests_mock.Mocker
32 32 |     y: Union[type[requests_mock.Mocker], type[httpretty], type[str]] = requests_mock.Mocker
33 33 | 
34 34 | 

PYI055.py:32:8: PYI055 [*] Multiple `type` members in a union. Combine them into one, e.g., `type[Union[requests_mock.Mocker, httpretty, str]]`.
   |
30 |     # PYI055
31 |     x: type[requests_mock.Mocker] | type[httpretty] | type[str] = requests_mock.Mocker
32 |     y: Union[type[requests_mock.Mocker], type[httpretty], type[str]] = requests_mock.Mocker
   |        ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ PYI055
   |
   = help: Combine multiple `type` members

ℹ Safe fix
29 29 | def func():
30 30 |     # PYI055
31 31 |     x: type[requests_mock.Mocker] | type[httpretty] | type[str] = requests_mock.Mocker
32    |-    y: Union[type[requests_mock.Mocker], type[httpretty], type[str]] = requests_mock.Mocker
   32 |+    y: type[Union[requests_mock.Mocker, httpretty, str]] = requests_mock.Mocker
33 33 | 
34 34 | 
35 35 | def func():

PYI055.py:39:8: PYI055 [*] Multiple `type` members in a union. Combine them into one, e.g., `type[Union[requests_mock.Mocker, httpretty, str]]`.
   |
38 |     # PYI055
39 |     x: Union[type[requests_mock.Mocker], type[httpretty], type[str]] = requests_mock.Mocker
   |        ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ PYI055
   |
   = help: Combine multiple `type` members

ℹ Safe fix
36 36 |     from typing import Union as U
37 37 | 
38 38 |     # PYI055
39    |-    x: Union[type[requests_mock.Mocker], type[httpretty], type[str]] = requests_mock.Mocker
   39 |+    x: type[Union[requests_mock.Mocker, httpretty, str]] = requests_mock.Mocker
40 40 | 
41 41 | 
42 42 | def convert_union(union: UnionType) -> _T | None:

PYI055.py:44:9: PYI055 [*] Multiple `type` members in a union. Combine them into one, e.g., `type[_T | Converter[_T]]`.
   |
42 | def convert_union(union: UnionType) -> _T | None:
43 |     converters: tuple[
44 |         type[_T] | type[Converter[_T]] | Converter[_T] | Callable[[str], _T], ...  # PYI055
   |         ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ PYI055
45 |     ] = union.__args__
46 |     ...
   |
   = help: Combine multiple `type` members

ℹ Safe fix
41 41 | 
42 42 | def convert_union(union: UnionType) -> _T | None:
43 43 |     converters: tuple[
44    |-        type[_T] | type[Converter[_T]] | Converter[_T] | Callable[[str], _T], ...  # PYI055
   44 |+        type[_T | Converter[_T]] | Converter[_T] | Callable[[str], _T], ...  # PYI055
45 45 |     ] = union.__args__
46 46 |     ...
47 47 | 

PYI055.py:50:15: PYI055 [*] Multiple `type` members in a union. Combine them into one, e.g., `type[_T | Converter[_T]]`.
   |
48 | def convert_union(union: UnionType) -> _T | None:
49 |     converters: tuple[
50 |         Union[type[_T] | type[Converter[_T]] | Converter[_T] | Callable[[str], _T]], ...  # PYI055
   |               ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ PYI055
51 |     ] = union.__args__
52 |     ...
   |
   = help: Combine multiple `type` members

ℹ Safe fix
47 47 | 
48 48 | def convert_union(union: UnionType) -> _T | None:
49 49 |     converters: tuple[
50    |-        Union[type[_T] | type[Converter[_T]] | Converter[_T] | Callable[[str], _T]], ...  # PYI055
   50 |+        Union[type[_T | Converter[_T]] | Converter[_T] | Callable[[str], _T]], ...  # PYI055
51 51 |     ] = union.__args__
52 52 |     ...
53 53 | 

PYI055.py:56:15: PYI055 [*] Multiple `type` members in a union. Combine them into one, e.g., `type[_T | Converter[_T]]`.
   |
54 | def convert_union(union: UnionType) -> _T | None:
55 |     converters: tuple[
56 |         Union[type[_T] | type[Converter[_T]]] | Converter[_T] | Callable[[str], _T], ...  # PYI055
   |               ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ PYI055
57 |     ] = union.__args__
58 |     ...
   |
   = help: Combine multiple `type` members

ℹ Safe fix
53 53 | 
54 54 | def convert_union(union: UnionType) -> _T | None:
55 55 |     converters: tuple[
56    |-        Union[type[_T] | type[Converter[_T]]] | Converter[_T] | Callable[[str], _T], ...  # PYI055
   56 |+        Union[type[_T | Converter[_T]]] | Converter[_T] | Callable[[str], _T], ...  # PYI055
57 57 |     ] = union.__args__
58 58 |     ...
59 59 | 

PYI055.py:62:15: PYI055 [*] Multiple `type` members in a union. Combine them into one, e.g., `type[_T | Converter[_T]]`.
   |
60 | def convert_union(union: UnionType) -> _T | None:
61 |     converters: tuple[
62 |         Union[type[_T] | type[Converter[_T]] | str] | Converter[_T] | Callable[[str], _T], ...  # PYI055
   |               ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ PYI055
63 |     ] = union.__args__
64 |     ...
   |
   = help: Combine multiple `type` members

ℹ Safe fix
59 59 | 
60 60 | def convert_union(union: UnionType) -> _T | None:
61 61 |     converters: tuple[
62    |-        Union[type[_T] | type[Converter[_T]] | str] | Converter[_T] | Callable[[str], _T], ...  # PYI055
   62 |+        Union[type[_T | Converter[_T]] | str] | Converter[_T] | Callable[[str], _T], ...  # PYI055
63 63 |     ] = union.__args__
64 64 |     ...


