(raw_diffs)
return diffs
See: http://alembic.readthedocs.io/en/latest/api/autogenerate.html
    :param raw_diffs: from alembic
    :return: list of ``SimpleDiff`` tuples
See: http://alembic.readthedocs.io/en/latest/api/autogenerate.html
    :param raw_diffs: from alembic
    :return: list of ``SimpleDiff`` tuples
See : http : // alembic . readthedocs . io / en / latest / api / autogenerate . html : param raw_diffs : from alembic : return : list of SimpleDiff tuples
def reformat_alembic_diffs(raw_diffs):
    """
    See: http://alembic.readthedocs.io/en/latest/api/autogenerate.html
    :param raw_diffs: from alembic
    :return: list of ``SimpleDiff`` tuples
    """
    diffs = []

    def _simplify_diff(raw_diff):
        type_ = raw_diff[0]
        if type_ in DiffTypes.TABLE_TYPES:
            diffs.append(
                SimpleDiff(type_, raw_diff[1].name, None, raw_diff)
            )
        elif type_ in DiffTypes.CONSTRAINT_TYPES:
            any_column = list(raw_diff[1].columns.values())[0]
            table_name = any_column.table.name
            diffs.append(
                SimpleDiff(type_, table_name, raw_diff[1].name, raw_diff)
            )
        elif type_ in DiffTypes.MODIFY_TYPES:
            diffs.append(
                SimpleDiff(type_, raw_diff[2], raw_diff[3], raw_diff)
            )
        elif type_ == DiffTypes.ADD_COLUMN and raw_diff[3].nullable:
            diffs.append(
                SimpleDiff(DiffTypes.ADD_NULLABLE_COLUMN, raw_diff[2], raw_diff[3].name, raw_diff)
            )
        elif type_ in DiffTypes.COLUMN_TYPES:
            diffs.append(
                SimpleDiff(type_, raw_diff[2], raw_diff[3].name, raw_diff)
            )
        elif type_ in DiffTypes.INDEX_TYPES:
            diffs.append(SimpleDiff(type_, diff[1].table.name, diff[1].name, raw_diff))
        else:
            diffs.append(SimpleDiff(type_, None, None, None))

    for diff in raw_diffs:
        if isinstance(diff, list):
            for d in diff:
                _simplify_diff(d)
        else:
            _simplify_diff(diff)

    return diffs
def reformat_alembic_diffs ( raw_diffs ) : diffs = [ ] def _simplify_diff ( raw_diff ) : type_ = raw_diff [ 0 ] if type_ in DiffTypes . TABLE_TYPES : diffs . append ( SimpleDiff ( type_ , raw_diff [ 1 ] . name , None , raw_diff ) ) elif type_ in DiffTypes . CONSTRAINT_TYPES : any_column = list ( raw_diff [ 1 ] . columns . values ( ) ) [ 0 ] table_name = any_column . table . name diffs . append ( SimpleDiff ( type_ , table_name , raw_diff [ 1 ] . name , raw_diff ) ) elif type_ in DiffTypes . MODIFY_TYPES : diffs . append ( SimpleDiff ( type_ , raw_diff [ 2 ] , raw_diff [ 3 ] , raw_diff ) ) elif type_ == DiffTypes . ADD_COLUMN and raw_diff [ 3 ] . nullable : diffs . append ( SimpleDiff ( DiffTypes . ADD_NULLABLE_COLUMN , raw_diff [ 2 ] , raw_diff [ 3 ] . name , raw_diff ) ) elif type_ in DiffTypes . COLUMN_TYPES : diffs . append ( SimpleDiff ( type_ , raw_diff [ 2 ] , raw_diff [ 3 ] . name , raw_diff ) ) elif type_ in DiffTypes . INDEX_TYPES : diffs . append ( SimpleDiff ( type_ , diff [ 1 ] . table . name , diff [ 1 ] . name , raw_diff ) ) else : diffs . append ( SimpleDiff ( type_ , None , None , None ) ) for diff in raw_diffs : if isinstance ( diff , list ) : for d in diff : _simplify_diff ( d ) else : _simplify_diff ( diff ) return diffs