def __init__(self, archive, obj, symbol, sections, target): if archive == "*": archive = None if obj == "*": obj = None self.archive = archive self.obj = obj self.symbol = symbol self.target = target self.sections = dict() self.specificity = 0 self.specificity += 1 if self.archive else 0 self.specificity += 1 if (self.obj and not self.obj == '*') else 0 self.specificity += 1 if self.symbol else 0 for section in sections: section_data = Sections.get_section_data_from_entry(section, self.symbol) if not self.symbol: for s in section_data: metadata = self.__metadata(self.__container([]), self.__container([]), self.__container(False)) self.sections[s] = metadata else: (section, expansion) = section_data if expansion: metadata = self.__metadata(self.__container([]), self.__container([expansion]), self.__container(True)) self.sections[section] = metadata
def get_section_strs(section): s_list = [ Sections.get_section_data_from_entry(s) for s in section.entries ] return frozenset([item for sublist in s_list for item in sublist])
def _add_sections(self, text): parser = Sections.get_fragment_grammar() fragment = parser.parseString(text, parseAll=True) self.model.sections[fragment[0].name] = fragment[0]