Josverl / micropython-stubber

Generate and maintain stubs for different MicroPython ports to use with VSCode and Pylance, PyRight, Thonny, PyCharm or MyPy
https://micropython-stubber.readthedocs.io
Other
172 stars 14 forks source link

createsubs.py should create an class __init__ : def __init__(self, *args,**argv ) -> None: ... #150

Closed Josverl closed 2 years ago

Josverl commented 2 years ago

pyright throws error :

os.mount(machine.SDCard(slot=2, width=1, sck=18, miso=19, mosi=23, cs=4), "/sd")  # SPI 1 bit M5Stack Core
` ``
 C:\develop\MyPython\micropython-stubber\board\boot.py:31:22 - error: Expected no arguments to "SDCard" constructor (reportGeneralTypeIssues)
1 error, 1 warning, 0 infos

createsubs 
    def __init__(self, *args,**argv ) -> None: ...

.py
```python 
class SDCard:
    """"""
   def __init__(self, *args,**argv ) -> None:
       ...

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

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

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

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

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

pyi

class SDCard:
    # def __init__(self, *args,**argv ) -> None: ...
    def deinit(self, *args) -> Any: ...
    def info(self, *args) -> Any: ...
    def ioctl(self, *args) -> Any: ...
    def readblocks(self, *args) -> Any: ...
    def writeblocks(self, *args) -> Any: ...

pyrightconfig :

    "executionEnvironments": [
        {
            "root": "board",
            "pythonVersion": "3.6",
            "pythonPlatform": "Linux",
            "extraPaths": [
                "board/lib",
                //"all-stubs/cpython_core-pycopy",
                "all-stubs/micropython-v1_17-frozen/esp32/RELEASE",
                "all-stubs/micropython-v1_17-esp32",
                "all-stubs/micropython-v1_17-pyboard",
//                "all-stubs/micropython-latest-docstubs",
            ],
            "verboseOutput": true
        },
Josverl commented 2 years ago

createsubs v1.5.4 Better exeptions fix missed updates to mem and stub variants e1cd179757156f8d978eef27bf3d69d4c14b0971