Improve cast typing (#86536)

This commit is contained in:
Marc Mueller 2023-01-24 16:48:01 +01:00 committed by GitHub
parent d684aa4225
commit b4ddff751a
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -5,6 +5,7 @@ import asyncio
import configparser import configparser
from dataclasses import dataclass from dataclasses import dataclass
import logging import logging
from typing import TYPE_CHECKING
from urllib.parse import urlparse from urllib.parse import urlparse
import aiohttp import aiohttp
@ -19,6 +20,10 @@ from homeassistant.helpers import aiohttp_client
from .const import DOMAIN from .const import DOMAIN
if TYPE_CHECKING:
from homeassistant.components import zeroconf
_LOGGER = logging.getLogger(__name__) _LOGGER = logging.getLogger(__name__)
_PLS_SECTION_PLAYLIST = "playlist" _PLS_SECTION_PLAYLIST = "playlist"
@ -124,15 +129,15 @@ class ChromecastInfo:
class ChromeCastZeroconf: class ChromeCastZeroconf:
"""Class to hold a zeroconf instance.""" """Class to hold a zeroconf instance."""
__zconf = None __zconf: zeroconf.HaZeroconf | None = None
@classmethod @classmethod
def set_zeroconf(cls, zconf): def set_zeroconf(cls, zconf: zeroconf.HaZeroconf) -> None:
"""Set zeroconf.""" """Set zeroconf."""
cls.__zconf = zconf cls.__zconf = zconf
@classmethod @classmethod
def get_zeroconf(cls): def get_zeroconf(cls) -> zeroconf.HaZeroconf | None:
"""Get zeroconf.""" """Get zeroconf."""
return cls.__zconf return cls.__zconf