-
Notifications
You must be signed in to change notification settings - Fork 105
Description
For a couple of years now (since this commit) the Micropython implementations of the standard libraries have been importable without needing a u
prefix, so you can just import json
or asyncio
instead of ujson
or uasyncio
. This is now the preferred way to use these libraries, and their example code generally uses them this way. Unfortunately the current Intellij plugin does not recognise these imports as fetching the Micropython version, and it uses the type hints from the standard CPython libraries instead.
The Micropython versions of these libraries have some minor differences and extensions, so otherwise working code that say await asyncio.sleep_ms(100)
gets flagged with a Cannot find reference 'sleep_ms' in '__init__.pyi'
and if you remove the await
then it fails to flag the Coroutine 'sleep_ms' is not awaited
that it should.
It would be very helpful if the stub .pyi
files were updated to provide Micropython-specific hints for the standard libraries under the standard names as well as with the u
prefix, so that it properly hints code written in the now-preferred manner.