Skip to content

Commit ff053d0

Browse files
committed
Rename to singleton
1 parent 3b3ee10 commit ff053d0

File tree

3 files changed

+5
-5
lines changed

3 files changed

+5
-5
lines changed

homeassistant/helpers/device_registry.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99
from homeassistant.core import callback
1010
from homeassistant.loader import bind_hass
1111

12-
from .call_coordinator import cache_per_instance
12+
from .singleton import singleton
1313
from .typing import HomeAssistantType
1414

1515
# mypy: allow-untyped-calls, allow-untyped-defs, no-check-untyped-defs
@@ -356,7 +356,7 @@ def async_clear_area_id(self, area_id: str) -> None:
356356

357357

358358
@bind_hass
359-
@cache_per_instance(DATA_REGISTRY)
359+
@singleton(DATA_REGISTRY)
360360
async def async_get_registry(hass: HomeAssistantType) -> DeviceRegistry:
361361
"""Create entity registry."""
362362
reg = DeviceRegistry(hass)

homeassistant/helpers/entity_registry.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@
3838
from homeassistant.util import slugify
3939
from homeassistant.util.yaml import load_yaml
4040

41-
from .call_coordinator import cache_per_instance
41+
from .singleton import singleton
4242
from .typing import HomeAssistantType
4343

4444
if TYPE_CHECKING:
@@ -492,7 +492,7 @@ def async_clear_config_entry(self, config_entry: str) -> None:
492492

493493

494494
@bind_hass
495-
@cache_per_instance(DATA_REGISTRY)
495+
@singleton(DATA_REGISTRY)
496496
async def async_get_registry(hass: HomeAssistantType) -> EntityRegistry:
497497
"""Create entity registry."""
498498
reg = EntityRegistry(hass)
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010
FUNC = Callable[[HomeAssistant], Awaitable[T]]
1111

1212

13-
def cache_per_instance(data_key: str) -> Callable[[FUNC], FUNC]:
13+
def singleton(data_key: str) -> Callable[[FUNC], FUNC]:
1414
"""Decorate a function that should be called once per instance.
1515
1616
Result will be cached and simultaneous calls will be handled.

0 commit comments

Comments
 (0)