capellambse.extensions.reqif package¶
Tools for handling ReqIF Requirements.
- class capellambse.extensions.reqif.AbstractRequirementsAttribute¶
Bases:
GenericElement
- definition¶
The definition of this AbstractRequirementsAttribute.
- value: c.AttributeProperty | c.AttrProxyAccessor¶
- class capellambse.extensions.reqif.AbstractRequirementsRelation¶
Bases:
ReqIFElement
- source¶
The source of this AbstractRequirementsRelation.
- target¶
The target of this AbstractRequirementsRelation.
- type: c.Accessor¶
The type of this AbstractRequirementsRelation.
- class capellambse.extensions.reqif.AbstractType¶
Bases:
ReqIFElement
- attribute_definitions¶
The attribute definitions of this AbstractType.
- owner¶
The owner of this AbstractType.
- class capellambse.extensions.reqif.AttributeAccessor¶
Bases:
DirectProxyAccessor
[AbstractRequirementsAttribute
]- __init__()¶
Create a DirectProxyAccessor.
- Parameters:
class – The proxy class.
xtypes – 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 – 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()
.
- Return type:
None
- class capellambse.extensions.reqif.AttributeDefinition¶
Bases:
ReqIFElement
An attribute definition for requirement types.
- data_type¶
The data type of this AttributeDefinition.
- class capellambse.extensions.reqif.AttributeDefinitionEnumeration¶
Bases:
ReqIFElement
An enumeration attribute definition for requirement types.
- data_type¶
The data type of this AttributeDefinitionEnumeration.
- multi_valued¶
Boolean flag for setting multiple enumeration values on the attribute
- class capellambse.extensions.reqif.BooleanValueAttribute¶
Bases:
AbstractRequirementsAttribute
A string value attribute.
- value: c.AttributeProperty | c.AttrProxyAccessor¶
- class capellambse.extensions.reqif.CapellaIncomingRelation¶
Bases:
AbstractRequirementsRelation
A Relation between a requirement and an object.
- class capellambse.extensions.reqif.CapellaModule¶
Bases:
ReqIFElement
A ReqIF Module that bundles multiple Requirement folders.
- attributes¶
The attributes of this CapellaModule.
- folders¶
The folders of this CapellaModule.
- requirement_types_folders¶
The requirement types folders of this CapellaModule.
- requirements¶
The requirements of this CapellaModule.
- to_reqif(to, *, metadata=None, pretty=False, compress=None)¶
Export this module as ReqIF XML.
You can override some auto-generated metadata placed in the header section by passing a dictionary as
metadata
. The following keys are supported. Unsupported keys are silently ignored.creation_time
: Adatetime.datetime
object that specifies this document’s creation time. Default to the current time.comment
: Override the ReqIF file’s comment. Defaults to a text derived from the model and module names.title
: Specify the document title. Defaults to the module’slong_name
.
- Parameters:
to (str | PathLike | IO[bytes]) – Where to export to. Can be the name of a file, or a file-like object opened in binary mode.
metadata (Mapping[str, Any] | None) – A dictionary with additional metadata (see above).
pretty (bool) – Format the XML human-readable.
compress (bool | None) – Write compressed data (
*.reqifz
). Defaults toTrue
iftarget
is a string or path-like and its name ends in.reqifz
, otherwise defaults toFalse
.
- Return type:
None
- type: c.Accessor¶
The type of this CapellaModule.
- class capellambse.extensions.reqif.CapellaOutgoingRelation¶
Bases:
AbstractRequirementsRelation
A Relation between an object and a requirement.
- source¶
The source of this CapellaOutgoingRelation.
- target¶
The target of this CapellaOutgoingRelation.
- class capellambse.extensions.reqif.CapellaTypesFolder¶
Bases:
ReqIFElement
- data_type_definitions¶
The data type definitions of this CapellaTypesFolder.
- module_types¶
The module types of this CapellaTypesFolder.
- relation_types¶
The relation types of this CapellaTypesFolder.
- requirement_types¶
The requirement types of this CapellaTypesFolder.
- class capellambse.extensions.reqif.DataTypeDefinition¶
Bases:
ReqIFElement
A data type definition for requirement types.
- class capellambse.extensions.reqif.DateValueAttribute¶
Bases:
AbstractRequirementsAttribute
A value attribute that stores a date and time.
- value: c.AttributeProperty | c.AttrProxyAccessor¶
- class capellambse.extensions.reqif.ElementRelationAccessor¶
Bases:
WritableAccessor
[rq.AbstractRequirementsRelation
]Provides access to RequirementsRelations of a GenericElement.
- __init__()¶
- Return type:
None
- aslist: type[ElementListCouplingMixin] | None¶
- purge_references(obj, target)¶
Do nothing.
This is a no-op, as this accessor provides a virtual relation.
The relation objects it handles are cleaned up by removing the source or target attribute.
- Parameters:
obj (ModelObject)
target (ModelObject)
- Return type:
Generator[None, None, None]
- class capellambse.extensions.reqif.EnumValue¶
Bases:
ReqIFElement
An enumeration value for
EnumerationDataTypeDefinition
.
- class capellambse.extensions.reqif.EnumerationDataTypeDefinition¶
Bases:
ReqIFElement
An enumeration data type definition for requirement types.
- values¶
The values of this EnumerationDataTypeDefinition.
- class capellambse.extensions.reqif.EnumerationValueAttribute¶
Bases:
AbstractRequirementsAttribute
An enumeration attribute.
- definition¶
The definition of this EnumerationValueAttribute.
- property value¶
- values¶
The values of this EnumerationValueAttribute.
- class capellambse.extensions.reqif.Folder¶
Bases:
Requirement
A folder that stores Requirements.
- folders: c.Accessor¶
The folders of this Folder.
- requirements¶
The requirements of this Folder.
- class capellambse.extensions.reqif.IntegerValueAttribute¶
Bases:
AbstractRequirementsAttribute
An integer value attribute.
- value: c.AttributeProperty | c.AttrProxyAccessor¶
- class capellambse.extensions.reqif.InternalRelation¶
Bases:
AbstractRequirementsRelation
A Relation between two requirements.
- class capellambse.extensions.reqif.ModuleType¶
Bases:
AbstractType
A requirement-module type.
- class capellambse.extensions.reqif.RealValueAttribute¶
Bases:
AbstractRequirementsAttribute
A floating-point number value attribute.
- value: c.AttributeProperty | c.AttrProxyAccessor¶
- class capellambse.extensions.reqif.RelationType¶
Bases:
AbstractType
A requirement-relation type.
- class capellambse.extensions.reqif.RelationsList¶
Bases:
ElementList
[rq.AbstractRequirementsRelation]- __init__(model, elements, elemclass=None, *, source)¶
- Parameters:
model (MelodyModel)
source (ModelObject)
- Return type:
None
- by_relation_class(class_)¶
- Parameters:
class_ (Literal['incoming', 'outgoing', 'internal'])
- Return type:
- class capellambse.extensions.reqif.ReqIFElement¶
Bases:
GenericElement
Attributes shared by all ReqIF elements.
- identifier¶
- long_name¶
- name¶
- prefix¶
- property type¶
- class capellambse.extensions.reqif.Requirement¶
Bases:
ReqIFElement
A ReqIF Requirement.
- attributes¶
The attributes of this Requirement.
- chapter_name¶
- foreign_id¶
- owner¶
The owner of this Requirement.
The related of this Requirement.
- relations: c.Accessor[AbstractRequirementsRelation]¶
The relations of this Requirement.
- text¶
- type: c.Accessor¶
The type of this Requirement.
- class capellambse.extensions.reqif.RequirementType¶
Bases:
AbstractType
A requirement type.
- class capellambse.extensions.reqif.RequirementsRelationAccessor¶
Bases:
WritableAccessor
[rq.AbstractRequirementsRelation
]Searches for requirement relations in the architecture layer.
- __init__(*args, **kw)¶
- Return type:
None
- aslist: type[ElementListCouplingMixin] | None¶
- 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:
- delete(elmlist, obj)¶
Delete the
obj
from the model.- 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 indexindex
.- Parameters:
elmlist (ElementListCouplingMixin)
index (int)
value (ModelObject | _NewObject)
- Return type:
None
- purge_references(obj, target)¶
Do nothing.
This is a no-op, as this accessor provides a virtual relation.
The relation objects it handles are cleaned up by removing the source or target attribute.
- Parameters:
obj (ModelObject)
target (ModelObject)
- Return type:
Generator[None, None, None]
- class capellambse.extensions.reqif.StringValueAttribute¶
Bases:
AbstractRequirementsAttribute
A string value attribute.
- value: c.AttributeProperty | c.AttrProxyAccessor¶
- capellambse.extensions.reqif.init()¶
- Return type:
None
Submodules¶
capellambse.extensions.reqif.exporter module¶
Implementation of a ReqIF 1.1 and 1.2 exporter.