Update dynalite library and minor changes#34618
Conversation
| { | ||
| vol.Required(CONF_NAME): cv.string, | ||
| vol.Optional(CONF_TEMPLATE): cv.string, | ||
| vol.Optional(CONF_TEMPLATE): vol.In(DEFAULT_TEMPLATES.keys()), |
There was a problem hiding this comment.
keys() is the default iterator.
| vol.Optional(CONF_TEMPLATE): vol.In(DEFAULT_TEMPLATES.keys()), | |
| vol.Optional(CONF_TEMPLATE): vol.In(DEFAULT_TEMPLATES), |
|
|
||
| @callback | ||
| def update_device(self, device: "DynaliteBaseDevice") -> None: | ||
| def update_device(self, device: "DynaliteBaseDevice" = None) -> None: |
There was a problem hiding this comment.
This type should be optional since it can be none:
| def update_device(self, device: "DynaliteBaseDevice" = None) -> None: | |
| def update_device(self, device: Optional["DynaliteBaseDevice"] = None) -> None: |
from typing import Optional| from .const import ENTITY_PLATFORMS, LOGGER | ||
| from .convert_config import convert_config | ||
|
|
||
| if TYPE_CHECKING: # pragma: no cover |
There was a problem hiding this comment.
This needs to remain there or else the type checking won't work. (you can test it with mypy <path to file>)
There was a problem hiding this comment.
that is exactly the weird behavior i had. when i moved it from DynaliteBaseDevice to Optional, flake8 didn't let me commit because it said it is unused. When I removed it, flake8 worked and mypy had no problem (see checks below). Weird.
Perhaps I can remove the Optional[] here? Since we don't define the flag '--no-implicit-optional", if it is defined with a default value of NULL, mypy understands its Optional by default?
There was a problem hiding this comment.
in any case, i figured out that i don't need "if TYPE_CHECKING" since there is no circular dependency, so while I still don't understnad why it happened, the problem is no longer relevant
There was a problem hiding this comment.
Oh I missed that you import it now from the package directly. ok 👍
balloob
left a comment
There was a problem hiding this comment.
Ok to merge once the type checking part has been put back.
Breaking change
not a breaking change
Proposed change
Type of change
Example entry for
configuration.yaml:# Example configuration.yamlAdditional information
Checklist
black --fast homeassistant tests)If user exposed functionality or configuration variables are added/changed:
If the code communicates with devices, web services, or third-party tools:
Updated and included derived files by running:
python3 -m script.hassfest.requirements_all.txt.Updated by running
python3 -m script.gen_requirements_all..coveragerc.The integration reached or maintains the following Integration Quality Scale: