Skip to content

Commit 7aee410

Browse files
Apply ruff/pyupgrade rule UP007
UP007 Use `X | Y` for type annotations
1 parent 760db7c commit 7aee410

File tree

1 file changed

+8
-13
lines changed

1 file changed

+8
-13
lines changed

uvloop/loop.pyi

Lines changed: 8 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -10,14 +10,13 @@ from typing import (
1010
Optional,
1111
Sequence,
1212
TypeVar,
13-
Union,
1413
overload,
1514
)
1615

1716
_T = TypeVar('_T')
1817
_Context = dict[str, Any]
1918
_ExceptionHandler = Callable[[asyncio.AbstractEventLoop, _Context], Any]
20-
_SSLContext = Union[bool, None, ssl.SSLContext]
19+
_SSLContext = bool | None | ssl.SSLContext
2120
_ProtocolT = TypeVar("_ProtocolT", bound=asyncio.BaseProtocol)
2221

2322
class Loop:
@@ -44,7 +43,7 @@ class Loop:
4443
def create_future(self) -> asyncio.Future[Any]: ...
4544
def create_task(
4645
self,
47-
coro: Union[Awaitable[_T], Generator[Any, None, _T]],
46+
coro: Awaitable[_T] | Generator[Any, None, _T],
4847
*,
4948
name: Optional[str] = ...,
5049
) -> asyncio.Task[_T]: ...
@@ -65,8 +64,8 @@ class Loop:
6564
def run_until_complete(self, future: Awaitable[_T]) -> _T: ...
6665
async def getaddrinfo(
6766
self,
68-
host: Optional[Union[str, bytes]],
69-
port: Optional[Union[str, bytes, int]],
67+
host: Optional[str | bytes],
68+
port: Optional[str | bytes | int],
7069
*,
7170
family: int = ...,
7271
type: int = ...,
@@ -78,16 +77,12 @@ class Loop:
7877
SocketKind,
7978
int,
8079
str,
81-
Union[tuple[str, int], tuple[str, int, int, int]],
80+
tuple[str, int] | tuple[str, int, int, int],
8281
]
8382
]: ...
8483
async def getnameinfo(
8584
self,
86-
sockaddr: Union[
87-
tuple[str, int],
88-
tuple[str, int, int],
89-
tuple[str, int, int, int]
90-
],
85+
sockaddr: tuple[str, int] | tuple[str, int, int] | tuple[str, int, int, int],
9186
flags: int = ...,
9287
) -> tuple[str, str]: ...
9388
async def start_tls(
@@ -105,7 +100,7 @@ class Loop:
105100
async def create_server(
106101
self,
107102
protocol_factory: asyncio.events._ProtocolFactory,
108-
host: Optional[Union[str, Sequence[str]]] = ...,
103+
host: Optional[str | Sequence[str]] = ...,
109104
port: int = ...,
110105
*,
111106
family: int = ...,
@@ -226,7 +221,7 @@ class Loop:
226221
async def subprocess_shell(
227222
self,
228223
protocol_factory: Callable[[], _ProtocolT],
229-
cmd: Union[bytes, str],
224+
cmd: bytes | str,
230225
*,
231226
stdin: Any = ...,
232227
stdout: Any = ...,

0 commit comments

Comments
 (0)