Parse a structured list of flux limits as obtained from a YAML file

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

def parse_limits_list(path, limits):
    """Parse a structured list of flux limits as obtained from a YAML file

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

    context = FilePathContext(path)

    for limit_def in limits:
        if 'include' in limit_def:
            include_context = context.resolve(limit_def['include'])
            for limit in parse_limits_file(include_context):
                yield limit
        else:
            yield parse_limit(limit_def)