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 :
@@ -212,7 +214,7 @@ def _all_locations(self) -> None:
212214 f"./location[@id='{ loc .loc_id } ']"
213215 )
214216
215- def _appliance_info_finder (self , appl : Munch , appliance : etree ) -> Munch :
217+ def _appliance_info_finder (self , appl : Munch , appliance : etree . Element ) -> Munch :
216218 """Collect info for all appliances found."""
217219 match appl .pwclass :
218220 case "gateway" :
@@ -252,7 +254,7 @@ def _appliance_info_finder(self, appl: Munch, appliance: etree) -> Munch:
252254 case _: # pragma: no cover
253255 return appl
254256
255- def _appl_gateway_info (self , appl : Munch , appliance : etree ) -> Munch :
257+ def _appl_gateway_info (self , appl : Munch , appliance : etree . Element ) -> Munch :
256258 """Helper-function for _appliance_info_finder()."""
257259 self ._gateway_id = appliance .attrib ["id" ]
258260 appl .firmware = str (self .smile_version )
@@ -285,7 +287,7 @@ def _appl_gateway_info(self, appl: Munch, appliance: etree) -> Munch:
285287 return appl
286288
287289 def _get_appl_actuator_modes (
288- self , appliance : etree , actuator_type : str
290+ self , appliance : etree . Element , actuator_type : str
289291 ) -> list [str ]:
290292 """Get allowed modes for the given actuator type."""
291293 mode_list : list [str ] = []
@@ -397,7 +399,7 @@ def _power_data_from_location(self) -> GwEntityData:
397399
398400 def _appliance_measurements (
399401 self ,
400- appliance : etree ,
402+ appliance : etree . Element ,
401403 data : GwEntityData ,
402404 measurements : dict [str , DATA | UOM ],
403405 ) -> None :
@@ -429,7 +431,7 @@ def _appliance_measurements(
429431 self ._count = count_data_items (self ._count , data )
430432
431433 def _get_toggle_state (
432- self , xml : etree , toggle : str , name : ToggleNameType , data : GwEntityData
434+ self , xml : etree . Element , toggle : str , name : ToggleNameType , data : GwEntityData
433435 ) -> None :
434436 """Helper-function for _get_measurement_data().
435437
@@ -458,7 +460,7 @@ def _get_plugwise_notifications(self) -> None:
458460 )
459461
460462 def _get_actuator_functionalities (
461- self , xml : etree , entity : GwEntityData , data : GwEntityData
463+ self , xml : etree . Element , entity : GwEntityData , data : GwEntityData
462464 ) -> None :
463465 """Get and process the actuator_functionalities details for an entity.
464466
@@ -520,7 +522,7 @@ def _get_actuator_functionalities(
520522 data [act_item ] = temp_dict
521523
522524 def _get_actuator_mode (
523- self , appliance : etree , entity_id : str , key : str
525+ self , appliance : etree . Element , entity_id : str , key : str
524526 ) -> str | None :
525527 """Helper-function for _get_regulation_mode and _get_gateway_mode.
526528
@@ -535,7 +537,7 @@ def _get_actuator_mode(
535537 return None
536538
537539 def _get_regulation_mode (
538- self , appliance : etree , entity_id : str , data : GwEntityData
540+ self , appliance : etree . Element , entity_id : str , data : GwEntityData
539541 ) -> None :
540542 """Helper-function for _get_measurement_data().
541543
@@ -551,7 +553,7 @@ def _get_regulation_mode(
551553 self ._cooling_enabled = mode == "cooling"
552554
553555 def _get_gateway_mode (
554- self , appliance : etree , entity_id : str , data : GwEntityData
556+ self , appliance : etree . Element , entity_id : str , data : GwEntityData
555557 ) -> None :
556558 """Helper-function for _get_measurement_data().
557559
@@ -837,9 +839,7 @@ def _presets(self, loc_id: str) -> dict[str, list[float]]:
837839 return presets # pragma: no cover
838840
839841 for rule_id in rule_ids :
840- directives : etree = self ._domain_objects .find (
841- f'rule[@id="{ rule_id } "]/directives'
842- )
842+ directives = self ._domain_objects .find (f'rule[@id="{ rule_id } "]/directives' )
843843 for directive in directives :
844844 preset = directive .find ("then" ).attrib
845845 presets [directive .attrib ["preset" ]] = [
0 commit comments