class documentation
Concrete implementation for leaf nodes. The __str__ value is derived from the prefix and the value. The prefix is any white space and comments before this item (e.g., Leaf(token.NEWLINE, value=" ", prefix=" # comment"). The _eq method (see Base.__eq__) compares only type and value.
Method | __init__ |
Initializer. |
Method | __repr__ |
Return a canonical string representation. |
Method | __unicode__ |
Return a pretty string representation. |
Method | clone |
Return a cloned (deep) copy of self. |
Method | leaves |
Undocumented |
Method | post |
Post-order iterator for the tree. |
Method | pre |
Pre-order iterator for the tree. |
Class Variable | column |
Undocumented |
Class Variable | lineno |
Undocumented |
Class Variable | prefix |
Undocumented |
Instance Variable | fixers |
Undocumented |
Instance Variable | type |
Undocumented |
Instance Variable | value |
Undocumented |
Method | _eq |
Compare two nodes for equality (type and value). |
Method | _prefix |
The whitespace and comments preceding this token in the input. |
Method | _prefix |
Undocumented |
Instance Variable | _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 | 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 | children |
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 token number < 256), a string value, and an optional context keyword argument (prefix, (lineno, column)). If the prefix keyword argument is provided, it overrides the prefix derived from the context. The prefix is the text that appears before the value (e.g., blanks and comments).