Update typing 10 (#48071)

This commit is contained in:
Marc Mueller 2021-03-18 13:07:04 +01:00 committed by GitHub
parent 00dca88024
commit 25a13d1554
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
73 changed files with 412 additions and 333 deletions

View file

@ -1,7 +1,9 @@
"""Support for Modbus Register sensors."""
from __future__ import annotations
import logging
import struct
from typing import Any, Optional, Union
from typing import Any
from pymodbus.exceptions import ConnectionException, ModbusException
from pymodbus.pdu import ExceptionResponse
@ -44,7 +46,7 @@ from .const import (
_LOGGER = logging.getLogger(__name__)
def number(value: Any) -> Union[int, float]:
def number(value: Any) -> int | float:
"""Coerce a value to number without losing precision."""
if isinstance(value, int):
return value
@ -217,7 +219,7 @@ class ModbusRegisterSensor(RestoreEntity):
return self._unit_of_measurement
@property
def device_class(self) -> Optional[str]:
def device_class(self) -> str | None:
"""Return the device class of the sensor."""
return self._device_class