Add public missing asyncio stubs for windows and proactor files#3234
Add public missing asyncio stubs for windows and proactor files#3234JelleZijlstra merged 9 commits intopython:masterfrom
Conversation
…any necessary private return/argument types.
|
Sorry for the delay in reviewing this PR! The CI failures obviously need to be dealt with. The best option is probably to add these methods to the stub with a comment that they don't really exist at runtime. |
…with note about status at runtime
|
Alright, after a merge and fixes, build is now passing. Added the comment about runtime status of the methods in BaseProactorEventLoop |
JelleZijlstra
left a comment
There was a problem hiding this comment.
Sorry for another delay! I have some minor comments.
stdlib/3/asyncio/proactor_events.pyi
Outdated
|
|
||
| class _ProactorBasePipeTransport(transports._FlowControlMixin, transports.BaseTransport): | ||
|
|
||
| def __init__(self, loop: events.AbstractEventLoop, sock: socket, protocol: streams.StreamReaderProtocol, waiter: futures.Future[Any] = ..., extra: Mapping[Any, Any] = ..., server: events.AbstractServer = ...) -> None: ... |
There was a problem hiding this comment.
waiter, extra, and server should be Optional (also in the other classes below).
| def __init__(self, loop: events.AbstractEventLoop, sock: socket, protocol: streams.StreamReaderProtocol, waiter: futures.Future[Any] = ..., extra: Mapping[Any, Any] = ..., server: events.AbstractServer = ...) -> None: ... | ||
|
|
||
| class _ProactorDuplexPipeTransport(_ProactorReadPipeTransport, _ProactorBaseWritePipeTransport, transports.Transport): ... | ||
|
|
There was a problem hiding this comment.
Why isn't _ProactorSocketTransport included?
stdlib/3/asyncio/transports.pyi
Outdated
| def kill(self) -> None: ... | ||
|
|
||
| class _FlowControlMixin(Transport): | ||
| def __init__(self, extra: Mapping[Any, Any] = ..., loop: AbstractEventLoop = ...) -> None: ... |
There was a problem hiding this comment.
Both of the arguments are Optional
stdlib/3/asyncio/windows_events.pyi
Outdated
| import socket | ||
| from . import proactor_events, events, futures, windows_utils, selector_events | ||
|
|
||
| NULL: int = ... |
There was a problem hiding this comment.
The = ... can be omitted.
stdlib/3/asyncio/windows_events.pyi
Outdated
|
|
||
| class ProactorEventLoop(proactor_events.BaseProactorEventLoop): | ||
|
|
||
| def __init__(self, proactor: IocpProactor = ...) -> None: ... |
stdlib/3/asyncio/windows_events.pyi
Outdated
| class ProactorEventLoop(proactor_events.BaseProactorEventLoop): | ||
|
|
||
| def __init__(self, proactor: IocpProactor = ...) -> None: ... | ||
| async def create_pipe_connection(self, protocol_factory: Callable[[], events.AbstractEventLoopPolicy], address: str) -> Tuple[proactor_events._ProactorDuplexPipeTransport, events.AbstractEventLoopPolicy]: ... |
There was a problem hiding this comment.
AbstractEventLoopPolicy seems wrong. Surely it should be some sort of Protocol?
There was a problem hiding this comment.
Pretty sure you're right, it actually expects a StreamReaderProtocol from what I can tell. Not sure why I put it as AbstractEventLoopPolicy
stdlib/3/asyncio/windows_events.pyi
Outdated
|
|
||
| class IocpProactor: | ||
|
|
||
| def __init__(self, concurrency: int = ...): ... |
stdlib/3/asyncio/windows_events.pyi
Outdated
| def __repr__(self) -> str: ... | ||
| def __del__(self) -> None: ... | ||
| def set_loop(self, loop: events.AbstractEventLoop) -> None: ... | ||
| def select(self, timeout: int = ...) -> List[futures.Future[Any]]: ... |
stdlib/3/asyncio/windows_utils.pyi
Outdated
| def __repr__(self) -> str: ... | ||
| def __del__(self) -> None: ... | ||
| def __enter__(self) -> PipeHandle: ... | ||
| def __exit__(self, t: type, v: BaseException, tb: TracebackType) -> None: ... |
There was a problem hiding this comment.
Strictly all the arguments should be Optional.
…nd add missing _ProactorSocketTransport class
More work towards #2313.
Adds in all the
windows_*.pyandproactor_*.pyfiles. There are mypy test failures, but I don't want to add stubs for those methods without discussion because the real implementation doesn't actually have them.create_unix_*are not actual methods on windows-specific asyncio loops.