PathConst

class dsviper.PathConst

Bases: object

A class used to retreive a value from a Path.

Note: Not directly instantiable.

ancestors() list[Path]

Return the list of ancestors.

at(target: Value, *, encoded: bool = True) _OutputValues

Return the value for the target.

check_type(type: Type) Type

Check if the path can be used to locate the value in the type.

components() list[PathComponent]

Return the list of components.

copy() Path

Return a copy.

element_info() PathElementInfo

Return the ElementInfo.

encode(*, stream_codec_instancing: StreamCodecInstancing | None = None) ValueBlob

Return a blob that encodes the Path with a StreamTokenBinaryCodec if not specified.

entry_key_info() PathEntryKeyInfo

Return the EntryKeyInfo.

from_component(index: int) Path

Return a path from index.

has_prefix(path: PathConst) bool

Return True if other is a prefix.

is_applicable(value: Value) bool

Check if the path is applicable to the value.

is_element_path() bool

Return True if the path contains Element components.

is_entry_key_path() bool

Return True if the path contains Entry components.

is_regular() bool

Return False if the path contains Entry components.

is_root() bool

Return True if self is the root.

last_component() Path

Return the last component as a Path.

last_component_value(*, encoded: bool = True) _OutputValues | None

Return the last component value.

parent() Path

Return the parent Path or raise if self is root.

patch(target: Value, value: _InputValues) None

Assign the value to the target.

regularized() Path

Return the path without the entry component.

representation() str

Return a string representation.

set(target: Value, value: _InputValues) None

Assign the value to the target.

to_component(index: int) Path

Return a path to index (excluded).

write(*, stream_writing: StreamWriting) None

Write a path.