Path

class dsviper.Path(path=None)

Bases: object

Constructs the location of a portion of a value.

Build one with Path() and append components, or start from a static factory: from_field, from_index, from_key, from_position, from_entry, from_element and from_unwrap.

A Path and a PathConst with the same components compare equal: they carry the same path, and only the Path can still be extended.

const() → PathConst

Return the PathConst interface.

copy() → Path

Return a Path holding the same components.

static decode(blob: ValueBlob, definitions: DefinitionsConst, *, stream_codec_instancing: StreamCodecInstancing | None = None) → Path

Return a Path by decoding the blob with Codec.STREAM_BINARY if not specified.

element(index: int) → Path

Append an element component at index and return self.

An element addresses a member of a set, which has no key to address it by.

entry(key: _InputValues) → Path

Append an entry component for key and return self.

An entry component addresses the key itself, which a key component, addressing the value, cannot reach.

field(name: str) → Path

Append a field component for name and return self, addressing that field of a struct.

static from_element(index: int) → Path

Create and return a Path with an element component at index.

static from_entry(value: _InputValues) → Path

Return a Path of one entry component for value.

static from_field(name: str) → Path

Return a Path of one field component for name.

static from_index(index: int) → Path

Return a Path of one index component for index.

static from_key(key: _InputValues) → Path

Return a Path of one key component for key.

static from_position(position: ValueUUId) → Path

Return a Path of one position component for position.

static from_unwrap() → Path

Return a Path of one unwrap component.

index(value: int) → Path

Append an index component for value and return self, addressing the element at that index of a vector or a tuple.

key(value: _InputValues) → Path

Append a key component for value and return self, addressing the value a map holds under that key.

path(other: PathConst) → Path

Append every component of other and return self.

position(value: ValueUUId) → Path

Append a position component for value and return self, addressing the element an xarray holds at that position.

static read(stream_reading: StreamReading, definitions: DefinitionsConst) → Path

Read and return a Path.

representation() → str

Return a string representation.

unwrap() → Path

Append an unwrap component and return self.

It addresses what an optional, a variant or an any holds - the three types whose value is reached by unwrapping it.