-
-
Notifications
You must be signed in to change notification settings - Fork 357
Closed
Labels
good first issuetypingAdding static types to trio's interfaceAdding static types to trio's interface
Description
python/typeshed#11250 changed the signatures of SocketType.recv
and friends, so it should now be possible to change
Lines 1115 to 1129 in 4e979bf
# Not possible to typecheck with a Callable (due to DefaultArg), nor with a | |
# callback Protocol (https://github.com/python/typing/discussions/1040) | |
# but this seems to work. If not explicitly defined then pyright --verifytypes will | |
# complain about AmbiguousType | |
if TYPE_CHECKING: | |
def recv(__self, __buflen: int, __flags: int = 0) -> Awaitable[bytes]: ... | |
# _make_simple_sock_method_wrapper is typed, so this checks that the above is correct | |
# this requires that we refrain from using `/` to specify pos-only | |
# args, or mypy thinks the signature differs from typeshed. | |
recv = _make_simple_sock_method_wrapper( | |
_stdlib_socket.socket.recv, | |
_core.wait_readable, | |
) |
although I'm surprised that mypy haven't started complaining from bumping typeshed. Maybe they did some backwards compatibility thing? Or haven't bumped typeshed?
Metadata
Metadata
Assignees
Labels
good first issuetypingAdding static types to trio's interfaceAdding static types to trio's interface