mirror of
https://github.com/davidhalter/typeshed.git
synced 2025-12-09 05:24:52 +08:00
Address parameter of datagram_received can be of type tuple[int, int] (#7366)
This commit is contained in:
@@ -1,5 +1,6 @@
|
||||
import sys
|
||||
from asyncio import transports
|
||||
from typing import Any
|
||||
|
||||
if sys.version_info >= (3, 7):
|
||||
__all__ = ("BaseProtocol", "Protocol", "DatagramProtocol", "SubprocessProtocol", "BufferedProtocol")
|
||||
@@ -24,7 +25,11 @@ if sys.version_info >= (3, 7):
|
||||
|
||||
class DatagramProtocol(BaseProtocol):
|
||||
def connection_made(self, transport: transports.DatagramTransport) -> None: ... # type: ignore[override]
|
||||
def datagram_received(self, data: bytes, addr: tuple[str, int]) -> None: ...
|
||||
# addr can be a tuple[int, int] for some unusual protocols like socket.AF_NETLINK.
|
||||
# Use tuple[str | Any, int] to not cause typechecking issues on most usual cases.
|
||||
# This could be improved by using tuple[AnyOf[str, int], int] if the AnyOf feature is accepted.
|
||||
# See https://github.com/python/typing/issues/566
|
||||
def datagram_received(self, data: bytes, addr: tuple[str | Any, int]) -> None: ...
|
||||
def error_received(self, exc: Exception) -> None: ...
|
||||
|
||||
class SubprocessProtocol(BaseProtocol):
|
||||
|
||||
Reference in New Issue
Block a user