Environment
- class Environment
Standard library environment for use with user models.
Members defined in
Environment(7 members)
RWDocuments in this environment
RWStandard library cache
RWResult of parsing documents in this environment
Construct the environment from the given documents.
Construct the environment from the given stdlib files.
Get a default constructed standard library environment.
Returns a copy of the environment index for use in dependent models.
Attributes
- documents: list[syside.SharedMutex[syside.Document]] = None
Documents in this environment
- lib: syside.Stdlib = None
Standard library cache
- result: syside.ExecutionResult | None = None
Result of parsing documents in this environment
Methods
- classmethod from_documents(documents: Iterable[syside.SharedMutex[syside.Document]], index: syside.StaticIndex | None = None) syside.Environment
Construct the environment from the given documents.
- Parameters:
documents – The documents from which to construct the SysMLv2 environment.
index – The index to be used in models. If
None, creates a new index. If notNone, clones the index to avoid mutating the argument.
- classmethod from_stdlib_files(stdlib_files: list[pathlib.Path]) syside.Environment
Construct the environment from the given stdlib files.
- Parameters:
stdlib_files – The paths to SysMLv2 or KerML files representing the stdlib. These files must have correct file extensions (
.sysmlor.kerml).
- classmethod get_default(root: pathlib.Path | None = None) syside.Environment
Get a default constructed standard library environment.
This will only be executed on the first call, and any subsequent calls will return a cached value. Standard library environment is cached based on the assumption that it WILL NOT change during runtime, saving resources when loading other models.
The additional
rootargument may be used to initialize the default environment to another standard library underroot / sysml.library. Note that this only has effect on the very first call ofget_default— call this on the program startup.
- index() syside.StaticIndex
Returns a copy of the environment index for use in dependent models.
A copy is required so that dependent models do not affect this environment and other dependent models.