Part of lp.bugs.adapters.treelookup View In Hierarchy
Known subclasses: lp.bugs.externalbugtracker.base.LookupBranch
Method | __init__ | Construct a new LookupBranch from the given keys and result. |
Method | is_leaf | Whether or not this is a leaf. |
Method | is_default | Whether or not this is a default branch. |
Method | describe | A representation of this branch. |
Method | __repr__ | A machine-readable representation of this branch. |
Method | _verify | Check the validity of the branch. |
Method | _describe_key | Return a pretty representation of a simple key. |
Method | _describe_result | Return a pretty representation of the branch result. |
LookupBranch
from the given keys and result.
Split out the keys from the result. The last argument specified is the result of this branch, and all the other arguments are keys.
As an extra step, the branch is verified by calling _verify
.
The default implementation does nothing.
Raises | TypeError | If the branch is invalid. |
If the result of this branch is not a LookupTree
, then this
is a leaf... as well as a branch... the terminology is a
little confused :)
If there are no keys for this branch, then this is a default branch.
If the result of this branch is a LookupTree
instance, it's
asked for a representation at a specific level
, which
corresponds to its position in the tree. This allows for
pretty indentation to aid human comprehension.
If the result is any other object, _describe_result
is used.
Keys are formatted using _describe_key
.
This is mainly intended as an aid to development.
If the key, as a string, contains only characters from a small
selected set, it is returned without quotes. Otherwise, the
result of repr
is returned.
By default, return the representation as returned by repr
.