Update typing 14 (#48078)
This commit is contained in:
parent
7d196abc4a
commit
dcca29ef68
73 changed files with 614 additions and 521 deletions
|
@ -1,7 +1,8 @@
|
|||
"""Representation of Z-Wave switches."""
|
||||
from __future__ import annotations
|
||||
|
||||
import logging
|
||||
from typing import Any, Callable, List, Optional
|
||||
from typing import Any, Callable
|
||||
|
||||
from zwave_js_server.client import Client as ZwaveClient
|
||||
|
||||
|
@ -30,7 +31,7 @@ async def async_setup_entry(
|
|||
@callback
|
||||
def async_add_switch(info: ZwaveDiscoveryInfo) -> None:
|
||||
"""Add Z-Wave Switch."""
|
||||
entities: List[ZWaveBaseEntity] = []
|
||||
entities: list[ZWaveBaseEntity] = []
|
||||
if info.platform_hint == "barrier_event_signaling_state":
|
||||
entities.append(
|
||||
ZWaveBarrierEventSignalingSwitch(config_entry, client, info)
|
||||
|
@ -53,7 +54,7 @@ class ZWaveSwitch(ZWaveBaseEntity, SwitchEntity):
|
|||
"""Representation of a Z-Wave switch."""
|
||||
|
||||
@property
|
||||
def is_on(self) -> Optional[bool]: # type: ignore
|
||||
def is_on(self) -> bool | None: # type: ignore
|
||||
"""Return a boolean for the state of the switch."""
|
||||
if self.info.primary_value.value is None:
|
||||
# guard missing value
|
||||
|
@ -85,7 +86,7 @@ class ZWaveBarrierEventSignalingSwitch(ZWaveBaseEntity, SwitchEntity):
|
|||
"""Initialize a ZWaveBarrierEventSignalingSwitch entity."""
|
||||
super().__init__(config_entry, client, info)
|
||||
self._name = self.generate_name(include_value_name=True)
|
||||
self._state: Optional[bool] = None
|
||||
self._state: bool | None = None
|
||||
|
||||
self._update_state()
|
||||
|
||||
|
@ -100,7 +101,7 @@ class ZWaveBarrierEventSignalingSwitch(ZWaveBaseEntity, SwitchEntity):
|
|||
return self._name
|
||||
|
||||
@property
|
||||
def is_on(self) -> Optional[bool]: # type: ignore
|
||||
def is_on(self) -> bool | None: # type: ignore
|
||||
"""Return a boolean for the state of the switch."""
|
||||
return self._state
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue