Skip to content

Commit

Permalink
Recover m_xpath to check if sibling_section_name exists under section…
Browse files Browse the repository at this point in the history
….m_parent
  • Loading branch information
JosePizarro3 committed Feb 13, 2024
1 parent 5d829d5 commit a07b9ae
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions simulationdataschema/utils/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -59,10 +59,10 @@ def get_sibling_section(
return

# Check if the sibling_section exists in the parent of section
if not hasattr(section.m_parent, sibling_section_name):
sibling_section = section.m_parent.m_xpath(sibling_section_name, dict=False)
if not sibling_section:
logger.warning("Could not find the section.m_parent.sibling_section.")
return
sibling_section = getattr(section.m_parent, sibling_section_name)

# If the sibling_section is a list, return the element `index_sibling` of that list
if isinstance(sibling_section, list):
Expand Down

0 comments on commit a07b9ae

Please sign in to comment.