Adjust type hints for AlarmControlPanelEntityFeature (#82186)

This commit is contained in:
epenet 2022-11-16 17:08:42 +01:00 committed by GitHub
parent 1f0691bf18
commit f952b74b74
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
4 changed files with 5 additions and 5 deletions

View file

@ -133,7 +133,7 @@ class AlarmControlPanelEntity(Entity):
_attr_changed_by: str | None = None
_attr_code_arm_required: bool = True
_attr_code_format: CodeFormat | None = None
_attr_supported_features: int
_attr_supported_features: AlarmControlPanelEntityFeature | int
@property
def code_format(self) -> CodeFormat | None:
@ -207,7 +207,7 @@ class AlarmControlPanelEntity(Entity):
await self.hass.async_add_executor_job(self.alarm_arm_custom_bypass, code)
@property
def supported_features(self) -> int:
def supported_features(self) -> AlarmControlPanelEntityFeature | int:
"""Return the list of supported features."""
return self._attr_supported_features

View file

@ -243,7 +243,7 @@ class MqttAlarm(MqttEntity, alarm.AlarmControlPanelEntity):
return self._state
@property
def supported_features(self) -> int:
def supported_features(self) -> AlarmControlPanelEntityFeature:
"""Return the list of supported features."""
return (
AlarmControlPanelEntityFeature.ARM_HOME

View file

@ -39,7 +39,7 @@ from .entity import OverkizDescriptiveEntity
class OverkizAlarmDescriptionMixin:
"""Define an entity description mixin for switch entities."""
supported_features: int
supported_features: AlarmControlPanelEntityFeature
fn_state: Callable[[Callable[[str], OverkizStateType]], str]

View file

@ -661,7 +661,7 @@ _INHERITANCE_MATCH: dict[str, list[ClassTypeHintMatch]] = {
),
TypeHintMatch(
function_name="supported_features",
return_type="int",
return_type=["AlarmControlPanelEntityFeature", "int"],
),
TypeHintMatch(
function_name="alarm_disarm",