Ensure directv config flow title_placeholders items are [str, str] (#127288)

This commit is contained in:
Erik Montnemery 2024-10-02 14:19:23 +02:00 committed by GitHub
parent 3308de95f0
commit 4726dc96d4
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -3,7 +3,7 @@
from __future__ import annotations from __future__ import annotations
import logging import logging
from typing import Any from typing import Any, cast
from urllib.parse import urlparse from urllib.parse import urlparse
from directv import DIRECTV, DIRECTVError from directv import DIRECTV, DIRECTVError
@ -70,7 +70,9 @@ class DirecTVConfigFlow(ConfigFlow, domain=DOMAIN):
self, discovery_info: ssdp.SsdpServiceInfo self, discovery_info: ssdp.SsdpServiceInfo
) -> ConfigFlowResult: ) -> ConfigFlowResult:
"""Handle SSDP discovery.""" """Handle SSDP discovery."""
host = urlparse(discovery_info.ssdp_location).hostname # We can cast the hostname to str because the ssdp_location is not bytes and
# not a relative url
host = cast(str, urlparse(discovery_info.ssdp_location).hostname)
receiver_id = None receiver_id = None
if discovery_info.upnp.get(ssdp.ATTR_UPNP_SERIAL): if discovery_info.upnp.get(ssdp.ATTR_UPNP_SERIAL):