Type vlc_telnet strictly (#59154)

This commit is contained in:
Martin Hjelmare 2021-11-05 14:42:08 +01:00 committed by GitHub
parent 442d65e8da
commit c0801c1233
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 23 additions and 11 deletions

View File

@ -135,6 +135,7 @@ homeassistant.components.uptime.*
homeassistant.components.uptimerobot.*
homeassistant.components.vacuum.*
homeassistant.components.vallox.*
homeassistant.components.vlc_telnet.*
homeassistant.components.water_heater.*
homeassistant.components.watttime.*
homeassistant.components.weather.*

View File

@ -104,7 +104,7 @@ def catch_vlc_errors(func: Func) -> Func:
"""Catch VLC errors."""
@wraps(func)
async def wrapper(self, *args: Any, **kwargs: Any) -> Any:
async def wrapper(self: VlcDevice, *args: Any, **kwargs: Any) -> Any:
"""Catch VLC errors and modify availability."""
try:
await func(self, *args, **kwargs)
@ -206,12 +206,12 @@ class VlcDevice(MediaPlayerEntity):
self._media_title = data_info["filename"]
@property
def name(self):
def name(self) -> str:
"""Return the name of the device."""
return self._name
@property
def state(self):
def state(self) -> str | None:
"""Return the state of the device."""
return self._state
@ -226,42 +226,42 @@ class VlcDevice(MediaPlayerEntity):
return self._volume
@property
def is_volume_muted(self):
def is_volume_muted(self) -> bool | None:
"""Boolean if volume is currently muted."""
return self._muted
@property
def supported_features(self):
def supported_features(self) -> int:
"""Flag media player features that are supported."""
return SUPPORT_VLC
@property
def media_content_type(self):
def media_content_type(self) -> str:
"""Content type of current playing media."""
return MEDIA_TYPE_MUSIC
@property
def media_duration(self):
def media_duration(self) -> int | None:
"""Duration of current playing media in seconds."""
return self._media_duration
@property
def media_position(self):
def media_position(self) -> int | None:
"""Position of current playing media in seconds."""
return self._media_position
@property
def media_position_updated_at(self):
def media_position_updated_at(self) -> datetime | None:
"""When was the position of the current playing media valid."""
return self._media_position_updated_at
@property
def media_title(self):
def media_title(self) -> str | None:
"""Title of current playing media."""
return self._media_title
@property
def media_artist(self):
def media_artist(self) -> str | None:
"""Artist of current playing media, music track only."""
return self._media_artist

View File

@ -1496,6 +1496,17 @@ no_implicit_optional = true
warn_return_any = true
warn_unreachable = true
[mypy-homeassistant.components.vlc_telnet.*]
check_untyped_defs = true
disallow_incomplete_defs = true
disallow_subclassing_any = true
disallow_untyped_calls = true
disallow_untyped_decorators = true
disallow_untyped_defs = true
no_implicit_optional = true
warn_return_any = true
warn_unreachable = true
[mypy-homeassistant.components.water_heater.*]
check_untyped_defs = true
disallow_incomplete_defs = true