Fix ty type-check failure in select.py
_display_option read self._bound.desc.display_fn without narrowing desc's type first, unlike every other method in this class -- desc is typed as the base SamsungEntityDescription, which has no display_fn (only SelectDesc does). Cast it, matching the rest of the class.
This commit is contained in:
1 file changed
+1
-1
@@ -97,7 +97,7 @@ class LocalThingsSelect(LocalThingsEntity, SelectEntity):
|
|||||||
|
|
||||||
def _display_option(self, value):
|
def _display_option(self, value):
|
||||||
"""Normalize both current state and options through one path."""
|
"""Normalize both current state and options through one path."""
|
||||||
display_fn = self._bound.desc.display_fn
|
display_fn = cast(SelectDesc, self._bound.desc).display_fn
|
||||||
fallback_fn = (
|
fallback_fn = (
|
||||||
(lambda raw: display_fn(raw, self._resources)) if display_fn is not None else None
|
(lambda raw: display_fn(raw, self._resources)) if display_fn is not None else None
|
||||||
)
|
)
|
||||||
|
|||||||
Reference in new issue
Block a user