From fad4e8760af0468218006c3934a42a2e44bfbfa3 Mon Sep 17 00:00:00 2001 From: Aidan <63606283+artificial-aidan@users.noreply.github.com> Date: Tue, 9 Nov 2021 14:13:08 -0800 Subject: [PATCH 1/2] Update client.py Add clarification on recv_message return value --- grpclib/client.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/grpclib/client.py b/grpclib/client.py index 9411b14..672dcb8 100644 --- a/grpclib/client.py +++ b/grpclib/client.py @@ -401,7 +401,7 @@ async def recv_message(self) -> Optional[_RecvType]: If server sends UNARY response, then you can call this coroutine only once. If server sends STREAM response, then you should call this - coroutine several times, until it returns None. To simplify you code in + coroutine several times, until it returns None when the server has ended the stream. To simplify you code in this case, :py:class:`Stream` implements async iterations protocol, so you can use it like this: From f0dc94486278ffa636f06ecdd4016fd1b00f27d7 Mon Sep 17 00:00:00 2001 From: Aidan Jensen Date: Wed, 10 Nov 2021 08:15:46 -0800 Subject: [PATCH 2/2] Fix lint, add to server --- grpclib/client.py | 7 ++++--- grpclib/server.py | 7 ++++--- 2 files changed, 8 insertions(+), 6 deletions(-) diff --git a/grpclib/client.py b/grpclib/client.py index 672dcb8..ba4a549 100644 --- a/grpclib/client.py +++ b/grpclib/client.py @@ -401,9 +401,9 @@ async def recv_message(self) -> Optional[_RecvType]: If server sends UNARY response, then you can call this coroutine only once. If server sends STREAM response, then you should call this - coroutine several times, until it returns None when the server has ended the stream. To simplify you code in - this case, :py:class:`Stream` implements async iterations protocol, so - you can use it like this: + coroutine several times, until it returns None when the server has + ended the stream. To simplify you code in this case, :py:class:`Stream` + implements async iterations protocol, so you can use it like this: .. code-block:: python3 @@ -816,6 +816,7 @@ class ServiceMethod(Generic[_SendType, _RecvType]): """ Base class for all gRPC method types """ + def __init__( self, channel: Channel, diff --git a/grpclib/server.py b/grpclib/server.py index 5bbab27..a47261c 100644 --- a/grpclib/server.py +++ b/grpclib/server.py @@ -112,9 +112,10 @@ async def recv_message(self) -> Optional[_RecvType]: If client sends UNARY request, then you can call this coroutine only once. If client sends STREAM request, then you should call this - coroutine several times, until it returns None. To simplify your code - in this case, :py:class:`Stream` class implements async iteration - protocol, so you can use it like this: + coroutine several times, until it returns None when the client has + ended the stream. To simplify your code in this case, + :py:class:`Stream` class implements async iteration protocol, so + you can use it like this: .. code-block:: python3