sec_parser.utils.bs4_.is_unary_tree
Functions
|
is_unary_tree determines if a BeautifulSoup tag forms a unary tree. |
Module Contents
- sec_parser.utils.bs4_.is_unary_tree.is_unary_tree(tag: bs4.Tag) bool
is_unary_tree determines if a BeautifulSoup tag forms a unary tree. In a unary tree, each node has at most one child.
Unary trees can contain NavigableString leaves. However, if a non-leaf node contains a non-empty NavigableString, the tree is not considered unary.
Additionally, if the some tag is a ‘table’, the function will return True regardless of its children. This is because in the context of this application, ‘table’ tags are always considered unary.