diff --git a/homeassistant/components/backup/agent.py b/homeassistant/components/backup/agent.py index ee636b244cd..8d378b36467 100644 --- a/homeassistant/components/backup/agent.py +++ b/homeassistant/components/backup/agent.py @@ -20,11 +20,9 @@ class UploadedBackup(BaseBackup): class BackupAgent(abc.ABC): - """Define the format that backup agents can have.""" + """Backup agent interface.""" - def __init__(self, name: str) -> None: - """Initialize the backup agent.""" - self.name = name + name: str @abc.abstractmethod async def async_download_backup( @@ -36,9 +34,8 @@ class BackupAgent(abc.ABC): ) -> None: """Download a backup file. - The `id` parameter is the ID of the backup that was returned in async_list_backups. - - The `path` parameter is the full file path to download the backup to. + :param id: The ID of the backup that was returned in async_list_backups. + :param path: The full file path to download the backup to. """ @abc.abstractmethod @@ -51,9 +48,8 @@ class BackupAgent(abc.ABC): ) -> None: """Upload a backup. - The `path` parameter is the full file path to the backup that should be uploaded. - - The `metadata` parameter contains metadata about the backup that should be uploaded. + :param path: The full file path to the backup that should be uploaded. + :param metadata: Metadata about the backup that should be uploaded. """ @abc.abstractmethod @@ -62,12 +58,11 @@ class BackupAgent(abc.ABC): class BackupAgentPlatformProtocol(Protocol): - """Define the format that backup platforms can have.""" + """Define the format of backup platforms which implement backup agents.""" async def async_get_backup_agents( self, - *, hass: HomeAssistant, **kwargs: Any, ) -> list[BackupAgent]: - """Register the backup agent.""" + """Return a list of backup agents.""" diff --git a/homeassistant/components/kitchen_sink/backup.py b/homeassistant/components/kitchen_sink/backup.py index ffbca276680..35c646845a3 100644 --- a/homeassistant/components/kitchen_sink/backup.py +++ b/homeassistant/components/kitchen_sink/backup.py @@ -29,7 +29,8 @@ class KitchenSinkBackupAgent(BackupAgent): def __init__(self, name: str) -> None: """Initialize the kitchen sink backup sync agent.""" - super().__init__(name) + super().__init__() + self.name = name self._uploads = [ UploadedBackup( id="def456", diff --git a/tests/components/backup/common.py b/tests/components/backup/common.py index 5e2a7c7bf53..f13543861ed 100644 --- a/tests/components/backup/common.py +++ b/tests/components/backup/common.py @@ -30,6 +30,10 @@ TEST_BACKUP = Backup( class BackupAgentTest(BackupAgent): """Test backup agent.""" + def __init__(self, name: str) -> None: + """Initialize the backup agent.""" + self.name = name + async def async_download_backup( self, *,