Concrete implementation for interior nodes. The __str__ value is derived entirely from the children, and ultimately from the concrete realization of the Leaf nodes below this. The _eq method (see Base.__eq__) compares only type and recursively the children. Extra attributes, such as context or label, are ignored.
Method | __init__ |
Initializer. |
Method | __repr__ |
Return a canonical string representation. |
Method | __unicode__ |
Return a pretty string representation. |
Method | append |
Equivalent to 'node.children.append(child)'. This method also sets the child's parent attribute appropriately. |
Method | clone |
Return a cloned (deep) copy of self. |
Method | insert |
Equivalent to 'node.children.insert(i, child)'. This method also sets the child's parent attribute appropriately. |
Method | post |
Post-order iterator for the tree. |
Method | pre |
Pre-order iterator for the tree. |
Method | set |
Equivalent to 'node.children[i] = child'. This method also sets the child's parent attribute appropriately. |
Instance Variable | children |
Undocumented |
Instance Variable | fixers |
Undocumented |
Instance Variable | prefix |
Undocumented |
Instance Variable | type |
Undocumented |
Method | _eq |
Compare two nodes for equality (using type, children) - see Base.__eq__ |
Method | _prefix |
The whitespace and comments preceding this node in the input. |
Method | _prefix |
Undocumented |
Inherited from Base
:
Method | __eq__ |
Compare two nodes for equality. |
Method | __ne__ |
Compare two nodes for inequality. |
Method | __new__ |
Constructor that prevents Base from being instantiated. |
Method | __str__ |
Undocumented |
Method | changed |
Undocumented |
Method | depth |
Undocumented |
Method | descend |
Takes a sequence of integers and descends via children. |
Method | get |
Return the line number which generated the invocant node. |
Method | get |
Return the prefix for the node (see Leaf class). |
Method | get |
Return the string immediately following the invocant node. This is effectively equivalent to node.next_sibling.prefix |
Method | label |
Create 'label' attritbute for each Node/Leaf. |
Method | leaves |
Undocumented |
Method | remove |
Remove the node from the tree. Returns the position of the node in its parent's children before it was removed. |
Method | replace |
Replace this node with a new one in the parent. |
Method | set |
Set the prefix for the node (see Leaf class). |
Class Variable | __hash__ |
Undocumented |
Class Variable | was |
Undocumented |
Instance Variable | label |
Undocumented |
Instance Variable | parent |
Undocumented |
Instance Variable | was |
Undocumented |
Property | next |
The node immediately following the invocant in their parent's children list. If the invocant does not have a next sibling, it is None |
Property | prev |
The node immediately preceding the invocant in their parent's children list. If the invocant does not have a previous sibling, it is None. |
Property | type |
Get the type as a human-readable string. |
Initializer. Takes a type constant (a symbol number >= 256) and a sequence of child nodes. The 'context' keyword argument is ignored -- its presence simplifies some callers, but in reality the information (prefix, lineno, column) is kept in the Leaf nodes (this information is used by the __str__ method, which is derived from the children of the node, and utlimately from the Leaf nodes. As a side effect, the parent pointers of the children are updated.
Equivalent to 'node.children.append(child)'. This method also sets the child's parent attribute appropriately.
Equivalent to 'node.children.insert(i, child)'. This method also sets the child's parent attribute appropriately.
Equivalent to 'node.children[i] = child'. This method also sets the child's parent attribute appropriately.
pytype.test_data.pytree.Base._eq
Compare two nodes for equality (using type, children) - see Base.__eq__