Implementation of the route base class and route tools.
The primary class, PartitionedSequence, is essentially a unrolled linked list leveraging Python's reference counting to allow sharing of routes and segments across instances.
Direct use of this class is likely inappropriate. Either types.Selector or types.Segment should be subclassed in order to convey the presence of a target resource.
Iterable
Iterator
Sequence
Hashable
TypeVar
Generic
Optional0
functools0
cachedcalls
consistency0
Identifier0
Identifier = TypeVar('Identifier', bound=Hashable)
vcombine0
vcombine(*args)
partition_cache0
partition_cache = cachedcalls(32)(vcombine)
join0Sequence[Identifier]
join(head, tail)
absolute_cache0
absolute_cache = cachedcalls(64)(join)
@cachedcalls(32)
construct_cache0
construct_cache(Class, context, points)
map_partitions20%
map_partitions(parts)
relative_path0tuple[int, int, Sequence[Identifier]]
relative_path(target, source)
PartitionedSequence0
Generic[Identifier]Route implementation class managing the path as a partitioned sequence.
The stored sequences are usually tuples that are connected to a Context instance defining the preceeding points in the path. The intent of the structure is to allow path sharing for reducing memory use when working with long paths. However, this is not done automatically and the exact usage must be aware of how context can eliminate redundant leading segments.
PartitionedSequencecorrelate0tuple[int, Sequence[Identifier]]
correlate(self, target)
The relative positioning of self with respect to target. Provides the necessary information to form a relative path to target from self.
Returns the number of steps to ascend and the sequence of identifiers to apply in order to arrive at target.
PartitionedSequencefrom_sequence0
from_sequence(Class, points)
PartitionedSequencefrom_partitions0
from_partitions(Class, parts)
Construct a new instance from an iterable of partitions in root order.
PartitionedSequencefrom_context20%
from_context(self, *paths)
Construct a new route relative to self.context.
PartitionedSequencedelimit0
delimit(self)
Create a new partitioned sequence designating self as the context.
If the context-relative path of self is an empty sequence, self is returned exactly.
PartitionedSequenceiterpartitions0
iterpartitions(self)
Produce the partitions of the sequence in inverse order.
The identifiers inside the partitions will be in root order.
PartitionedSequencepartitions0
partitions(self)
Construct a sequence of partitions in root order. Result is a suitable parameter for from_partitions.
PartitionedSequence__init__0
__init__(self, context, points)
PartitionedSequence__repr__10%
__repr__(self)
PartitionedSequence__reduce__0
__reduce__(self)
PartitionedSequence__hash__0int
__hash__(self)
PartitionedSequence__eq__0
__eq__(self, operand)
PartitionedSequence__lt__175%
__lt__(self, operand)
PartitionedSequence__len__0
__len__(self)
PartitionedSequence__iter__0Iterator[Identifier]
__iter__(self)
PartitionedSequence__contains__0
__contains__(self, operand)
PartitionedSequence__getitem__0
__getitem__(self, req)
PartitionedSequence__add__0
__add__(self, tail)
PartitionedSequence__truediv__0
__truediv__(self, addition)
PartitionedSequence__floordiv__166%
__floordiv__(self, route)
PartitionedSequence__mul__0
__mul__(self, replacement)
PartitionedSequence__pow__183%
__pow__(self, strip)
PartitionedSequence__rshift__0
__rshift__(self, segment)
PartitionedSequence__lshift__0
__lshift__(self, segment)
PartitionedSequence__invert__0
__invert__(self)
PartitionedSequence__xor__100%
__xor__(self, operand)
PartitionedSequenceiterpoints0
iterpoints(self)
PartitionedSequenceiterinverse0
iterinverse(self)