Make BaseCoordinatorEntity.should_poll a cached_property since it never changes (#121826)

This commit is contained in:
J. Nick Koston 2024-07-12 00:39:22 -05:00 committed by GitHub
parent cdb26ef8a3
commit cdf7ecebc0
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -6,6 +6,7 @@ from abc import abstractmethod
import asyncio import asyncio
from collections.abc import Awaitable, Callable, Coroutine, Generator from collections.abc import Awaitable, Callable, Coroutine, Generator
from datetime import datetime, timedelta from datetime import datetime, timedelta
from functools import cached_property
import logging import logging
from random import randint from random import randint
from time import monotonic from time import monotonic
@ -471,7 +472,7 @@ class BaseCoordinatorEntity[
self.coordinator = coordinator self.coordinator = coordinator
self.coordinator_context = context self.coordinator_context = context
@property @cached_property
def should_poll(self) -> bool: def should_poll(self) -> bool:
"""No need to poll. Coordinator notifies entity of updates.""" """No need to poll. Coordinator notifies entity of updates."""
return False return False