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=u'|')[source]

This definition sets given namespace to given attribute.

Usage:

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

Namespaced attribute. ( String )

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

This definition returns given attribute foundations.namespace.

Usage:

>>> getNamespace("grandParent|parent|child")
u'grandParent|parent'
>>> getNamespace("grandParent|parent|child", rootOnly=True)
u'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=u'|', rootOnly=False)[source]

This definition returns attribute with stripped foundations.namespace.

Usage:

>>> removeNamespace("grandParent|parent|child")
u'child'
>>> removeNamespace("grandParent|parent|child", rootOnly=True)
u'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=u'|')[source]

This definition returns given attribute root.

Usage:

>>> getRoot("grandParent|parent|child")
u'grandParent'
Parameters:
  • attribute – Attribute. ( String )
  • namespaceSplitter – Namespace splitter character. ( String )
Returns:

Attribute foundations.namespace. ( String )

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

This definition returns given attribute leaf.

Usage:

>>> getLeaf("grandParent|parent|child")
u'child'
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