@finalclass DurationSeconds, plus how we know them.
There is no __new__: naming a provenance is the only way to build one, and the
two named constructors are the only doors. cost.py achieved the same thing with a
field that had no default, so Duration(3600) raised TypeError — here there is
nothing to call, which is one rung stronger.
Constructor
Section titled “Constructor”Duration declares no __new__ or __init__, so it is not constructed directly: an instance comes back from another call in this package.
Properties
Section titled “Properties”is_measured
Section titled “is_measured”is_measured: boolTrue only for a timed span. What CostReport.fully_measured reads.
provenance
Section titled “provenance”provenance: str"measured" or "projected", spelled as the Python StrEnum member.
seconds
Section titled “seconds”seconds: floatThe span in seconds, without its label.
A float here and not on the money types, deliberately: seconds really are a
measurement a caller does arithmetic on, and the core’s own
break_even_seconds_f64 makes the same distinction for the same reason.
Methods
Section titled “Methods”measured
Section titled “measured”@staticmethoddef measured(seconds: SupportsFloat | SupportsIndex) -> DurationA timed phase: a clock ran and this is what it read.
Fallible because the float is — a negative or non-finite figure has no reading as
a duration, and the refusal is the core’s duration_of_secs_f64.
projected
Section titled “projected”@staticmethoddef projected(seconds: SupportsFloat | SupportsIndex) -> DurationA hypothetical phase: an estimate’s input, or a documented minimum nobody timed.
Special methods
Section titled “Special methods”__repr__
Section titled “__repr__”def __repr__() -> str__str__
Section titled “__str__”def __str__() -> strProvenance
Section titled “Provenance”This page is generated from bindings/microvms-py/microvms.pyi by Griffe 2.3.0, run from site/scripts/gen-reference.mjs on every pnpm run sync, so an edit made here is overwritten by the next run.
To change the page, change the doc comment in the binding’s Rust source, then regenerate the declarations with mise run stubs. mise run stubs:check fails when the committed file no longer matches the source.