Tooling and types

Names for tools and type annotations rather than scene code.

Contents:

  • k.Diagnostic: Diagnostics are read with kinemo check and kinemo explain <code>.
  • k.IR_VERSION: IR format version, for tools.
  • k.KinemoError: A build error.
  • k.Val: Type alias T | Signal[T] | Callable[[], T], for annotations only.

Back to the reference index.

k.Diagnostic (class)

k.Diagnostic(
    code: str,
    level: Level,
    message: str,
    spans: list[Span] = <factory>,
    span_notes: list[str] = <factory>,
    time: float | None = None,
    objects: list[str] = <factory>,
    fixes: list[Fix] = <factory>,
)

Diagnostics are read with kinemo check and kinemo explain <code>.

Parameters:

Name Type Default Description
code str required
level Level required
message str required
spans list[Span] <factory>
span_notes list[str] <factory>
time float | None None
objects list[str] <factory>
fixes list[Fix] <factory>

Members:

  • json: The diagnostic as the stable JSON object of kinemo check --json.
  • render: The diagnostic as terminal text: code, message, source lines, instant and fixes.

k.Diagnostic.json (method)

diagnostic.json() -> dict[str, object]

The diagnostic as the stable JSON object of kinemo check --json.

k.Diagnostic.render (method)

diagnostic.render() -> str

The diagnostic as terminal text: code, message, source lines, instant and fixes.

k.IR_VERSION (constant)

k.IR_VERSION: str = "1.0.0"

IR format version, for tools.

k.KinemoError (class)

k.KinemoError(diagnostic: Diagnostic)

A build error. Always carries a diagnostic with a stable code and, when possible, a fix.

Parameters:

Name Type Default Description
diagnostic Diagnostic required

Attributes:

Attribute Type Description
kinemoerror.diagnostic

Members:

  • make: classmethod.

k.KinemoError.make (classmethod)

k.KinemoError.make(
    code: str,
    message: str,
    *,
    fixes: Sequence[FixSpec | Fix] = (),
    spans: Sequence[Span] = (),
    notes: Sequence[str] = (),
    time: float | None = None,
    objects: Sequence[str] = (),
) -> KinemoError

Parameters:

Name Type Default Description
code str required
message str required
fixes Sequence[FixSpec | Fix] ()
spans Sequence[Span] ()
notes Sequence[str] ()
time float | None None
objects Sequence[str] ()

k.Val (type alias)

k.Val[T] = T | Signal[T] | Callable[[], T]

Type alias T | Signal[T] | Callable[[], T], for annotations only.