mirror of
https://github.com/home-assistant/core.git
synced 2025-07-17 18:27:09 +00:00
Clean up codespell words (#123541)
This commit is contained in:
parent
257742de46
commit
13b12a7657
@ -12,7 +12,7 @@ repos:
|
|||||||
hooks:
|
hooks:
|
||||||
- id: codespell
|
- id: codespell
|
||||||
args:
|
args:
|
||||||
- --ignore-words-list=astroid,checkin,currenty,hass,iif,incomfort,lookin,nam,NotIn,pres,ser,ue
|
- --ignore-words-list=astroid,checkin,currenty,hass,iif,incomfort,lookin,nam,NotIn
|
||||||
- --skip="./.*,*.csv,*.json,*.ambr"
|
- --skip="./.*,*.csv,*.json,*.ambr"
|
||||||
- --quiet-level=2
|
- --quiet-level=2
|
||||||
exclude_types: [csv, json, html]
|
exclude_types: [csv, json, html]
|
||||||
|
@ -81,7 +81,7 @@ class AcerSwitch(SwitchEntity):
|
|||||||
write_timeout: int,
|
write_timeout: int,
|
||||||
) -> None:
|
) -> None:
|
||||||
"""Init of the Acer projector."""
|
"""Init of the Acer projector."""
|
||||||
self.ser = serial.Serial(
|
self.serial = serial.Serial(
|
||||||
port=serial_port, timeout=timeout, write_timeout=write_timeout
|
port=serial_port, timeout=timeout, write_timeout=write_timeout
|
||||||
)
|
)
|
||||||
self._serial_port = serial_port
|
self._serial_port = serial_port
|
||||||
@ -99,16 +99,16 @@ class AcerSwitch(SwitchEntity):
|
|||||||
# was disconnected during runtime.
|
# was disconnected during runtime.
|
||||||
# This way the projector can be reconnected and will still work
|
# This way the projector can be reconnected and will still work
|
||||||
try:
|
try:
|
||||||
if not self.ser.is_open:
|
if not self.serial.is_open:
|
||||||
self.ser.open()
|
self.serial.open()
|
||||||
self.ser.write(msg.encode("utf-8"))
|
self.serial.write(msg.encode("utf-8"))
|
||||||
# Size is an experience value there is no real limit.
|
# Size is an experience value there is no real limit.
|
||||||
# AFAIK there is no limit and no end character so we will usually
|
# AFAIK there is no limit and no end character so we will usually
|
||||||
# need to wait for timeout
|
# need to wait for timeout
|
||||||
ret = self.ser.read_until(size=20).decode("utf-8")
|
ret = self.serial.read_until(size=20).decode("utf-8")
|
||||||
except serial.SerialException:
|
except serial.SerialException:
|
||||||
_LOGGER.error("Problem communicating with %s", self._serial_port)
|
_LOGGER.error("Problem communicating with %s", self._serial_port)
|
||||||
self.ser.close()
|
self.serial.close()
|
||||||
return ret
|
return ret
|
||||||
|
|
||||||
def _write_read_format(self, msg: str) -> str:
|
def _write_read_format(self, msg: str) -> str:
|
||||||
|
@ -64,7 +64,7 @@ async def async_setup_platform(
|
|||||||
keba,
|
keba,
|
||||||
"session_energy",
|
"session_energy",
|
||||||
SensorEntityDescription(
|
SensorEntityDescription(
|
||||||
key="E pres",
|
key="E pres", # codespell:ignore pres
|
||||||
name="Session Energy",
|
name="Session Energy",
|
||||||
native_unit_of_measurement=UnitOfEnergy.KILO_WATT_HOUR,
|
native_unit_of_measurement=UnitOfEnergy.KILO_WATT_HOUR,
|
||||||
device_class=SensorDeviceClass.ENERGY,
|
device_class=SensorDeviceClass.ENERGY,
|
||||||
|
@ -104,8 +104,8 @@ class MySensorsBinarySensor(mysensors.device.MySensorsChildEntity, BinarySensorE
|
|||||||
def __init__(self, *args: Any, **kwargs: Any) -> None:
|
def __init__(self, *args: Any, **kwargs: Any) -> None:
|
||||||
"""Set up the instance."""
|
"""Set up the instance."""
|
||||||
super().__init__(*args, **kwargs)
|
super().__init__(*args, **kwargs)
|
||||||
pres = self.gateway.const.Presentation
|
presentation = self.gateway.const.Presentation
|
||||||
self.entity_description = SENSORS[pres(self.child_type).name]
|
self.entity_description = SENSORS[presentation(self.child_type).name]
|
||||||
|
|
||||||
@property
|
@property
|
||||||
def is_on(self) -> bool:
|
def is_on(self) -> bool:
|
||||||
|
@ -168,11 +168,9 @@ def invalid_msg(
|
|||||||
gateway: BaseAsyncGateway, child: ChildSensor, value_type_name: ValueType
|
gateway: BaseAsyncGateway, child: ChildSensor, value_type_name: ValueType
|
||||||
) -> str:
|
) -> str:
|
||||||
"""Return a message for an invalid child during schema validation."""
|
"""Return a message for an invalid child during schema validation."""
|
||||||
pres = gateway.const.Presentation
|
presentation = gateway.const.Presentation
|
||||||
set_req = gateway.const.SetReq
|
set_req = gateway.const.SetReq
|
||||||
return (
|
return f"{presentation(child.type).name} requires value_type {set_req[value_type_name].name}"
|
||||||
f"{pres(child.type).name} requires value_type {set_req[value_type_name].name}"
|
|
||||||
)
|
|
||||||
|
|
||||||
|
|
||||||
def validate_set_msg(
|
def validate_set_msg(
|
||||||
@ -202,10 +200,10 @@ def validate_child(
|
|||||||
) -> defaultdict[Platform, list[DevId]]:
|
) -> defaultdict[Platform, list[DevId]]:
|
||||||
"""Validate a child. Returns a dict mapping hass platform names to list of DevId."""
|
"""Validate a child. Returns a dict mapping hass platform names to list of DevId."""
|
||||||
validated: defaultdict[Platform, list[DevId]] = defaultdict(list)
|
validated: defaultdict[Platform, list[DevId]] = defaultdict(list)
|
||||||
pres: type[IntEnum] = gateway.const.Presentation
|
presentation: type[IntEnum] = gateway.const.Presentation
|
||||||
set_req: type[IntEnum] = gateway.const.SetReq
|
set_req: type[IntEnum] = gateway.const.SetReq
|
||||||
child_type_name: SensorType | None = next(
|
child_type_name: SensorType | None = next(
|
||||||
(member.name for member in pres if member.value == child.type), None
|
(member.name for member in presentation if member.value == child.type), None
|
||||||
)
|
)
|
||||||
if not child_type_name:
|
if not child_type_name:
|
||||||
_LOGGER.warning("Child type %s is not supported", child.type)
|
_LOGGER.warning("Child type %s is not supported", child.type)
|
||||||
|
@ -318,9 +318,9 @@ class MySensorsSensor(mysensors.device.MySensorsChildEntity, SensorEntity):
|
|||||||
entity_description = SENSORS.get(set_req(self.value_type).name)
|
entity_description = SENSORS.get(set_req(self.value_type).name)
|
||||||
|
|
||||||
if not entity_description:
|
if not entity_description:
|
||||||
pres = self.gateway.const.Presentation
|
presentation = self.gateway.const.Presentation
|
||||||
entity_description = SENSORS.get(
|
entity_description = SENSORS.get(
|
||||||
f"{set_req(self.value_type).name}_{pres(self.child_type).name}"
|
f"{set_req(self.value_type).name}_{presentation(self.child_type).name}"
|
||||||
)
|
)
|
||||||
|
|
||||||
return entity_description
|
return entity_description
|
||||||
|
@ -33,7 +33,7 @@ def test_boolean() -> None:
|
|||||||
"T",
|
"T",
|
||||||
"negative",
|
"negative",
|
||||||
"lock",
|
"lock",
|
||||||
"tr ue",
|
"tr ue", # codespell:ignore ue
|
||||||
[],
|
[],
|
||||||
[1, 2],
|
[1, 2],
|
||||||
{"one": "two"},
|
{"one": "two"},
|
||||||
@ -1492,7 +1492,7 @@ def test_whitespace() -> None:
|
|||||||
"T",
|
"T",
|
||||||
"negative",
|
"negative",
|
||||||
"lock",
|
"lock",
|
||||||
"tr ue",
|
"tr ue", # codespell:ignore ue
|
||||||
[],
|
[],
|
||||||
[1, 2],
|
[1, 2],
|
||||||
{"one": "two"},
|
{"one": "two"},
|
||||||
|
Loading…
x
Reference in New Issue
Block a user