Drop unused hass argument from internal helper (#152733)

This commit is contained in:
epenet
2025-09-22 09:56:52 +02:00
committed by GitHub
parent 7f7bd5a97f
commit de42ac14ac
4 changed files with 9 additions and 11 deletions

View File

@@ -492,7 +492,7 @@ async def async_extract_config_entry_ids(
return config_entry_ids
def _load_services_file(hass: HomeAssistant, integration: Integration) -> JSON_TYPE:
def _load_services_file(integration: Integration) -> JSON_TYPE:
"""Load services file for an integration."""
try:
return cast(
@@ -515,12 +515,10 @@ def _load_services_file(hass: HomeAssistant, integration: Integration) -> JSON_T
return {}
def _load_services_files(
hass: HomeAssistant, integrations: Iterable[Integration]
) -> dict[str, JSON_TYPE]:
def _load_services_files(integrations: Iterable[Integration]) -> dict[str, JSON_TYPE]:
"""Load service files for multiple integrations."""
return {
integration.domain: _load_services_file(hass, integration)
integration.domain: _load_services_file(integration)
for integration in integrations
}
@@ -586,7 +584,7 @@ async def async_get_all_descriptions(
if integrations:
loaded = await hass.async_add_executor_job(
_load_services_files, hass, integrations
_load_services_files, integrations
)
# Load translations for all service domains

View File

@@ -338,7 +338,7 @@ async def test_api_get_services(
assert data == snapshot
# Set up an integration with legacy translations in services.yaml
def _load_services_file(hass: HomeAssistant, integration: Integration) -> JSON_TYPE:
def _load_services_file(integration: Integration) -> JSON_TYPE:
return {
"set_default_level": {
"description": "Translated description",

View File

@@ -718,7 +718,7 @@ async def test_get_services(
assert hass.data[ALL_SERVICE_DESCRIPTIONS_JSON_CACHE] is old_cache
# Set up an integration with legacy translations in services.yaml
def _load_services_file(hass: HomeAssistant, integration: Integration) -> JSON_TYPE:
def _load_services_file(integration: Integration) -> JSON_TYPE:
return {
"set_default_level": {
"description": "Translated description",

View File

@@ -837,7 +837,7 @@ async def test_async_get_all_descriptions(hass: HomeAssistant) -> None:
# Test we only load services.yaml for integrations with services.yaml
# And system_health has no services
assert proxy_load_services_files.mock_calls[0][1][1] == unordered(
assert proxy_load_services_files.mock_calls[0][1][0] == unordered(
[
await async_get_integration(hass, DOMAIN_GROUP),
]
@@ -990,7 +990,7 @@ async def test_async_get_all_descriptions_dot_keys(hass: HomeAssistant) -> None:
descriptions = await service.async_get_all_descriptions(hass)
mock_load_yaml.assert_called_once_with("services.yaml", None)
assert proxy_load_services_files.mock_calls[0][1][1] == unordered(
assert proxy_load_services_files.mock_calls[0][1][0] == unordered(
[
await async_get_integration(hass, domain),
]
@@ -1085,7 +1085,7 @@ async def test_async_get_all_descriptions_filter(hass: HomeAssistant) -> None:
descriptions = await service.async_get_all_descriptions(hass)
mock_load_yaml.assert_called_once_with("services.yaml", None)
assert proxy_load_services_files.mock_calls[0][1][1] == unordered(
assert proxy_load_services_files.mock_calls[0][1][0] == unordered(
[
await async_get_integration(hass, domain),
]