generated from Hochfrequenz/python_template_repository
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
move element distinction logic to separate module (#7)
- Loading branch information
Showing
2 changed files
with
45 additions
and
35 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
"""shared logic between MIG and AHB reader to distinguish elements from the XML""" | ||
|
||
import xml.etree.ElementTree as ET | ||
|
||
|
||
def _is_segment_group(element: ET.Element) -> bool: | ||
""" | ||
returns True if the given element is a segment group | ||
""" | ||
return element.tag.startswith("G_SG") | ||
|
||
|
||
def _is_segment(element: ET.Element) -> bool: | ||
""" | ||
returns True if the given element is a segment | ||
""" | ||
return element.tag.startswith("S_") | ||
|
||
|
||
def _is_data_element_group(element: ET.Element) -> bool: | ||
""" | ||
returns True if the given element is a data element group | ||
""" | ||
return element.tag.startswith("C_") | ||
|
||
|
||
def _is_data_element(element: ET.Element) -> bool: | ||
""" | ||
returns True if the given element is a data element | ||
""" | ||
return element.tag.startswith("D_") | ||
|
||
|
||
def _is_code(element: ET.Element) -> bool: | ||
""" | ||
returns True if the given element is a code | ||
""" | ||
return element.tag == "Code" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters