Update Union typing (2) [Py310] (#86425)

This commit is contained in:
Marc Mueller 2023-01-23 08:40:09 +01:00 committed by GitHub
parent 1eec87214f
commit f57c0ea725
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
11 changed files with 29 additions and 36 deletions

View file

@ -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