adafruit / Adafruit_CircuitPython_ESP_ATcontrol

Use the ESP AT command sent to communicate with the Interwebs
MIT License
20 stars 17 forks source link

Add type hints #45

Closed jsymons closed 3 years ago

jsymons commented 3 years ago

Added type hints as per https://github.com/adafruit/Adafruit_CircuitPython_ESP_ATcontrol/issues/42

Closes: #42

jepler commented 3 years ago

Thank you! I went ahead and marked this as hacktoberfest-accepted. However, our CI did find some problems that will need to be addressed before we can merge this. Take a look at the details of the checks and let us know if you need a hand in resolving them.

jsymons commented 3 years ago

@jepler Should be passing now, sorry about that.

jsymons commented 3 years ago

I've added pylint exceptions for the Pixel class that's used to type hint where a NeoPixel or DotStar device is supposed to passed through as the class is just there for type hint purposes. However on the last workflow run pylint is failing on some of the existing example code.

jepler commented 3 years ago

I fixed one of the diagnostics you are seeing over in #46. I think that

adafruit_espatcontrol/adafruit_espatcontrol_wifimanager.py:30:18: W0613: Unused argument 'value' (unused-argument)
adafruit_espatcontrol/adafruit_espatcontrol_wifimanager.py:29:8: R0201: Method could be a function (no-self-use)

are related to your new code.

The cause is the location of the pylint special comment:

        def fill(
            self, value: Union[int, Tuple[int, int, int]]
        ) -> Any:  # pylint: disable=unused-argument, no-self-use

After black decides to flow the parameter list onto multiple lines, it becomes necessary to move the # pylint comment to just after the opening ( of the parameter list, otherwise it doesn't work as desired.

jsymons commented 3 years ago

Yeah I understand why it's causing the error, just not sure why it's passing when the pre-commit hooks run locally. Should be resolved now.