1
0
mirror of https://github.com/home-assistant/supervisor.git synced 2025-12-20 02:18:59 +00:00

Fix type annotations in AddonModel (#6387)

* Fix type annotations in AddonModel

Correct return type annotations for three properties in AddonModel
that were inconsistent with their actual return values:

- panel_admin: str -> bool
- with_tmpfs: str | None -> bool
- homeassistant_version: str | None -> AwesomeVersion | None

Based on the add-on schema _SCHEMA_ADDON_CONFIG in
supervisor/addons/validate.py.

Found while enabling typeguard for local testing.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>

* Fix docstrings

---------

Co-authored-by: Claude <noreply@anthropic.com>
This commit is contained in:
Stefan Agner
2025-12-03 17:45:44 +01:00
committed by GitHub
parent fea8159ccf
commit d203f20b7f

View File

@@ -316,12 +316,12 @@ class AddonModel(JobGroup, ABC):
@property @property
def panel_title(self) -> str: def panel_title(self) -> str:
"""Return panel icon for Ingress frame.""" """Return panel title for Ingress frame."""
return self.data.get(ATTR_PANEL_TITLE, self.name) return self.data.get(ATTR_PANEL_TITLE, self.name)
@property @property
def panel_admin(self) -> str: def panel_admin(self) -> bool:
"""Return panel icon for Ingress frame.""" """Return if panel is only available for admin users."""
return self.data[ATTR_PANEL_ADMIN] return self.data[ATTR_PANEL_ADMIN]
@property @property
@@ -489,7 +489,7 @@ class AddonModel(JobGroup, ABC):
return self.data[ATTR_DEVICETREE] return self.data[ATTR_DEVICETREE]
@property @property
def with_tmpfs(self) -> str | None: def with_tmpfs(self) -> bool:
"""Return if tmp is in memory of add-on.""" """Return if tmp is in memory of add-on."""
return self.data[ATTR_TMPFS] return self.data[ATTR_TMPFS]
@@ -509,7 +509,7 @@ class AddonModel(JobGroup, ABC):
return self.data[ATTR_VIDEO] return self.data[ATTR_VIDEO]
@property @property
def homeassistant_version(self) -> str | None: def homeassistant_version(self) -> AwesomeVersion | None:
"""Return min Home Assistant version they needed by Add-on.""" """Return min Home Assistant version they needed by Add-on."""
return self.data.get(ATTR_HOMEASSISTANT) return self.data.get(ATTR_HOMEASSISTANT)