gemseo.core.namespaces module#

Utility functions and classes to handle namespaces.

The namespaces implementation itself is mainly in grammars and discipline

remove_prefix(names)[source]#

Remove namespaces prefixes from names, if any.

Parameters:

names (Iterable[str]) -- The names that may contain namespaces.

Returns:

The names without prefixes in its keys.

Return type:

Iterator[str]

split_namespace(name)[source]#

Return the (namespace, name) pair from a data name.

For instance if data_name = my:namespace:a and the separator is :, returns (my:namespace,``a``).

If there is no namespace prefix in data_name, returns data_name.

In case data_name contains the namespace separator but empty name, or empty namespace, returns the (namespace, name) pair, containing eventually empty strings.

Parameters:

name (str) -- The data name containing the namespace name.

Returns:

The namespace name and the data name.

Return type:

list[str]

update_namespaces(namespaces, other_namespaces)[source]#

Update namespaces with the key/value pairs from other, overwriting existing keys.

Parameters:
Return type:

None