-
-
Notifications
You must be signed in to change notification settings - Fork 378
Closed
Labels
Description
When using mypy and type hints for trio.abc.SendChannel and trio.abc.ReceiveChannel, mypy complains about calling things like:
channel.clone()channel.send_nowait()
This is because trio.abc.XXXChannel don't have these interfaces, only the MemoryXXXChannel does. The problem is that the trio.abc.SendChannel allow for specifying the type of object that passes through the channel via trio.abc.SendChannel[SomeType], however, the MemoryXXXChannel objects do not.
Both of the solutions for this are not ideal.
cast(MemoryXXXChannel, my_channel): this loses the object type that passes through the channel.# type: ignore: this just silences the error....