Update typing 10 (#48071)
This commit is contained in:
parent
00dca88024
commit
25a13d1554
73 changed files with 412 additions and 333 deletions
|
@ -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
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue