6.11. foundations.namespace

namespace.py

Platform:
Windows, Linux, Mac Os X.
Description:
This module provides simple strings namespace manipulation objects.

Others:

6.11.1. Module Attributes

foundations.namespace.LOGGER
foundations.namespace.NAMESPACE_SPLITTER

6.11.2. Functions

foundations.namespace.setNamespace(namespace, attribute, namespaceSplitter='|')[source]

This definition sets given namespace to given attribute.

Usage:

>>> setNamespace("parent", "child")
'parent|child'
Parameters:
  • namespace – Namespace. ( String )
  • attribute – Attribute. ( String )
  • namespaceSplitter – Namespace splitter character. ( String )
Returns:

Namespaced attribute. ( String )

foundations.namespace.getNamespace(attribute, namespaceSplitter='|', rootOnly=False)[source]

This definition returns given attribute foundations.namespace.

Usage:

>>> getNamespace("grandParent|parent|child")
'grandParent|parent'
>>> getNamespace("grandParent|parent|child", rootOnly=True)
'grandParent'
Parameters:
  • attribute – Attribute. ( String )
  • namespaceSplitter – Namespace splitter character. ( String )
  • rootOnly – Return only root foundations.namespace. ( Boolean )
Returns:

Attribute foundations.namespace. ( String )

foundations.namespace.removeNamespace(attribute, namespaceSplitter='|', rootOnly=False)[source]

This definition returns attribute with stripped foundations.namespace.

Usage:

>>> removeNamespace("grandParent|parent|child")
'child'
>>> removeNamespace("grandParent|parent|child", rootOnly=True)
'parent|child'
Parameters:
  • attribute – Attribute. ( String )
  • namespaceSplitter – Namespace splitter character. ( String )
  • rootOnly – Remove only root foundations.namespace. ( Boolean )
Returns:

Attribute without foundations.namespace. ( String )

foundations.namespace.getRoot(attribute, namespaceSplitter='|')[source]

This definition returns given attribute root.

Usage:

>>> getNamespace("grandParent|parent|child")
'grandParent|parent'
>>> getNamespace("grandParent|parent|child", rootOnly=True)
'grandParent'
Parameters:
  • attribute – Attribute. ( String )
  • namespaceSplitter – Namespace splitter character. ( String )
Returns:

Attribute foundations.namespace. ( String )

foundations.namespace.getLeaf(attribute, namespaceSplitter='|')[source]

This definition returns given attribute leaf.

Usage:

>>> getNamespace("grandParent|parent|child")
'grandParent|parent'
>>> getNamespace("grandParent|parent|child", rootOnly=True)
'grandParent'
Parameters:
  • attribute – Attribute. ( String )
  • namespaceSplitter – Namespace splitter character. ( String )
Returns:

Attribute foundations.namespace. ( String )

Table Of Contents

Previous topic

6.10. foundations.library

Next topic

6.12. foundations.nodes

This Page