You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
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....
The text was updated successfully, but these errors were encountered:
When using
mypy
and type hints fortrio.abc.SendChannel
andtrio.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 theMemoryXXXChannel
does. The problem is that thetrio.abc.SendChannel
allow for specifying the type of object that passes through the channel viatrio.abc.SendChannel[SomeType]
, however, theMemoryXXXChannel
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....The text was updated successfully, but these errors were encountered: