Skip to content

Commit

Permalink
Add strict typing to husqvarna automower (home-assistant#115374)
Browse files Browse the repository at this point in the history
  • Loading branch information
Thomas55555 authored Apr 25, 2024
1 parent 421dbe1 commit ccc2f6c
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 1 deletion.
1 change: 1 addition & 0 deletions .strict-typing
Original file line number Diff line number Diff line change
Expand Up @@ -235,6 +235,7 @@ homeassistant.components.homeworks.*
homeassistant.components.http.*
homeassistant.components.huawei_lte.*
homeassistant.components.humidifier.*
homeassistant.components.husqvarna_automower.*
homeassistant.components.hydrawise.*
homeassistant.components.hyperion.*
homeassistant.components.ibeacon.*
Expand Down
3 changes: 2 additions & 1 deletion homeassistant/components/husqvarna_automower/api.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
"""API for Husqvarna Automower bound to Home Assistant OAuth."""

import logging
from typing import cast

from aioautomower.auth import AbstractAuth
from aioautomower.const import API_BASE_URL
Expand All @@ -26,4 +27,4 @@ def __init__(
async def async_get_access_token(self) -> str:
"""Return a valid access token."""
await self._oauth_session.async_ensure_token_valid()
return self._oauth_session.token["access_token"]
return cast(str, self._oauth_session.token["access_token"])
10 changes: 10 additions & 0 deletions mypy.ini
Original file line number Diff line number Diff line change
Expand Up @@ -2112,6 +2112,16 @@ disallow_untyped_defs = true
warn_return_any = true
warn_unreachable = true

[mypy-homeassistant.components.husqvarna_automower.*]
check_untyped_defs = true
disallow_incomplete_defs = true
disallow_subclassing_any = true
disallow_untyped_calls = true
disallow_untyped_decorators = true
disallow_untyped_defs = true
warn_return_any = true
warn_unreachable = true

[mypy-homeassistant.components.hydrawise.*]
check_untyped_defs = true
disallow_incomplete_defs = true
Expand Down

0 comments on commit ccc2f6c

Please sign in to comment.