Update Union typing (2) [Py310] (#86425)
This commit is contained in:
parent
1eec87214f
commit
f57c0ea725
11 changed files with 29 additions and 36 deletions
|
@ -4,7 +4,7 @@ from __future__ import annotations
|
|||
from collections.abc import Callable
|
||||
from dataclasses import dataclass
|
||||
from datetime import datetime
|
||||
from typing import Any, Generic, Union, cast
|
||||
from typing import Any, Generic, cast
|
||||
|
||||
from pylitterbot import FeederRobot, LitterRobot, LitterRobot4, Robot
|
||||
|
||||
|
@ -55,7 +55,7 @@ class LitterRobotSensorEntity(LitterRobotEntity[_RobotT], SensorEntity):
|
|||
if self.entity_description.should_report(self.robot):
|
||||
if isinstance(val := getattr(self.robot, self.entity_description.key), str):
|
||||
return val.lower()
|
||||
return cast(Union[float, datetime, None], val)
|
||||
return cast(float | datetime | None, val)
|
||||
return None
|
||||
|
||||
@property
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue