(session, db_kb: 'DbKnowledgeBase', code_manager: StructuredCodeManager)
:param session:
        :param db_kb:
        :param code_manager:
        :return:
def dump(session, db_kb: 'DbKnowledgeBase', code_manager: StructuredCodeManager):
        """

        :param session:
        :param db_kb:
        :param code_manager:
        :return:
        """

        # remove all existing stored structured code
        session.query(DbStructuredCode).filter_by(kb=db_kb).delete()

        for key, cache in code_manager.cached.items():
            func_addr, flavor = key

            # TODO: Cache types

            expr_comments = None
            if cache.codegen.expr_comments:
                expr_comments = json.dumps(cache.codegen.expr_comments).encode("utf-8")

            stmt_comments = None
            if cache.codegen.stmt_comments:
                stmt_comments = json.dumps(cache.codegen.stmt_comments).encode("utf-8")

            db_code = DbStructuredCode(
                kb=db_kb,
                func_addr=func_addr,
                flavor=flavor,
                expr_comments=expr_comments,
                stmt_comments=stmt_comments,
                # configuration=configuration,
            )
            session.add(db_code)
def dump ( session , db_kb : 'DbKnowledgeBase' , code_manager : StructuredCodeManager ) : # remove all existing stored structured code session . query ( DbStructuredCode ) . filter_by ( kb = db_kb ) . delete ( ) for key , cache in code_manager . cached . items ( ) : func_addr , flavor = key # TODO: Cache types expr_comments = None if cache . codegen . expr_comments : expr_comments = json . dumps ( cache . codegen . expr_comments ) . encode ( "utf-8" ) stmt_comments = None if cache . codegen . stmt_comments : stmt_comments = json . dumps ( cache . codegen . stmt_comments ) . encode ( "utf-8" ) db_code = DbStructuredCode ( kb = db_kb , func_addr = func_addr , flavor = flavor , expr_comments = expr_comments , stmt_comments = stmt_comments , # configuration=configuration, ) session . add ( db_code )