description: A representation of a path in the expression.
View source on GitHub
|
A representation of a path in the expression.
s2t.Path(
field_list: Sequence[s2t.Step]
)
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). |
as_proto()
Serialize a path as a proto.
This fails if there are any anonymous fields.
| Returns | |
|---|---|
| a Path proto. |
concat(
other_path: "Path"
) -> "Path"
get_child(
field_name: s2t.Step
) -> "Path"
Get the child path.
get_least_common_ancestor(
other: "Path"
) -> "Path"
Get the least common ancestor, the longest shared prefix.
get_parent() -> "Path"
Get the parent path.
| Returns | |
|---|---|
| The parent path. |
| Raises | |
|---|---|
| `ValueError` | If this is the root path. |
is_ancestor(
other: "Path"
) -> bool
True if self is ancestor of other (i.e. a prefix).
prefix(
ending_index: int
) -> "Path"
suffix(
starting_index: int
) -> "Path"
__add__(
other: Union['Path', str]
) -> "Path"
__eq__(
other: "Path"
) -> bool
Return self==value.
__ge__(
other: "Path"
) -> bool
Return self>=value.
__gt__(
other: "Path"
) -> bool
Return self>value.
__le__(
other: "Path"
) -> bool
Return self<=value.
__len__() -> int
__lt__(
other: "Path"
) -> bool
Return self<value.
__ne__(
other: "Path"
) -> bool
Return self!=value.
View source on GitHub