def get_section_hdrgos_nts(self, sortby=None):
        """Get a flat list of sections and hdrgos actually used in grouping."""
        nts_all = []
        section_hdrgos_actual = self.get_sections_2d()
        flds_all = ['Section'] + self.gosubdag.prt_attr['flds']
        ntobj = cx.namedtuple("NtGoSec", " ".join(flds_all))
        flds_go = None
        if sortby is None:
            sortby = lambda nt: -1*nt.dcnt
        for section_name, hdrgos_actual in section_hdrgos_actual:
            nts_sec = []
            for hdrgo_nt in self.gosubdag.get_go2nt(hdrgos_actual).values():
                if flds_go is None:
                    flds_go = hdrgo_nt._fields
                key2val = {key:val for key, val in zip(flds_go, list(hdrgo_nt))}
                key2val['Section'] = section_name
                nts_sec.append(ntobj(**key2val))
            nts_all.extend(sorted(nts_sec, key=sortby))
        return nts_all
def get_section_hdrgos_nts ( self , sortby = None ) : nts_all = [ ] section_hdrgos_actual = self . get_sections_2d ( ) flds_all = [ 'Section' ] + self . gosubdag . prt_attr [ 'flds' ] ntobj = cx . namedtuple ( "NtGoSec" , " " . join ( flds_all ) ) flds_go = None if sortby is None : sortby = lambda nt : - 1 * nt . dcnt for section_name , hdrgos_actual in section_hdrgos_actual : nts_sec = [ ] for hdrgo_nt in self . gosubdag . get_go2nt ( hdrgos_actual ) . values ( ) : if flds_go is None : flds_go = hdrgo_nt . _fields key2val = { key : val for key , val in zip ( flds_go , list ( hdrgo_nt ) ) } key2val [ 'Section' ] = section_name nts_sec . append ( ntobj ( ** key2val ) ) nts_all . extend ( sorted ( nts_sec , key = sortby ) ) return nts_all
Get a flat list of sections and hdrgos actually used in grouping.