Python

InputBase

Exact retained-input bases in the unified Python API.

Class: InputBase

Python · dataclassSince v0.17.0
InputBasefrozen=True
Immutable retained-input base: attachment incarnation and committed generation. Pass the current base to replace or apply.
Creation and access
Fields
incarnationintproperty
Exact attachment incarnation read from this attachment.
generationintproperty
Committed input generation; read a fresh base after a successful transaction.
Example
base = inputs.base
with inputs.replace(base, [("owns", ["alice", "roadmap.pdf"])]) as result:
    print("allowed:", result.contains_fact("allow", ["alice", "roadmap.pdf"]))
print("base changed:", inputs.base != base)
allowed: True
base changed: True

Constructor: InputBase()

Python · constructorSince v0.17.0
InputBase
InputBase(
incarnation: int,
generation: int
) -> InputBase
Reconstructs an immutable retained-input base from its exact public integer fields.
Arguments
incarnationint
Attachment incarnation from the base being reconstructed.
generationint
Committed generation from that same base.
Return value
InputBase

Returns an immutable InputBase. Boolean or non-integer fields raise TypeError; values outside uint64 raise ValueError. Constructing a base does not attach input or commit facts.

Example
current = inputs.base
base = InputBase(incarnation=current.incarnation, generation=current.generation)
print("base preserved:", base == current)

Usage guides