LockedModel

class LockedModel[T]

Description

A SysML v2 model represented using abstract syntax.

Members defined in LockedModel (13 members)

diagnostics

R

Diagnostics emitted while building this model.

documents

R

Documents as part of this model.

environment

R

The environment this model was built in.

index

R

Index of exported symbols.

lib

R

Standard library cache.

paths

R

Paths extracted from URIs of available documents in this model.

result

R

The model build result.

uris

R

URIs of available documents in this model.

elements

An alias for nodes.

indexed_member

Find an owned member at path defined by segments starting with top-level elements in index. This excludes imported and inherited members.

nodes

Iterate over all nodes of the given kind.

to_environment

Convert this model to Environment for building other dependent models.

unlock

Unlocks the model, freeing it up for others to lock.

Attributes

property diagnostics: syside.Diagnostics

Diagnostics emitted while building this model.

property documents: list[T]

Documents as part of this model.

property environment: syside.Environment

The environment this model was built in.

property index: syside.StaticIndex

Index of exported symbols.

property lib: syside.Stdlib

Standard library cache.

property paths: Iterable[pathlib.Path]

Paths extracted from URIs of available documents in this model.

property result: syside.ExecutionResult | None

The model build result.

property uris: Iterable[syside.Url]

URIs of available documents in this model.

Methods

elements(node_kind: type[syside.TElement], include_subtypes: bool = False) → Iterable[syside.TElement]

An alias for nodes.

indexed_member(*segments: str) → syside.Element

Find an owned member at path defined by segments starting with top-level elements in index. This excludes imported and inherited members.

Note that modifications to top-level elements will not be reflected here.

Raises KeyError if any chain segment is not found.

nodes(node_kind: type[syside.TElement], include_subtypes: bool = False) → Iterable[syside.TElement]

Iterate over all nodes of the given kind.

Parameters:
  • node_kind – What kind of nodes to return.

  • include_subtypes – Whether to consider subtypes.

to_environment() → syside.Environment

Convert this model to Environment for building other dependent models.

Using environment to build models requires that documents in it are not modified while build is in progress as no explicit dependency locking is performed otherwise.

Documents in the returned environment are guaranteed to be after documents in this model.

unlock() → T

Unlocks the model, freeing it up for others to lock.

Raises:

RuntimeError – if used after unlocking