annotations.py 文件源码

python
阅读 28 收藏 0 点赞 0 评论 0

项目:esys-pbi 作者: fsxfreak 项目源码 文件源码
def export_annotations(self,export_range,export_dir):

        if not self.annotations:
            logger.warning('No annotations in this recording nothing to export')
            return

        annotations_in_section = chain(*self.annotations_by_frame[export_range])
        annotations_in_section = list({a['index']: a for a in annotations_in_section}.values())  # remove duplicates
        annotations_in_section.sort(key=lambda a:a['index'])

        with open(os.path.join(export_dir,'annotations.csv'),'w',encoding='utf-8',newline='') as csvfile:
            csv_writer = csv.writer(csvfile)
            csv_writer.writerow(self.csv_representation_keys())
            for a in annotations_in_section:
                csv_writer.writerow(self.csv_representation_for_annotations(a))
            logger.info("Created 'annotations.csv' file.")
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号