From e305af1a0d93258c2ebb2dbbb7a050e0b9b51164 Mon Sep 17 00:00:00 2001 From: epenet <6771947+epenet@users.noreply.github.com> Date: Wed, 22 Feb 2023 09:34:57 +0000 Subject: [PATCH] Use load_json_object in matrix --- homeassistant/components/matrix/__init__.py | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/homeassistant/components/matrix/__init__.py b/homeassistant/components/matrix/__init__.py index 84fafd3f068bb0..febafc367f1be2 100644 --- a/homeassistant/components/matrix/__init__.py +++ b/homeassistant/components/matrix/__init__.py @@ -21,7 +21,7 @@ import homeassistant.helpers.config_validation as cv from homeassistant.helpers.json import save_json from homeassistant.helpers.typing import ConfigType -from homeassistant.util.json import load_json +from homeassistant.util.json import JsonObjectType, load_json_object from .const import DOMAIN, FORMAT_HTML, FORMAT_TEXT, SERVICE_SEND_MESSAGE @@ -276,15 +276,13 @@ def _join_rooms(self): except MatrixRequestError as ex: _LOGGER.error("Could not join room %s: %s", room_id, ex) - def _get_auth_tokens(self): + def _get_auth_tokens(self) -> JsonObjectType: """Read sorted authentication tokens from disk. Returns the auth_tokens dictionary. """ try: - auth_tokens = load_json(self._session_filepath) - - return auth_tokens + return load_json_object(self._session_filepath) except HomeAssistantError as ex: _LOGGER.warning( "Loading authentication tokens from file '%s' failed: %s",