Josverl/micropython-stubs

Trying to use this for RPI Pico W

antoinegomez opened this issue · 4 comments

I can see the definition on the line here:

def init(self, *, mode=PERIODIC, period=-1, callback=None) -> None:

Not matching the lib for RP2040.

Here is the error I get:

image

Can you point me towards the right resources so I can build the stubs for it?
I am quite noob and not a versed python developer.

Thank you for your time and help.

Just to add some to this issue:

I've just generated stubs from my pico-w, and the definition that is generated is this:

class Timer:
    ''
    ONE_SHOT = 0 # type: int
    PERIODIC = 1 # type: int
    def deinit(self, *args) -> Any:
        ...

    def init(self, *args) -> Any:
        ...

If you generate them, that should work for you as well, but for some reason when generating stubs micropython-stubber seems to be generating all function arguments as just *args and giving no type information.

The machine.Timber object's docs are here: https://docs.micropython.org/en/latest/library/machine.Timer.html, which seem to indicate to me that there is no freq parameter.

The documentation on this appears to be incorrect, there is a PR on already to correct this, but I plan to patch it in the exeptionlist if that does not get merged

the documentation PR has been merged and based on that the issue should be resolved in the next release