Adjust type hints for CameraEntityFeature (#82191)
This commit is contained in:
parent
4f7b583f19
commit
5d78632d04
5 changed files with 7 additions and 7 deletions
|
@ -429,7 +429,7 @@ class Camera(Entity):
|
|||
_attr_motion_detection_enabled: bool = False
|
||||
_attr_should_poll: bool = False # No need to poll cameras
|
||||
_attr_state: None = None # State is determined by is_on
|
||||
_attr_supported_features: int = 0
|
||||
_attr_supported_features: CameraEntityFeature | int = 0
|
||||
|
||||
def __init__(self) -> None:
|
||||
"""Initialize a camera."""
|
||||
|
@ -450,7 +450,7 @@ class Camera(Entity):
|
|||
return ENTITY_IMAGE_URL.format(self.entity_id, self.access_tokens[-1])
|
||||
|
||||
@property
|
||||
def supported_features(self) -> int:
|
||||
def supported_features(self) -> CameraEntityFeature | int:
|
||||
"""Flag supported features."""
|
||||
return self._attr_supported_features
|
||||
|
||||
|
|
|
@ -179,9 +179,9 @@ class NetatmoCamera(NetatmoBase, Camera):
|
|||
return None
|
||||
|
||||
@property
|
||||
def supported_features(self) -> int:
|
||||
def supported_features(self) -> CameraEntityFeature:
|
||||
"""Return supported features."""
|
||||
supported_features: int = CameraEntityFeature.ON_OFF
|
||||
supported_features = CameraEntityFeature.ON_OFF
|
||||
if self._model != "NDB":
|
||||
supported_features |= CameraEntityFeature.STREAM
|
||||
return supported_features
|
||||
|
|
|
@ -175,7 +175,7 @@ class ProtectCamera(ProtectDeviceEntity, Camera):
|
|||
self._stream_source = ( # pylint: disable=attribute-defined-outside-init
|
||||
None if disable_stream else rtsp_url
|
||||
)
|
||||
self._attr_supported_features: int = (
|
||||
self._attr_supported_features = (
|
||||
CameraEntityFeature.STREAM if self._stream_source else 0
|
||||
)
|
||||
|
||||
|
|
|
@ -107,7 +107,7 @@ class UnifiVideoCamera(Camera):
|
|||
return self._name
|
||||
|
||||
@property
|
||||
def supported_features(self) -> int:
|
||||
def supported_features(self) -> CameraEntityFeature | int:
|
||||
"""Return supported features."""
|
||||
channels = self._caminfo["channels"]
|
||||
for channel in channels:
|
||||
|
|
|
@ -803,7 +803,7 @@ _INHERITANCE_MATCH: dict[str, list[ClassTypeHintMatch]] = {
|
|||
),
|
||||
TypeHintMatch(
|
||||
function_name="supported_features",
|
||||
return_type="int",
|
||||
return_type=["CameraEntityFeature", "int"],
|
||||
),
|
||||
TypeHintMatch(
|
||||
function_name="is_recording",
|
||||
|
|
Loading…
Add table
Reference in a new issue