micropython-stubber
micropython-stubber copied to clipboard
investigate/resolve 'import time' and 'import gc' issues
workaround for sys and gc
# pylint: disable=no-member
Module 'sys' has no 'print_exception' member Module 'gc' has no 'mem_free' member Module 'gc' has no 'threshold' member Module 'gc' has no 'mem_free' member Module 'gc' has no 'mem_alloc' member { "resource": "/c:/develop/MyPython/ESP32-P1Meter/src/main.py", "owner": "python", "code": "no-member", "severity": 8, "message": "Module 'gc' has no 'mem_free' member", "source": "pylint", "startLineNumber": 33, "startColumn": 22, "endLineNumber": 33, "endColumn": 22 }
This was caused by a priority order conflict in pyright. this is now fixed in pyright and will be updated in Pylance as well. https://github.com/microsoft/pyright/issues/2937
this change however also exposes a few new issues where the generated firmware and document stubs do not work well, and where they add little value
The best option for this is to prevent these stubs to be created in both docstubs and in create_stubs Maintain lookup table in : src/rst/lookup.py - DOCSTUB_SKIP= List[string]
# docstubs generation, exclude stub generation for below stubs.
DOCSTUB_SKIP = [
"uasyncio.rst", # can create better stubs from frozen python modules.
"builtins.rst", # conflicts with static type checking , has very little information anyway
"re.rst", # regex is too complex
]
docstubs
- [x] builtins
- [x] re
- [ ] array?
createstubs
- [ ] builtins
- [ ] re
- [ ] array?
Fixed by
- https://github.com/Josverl/micropython-stubber/pull/274 and
- https://github.com/Josverl/micropython-stubber/pull/291