Clean up codespell words (#123541)
This commit is contained in:
parent
257742de46
commit
13b12a7657
7 changed files with 18 additions and 20 deletions
|
@ -12,7 +12,7 @@ repos:
|
|||
hooks:
|
||||
- id: codespell
|
||||
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"
|
||||
- --quiet-level=2
|
||||
exclude_types: [csv, json, html]
|
||||
|
|
|
@ -81,7 +81,7 @@ class AcerSwitch(SwitchEntity):
|
|||
write_timeout: int,
|
||||
) -> None:
|
||||
"""Init of the Acer projector."""
|
||||
self.ser = serial.Serial(
|
||||
self.serial = serial.Serial(
|
||||
port=serial_port, timeout=timeout, write_timeout=write_timeout
|
||||
)
|
||||
self._serial_port = serial_port
|
||||
|
@ -99,16 +99,16 @@ class AcerSwitch(SwitchEntity):
|
|||
# was disconnected during runtime.
|
||||
# This way the projector can be reconnected and will still work
|
||||
try:
|
||||
if not self.ser.is_open:
|
||||
self.ser.open()
|
||||
self.ser.write(msg.encode("utf-8"))
|
||||
if not self.serial.is_open:
|
||||
self.serial.open()
|
||||
self.serial.write(msg.encode("utf-8"))
|
||||
# Size is an experience value there is no real limit.
|
||||
# AFAIK there is no limit and no end character so we will usually
|
||||
# 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:
|
||||
_LOGGER.error("Problem communicating with %s", self._serial_port)
|
||||
self.ser.close()
|
||||
self.serial.close()
|
||||
return ret
|
||||
|
||||
def _write_read_format(self, msg: str) -> str:
|
||||
|
|
|
@ -64,7 +64,7 @@ async def async_setup_platform(
|
|||
keba,
|
||||
"session_energy",
|
||||
SensorEntityDescription(
|
||||
key="E pres",
|
||||
key="E pres", # codespell:ignore pres
|
||||
name="Session Energy",
|
||||
native_unit_of_measurement=UnitOfEnergy.KILO_WATT_HOUR,
|
||||
device_class=SensorDeviceClass.ENERGY,
|
||||
|
|
|
@ -104,8 +104,8 @@ class MySensorsBinarySensor(mysensors.device.MySensorsChildEntity, BinarySensorE
|
|||
def __init__(self, *args: Any, **kwargs: Any) -> None:
|
||||
"""Set up the instance."""
|
||||
super().__init__(*args, **kwargs)
|
||||
pres = self.gateway.const.Presentation
|
||||
self.entity_description = SENSORS[pres(self.child_type).name]
|
||||
presentation = self.gateway.const.Presentation
|
||||
self.entity_description = SENSORS[presentation(self.child_type).name]
|
||||
|
||||
@property
|
||||
def is_on(self) -> bool:
|
||||
|
|
|
@ -168,11 +168,9 @@ def invalid_msg(
|
|||
gateway: BaseAsyncGateway, child: ChildSensor, value_type_name: ValueType
|
||||
) -> str:
|
||||
"""Return a message for an invalid child during schema validation."""
|
||||
pres = gateway.const.Presentation
|
||||
presentation = gateway.const.Presentation
|
||||
set_req = gateway.const.SetReq
|
||||
return (
|
||||
f"{pres(child.type).name} requires value_type {set_req[value_type_name].name}"
|
||||
)
|
||||
return f"{presentation(child.type).name} requires value_type {set_req[value_type_name].name}"
|
||||
|
||||
|
||||
def validate_set_msg(
|
||||
|
@ -202,10 +200,10 @@ def validate_child(
|
|||
) -> defaultdict[Platform, list[DevId]]:
|
||||
"""Validate a child. Returns a dict mapping hass platform names to list of DevId."""
|
||||
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
|
||||
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:
|
||||
_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)
|
||||
|
||||
if not entity_description:
|
||||
pres = self.gateway.const.Presentation
|
||||
presentation = self.gateway.const.Presentation
|
||||
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
|
||||
|
|
|
@ -33,7 +33,7 @@ def test_boolean() -> None:
|
|||
"T",
|
||||
"negative",
|
||||
"lock",
|
||||
"tr ue",
|
||||
"tr ue", # codespell:ignore ue
|
||||
[],
|
||||
[1, 2],
|
||||
{"one": "two"},
|
||||
|
@ -1492,7 +1492,7 @@ def test_whitespace() -> None:
|
|||
"T",
|
||||
"negative",
|
||||
"lock",
|
||||
"tr ue",
|
||||
"tr ue", # codespell:ignore ue
|
||||
[],
|
||||
[1, 2],
|
||||
{"one": "two"},
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue