def flatten_lines()

in gridengine/src/gridengine/util.py [0:0]


def flatten_lines(lines: List[str]) -> List[str]:
    """
    Combines lines that were split with line continuations
    i.e.
    this is \
       one line
    => this is        one line
    """
    ret = []
    n = 0
    while n < len(lines):
        line = lines[n]
        while line.endswith("\\") and n < len(lines) - 1:
            n += 1
            next_line = lines[n]
            line = line[:-1] + " " + next_line.strip()
        ret.append(line)
        n += 1
    return ret