pymel.util.treesΒΆ

A tree module that can wrap either pure python tree implementation or the networkx library if present

>>> # Create a tree from nested sequences:
>>> myTree = Tree('a', ('ab', 'aa', 3, {}))
>>> print myTree
('a', ('ab', 'aa', '3', '{}'))
>>> print myTree.formatted()
+: a
|--: ab
|--: aa
|--: 3
\--: {}
>>> myTree.sort()
>>> print myTree.formatted()
+: a
|--: 3
|--: {}
|--: aa
\--: ab
>>>
>>> # Forests
>>> # -------
>>> # We can make a forest by passing in multiple args to the constructor
>>> myForest = Tree(1, 2, 3)
>>> for top in myForest.tops():
...     print top.value
... 
1
2
3
>>> print myForest.formatted()
-: 1
<BLANKLINE>
-: 2
<BLANKLINE>
-: 3

Functions

copy Shallow copy operation on arbitrary Python objects.
deepcopy Deep copy operation on arbitrary Python objects.
isImmutableTree
isMutableTree
isSequence
isTree
mutabletree
namedtuple Returns a new subclass of tuple with named fields.
treeFromChildLink This function will build a tree from the provided sequence and a comparison function in the form:
treeFromDict This function will build a tree from the provided dictionnary of child:parent relations :
treeFromIsChild This function will build a tree from the provided sequence and a comparison function in the form:

Classes

Callable
Container
FrozenTree Core methods for pure python trees implementation
Hashable
IndexedFrozenTree Additionnal methods for pure python indexed trees implementation, elements must have unique values
IndexedTree Additionnal methods for pure python indexed trees implementation, elements must have unique values
ItemsView
Iterable
Iterator
KeysView
Mapping
MappingView
MetaTree This metaclass defines the type of all ‘tree’ classes
MutableMapping
MutableSequence
MutableSet
Sequence All the operations on a read-only sequence.
Set A set is a finite, iterable container.
Sized
Tree Core methods for pure python trees implementation
ValuesView
defaultdict defaultdict(default_factory) –> dict with default factory
deque deque(iterable[, maxlen]) –> deque object

Exceptions

Error

Previous topic

pymel.util.path

Next topic

pymel.util.trees.copy

Core

Core Modules

Other Modules

This Page