mirror of
https://github.com/home-assistant/core.git
synced 2025-07-09 14:27:07 +00:00
Mark entity methods and properties as mandatory in pylint plugin (#145210)
* Mark entity methods and properties as mandatory in pylint plugin * Fixes
This commit is contained in:
parent
e76bd1bbb9
commit
df3688ef08
@ -57,7 +57,7 @@ class CecEntity(Entity):
|
||||
self._attr_available = False
|
||||
self.schedule_update_ha_state(False)
|
||||
|
||||
async def async_added_to_hass(self):
|
||||
async def async_added_to_hass(self) -> None:
|
||||
"""Register HDMI callbacks after initialization."""
|
||||
self._device.set_update_callback(self._update)
|
||||
self.hass.bus.async_listen(
|
||||
|
@ -74,7 +74,7 @@ class SmartMeterTexasSensor(CoordinatorEntity, RestoreEntity, SensorEntity):
|
||||
self._attr_native_value = self.meter.reading
|
||||
self.async_write_ha_state()
|
||||
|
||||
async def async_added_to_hass(self):
|
||||
async def async_added_to_hass(self) -> None:
|
||||
"""Subscribe to updates."""
|
||||
await super().async_added_to_hass()
|
||||
self.async_on_remove(self.coordinator.async_add_listener(self._state_update))
|
||||
|
@ -605,7 +605,7 @@ class UtilityMeterSensor(RestoreSensor):
|
||||
self._attr_native_value = Decimal(str(value))
|
||||
self.async_write_ha_state()
|
||||
|
||||
async def async_added_to_hass(self):
|
||||
async def async_added_to_hass(self) -> None:
|
||||
"""Handle entity which will be added."""
|
||||
await super().async_added_to_hass()
|
||||
|
||||
|
@ -667,6 +667,7 @@ _ENTITY_MATCH: list[TypeHintMatch] = [
|
||||
TypeHintMatch(
|
||||
function_name="should_poll",
|
||||
return_type="bool",
|
||||
mandatory=True,
|
||||
),
|
||||
TypeHintMatch(
|
||||
function_name="unique_id",
|
||||
@ -725,6 +726,7 @@ _ENTITY_MATCH: list[TypeHintMatch] = [
|
||||
TypeHintMatch(
|
||||
function_name="force_update",
|
||||
return_type="bool",
|
||||
mandatory=True,
|
||||
),
|
||||
TypeHintMatch(
|
||||
function_name="supported_features",
|
||||
@ -733,10 +735,12 @@ _ENTITY_MATCH: list[TypeHintMatch] = [
|
||||
TypeHintMatch(
|
||||
function_name="entity_registry_enabled_default",
|
||||
return_type="bool",
|
||||
mandatory=True,
|
||||
),
|
||||
TypeHintMatch(
|
||||
function_name="entity_registry_visible_default",
|
||||
return_type="bool",
|
||||
mandatory=True,
|
||||
),
|
||||
TypeHintMatch(
|
||||
function_name="attribution",
|
||||
@ -749,23 +753,28 @@ _ENTITY_MATCH: list[TypeHintMatch] = [
|
||||
TypeHintMatch(
|
||||
function_name="async_removed_from_registry",
|
||||
return_type=None,
|
||||
mandatory=True,
|
||||
),
|
||||
TypeHintMatch(
|
||||
function_name="async_added_to_hass",
|
||||
return_type=None,
|
||||
mandatory=True,
|
||||
),
|
||||
TypeHintMatch(
|
||||
function_name="async_will_remove_from_hass",
|
||||
return_type=None,
|
||||
mandatory=True,
|
||||
),
|
||||
TypeHintMatch(
|
||||
function_name="async_registry_entry_updated",
|
||||
return_type=None,
|
||||
mandatory=True,
|
||||
),
|
||||
TypeHintMatch(
|
||||
function_name="update",
|
||||
return_type=None,
|
||||
has_async_counterpart=True,
|
||||
mandatory=True,
|
||||
),
|
||||
]
|
||||
_RESTORE_ENTITY_MATCH: list[TypeHintMatch] = [
|
||||
|
Loading…
x
Reference in New Issue
Block a user