-
Notifications
You must be signed in to change notification settings - Fork 31
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Fix mypy complaints #137
Fix mypy complaints #137
Conversation
I'm ok with the new fields within Status class Something else is wrong with typing. RoborockBase.from_dict can return None |
Hmm Should it raise when from dict is passed a non dict and returns none? Or create an empty version of the class. I see what you mean now. What's you opinion on best typing there? |
Raising an exception is a good way to type it. But at the same time it could have a big impact on core and hacs implementation |
Hows that? A few guaranteed types - others optional None |
I'll fix lint commit in merge |
With py.typed enabled there are a lot of mypy complaints on the component side using the library.
This makes a few changes such as making some variables that we require/ know we will have into empty versions of themselves before we get them, i.e. Status.
Exporting some commonly accessed values like the name of the dock error
In the old system it was
props.status.dock_error.name But status could be none and dock_error could be None and that was two additional None checks that had to be done in the component side - this simplifies things.