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M2NiIgc3Ryb2tlLXdpZHRoPSIxIiB3aWR0aD0iMTcxIiB4PSIzOTAuNSIgeT0iMTQzLjUiIC8+PHRleHQgY2xhc3M9Ik5vdGUiIGRvbWluYW50LWJhc2VsaW5lPSJtaWRkbGUiIGZpbGw9IiMwMDAwMDAiIHRleHQtYW5jaG9yPSJtaWRkbGUiIHg9IjM5MCIgeT0iMTQzIj48dHNwYW4geD0iNDc1LjUiIHhtbDpzcGFjZT0icHJlc2VydmUiIHk9IjE1NS4yODU3MTQyODU3MTQyOCI+RGlhZ3JhbXMgYWNjZXNzZWQ8L3RzcGFuPjx0c3BhbiB4PSI0NzUuNSIgeG1sOnNwYWNlPSJwcmVzZXJ2ZSIgeT0iMTczLjg1NzE0Mjg1NzE0Mjg2Ij5mcm9tIGEgbGF5ZXIgYXJlPC90c3Bhbj48dHNwYW4geD0iNDc1LjUiIHhtbDpzcGFjZT0icHJlc2VydmUiIHk9IjE5Mi40Mjg1NzE0Mjg1NzE0NCI+ZmlsdGVyZWQgZm9yIHRoZS4uLjwvdHNwYW4+PC90ZXh0PjwvZz48L3N2Zz4=
capellambse.model.common.XTYPE_ANCHORS = {'capellambse.extensions.filtering': 'filtering', 'capellambse.extensions.reqif._capellareq': 'CapellaRequirements', 'capellambse.extensions.reqif._requirements': 'Requirements', 'capellambse.model': 'org.polarsys.capella.core.data.capellamodeller', 'capellambse.model.crosslayer': 'org.polarsys.capella.core.data', 'capellambse.model.diagram': 'viewpoint', 'capellambse.model.layers': 'org.polarsys.capella.core.data'}

A mapping from anchor modules to Capella packages.

This dictionary maps Python modules and packages to the Capella packages they represent. build_xtype and related functions/classes can then use this information to automatically derive an xsi:type from any class that is defined in such an anchor module (or a submodule of one).

capellambse.model.common.XTYPE_HANDLERS: dict[str | None, dict[str, type[Any]]] = {'org.polarsys.capella.core.data.ctx:SystemAnalysis': {'org.polarsys.capella.core.data.ctx:Capability': <class 'capellambse.model.layers.ctx.Capability'>, 'org.polarsys.capella.core.data.ctx:CapabilityExploitation': <class 'capellambse.model.layers.ctx.CapabilityExploitation'>, 'org.polarsys.capella.core.data.ctx:CapabilityInvolvement': <class 'capellambse.model.layers.ctx.CapabilityInvolvement'>, 'org.polarsys.capella.core.data.ctx:CapabilityPkg': <class 'capellambse.model.layers.ctx.CapabilityPkg'>, 'org.polarsys.capella.core.data.ctx:Mission': <class 'capellambse.model.layers.ctx.Mission'>, 'org.polarsys.capella.core.data.ctx:MissionInvolvement': <class 'capellambse.model.layers.ctx.MissionInvolvement'>, 'org.polarsys.capella.core.data.ctx:MissionPkg': <class 'capellambse.model.layers.ctx.MissionPkg'>, 'org.polarsys.capella.core.data.ctx:SystemComponent': <class 'capellambse.model.layers.ctx.SystemComponent'>, 'org.polarsys.capella.core.data.ctx:SystemComponentPkg': <class 'capellambse.model.layers.ctx.SystemComponentPkg'>, 'org.polarsys.capella.core.data.ctx:SystemFunction': <class 'capellambse.model.layers.ctx.SystemFunction'>, 'org.polarsys.capella.core.data.ctx:SystemFunctionPkg': <class 'capellambse.model.layers.ctx.SystemFunctionPkg'>}, 'org.polarsys.capella.core.data.la:LogicalArchitecture': {'org.polarsys.capella.core.data.la:CapabilityRealization': <class 'capellambse.model.layers.la.CapabilityRealization'>, 'org.polarsys.capella.core.data.la:CapabilityRealizationPkg': <class 'capellambse.model.layers.la.CapabilityRealizationPkg'>, 'org.polarsys.capella.core.data.la:LogicalComponent': <class 'capellambse.model.layers.la.LogicalComponent'>, 'org.polarsys.capella.core.data.la:LogicalComponentPkg': <class 'capellambse.model.layers.la.LogicalComponentPkg'>, 'org.polarsys.capella.core.data.la:LogicalFunction': <class 'capellambse.model.layers.la.LogicalFunction'>, 'org.polarsys.capella.core.data.la:LogicalFunctionPkg': <class 'capellambse.model.layers.la.LogicalFunctionPkg'>}, 'org.polarsys.capella.core.data.oa:OperationalAnalysis': {'org.polarsys.capella.core.data.oa:CommunicationMean': <class 'capellambse.model.layers.oa.CommunicationMean'>, 'org.polarsys.capella.core.data.oa:Entity': <class 'capellambse.model.layers.oa.Entity'>, 'org.polarsys.capella.core.data.oa:EntityOperationalCapabilityInvolvement': <class 'capellambse.model.layers.oa.EntityOperationalCapabilityInvolvement'>, 'org.polarsys.capella.core.data.oa:EntityPkg': <class 'capellambse.model.layers.oa.EntityPkg'>, 'org.polarsys.capella.core.data.oa:OperationalActivity': <class 'capellambse.model.layers.oa.OperationalActivity'>, 'org.polarsys.capella.core.data.oa:OperationalActivityPkg': <class 'capellambse.model.layers.oa.OperationalActivityPkg'>, 'org.polarsys.capella.core.data.oa:OperationalCapability': <class 'capellambse.model.layers.oa.OperationalCapability'>, 'org.polarsys.capella.core.data.oa:OperationalCapabilityPkg': <class 'capellambse.model.layers.oa.OperationalCapabilityPkg'>, 'org.polarsys.capella.core.data.oa:OperationalProcess': <class 'capellambse.model.layers.oa.OperationalProcess'>}, 'org.polarsys.capella.core.data.pa:PhysicalArchitecture': {'org.polarsys.capella.core.data.pa:PhysicalComponent': <class 'capellambse.model.layers.pa.PhysicalComponent'>, 'org.polarsys.capella.core.data.pa:PhysicalComponentPkg': <class 'capellambse.model.layers.pa.PhysicalComponentPkg'>, 'org.polarsys.capella.core.data.pa:PhysicalFunction': <class 'capellambse.model.layers.pa.PhysicalFunction'>, 'org.polarsys.capella.core.data.pa:PhysicalFunctionPkg': <class 'capellambse.model.layers.pa.PhysicalFunctionPkg'>}, None: {'CapellaRequirements:CapellaIncomingRelation': <class 'capellambse.extensions.reqif._capellareq.CapellaIncomingRelation'>, 'CapellaRequirements:CapellaModule': <class 'capellambse.extensions.reqif._capellareq.CapellaModule'>, 'CapellaRequirements:CapellaOutgoingRelation': <class 'capellambse.extensions.reqif._capellareq.CapellaOutgoingRelation'>, 'CapellaRequirements:CapellaTypesFolder': <class 'capellambse.extensions.reqif._capellareq.CapellaTypesFolder'>, 'Requirements:AttributeDefinition': <class 'capellambse.extensions.reqif._requirements.AttributeDefinition'>, 'Requirements:AttributeDefinitionEnumeration': <class 'capellambse.extensions.reqif._requirements.AttributeDefinitionEnumeration'>, 'Requirements:BooleanValueAttribute': <class 'capellambse.extensions.reqif._requirements.BooleanValueAttribute'>, 'Requirements:DataTypeDefinition': <class 'capellambse.extensions.reqif._requirements.DataTypeDefinition'>, 'Requirements:DateValueAttribute': <class 'capellambse.extensions.reqif._requirements.DateValueAttribute'>, 'Requirements:EnumValue': <class 'capellambse.extensions.reqif._requirements.EnumValue'>, 'Requirements:EnumerationDataTypeDefinition': <class 'capellambse.extensions.reqif._requirements.EnumerationDataTypeDefinition'>, 'Requirements:EnumerationValueAttribute': <class 'capellambse.extensions.reqif._requirements.EnumerationValueAttribute'>, 'Requirements:Folder': <class 'capellambse.extensions.reqif._requirements.Folder'>, 'Requirements:IntegerValueAttribute': <class 'capellambse.extensions.reqif._requirements.IntegerValueAttribute'>, 'Requirements:InternalRelation': <class 'capellambse.extensions.reqif._requirements.InternalRelation'>, 'Requirements:ModuleType': <class 'capellambse.extensions.reqif._requirements.ModuleType'>, 'Requirements:RealValueAttribute': <class 'capellambse.extensions.reqif._requirements.RealValueAttribute'>, 'Requirements:RelationType': <class 'capellambse.extensions.reqif._requirements.RelationType'>, 'Requirements:Requirement': <class 'capellambse.extensions.reqif._requirements.Requirement'>, 'Requirements:RequirementType': <class 'capellambse.extensions.reqif._requirements.RequirementType'>, 'Requirements:StringValueAttribute': <class 'capellambse.extensions.reqif._requirements.StringValueAttribute'>, 'diagram:DSemanticDiagram': <class 'capellambse.model.diagram.Diagram'>, 'filtering:ComposedFilteringResult': <class 'capellambse.extensions.filtering.ComposedFilteringResult'>, 'filtering:FilteringCriterion': <class 'capellambse.extensions.filtering.FilteringCriterion'>, 'filtering:FilteringCriterionPkg': <class 'capellambse.extensions.filtering.FilteringCriterionPkg'>, 'filtering:FilteringModel': <class 'capellambse.extensions.filtering.FilteringModel'>, 'filtering:FilteringResult': <class 'capellambse.extensions.filtering.FilteringResult'>, 'org.polarsys.capella.core.data.capellacommon:DeepHistoryPseudoState': <class 'capellambse.model.crosslayer.capellacommon.DeepHistoryPseudoState'>, 'org.polarsys.capella.core.data.capellacommon:FinalState': <class 'capellambse.model.crosslayer.capellacommon.FinalState'>, 'org.polarsys.capella.core.data.capellacommon:ForkPseudoState': <class 'capellambse.model.crosslayer.capellacommon.ForkPseudoState'>, 'org.polarsys.capella.core.data.capellacommon:GenericTrace': <class 'capellambse.model.crosslayer.capellacommon.GenericTrace'>, 'org.polarsys.capella.core.data.capellacommon:InitialPseudoState': <class 'capellambse.model.crosslayer.capellacommon.InitialPseudoState'>, 'org.polarsys.capella.core.data.capellacommon:JoinPseudoState': <class 'capellambse.model.crosslayer.capellacommon.JoinPseudoState'>, 'org.polarsys.capella.core.data.capellacommon:Mode': <class 'capellambse.model.crosslayer.capellacommon.Mode'>, 'org.polarsys.capella.core.data.capellacommon:Region': <class 'capellambse.model.crosslayer.capellacommon.Region'>, 'org.polarsys.capella.core.data.capellacommon:ShallowHistoryPseudoState': <class 'capellambse.model.crosslayer.capellacommon.ShallowHistoryPseudoState'>, 'org.polarsys.capella.core.data.capellacommon:State': <class 'capellambse.model.crosslayer.capellacommon.State'>, 'org.polarsys.capella.core.data.capellacommon:StateMachine': <class 'capellambse.model.crosslayer.capellacommon.StateMachine'>, 'org.polarsys.capella.core.data.capellacommon:StateTransition': <class 'capellambse.model.crosslayer.capellacommon.StateTransition'>, 'org.polarsys.capella.core.data.capellacommon:TerminatePseudoState': <class 'capellambse.model.crosslayer.capellacommon.TerminatePseudoState'>, 'org.polarsys.capella.core.data.capellacore:BooleanPropertyValue': <class 'capellambse.model.crosslayer.capellacore.BooleanPropertyValue'>, 'org.polarsys.capella.core.data.capellacore:Constraint': <class 'capellambse.model.crosslayer.capellacore.Constraint'>, 'org.polarsys.capella.core.data.capellacore:EnumerationPropertyLiteral': <class 'capellambse.model.crosslayer.capellacore.EnumerationPropertyLiteral'>, 'org.polarsys.capella.core.data.capellacore:EnumerationPropertyType': <class 'capellambse.model.crosslayer.capellacore.EnumerationPropertyType'>, 'org.polarsys.capella.core.data.capellacore:EnumerationPropertyValue': <class 'capellambse.model.crosslayer.capellacore.EnumerationPropertyValue'>, 'org.polarsys.capella.core.data.capellacore:FloatPropertyValue': <class 'capellambse.model.crosslayer.capellacore.FloatPropertyValue'>, 'org.polarsys.capella.core.data.capellacore:Generalization': <class 'capellambse.model.crosslayer.capellacore.Generalization'>, 'org.polarsys.capella.core.data.capellacore:IntegerPropertyValue': <class 'capellambse.model.crosslayer.capellacore.IntegerPropertyValue'>, 'org.polarsys.capella.core.data.capellacore:PropertyValueGroup': <class 'capellambse.model.crosslayer.capellacore.PropertyValueGroup'>, 'org.polarsys.capella.core.data.capellacore:PropertyValuePkg': <class 'capellambse.model.crosslayer.capellacore.PropertyValuePkg'>, 'org.polarsys.capella.core.data.capellacore:StringPropertyValue': <class 'capellambse.model.crosslayer.capellacore.StringPropertyValue'>, 'org.polarsys.capella.core.data.capellamodeller:Library': <class 'capellambse.model.MelodyModel'>, 'org.polarsys.capella.core.data.capellamodeller:Project': <class 'capellambse.model.MelodyModel'>, 'org.polarsys.capella.core.data.cs:ComponentRealization': <class 'capellambse.model.crosslayer.cs.ComponentRealization'>, 'org.polarsys.capella.core.data.cs:ExchangeItemAllocation': <class 'capellambse.model.crosslayer.cs.ExchangeItemAllocation'>, 'org.polarsys.capella.core.data.cs:Interface': <class 'capellambse.model.crosslayer.cs.Interface'>, 'org.polarsys.capella.core.data.cs:InterfacePkg': <class 'capellambse.model.crosslayer.cs.InterfacePkg'>, 'org.polarsys.capella.core.data.cs:Part': <class 'capellambse.model.crosslayer.cs.Part'>, 'org.polarsys.capella.core.data.cs:PhysicalLink': <class 'capellambse.model.crosslayer.cs.PhysicalLink'>, 'org.polarsys.capella.core.data.cs:PhysicalPath': <class 'capellambse.model.crosslayer.cs.PhysicalPath'>, 'org.polarsys.capella.core.data.cs:PhysicalPort': <class 'capellambse.model.crosslayer.cs.PhysicalPort'>, 'org.polarsys.capella.core.data.ctx:SystemAnalysis': <class 'capellambse.model.layers.ctx.SystemAnalysis'>, 'org.polarsys.capella.core.data.fa:AbstractFunction': <class 'capellambse.model.crosslayer.fa.AbstractFunction'>, 'org.polarsys.capella.core.data.fa:ComponentExchange': <class 'capellambse.model.crosslayer.fa.ComponentExchange'>, 'org.polarsys.capella.core.data.fa:ComponentPort': <class 'capellambse.model.crosslayer.fa.ComponentPort'>, 'org.polarsys.capella.core.data.fa:ControlNode': <class 'capellambse.model.crosslayer.fa.ControlNode'>, 'org.polarsys.capella.core.data.fa:FunctionInputPort': <class 'capellambse.model.crosslayer.fa.FunctionInputPort'>, 'org.polarsys.capella.core.data.fa:FunctionOutputPort': <class 'capellambse.model.crosslayer.fa.FunctionOutputPort'>, 'org.polarsys.capella.core.data.fa:FunctionPort': <class 'capellambse.model.crosslayer.fa.FunctionPort'>, 'org.polarsys.capella.core.data.fa:FunctionRealization': <class 'capellambse.model.crosslayer.fa.FunctionRealization'>, 'org.polarsys.capella.core.data.fa:FunctionalChain': <class 'capellambse.model.crosslayer.fa.FunctionalChain'>, 'org.polarsys.capella.core.data.fa:FunctionalChainInvolvementFunction': <class 'capellambse.model.crosslayer.fa.FunctionalChainInvolvementFunction'>, 'org.polarsys.capella.core.data.fa:FunctionalChainInvolvementLink': <class 'capellambse.model.crosslayer.fa.FunctionalChainInvolvementLink'>, 'org.polarsys.capella.core.data.fa:FunctionalChainReference': <class 'capellambse.model.crosslayer.fa.FunctionalChainReference'>, 'org.polarsys.capella.core.data.fa:FunctionalExchange': <class 'capellambse.model.crosslayer.fa.FunctionalExchange'>, 'org.polarsys.capella.core.data.information.datatype:BooleanType': <class 'capellambse.model.crosslayer.information.datatype.BooleanType'>, 'org.polarsys.capella.core.data.information.datatype:Enumeration': <class 'capellambse.model.crosslayer.information.datatype.Enumeration'>, 'org.polarsys.capella.core.data.information.datatype:NumericType': <class 'capellambse.model.crosslayer.information.datatype.NumericType'>, 'org.polarsys.capella.core.data.information.datatype:PhysicalQuantity': <class 'capellambse.model.crosslayer.information.datatype.PhysicalQuantity'>, 'org.polarsys.capella.core.data.information.datatype:StringType': <class 'capellambse.model.crosslayer.information.datatype.StringType'>, 'org.polarsys.capella.core.data.information.datavalue:ComplexValue': <class 'capellambse.model.crosslayer.information.datavalue.ComplexValue'>, 'org.polarsys.capella.core.data.information.datavalue:EnumerationLiteral': <class 'capellambse.model.crosslayer.information.datavalue.EnumerationLiteral'>, 'org.polarsys.capella.core.data.information.datavalue:EnumerationReference': <class 'capellambse.model.crosslayer.information.datavalue.EnumerationReference'>, 'org.polarsys.capella.core.data.information.datavalue:LiteralNumericValue': <class 'capellambse.model.crosslayer.information.datavalue.LiteralNumericValue'>, 'org.polarsys.capella.core.data.information.datavalue:LiteralStringValue': <class 'capellambse.model.crosslayer.information.datavalue.LiteralStringValue'>, 'org.polarsys.capella.core.data.information.datavalue:ValuePart': <class 'capellambse.model.crosslayer.information.datavalue.ValuePart'>, 'org.polarsys.capella.core.data.information:Association': <class 'capellambse.model.crosslayer.information.Association'>, 'org.polarsys.capella.core.data.information:Class': <class 'capellambse.model.crosslayer.information.Class'>, 'org.polarsys.capella.core.data.information:Collection': <class 'capellambse.model.crosslayer.information.Collection'>, 'org.polarsys.capella.core.data.information:DataPkg': <class 'capellambse.model.crosslayer.information.DataPkg'>, 'org.polarsys.capella.core.data.information:ExchangeItem': <class 'capellambse.model.crosslayer.information.ExchangeItem'>, 'org.polarsys.capella.core.data.information:ExchangeItemElement': <class 'capellambse.model.crosslayer.information.ExchangeItemElement'>, 'org.polarsys.capella.core.data.information:InformationRealization': <class 'capellambse.model.crosslayer.information.InformationRealization'>, 'org.polarsys.capella.core.data.information:PortAllocation': <class 'capellambse.model.crosslayer.information.PortAllocation'>, 'org.polarsys.capella.core.data.information:Property': <class 'capellambse.model.crosslayer.information.Property'>, 'org.polarsys.capella.core.data.information:Union': <class 'capellambse.model.crosslayer.information.Union'>, 'org.polarsys.capella.core.data.information:Unit': <class 'capellambse.model.crosslayer.information.Unit'>, 'org.polarsys.capella.core.data.interaction:AbstractCapabilityExtend': <class 'capellambse.model.crosslayer.interaction.AbstractCapabilityExtend'>, 'org.polarsys.capella.core.data.interaction:AbstractCapabilityGeneralization': <class 'capellambse.model.crosslayer.interaction.AbstractCapabilityGeneralization'>, 'org.polarsys.capella.core.data.interaction:AbstractCapabilityInclude': <class 'capellambse.model.crosslayer.interaction.AbstractCapabilityInclude'>, 'org.polarsys.capella.core.data.interaction:AbstractFunctionAbstractCapabilityInvolvement': <class 'capellambse.model.crosslayer.interaction.AbstractFunctionAbstractCapabilityInvolvement'>, 'org.polarsys.capella.core.data.interaction:CombinedFragment': <class 'capellambse.model.crosslayer.interaction.CombinedFragment'>, 'org.polarsys.capella.core.data.interaction:EventReceiptOperation': <class 'capellambse.model.crosslayer.interaction.EventReceiptOperation'>, 'org.polarsys.capella.core.data.interaction:EventSentOperation': <class 'capellambse.model.crosslayer.interaction.EventSentOperation'>, 'org.polarsys.capella.core.data.interaction:Execution': <class 'capellambse.model.crosslayer.interaction.Execution'>, 'org.polarsys.capella.core.data.interaction:ExecutionEnd': <class 'capellambse.model.crosslayer.interaction.ExecutionEnd'>, 'org.polarsys.capella.core.data.interaction:ExecutionEvent': <class 'capellambse.model.crosslayer.interaction.ExecutionEvent'>, 'org.polarsys.capella.core.data.interaction:FragmentEnd': <class 'capellambse.model.crosslayer.interaction.FragmentEnd'>, 'org.polarsys.capella.core.data.interaction:InstanceRole': <class 'capellambse.model.crosslayer.interaction.InstanceRole'>, 'org.polarsys.capella.core.data.interaction:InteractionOperand': <class 'capellambse.model.crosslayer.interaction.InteractionOperand'>, 'org.polarsys.capella.core.data.interaction:InteractionState': <class 'capellambse.model.crosslayer.interaction.InteractionState'>, 'org.polarsys.capella.core.data.interaction:MessageEnd': <class 'capellambse.model.crosslayer.interaction.MessageEnd'>, 'org.polarsys.capella.core.data.interaction:Scenario': <class 'capellambse.model.crosslayer.interaction.Scenario'>, 'org.polarsys.capella.core.data.interaction:SequenceMessage': <class 'capellambse.model.crosslayer.interaction.SequenceMessage'>, 'org.polarsys.capella.core.data.interaction:StateFragment': <class 'capellambse.model.crosslayer.interaction.StateFragment'>, 'org.polarsys.capella.core.data.la:LogicalArchitecture': <class 'capellambse.model.layers.la.LogicalArchitecture'>, 'org.polarsys.capella.core.data.oa:OperationalAnalysis': <class 'capellambse.model.layers.oa.OperationalAnalysis'>, 'org.polarsys.capella.core.data.pa:PhysicalArchitecture': <class 'capellambse.model.layers.pa.PhysicalArchitecture'>, 'sequence:SequenceDDiagram': <class 'capellambse.model.diagram.Diagram'>, 'viewpoint:DRepresentationDescriptor': <class 'capellambse.model.diagram.Diagram'>}}

Defines a mapping between xsi:types and wrapper classes.

The first layer’s keys can be either None or the xsi:type of the architectural layer that the wrapper should be applied to. In the case of None, the wrapper will be applied to all layers. Note that layer-specific wrappers have precedence over layer-agnostic ones.

These keys map to a further dictionary. This second layer maps from the xsi:type(s) that each wrapper handles to the wrapper class.

capellambse.model.common.build_xtype(class_)
Parameters:

class_ (type[ModelObject])

Return type:

str

capellambse.model.common.enumliteral(generic_element, attr, default='NOT_SET')
Parameters:
Return type:

AttributeProperty | str

capellambse.model.common.find_wrapper(typehint)

Find the possible wrapper classes for the hinted type.

The typehint is either a single class name, or a namespace prefix and class name separated by :. This function searches for all known wrapper classes that match the given namespace prefix (if any) and which have the given name, and returns them as a tuple. If no matching wrapper classes are found, an empty tuple is returned.

Parameters:

typehint (str)

Return type:

tuple[type[ModelObject], …]

capellambse.model.common.set_accessor(cls, attr, accessor)
Parameters:
Return type:

None

capellambse.model.common.set_self_references(*args)
Parameters:

args (tuple[type[ModelObject], str])

Return type:

None

capellambse.model.common.xtype_handler(arch=None, /, *xtypes)

Register a class as handler for a specific xsi:type.

arch is the xsi:type of the desired architecture. It must always be a simple string or None. In the latter case the definition applies to all elements regardless of their architectural layer. Architecture-specific definitions will always win over architecture-independent ones.

Each string given in xtypes notes an xsi:type of elements that this class handles. It is possible to specify multiple values, in which case the class will be registered for each xsi:type under the architectural layer given in arch.

Handler classes’ __init__ methods must accept two positional arguments. The first argument is the MelodyModel instance which loaded the corresponding model, and the second one is the LXML element that needs to be handled.

Example:

>>> @xtype_handler('arch:xtype', 'xtype:1', 'xtype:2')
... class Test:
...     _xmltag = "ownedTests"
...     def from_model(self, model, element, /):
...         ...  # Instantiate from model XML element
Parameters:
  • arch (str | None)

  • xtypes (str)

Return type:

Callable[[type[T]], type[T]]

Submodules

capellambse.model.common.accessors module

class capellambse.model.common.accessors.Accessor

Bases: Generic[T]

Super class for all Accessor types.

__init__()
Return type:

None

class capellambse.model.common.accessors.AlternateAccessor

Bases: Accessor[T]

Provides access to an “alternate” form of the object.

__init__(class_)
Parameters:

class_ (type[T])

class_
class capellambse.model.common.accessors.AttrProxyAccessor

Bases: WritableAccessor[T], PhysicalAccessor[T]

Provides access to elements that are linked in an attribute.

__init__(class_, attr, *, aslist=None, list_extra_args=None)

Create an AttrProxyAccessor.

Parameters:
  • class – The proxy class. Currently only used for type hints.

  • attr (str) – The XML attribute to handle.

  • aslist (type[ElementList] | None) – If None, the attribute contains at most one element reference, and either None or the constructed proxy will be returned. If not None, must be a subclass of ElementList. It will be used to return a list of all matched objects.

  • list_extra_args (Mapping[str, Any] | None) – Extra arguments to pass to the ElementList constructor.

  • class_ (type[T] | None)

attr
delete(elmlist, obj)

Delete the obj from the model.

Parameters:
Return type:

None

insert(elmlist, index, value)

Insert the value object into the model.

The object must be inserted at an appropriate place, so that, if elmlist were to be created afresh, value would show up at index index.

Parameters:
Return type:

None

purge_references(obj, target)

Purge references to the given object from the model.

This method is called while deleting physical objects, in order to get rid of references to that object (and its descendants). Reference purging is done in two steps, which is why this method returns a context manager.

The first step, executed by the __enter__ method, collects references to the target and ensures that deleting them would result in a valid model. If any validity constraints would be violated, an exception is raised to indicate as such, and the whole operation is aborted. This is also when the relevant “capellambse.delete” audit events are fired for each reference.

Once all __enter__ methods have been called, the target object is deleted from the model. Then all __exit__ methods are called, which triggers the actual deletion of all previously discovered references.

As per the context manager protocol, __exit__ will always be called after __enter__, even if the operation is to be aborted. The __exit__ method must therefore inspect whether an exception was passed in or not in order to know whether the operation succeeded.

In order to not confuse other context managers and keep the model consistent, __exit__ must not raise any further exceptions. Exceptions should instead be logged to stderr, for example by using the logging.Logger.exception() facility.

The purge_references method will only be called for Accessor instances that actually contain a reference.

Parameters:
  • obj (ModelObject) – The model object to purge references from.

  • target (ModelObject) – The object that is to be deleted; references to this object will be purged.

Returns:

A context manager that deals with purging references in a transactional manner.

Return type:

contextlib.AbstractContextManager

Raises:
  • InvalidModificationError – Raised by the returned context manager’s __enter__ method if the attempted modification would result in an invalid model. Note that it is generally preferred to allow the operation and take the necessary steps to keep the model consistent, if possible. This can be achieved for example by deleting dependent objects along with the original deletion target.

  • Exception – Any exception may be raised before __enter__ returns in order to abort the transaction and prevent the obj from being deleted. No exceptions must be raised by __exit__.

Examples

A simple implementation for purging a single object reference could look like this:

@contextlib.contextmanager
def purge_references(self, obj, target):
    assert self.__get__(obj, type(obj)) == target
    sys.audit("capellambse.delete", obj, self.__name__, None)

    yield

    try:
        self.__delete__(obj)
    except Exception:
        LOGGER.exception("Could not purge a dangling reference")
class capellambse.model.common.accessors.AttributeMatcherAccessor

Bases: DirectProxyAccessor[T]

__init__(class_, xtypes=None, *, aslist=None, attributes, **kwargs)

Create a DirectProxyAccessor.

Parameters:
  • class – The proxy class.

  • xtypes (str | type[T] | Iterable[str | type[T]] | None) – The xsi:type(s) of the child element(s). If None, then the constructed proxy will be passed the original element instead of a child.

  • aslist (type[ElementList] | None) – If None, only a single element must match, which will be returned directly. If not None, must be a subclass of ElementList, which will be used to return a list of all matched objects.

  • follow_abstract – Follow the link in the abstractType XML attribute of each list member and instantiate that object instead. The default is to instantiate the child elements directly.

  • list_extra_args – Extra arguments to pass to the ElementList constructor.

  • rootelem – A class or xsi:type (or list thereof) that defines the path from the current object’s XML element to the search root. If None, the current element will be used directly.

  • single_attr – If objects can be created with only a single attribute specified, this argument is the name of that attribute. This create_singleattr().

  • class_ (type[T])

  • attributes (dict[str, Any])

Return type:

None

attributes
class capellambse.model.common.accessors.CustomAccessor

Bases: PhysicalAccessor[T]

Customizable alternative to the DirectProxyAccessor.

Deprecated since version 0.5.4: Deprecated due to overcomplexity and (ironically) a lack of flexibility.

__init__(class_, *elmfinders, elmmatcher=<built-in function contains>, matchtransform=<function CustomAccessor.<lambda>>, aslist=None)

Create a CustomAccessor.

Parameters:
  • class – The target subclass of GenericElement

  • elmfinders (Callable[[GenericElement], Iterable[T]]) – Functions that are called on the current element. Each returns an iterable of possible targets.

  • aslist (type[ElementList] | None) – If None, only a single element must match, which will be returned directly. If not None, must be a subclass of ElementList, which will be used to return a list of all matched objects.

  • elmmatcher (Callable[[U, GenericElement], bool]) – Function that is called with the transformed target element and the current element to determine if the untransformed target should be accepted.

  • matchtransform (Callable[[T], U]) – Function that transforms a target so that it can be used by the matcher function.

  • class_ (type[T])

Return type:

None

elmfinders
elmmatcher
matchtransform
class capellambse.model.common.accessors.DeepProxyAccessor

Bases: DirectProxyAccessor[T]

A DirectProxyAccessor that searches recursively through the tree.

class capellambse.model.common.accessors.DeprecatedAccessor

Bases: Accessor[T]

Provides a deprecated alias to another attribute.

__init__(alternative, /)
Parameters:

alternative (str)

Return type:

None

alternative
class capellambse.model.common.accessors.DirectProxyAccessor

Bases: WritableAccessor[T], PhysicalAccessor[T]

Creates proxy objects on the fly.

__init__(class_, xtypes=None, *, aslist=None, follow_abstract=False, list_extra_args=None, rootelem=None, single_attr=None)

Create a DirectProxyAccessor.

Parameters:
  • class – The proxy class.

  • xtypes (str | type[T] | Iterable[str | type[T]] | None) – The xsi:type(s) of the child element(s). If None, then the constructed proxy will be passed the original element instead of a child.

  • aslist (type[ElementList] | None) – If None, only a single element must match, which will be returned directly. If not None, must be a subclass of ElementList, which will be used to return a list of all matched objects.

  • follow_abstract (bool) – Follow the link in the abstractType XML attribute of each list member and instantiate that object instead. The default is to instantiate the child elements directly.

  • list_extra_args (dict[str, Any] | None) – Extra arguments to pass to the ElementList constructor.

  • rootelem (str | type[GenericElement] | Sequence[str | type[GenericElement]] | None) – A class or xsi:type (or list thereof) that defines the path from the current object’s XML element to the search root. If None, the current element will be used directly.

  • single_attr (str | None) – If objects can be created with only a single attribute specified, this argument is the name of that attribute. This create_singleattr().

  • class_ (type[T])

create(elmlist, /, *type_hints, **kw)

Create and return a new element of type elmclass.

Parameters:
  • elmlist (ElementListCouplingMixin) – The (coupled) ElementList to insert the new object into.

  • type_hints (str | None) – Hints for finding the correct type of element to create. Can either be a full or shortened xsi:type string, or an abbreviation defined by the specific Accessor instance.

  • kw (Any) – Initialize the properties of the new object. Depending on the object’s type, some attributes may be required.

Return type:

T

delete(elmlist, obj)

Delete the obj from the model.

Parameters:
Return type:

None

follow_abstract: bool
insert(elmlist, index, value)

Insert the value object into the model.

The object must be inserted at an appropriate place, so that, if elmlist were to be created afresh, value would show up at index index.

Parameters:
Return type:

None

purge_references(obj, target)

Purge references to the given object from the model.

This method is called while deleting physical objects, in order to get rid of references to that object (and its descendants). Reference purging is done in two steps, which is why this method returns a context manager.

The first step, executed by the __enter__ method, collects references to the target and ensures that deleting them would result in a valid model. If any validity constraints would be violated, an exception is raised to indicate as such, and the whole operation is aborted. This is also when the relevant “capellambse.delete” audit events are fired for each reference.

Once all __enter__ methods have been called, the target object is deleted from the model. Then all __exit__ methods are called, which triggers the actual deletion of all previously discovered references.

As per the context manager protocol, __exit__ will always be called after __enter__, even if the operation is to be aborted. The __exit__ method must therefore inspect whether an exception was passed in or not in order to know whether the operation succeeded.

In order to not confuse other context managers and keep the model consistent, __exit__ must not raise any further exceptions. Exceptions should instead be logged to stderr, for example by using the logging.Logger.exception() facility.

The purge_references method will only be called for Accessor instances that actually contain a reference.

Parameters:
  • obj (ModelObject) – The model object to purge references from.

  • target (ModelObject) – The object that is to be deleted; references to this object will be purged.

Returns:

A context manager that deals with purging references in a transactional manner.

Return type:

contextlib.AbstractContextManager

Raises:
  • InvalidModificationError – Raised by the returned context manager’s __enter__ method if the attempted modification would result in an invalid model. Note that it is generally preferred to allow the operation and take the necessary steps to keep the model consistent, if possible. This can be achieved for example by deleting dependent objects along with the original deletion target.

  • Exception – Any exception may be raised before __enter__ returns in order to abort the transaction and prevent the obj from being deleted. No exceptions must be raised by __exit__.

Examples

A simple implementation for purging a single object reference could look like this:

@contextlib.contextmanager
def purge_references(self, obj, target):
    assert self.__get__(obj, type(obj)) == target
    sys.audit("capellambse.delete", obj, self.__name__, None)

    yield

    try:
        self.__delete__(obj)
    except Exception:
        LOGGER.exception("Could not purge a dangling reference")
rootelem: Sequence[str]
single_attr: str | None
class capellambse.model.common.accessors.ElementListCouplingMixin

Bases: ElementList[T], Generic[T]

Couples an ElementList with an Accessor to enable write support.

This class is meant to be subclassed further, where the subclass has both this class and the originally intended one as base classes (but no other ones, i.e. there must be exactly two bases). The Accessor then inserts itself as the _accessor class variable on the new subclass. This allows the mixed-in methods to delegate actual model modifications to the Accessor.

__init__(*args, parent, fixed_length=0, **kw)
Parameters:
Return type:

None

create(*type_hints, **kw)

Make a new model object (instance of GenericElement).

Instead of specifying the full xsi:type including the namespace, you can also pass in just the part after the : separator. If this is unambiguous, the appropriate layer-specific type will be selected automatically.

This method can be called with or without the layertype argument. If a layertype is not given, all layers will be tried to find an appropriate xsi:type handler. Note that setting the layertype to None explicitly is different from not specifying it at all; None tries only the “Transverse modelling” type elements.

Parameters:
  • type_hints (str | None) – Hints for finding the correct type of element to create. Can either be a full or shortened xsi:type string, or an abbreviation defined by the specific Accessor instance.

  • kw (Any) – Initialize the properties of the new object. Depending on the object, some attributes may be required.

Return type:

T

create_singleattr(arg)

Make a new model object (instance of GenericElement).

This new object has only one interesting attribute.

See also

ElementListCouplingMixin.create()

More details on how elements are created.

WritableAccessor.create_singleattr()

The method to override in Accessors in order to implement this operation.

Parameters:

arg (Any)

Return type:

T

delete_all(**kw)

Delete all matching objects from the model.

Parameters:

kw (Any)

Return type:

None

insert(index, value)

S.insert(index, value) – insert value before index

Parameters:
  • index (int)

  • value (T)

Return type:

None

class capellambse.model.common.accessors.IndexAccessor

Bases: Accessor[T]

Access a specific index in an ElementList of a fixed size.

__init__(wrapped, index)
Parameters:
Return type:

None

index
wrapped
exception capellambse.model.common.accessors.InvalidModificationError

Bases: RuntimeError

Raised when a modification would result in an invalid model.

class capellambse.model.common.accessors.LinkAccessor

Bases: WritableAccessor[T], PhysicalAccessor[T]

Accesses elements through reference elements.

__init__(tag, xtype, /, *, aslist=None, attr, backattr=None, unique=True)

Create a LinkAccessor.

Parameters:
  • tag (str | None) – The XML tag that the reference elements will have.

  • xtype (str | type[GenericElement]) – The xsi:type that the reference elements will have. This has no influence on the elements that are referenced.

  • attr (str) – The attribute on the reference element that contains the actual link.

  • backattr (str | None) – An optional attribute on the reference element to store a reference back to the owner (parent) object.

  • aslist (type[ElementList] | None) – Optionally specify a different subclass of ElementList.

  • unique (bool) – Enforce that each element may only appear once in the list. If a duplicate is attempted to be added, an exception will be raised. Note that this does not have an effect on lists already existing within the loaded model.

Return type:

None

backattr: str | None
delete(elmlist, obj)

Delete the obj from the model.

Parameters:
Return type:

None

insert(elmlist, index, value)

Insert the value object into the model.

The object must be inserted at an appropriate place, so that, if elmlist were to be created afresh, value would show up at index index.

Parameters:
Return type:

None

purge_references(obj, target)

Purge references to the given object from the model.

This method is called while deleting physical objects, in order to get rid of references to that object (and its descendants). Reference purging is done in two steps, which is why this method returns a context manager.

The first step, executed by the __enter__ method, collects references to the target and ensures that deleting them would result in a valid model. If any validity constraints would be violated, an exception is raised to indicate as such, and the whole operation is aborted. This is also when the relevant “capellambse.delete” audit events are fired for each reference.

Once all __enter__ methods have been called, the target object is deleted from the model. Then all __exit__ methods are called, which triggers the actual deletion of all previously discovered references.

As per the context manager protocol, __exit__ will always be called after __enter__, even if the operation is to be aborted. The __exit__ method must therefore inspect whether an exception was passed in or not in order to know whether the operation succeeded.

In order to not confuse other context managers and keep the model consistent, __exit__ must not raise any further exceptions. Exceptions should instead be logged to stderr, for example by using the logging.Logger.exception() facility.

The purge_references method will only be called for Accessor instances that actually contain a reference.

Parameters:
  • obj (ModelObject) – The model object to purge references from.

  • target (ModelObject) – The object that is to be deleted; references to this object will be purged.

Returns:

A context manager that deals with purging references in a transactional manner.

Return type:

contextlib.AbstractContextManager

Raises:
  • InvalidModificationError – Raised by the returned context manager’s __enter__ method if the attempted modification would result in an invalid model. Note that it is generally preferred to allow the operation and take the necessary steps to keep the model consistent, if possible. This can be achieved for example by deleting dependent objects along with the original deletion target.

  • Exception – Any exception may be raised before __enter__ returns in order to abort the transaction and prevent the obj from being deleted. No exceptions must be raised by __exit__.

Examples

A simple implementation for purging a single object reference could look like this:

@contextlib.contextmanager
def purge_references(self, obj, target):
    assert self.__get__(obj, type(obj)) == target
    sys.audit("capellambse.delete", obj, self.__name__, None)

    yield

    try:
        self.__delete__(obj)
    except Exception:
        LOGGER.exception("Could not purge a dangling reference")
tag: str | None
unique
exception capellambse.model.common.accessors.NonUniqueMemberError

Bases: ValueError

Raised when a duplicate member is inserted into a list.

property attr
property parent
property target
class capellambse.model.common.accessors.ParentAccessor

Bases: PhysicalAccessor[T]

Accesses the parent XML element.

__init__(class_)
Parameters:

class_ (type[T])

class capellambse.model.common.accessors.PhysicalAccessor

Bases: Accessor[T]

Helper super class for accessors that work with real elements.

__init__(class_, xtypes=None, *, aslist=None, list_extra_args=None)
Parameters:
Return type:

None

aslist: type[ElementList] | None
class_: type[T]
list_extra_args: Mapping[str, Any]
xtypes: Set[str]
class capellambse.model.common.accessors.PhysicalLinkEndsAccessor

Bases: AttrProxyAccessor[T]

__init__(class_, attr, *, aslist)

Create an AttrProxyAccessor.

Parameters:
  • class – The proxy class. Currently only used for type hints.

  • attr (str) – The XML attribute to handle.

  • aslist (type[ElementList]) – If None, the attribute contains at most one element reference, and either None or the constructed proxy will be returned. If not None, must be a subclass of ElementList. It will be used to return a list of all matched objects.

  • list_extra_args – Extra arguments to pass to the ElementList constructor.

  • class_ (type[T])

Return type:

None

attr
purge_references(obj, target)

Purge references to the given object from the model.

This method is called while deleting physical objects, in order to get rid of references to that object (and its descendants). Reference purging is done in two steps, which is why this method returns a context manager.

The first step, executed by the __enter__ method, collects references to the target and ensures that deleting them would result in a valid model. If any validity constraints would be violated, an exception is raised to indicate as such, and the whole operation is aborted. This is also when the relevant “capellambse.delete” audit events are fired for each reference.

Once all __enter__ methods have been called, the target object is deleted from the model. Then all __exit__ methods are called, which triggers the actual deletion of all previously discovered references.

As per the context manager protocol, __exit__ will always be called after __enter__, even if the operation is to be aborted. The __exit__ method must therefore inspect whether an exception was passed in or not in order to know whether the operation succeeded.

In order to not confuse other context managers and keep the model consistent, __exit__ must not raise any further exceptions. Exceptions should instead be logged to stderr, for example by using the logging.Logger.exception() facility.

The purge_references method will only be called for Accessor instances that actually contain a reference.

Parameters:
  • obj (ModelObject) – The model object to purge references from.

  • target (ModelObject) – The object that is to be deleted; references to this object will be purged.

Returns:

A context manager that deals with purging references in a transactional manner.

Return type:

contextlib.AbstractContextManager

Raises:
  • InvalidModificationError – Raised by the returned context manager’s __enter__ method if the attempted modification would result in an invalid model. Note that it is generally preferred to allow the operation and take the necessary steps to keep the model consistent, if possible. This can be achieved for example by deleting dependent objects along with the original deletion target.

  • Exception – Any exception may be raised before __enter__ returns in order to abort the transaction and prevent the obj from being deleted. No exceptions must be raised by __exit__.

Examples

A simple implementation for purging a single object reference could look like this:

@contextlib.contextmanager
def purge_references(self, obj, target):
    assert self.__get__(obj, type(obj)) == target
    sys.audit("capellambse.delete", obj, self.__name__, None)

    yield

    try:
        self.__delete__(obj)
    except Exception:
        LOGGER.exception("Could not purge a dangling reference")
class capellambse.model.common.accessors.ReferenceSearchingAccessor

Bases: PhysicalAccessor[T]

Searches for references to the current element elsewhere.

__init__(class_, *attrs, aslist=None)

Create a ReferenceSearchingAccessor.

Parameters:
  • class – The type of class to search for references on.

  • attrs (str) – The attributes of the target classes to search through.

  • aslist (type[ElementList] | None) – If None, only a single element must match, which will be returned directly. If not None, must be a subclass of ElementList, which will be used to return a list of all matched objects.

  • class_ (type[T] | tuple[type[ModelObject], ...])

Return type:

None

attrs: tuple[attrgetter, ...]
target_classes: tuple[type[ModelObject], ...]
class capellambse.model.common.accessors.RoleTagAccessor

Bases: WritableAccessor, PhysicalAccessor

__init__(role_tag, classes=(), *, aslist=None, list_extra_args=None)
Parameters:
Return type:

None

classes
create(elmlist, /, *type_hints, **kw)

Create and return a new element of type elmclass.

Parameters:
  • elmlist (ElementListCouplingMixin) – The (coupled) ElementList to insert the new object into.

  • type_hints (str | None) – Hints for finding the correct type of element to create. Can either be a full or shortened xsi:type string, or an abbreviation defined by the specific Accessor instance.

  • kw (Any) – Initialize the properties of the new object. Depending on the object’s type, some attributes may be required.

Return type:

GenericElement

delete(elmlist, obj)

Delete the obj from the model.

Parameters:
Return type:

None

insert(elmlist, index, value)

Insert the value object into the model.

The object must be inserted at an appropriate place, so that, if elmlist were to be created afresh, value would show up at index index.

Parameters:
Return type:

None

purge_references(obj, target)

Purge references to the given object from the model.

This method is called while deleting physical objects, in order to get rid of references to that object (and its descendants). Reference purging is done in two steps, which is why this method returns a context manager.

The first step, executed by the __enter__ method, collects references to the target and ensures that deleting them would result in a valid model. If any validity constraints would be violated, an exception is raised to indicate as such, and the whole operation is aborted. This is also when the relevant “capellambse.delete” audit events are fired for each reference.

Once all __enter__ methods have been called, the target object is deleted from the model. Then all __exit__ methods are called, which triggers the actual deletion of all previously discovered references.

As per the context manager protocol, __exit__ will always be called after __enter__, even if the operation is to be aborted. The __exit__ method must therefore inspect whether an exception was passed in or not in order to know whether the operation succeeded.

In order to not confuse other context managers and keep the model consistent, __exit__ must not raise any further exceptions. Exceptions should instead be logged to stderr, for example by using the logging.Logger.exception() facility.

The purge_references method will only be called for Accessor instances that actually contain a reference.

Parameters:
  • obj (ModelObject) – The model object to purge references from.

  • target (ModelObject) – The object that is to be deleted; references to this object will be purged.

Returns:

A context manager that deals with purging references in a transactional manner.

Return type:

contextlib.AbstractContextManager

Raises:
  • InvalidModificationError – Raised by the returned context manager’s __enter__ method if the attempted modification would result in an invalid model. Note that it is generally preferred to allow the operation and take the necessary steps to keep the model consistent, if possible. This can be achieved for example by deleting dependent objects along with the original deletion target.

  • Exception – Any exception may be raised before __enter__ returns in order to abort the transaction and prevent the obj from being deleted. No exceptions must be raised by __exit__.

Examples

A simple implementation for purging a single object reference could look like this:

@contextlib.contextmanager
def purge_references(self, obj, target):
    assert self.__get__(obj, type(obj)) == target
    sys.audit("capellambse.delete", obj, self.__name__, None)

    yield

    try:
        self.__delete__(obj)
    except Exception:
        LOGGER.exception("Could not purge a dangling reference")
role_tag
class capellambse.model.common.accessors.SpecificationAccessor

Bases: Accessor[_Specification]

Provides access to linked specifications.

class capellambse.model.common.accessors.TypecastAccessor

Bases: WritableAccessor[T], PhysicalAccessor[T]

Changes the static type of the value of another accessor.

This is useful for when a class has an attribute that is polymorphic, but the accessor should always return a specific subclass.

At runtime, this Accessor mostly behaves like a simple alias (without performing any runtime type checks or conversions). When creating new objects, it will only allow to create objects of the specified type.

__init__(cls, attr)
Parameters:
Return type:

None

aslist: type[ElementListCouplingMixin] | None
class_: type[T]
create(elmlist, /, *type_hints, **kw)

Create and return a new element of type elmclass.

Parameters:
  • elmlist (ElementListCouplingMixin) – The (coupled) ElementList to insert the new object into.

  • type_hints (str | None) – Hints for finding the correct type of element to create. Can either be a full or shortened xsi:type string, or an abbreviation defined by the specific Accessor instance.

  • kw (Any) – Initialize the properties of the new object. Depending on the object’s type, some attributes may be required.

Return type:

T

delete(elmlist, obj)

Delete the obj from the model.

Parameters:
Return type:

None

insert(elmlist, index, value)

Insert the value object into the model.

The object must be inserted at an appropriate place, so that, if elmlist were to be created afresh, value would show up at index index.

Parameters:
Return type:

None

list_extra_args: Mapping[str, Any]
purge_references(obj, target)

Purge references to the given object from the model.

This method is called while deleting physical objects, in order to get rid of references to that object (and its descendants). Reference purging is done in two steps, which is why this method returns a context manager.

The first step, executed by the __enter__ method, collects references to the target and ensures that deleting them would result in a valid model. If any validity constraints would be violated, an exception is raised to indicate as such, and the whole operation is aborted. This is also when the relevant “capellambse.delete” audit events are fired for each reference.

Once all __enter__ methods have been called, the target object is deleted from the model. Then all __exit__ methods are called, which triggers the actual deletion of all previously discovered references.

As per the context manager protocol, __exit__ will always be called after __enter__, even if the operation is to be aborted. The __exit__ method must therefore inspect whether an exception was passed in or not in order to know whether the operation succeeded.

In order to not confuse other context managers and keep the model consistent, __exit__ must not raise any further exceptions. Exceptions should instead be logged to stderr, for example by using the logging.Logger.exception() facility.

The purge_references method will only be called for Accessor instances that actually contain a reference.

Parameters:
  • obj (ModelObject) – The model object to purge references from.

  • target (ModelObject) – The object that is to be deleted; references to this object will be purged.

Returns:

A context manager that deals with purging references in a transactional manner.

Return type:

contextlib.AbstractContextManager

Raises:
  • InvalidModificationError – Raised by the returned context manager’s __enter__ method if the attempted modification would result in an invalid model. Note that it is generally preferred to allow the operation and take the necessary steps to keep the model consistent, if possible. This can be achieved for example by deleting dependent objects along with the original deletion target.

  • Exception – Any exception may be raised before __enter__ returns in order to abort the transaction and prevent the obj from being deleted. No exceptions must be raised by __exit__.

Examples

A simple implementation for purging a single object reference could look like this:

@contextlib.contextmanager
def purge_references(self, obj, target):
    assert self.__get__(obj, type(obj)) == target
    sys.audit("capellambse.delete", obj, self.__name__, None)

    yield

    try:
        self.__delete__(obj)
    except Exception:
        LOGGER.exception("Could not purge a dangling reference")
xtypes: Set[str]
class capellambse.model.common.accessors.WritableAccessor

Bases: Accessor[T]

An Accessor that also provides write support on lists it returns.

__init__(*args, aslist, single_attr=None, **kw)
Parameters:
Return type:

None

aslist: type[ElementListCouplingMixin] | None
class_: type[T]
create(elmlist, /, *type_hints, **kw)

Create and return a new element of type elmclass.

Parameters:
  • elmlist (ElementListCouplingMixin) – The (coupled) ElementList to insert the new object into.

  • type_hints (str | None) – Hints for finding the correct type of element to create. Can either be a full or shortened xsi:type string, or an abbreviation defined by the specific Accessor instance.

  • kw (Any) – Initialize the properties of the new object. Depending on the object’s type, some attributes may be required.

Return type:

T

create_singleattr(elmlist, arg, /)

Create an element that only has a single attribute of interest.

Parameters:
Return type:

T

delete(elmlist, obj)

Delete the obj from the model.

Parameters:
Return type:

None

insert(elmlist, index, value)

Insert the value object into the model.

The object must be inserted at an appropriate place, so that, if elmlist were to be created afresh, value would show up at index index.

Parameters:
Return type:

None

list_extra_args: Mapping[str, Any]
purge_references(obj, target)

Purge references to the given object from the model.

This method is called while deleting physical objects, in order to get rid of references to that object (and its descendants). Reference purging is done in two steps, which is why this method returns a context manager.

The first step, executed by the __enter__ method, collects references to the target and ensures that deleting them would result in a valid model. If any validity constraints would be violated, an exception is raised to indicate as such, and the whole operation is aborted. This is also when the relevant “capellambse.delete” audit events are fired for each reference.

Once all __enter__ methods have been called, the target object is deleted from the model. Then all __exit__ methods are called, which triggers the actual deletion of all previously discovered references.

As per the context manager protocol, __exit__ will always be called after __enter__, even if the operation is to be aborted. The __exit__ method must therefore inspect whether an exception was passed in or not in order to know whether the operation succeeded.

In order to not confuse other context managers and keep the model consistent, __exit__ must not raise any further exceptions. Exceptions should instead be logged to stderr, for example by using the logging.Logger.exception() facility.

The purge_references method will only be called for Accessor instances that actually contain a reference.

Parameters:
  • obj (ModelObject) – The model object to purge references from.

  • target (ModelObject) – The object that is to be deleted; references to this object will be purged.

Returns:

A context manager that deals with purging references in a transactional manner.

Return type:

contextlib.AbstractContextManager

Raises:
  • InvalidModificationError – Raised by the returned context manager’s __enter__ method if the attempted modification would result in an invalid model. Note that it is generally preferred to allow the operation and take the necessary steps to keep the model consistent, if possible. This can be achieved for example by deleting dependent objects along with the original deletion target.

  • Exception – Any exception may be raised before __enter__ returns in order to abort the transaction and prevent the obj from being deleted. No exceptions must be raised by __exit__.

Examples

A simple implementation for purging a single object reference could look like this:

@contextlib.contextmanager
def purge_references(self, obj, target):
    assert self.__get__(obj, type(obj)) == target
    sys.audit("capellambse.delete", obj, self.__name__, None)

    yield

    try:
        self.__delete__(obj)
    except Exception:
        LOGGER.exception("Could not purge a dangling reference")
single_attr: str | None

capellambse.model.common.element module

class capellambse.model.common.element.CachedElementList

Bases: ElementList[T], Generic[T]

An ElementList that caches the constructed proxies by UUID.

__init__(model, elements, elemclass, *, cacheattr=None, **kw)

Create a CachedElementList.

Parameters:
  • model (MelodyModel) – The model that all elements are a part of.

  • elements (list[_Element]) – The members of this list.

  • elemclass (type[T]) – The GenericElement subclass to use for reconstructing elements.

  • cacheattr (str | None) – The attribute on the model to use as cache.

  • kw (Any)

Return type:

None

class capellambse.model.common.element.ElementList

Bases: MutableSequence, Generic[T]

Provides access to elements without affecting the underlying model.

__init__(model, elements, elemclass=None, *, mapkey=None, mapvalue=None)
Parameters:
Return type:

None

filter(predicate)

Filter this list with a custom predicate.

The predicate may be the name of an attribute or a callable, which will be called on each list item. If the attribute value or the callable’s return value is truthy, the item is included in the resulting list.

When specifying the name of an attribute, nested attributes can be chained using ., like "parent.name" (which would pick all elements whose parent has a non-empty name).

Parameters:

predicate (str | Callable[[T], bool])

Return type:

ElementList[T]

get(key: str) T | None
get(key: str, default: U) T | U
insert(index, value)

S.insert(index, value) – insert value before index

Parameters:
  • index (int)

  • value (T)

Return type:

None

items()
Return type:

ElementListMapItemsView[T]

keys()
Return type:

ElementListMapKeyView

map(attr)

Apply a function to each element in this list.

If the argument is a string, it is interpreted as an attribute name, and the value of that attribute is returned for each element. Nested attribute names can be chained with ..

If the argument is a callable, it is called for each element, and the return value is included in the result. If the callable returns a sequence, the sequence is flattened into the result.

Duplicate values and Nones are always filtered out.

It is an error if a callable returns something that is not a model element or a flat sequence of model elements.

Parameters:

attr (str | _MapFunction[T])

Return type:

ElementList[GenericElement]

values()
Return type:

ElementList[T]

class capellambse.model.common.element.ElementListMapItemsView

Bases: Sequence[Tuple[Any, Any]], Generic[T]

__init__(parent, /)
Return type:

None

class capellambse.model.common.element.ElementListMapKeyView

Bases: Sequence

__init__(parent, /)
Return type:

None

class capellambse.model.common.element.GenericElement

Bases: object

Provides high-level access to a single model element.

__init__(model, parent, xmltag=None, /, **kw)
Parameters:
Return type:

None

applied_property_value_groups

The applied property value groups of this GenericElement.

applied_property_values

The applied property values of this GenericElement.

constraints: Accessor

The constraints of this GenericElement.

description
property diagrams
filtering_criteria

The filtering criteria of this GenericElement.

classmethod from_model(model, element)

Wrap an existing model object.

Parameters:
  • model (MelodyModel) – The MelodyModel instance

  • element (_Element) – The XML element to wrap

Returns:

An instance of GenericElement (or a more appropriate subclass, if any) that wraps the given XML element.

Return type:

GenericElement

name
parent: ParentAccessor

The parent of this GenericElement.

property progress_status: AttributeProperty | str
property_value_groups

The property value groups of this GenericElement.

property_values

The property values of this GenericElement.

pvmt

The pvmt of this GenericElement.

requirements

The requirements of this GenericElement.

summary
traces

The traces of this GenericElement.

uuid
property xtype
class capellambse.model.common.element.MixedElementList

Bases: ElementList[GenericElement]

ElementList that handles proxies using XTYPE_HANDLERS.

__init__(model, elements, elemclass=None, **kw)

Create a MixedElementList.

Parameters:
  • model (MelodyModel) – The model that all elements are a part of.

  • elements (list[_Element]) – The members of this list.

  • elemclass (Any) – Ignored; provided for drop-in compatibility.

  • kw (Any)

Return type:

None

class capellambse.model.common.element.ModelObject

Bases: Protocol

A class that wraps a specific model object.

Most of the time, you’ll want to subclass the concrete GenericElement class. However, some special classes (e.g. AIRD diagrams) provide a compatible interface, but it doesn’t make sense to wrap a specific XML element. This protocol class is used in type annotations to catch both “normal” GenericElement subclasses and the mentioned special cases.

__init__(model, parent, xmltag, /, **kw)

Create a new model object.

Parameters:
  • model (MelodyModel) – The model instance.

  • parent (_Element) – The parent XML element below which to create a new object.

  • kw (Any) – Any additional arguments will be used to populate the instance attributes. Note that some attributes may be required by specific element types at construction time (commonly e.g. uuid).

  • xmltag (str | None)

Return type:

None

classmethod from_model(model, element)

Instantiate a ModelObject from existing model elements.

Parameters:
Return type:

ModelObject

capellambse.model.common.element.attr_equal(attr)
Parameters:

attr (str)

Return type:

Callable[[type[T]], type[T]]

capellambse.model.common.properties module

class capellambse.model.common.properties.AttributeProperty

Bases: object

A property that forwards access to the underlying XML element.

NOT_OPTIONAL = <object object>
__init__(attribute, *, returntype=<class 'str'>, optional=False, default=None, writable=True, __doc__=None)

Create an AttributeProperty.

Parameters:
  • attribute (str) – The attribute on the XML element to handle.

  • returntype (Callable[[str], Any]) – The type to return the result as. Must accept a single str as argument.

  • optional (bool) – If False (default) and the XML attribute does not exist, an AttributeError is raised. Otherwise a default value is returned.

  • default (Any) – A new-style format string to use as fallback value. You can access the object instance as self and the XML element as xml.

  • writable (bool) – Whether to allow modifying the XML attribute.

  • __doc__ (str | None)

Return type:

None

attribute
default
returntype
writable
class capellambse.model.common.properties.BooleanAttributeProperty

Bases: AttributeProperty

An AttributeProperty that works with booleans.

__init__(attribute, *, writable=True, __doc__=None)

Create an AttributeProperty.

Parameters:
  • attribute (str) – The attribute on the XML element to handle.

  • returntype – The type to return the result as. Must accept a single str as argument.

  • optional – If False (default) and the XML attribute does not exist, an AttributeError is raised. Otherwise a default value is returned.

  • default – A new-style format string to use as fallback value. You can access the object instance as self and the XML element as xml.

  • writable (bool) – Whether to allow modifying the XML attribute.

  • __doc__ (str | None)

Return type:

None

attribute
default
returntype
writable
class capellambse.model.common.properties.DatetimeAttributeProperty

Bases: AttributeProperty

An AttributeProperty that stores a datetime.

The value stored in the XML will be formatted as required by Capella. This format is the ISO8601 format with millisecond precision, but no : in the time zone specification.

__init__(attribute, *, optional=True, writable=True, __doc__=None)

Create an AttributeProperty.

Parameters:
  • attribute (str) – The attribute on the XML element to handle.

  • returntype – The type to return the result as. Must accept a single str as argument.

  • optional (bool) – If False (default) and the XML attribute does not exist, an AttributeError is raised. Otherwise a default value is returned.

  • default – A new-style format string to use as fallback value. You can access the object instance as self and the XML element as xml.

  • writable (bool) – Whether to allow modifying the XML attribute.

  • __doc__ (str | None)

Return type:

None

format
re_get = re.compile('(?<=[+-]\\d\\d)(?=\\d\\d$)')
re_set = re.compile('(?<=[+-]\\d\\d):(?=\\d\\d$)')
class capellambse.model.common.properties.EnumAttributeProperty

Bases: AttributeProperty

An AttributeProperty whose values are determined by an Enum.

This works in much the same way as the standard AttributeProperty, except that the returned and consumed values are not simple strings, but members of the Enum that was passed into the constructor.

Usually it is expected that the enum members will be directly assigned to this property. However it is also possible to assign a str instead. In this case, the string will be taken to be an enum member’s name. In both cases, the enum member’s value will be placed in the underlying XML attribute.

If the XML attribute contains a value that does not correspond to any of the Enum’s members, a KeyError will be raised. If the attribute is completely missing from the XML and there was no default= value set during construction, this property will return None.

__init__(attribute, enumcls, *args, default=None, **kw)

Create an EnumAttributeProperty.

Parameters:
  • attribute (str) – The attribute on the XML element to handle.

  • enumcls (type[Enum]) – The enum.Enum subclass to use. The class’ members’ values are used as the possible values for the XML attribute.

  • default (str | Enum | None) – The default value to return if the attribute is not present in the XML. If None, an AttributeError will be raised instead.

  • args (Any)

  • kw (Any)

Return type:

None

enumcls
class capellambse.model.common.properties.HTMLAttributeProperty

Bases: AttributeProperty

An AttributeProperty that gracefully handles HTML-in-XML.

__init__(attribute, *, optional=False, writable=True, __doc__=None)

Create an AttributeProperty.

Parameters:
  • attribute (str) – The attribute on the XML element to handle.

  • returntype – The type to return the result as. Must accept a single str as argument.

  • optional (bool) – If False (default) and the XML attribute does not exist, an AttributeError is raised. Otherwise a default value is returned.

  • default – A new-style format string to use as fallback value. You can access the object instance as self and the XML element as xml.

  • writable (bool) – Whether to allow modifying the XML attribute.

  • __doc__ (str | None)

Return type:

None

attribute
default
returntype
writable
class capellambse.model.common.properties.NumericAttributeProperty

Bases: AttributeProperty

Attribute property that handles (possibly infinite) numeric values.

Positive infinity is stored in Capella XML as *. This class takes care of converting to and from that value when setting or retrieving the value.

Note that there is currently no representation of negative infinity, which is why -inf is rejected with a ValueError.

NaN values are rejected with a ValueError as well.

__init__(attribute, *, optional=False, default=None, allow_float=True, writable=True, __doc__=None)

Create an AttributeProperty.

Parameters:
  • attribute (str) – The attribute on the XML element to handle.

  • returntype – The type to return the result as. Must accept a single str as argument.

  • optional (bool) – If False (default) and the XML attribute does not exist, an AttributeError is raised. Otherwise a default value is returned.

  • default (int | float | None) – A new-style format string to use as fallback value. You can access the object instance as self and the XML element as xml.

  • writable (bool) – Whether to allow modifying the XML attribute.

  • allow_float (bool)

  • __doc__ (str | None)

Return type:

None

attribute
default
returntype
writable