Fixed deprecation warning and updated changelog

This commit is contained in:
Vladimir Magamedov 2018-04-01 00:44:34 +03:00
parent 611dd3e935
commit 318046fa12
2 changed files with 14 additions and 4 deletions

View File

@ -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
~~~~~

View File

@ -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()