示例#1
0
 def get_annot_viewpoint_stats(ibs, aid_list):
     annots = ibs.annots(aid_list)
     viewcode2_nAnnots = ut.order_dict_by(
         ut.map_vals(len, annots.group_items(annots.viewpoint_code)),
         list(ibs.const.VIEW.CODE_TO_INT.keys()) + [None],
     )
     return viewcode2_nAnnots
示例#2
0
    def fix_conference_places(bibman):

        pubman = constants_tex_fixes.PubManager()

        needed = set()

        for entry in bibman.cleaned.values():
            if entry['pub_type'] == 'conference':
                accro, year = (entry['pub_accro'], entry['year'])
                pub = pubman.find(accro)
                if pub.places is None or int(year) not in pub.places:
                    needed.add((accro, year))
                else:
                    place = pub.places[int(year)]
                    print('place = {!r}'.format(place))
                    entry['address'] = place

        if needed:
            needed = list(needed)
            used_years = ub.group_items(needed, ut.take_column(needed, 0))
            for k, v in list(used_years.items()):
                used_years[k] = sorted(v)

            sortby = ub.map_vals(lambda vs: (len(vs), max(e[1] for e in vs)),
                                 used_years)
            used_years = ut.order_dict_by(used_years, ub.argsort(sortby))
            print('NEED CONFERENCE LOCATIONS')
            print(ub.repr2(used_years, nl=2))
示例#3
0
 def get_annot_qual_stats(ibs, aid_list):
     annots = ibs.annots(aid_list)
     qualtext2_nAnnots = ut.order_dict_by(
         ut.map_vals(len, annots.group_items(annots.quality_texts)),
         list(ibs.const.QUALITY_TEXT_TO_INT.keys()),
     )
     return qualtext2_nAnnots
示例#4
0
    def _read_raw_entries(bibman):
        parser = bparser.BibTexParser()
        ut.delete_keys(parser.alt_dict, ['url', 'urls'])
        parser.ignore_nonstandard_types = False
        text = ut.readfrom(bibman.fpath)

        # ensure good format
        flag = 0
        for x in re.finditer('^.*}\n[^}\n]', text, flags=re.MULTILINE):
            lineno = x.string[:x.start()].count('\n') + 1
            print('DID YOU FORGET A COMMA ON lineno = {!r}'.format(lineno))
            print(x.group())
            flag += 1
        assert not flag, 'fix formating'

        database = parser.parse(text)
        entries = database.entries
        raw_entries = database.get_entry_dict()
        raw_entries = ut.order_dict_by(raw_entries, [e['ID'] for e in entries])
        bibman.raw_text = text
        bibman.raw_entries = raw_entries