def read_omega_scan_config(source):
out = ChannelList()<EOL>append = out.append<EOL>if isinstance(source, FILE_LIKE):<EOL><INDENT>close = False<EOL><DEDENT>else:<EOL><INDENT>source = open(source, '<STR_LIT:r>')<EOL>close = True<EOL><DEDENT>try:<EOL><INDENT>section = None<EOL>while True:<EOL><INDENT>try:<EOL><INDENT>line = next(source)<EOL><DEDENT>except StopIteration:<EOL><INDENT>break<EOL><DEDENT>if line == '<STR_LIT>' or line == '<STR_LIT:\n>' or line.startswith('<STR_LIT:#>'):<EOL><INDENT>continue<EOL><DEDENT>elif line.startswith('<STR_LIT:[>'):<EOL><INDENT>section = line[<NUM_LIT:1>:-<NUM_LIT:2>]<EOL><DEDENT>elif line.startswith('<STR_LIT:{>'):<EOL><INDENT>append(parse_omega_channel(source, section))<EOL><DEDENT>else:<EOL><INDENT>raise RuntimeError("<STR_LIT>"<EOL>% line)<EOL><DEDENT><DEDENT><DEDENT>finally:<EOL><INDENT>if close:<EOL><INDENT>source.close()<EOL><DEDENT><DEDENT>return out<EOL>
Parse an Omega-scan configuration file into a `ChannelList`

    Parameters
    ----------
    source : `str`
        path of Omega configuration file to parse

    Returns
    -------
    channels : `ChannelList`
        the list of channels (in order) as parsed

    Raises
    ------
    RuntimeError
        if this method finds a line it cannot parse sensibly