forked from goodboy/tractor
1
0
Fork 0

Comment out `MsgStream` for now

stream_contexts
Tyler Goodlet 2021-04-28 16:40:38 -04:00
parent b1f657e246
commit fc36e73628
1 changed files with 11 additions and 13 deletions

View File

@ -101,7 +101,7 @@ def stream(func):
params = sig.parameters params = sig.parameters
if 'stream' not in params and 'ctx' in params: if 'stream' not in params and 'ctx' in params:
warnings.warn( warnings.warn(
"`@tractr.stream decorated funcs should now declare a `stream` " "`@tractor.stream decorated funcs should now declare a `stream` "
" arg, `ctx` is now designated for use with @tractor.context", " arg, `ctx` is now designated for use with @tractor.context",
DeprecationWarning, DeprecationWarning,
stacklevel=2, stacklevel=2,
@ -141,7 +141,6 @@ class ReceiveMsgStream(trio.abc.ReceiveChannel):
self._ctx = ctx self._ctx = ctx
self._rx_chan = rx_chan self._rx_chan = rx_chan
self._portal = portal self._portal = portal
# self._chan = portal.channel
self._shielded = False self._shielded = False
# delegate directly to underlying mem channel # delegate directly to underlying mem channel
@ -152,7 +151,6 @@ class ReceiveMsgStream(trio.abc.ReceiveChannel):
try: try:
msg = await self._rx_chan.receive() msg = await self._rx_chan.receive()
return msg['yield'] return msg['yield']
# return msg['yield']
except KeyError: except KeyError:
# internal error should never get here # internal error should never get here
@ -249,14 +247,14 @@ class ReceiveMsgStream(trio.abc.ReceiveChannel):
# ) # )
class MsgStream(ReceiveMsgStream, trio.abc.Channel): # class MsgStream(ReceiveMsgStream, trio.abc.Channel):
""" # """
Bidirectional message stream for use within an inter-actor actor # Bidirectional message stream for use within an inter-actor actor
``Context```. # ``Context```.
""" # """
async def send( # async def send(
self, # self,
data: Any # data: Any
) -> None: # ) -> None:
await self._ctx.chan.send({'yield': data, 'cid': self._ctx.cid}) # await self._ctx.chan.send({'yield': data, 'cid': self._ctx.cid})