@@ -46,7 +46,7 @@ def decode_or_not(elem, encoding: str = "utf-8", decode: bool = True):
4646 try :
4747 return elem .decode (encoding )
4848 except UnicodeDecodeError as e :
49- raise ValueError ( "Error decoding bytes" ) from e
49+ raise UnicodeDecodeError ( f "Error decoding bytes: { e } " )
5050
5151 return elem
5252
@@ -316,11 +316,19 @@ def is_name_type(child, name_type_value: str) -> bool:
316316 name_type_value (str): The nameType value to compare against ("any" or "partial").
317317
318318 """
319- return child .attrib .get ("nameType" ) == name_type_value or (
320- get_local_name_from_xml (child ) == "group"
321- and "nameType" not in child .attrib
322- and "name" not in child .attrib
323- )
319+ if (child .attrib .get ("nameType" ) == name_type_value ):
320+ return True
321+
322+
323+ if name_type_value == "any" and (
324+ get_local_name_from_xml (child ) == "group" and
325+ "nameType" not in child .attrib and
326+ "name" not in child .attrib ):
327+ return True
328+ return False
329+
330+
331+
324332
325333
326334def belongs_to (nxdl_elem , child , name , class_type = None , hdf_name = None ):
@@ -850,7 +858,11 @@ def get_best_child(nxdl_elem, hdf_node, hdf_name, hdf_class_name, nexus_type):
850858 nexus_type != "group" or get_nx_class (child ) == hdf_class_name
851859 ):
852860 name_any = is_name_type (child , "any" )
861+ < << << << Updated upstream
853862 name_partial = child .attrib .get ("nameType" ) == "partial"
863+ == == == =
864+ name_partial = is_name_type (child , "partial" )
865+ >> >> >> > Stashed changes
854866 if name_partial or name_any :
855867 fit = get_nx_namefit (
856868 hdf_name ,
0 commit comments