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
@glenn20 , I hopy you can assist in improvin 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]
classESPNow(ESPNowBase, Iterator):
#....defsend(
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."""
...
pyright: error: Argument of type "Literal[True]" cannot be assigned to parameter "mac" of type "_MACAddress | None" in function "send"
mypy: error: Argument 3 to "send" of "ESPNow" has incompatible type "bool"; expected "bytes | None" [arg-type]
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.
reacted with thumbs up emoji reacted with thumbs down emoji reacted with laugh emoji reacted with hooray emoji reacted with confused emoji reacted with heart emoji reacted with rocket emoji reacted with eyes emoji
-
@glenn20 , I hopy you can assist in improvin 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.
If I check this with the Sender: example on https://docs.micropython.org/en/latest/library/espnow.html#module-espnow
then both pyright and mypy report an error on the
e.send
in:error: Argument of type "Literal[True]" cannot be assigned to parameter "mac" of type "_MACAddress | None" in function "send"
error: Argument 3 to "send" of "ESPNow" has incompatible type "bool"; expected "bytes | None" [arg-type]
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.
All reactions