mirror of https://github.com/astral-sh/ruff
65 lines
1.7 KiB
Python
65 lines
1.7 KiB
Python
import builtins
|
|
from typing import Union
|
|
|
|
w: builtins.type[int] | builtins.type[str] | builtins.type[complex]
|
|
x: type[int] | type[str] | type[float]
|
|
y: builtins.type[int] | type[str] | builtins.type[complex]
|
|
z: Union[type[float], type[complex]]
|
|
z: Union[type[float, int], type[complex]]
|
|
|
|
|
|
def func(arg: type[int] | str | type[float]) -> None:
|
|
...
|
|
|
|
|
|
# OK
|
|
x: type[int, str, float]
|
|
y: builtins.type[int, str, complex]
|
|
z: Union[float, complex]
|
|
|
|
|
|
def func(arg: type[int, float] | str) -> None:
|
|
...
|
|
|
|
|
|
# OK
|
|
item: type[requests_mock.Mocker] | type[httpretty] = requests_mock.Mocker
|
|
|
|
|
|
def func():
|
|
# PYI055
|
|
x: type[requests_mock.Mocker] | type[httpretty] | type[str] = requests_mock.Mocker
|
|
y: Union[type[requests_mock.Mocker], type[httpretty], type[str]] = requests_mock.Mocker
|
|
|
|
|
|
def func():
|
|
from typing import Union as U
|
|
|
|
# PYI055
|
|
x: Union[type[requests_mock.Mocker], type[httpretty], type[str]] = requests_mock.Mocker
|
|
|
|
|
|
def convert_union(union: UnionType) -> _T | None:
|
|
converters: tuple[
|
|
type[_T] | type[Converter[_T]] | Converter[_T] | Callable[[str], _T], ... # PYI055
|
|
] = union.__args__
|
|
...
|
|
|
|
def convert_union(union: UnionType) -> _T | None:
|
|
converters: tuple[
|
|
Union[type[_T] | type[Converter[_T]] | Converter[_T] | Callable[[str], _T]], ... # PYI055
|
|
] = union.__args__
|
|
...
|
|
|
|
def convert_union(union: UnionType) -> _T | None:
|
|
converters: tuple[
|
|
Union[type[_T] | type[Converter[_T]]] | Converter[_T] | Callable[[str], _T], ... # PYI055
|
|
] = union.__args__
|
|
...
|
|
|
|
def convert_union(union: UnionType) -> _T | None:
|
|
converters: tuple[
|
|
Union[type[_T] | type[Converter[_T]] | str] | Converter[_T] | Callable[[str], _T], ... # PYI055
|
|
] = union.__args__
|
|
...
|