tuya / tuya-iot-python-sdk

Tuya IoT Python SDK for Tuya Open API.
MIT License
117 stars 47 forks source link

Incorrect type hint #34

Open umonaca opened 2 years ago

umonaca commented 2 years ago

https://github.com/tuya/tuya-iot-python-sdk/blob/83f1e999d75ef87b2170ffbbb239ca8651dab0c3/tuya_iot/openapi.py#L230

It should be dict[str, Any] | None because there is a return None statement below.

frenck commented 2 years ago

Honestly, that should not return None, it should raise an exception instead.

umonaca commented 2 years ago

Honestly, that should not return None, it should raise an exception instead.

It's weird to me that this framework rarely raises any exceptions, but it silently consumes all types of exceptions and relies on side effects to log errors instead.

frenck commented 2 years ago

I agree, hence I think the typehint is actually the one thing that is right 😉