s2t.Path

May 7, 2026 ยท View on GitHub

description: A representation of a path in the expression.

s2t.Path

A representation of a path in the expression.

Do not implement nonzero, eq, ne, et cetera as these are implicitly defined by cmp and len.

`field_list` a list or tuple of fields leading from one node to another.
`ValueError` if any field is not a valid step (see is_valid_step).

Methods

as_proto

View source

Serialize a path as a proto.

This fails if there are any anonymous fields.

Returns
a Path proto.

concat

View source

get_child

View source

Get the child path.

get_least_common_ancestor

View source

Get the least common ancestor, the longest shared prefix.

get_parent

View source

Get the parent path.

Returns
The parent path.
Raises
`ValueError` If this is the root path.

is_ancestor

View source

True if self is ancestor of other (i.e. a prefix).

prefix

View source

suffix

View source

__add__

View source

__eq__

View source

Return self==value.

__ge__

View source

Return self>=value.

__gt__

View source

Return self>value.

__le__

View source

Return self<=value.

__len__

View source

__lt__

View source

Return self<value.

__ne__

View source

Return self!=value.