capellambse.extensions.pvmt package

Property Value Management extension for py-capellambse.

class capellambse.extensions.pvmt.ManagedDomain

Bases: ModelElement

A “domain” in the property value management extension.

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

None

enumeration_property_types

The enumeration property types of this ManagedDomain.

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 ModelElement (or a more appropriate subclass, if any) that wraps the given XML element.

Return type:

ModelElement

groups

The groups of this ManagedDomain.

types

The types of this ManagedDomain.

property version
class capellambse.extensions.pvmt.ManagedGroup

Bases: ModelElement

A managed group of property values.

applies_to(obj)

Determine whether this group applies to a model element.

Return type:

bool

Parameters:

obj (ModelObject)

apply(obj)

Apply this group to the model element, and return the applied group.

If the group is not applicable to the passed element, a :class:ScopeError will be raised.

If the group was already applied earlier, that group instance will be returned instead. This makes it safe to always use this method when working with PVMT-managed property value groups.

Return type:

PropertyValueGroup

Parameters:

obj (ModelObject)

description

The description of this ManagedGroup.

find_applicable()

Find all elements in the model that this group applies to.

Return type:

ElementList

property fullname: str
selector

The element selector rules for this group.

class capellambse.extensions.pvmt.ObjectPVMT

Bases: object

Provides access to managed property values on an element.

Managed property values can be accessed in different ways.

  1. The simplest way is to treat the ‘pvmt’ attribute like a dictionary, and assign and retrieve property values directly with subscripting syntax. To do this, provide the “path” to the property value as ‘domain.group.property’, like this:

    >>> obj = model.by_uuid("08e02248-504d-4ed8-a295-c7682a614f66")
    >>> obj.pvmt["DarkMagic.Power.Max"]
    1600
    >>> obj.pvmt["DarkMagic.Power.Max"] = 2000
    >>> obj.pvmt["DarkMagic.Power.Max"]
    2000
    
  2. It’s also possible to retrieve a managed group with the same syntax, by omitting the ‘property’ part of the path. The resulting object can be used like a dictionary to access the property values.

    >>> power = obj.pvmt["DarkMagic.Power"]
    >>> power["Max"]
    2000
    
__init__(*_a, **_k)
Parameters:
Return type:

None

property applied_groups: ElementList[PropertyValueGroup]
classmethod from_model(model, element)

Wrap a model element for accessing its applied PVMT.

Return type:

Self

Parameters:
property groupdefs: ElementList[ManagedGroup]
owner

The owner of this ObjectPVMT.

class capellambse.extensions.pvmt.PVMTConfiguration

Bases: ModelElement

Provides access to the model-wide PVMT configuration.

__init__(*_args, **_kw)
Return type:

None

domains

The domains of this PVMTConfiguration.

class capellambse.extensions.pvmt.PVMTDescriptionProperty

Bases: BasePOD[SelectorRules]

__init__(attribute)
Parameters:

attribute (str)

Return type:

None

attribute
default
writable
exception capellambse.extensions.pvmt.ScopeError

Bases: InvalidModificationError

Raised when trying to apply a PVMT group to an out-of-scope element.

property group: ManagedGroup
property obj: ModelObject
class capellambse.extensions.pvmt.SelectorRules

Bases: object

SelectorRules(raw: ‘str’)

__init__(raw)
Parameters:

raw (str)

Return type:

None

property classes: tuple[type[ModelObject], ...]
property layers: tuple[type[ComponentArchitecture], ...]
property properties: tuple[tuple[str, str, str], ...]
raw: str