cls

returns elements that are the only child of their parent.

Source


def select_only_child(self):
    ret = pyNodeList()
    for node in self:
        if node.has_parent():
            if len(node.parent().children()) == 1:
                ret.append(node)
    if len(ret) == 1: return ret[0]
    else: return ret