1
0
mirror of https://github.com/esphome/esphome.git synced 2025-10-30 22:53:59 +00:00

Ruff format for CI (#8276)

This commit is contained in:
Katherine Whitlock
2025-02-19 14:24:43 -05:00
committed by GitHub
parent 31e90e5544
commit 3020083564
21 changed files with 75 additions and 87 deletions

View File

@@ -1,8 +1,9 @@
from typing import Any
import esphome.config_validation as cv
from esphome.components import binary_sensor
from .. import const, schema, validate, generate
import esphome.config_validation as cv
from .. import const, generate, schema, validate
DEPENDENCIES = [const.OPENTHERM]
COMPONENT_TYPE = const.BINARY_SENSOR
@@ -11,8 +12,7 @@ COMPONENT_TYPE = const.BINARY_SENSOR
def get_entity_validation_schema(entity: schema.BinarySensorSchema) -> cv.Schema:
return binary_sensor.binary_sensor_schema(
device_class=(
entity.device_class
or binary_sensor._UNDEF # pylint: disable=protected-access
entity.device_class or binary_sensor._UNDEF # pylint: disable=protected-access
),
icon=(entity.icon or binary_sensor._UNDEF), # pylint: disable=protected-access
)

View File

@@ -3,8 +3,9 @@ from typing import Any, Callable, Optional
import esphome.codegen as cg
from esphome.const import CONF_ID
from . import const
from .schema import TSchema, SettingSchema
from .schema import SettingSchema, TSchema
opentherm_ns = cg.esphome_ns.namespace("opentherm")
OpenthermHub = opentherm_ns.class_("OpenthermHub", cg.Component)
@@ -112,11 +113,10 @@ def add_messages(hub: cg.MockObj, keys: list[str], schemas: dict[str, TSchema]):
msg_expr = cg.RawExpression(f"esphome::opentherm::MessageId::{msg}")
if keep_updated:
cg.add(hub.add_repeating_message(msg_expr))
elif order is not None:
cg.add(hub.add_initial_message(msg_expr, order))
else:
if order is not None:
cg.add(hub.add_initial_message(msg_expr, order))
else:
cg.add(hub.add_initial_message(msg_expr))
cg.add(hub.add_initial_message(msg_expr))
def add_property_set(var: cg.MockObj, config_key: str, config: dict[str, Any]) -> None:
@@ -128,7 +128,7 @@ Create = Callable[[dict[str, Any], str, cg.MockObj], Awaitable[cg.Pvariable]]
def create_only_conf(
create: Callable[[dict[str, Any]], Awaitable[cg.Pvariable]]
create: Callable[[dict[str, Any]], Awaitable[cg.Pvariable]],
) -> Create:
return lambda conf, _key, _hub: create(conf)

View File

@@ -1,8 +1,9 @@
from typing import Any
import esphome.config_validation as cv
from esphome.components import sensor
from .. import const, schema, validate, generate
import esphome.config_validation as cv
from .. import const, generate, schema, validate
DEPENDENCIES = [const.OPENTHERM]
COMPONENT_TYPE = const.SENSOR
@@ -22,11 +23,9 @@ MSG_DATA_TYPES = {
def get_entity_validation_schema(entity: schema.SensorSchema) -> cv.Schema:
return sensor.sensor_schema(
unit_of_measurement=entity.unit_of_measurement
or sensor._UNDEF, # pylint: disable=protected-access
unit_of_measurement=entity.unit_of_measurement or sensor._UNDEF, # pylint: disable=protected-access
accuracy_decimals=entity.accuracy_decimals,
device_class=entity.device_class
or sensor._UNDEF, # pylint: disable=protected-access
device_class=entity.device_class or sensor._UNDEF, # pylint: disable=protected-access
icon=entity.icon or sensor._UNDEF, # pylint: disable=protected-access
state_class=entity.state_class,
).extend(