From 318046fa12525f29824840bb4a9e8a17f7a459b7 Mon Sep 17 00:00:00 2001 From: Vladimir Magamedov Date: Sun, 1 Apr 2018 00:44:34 +0300 Subject: [PATCH] Fixed deprecation warning and updated changelog --- docs/changelog/index.rst | 6 ++++++ grpclib/server.py | 12 ++++++++---- 2 files changed, 14 insertions(+), 4 deletions(-) diff --git a/docs/changelog/index.rst b/docs/changelog/index.rst index 0b438f5..806109e 100644 --- a/docs/changelog/index.rst +++ b/docs/changelog/index.rst @@ -1,6 +1,12 @@ Changelog ========= +next +~~~~ + + - deprecated ``end`` keyword-only argument in the + :py:meth:`grpclib.server.Stream.send_message` method on the server-side + 0.1.0 ~~~~~ diff --git a/grpclib/server.py b/grpclib/server.py index 1392eb0..0867382 100644 --- a/grpclib/server.py +++ b/grpclib/server.py @@ -45,10 +45,14 @@ class Stream(StreamIterator): ('content-type', CONTENT_TYPE)]) self._send_initial_metadata_done = True - async def send_message(self, message, *, end=False): - if end: - warnings.warn('"end" argument is deprecated, ' - 'use "send_trailing_metadata" explicitly') + async def send_message(self, message, **kwargs): + if 'end' in kwargs: + warnings.warn('"end" argument is deprecated, use ' + '"stream.send_trailing_metadata" explicitly', + stacklevel=2) + + end = kwargs.pop('end', False) + assert not kwargs, kwargs if not self._send_initial_metadata_done: await self.send_initial_metadata()