capella2polarion.data_model package

A module for custom data models of cappela2polarion.

Submodules

capella2polarion.data_model.document_data module

Module providing data classes for documents.

class capella2polarion.data_model.document_data.DocumentData(document: Document, headings: list[WorkItem], text_work_item_provider: TextWorkItemProvider)

Bases: object

A class to store data related to a rendered document.

document: Document
headings: list[WorkItem]
text_work_item_provider: TextWorkItemProvider
class capella2polarion.data_model.document_data.DocumentInfo(project_id: str | None, module_folder: str, module_name: str, text_work_item_type: str, text_work_item_id_field: str)

Bases: object

Class for information regarding a document which should be created.

module_folder: str
module_name: str
project_id: str | None
text_work_item_id_field: str
text_work_item_type: str

capella2polarion.data_model.work_item_attachments module

Module providing the CapellaWorkItemAttachment classes.

class capella2polarion.data_model.work_item_attachments.Capella2PolarionAttachment(work_item_id: str, id: str, title: str | None = None, content_bytes: bytes | None = None, mime_type: str | None = None, file_name: str | None = None, _checksum: str | None = None)

Bases: WorkItemAttachment

Stub Base-Class for Capella2Polarion attachments.

property content_checksum: str

Calculate the checksum for the content of the attachment.

class capella2polarion.data_model.work_item_attachments.CapellaContextDiagramAttachment(diagram: ContextDiagram, file_name: str, render_params: dict[str, Any] | None, title: str)

Bases: CapellaDiagramAttachment

A dedicated attachment type for Capella context diagrams.

Implements a checksum property using the elk input instead of content. This will speed up the checksum calculation a lot.

property content_checksum: str

Return checksum based on elk input for ContextDiagrams else None.

class capella2polarion.data_model.work_item_attachments.CapellaDiagramAttachment(diagram: AbstractDiagram, file_name: str, render_params: dict[str, Any] | None, title: str)

Bases: Capella2PolarionAttachment

A class for lazy loading content_bytes for diagram attachments.

property content_bytes: bytes | None

Diagrams are only rendered, if content_bytes are requested.

class capella2polarion.data_model.work_item_attachments.PngConvertedSvgAttachment(attachment: WorkItemAttachment)

Bases: Capella2PolarionAttachment

A special attachment type for PNGs which shall be created from SVGs.

An SVG attachment must be provided to create this attachment. The actual conversion of SVG to PNG takes place when content bytes are requested. For that reason creating this attachment does not trigger diagram rendering as long as context_bytes aren’t requested.

property content_bytes: bytes | None

The content bytes are created from the SVG when requested.

capella2polarion.data_model.work_item_attachments.calculate_content_checksum(attachment: WorkItemAttachment) str

Calculate content checksum for an attachment.

capella2polarion.data_model.work_items module

Module providing the CapellaWorkItem class.

class capella2polarion.data_model.work_items.CapellaWorkItem(id: str | None = None, *, title: str | None = None, description_type: str | None = None, description: TextContent | str | None = None, type: str | None = None, status: str | None = None, additional_attributes: dict[str, Any] | None = None, linked_work_items: list[WorkItemLink] | None = None, attachments: list[WorkItemAttachment] | None = None, linked_work_items_truncated: bool = False, attachments_truncated: bool = False, home_document: DocumentReference | None = None, **kwargs)

Bases: WorkItem

A WorkItem class with additional Capella related attributes.

property attachment_checksums: dict[str, str]

Return attachment checksums.

calculate_checksum() str

Calculate and return a checksum for this WorkItem.

In addition, the checksum will be written to self._checksum. Filenames must be unique and same filenames are only valid for png&svg pairs.

checksum: str | None
clear_attributes()

Clear all additional attributes except the checksum.

property content_checksum: str

Return checksum of the WorkItem content.

postCondition: polarion_api.HtmlContent | None
preCondition: polarion_api.HtmlContent | None
uuid_capella: str