def parse_exchange_list(path, exchange, default_compartment):
context = FilePathContext(path)<EOL>for exchange_def in exchange:<EOL><INDENT>if '<STR_LIT>' in exchange_def:<EOL><INDENT>include_context = context.resolve(exchange_def['<STR_LIT>'])<EOL>for exchange_compound in parse_exchange_file(<EOL>include_context, default_compartment):<EOL><INDENT>yield exchange_compound<EOL><DEDENT><DEDENT>else:<EOL><INDENT>for exchange_compound in parse_exchange(<EOL>exchange_def, default_compartment):<EOL><INDENT>yield exchange_compound<EOL><DEDENT><DEDENT><DEDENT>
Parse a structured exchange list as obtained from a YAML file.

    Yields tuples of compound, reaction ID, lower and upper flux bounds. Path
    can be given as a string or a context.