micropython-stubber icon indicating copy to clipboard operation
micropython-stubber copied to clipboard

investigate/resolve 'import time' and 'import gc' issues

Open Josverl opened this issue 5 years ago • 1 comments

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 }

Josverl avatar Oct 27 '20 20:10 Josverl

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?

Josverl avatar Feb 11 '22 11:02 Josverl

Fixed by

  • https://github.com/Josverl/micropython-stubber/pull/274 and
  • https://github.com/Josverl/micropython-stubber/pull/291

Josverl avatar Dec 17 '22 23:12 Josverl