`Community.decode_map` and associated functions are typed wrong
qstokkink opened this issue · 0 comments
qstokkink commented
Currently, the Community.decode_map
is typed as follows:
self.decode_map: list[Callable[[Community, Address, bytes], None] |
Callable[[Address, bytes], None] |
None]
This typing is mirrored in other functions like Community.add_message_handler()
.
The problem is that the typing only allows for callbacks of the following form:
def callback_type1(Community, Address, bytes) -> None: ...
def callback_type2(Address, bytes) -> None: ...
None # Undefined
However, the following two types are (/should be) also valid:
async def callback_type3(Community, Address, bytes) -> None: ...
async def callback_type4(Address, bytes) -> None: ...