Skip to content

Commit ccdf4d2

Browse files
committed
Better function-name
1 parent b7c12f6 commit ccdf4d2

File tree

2 files changed

+5
-5
lines changed

2 files changed

+5
-5
lines changed

plugwise/common.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
from __future__ import annotations
66

77
from plugwise.constants import ModelData
8-
from plugwise.util import check_heater_central, check_model, get_vendor_name, safe
8+
from plugwise.util import check_heater_central, check_model, get_vendor_name, return_valid
99

1010
from defusedxml import ElementTree as etree
1111
from munch import Munch
@@ -32,7 +32,7 @@ def _appl_thermostat_info(self, appl: Munch, xml_1: etree, xml_2: etree = None)
3232
"""Helper-function for _appliance_info_finder()."""
3333
locator = "./logs/point_log[type='thermostat']/thermostat"
3434
mod_type = "thermostat"
35-
xml_2 = safe(xml_2, self._domain_objects)
35+
xml_2 = return_valid(xml_2, self._domain_objects)
3636
module_data = self._get_module_data(xml_1, locator, mod_type, xml_2)
3737
appl.vendor_name = module_data["vendor_name"]
3838
appl.model = check_model(module_data["vendor_model"], appl.vendor_name)
@@ -56,7 +56,7 @@ def _appl_heater_central_info(
5656

5757
# Find the valid heater_central
5858
# xml_2 self._appliances for legacy, self._domain_objects for actual
59-
xml_2 = safe(xml_2, self._domain_objects)
59+
xml_2 = return_valid(xml_2, self._domain_objects)
6060
self._heater_id = check_heater_central(xml_2)
6161

6262
# Info for On-Off device
@@ -73,7 +73,7 @@ def _appl_heater_central_info(
7373
mod_type = "boiler_state"
7474
# xml_1: appliance
7575
# xml_3: self._modules for legacy, self._domain_objects for actual
76-
xml_3 = safe(xml_3, self._domain_objects)
76+
xml_3 = return_valid(xml_3, self._domain_objects)
7777
module_data = self._get_module_data(xml_1, locator_1, mod_type, xml_3)
7878
if not module_data["contents"]:
7979
module_data = self._get_module_data(xml_1, locator_2, mod_type, xml_3)

plugwise/util.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -123,7 +123,7 @@ def remove_empty_platform_dicts(data: DeviceData) -> None:
123123
data.pop("switches")
124124

125125

126-
def safe(value: etree | None, default: etree) -> etree:
126+
def return_valid(value: etree | None, default: etree) -> etree:
127127
"""Return default when value is None."""
128128
return value if value is not None else default
129129

0 commit comments

Comments
 (0)