Add missing type hints for AndroidTV (#96554)

* Add missing type hints for AndroidTV

* Suggested change
This commit is contained in:
ollo69
2023-07-15 02:18:34 +02:00
committed by GitHub
parent 9775832d53
commit c95e2c074c
3 changed files with 40 additions and 32 deletions
+4 -4
View File
@@ -23,7 +23,7 @@ PROPS_DEV_MAC = "ether ab:cd:ef:gh:ij:kl brd"
class AdbDeviceTcpAsyncFake:
"""A fake of the `adb_shell.adb_device_async.AdbDeviceTcpAsync` class."""
def __init__(self, *args, **kwargs):
def __init__(self, *args, **kwargs) -> None:
"""Initialize a fake `adb_shell.adb_device_async.AdbDeviceTcpAsync` instance."""
self.available = False
@@ -43,7 +43,7 @@ class AdbDeviceTcpAsyncFake:
class ClientAsyncFakeSuccess:
"""A fake of the `ClientAsync` class when the connection and shell commands succeed."""
def __init__(self, host=ADB_SERVER_HOST, port=DEFAULT_ADB_SERVER_PORT):
def __init__(self, host=ADB_SERVER_HOST, port=DEFAULT_ADB_SERVER_PORT) -> None:
"""Initialize a `ClientAsyncFakeSuccess` instance."""
self._devices = []
@@ -57,7 +57,7 @@ class ClientAsyncFakeSuccess:
class ClientAsyncFakeFail:
"""A fake of the `ClientAsync` class when the connection and shell commands fail."""
def __init__(self, host=ADB_SERVER_HOST, port=DEFAULT_ADB_SERVER_PORT):
def __init__(self, host=ADB_SERVER_HOST, port=DEFAULT_ADB_SERVER_PORT) -> None:
"""Initialize a `ClientAsyncFakeFail` instance."""
self._devices = []
@@ -70,7 +70,7 @@ class ClientAsyncFakeFail:
class DeviceAsyncFake:
"""A fake of the `DeviceAsync` class."""
def __init__(self, host):
def __init__(self, host) -> None:
"""Initialize a `DeviceAsyncFake` instance."""
self.host = host
@@ -197,7 +197,7 @@ def keygen_fixture() -> None:
yield
def _setup(config):
def _setup(config) -> tuple[str, str, MockConfigEntry]:
"""Perform common setup tasks for the tests."""
patch_key = config[ADB_PATCH_KEY]
entity_id = f"{MP_DOMAIN}.{slugify(config[TEST_ENTITY_NAME])}"
@@ -453,8 +453,8 @@ async def test_exclude_sources(
async def _test_select_source(
hass, config, conf_apps, source, expected_arg, method_patch
):
hass: HomeAssistant, config, conf_apps, source, expected_arg, method_patch
) -> None:
"""Test that the methods for launching and stopping apps are called correctly when selecting a source."""
patch_key, entity_id, config_entry = _setup(config)
config_entry.add_to_hass(hass)
@@ -947,13 +947,13 @@ async def test_get_image_disabled(hass: HomeAssistant) -> None:
async def _test_service(
hass,
hass: HomeAssistant,
entity_id,
ha_service_name,
androidtv_method,
additional_service_data=None,
return_value=None,
):
) -> None:
"""Test generic Android media player entity service."""
service_data = {ATTR_ENTITY_ID: entity_id}
if additional_service_data: