[simple-websocket]: add stubs for simple-websocket#14868
[simple-websocket]: add stubs for simple-websocket#14868srittau merged 6 commits intopython:mainfrom
Conversation
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
| async def connect(self) -> None: ... | ||
| async def handshake(self) -> None: ... | ||
| async def send(self, data: bytes | Any) -> None: ... | ||
| async def receive(self, timeout: float | None = None) -> bytes | str | Any: ... |
There was a problem hiding this comment.
We now require a comment whenever Any is used in a non-obvious way.
There was a problem hiding this comment.
this was an error on my part, thanks - it was meant to be None :)
There was a problem hiding this comment.
i'll go over all the places that have any 👍🏼
|
|
||
| class AioServer(AioBase): | ||
| request: _AioServerRequest | ||
| headers: dict[str, Any] |
There was a problem hiding this comment.
Here we don't require it, because dict[str, Any] is a very common idiom and obvious.
| @type_check_only | ||
| class _ThreadClassProtocol(Protocol): | ||
| name: str | ||
| def __init__(self, target: Callable[..., Any], *args: Any, **kwargs: Any) -> None: ... |
There was a problem hiding this comment.
Can't we use a ParamSpec here?
There was a problem hiding this comment.
on second read - it doesn't actually need args or kwargs - the code only uses target
|
|
||
| @type_check_only | ||
| class _SelectorClassProtocol(Protocol): | ||
| def register(self, fileobj: FileDescriptorLike, events: _EventMask, data: Any = None) -> SelectorKey: ... |
There was a problem hiding this comment.
As above: We need a comment for how data is used and why it's Any.
This comment has been minimized.
This comment has been minimized.
|
According to mypy_primer, this change has no effect on the checked open source code. 🤖🎉 |
source repo: https://github.com/miguelgrinberg/simple-websocket
in his other repositories (
python-socketio,python-engineioand more) the maintainer stated that they aren't interested in adding in-line types to the repo, hence the addition to typeshed