autoflake.py
def break_up_import(line):
    """Return line with imports on separate lines."""
    assert '\\' not in line
    assert '(' not in line
    assert ')' not in line
    assert ';' not in line
    assert '#' not in line
    assert not line.lstrip().startswith('from')

    newline = get_line_ending(line)
    if not newline:
        return line

    (indentation, imports) = re.split(pattern=r'\bimport\b',
                                      string=line, maxsplit=1)

    indentation += 'import '
    assert newline

    return ''.join([indentation + i.strip() + newline
                    for i in sorted(imports.split(','))])
def break_up_import(line):
    assert '\\' not in line
    assert '(' not in line
    assert ')' not in line
    assert ';' not in line
    assert '#' not in line
    assert not line.lstrip().startswith('from')

    newline = get_line_ending(line)
    if not newline:
        return line

    (indentation, imports) = re.split(pattern=r'\bimport\b',
                                      string=line, maxsplit=1)

    indentation += 'import '
    assert newline

    return ''.join([indentation + i.strip() + newline
                    for i in sorted(imports.split(','))])
def break_up_import ( line ) : assert '\\' not in line assert '(' not in line assert ')' not in line assert ';' not in line assert '#' not in line assert not line . lstrip ( ) . startswith ( 'from' ) newline = get_line_ending ( line ) if not newline : return line ( indentation , imports ) = re . split ( pattern = r'\bimport\b' , string = line , maxsplit = 1 ) indentation += 'import ' assert newline return '' . join ( [ indentation + i . strip ( ) + newline for i in sorted ( imports . split ( ',' ) ) ] )
Return line with imports on separate lines.
Return line with imports on separate lines .