Package ClusterShell :: Module MsgTree :: Class MsgTreeElem
[hide private]
[frames] | no frames]

Class MsgTreeElem

source code


Class representing an element of the MsgTree and its associated message. Object of this class are returned by the various MsgTree methods like messages() or walk(). The object can then be used as an iterator over the message lines or casted into a string.

Instance Methods [hide private]
 
__init__(self, msgline=None, parent=None, trace=False)
Initialize message tree element.
source code
 
__len__(self)
Length of whole message string.
source code
 
__eq__(self, other)
Comparison method compares whole message strings.
source code
 
_add_key(self, key)
Add a key to this tree element.
source code
 
_shift_notrace(self, key, target_elem)
Shift one of our key to specified target element.
source code
 
_shift_trace(self, key, target_elem)
Shift one of our key to specified target element (trace mode: keep backtrace of keys).
source code
 
__getitem__(self, i) source code
 
__iter__(self)
Iterate over message lines up to this element.
source code
 
lines(self)
Get an iterator over all message lines up to this element.
source code
 
splitlines(self)
Get an iterator over all message lines up to this element.
source code
 
message(self)
Get the whole message buffer from this tree element.
source code
 
__str__(self)
Get the whole message buffer from this tree element.
source code
 
append(self, msgline, key=None)
A new message is coming, append it to the tree element with optional associated source key.
source code

Inherited from object: __delattr__, __format__, __getattribute__, __hash__, __new__, __reduce__, __reduce_ex__, __repr__, __setattr__, __sizeof__, __subclasshook__

Properties [hide private]

Inherited from object: __class__

Method Details [hide private]

__init__(self, msgline=None, parent=None, trace=False)
(Constructor)

source code 

Initialize message tree element.

Overrides: object.__init__

__str__(self)
(Informal representation operator)

source code 

Get the whole message buffer from this tree element.

Overrides: object.__str__

append(self, msgline, key=None)

source code 

A new message is coming, append it to the tree element with optional associated source key. Called by MsgTree.add(). Return corresponding MsgTreeElem (possibly newly created).