Use assignment expressions 37 (#58827)

This commit is contained in:
Marc Mueller 2021-10-31 18:45:27 +01:00 committed by GitHub
parent 8e03102892
commit b6d9e517c2
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
14 changed files with 29 additions and 52 deletions

View file

@ -80,7 +80,5 @@ async def async_remove_user(
"""Remove Home Assistant Cast user."""
user_id: str | None = entry.data.get("user_id")
if user_id is not None:
user = await hass.auth.async_get_user(user_id)
if user:
await hass.auth.async_remove_user(user)
if user_id is not None and (user := await hass.auth.async_get_user(user_id)):
await hass.auth.async_remove_user(user)