(session, db_kb, comments)
:param session:
        :param DbKnowledgeBase db_kb:
        :param Comments comments:
        :return:                        None
def dump(session, db_kb, comments):
        """

        :param session:
        :param DbKnowledgeBase db_kb:
        :param Comments comments:
        :return:                        None
        """

        for addr, comment in comments.items():
            db_comment = session.query(DbComment).filter_by(
                kb=db_kb,
                addr=addr,
            ).scalar()
            if db_comment is not None:
                if comment == db_comment.comment:
                    continue
                db_comment.comment = comment
            else:
                db_comment = DbComment(
                    kb=db_kb,
                    addr=addr,
                    comment=comment,
                    type=0,
                )
                session.add(db_comment)
def dump ( session , db_kb , comments ) : for addr , comment in comments . items ( ) : db_comment = session . query ( DbComment ) . filter_by ( kb = db_kb , addr = addr , ) . scalar ( ) if db_comment is not None : if comment == db_comment . comment : continue db_comment . comment = comment else : db_comment = DbComment ( kb = db_kb , addr = addr , comment = comment , type = 0 , ) session . add ( db_comment )