-
@glenn20 , I hope you can assist in improving the type-stubs for this. I am in process of adding parameter types to the type-stubs, and I use the examples from the documentation to help verify the level of correctness of the stubs. #espnow.pyi
_MACAddress: TypeAlias = bytes
_PeerInfo: TypeAlias = Tuple[_MACAddress, bytes, int, int, bool]
class ESPNow(ESPNowBase, Iterator):
#....
def send(
self,
peer: _MACAddress,
msg: str | bytes,
mac: _MACAddress | None = None,
sync: bool = True,
) -> bool:
"""Send the data contained in ``msg`` to the peer with given network ``mac`` address."""
... If I check this with the Sender: example on https://docs.micropython.org/en/latest/library/espnow.html#module-espnow for i in range(100):
e.send(peer, str(i) * 20, True)
before digging deeper I wanted to check if I have understood the documentation correctly, this is a documentation bug, or that this is a form that the typecheckers cannot handle by default. Code sample in pyright playground |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 2 replies
-
@Josverl , sorry for the slow response. Thanks again for your work on the stubs... they make coding in micropython so much more productive :). I believe, you should change
to
ie. remove the There is still a gotcha in the api, in that if only one argument is provided, it is expected to be a string (the message). I supported that as a convenience to send broadcast messages. |
Beta Was this translation helpful? Give feedback.
@Josverl , sorry for the slow response.
Thanks again for your work on the stubs... they make coding in micropython so much more productive :).
I believe, you should change
to
ie. remove the
mac
argument. In the docs, I use the namemac
for the first argument (that you have calledpeer
). I started withpeer
, but fo…