Add setup type hints to rfxtrx (#63963)

Co-authored-by: epenet <epenet@users.noreply.github.com>
This commit is contained in:
epenet 2022-01-13 07:00:14 +01:00 committed by GitHub
parent 20768172b1
commit 91c47264b5
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
5 changed files with 40 additions and 30 deletions

View File

@ -10,9 +10,11 @@ from homeassistant.components.binary_sensor import (
BinarySensorEntity, BinarySensorEntity,
BinarySensorEntityDescription, BinarySensorEntityDescription,
) )
from homeassistant.config_entries import ConfigEntry
from homeassistant.const import CONF_COMMAND_OFF, CONF_COMMAND_ON, STATE_ON from homeassistant.const import CONF_COMMAND_OFF, CONF_COMMAND_ON, STATE_ON
from homeassistant.core import CALLBACK_TYPE, callback from homeassistant.core import CALLBACK_TYPE, HomeAssistant, callback
from homeassistant.helpers import event as evt from homeassistant.helpers import event as evt
from homeassistant.helpers.entity_platform import AddEntitiesCallback
from . import DeviceTuple, RfxtrxEntity, async_setup_platform_entry, get_pt2262_cmd from . import DeviceTuple, RfxtrxEntity, async_setup_platform_entry, get_pt2262_cmd
from .const import ( from .const import (
@ -83,10 +85,10 @@ def supported(event: rfxtrxmod.RFXtrxEvent):
async def async_setup_entry( async def async_setup_entry(
hass, hass: HomeAssistant,
config_entry, config_entry: ConfigEntry,
async_add_entities, async_add_entities: AddEntitiesCallback,
): ) -> None:
"""Set up config entry.""" """Set up config entry."""
def get_sensor_description(type_string: str): def get_sensor_description(type_string: str):
@ -96,7 +98,7 @@ async def async_setup_entry(
def _constructor( def _constructor(
event: rfxtrxmod.RFXtrxEvent, event: rfxtrxmod.RFXtrxEvent,
auto: bool, auto: rfxtrxmod.RFXtrxEvent | None,
device_id: DeviceTuple, device_id: DeviceTuple,
entity_info: dict, entity_info: dict,
): ):

View File

@ -14,8 +14,10 @@ from homeassistant.components.cover import (
SUPPORT_STOP_TILT, SUPPORT_STOP_TILT,
CoverEntity, CoverEntity,
) )
from homeassistant.config_entries import ConfigEntry
from homeassistant.const import STATE_OPEN from homeassistant.const import STATE_OPEN
from homeassistant.core import callback from homeassistant.core import HomeAssistant, callback
from homeassistant.helpers.entity_platform import AddEntitiesCallback
from . import ( from . import (
DEFAULT_SIGNAL_REPETITIONS, DEFAULT_SIGNAL_REPETITIONS,
@ -41,15 +43,15 @@ def supported(event: rfxtrxmod.RFXtrxEvent):
async def async_setup_entry( async def async_setup_entry(
hass, hass: HomeAssistant,
config_entry, config_entry: ConfigEntry,
async_add_entities, async_add_entities: AddEntitiesCallback,
): ) -> None:
"""Set up config entry.""" """Set up config entry."""
def _constructor( def _constructor(
event: rfxtrxmod.RFXtrxEvent, event: rfxtrxmod.RFXtrxEvent,
auto: bool, auto: rfxtrxmod.RFXtrxEvent | None,
device_id: DeviceTuple, device_id: DeviceTuple,
entity_info: dict, entity_info: dict,
): ):

View File

@ -10,8 +10,10 @@ from homeassistant.components.light import (
SUPPORT_BRIGHTNESS, SUPPORT_BRIGHTNESS,
LightEntity, LightEntity,
) )
from homeassistant.config_entries import ConfigEntry
from homeassistant.const import STATE_ON from homeassistant.const import STATE_ON
from homeassistant.core import callback from homeassistant.core import HomeAssistant, callback
from homeassistant.helpers.entity_platform import AddEntitiesCallback
from . import ( from . import (
DEFAULT_SIGNAL_REPETITIONS, DEFAULT_SIGNAL_REPETITIONS,
@ -35,15 +37,15 @@ def supported(event: rfxtrxmod.RFXtrxEvent):
async def async_setup_entry( async def async_setup_entry(
hass, hass: HomeAssistant,
config_entry, config_entry: ConfigEntry,
async_add_entities, async_add_entities: AddEntitiesCallback,
): ) -> None:
"""Set up config entry.""" """Set up config entry."""
def _constructor( def _constructor(
event: rfxtrxmod.RFXtrxEvent, event: rfxtrxmod.RFXtrxEvent,
auto: bool, auto: rfxtrxmod.RFXtrxEvent | None,
device_id: DeviceTuple, device_id: DeviceTuple,
entity_info: dict, entity_info: dict,
): ):

View File

@ -13,6 +13,7 @@ from homeassistant.components.sensor import (
SensorEntityDescription, SensorEntityDescription,
SensorStateClass, SensorStateClass,
) )
from homeassistant.config_entries import ConfigEntry
from homeassistant.const import ( from homeassistant.const import (
DEGREE, DEGREE,
ELECTRIC_CURRENT_AMPERE, ELECTRIC_CURRENT_AMPERE,
@ -28,8 +29,9 @@ from homeassistant.const import (
TEMP_CELSIUS, TEMP_CELSIUS,
UV_INDEX, UV_INDEX,
) )
from homeassistant.core import callback from homeassistant.core import HomeAssistant, callback
from homeassistant.helpers.entity import EntityCategory from homeassistant.helpers.entity import EntityCategory
from homeassistant.helpers.entity_platform import AddEntitiesCallback
from . import DeviceTuple, RfxtrxEntity, async_setup_platform_entry, get_rfx_object from . import DeviceTuple, RfxtrxEntity, async_setup_platform_entry, get_rfx_object
from .const import ATTR_EVENT from .const import ATTR_EVENT
@ -208,10 +210,10 @@ SENSOR_TYPES_DICT = {desc.key: desc for desc in SENSOR_TYPES}
async def async_setup_entry( async def async_setup_entry(
hass, hass: HomeAssistant,
config_entry, config_entry: ConfigEntry,
async_add_entities, async_add_entities: AddEntitiesCallback,
): ) -> None:
"""Set up config entry.""" """Set up config entry."""
def _supported(event): def _supported(event):
@ -219,7 +221,7 @@ async def async_setup_entry(
def _constructor( def _constructor(
event: RFXtrxEvent, event: RFXtrxEvent,
auto: bool, auto: RFXtrxEvent | None,
device_id: DeviceTuple, device_id: DeviceTuple,
entity_info: dict, entity_info: dict,
): ):

View File

@ -6,8 +6,10 @@ import logging
import RFXtrx as rfxtrxmod import RFXtrx as rfxtrxmod
from homeassistant.components.switch import SwitchEntity from homeassistant.components.switch import SwitchEntity
from homeassistant.config_entries import ConfigEntry
from homeassistant.const import STATE_ON from homeassistant.const import STATE_ON
from homeassistant.core import callback from homeassistant.core import HomeAssistant, callback
from homeassistant.helpers.entity_platform import AddEntitiesCallback
from . import ( from . import (
DEFAULT_SIGNAL_REPETITIONS, DEFAULT_SIGNAL_REPETITIONS,
@ -34,15 +36,15 @@ def supported(event):
async def async_setup_entry( async def async_setup_entry(
hass, hass: HomeAssistant,
config_entry, config_entry: ConfigEntry,
async_add_entities, async_add_entities: AddEntitiesCallback,
): ) -> None:
"""Set up config entry.""" """Set up config entry."""
def _constructor( def _constructor(
event: rfxtrxmod.RFXtrxEvent, event: rfxtrxmod.RFXtrxEvent,
auto: bool, auto: rfxtrxmod.RFXtrxEvent | None,
device_id: DeviceTuple, device_id: DeviceTuple,
entity_info: dict, entity_info: dict,
): ):