Skip to content

Commit 279ba0e

Browse files
committed
Properly deal with undocumented @Units as discussed w/ @sherjeelshabih
1 parent 116f099 commit 279ba0e

File tree

1 file changed

+9
-4
lines changed

1 file changed

+9
-4
lines changed

pynxtools/dataconverter/helpers.py

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -545,10 +545,15 @@ def try_undocumented(data, nxdl_root: ET.Element):
545545
nxdl_path = convert_data_converter_dict_to_nxdl_path(path)
546546

547547
if entry_name == "@units":
548-
if (
549-
path.rsplit("/", 1)[0] in data.get_documented()
550-
and path in data.undocumented
551-
):
548+
field_path = path.rsplit("/", 1)[0]
549+
if field_path in data.get_documented() and path in data.undocumented:
550+
field_requiredness = get_required_string(
551+
nexus.get_node_at_nxdl_path(
552+
nxdl_path=convert_data_converter_dict_to_nxdl_path(field_path),
553+
elem=nxdl_root,
554+
)
555+
)
556+
data[field_requiredness][path] = data.undocumented[path]
552557
del data.undocumented[path]
553558
continue
554559

0 commit comments

Comments
 (0)