Repository: home-assistant/core
File: homeassistant/components/syncthing/__init__.py (Python)

Code before:
        hass.bus.async_listen_once(EVENT_HOMEASSISTANT_STOP, cancel_listen_task)
    )

    return True


async def async_unload_entry(hass: HomeAssistant, entry: ConfigEntry) -> bool:
    """Unload a config entry."""
    unload_ok = await hass.config_entries.async_unload_platforms(entry, PLATFORMS)
    if unload_ok:
        syncthing = hass.data[DOMAIN].pop(entry.entry_id)
        await syncthing.unsubscribe()

    return unload_ok


class SyncthingClient:
    """A Syncthing client."""

    def __init__(
        self, hass: HomeAssistant, client: aiosyncthing.Syncthing, server_id: str
    ) -> None:
        """Initialize the client."""
        self._hass: HomeAssistant = hass
        self._client: aiosyncthing.Syncthing = client
        self._server_id: str = server_id
        self._listen_task: Task[None] | None = None

    @property
    def server_id(self) -> str:
        """Get server id."""
        return self._server_id

    @property
    def url(self) -> str:
        """Get server URL."""
        return self._client.url

    @property
    def database(self) -> aiosyncthing.Database:
        """Get database namespace client."""
        return self._client.database

    @property
    def system(self) -> aiosyncthing.System:
        """Get system namespace client."""
        return self._client.system

    def subscribe(self) -> None:
        """Start event listener coroutine."""
        self._listen_task = asyncio.create_task(self._listen())

Review comment (suggestion):
Not needed - already typed from the arguments
```suggestion
        self._hass = hass
        self._client = client
        self._server_id = server_id
```

Code after:
        hass.bus.async_listen_once(EVENT_HOMEASSISTANT_STOP, cancel_listen_task)
    )

    return True


async def async_unload_entry(hass: HomeAssistant, entry: ConfigEntry) -> bool:
    """Unload a config entry."""
    unload_ok = await hass.config_entries.async_unload_platforms(entry, PLATFORMS)
    if unload_ok:
        syncthing = hass.data[DOMAIN].pop(entry.entry_id)
        await syncthing.unsubscribe()

    return unload_ok


class SyncthingClient:
    """A Syncthing client."""

    def __init__(
        self, hass: HomeAssistant, client: aiosyncthing.Syncthing, server_id: str
    ) -> None:
        """Initialize the client."""
        self._hass = hass
        self._client = client
        self._server_id = server_id
        self._listen_task: Task[None] | None = None

    @property
    def server_id(self) -> str:
        """Get server id."""
        return self._server_id

    @property
    def url(self) -> str:
        """Get server URL."""
        return self._client.url

    @property
    def database(self) -> aiosyncthing.Database:
        """Get database namespace client."""
        return self._client.database

    @property
    def system(self) -> aiosyncthing.System:
        """Get system namespace client."""
        return self._client.system

    def subscribe(self) -> None:
        """Start event listener coroutine."""
        self._listen_task = asyncio.create_task(self._listen())