core1888%python.module
fault.route

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
import

Iterator
import

Sequence
import

Hashable
import

TypeVar
import

Generic
import

Optional0
import

functools0
import

cachedcalls
import

consistency0
import

Identifier0
data

Identifier = TypeVar('Identifier', bound=Hashable)

vcombine0
function

vcombine(*args)

partition_cache0
data

partition_cache = cachedcalls(32)(vcombine)

join0
function
Sequence[Identifier]

join(head, tail)

absolute_cache0
data

absolute_cache = cachedcalls(64)(join)

@cachedcalls(32)

construct_cache0
function

construct_cache(Class, context, points)

map_partitions20%
function

map_partitions(parts)

relative_path0
function
tuple[int, int, Sequence[Identifier]]

relative_path(target, source)

PartitionedSequence0
class

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.

PartitionedSequencecorrelate0
method
tuple[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
classmethod

from_sequence(Class, points)

PartitionedSequencefrom_partitions0
classmethod

from_partitions(Class, parts)

Construct a new instance from an iterable of partitions in root order.

PartitionedSequencefrom_context20%
method

from_context(self, *paths)

Construct a new route relative to self.context.

PartitionedSequencedelimit0
method

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
method

iterpartitions(self)

Produce the partitions of the sequence in inverse order.

The identifiers inside the partitions will be in root order.

PartitionedSequencepartitions0
method

partitions(self)

Construct a sequence of partitions in root order. Result is a suitable parameter for from_partitions.

PartitionedSequence__init__0
method

__init__(self, context, points)

PartitionedSequence__repr__10%
method

__repr__(self)

PartitionedSequence__reduce__0
method

__reduce__(self)

PartitionedSequence__hash__0
method
int

__hash__(self)

PartitionedSequence__eq__0
method

__eq__(self, operand)

PartitionedSequence__lt__175%
method

__lt__(self, operand)

PartitionedSequence__len__0
method

__len__(self)

PartitionedSequence__iter__0
method
Iterator[Identifier]

__iter__(self)

PartitionedSequence__contains__0
method

__contains__(self, operand)

PartitionedSequence__getitem__0
method

__getitem__(self, req)

PartitionedSequence__add__0
method

__add__(self, tail)

PartitionedSequence__truediv__0
method

__truediv__(self, addition)

PartitionedSequence__floordiv__166%
method

__floordiv__(self, route)

PartitionedSequence__mul__0
method

__mul__(self, replacement)

PartitionedSequence__pow__183%
method

__pow__(self, strip)

PartitionedSequence__rshift__0
method

__rshift__(self, segment)

PartitionedSequence__lshift__0
method

__lshift__(self, segment)

PartitionedSequence__invert__0
method

__invert__(self)

PartitionedSequence__xor__100%
method

__xor__(self, operand)

PartitionedSequenceiterpoints0
method

iterpoints(self)

PartitionedSequenceiterinverse0
method

iterinverse(self)

PartitionedSequenceabsolute0
property
Sequence[Identifier]

PartitionedSequenceidentifier0
property

PartitionedSequenceroot0
property

PartitionedSequencecontainer0
property