Skip to content

Commit d731bff

Browse files
committed
Update all in [..., ...] constructs to using set()
1 parent 2cc0d7f commit d731bff

File tree

4 files changed

+10
-10
lines changed

4 files changed

+10
-10
lines changed

plugwise/helper.py

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -214,7 +214,7 @@ def __init__(self) -> None:
214214
self._thermo_locs: dict[str, ThermoLoc] = {}
215215
###################################################################
216216
# '_cooling_enabled' can refer to the state of the Elga heatpump
217-
# connected to an Anna. For Elga, 'elga_status_code' in [8, 9]
217+
# connected to an Anna. For Elga, 'elga_status_code' in (8, 9)
218218
# means cooling mode is available, next to heating mode.
219219
# 'elga_status_code' = 8 means cooling is active, 9 means idle.
220220
#
@@ -523,7 +523,7 @@ def _get_measurement_data(self, dev_id: str) -> DeviceData:
523523
# Techneco Elga has cooling-capability
524524
self._cooling_present = True
525525
data["model"] = "Generic heater/cooler"
526-
self._cooling_enabled = data["elga_status_code"] in [8, 9]
526+
self._cooling_enabled = data["elga_status_code"] in (8, 9)
527527
data["binary_sensors"]["cooling_state"] = self._cooling_active = (
528528
data["elga_status_code"] == 8
529529
)
@@ -590,7 +590,7 @@ def _appliance_measurements(
590590
data["select_dhw_mode"] = appl_p_loc.text
591591
case _ as measurement if measurement in BINARY_SENSORS:
592592
bs_key = cast(BinarySensorType, measurement)
593-
bs_value = appl_p_loc.text in ["on", "true"]
593+
bs_value = appl_p_loc.text in ("on", "true")
594594
data["binary_sensors"][bs_key] = bs_value
595595
case _ as measurement if measurement in SENSORS:
596596
s_key = cast(SensorType, measurement)
@@ -600,11 +600,11 @@ def _appliance_measurements(
600600
data["sensors"][s_key] = s_value
601601
case _ as measurement if measurement in SWITCHES:
602602
sw_key = cast(SwitchType, measurement)
603-
sw_value = appl_p_loc.text in ["on", "true"]
603+
sw_value = appl_p_loc.text in ("on", "true")
604604
data["switches"][sw_key] = sw_value
605605
case _ as measurement if measurement in SPECIALS:
606606
sp_key = cast(SpecialType, measurement)
607-
sp_value = appl_p_loc.text in ["on", "true"]
607+
sp_value = appl_p_loc.text in ("on", "true")
608608
data[sp_key] = sp_value
609609
case "elga_status_code":
610610
data["elga_status_code"] = int(appl_p_loc.text)

plugwise/legacy/helper.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -344,7 +344,7 @@ def _appliance_measurements(
344344
match measurement:
345345
case _ as measurement if measurement in BINARY_SENSORS:
346346
bs_key = cast(BinarySensorType, measurement)
347-
bs_value = appl_p_loc.text in ["on", "true"]
347+
bs_value = appl_p_loc.text in ("on", "true")
348348
data["binary_sensors"][bs_key] = bs_value
349349
case _ as measurement if measurement in SENSORS:
350350
s_key = cast(SensorType, measurement)
@@ -354,11 +354,11 @@ def _appliance_measurements(
354354
data["sensors"][s_key] = s_value
355355
case _ as measurement if measurement in SWITCHES:
356356
sw_key = cast(SwitchType, measurement)
357-
sw_value = appl_p_loc.text in ["on", "true"]
357+
sw_value = appl_p_loc.text in ("on", "true")
358358
data["switches"][sw_key] = sw_value
359359
case _ as measurement if measurement in SPECIALS:
360360
sp_key = cast(SpecialType, measurement)
361-
sp_value = appl_p_loc.text in ["on", "true"]
361+
sp_value = appl_p_loc.text in ("on", "true")
362362
data[sp_key] = sp_value
363363

364364
i_locator = f'.//logs/interval_log[type="{measurement}"]/period/measurement'

plugwise/legacy/smile.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -188,7 +188,7 @@ async def set_schedule_state(self, _: str, state: str, name: str | None) -> None
188188
Determined from - DOMAIN_OBJECTS.
189189
Used in HA Core to set the hvac_mode: in practice switch between schedule on - off.
190190
"""
191-
if state not in ["on", "off"]:
191+
if state not in ("on", "off"):
192192
raise PlugwiseError("Plugwise: invalid schedule state.")
193193

194194
# Handle no schedule-name / Off-schedule provided

plugwise/smile.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -266,7 +266,7 @@ async def set_schedule_state(
266266
Used in HA Core to set the hvac_mode: in practice switch between schedule on - off.
267267
"""
268268
# Input checking
269-
if new_state not in ["on", "off"]:
269+
if new_state not in ("on", "off"):
270270
raise PlugwiseError("Plugwise: invalid schedule state.")
271271

272272
# Translate selection of Off-schedule-option to disabling the active schedule

0 commit comments

Comments
 (0)