File tree Expand file tree Collapse file tree 1 file changed +11
-4
lines changed
Expand file tree Collapse file tree 1 file changed +11
-4
lines changed Original file line number Diff line number Diff line change 1111from munch import Munch
1212
1313
14+ def get_vendor_name (module : etree , model_data : ModelData ) -> ModelData :
15+ """Helper-function for _get_model_data()."""
16+ if (vendor_name := module .find ("vendor_name" ).text ) is not None :
17+ model_data ["vendor_name" ] = vendor_name
18+ if "Plugwise" in vendor_name :
19+ model_data ["vendor_name" ] = vendor_name .split (" " , 1 )[0 ]
20+
21+ return model_data
22+
23+
1424class SmileCommon :
1525 """The SmileCommon class."""
1626
@@ -112,10 +122,7 @@ def _get_module_data(
112122 module = xml_2 .find (loc )
113123 if module is not None : # pylint: disable=consider-using-assignment-expr
114124 model_data ["contents" ] = True
115- if (vendor_name := module .find ("vendor_name" ).text ) is not None :
116- model_data ["vendor_name" ] = vendor_name
117- if "Plugwise" in vendor_name :
118- model_data ["vendor_name" ] = vendor_name .split (" " , 1 )[0 ]
125+ get_vendor_name (module , model_data )
119126 model_data ["vendor_model" ] = module .find ("vendor_model" ).text
120127 model_data ["hardware_version" ] = module .find ("hardware_version" ).text
121128 model_data ["firmware_version" ] = module .find ("firmware_version" ).text
You can’t perform that action at this time.
0 commit comments