def _get_yin_element_class(name): yin_element_class_map = { 'module': ModuleElement, 'rpc': RpcElement, 'container': ContainerElement, 'leaf': LeafElement, 'leaf-list': LeafListElement, 'list': ListElement, 'anyxml': AnyxmlElement, 'type': TypeElement, 'typedef': TypedefElement, 'bit': BitElement, 'enum': EnumElement, 'pattern': PatternElement, 'when': WhenElement, 'identity': IdentityElement } try: element_class = yin_element_class_map[name] except KeyError: if _common.is_data_definition(name): element_class = DataDefinitionElement else: element_class = YinElement return element_class
def test_is_not_data_definition(keyword): assert not _common.is_data_definition(keyword)
def iterate_data_definitions(self): for child in self: if _common.is_data_definition(etree.QName(child.tag).localname): yield child
def _is_member_of_grouping(statement): return (_common.is_data_definition(statement.keyword) and hasattr(statement, 'i_uses') and statement.i_uses is not None)