Fix type annots

contexts
Tyler Goodlet 2019-01-16 16:50:30 -05:00
parent 7cec62d585
commit c58a6ea80f
1 changed files with 4 additions and 5 deletions

View File

@ -2,13 +2,12 @@
Messaging pattern APIs and helpers. Messaging pattern APIs and helpers.
""" """
import typing import typing
from typing import Dict from typing import Dict, Any
from functools import partial from functools import partial
import trio import trio
import wrapt import wrapt
from ._ipc import Context
from .log import get_logger from .log import get_logger
from . import current_actor from . import current_actor
@ -18,8 +17,8 @@ log = get_logger('messaging')
async def fan_out_to_ctxs( async def fan_out_to_ctxs(
pub_gen: typing.AsyncGenerator, pub_gen: typing.Callable, # it's an async gen ... gd mypy
topics2ctxs: Dict[str, Context], topics2ctxs: Dict[str, set],
topic_key: str = 'key', topic_key: str = 'key',
) -> None: ) -> None:
"""Request and fan out quotes to each subscribed actor channel. """Request and fan out quotes to each subscribed actor channel.
@ -30,7 +29,7 @@ async def fan_out_to_ctxs(
async for published in pub_gen( async for published in pub_gen(
get_topics=get_topics, get_topics=get_topics,
): ):
ctx_payloads = {} ctx_payloads: Dict[str, Any] = {}
for packet_key, data in published.items(): for packet_key, data in published.items():
# grab each suscription topic using provided key for lookup # grab each suscription topic using provided key for lookup
topic = data[topic_key] topic = data[topic_key]