Skip to content

Commit d79e10b

Browse files
committed
Улучшения типизации
1 parent c1c2102 commit d79e10b

File tree

2 files changed

+7
-3
lines changed

2 files changed

+7
-3
lines changed

custom_components/yandex_station_intents/yandex_session.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -178,7 +178,7 @@ async def async_refresh(self) -> None:
178178

179179
async def async_validate(self) -> bool:
180180
r = await self._session.get("https://quasar.yandex.ru/get_account_config")
181-
return r.status == HTTPStatus.OK and (await r.json()).get("status") == "ok"
181+
return bool(r.status == HTTPStatus.OK and (await r.json()).get("status") == "ok")
182182

183183
async def get(self, url: str, **kwargs: Any) -> ClientResponse:
184184
return await self._request(hdrs.METH_GET, url, **kwargs)
@@ -193,7 +193,7 @@ async def delete(self, url: str, **kwargs: Any) -> ClientResponse:
193193
return await self._request(hdrs.METH_DELETE, url, **kwargs)
194194

195195
async def ws_connect(self, *args: Any, **kwargs: Any) -> ClientWebSocketResponse:
196-
return await self._session.ws_connect(*args, **kwargs)
196+
return cast(ClientWebSocketResponse, await self._session.ws_connect(*args, **kwargs))
197197

198198
async def _request(self, method: str, url: str, retry: int = 2, **kwargs: Any) -> ClientResponse:
199199
if method != hdrs.METH_GET:
@@ -215,7 +215,7 @@ async def _request(self, method: str, url: str, retry: int = 2, **kwargs: Any) -
215215
ir.async_delete_issue(self._hass, DOMAIN, f"{ISSUE_ID_CAPTCHA}_{self._entry.entry_id}")
216216
ir.async_delete_issue(self._hass, DOMAIN, f"{ISSUE_ID_REAUTH_REQUIRED}_{self._entry.entry_id}")
217217

218-
return r
218+
return cast(ClientResponse, r)
219219
elif r.status == HTTPStatus.BAD_REQUEST:
220220
retry = 0
221221
elif r.status == HTTPStatus.UNAUTHORIZED:

pyproject.toml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -36,3 +36,7 @@ warn_unreachable = true
3636

3737
[tool.pytest.ini_options]
3838
asyncio_mode = "auto"
39+
40+
[[tool.mypy.overrides]]
41+
module = "custom_components.yandex_station_intents.config_flow"
42+
warn_return_any = false

0 commit comments

Comments
 (0)