5959from packaging import version
6060
6161
62- def search_actuator_functionalities (appliance : etree , actuator : str ) -> etree | None :
62+ def search_actuator_functionalities (
63+ appliance : etree .Element , actuator : str
64+ ) -> etree .Element | None :
6365 """Helper-function for finding the relevant actuator xml-structure."""
6466 locator = f"./actuator_functionalities/{ actuator } "
6567 if (search := appliance .find (locator )) is not None :
@@ -213,7 +215,7 @@ def _all_locations(self) -> None:
213215 f"./location[@id='{ loc .loc_id } ']"
214216 )
215217
216- def _appliance_info_finder (self , appl : Munch , appliance : etree ) -> Munch :
218+ def _appliance_info_finder (self , appl : Munch , appliance : etree . Element ) -> Munch :
217219 """Collect info for all appliances found."""
218220 match appl .pwclass :
219221 case "gateway" :
@@ -253,7 +255,7 @@ def _appliance_info_finder(self, appl: Munch, appliance: etree) -> Munch:
253255 case _: # pragma: no cover
254256 return appl
255257
256- def _appl_gateway_info (self , appl : Munch , appliance : etree ) -> Munch :
258+ def _appl_gateway_info (self , appl : Munch , appliance : etree . Element ) -> Munch :
257259 """Helper-function for _appliance_info_finder()."""
258260 self ._gateway_id = appliance .attrib ["id" ]
259261 appl .firmware = str (self .smile_version )
@@ -286,7 +288,7 @@ def _appl_gateway_info(self, appl: Munch, appliance: etree) -> Munch:
286288 return appl
287289
288290 def _get_appl_actuator_modes (
289- self , appliance : etree , actuator_type : str
291+ self , appliance : etree . Element , actuator_type : str
290292 ) -> list [str ]:
291293 """Get allowed modes for the given actuator type."""
292294 mode_list : list [str ] = []
@@ -398,7 +400,7 @@ def _power_data_from_location(self) -> GwEntityData:
398400
399401 def _appliance_measurements (
400402 self ,
401- appliance : etree ,
403+ appliance : etree . Element ,
402404 data : GwEntityData ,
403405 measurements : dict [str , DATA | UOM ],
404406 ) -> None :
@@ -430,7 +432,7 @@ def _appliance_measurements(
430432 self ._count = count_data_items (self ._count , data )
431433
432434 def _get_toggle_state (
433- self , xml : etree , toggle : str , name : ToggleNameType , data : GwEntityData
435+ self , xml : etree . Element , toggle : str , name : ToggleNameType , data : GwEntityData
434436 ) -> None :
435437 """Helper-function for _get_measurement_data().
436438
@@ -459,7 +461,7 @@ def _get_plugwise_notifications(self) -> None:
459461 )
460462
461463 def _get_actuator_functionalities (
462- self , xml : etree , entity : GwEntityData , data : GwEntityData
464+ self , xml : etree . Element , entity : GwEntityData , data : GwEntityData
463465 ) -> None :
464466 """Get and process the actuator_functionalities details for an entity.
465467
@@ -521,7 +523,7 @@ def _get_actuator_functionalities(
521523 data [act_item ] = temp_dict
522524
523525 def _get_actuator_mode (
524- self , appliance : etree , entity_id : str , key : str
526+ self , appliance : etree . Element , entity_id : str , key : str
525527 ) -> str | None :
526528 """Helper-function for _get_regulation_mode and _get_gateway_mode.
527529
@@ -536,7 +538,7 @@ def _get_actuator_mode(
536538 return None
537539
538540 def _get_regulation_mode (
539- self , appliance : etree , entity_id : str , data : GwEntityData
541+ self , appliance : etree . Element , entity_id : str , data : GwEntityData
540542 ) -> None :
541543 """Helper-function for _get_measurement_data().
542544
@@ -552,7 +554,7 @@ def _get_regulation_mode(
552554 self ._cooling_enabled = mode == "cooling"
553555
554556 def _get_gateway_mode (
555- self , appliance : etree , entity_id : str , data : GwEntityData
557+ self , appliance : etree . Element , entity_id : str , data : GwEntityData
556558 ) -> None :
557559 """Helper-function for _get_measurement_data().
558560
@@ -838,9 +840,7 @@ def _presets(self, loc_id: str) -> dict[str, list[float]]:
838840 return presets # pragma: no cover
839841
840842 for rule_id in rule_ids :
841- directives : etree = self ._domain_objects .find (
842- f'rule[@id="{ rule_id } "]/directives'
843- )
843+ directives = self ._domain_objects .find (f'rule[@id="{ rule_id } "]/directives' )
844844 for directive in directives :
845845 preset = directive .find ("then" ).attrib
846846 presets [directive .attrib ["preset" ]] = [
0 commit comments