1
0
mirror of https://github.com/home-assistant/core.git synced 2025-12-24 21:06:19 +00:00

Remove HomeAssistantType alias from helpers (#48400)

This commit is contained in:
Franck Nijhof
2021-03-27 12:55:24 +01:00
committed by GitHub
parent 4a353efdfb
commit 38d14702fa
19 changed files with 141 additions and 157 deletions

View File

@@ -6,7 +6,7 @@ from collections import ChainMap
import logging
from typing import Any
from homeassistant.core import callback
from homeassistant.core import HomeAssistant, callback
from homeassistant.loader import (
MAX_LOAD_CONCURRENTLY,
Integration,
@@ -17,8 +17,6 @@ from homeassistant.loader import (
from homeassistant.util.async_ import gather_with_concurrency
from homeassistant.util.json import load_json
from .typing import HomeAssistantType
_LOGGER = logging.getLogger(__name__)
TRANSLATION_LOAD_LOCK = "translation_load_lock"
@@ -148,7 +146,7 @@ def _build_resources(
async def async_get_component_strings(
hass: HomeAssistantType, language: str, components: set[str]
hass: HomeAssistant, language: str, components: set[str]
) -> dict[str, Any]:
"""Load translations."""
domains = list({loaded.split(".")[-1] for loaded in components})
@@ -204,7 +202,7 @@ async def async_get_component_strings(
class _TranslationCache:
"""Cache for flattened translations."""
def __init__(self, hass: HomeAssistantType) -> None:
def __init__(self, hass: HomeAssistant) -> None:
"""Initialize the cache."""
self.hass = hass
self.loaded: dict[str, set[str]] = {}
@@ -282,7 +280,7 @@ class _TranslationCache:
@bind_hass
async def async_get_translations(
hass: HomeAssistantType,
hass: HomeAssistant,
language: str,
category: str,
integration: str | None = None,