gem
v0.13.0

Field Paths

Decodes Huffman-coded field path operations used to address properties inside entity deltas.

See also: How Entities Are Decoded, Part 2: Field Paths for an explanation with a real example, and How Proto Parsing Works.


Generated API

gem.schema.field_path.read_field_paths

read_field_paths

def read_field_paths(r: BitReader) -> list[FieldPath]

Decode field paths into independent mutable compatibility objects.

Source: src/gem/schema/field_path/path_sequence.py:102

gem.schema.field_path.FieldPath

FieldPath

class FieldPath

A mutable path of up to 7 integer field indices.

Source: src/gem/schema/field_path/models.py:11

Methods

reset

Signature: def FieldPath.reset(self) -> None

Reset to the initial empty state.

Source: src/gem/schema/field_path/models.py:30

pop

Signature: def FieldPath.pop(self, n: int) -> None

Pop n levels off the path, zeroing the vacated slots.

Source: src/gem/schema/field_path/models.py:36

copy

Signature: def FieldPath.copy(self) -> FieldPath

Return an independent copy of this path.

Source: src/gem/schema/field_path/models.py:46

to_tuple

Signature: def FieldPath.to_tuple(self) -> CompactFieldPath

Return the active indices as an immutable tuple.

Source: src/gem/schema/field_path/models.py:58

to_str

Signature: def FieldPath.to_str(self) -> str

Return a slash-separated string of active indices.

Source: src/gem/schema/field_path/models.py:91

plus_one

Signature: def FieldPath.plus_one(self) -> None

Increment the deepest index by 1.

Source: src/gem/schema/field_path/models.py:99

gem.schema.field_path.FieldPathOp

FieldPathOp

class FieldPathOp

A single field-path operation with its Huffman weight.

Source: src/gem/schema/field_path/operations.py:20

Dataclass fields

NameTypeDefault
namestr-
weightint-
fnCallable[[BitReader, FieldPath], None]-