mirror of
https://github.com/home-assistant/supervisor.git
synced 2026-05-08 17:08:36 +01:00
Fix RAUC D-Bus type annotations for runtime type checking (#6532)
Replace ctypes integer types (c_uint32, c_uint64) with standard Python int in SlotStatusDataType to satisfy typeguard runtime type checking. D-Bus returns standard Python integers, not ctypes objects. Also fix the mark() method return type from tuple[str, str] to list[str] to match the actual D-Bus return value, and add missing optional fields "bundle.hash" and "installed.transaction" to SlotStatusDataType. Co-authored-by: Claude Sonnet 4.5 <noreply@anthropic.com>
This commit is contained in:
@@ -1,6 +1,5 @@
|
||||
"""D-Bus interface for rauc."""
|
||||
|
||||
from ctypes import c_uint32, c_uint64
|
||||
import logging
|
||||
from typing import Any, NotRequired, TypedDict
|
||||
|
||||
@@ -33,13 +32,15 @@ SlotStatusDataType = TypedDict(
|
||||
"state": str,
|
||||
"device": str,
|
||||
"bundle.compatible": NotRequired[str],
|
||||
"bundle.hash": NotRequired[str],
|
||||
"sha256": NotRequired[str],
|
||||
"size": NotRequired[c_uint64],
|
||||
"installed.count": NotRequired[c_uint32],
|
||||
"size": NotRequired[int],
|
||||
"installed.count": NotRequired[int],
|
||||
"installed.transaction": NotRequired[str],
|
||||
"bundle.version": NotRequired[str],
|
||||
"installed.timestamp": NotRequired[str],
|
||||
"status": NotRequired[str],
|
||||
"activated.count": NotRequired[c_uint32],
|
||||
"activated.count": NotRequired[int],
|
||||
"activated.timestamp": NotRequired[str],
|
||||
"boot-status": NotRequired[str],
|
||||
"bootname": NotRequired[str],
|
||||
@@ -117,7 +118,7 @@ class Rauc(DBusInterfaceProxy):
|
||||
return self.connected_dbus.signal(DBUS_SIGNAL_RAUC_INSTALLER_COMPLETED)
|
||||
|
||||
@dbus_connected
|
||||
async def mark(self, state: RaucState, slot_identifier: str) -> tuple[str, str]:
|
||||
async def mark(self, state: RaucState, slot_identifier: str) -> list[str]:
|
||||
"""Get slot status."""
|
||||
return await self.connected_dbus.Installer.call("mark", state, slot_identifier)
|
||||
|
||||
|
||||
Reference in New Issue
Block a user