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

resolve errors flagged by MyPy

Open Josverl opened this issue 2 years ago • 0 comments

when running MyPy on the snippets there are a number of additional errors flagged Need to determine if these are false positives or that they need to be fixed

repro:

install micropython-esp32-stubs in typings folder set MYPYPATH to 'typings'

$env:MYPYPATH="./typings"

# avoid stdlib conflicts 
del typings/os.pyi
del typings/sys.pyi

mypy .\src
(.venv) PS C:\develop\MyPython\demo> mypy .\src --no-incremental             
typings\stdlib\os\__init__.pyi:24: error: Module "io" has no attribute "BufferedRandom"  [attr-defined]
typings\stdlib\os\__init__.pyi:24: error: Module "io" has no attribute "BufferedReader"  [attr-defined]
typings\stdlib\os\__init__.pyi:368: error: Overloaded function signatures 1 and 2 overlap with incompatible return types  [misc]
typings\stdlib\os\__init__.pyi:370: error: Overloaded function signatures 2 and 3 overlap with incompatible return types  [misc]
typings\stdlib\os\__init__.pyi:518: error: Overloaded function signatures 1 and 7 overlap with incompatible return types  [misc]
typings\stdlib\os\__init__.pyi:529: error: Overloaded function signatures 2 and 6 overlap with incompatible return types  [misc]
typings\stdlib\os\__init__.pyi:529: error: Overloaded function signatures 2 and 7 overlap with incompatible return types  [misc]
typings\stdlib\os\__init__.pyi:551: error: Overloaded function signatures 4 and 6 overlap with incompatible return types  [misc]
typings\stdlib\os\__init__.pyi:551: error: Overloaded function signatures 4 and 7 overlap with incompatible return types  [misc]
src\snippets\common\validate_sys.py:22: error: Module has no attribute "print_exception"  [attr-defined]
src\snippets\common\validate_sys.py:22: note: Error code "attr-defined" not covered by "type: ignore" comment
src\snippets\common\validate_sys.py:29: error: Module has no attribute "atexit"; maybe "exit"?  [attr-defined]
src\snippets\common\validate_sys.py:29: note: Error code "attr-defined" not covered by "type: ignore" comment
src\snippets\stm32\validate_pyb.py:4: error: Cannot find implementation or library stub for module named "pyb"  [import]
src\snippets\rp2\pio_exec.py:9: error: Cannot find implementation or library stub for module named "rp2"  [import]
src\snippets\rp2\mod_rp2.py:5: error: Cannot find implementation or library stub for module named "rp2"  [import]
src\snippets\rp2\mod_rp2.py:5: note: See https://mypy.readthedocs.io/en/stable/running_mypy.html#missing-imports
src\snippets\rp2\mod_machine.py:80: error: Incompatible types in assignment (expression has type "I2C", variable has type "SoftI2C")  [assignment]
src\snippets\rp2\mod_machine.py:81: error: Incompatible types in assignment (expression has type "I2C", variable has type "SoftI2C")  [assignment]
src\snippets\esp8266\validate_machine_8266.py:19: error: Incompatible types in assignment (expression has type "DHT22", variable has type
 "DHT11")  [assignment]
src\snippets\esp8266\validate_dht_8266.py:13: error: Incompatible types in assignment (expression has type "DHT22", variable has type "DHT11")  [assignment]
src\snippets\esp32\validate_machine_2.py:120: error: Incompatible types in assignment (expression has type "I2C", variable has type "SoftI2C")  [assignment]
src\snippets\esp32\validate_machine_2.py:121: error: Incompatible types in assignment (expression has type "I2C", variable has type "SoftI2C")  [assignment]
src\snippets\esp32\validate_machine_2.py:124: error: Incompatible types in assignment (expression has type "I2C", variable has type "SoftI2C")  [assignment]
src\snippets\esp32\validate_dht_32.py:13: error: Incompatible types in assignment (expression has type "DHT22", variable has type "DHT11")  [assignment]
src\snippets\common\validate_uio.py:8: error: Incompatible types in assignment (expression has type "BytesIO", variable has type "StringIO")  [assignment]
src\snippets\common\validate_machine_1.py:88: error: Incompatible types in assignment (expression has type "I2C", variable has type "SoftI2C")  [assignment]
src\snippets\common\validate_machine_1.py:89: error: Incompatible types in assignment (expression has type "I2C", variable has type "SoftI2C")  [assignment]

Josverl avatar Mar 04 '23 00:03 Josverl