diff --git a/custom_components/yandex_station_intents/yandex_session.py b/custom_components/yandex_station_intents/yandex_session.py index 17dfecc..1d24f12 100644 --- a/custom_components/yandex_station_intents/yandex_session.py +++ b/custom_components/yandex_station_intents/yandex_session.py @@ -178,7 +178,7 @@ async def async_refresh(self) -> None: async def async_validate(self) -> bool: r = await self._session.get("https://quasar.yandex.ru/get_account_config") - return r.status == HTTPStatus.OK and (await r.json()).get("status") == "ok" + return bool(r.status == HTTPStatus.OK and (await r.json()).get("status") == "ok") async def get(self, url: str, **kwargs: Any) -> ClientResponse: return await self._request(hdrs.METH_GET, url, **kwargs) @@ -193,7 +193,7 @@ async def delete(self, url: str, **kwargs: Any) -> ClientResponse: return await self._request(hdrs.METH_DELETE, url, **kwargs) async def ws_connect(self, *args: Any, **kwargs: Any) -> ClientWebSocketResponse: - return await self._session.ws_connect(*args, **kwargs) + return cast(ClientWebSocketResponse, await self._session.ws_connect(*args, **kwargs)) async def _request(self, method: str, url: str, retry: int = 2, **kwargs: Any) -> ClientResponse: if method != hdrs.METH_GET: @@ -215,7 +215,7 @@ async def _request(self, method: str, url: str, retry: int = 2, **kwargs: Any) - ir.async_delete_issue(self._hass, DOMAIN, f"{ISSUE_ID_CAPTCHA}_{self._entry.entry_id}") ir.async_delete_issue(self._hass, DOMAIN, f"{ISSUE_ID_REAUTH_REQUIRED}_{self._entry.entry_id}") - return r + return cast(ClientResponse, r) elif r.status == HTTPStatus.BAD_REQUEST: retry = 0 elif r.status == HTTPStatus.UNAUTHORIZED: diff --git a/pyproject.toml b/pyproject.toml index 8074a45..e2a9099 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -36,3 +36,7 @@ warn_unreachable = true [tool.pytest.ini_options] asyncio_mode = "auto" + +[[tool.mypy.overrides]] +module = "custom_components.yandex_station_intents.config_flow" +warn_return_any = false