Improve entity type hints [p] (#77871)
This commit is contained in:
parent
6f564e4f51
commit
474844744b
22 changed files with 130 additions and 107 deletions
|
@ -2,6 +2,7 @@
|
|||
from __future__ import annotations
|
||||
|
||||
import logging
|
||||
from typing import Any
|
||||
|
||||
from pulsectl import Pulse, PulseError
|
||||
import voluptuous as vol
|
||||
|
@ -100,7 +101,7 @@ class PALoopbackSwitch(SwitchEntity):
|
|||
return None
|
||||
|
||||
@property
|
||||
def available(self):
|
||||
def available(self) -> bool:
|
||||
"""Return true when connected to server."""
|
||||
return self._pa_svr.connected
|
||||
|
||||
|
@ -114,7 +115,7 @@ class PALoopbackSwitch(SwitchEntity):
|
|||
"""Return true if device is on."""
|
||||
return self._module_idx is not None
|
||||
|
||||
def turn_on(self, **kwargs):
|
||||
def turn_on(self, **kwargs: Any) -> None:
|
||||
"""Turn the device on."""
|
||||
if not self.is_on:
|
||||
self._pa_svr.module_load(
|
||||
|
@ -124,13 +125,13 @@ class PALoopbackSwitch(SwitchEntity):
|
|||
else:
|
||||
_LOGGER.warning(IGNORED_SWITCH_WARN)
|
||||
|
||||
def turn_off(self, **kwargs):
|
||||
def turn_off(self, **kwargs: Any) -> None:
|
||||
"""Turn the device off."""
|
||||
if self.is_on:
|
||||
self._pa_svr.module_unload(self._module_idx)
|
||||
else:
|
||||
_LOGGER.warning(IGNORED_SWITCH_WARN)
|
||||
|
||||
def update(self):
|
||||
def update(self) -> None:
|
||||
"""Refresh state in case an alternate process modified this data."""
|
||||
self._module_idx = self._get_module_idx()
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue