From 32004973c8243a5deca6c4e0ec5cd55cd1c6b02e Mon Sep 17 00:00:00 2001 From: "J. Nick Koston" Date: Sun, 7 Apr 2024 00:17:18 -1000 Subject: [PATCH] Simplify invalidating the User cache (#115074) --- homeassistant/auth/models.py | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-) diff --git a/homeassistant/auth/models.py b/homeassistant/auth/models.py index 9242c6a67c6..7192f6345e1 100644 --- a/homeassistant/auth/models.py +++ b/homeassistant/auth/models.py @@ -86,11 +86,7 @@ class User: def invalidate_cache(self) -> None: """Invalidate permission and is_admin cache.""" for attr_to_invalidate in ("permissions", "is_admin"): - # try is must more efficient than suppress - try: # noqa: SIM105 - delattr(self, attr_to_invalidate) - except AttributeError: - pass + self.__dict__.pop(attr_to_invalidate, None) @attr.s(slots=True)