def elements_nested(self): """List of tuples containing the element name and the element""" result = [] generator = NamePrefixGenerator() generator_2 = UniqueNameGenerator() for elm in self: if isinstance(elm, (All, Choice, Group, Sequence)): if elm.accepts_multiple: result.append((generator.get_name(), elm)) else: for sub_name, sub_elm in elm.elements: sub_name = generator_2.create_name(sub_name) result.append((None, elm)) elif isinstance(elm, (Any, Choice)): result.append((generator.get_name(), elm)) else: name = generator_2.create_name(elm.name) result.append((name, elm)) return result
def elements_nested(self): """List of tuples containing the element name and the element""" result = [] generator = NamePrefixGenerator() generator_2 = UniqueNameGenerator() for elm in self: if isinstance(elm, (All, Choice, Group, Sequence)): if elm.accepts_multiple: result.append((generator.get_name(), elm)) else: for sub_name, sub_elm in elm.elements: sub_name = generator_2.create_name(sub_name) result.append((None, elm)) elif isinstance(elm, (Any, Choice)): result.append((generator.get_name(), elm)) else: name = generator_2.create_name(elm.name) result.append((name, elm)) return result