@classmethod<EOL><INDENT>def coalesce_headers(cls, header_lines):<DEDENT>
header_lines = [list(hl) for hl in header_lines if bool(hl)]<EOL>if len(header_lines) == <NUM_LIT:0>:<EOL><INDENT>return []<EOL><DEDENT>if len(header_lines) == <NUM_LIT:1>:<EOL><INDENT>return header_lines[<NUM_LIT:0>]<EOL><DEDENT>for hl in header_lines:<EOL><INDENT>last = None<EOL>for i in range(len(hl)):<EOL><INDENT>hli = text_type(hl[i])<EOL>if not hli.strip():<EOL><INDENT>hl[i] = last<EOL><DEDENT>else:<EOL><INDENT>last = hli<EOL><DEDENT><DEDENT><DEDENT>headers = ['<STR_LIT:U+0020>'.join(text_type(col_val).strip() if col_val else '<STR_LIT>' for col_val in col_set)<EOL>for col_set in zip(*header_lines)]<EOL>headers = [slugify(h.strip()) for h in headers]<EOL>return headers<EOL>
Collects headers that are spread across multiple lines into a single row