petretiandrea / plugp100

Work in progress implementation of tapo protocol in python.
GNU General Public License v3.0
72 stars 27 forks source link

TypeError: Parameters to generic types must be types. Got True. (solved by using Try[bool] instead of Try[True] ) #118

Closed syntagmerror closed 1 year ago

syntagmerror commented 1 year ago

Hello,

thanks for this helpful module, and in particular the recent KLAP update thanks to which I can use again the L510/L530 bulbs.

I installed this module using PIP, and I am using Python 3.9.2 .

I'm getting the following kind of errors when importing modules in the api folder:

File "/usr/local/lib/python3.9/dist-packages/plugp100/api/light_device.py", line 29, in LightDevice async def on(self) -> Try[True]: File "/usr/lib/python3.9/typing.py", line 268, in inner return func(*args, **kwds) File "/usr/lib/python3.9/typing.py", line 976, in __class_getitem__ params = tuple(_type_check(p, msg) for p in params) File "/usr/lib/python3.9/typing.py", line 976, in params = tuple(_type_check(p, msg) for p in params) File "/usr/lib/python3.9/typing.py", line 157, in _type_check raise TypeError(f"{msg} Got {arg!r:.100}.") TypeError: Parameters to generic types must be types. Got True.

These are due to the Try[True] directives, as True is not a type but a bool value. I changed it locally to Try[bool] which solved the issue for me.

petretiandrea commented 1 year ago

Solved in 3.11.0