diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index ed28852fd81..f057931e2a8 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -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] diff --git a/homeassistant/components/acer_projector/switch.py b/homeassistant/components/acer_projector/switch.py index 5c1c37df5d8..c1463cd9a08 100644 --- a/homeassistant/components/acer_projector/switch.py +++ b/homeassistant/components/acer_projector/switch.py @@ -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: diff --git a/homeassistant/components/keba/sensor.py b/homeassistant/components/keba/sensor.py index 74c08933cbe..1878a7f6e49 100644 --- a/homeassistant/components/keba/sensor.py +++ b/homeassistant/components/keba/sensor.py @@ -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, diff --git a/homeassistant/components/mysensors/binary_sensor.py b/homeassistant/components/mysensors/binary_sensor.py index a0a1c92c682..b8a3769308a 100644 --- a/homeassistant/components/mysensors/binary_sensor.py +++ b/homeassistant/components/mysensors/binary_sensor.py @@ -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: diff --git a/homeassistant/components/mysensors/helpers.py b/homeassistant/components/mysensors/helpers.py index f060f3313dc..74dc99e76d3 100644 --- a/homeassistant/components/mysensors/helpers.py +++ b/homeassistant/components/mysensors/helpers.py @@ -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) diff --git a/homeassistant/components/mysensors/sensor.py b/homeassistant/components/mysensors/sensor.py index a6a91c12a81..9c6c0de89e6 100644 --- a/homeassistant/components/mysensors/sensor.py +++ b/homeassistant/components/mysensors/sensor.py @@ -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 diff --git a/tests/helpers/test_config_validation.py b/tests/helpers/test_config_validation.py index cf72012a1f1..ac3af13949b 100644 --- a/tests/helpers/test_config_validation.py +++ b/tests/helpers/test_config_validation.py @@ -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"},