Please consider
import dataclasses as dtc
import asyncio
PublishedMessagesVar = dict[int, 'PublishedMessages']
@dtc.dataclass(frozen=True, slots=True)
class PublishedMessages:
task: asyncio.Future[int]
left: int
right: int
then
$ mypy t2.py
t2.py:7: error: "PublishedMessages" both defines "__slots__" and is used with "slots=True"
Found 1 error in 1 file (checked 1 source file)
Above with Mypy 0.930, Python 3.10.1
There is no problem
- when line with
PublishedMessagesVar is removed
- with Mypy 0.921