Update mypy to 0.981 (#79115)

This commit is contained in:
Marc Mueller 2022-09-26 22:10:06 +02:00 committed by GitHub
parent 1f6d19bb99
commit e8156adb13
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
15 changed files with 75 additions and 75 deletions

View file

@ -212,13 +212,13 @@ class EsphomeClimateEntity(EsphomeEntity[ClimateInfo, ClimateState], ClimateEnti
features |= ClimateEntityFeature.SWING_MODE features |= ClimateEntityFeature.SWING_MODE
return features return features
@property # type: ignore[misc] @property
@esphome_state_property @esphome_state_property
def hvac_mode(self) -> str | None: def hvac_mode(self) -> str | None:
"""Return current operation ie. heat, cool, idle.""" """Return current operation ie. heat, cool, idle."""
return _CLIMATE_MODES.from_esphome(self._state.mode) return _CLIMATE_MODES.from_esphome(self._state.mode)
@property # type: ignore[misc] @property
@esphome_state_property @esphome_state_property
def hvac_action(self) -> str | None: def hvac_action(self) -> str | None:
"""Return current action.""" """Return current action."""
@ -227,7 +227,7 @@ class EsphomeClimateEntity(EsphomeEntity[ClimateInfo, ClimateState], ClimateEnti
return None return None
return _CLIMATE_ACTIONS.from_esphome(self._state.action) return _CLIMATE_ACTIONS.from_esphome(self._state.action)
@property # type: ignore[misc] @property
@esphome_state_property @esphome_state_property
def fan_mode(self) -> str | None: def fan_mode(self) -> str | None:
"""Return current fan setting.""" """Return current fan setting."""
@ -235,7 +235,7 @@ class EsphomeClimateEntity(EsphomeEntity[ClimateInfo, ClimateState], ClimateEnti
self._state.fan_mode self._state.fan_mode
) )
@property # type: ignore[misc] @property
@esphome_state_property @esphome_state_property
def preset_mode(self) -> str | None: def preset_mode(self) -> str | None:
"""Return current preset mode.""" """Return current preset mode."""
@ -243,31 +243,31 @@ class EsphomeClimateEntity(EsphomeEntity[ClimateInfo, ClimateState], ClimateEnti
self._state.preset_compat(self._api_version) self._state.preset_compat(self._api_version)
) )
@property # type: ignore[misc] @property
@esphome_state_property @esphome_state_property
def swing_mode(self) -> str | None: def swing_mode(self) -> str | None:
"""Return current swing mode.""" """Return current swing mode."""
return _SWING_MODES.from_esphome(self._state.swing_mode) return _SWING_MODES.from_esphome(self._state.swing_mode)
@property # type: ignore[misc] @property
@esphome_state_property @esphome_state_property
def current_temperature(self) -> float | None: def current_temperature(self) -> float | None:
"""Return the current temperature.""" """Return the current temperature."""
return self._state.current_temperature return self._state.current_temperature
@property # type: ignore[misc] @property
@esphome_state_property @esphome_state_property
def target_temperature(self) -> float | None: def target_temperature(self) -> float | None:
"""Return the temperature we try to reach.""" """Return the temperature we try to reach."""
return self._state.target_temperature return self._state.target_temperature
@property # type: ignore[misc] @property
@esphome_state_property @esphome_state_property
def target_temperature_low(self) -> float | None: def target_temperature_low(self) -> float | None:
"""Return the lowbound target temperature we try to reach.""" """Return the lowbound target temperature we try to reach."""
return self._state.target_temperature_low return self._state.target_temperature_low
@property # type: ignore[misc] @property
@esphome_state_property @esphome_state_property
def target_temperature_high(self) -> float | None: def target_temperature_high(self) -> float | None:
"""Return the highbound target temperature we try to reach.""" """Return the highbound target temperature we try to reach."""

View file

@ -65,26 +65,26 @@ class EsphomeCover(EsphomeEntity[CoverInfo, CoverState], CoverEntity):
"""Return true if we do optimistic updates.""" """Return true if we do optimistic updates."""
return self._static_info.assumed_state return self._static_info.assumed_state
@property # type: ignore[misc] @property
@esphome_state_property @esphome_state_property
def is_closed(self) -> bool | None: def is_closed(self) -> bool | None:
"""Return if the cover is closed or not.""" """Return if the cover is closed or not."""
# Check closed state with api version due to a protocol change # Check closed state with api version due to a protocol change
return self._state.is_closed(self._api_version) return self._state.is_closed(self._api_version)
@property # type: ignore[misc] @property
@esphome_state_property @esphome_state_property
def is_opening(self) -> bool: def is_opening(self) -> bool:
"""Return if the cover is opening or not.""" """Return if the cover is opening or not."""
return self._state.current_operation == CoverOperation.IS_OPENING return self._state.current_operation == CoverOperation.IS_OPENING
@property # type: ignore[misc] @property
@esphome_state_property @esphome_state_property
def is_closing(self) -> bool: def is_closing(self) -> bool:
"""Return if the cover is closing or not.""" """Return if the cover is closing or not."""
return self._state.current_operation == CoverOperation.IS_CLOSING return self._state.current_operation == CoverOperation.IS_CLOSING
@property # type: ignore[misc] @property
@esphome_state_property @esphome_state_property
def current_cover_position(self) -> int | None: def current_cover_position(self) -> int | None:
"""Return current position of cover. 0 is closed, 100 is open.""" """Return current position of cover. 0 is closed, 100 is open."""
@ -92,7 +92,7 @@ class EsphomeCover(EsphomeEntity[CoverInfo, CoverState], CoverEntity):
return None return None
return round(self._state.position * 100.0) return round(self._state.position * 100.0)
@property # type: ignore[misc] @property
@esphome_state_property @esphome_state_property
def current_cover_tilt_position(self) -> int | None: def current_cover_tilt_position(self) -> int | None:
"""Return current position of cover tilt. 0 is closed, 100 is open.""" """Return current position of cover tilt. 0 is closed, 100 is open."""

View file

@ -112,13 +112,13 @@ class EsphomeFan(EsphomeEntity[FanInfo, FanState], FanEntity):
key=self._static_info.key, direction=_FAN_DIRECTIONS.from_hass(direction) key=self._static_info.key, direction=_FAN_DIRECTIONS.from_hass(direction)
) )
@property # type: ignore[misc] @property
@esphome_state_property @esphome_state_property
def is_on(self) -> bool | None: def is_on(self) -> bool | None:
"""Return true if the entity is on.""" """Return true if the entity is on."""
return self._state.state return self._state.state
@property # type: ignore[misc] @property
@esphome_state_property @esphome_state_property
def percentage(self) -> int | None: def percentage(self) -> int | None:
"""Return the current speed percentage.""" """Return the current speed percentage."""
@ -141,7 +141,7 @@ class EsphomeFan(EsphomeEntity[FanInfo, FanState], FanEntity):
return len(ORDERED_NAMED_FAN_SPEEDS) return len(ORDERED_NAMED_FAN_SPEEDS)
return self._static_info.supported_speed_levels return self._static_info.supported_speed_levels
@property # type: ignore[misc] @property
@esphome_state_property @esphome_state_property
def oscillating(self) -> bool | None: def oscillating(self) -> bool | None:
"""Return the oscillation state.""" """Return the oscillation state."""
@ -149,7 +149,7 @@ class EsphomeFan(EsphomeEntity[FanInfo, FanState], FanEntity):
return None return None
return self._state.oscillating return self._state.oscillating
@property # type: ignore[misc] @property
@esphome_state_property @esphome_state_property
def current_direction(self) -> str | None: def current_direction(self) -> str | None:
"""Return the current fan direction.""" """Return the current fan direction."""

View file

@ -130,7 +130,7 @@ class EsphomeLight(EsphomeEntity[LightInfo, LightState], LightEntity):
"""Return whether the client supports the new color mode system natively.""" """Return whether the client supports the new color mode system natively."""
return self._api_version >= APIVersion(1, 6) return self._api_version >= APIVersion(1, 6)
@property # type: ignore[misc] @property
@esphome_state_property @esphome_state_property
def is_on(self) -> bool | None: def is_on(self) -> bool | None:
"""Return true if the light is on.""" """Return true if the light is on."""
@ -260,13 +260,13 @@ class EsphomeLight(EsphomeEntity[LightInfo, LightState], LightEntity):
data["transition_length"] = kwargs[ATTR_TRANSITION] data["transition_length"] = kwargs[ATTR_TRANSITION]
await self._client.light_command(**data) await self._client.light_command(**data)
@property # type: ignore[misc] @property
@esphome_state_property @esphome_state_property
def brightness(self) -> int | None: def brightness(self) -> int | None:
"""Return the brightness of this light between 0..255.""" """Return the brightness of this light between 0..255."""
return round(self._state.brightness * 255) return round(self._state.brightness * 255)
@property # type: ignore[misc] @property
@esphome_state_property @esphome_state_property
def color_mode(self) -> str | None: def color_mode(self) -> str | None:
"""Return the color mode of the light.""" """Return the color mode of the light."""
@ -277,7 +277,7 @@ class EsphomeLight(EsphomeEntity[LightInfo, LightState], LightEntity):
return _color_mode_to_ha(self._state.color_mode) return _color_mode_to_ha(self._state.color_mode)
@property # type: ignore[misc] @property
@esphome_state_property @esphome_state_property
def rgb_color(self) -> tuple[int, int, int] | None: def rgb_color(self) -> tuple[int, int, int] | None:
"""Return the rgb color value [int, int, int].""" """Return the rgb color value [int, int, int]."""
@ -294,7 +294,7 @@ class EsphomeLight(EsphomeEntity[LightInfo, LightState], LightEntity):
round(self._state.blue * self._state.color_brightness * 255), round(self._state.blue * self._state.color_brightness * 255),
) )
@property # type: ignore[misc] @property
@esphome_state_property @esphome_state_property
def rgbw_color(self) -> tuple[int, int, int, int] | None: def rgbw_color(self) -> tuple[int, int, int, int] | None:
"""Return the rgbw color value [int, int, int, int].""" """Return the rgbw color value [int, int, int, int]."""
@ -302,7 +302,7 @@ class EsphomeLight(EsphomeEntity[LightInfo, LightState], LightEntity):
rgb = cast("tuple[int, int, int]", self.rgb_color) rgb = cast("tuple[int, int, int]", self.rgb_color)
return (*rgb, white) return (*rgb, white)
@property # type: ignore[misc] @property
@esphome_state_property @esphome_state_property
def rgbww_color(self) -> tuple[int, int, int, int, int] | None: def rgbww_color(self) -> tuple[int, int, int, int, int] | None:
"""Return the rgbww color value [int, int, int, int, int].""" """Return the rgbww color value [int, int, int, int, int]."""
@ -330,13 +330,13 @@ class EsphomeLight(EsphomeEntity[LightInfo, LightState], LightEntity):
round(self._state.warm_white * 255), round(self._state.warm_white * 255),
) )
@property # type: ignore[misc] @property
@esphome_state_property @esphome_state_property
def color_temp(self) -> float | None: # type: ignore[override] def color_temp(self) -> float | None: # type: ignore[override]
"""Return the CT color value in mireds.""" """Return the CT color value in mireds."""
return self._state.color_temperature return self._state.color_temperature
@property # type: ignore[misc] @property
@esphome_state_property @esphome_state_property
def effect(self) -> str | None: def effect(self) -> str | None:
"""Return the current effect.""" """Return the current effect."""

View file

@ -49,25 +49,25 @@ class EsphomeLock(EsphomeEntity[LockInfo, LockEntityState], LockEntity):
return self._static_info.code_format return self._static_info.code_format
return None return None
@property # type: ignore[misc] @property
@esphome_state_property @esphome_state_property
def is_locked(self) -> bool | None: def is_locked(self) -> bool | None:
"""Return true if the lock is locked.""" """Return true if the lock is locked."""
return self._state.state == LockState.LOCKED return self._state.state == LockState.LOCKED
@property # type: ignore[misc] @property
@esphome_state_property @esphome_state_property
def is_locking(self) -> bool | None: def is_locking(self) -> bool | None:
"""Return true if the lock is locking.""" """Return true if the lock is locking."""
return self._state.state == LockState.LOCKING return self._state.state == LockState.LOCKING
@property # type: ignore[misc] @property
@esphome_state_property @esphome_state_property
def is_unlocking(self) -> bool | None: def is_unlocking(self) -> bool | None:
"""Return true if the lock is unlocking.""" """Return true if the lock is unlocking."""
return self._state.state == LockState.UNLOCKING return self._state.state == LockState.UNLOCKING
@property # type: ignore[misc] @property
@esphome_state_property @esphome_state_property
def is_jammed(self) -> bool | None: def is_jammed(self) -> bool | None:
"""Return true if the lock is jammed (incomplete locking).""" """Return true if the lock is jammed (incomplete locking)."""

View file

@ -64,19 +64,19 @@ class EsphomeMediaPlayer(
_attr_device_class = MediaPlayerDeviceClass.SPEAKER _attr_device_class = MediaPlayerDeviceClass.SPEAKER
@property # type: ignore[misc] @property
@esphome_state_property @esphome_state_property
def state(self) -> MediaPlayerState | None: def state(self) -> MediaPlayerState | None:
"""Return current state.""" """Return current state."""
return _STATES.from_esphome(self._state.state) return _STATES.from_esphome(self._state.state)
@property # type: ignore[misc] @property
@esphome_state_property @esphome_state_property
def is_volume_muted(self) -> bool: def is_volume_muted(self) -> bool:
"""Return true if volume is muted.""" """Return true if volume is muted."""
return self._state.muted return self._state.muted
@property # type: ignore[misc] @property
@esphome_state_property @esphome_state_property
def volume_level(self) -> float | None: def volume_level(self) -> float | None:
"""Volume level of the media player (0..1).""" """Volume level of the media player (0..1)."""

View file

@ -74,7 +74,7 @@ class EsphomeNumber(EsphomeEntity[NumberInfo, NumberState], NumberEntity):
return NUMBER_MODES.from_esphome(self._static_info.mode) return NUMBER_MODES.from_esphome(self._static_info.mode)
return NumberMode.AUTO return NumberMode.AUTO
@property # type: ignore[misc] @property
@esphome_state_property @esphome_state_property
def native_value(self) -> float | None: def native_value(self) -> float | None:
"""Return the state of the entity.""" """Return the state of the entity."""

View file

@ -36,7 +36,7 @@ class EsphomeSelect(EsphomeEntity[SelectInfo, SelectState], SelectEntity):
"""Return a set of selectable options.""" """Return a set of selectable options."""
return self._static_info.options return self._static_info.options
@property # type: ignore[misc] @property
@esphome_state_property @esphome_state_property
def current_option(self) -> str | None: def current_option(self) -> str | None:
"""Return the state of the entity.""" """Return the state of the entity."""

View file

@ -76,7 +76,7 @@ class EsphomeSensor(EsphomeEntity[SensorInfo, SensorState], SensorEntity):
"""Return if this sensor should force a state update.""" """Return if this sensor should force a state update."""
return self._static_info.force_update return self._static_info.force_update
@property # type: ignore[misc] @property
@esphome_state_property @esphome_state_property
def native_value(self) -> datetime | str | None: def native_value(self) -> datetime | str | None:
"""Return the state of the entity.""" """Return the state of the entity."""
@ -121,7 +121,7 @@ class EsphomeSensor(EsphomeEntity[SensorInfo, SensorState], SensorEntity):
class EsphomeTextSensor(EsphomeEntity[TextSensorInfo, TextSensorState], SensorEntity): class EsphomeTextSensor(EsphomeEntity[TextSensorInfo, TextSensorState], SensorEntity):
"""A text sensor implementation for ESPHome.""" """A text sensor implementation for ESPHome."""
@property # type: ignore[misc] @property
@esphome_state_property @esphome_state_property
def native_value(self) -> str | None: def native_value(self) -> str | None:
"""Return the state of the entity.""" """Return the state of the entity."""

View file

@ -36,7 +36,7 @@ class EsphomeSwitch(EsphomeEntity[SwitchInfo, SwitchState], SwitchEntity):
"""Return true if we do optimistic updates.""" """Return true if we do optimistic updates."""
return self._static_info.assumed_state return self._static_info.assumed_state
@property # type: ignore[misc] @property
@esphome_state_property @esphome_state_property
def is_on(self) -> bool | None: def is_on(self) -> bool | None:
"""Return true if the switch is on.""" """Return true if the switch is on."""

View file

@ -295,7 +295,7 @@ class ControllerDevice(ClimateEntity):
return key return key
assert False, "Should be unreachable" assert False, "Should be unreachable"
@property # type: ignore[misc] @property
@_return_on_connection_error([]) @_return_on_connection_error([])
def hvac_modes(self) -> list[HVACMode]: def hvac_modes(self) -> list[HVACMode]:
"""Return the list of available operation modes.""" """Return the list of available operation modes."""
@ -303,13 +303,13 @@ class ControllerDevice(ClimateEntity):
return [HVACMode.OFF, HVACMode.FAN_ONLY] return [HVACMode.OFF, HVACMode.FAN_ONLY]
return [HVACMode.OFF, *self._state_to_pizone] return [HVACMode.OFF, *self._state_to_pizone]
@property # type: ignore[misc] @property
@_return_on_connection_error(PRESET_NONE) @_return_on_connection_error(PRESET_NONE)
def preset_mode(self): def preset_mode(self):
"""Eco mode is external air.""" """Eco mode is external air."""
return PRESET_ECO if self._controller.free_air else PRESET_NONE return PRESET_ECO if self._controller.free_air else PRESET_NONE
@property # type: ignore[misc] @property
@_return_on_connection_error([PRESET_NONE]) @_return_on_connection_error([PRESET_NONE])
def preset_modes(self): def preset_modes(self):
"""Available preset modes, normal or eco.""" """Available preset modes, normal or eco."""
@ -317,7 +317,7 @@ class ControllerDevice(ClimateEntity):
return [PRESET_NONE, PRESET_ECO] return [PRESET_NONE, PRESET_ECO]
return [PRESET_NONE] return [PRESET_NONE]
@property # type: ignore[misc] @property
@_return_on_connection_error() @_return_on_connection_error()
def current_temperature(self) -> float | None: def current_temperature(self) -> float | None:
"""Return the current temperature.""" """Return the current temperature."""
@ -347,7 +347,7 @@ class ControllerDevice(ClimateEntity):
return None return None
return zone.target_temperature return zone.target_temperature
@property # type: ignore[misc] @property
@_return_on_connection_error() @_return_on_connection_error()
def target_temperature(self) -> float | None: def target_temperature(self) -> float | None:
"""Return the temperature we try to reach (either from control zone or master unit).""" """Return the temperature we try to reach (either from control zone or master unit)."""
@ -375,13 +375,13 @@ class ControllerDevice(ClimateEntity):
"""Return the list of available fan modes.""" """Return the list of available fan modes."""
return list(self._fan_to_pizone) return list(self._fan_to_pizone)
@property # type: ignore[misc] @property
@_return_on_connection_error(0.0) @_return_on_connection_error(0.0)
def min_temp(self) -> float: def min_temp(self) -> float:
"""Return the minimum temperature.""" """Return the minimum temperature."""
return self._controller.temp_min return self._controller.temp_min
@property # type: ignore[misc] @property
@_return_on_connection_error(50.0) @_return_on_connection_error(50.0)
def max_temp(self) -> float: def max_temp(self) -> float:
"""Return the maximum temperature.""" """Return the maximum temperature."""
@ -516,7 +516,7 @@ class ZoneDevice(ClimateEntity):
"""Return the name of the entity.""" """Return the name of the entity."""
return self._name return self._name
@property # type: ignore[misc] @property
@_return_on_connection_error(0) @_return_on_connection_error(0)
def supported_features(self) -> int: def supported_features(self) -> int:
"""Return the list of supported features.""" """Return the list of supported features."""

View file

@ -106,31 +106,31 @@ class AirSensor(AirQualityEntity):
"""Return the name of the sensor.""" """Return the name of the sensor."""
return self._name return self._name
@property # type: ignore[misc] @property
@round_state @round_state
def air_quality_index(self): def air_quality_index(self):
"""Return the Air Quality Index (AQI).""" """Return the Air Quality Index (AQI)."""
return self._api.data.get("aqi") return self._api.data.get("aqi")
@property # type: ignore[misc] @property
@round_state @round_state
def nitrogen_dioxide(self): def nitrogen_dioxide(self):
"""Return the NO2 (nitrogen dioxide) level.""" """Return the NO2 (nitrogen dioxide) level."""
return self._api.data.get("no2_concentration") return self._api.data.get("no2_concentration")
@property # type: ignore[misc] @property
@round_state @round_state
def ozone(self): def ozone(self):
"""Return the O3 (ozone) level.""" """Return the O3 (ozone) level."""
return self._api.data.get("o3_concentration") return self._api.data.get("o3_concentration")
@property # type: ignore[misc] @property
@round_state @round_state
def particulate_matter_2_5(self): def particulate_matter_2_5(self):
"""Return the particulate matter 2.5 level.""" """Return the particulate matter 2.5 level."""
return self._api.data.get("pm25_concentration") return self._api.data.get("pm25_concentration")
@property # type: ignore[misc] @property
@round_state @round_state
def particulate_matter_10(self): def particulate_matter_10(self):
"""Return the particulate matter 10 level.""" """Return the particulate matter 10 level."""

View file

@ -249,7 +249,7 @@ class PlexMediaPlayer(MediaPlayerEntity):
else: else:
self._attr_state = MediaPlayerState.IDLE self._attr_state = MediaPlayerState.IDLE
@property # type: ignore[misc] @property
@needs_session @needs_session
def username(self): def username(self):
"""Return the username of the client owner.""" """Return the username of the client owner."""
@ -280,109 +280,109 @@ class PlexMediaPlayer(MediaPlayerEntity):
return "video" return "video"
@property # type: ignore[misc] @property
@needs_session @needs_session
def session_key(self): def session_key(self):
"""Return current session key.""" """Return current session key."""
return self.session.sessionKey return self.session.sessionKey
@property # type: ignore[misc] @property
@needs_session @needs_session
def media_library_title(self): def media_library_title(self):
"""Return the library name of playing media.""" """Return the library name of playing media."""
return self.session.media_library_title return self.session.media_library_title
@property # type: ignore[misc] @property
@needs_session @needs_session
def media_content_id(self): def media_content_id(self):
"""Return the content ID of current playing media.""" """Return the content ID of current playing media."""
return self.session.media_content_id return self.session.media_content_id
@property # type: ignore[misc] @property
@needs_session @needs_session
def media_content_type(self): def media_content_type(self):
"""Return the content type of current playing media.""" """Return the content type of current playing media."""
return self.session.media_content_type return self.session.media_content_type
@property # type: ignore[misc] @property
@needs_session @needs_session
def media_content_rating(self): def media_content_rating(self):
"""Return the content rating of current playing media.""" """Return the content rating of current playing media."""
return self.session.media_content_rating return self.session.media_content_rating
@property # type: ignore[misc] @property
@needs_session @needs_session
def media_artist(self): def media_artist(self):
"""Return the artist of current playing media, music track only.""" """Return the artist of current playing media, music track only."""
return self.session.media_artist return self.session.media_artist
@property # type: ignore[misc] @property
@needs_session @needs_session
def media_album_name(self): def media_album_name(self):
"""Return the album name of current playing media, music track only.""" """Return the album name of current playing media, music track only."""
return self.session.media_album_name return self.session.media_album_name
@property # type: ignore[misc] @property
@needs_session @needs_session
def media_album_artist(self): def media_album_artist(self):
"""Return the album artist of current playing media, music only.""" """Return the album artist of current playing media, music only."""
return self.session.media_album_artist return self.session.media_album_artist
@property # type: ignore[misc] @property
@needs_session @needs_session
def media_track(self): def media_track(self):
"""Return the track number of current playing media, music only.""" """Return the track number of current playing media, music only."""
return self.session.media_track return self.session.media_track
@property # type: ignore[misc] @property
@needs_session @needs_session
def media_duration(self): def media_duration(self):
"""Return the duration of current playing media in seconds.""" """Return the duration of current playing media in seconds."""
return self.session.media_duration return self.session.media_duration
@property # type: ignore[misc] @property
@needs_session @needs_session
def media_position(self): def media_position(self):
"""Return the duration of current playing media in seconds.""" """Return the duration of current playing media in seconds."""
return self.session.media_position return self.session.media_position
@property # type: ignore[misc] @property
@needs_session @needs_session
def media_position_updated_at(self): def media_position_updated_at(self):
"""When was the position of the current playing media valid.""" """When was the position of the current playing media valid."""
return self.session.media_position_updated_at return self.session.media_position_updated_at
@property # type: ignore[misc] @property
@needs_session @needs_session
def media_image_url(self): def media_image_url(self):
"""Return the image URL of current playing media.""" """Return the image URL of current playing media."""
return self.session.media_image_url return self.session.media_image_url
@property # type: ignore[misc] @property
@needs_session @needs_session
def media_summary(self): def media_summary(self):
"""Return the summary of current playing media.""" """Return the summary of current playing media."""
return self.session.media_summary return self.session.media_summary
@property # type: ignore[misc] @property
@needs_session @needs_session
def media_title(self): def media_title(self):
"""Return the title of current playing media.""" """Return the title of current playing media."""
return self.session.media_title return self.session.media_title
@property # type: ignore[misc] @property
@needs_session @needs_session
def media_season(self): def media_season(self):
"""Return the season of current playing media (TV Show only).""" """Return the season of current playing media (TV Show only)."""
return self.session.media_season return self.session.media_season
@property # type: ignore[misc] @property
@needs_session @needs_session
def media_series_title(self): def media_series_title(self):
"""Return the title of the series of current playing media.""" """Return the title of the series of current playing media."""
return self.session.media_series_title return self.session.media_series_title
@property # type: ignore[misc] @property
@needs_session @needs_session
def media_episode(self): def media_episode(self):
"""Return the episode of current playing media (TV Show only).""" """Return the episode of current playing media (TV Show only)."""

View file

@ -150,7 +150,7 @@ class LazyState(State):
self.attr_cache = attr_cache self.attr_cache = attr_cache
@property # type: ignore[override] @property # type: ignore[override]
def attributes(self) -> dict[str, Any]: # type: ignore[override] def attributes(self) -> dict[str, Any]:
"""State attributes.""" """State attributes."""
if self._attributes is None: if self._attributes is None:
self._attributes = decode_attributes_from_row(self._row, self.attr_cache) self._attributes = decode_attributes_from_row(self._row, self.attr_cache)
@ -162,7 +162,7 @@ class LazyState(State):
self._attributes = value self._attributes = value
@property # type: ignore[override] @property # type: ignore[override]
def context(self) -> Context: # type: ignore[override] def context(self) -> Context:
"""State context.""" """State context."""
if self._context is None: if self._context is None:
self._context = Context(id=None) self._context = Context(id=None)
@ -174,7 +174,7 @@ class LazyState(State):
self._context = value self._context = value
@property # type: ignore[override] @property # type: ignore[override]
def last_changed(self) -> datetime: # type: ignore[override] def last_changed(self) -> datetime:
"""Last changed datetime.""" """Last changed datetime."""
if self._last_changed is None: if self._last_changed is None:
if (last_changed := self._row.last_changed) is not None: if (last_changed := self._row.last_changed) is not None:
@ -189,7 +189,7 @@ class LazyState(State):
self._last_changed = value self._last_changed = value
@property # type: ignore[override] @property # type: ignore[override]
def last_updated(self) -> datetime: # type: ignore[override] def last_updated(self) -> datetime:
"""Last updated datetime.""" """Last updated datetime."""
if self._last_updated is None: if self._last_updated is None:
self._last_updated = process_timestamp(self._row.last_updated) self._last_updated = process_timestamp(self._row.last_updated)

View file

@ -12,7 +12,7 @@ codecov==2.1.12
coverage==6.4.4 coverage==6.4.4
freezegun==1.2.1 freezegun==1.2.1
mock-open==1.4.0 mock-open==1.4.0
mypy==0.971 mypy==0.981
pre-commit==2.20.0 pre-commit==2.20.0
pylint==2.15.0 pylint==2.15.0
pipdeptree==2.3.1 pipdeptree==2.3.1