mirror of
https://github.com/home-assistant/core.git
synced 2025-07-21 04:07:08 +00:00
Fix partial typing (#118022)
This commit is contained in:
parent
0e03e591e7
commit
3b4b36a9fd
@ -62,7 +62,7 @@ async def async_setup_entry(
|
|||||||
await hass.async_add_executor_job(
|
await hass.async_add_executor_job(
|
||||||
partial(
|
partial(
|
||||||
HomeControl,
|
HomeControl,
|
||||||
gateway_id=gateway_id,
|
gateway_id=str(gateway_id),
|
||||||
mydevolo_instance=mydevolo,
|
mydevolo_instance=mydevolo,
|
||||||
zeroconf_instance=zeroconf_instance,
|
zeroconf_instance=zeroconf_instance,
|
||||||
)
|
)
|
||||||
|
@ -20,7 +20,7 @@ from . import data
|
|||||||
from .const import DOMAIN
|
from .const import DOMAIN
|
||||||
|
|
||||||
ENERGY_USAGE_DEVICE_CLASSES = (sensor.SensorDeviceClass.ENERGY,)
|
ENERGY_USAGE_DEVICE_CLASSES = (sensor.SensorDeviceClass.ENERGY,)
|
||||||
ENERGY_USAGE_UNITS = {
|
ENERGY_USAGE_UNITS: dict[str, tuple[UnitOfEnergy, ...]] = {
|
||||||
sensor.SensorDeviceClass.ENERGY: (
|
sensor.SensorDeviceClass.ENERGY: (
|
||||||
UnitOfEnergy.GIGA_JOULE,
|
UnitOfEnergy.GIGA_JOULE,
|
||||||
UnitOfEnergy.KILO_WATT_HOUR,
|
UnitOfEnergy.KILO_WATT_HOUR,
|
||||||
@ -38,7 +38,7 @@ GAS_USAGE_DEVICE_CLASSES = (
|
|||||||
sensor.SensorDeviceClass.ENERGY,
|
sensor.SensorDeviceClass.ENERGY,
|
||||||
sensor.SensorDeviceClass.GAS,
|
sensor.SensorDeviceClass.GAS,
|
||||||
)
|
)
|
||||||
GAS_USAGE_UNITS = {
|
GAS_USAGE_UNITS: dict[str, tuple[UnitOfEnergy | UnitOfVolume, ...]] = {
|
||||||
sensor.SensorDeviceClass.ENERGY: (
|
sensor.SensorDeviceClass.ENERGY: (
|
||||||
UnitOfEnergy.GIGA_JOULE,
|
UnitOfEnergy.GIGA_JOULE,
|
||||||
UnitOfEnergy.KILO_WATT_HOUR,
|
UnitOfEnergy.KILO_WATT_HOUR,
|
||||||
@ -58,7 +58,7 @@ GAS_PRICE_UNITS = tuple(
|
|||||||
GAS_UNIT_ERROR = "entity_unexpected_unit_gas"
|
GAS_UNIT_ERROR = "entity_unexpected_unit_gas"
|
||||||
GAS_PRICE_UNIT_ERROR = "entity_unexpected_unit_gas_price"
|
GAS_PRICE_UNIT_ERROR = "entity_unexpected_unit_gas_price"
|
||||||
WATER_USAGE_DEVICE_CLASSES = (sensor.SensorDeviceClass.WATER,)
|
WATER_USAGE_DEVICE_CLASSES = (sensor.SensorDeviceClass.WATER,)
|
||||||
WATER_USAGE_UNITS = {
|
WATER_USAGE_UNITS: dict[str, tuple[UnitOfVolume, ...]] = {
|
||||||
sensor.SensorDeviceClass.WATER: (
|
sensor.SensorDeviceClass.WATER: (
|
||||||
UnitOfVolume.CENTUM_CUBIC_FEET,
|
UnitOfVolume.CENTUM_CUBIC_FEET,
|
||||||
UnitOfVolume.CUBIC_FEET,
|
UnitOfVolume.CUBIC_FEET,
|
||||||
@ -360,12 +360,14 @@ async def async_validate(hass: HomeAssistant) -> EnergyPreferencesValidation:
|
|||||||
source_result,
|
source_result,
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
elif flow.get("entity_energy_price") is not None:
|
elif (
|
||||||
|
entity_energy_price := flow.get("entity_energy_price")
|
||||||
|
) is not None:
|
||||||
validate_calls.append(
|
validate_calls.append(
|
||||||
functools.partial(
|
functools.partial(
|
||||||
_async_validate_price_entity,
|
_async_validate_price_entity,
|
||||||
hass,
|
hass,
|
||||||
flow["entity_energy_price"],
|
entity_energy_price,
|
||||||
source_result,
|
source_result,
|
||||||
ENERGY_PRICE_UNITS,
|
ENERGY_PRICE_UNITS,
|
||||||
ENERGY_PRICE_UNIT_ERROR,
|
ENERGY_PRICE_UNIT_ERROR,
|
||||||
@ -411,12 +413,14 @@ async def async_validate(hass: HomeAssistant) -> EnergyPreferencesValidation:
|
|||||||
source_result,
|
source_result,
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
elif flow.get("entity_energy_price") is not None:
|
elif (
|
||||||
|
entity_energy_price := flow.get("entity_energy_price")
|
||||||
|
) is not None:
|
||||||
validate_calls.append(
|
validate_calls.append(
|
||||||
functools.partial(
|
functools.partial(
|
||||||
_async_validate_price_entity,
|
_async_validate_price_entity,
|
||||||
hass,
|
hass,
|
||||||
flow["entity_energy_price"],
|
entity_energy_price,
|
||||||
source_result,
|
source_result,
|
||||||
ENERGY_PRICE_UNITS,
|
ENERGY_PRICE_UNITS,
|
||||||
ENERGY_PRICE_UNIT_ERROR,
|
ENERGY_PRICE_UNIT_ERROR,
|
||||||
@ -462,12 +466,12 @@ async def async_validate(hass: HomeAssistant) -> EnergyPreferencesValidation:
|
|||||||
source_result,
|
source_result,
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
elif source.get("entity_energy_price") is not None:
|
elif (entity_energy_price := source.get("entity_energy_price")) is not None:
|
||||||
validate_calls.append(
|
validate_calls.append(
|
||||||
functools.partial(
|
functools.partial(
|
||||||
_async_validate_price_entity,
|
_async_validate_price_entity,
|
||||||
hass,
|
hass,
|
||||||
source["entity_energy_price"],
|
entity_energy_price,
|
||||||
source_result,
|
source_result,
|
||||||
GAS_PRICE_UNITS,
|
GAS_PRICE_UNITS,
|
||||||
GAS_PRICE_UNIT_ERROR,
|
GAS_PRICE_UNIT_ERROR,
|
||||||
@ -513,12 +517,12 @@ async def async_validate(hass: HomeAssistant) -> EnergyPreferencesValidation:
|
|||||||
source_result,
|
source_result,
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
elif source.get("entity_energy_price") is not None:
|
elif (entity_energy_price := source.get("entity_energy_price")) is not None:
|
||||||
validate_calls.append(
|
validate_calls.append(
|
||||||
functools.partial(
|
functools.partial(
|
||||||
_async_validate_price_entity,
|
_async_validate_price_entity,
|
||||||
hass,
|
hass,
|
||||||
source["entity_energy_price"],
|
entity_energy_price,
|
||||||
source_result,
|
source_result,
|
||||||
WATER_PRICE_UNITS,
|
WATER_PRICE_UNITS,
|
||||||
WATER_PRICE_UNIT_ERROR,
|
WATER_PRICE_UNIT_ERROR,
|
||||||
|
@ -103,7 +103,7 @@ def pong_message(iden: int) -> dict[str, Any]:
|
|||||||
|
|
||||||
@callback
|
@callback
|
||||||
def _forward_events_check_permissions(
|
def _forward_events_check_permissions(
|
||||||
send_message: Callable[[bytes | str | dict[str, Any] | Callable[[], str]], None],
|
send_message: Callable[[bytes | str | dict[str, Any]], None],
|
||||||
user: User,
|
user: User,
|
||||||
message_id_as_bytes: bytes,
|
message_id_as_bytes: bytes,
|
||||||
event: Event,
|
event: Event,
|
||||||
@ -123,7 +123,7 @@ def _forward_events_check_permissions(
|
|||||||
|
|
||||||
@callback
|
@callback
|
||||||
def _forward_events_unconditional(
|
def _forward_events_unconditional(
|
||||||
send_message: Callable[[bytes | str | dict[str, Any] | Callable[[], str]], None],
|
send_message: Callable[[bytes | str | dict[str, Any]], None],
|
||||||
message_id_as_bytes: bytes,
|
message_id_as_bytes: bytes,
|
||||||
event: Event,
|
event: Event,
|
||||||
) -> None:
|
) -> None:
|
||||||
@ -365,7 +365,7 @@ def _send_handle_get_states_response(
|
|||||||
|
|
||||||
@callback
|
@callback
|
||||||
def _forward_entity_changes(
|
def _forward_entity_changes(
|
||||||
send_message: Callable[[str | bytes | dict[str, Any] | Callable[[], str]], None],
|
send_message: Callable[[str | bytes | dict[str, Any]], None],
|
||||||
entity_ids: set[str],
|
entity_ids: set[str],
|
||||||
user: User,
|
user: User,
|
||||||
message_id_as_bytes: bytes,
|
message_id_as_bytes: bytes,
|
||||||
|
Loading…
x
Reference in New Issue
Block a user