Python
InputBase
Exact retained-input bases in the unified Python API.| Used by | SessionInputs.apply · SessionInputs.replace |
|---|
Class: InputBase
Python · dataclassSince v0.17.0
InputBasefrozen=TrueImmutable retained-input base: attachment incarnation and committed generation. Pass the current base to replace or apply.
Creation and access
- constructor
InputBase(incarnation, generation)Reconstructs an immutable retained-input base from its exact public integer fields.
- read from
sessionInputs.baseRead the current base of retained session input.
Fields
incarnationintproperty
Exact attachment incarnation read from this attachment.
generationintproperty
Committed input generation; read a fresh base after a successful transaction.
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
InputBaseInputBase(
incarnation: int,
generation: int
) -> InputBaseReconstructs 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
InputBaseReturns 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.
current = inputs.base
base = InputBase(incarnation=current.incarnation, generation=current.generation)
print("base preserved:", base == current)base preserved: True