string_util.py

Sting utilities.

openmdao.util.string_util.get_common_ancestor(name1, name2)[source]
Args:

name1 : str

Name of first system.

name2 : str

Name of second system.

Returns:

str

Absolute name of any common ancestor System containing both name1 and name2. If none is found, returns ‘’.

openmdao.util.string_util.nearest_child(parent_abspath, child_abspath)[source]

Determine the relative name of the nearest child inside of the parent that contains or is the object specified by child_abspath.

Args:

parent_abspath : str

Asbolute path of the parent system.

child_abspath : str

Absolute path of the child variable or system.

Returns:

str

Name of the child relative to the parent.

openmdao.util.string_util.name_relative_to(parent_abspath, child_abspath)[source]

Determine the relative name of a child path with respect to a parent system.

Args:

parent_abspath : str

Asbolute path of the parent.

child_abspath : str

Absolute path of the child.

Returns:

str

Name of the child relative to the parent.

openmdao.util.string_util.parse_for_vars(expr, vnames=())[source]
Args:

expr : str

An expression string that we want to parse for variable names.

Returns:

list of str

Names of variables from the given string.