iter_utils.py#

Various utilities for working with iterators.

openmdao.utils.iter_utils.meta2item_iter(metaiter, item)[source]

Convert a metadata iterator to an iterator over (name, <item>).

Parameters:
metaiteriter of (name, meta)

Iterator over variable names and their metadata dicts.

itemstr

The item to extract from the metadata.

Yields:
tuple

Tuple of (name, <item>) for each variable.

openmdao.utils.iter_utils.meta2items_iter(metaiter, items)[source]

Convert a metadata iterator to an iterator over [name, meta[item0], meta[item1], …].

Parameters:
metaiteriter of (name, meta)

Iterator over variable names and their metadata dicts.

itemslist of str

The items to extract from the metadata.

Yields:
list

[name, meta[item0], meta[item1], …] for each variable.

openmdao.utils.iter_utils.size2range_iter(size_iter)[source]

Convert a size iterator to a range iterator.

Parameters:
size_iteriter of (name, size)

Iterator over variable names and their sizes.

Yields:
tuple

Tuple of (name, (start, end)) for each variable.