grid
Description
Grid views as Python objects: a Labs feature.
Warning
Features in this submodule are experimental and may have breaking changes even in minor releases.
build_matrix() reads a matrix view of a locked model into a
Matrix; is_grid_matrix() says which views it accepts.
Index
Classes
A matrix view, read from a locked model by |
||
Reading the matrix failed. |
||
One row or column of a matrix. |
||
A relationship connecting the matrix’s axes, from one source header. |
||
|
||
|
||
|
Functions
Build the matrix that |
||
Whether |
Enumerations
The axis a header is on. |
||
Which end of a relationship may sit on which axis: |
Functions
- build_matrix(model: syside.Model, view: syside.ViewUsage, *, allow_errors: bool = False) syside.experimental.grid.Matrix
Build the matrix that
viewdefines.The result points into
modeland is usable only whilemodelstays locked. It is not updated when the model changes: build it again to see the changes.The view’s exposes are resolved by name. If two elements share a qualified name (a
namespace-distinguishabilityorglobal-namespace-distinguishabilitydiagnostic, whichallow_errorsor a[lint]override can let through), the specification does not say which of them a name resolves to, so the matrix may show a different element than the one intended.- Parameters:
model – The model containing
view. Must be locked.view – The matrix view. To find a view by its qualified name, use
syside.query.find_by_qualified_name.allow_errors – Build the matrix even though the model has Error diagnostics, which can make it incomplete or wrong where they are. A syntax error is refused regardless. Warnings never block.
- Returns:
The matrix object
Matrix.- Raises:
NotAMatrixViewError –
viewis not a matrix view, that is,is_grid_matrix(view)is false.ViewNotInModelError –
viewis not inmodel.syside.ModelError –
modelhas a syntax error, or an error andallow_errorsis not set.MatrixBuildError – Reading the matrix failed; the cause is on
__cause__. This includes a model holding more than one copy of theSysideViewslibrary, even withallow_errors: the message names each copy, as forsyside.grid.write_csv.TypeError –
modelis not locked,viewis not asyside.ViewUsage, orallow_errorsis not abool.
- is_grid_matrix(view: syside.ViewUsage) bool
Whether
viewis a matrix view thatbuild_matrix()accepts.A matrix view specialises
SysideViews::MatrixViewDefinitions::MatrixViewand is declared in the user’s model: not in a standard library, not inSysideViewsitself, and not nested in another view. These are the views the Syside views panel lists as matrices.- Parameters:
view – The view to check.
- Returns:
Trueifviewis a matrix view, editable or not.- Raises:
TypeError –
viewis not asyside.ViewUsage.
Enumerations
- class MatrixTraceabilityDirection
Which end of a relationship may sit on which axis:
SysideViews’Dir.