capellambse package¶
The capellambse package.
- capellambse.load_model_extensions()
Load all model extensions.
This function loads all entry points in the group
capellambse.model_extensionsand executes them.It is automatically called when loading a model. Calling it more than once has no effect, so it is safe (although not necessary) to explicitly call this function before loading a model.
- Return type:
Subpackages¶
- capellambse.aird package
- capellambse.diagram package
- capellambse.extensions package
- Subpackages
- capellambse.extensions.metrics package
- capellambse.extensions.pvmt package
- capellambse.extensions.reqif package
AbstractRelationAbstractTypeAttributeAttributeDefinitionAttributeDefinitionEnumerationAttributeOwnerBooleanValueAttributeCapellaIncomingRelationCapellaModuleCapellaOutgoingRelationCapellaRelationCapellaTypesFolderDataTypeDefinitionDateValueAttributeElementRelationAccessorEnumValueEnumerationDataTypeDefinitionEnumerationValueAttributeFolderIdentifiableElementIntegerValueAttributeInternalRelationModuleModuleTypeRealValueAttributeRelationTypeRelationsListReqIFElementRequirementRequirementTypeRequirementsRelationAccessorSharedDirectAttributesStringValueAttributeTypesFolder- Submodules
- capellambse.extensions.reqif.capellarequirements module
- capellambse.extensions.reqif.exporter module
- capellambse.extensions.reqif.requirements module
- capellambse.extensions.validation package
- Submodules
- capellambse.extensions.filtering module
AbstractFilteringResultAssociatedFilteringCriterionSetComposedFilteringResultCreationDefaultFilteringCriterionSetExclusionFilteringResultSetFilteringCriterionFilteringCriterionPkgFilteringCriterionSetFilteringModelFilteringResultFilteringResultPkgFilteringResultSetFilteringResultsIntersectionFilteringResultSetUnionFilteringResultSetinit()
- Subpackages
- capellambse.filehandler package
FileHandlerTransactionClosedErrorget_filehandler()- Submodules
- capellambse.filehandler.abc module
- capellambse.filehandler.git module
GitFileHandlerGitFileHandler.__init__()GitFileHandler.cache_dirGitFileHandler.get_model_info()GitFileHandler.identity_fileGitFileHandler.iterdir()GitFileHandler.known_hosts_fileGitFileHandler.open()GitFileHandler.passwordGitFileHandler.rootdirGitFileHandler.shallowGitFileHandler.usernameGitFileHandler.write_transaction()
GitHandlerInfoGitPath
- capellambse.filehandler.git_credhelper module
- capellambse.filehandler.gitlab_artifacts module
- capellambse.filehandler.http module
- capellambse.filehandler.local module
- capellambse.filehandler.memory module
- capellambse.filehandler.zip module
- capellambse.loader package
- Submodules
- capellambse.loader.core module
CorruptModelErrorFragmentTypeMelodyLoaderMelodyLoader.__init__()MelodyLoader.activate_viewpoint()MelodyLoader.check_duplicate_uuids()MelodyLoader.create_link()MelodyLoader.filehandlerMelodyLoader.find_fragment()MelodyLoader.find_root()MelodyLoader.follow_link()MelodyLoader.follow_links()MelodyLoader.generate_uuid()MelodyLoader.get_model_info()MelodyLoader.idcache_index()MelodyLoader.idcache_rebuild()MelodyLoader.idcache_remove()MelodyLoader.iterall()MelodyLoader.iterall_xt()MelodyLoader.iterancestors()MelodyLoader.iterchildren()MelodyLoader.iterchildren_xt()MelodyLoader.iterdescendants()MelodyLoader.iterdescendants_xt()MelodyLoader.new_uuid()MelodyLoader.referenced_viewpoints()MelodyLoader.save()MelodyLoader.update_namespaces()MelodyLoader.write_tmp_project_dir()MelodyLoader.xpath()MelodyLoader.xpath2()
ModelFileModelFile.__init__()ModelFile.add_namespace()ModelFile.enumerate_uuids()ModelFile.fragment_typeModelFile.idcache_index()ModelFile.idcache_rebuild()ModelFile.idcache_remove()ModelFile.idcache_reserve()ModelFile.iter_qtype()ModelFile.iter_qtypes()ModelFile.iterall()ModelFile.iterall_xt()ModelFile.unfollow_href()ModelFile.update_namespaces()ModelFile.write_xml()
- capellambse.loader.exs module
- capellambse.loader.modelinfo module
- capellambse.metamodel package
- Subpackages
- capellambse.metamodel.information package
AbstractCollectionValueAbstractEventOperationAbstractInstanceAggregationKindAssociationAssociationPkgClassCollectionCollectionKindCollectionValueCollectionValueReferenceDataPkgDomainElementElementKindExchangeItemExchangeItemElementExchangeItemInstanceExchangeItemRealizationExchangeMechanismInformationRealizationKeyPartMultiplicityElementOperationOperationAllocationParameterParameterDirectionPassingModePortPortAllocationPortRealizationPropertyServiceSynchronismKindUnionUnionKindUnionPropertyUnit- Submodules
- capellambse.metamodel.information.communication module
- capellambse.metamodel.information.datatype module
- capellambse.metamodel.information.datavalue module
- capellambse.metamodel.pa package
- capellambse.metamodel.information package
- Submodules
- capellambse.metamodel.activity module
AbstractActionAbstractActivityAcceptEventActionActivityEdgeActivityExchangeActivityGroupActivityNodeActivityPartitionCallActionCallBehaviorActionControlFlowExceptionHandlerExecutableNodeInputPinInterruptibleActivityRegionInvocationActionObjectFlowObjectNodeObjectNodeKindObjectNodeOrderingKindOutputPinPinSendSignalActionStructuredActivityNodeValuePin
- capellambse.metamodel.behavior module
- capellambse.metamodel.capellacommon module
AbstractCapabilityPkgAbstractStateAbstractStateRealizationCapabilityRealizationInvolvedElementCapabilityRealizationInvolvementChangeEventChangeEventKindChoicePseudoStateDeepHistoryPseudoStateEntryPointPseudoStateExitPointPseudoStateFinalStateForkPseudoStateGenericTraceInitialPseudoStateJoinPseudoStateJustificationLinkModePseudostateRegionShallowHistoryPseudoStateStateStateEventStateEventRealizationStateMachineStateTransitionStateTransition.destinationStateTransition.effectStateTransition.effectsStateTransition.guardStateTransition.kindStateTransition.realized_transitionsStateTransition.sourceStateTransition.state_transition_realizationsStateTransition.targetStateTransition.trigger_descriptionStateTransition.triggers
StateTransitionRealizationTerminatePseudoStateTimeEventTimeEventKindTransfoLinkTransitionKind
- capellambse.metamodel.capellacore module
AbstractAnnotationAbstractDependenciesPkgAbstractExchangeItemPkgAbstractModellingStructureAbstractPropertyValueAllocationBooleanPropertyValueCapellaElementCapellaElement.applied_property_value_groupsCapellaElement.applied_property_valuesCapellaElement.descriptionCapellaElement.enumeration_property_typesCapellaElement.featuresCapellaElement.property_value_groupsCapellaElement.property_valuesCapellaElement.reviewCapellaElement.statusCapellaElement.summary
ClassifierConstraintEnumerationPropertyLiteralEnumerationPropertyTypeEnumerationPropertyValueFeatureFloatPropertyValueGeneralClassGeneralizableElementGeneralizationIntegerPropertyValueInvolvedElementInvolvementInvolverElementKeyValueModellingArchitectureModellingArchitecturePkgModellingBlockNamedElementNamedRelationshipNamespaceNamingRulePropertyValueGroupPropertyValuePkgRelationshipReuseLinkReuseableStructureReuserStructureStringPropertyValueStructureTraceTypeTypedElementVisibilityKind
- capellambse.metamodel.capellamodeller module
- capellambse.metamodel.cs module
AbstractDeploymentLinkAbstractPathInvolvedElementAbstractPhysicalArtifactAbstractPhysicalLinkEndAbstractPhysicalPathLinkArchitectureAllocationBlockBlockArchitectureBlockArchitecture.all_capabilitiesBlockArchitecture.all_classesBlockArchitecture.all_collectionsBlockArchitecture.all_complex_valuesBlockArchitecture.all_enumerationsBlockArchitecture.all_interfacesBlockArchitecture.all_unionsBlockArchitecture.capability_packageBlockArchitecture.capability_pkgBlockArchitecture.data_packageBlockArchitecture.data_pkgBlockArchitecture.interface_packageBlockArchitecture.interface_pkg
BlockArchitecturePkgComponentComponent.__init__()Component.component_realizationsComponent.exchangesComponent.implemented_interfacesComponent.interface_implementationsComponent.interface_usesComponent.is_actorComponent.is_humanComponent.owned_partsComponent.ownerComponent.partsComponent.physical_link_categoriesComponent.physical_linksComponent.physical_pathsComponent.physical_portsComponent.portsComponent.realized_componentsComponent.realizing_componentsComponent.related_exchangesComponent.representing_partsComponent.used_interfaces
ComponentArchitectureComponentPkgComponentPkg.allocated_functionsComponentPkg.component_exchange_realizationsComponentPkg.exchange_categoriesComponentPkg.exchangesComponentPkg.functional_allocationsComponentPkg.functional_linksComponentPkg.owned_partsComponentPkg.partsComponentPkg.physical_link_categoriesComponentPkg.physical_linksComponentPkg.realized_component_exchangesComponentPkg.state_machines
ComponentRealizationDeployableElementDeploymentTargetExchangeItemAllocationInterfaceInterfaceAllocationInterfaceAllocatorInterfaceImplementationInterfacePkgInterfaceUsePartPhysicalLinkPhysicalLink.allocated_functional_exchangesPhysicalLink.endsPhysicalLink.exchangesPhysicalLink.functional_exchange_allocationsPhysicalLink.links()PhysicalLink.ownerPhysicalLink.physical_link_endsPhysicalLink.physical_link_realizationsPhysicalLink.physical_pathsPhysicalLink.realized_physical_linksPhysicalLink.sourcePhysicalLink.target
PhysicalLinkCategoryPhysicalLinkEndPhysicalLinkRealizationPhysicalPathPhysicalPathInvolvementPhysicalPathRealizationPhysicalPathReferencePhysicalPortPhysicalPortRealizationProvidedInterfaceLinkRequiredInterfaceLink
- capellambse.metamodel.epbs module
- capellambse.metamodel.fa module
AbstractFunctionAbstractFunction.available_in_statesAbstractFunction.conditionAbstractFunction.exchangesAbstractFunction.function_realizationsAbstractFunction.functionsAbstractFunction.is_leafAbstractFunction.kindAbstractFunction.realized_functionsAbstractFunction.realizing_functionsAbstractFunction.related_exchangesAbstractFunction.scenarios
AbstractFunctionAllocationAbstractFunctionalArchitectureAbstractFunctionalArchitecture.all_function_exchangesAbstractFunctionalArchitecture.all_functional_chainsAbstractFunctionalArchitecture.all_functionsAbstractFunctionalArchitecture.component_exchange_categoriesAbstractFunctionalArchitecture.component_exchange_realizationsAbstractFunctionalArchitecture.component_exchangesAbstractFunctionalArchitecture.function_packageAbstractFunctionalArchitecture.function_pkgAbstractFunctionalArchitecture.functional_allocationsAbstractFunctionalArchitecture.functional_links
AbstractFunctionalBlockAbstractFunctionalChainContainerComponentExchangeComponentExchange.allocated_exchange_itemsComponentExchange.allocated_functional_exchangesComponentExchange.allocating_physical_linkComponentExchange.allocating_physical_linksComponentExchange.allocating_physical_pathsComponentExchange.categoriesComponentExchange.component_exchange_realizationsComponentExchange.endsComponentExchange.exchange_itemsComponentExchange.functional_exchange_allocationsComponentExchange.is_orientedComponentExchange.kindComponentExchange.ownerComponentExchange.realized_component_exchangesComponentExchange.realizing_component_exchanges
ComponentExchangeAllocationComponentExchangeAllocatorComponentExchangeCategoryComponentExchangeEndComponentExchangeFunctionalExchangeAllocationComponentExchangeKindComponentExchangeRealizationComponentFunctionalAllocationComponentPortComponentPortAllocationComponentPortAllocationEndComponentPortKindControlNodeControlNodeKindExchangeCategoryExchangeContainmentExchangeLinkExchangeSpecificationExchangeSpecificationRealizationFunctionInputPortFunctionKindFunctionOutputPortFunctionPkgFunctionPortFunctionRealizationFunctionSpecificationFunctionalChainFunctionalChain.available_in_statesFunctionalChain.control_nodesFunctionalChain.functional_chain_realizationsFunctionalChain.involvedFunctionalChain.involved_chainsFunctionalChain.involved_functionsFunctionalChain.involved_linksFunctionalChain.involvementsFunctionalChain.involving_chainsFunctionalChain.kindFunctionalChain.postconditionFunctionalChain.preconditionFunctionalChain.realized_chainsFunctionalChain.realizing_chainsFunctionalChain.sequence_linksFunctionalChain.sequence_nodes
FunctionalChainInvolvementFunctionalChainInvolvementFunctionFunctionalChainInvolvementLinkFunctionalChainKindFunctionalChainRealizationFunctionalChainReferenceFunctionalExchangeFunctionalExchange.allocating_component_exchangeFunctionalExchange.categoriesFunctionalExchange.exchange_itemsFunctionalExchange.exchange_specificationsFunctionalExchange.exchanged_itemsFunctionalExchange.functional_exchange_realizationsFunctionalExchange.involving_functional_chainsFunctionalExchange.ownerFunctionalExchange.realized_functional_exchangesFunctionalExchange.realizing_functional_exchanges
FunctionalExchangeRealizationFunctionalExchangeSpecificationOrientationPortKindReferenceHierarchyContextSequenceLinkSequenceLinkEnd
- capellambse.metamodel.interaction module
AbstractCapabilityAbstractCapability.available_in_statesAbstractCapability.capability_realizationsAbstractCapability.chain_involvementsAbstractCapability.extended_byAbstractCapability.extendsAbstractCapability.extension_pointsAbstractCapability.function_involvementsAbstractCapability.generalizationsAbstractCapability.generalized_byAbstractCapability.generalizesAbstractCapability.included_byAbstractCapability.includesAbstractCapability.involved_chainsAbstractCapability.involved_functionsAbstractCapability.postconditionAbstractCapability.preconditionAbstractCapability.realized_capabilitiesAbstractCapability.realizing_capabilitiesAbstractCapability.scenariosAbstractCapability.states
AbstractCapabilityExtendAbstractCapabilityExtensionPointAbstractCapabilityGeneralizationAbstractCapabilityIncludeAbstractCapabilityRealizationAbstractEndAbstractFragmentAbstractFunctionAbstractCapabilityInvolvementArmTimerEventCancelTimerEventCombinedFragmentConstraintDurationCreationEventDestructionEventEventEventReceiptOperationEventSentOperationExecutionExecutionEndExecutionEventFragmentEndFunctionalChainAbstractCapabilityInvolvementGateInstanceRoleInteractionFragmentInteractionOperandInteractionOperatorKindInteractionOperatorKind.ALTInteractionOperatorKind.ASSERTInteractionOperatorKind.CONSIDERInteractionOperatorKind.CRITICALInteractionOperatorKind.IGNOREInteractionOperatorKind.LOOPInteractionOperatorKind.NEGInteractionOperatorKind.OPTInteractionOperatorKind.PARInteractionOperatorKind.SEQInteractionOperatorKind.STRICTInteractionOperatorKind.UNSET
InteractionStateInteractionUseMergeLinkMessageEndMessageKindRefinementLinkScenarioScenario.constraint_durationsScenario.eventsScenario.formal_gatesScenario.fragmentsScenario.instance_rolesScenario.is_mergedScenario.kindScenario.messagesScenario.postconditionScenario.preconditionScenario.realized_scenariosScenario.realizing_scenariosScenario.related_functionsScenario.scenario_realizationsScenario.time_lapses
ScenarioKindScenarioRealizationSequenceMessageSequenceMessageValuationStateFragmentTimeLapse
- capellambse.metamodel.la module
CapabilityRealizationCapabilityRealizationPkgContextInterfaceRealizationLogicalArchitectureLogicalArchitecture.actor_exchangesLogicalArchitecture.all_actor_exchangesLogicalArchitecture.all_actorsLogicalArchitecture.all_component_exchangesLogicalArchitecture.all_componentsLogicalArchitecture.component_exchangesLogicalArchitecture.component_packageLogicalArchitecture.component_pkgLogicalArchitecture.diagramsLogicalArchitecture.realized_system_analysisLogicalArchitecture.root_componentLogicalArchitecture.root_functionLogicalArchitecture.system_analysis_realizations
LogicalArchitecturePkgLogicalComponentLogicalComponentPkgLogicalFunctionLogicalFunctionPkgSystemAnalysisRealization
- capellambse.metamodel.libraries module
- capellambse.metamodel.modellingcore module
AbstractConstraintAbstractExchangeItemAbstractInformationFlowAbstractNamedElementAbstractParameterAbstractParameterSetAbstractRelationshipAbstractTraceAbstractTypeAbstractTypedElementFinalizableElementIStateInformationsExchangerParameterEffectKindPublishableElementRateKindTraceableElementValueSpecification
- capellambse.metamodel.modeltypes module
- capellambse.metamodel.namespaces module
- capellambse.metamodel.oa module
AbstractConceptItemActivityAllocationCapabilityConfigurationCommunicationMeanCommunityOfInterestCommunityOfInterestCompositionConceptConceptComplianceConceptPkgEntityEntityOperationalCapabilityInvolvementEntityPkgItemInConceptLocationOperationalActivityOperationalActivityPkgOperationalAnalysisOperationalAnalysis.activity_packageOperationalAnalysis.activity_pkgOperationalAnalysis.all_activitiesOperationalAnalysis.all_activity_exchangesOperationalAnalysis.all_actorsOperationalAnalysis.all_entitiesOperationalAnalysis.all_entity_exchangesOperationalAnalysis.all_operational_processesOperationalAnalysis.all_processesOperationalAnalysis.capability_packageOperationalAnalysis.concept_pkgOperationalAnalysis.diagramsOperationalAnalysis.entity_packageOperationalAnalysis.entity_pkgOperationalAnalysis.role_pkgOperationalAnalysis.root_activityOperationalAnalysis.root_entity
OperationalCapabilityOperationalCapabilityPkgOperationalProcessOperationalScenarioOrganisationalUnitOrganisationalUnitCompositionRoleRoleAllocationRoleAssemblyUsageRolePkgSwimlane
- capellambse.metamodel.re module
CatalogElementCatalogElement.authorCatalogElement.current_compliancyCatalogElement.default_replica_compliancyCatalogElement.environmentCatalogElement.is_read_onlyCatalogElement.kindCatalogElement.linksCatalogElement.originCatalogElement.purposeCatalogElement.suffixCatalogElement.tagsCatalogElement.version
CatalogElementKindCatalogElementLinkCatalogElementPkgCompliancyDefinitionCompliancyDefinitionPkgGroupingElementPkgReAbstractElementReDescriptionElementReElementContainerReNamedElementRecCatalog
- capellambse.metamodel.sa module
CapabilityCapabilityExploitationCapabilityInvolvementCapabilityPkgMissionMissionInvolvementMissionPkgOperationalAnalysisRealizationSystemAnalysisSystemAnalysis.actor_exchangesSystemAnalysis.all_actor_exchangesSystemAnalysis.all_actorsSystemAnalysis.all_capability_exploitationsSystemAnalysis.all_component_exchangesSystemAnalysis.all_componentsSystemAnalysis.all_missionsSystemAnalysis.component_packageSystemAnalysis.component_pkgSystemAnalysis.diagramsSystemAnalysis.mission_packageSystemAnalysis.mission_pkgSystemAnalysis.operational_analysis_realizationsSystemAnalysis.realized_operational_analysisSystemAnalysis.root_componentSystemAnalysis.root_function
SystemCommunicationSystemCommunicationHookSystemComponentSystemComponentPkgSystemFunctionSystemFunctionPkg
- capellambse.metamodel.sharedmodel module
- Subpackages
- capellambse.model package
AccessorAliasAllocationAlternateAccessorAssociationAttributeMatcherAccessorBackrefBasePODBoolPODBrokenModelErrorCachedElementListContainmentDatetimePODDeepProxyAccessorDeprecatedAccessorDirectProxyAccessorEElementListElementListCouplingMixinElementListMapItemsViewElementListMapKeyViewEnumPODFilterFloatPODHTMLStringPODIndexAccessorIntPODInvalidModificationErrorMelodyModelMelodyModel.__init__()MelodyModel.activate_viewpoint()MelodyModel.by_uuid()MelodyModel.description_badgeMelodyModel.diagram_cacheMelodyModel.diagramsMelodyModel.enumeration_property_types()MelodyModel.epbsMelodyModel.find_references()MelodyModel.infoMelodyModel.laMelodyModel.nameMelodyModel.oaMelodyModel.paMelodyModel.projectMelodyModel.property_value_packages()MelodyModel.qualify_classname()MelodyModel.referenced_viewpoints()MelodyModel.resolve_class()MelodyModel.resourcesMelodyModel.saMelodyModel.save()MelodyModel.search()MelodyModel.update_diagram_cache()MelodyModel.uuid
MissingClassErrorMissingValueErrorMixedElementListModelElementModelElement.__init__()ModelElement._get_icon()ModelElement._get_styleclass()ModelElement.constraintsModelElement.descriptionModelElement.diagramsModelElement.extensionsModelElement.from_model()ModelElement.layerModelElement.migrated_elementsModelElement.nameModelElement.parentModelElement.progress_statusModelElement.sidModelElement.summaryModelElement.uuidModelElement.visible_on_diagramsModelElement.xtype
ModelInfoModelObjectMultiStringPODNamespaceNewObjectNonUniqueMemberErrorParentAccessorPhysicalAccessorPhysicalLinkEndsAccessorRelationshipSSingleSpecificationAccessorStringPODTT_coTypecastAccessorUU_coVIRTUAL_NAMESPACE_PREFIXWritableAccessorattr_equal()build_xtype()enumerate_namespaces()find_namespace()find_namespace_by_uri()find_wrapper()reset_entrypoint_caches()resolve_class_name()set_self_references()stringy_enum()wrap_xml()xtype_handler()- Submodules
- capellambse.model.diagram module
AbstractDiagramConfluenceSVGFormatDRepresentationDescriptorDRepresentationDescriptor.__init__()DRepresentationDescriptor._allow_renderDRepresentationDescriptor._create_diagram()DRepresentationDescriptor.descriptionDRepresentationDescriptor.filtersDRepresentationDescriptor.from_model()DRepresentationDescriptor.invalidate_cache()DRepresentationDescriptor.nameDRepresentationDescriptor.nodesDRepresentationDescriptor.representation_pathDRepresentationDescriptor.semantic_nodesDRepresentationDescriptor.targetDRepresentationDescriptor.typeDRepresentationDescriptor.uuidDRepresentationDescriptor.viewpointDRepresentationDescriptor.xtype
DiagramDiagramAccessorDiagramFormatDiagramTypeDiagramType.CCDiagramType.CDBDiagramType.CDIDiagramType.CEIDiagramType.CIBDDiagramType.CIIDiagramType.CMDiagramType.COCDiagramType.CRBDiagramType.CRIDiagramType.CRRDiagramType.CSADiagramType.EABDiagramType.ESDiagramType.FSDiagramType.IDDiagramType.IDBDiagramType.ISDiagramType.LABDiagramType.LCBDDiagramType.LDFBDiagramType.LFBDDiagramType.LFCDDiagramType.MBDiagramType.MCBDiagramType.MSMDiagramType.OABDiagramType.OABDDiagramType.OAIBDiagramType.OASDiagramType.OCBDiagramType.OEBDDiagramType.OESDiagramType.OPDDiagramType.ORBDiagramType.PABDiagramType.PCBDDiagramType.PDDiagramType.PDFBDiagramType.PFBDDiagramType.PFCDDiagramType.PPDDiagramType.SABDiagramType.SDFBDiagramType.SFBDDiagramType.SFCDDiagramType.UNKNOWN
PNGFormatPrettyDiagramFormatREPR_DRAWSVGDataURIFormatSVGFormatSVGInHTMLIMGFormatTerminalGraphicsFormatUnknownOutputFormatconvert_format()convert_svgdiagram()
- capellambse.svg package
- Submodules
- capellambse.svg.decorations module
- capellambse.svg.drawing module
- capellambse.svg.generate module
- capellambse.svg.helpers module
- capellambse.svg.style module
- capellambse.svg.symbols module
Submodules¶
capellambse.cli_helpers module¶
Helpers for working with models in CLI scripts.
- class capellambse.cli_helpers.ModelCLI¶
Bases:
ParamTypeDeclare an option that loads a model.
Use instances of this class for the type argument to
click.option()etc.See also
capellambse.cli_helpers.loadcliA standalone function performing the same task.
Examples
@click.command() @click.option("-m", "--model", type=capellambse.ModelCLI()) def main(model: capellambse.MelodyModel) -> None: ...
- class capellambse.cli_helpers.ModelInfoCLI¶
Bases:
ParamTypeDeclare an option that loads information about a model.
Use instances of this class for the type argument to
click.option()etc.See also
capellambse.cli_helpers.loadinfoA standalone function performing the same task.
Examples
@click.command() @click.open("-m", "modelinfo", type=capellambse.ModelInfoCLI()) def main(modelinfo: dict[str, t.Any]) -> None: # change any options, for example: modelinfo["diagram_cache"] = "/tmp/diagrams" model = capellambse.MelodyModel(**modelinfo)
- convert(value, param, ctx)¶
Convert the value to the target type.
- capellambse.cli_helpers.enumerate_known_models()¶
Enumerate the models that are found in the
known_modelsfolders.Two places are searched for models: The known_models folder in the user’s configuration directory, and the known_models folder in the installed
capellambsepackage.Run the following command to print the location of the user’s known_models folder:
python -m capellambse.cli_helpers
In order to make a custom model known, place a JSON file in one of these known_models folders. It should contain a dictionary with the keyword arguments to
MelodyModel- specifically it needs apath, optionally anentrypoint, and any additional arguments that the underlyingFileHandlermight need to gain access to the model.Files in the user’s configuration directory take precedence over files in the package directory. If a file with the same name exists in both places, the one in the user’s configuration directory will be used.
Be aware that relative paths in the JSON will be interpreted relative to the current working directory.
- Return type:
- capellambse.cli_helpers.loadcli(value)¶
Load a model from a file or JSON string.
This function works like
loadinfo(), and also loads the model for convenience.- Parameters:
value (
str|PathLike[str]) – As described forloadinfo().- Returns:
The loaded model, as described by the value.
- Return type:
Examples
def main(): model = capellambse.loadcli(sys.argv[1])
- capellambse.cli_helpers.loadinfo(value)¶
Load information about how to load a model as dict.
- Parameters:
One of the following:
A str or PathLike pointing to an
.airdfileA str or PathLike pointing to a
.jsonfile, which contains the arguments to instantiate aMelodyModelThe contents of such a JSON file (as string)
- Returns:
A dict with information about how to load a
MelodyModel.- Return type:
- Raises:
TypeError – If the value cannot be parsed as described above.
ValueError – If the value looks like a “known model” name, but the name is not defined.
Examples
def main(): modelinfo = capellambse.loadinfo(sys.argv[1]) # change any options, for example: modelinfo["diagram_cache"] = "/tmp/diagrams" model = MelodyModel(**modelinfo)
capellambse.decl module¶
Support for YAML-based declarative modelling.
A YAML-based approach to describing how to create and modify
capellambse compatible models.
For an in-depth explanation, please refer to the full documentation about declarative modelling.
- class capellambse.decl.Metadata¶
Bases:
TypedDict-
model:
ModelMetadata¶
-
written_by:
WriterMetadata¶
-
model:
- class capellambse.decl.UUIDReference¶
Bases:
objectReferences a model object by its UUID.
- __init__(uuid)¶
- Parameters:
uuid (UUIDString)
- Return type:
None
- exception capellambse.decl.UnfulfilledPromisesError¶
Bases:
RuntimeErrorA promise could not be fulfilled.
This exception is raised when a promise is referenced via
!promise, but it is never fulfilled by declaring an object with the samepromise_id.
- class capellambse.decl.YDMDumper¶
Bases:
SafeDumperA YAML dumper with extensions for declarative modelling.
- yaml_representers = {<class 'NoneType'>: <function SafeRepresenter.represent_none>, <class 'bool'>: <function SafeRepresenter.represent_bool>, <class 'bytes'>: <function SafeRepresenter.represent_binary>, <class 'capellambse.decl.FindBy'>: <function YDMDumper.represent_findby>, <class 'capellambse.decl.Promise'>: <function YDMDumper.represent_promise>, <class 'capellambse.decl.UUIDReference'>: <function YDMDumper.represent_uuidref>, <class 'capellambse.model._descriptors.NewObject'>: <function YDMDumper.represent_newobj>, <class 'datetime.date'>: <function SafeRepresenter.represent_date>, <class 'datetime.datetime'>: <function SafeRepresenter.represent_datetime>, <class 'dict'>: <function SafeRepresenter.represent_dict>, <class 'float'>: <function SafeRepresenter.represent_float>, <class 'int'>: <function SafeRepresenter.represent_int>, <class 'list'>: <function SafeRepresenter.represent_list>, <class 'markupsafe.Markup'>: <function YDMDumper.represent_markup>, <class 'set'>: <function SafeRepresenter.represent_set>, <class 'str'>: <function SafeRepresenter.represent_str>, <class 'tuple'>: <function SafeRepresenter.represent_list>, None: <function SafeRepresenter.represent_undefined>}¶
- class capellambse.decl.YDMLoader¶
Bases:
SafeLoaderA YAML loader with extensions for declarative modelling.
- construct_uuidref(node)¶
- Return type:
- Parameters:
node (Node)
- yaml_constructors = {'!find': <function YDMLoader.construct_findby>, '!html': <function YDMLoader.construct_markup>, '!new_object': <function YDMLoader.construct_newobj>, '!promise': <function YDMLoader.construct_promise>, '!uuid': <function YDMLoader.construct_uuidref>, 'tag:yaml.org,2002:binary': <function SafeConstructor.construct_yaml_binary>, 'tag:yaml.org,2002:bool': <function SafeConstructor.construct_yaml_bool>, 'tag:yaml.org,2002:float': <function SafeConstructor.construct_yaml_float>, 'tag:yaml.org,2002:int': <function SafeConstructor.construct_yaml_int>, 'tag:yaml.org,2002:map': <function SafeConstructor.construct_yaml_map>, 'tag:yaml.org,2002:null': <function SafeConstructor.construct_yaml_null>, 'tag:yaml.org,2002:omap': <function SafeConstructor.construct_yaml_omap>, 'tag:yaml.org,2002:pairs': <function SafeConstructor.construct_yaml_pairs>, 'tag:yaml.org,2002:seq': <function SafeConstructor.construct_yaml_seq>, 'tag:yaml.org,2002:set': <function SafeConstructor.construct_yaml_set>, 'tag:yaml.org,2002:str': <function SafeConstructor.construct_yaml_str>, 'tag:yaml.org,2002:timestamp': <function SafeConstructor.construct_yaml_timestamp>, None: <function SafeConstructor.construct_undefined>}¶
- capellambse.decl.apply(model, file, *, strict=False)¶
Apply a declarative modelling file to the given model.
- Parameters:
model (
MelodyModel) – The model to apply the instructions to.file (
Union[str,PathLike[Any],IO[str]]) –An open file-like object to read YAML instructions from, or a path to such a file. Files will be read with UTF-8 encoding.
The full format of these files is documented in the section about declarative modelling.
strict (
bool) – Verify metadata contained in the file against the used model, and raise an error if they don’t match.
- Return type:
Notes
This function is not transactional: If an exception occurs during this function, the model will be left partially modified, with no reliable way to know how much of the YAML input has been consumed. It is therefore advised to reload or discard the model immediately in these cases, to avoid working with an inconsistent state.
Even though the YAML layout suggests linear execution from top to bottom, the actual order in which modifications are executed is implementation defined. This is necessary to support promises with
!promise, but reorderings are still possible even if no promises are used in an input document.
- capellambse.decl.dump(instructions, *, metadata=None, generator=None)¶
Dump an instruction stream to YAML.
Optionally dump metadata with the instruction stream to YAML.
- capellambse.decl.load(file)¶
Load an instruction stream from a YAML file.
- capellambse.decl.load_with_metadata(file)¶
Load an instruction stream and its metadata from a YAML file.
If the file does not have a metadata section, an empty dict will be returned.
- Parameters:
file (
Union[str,PathLike[Any],IO[str]]) – An open file-like object containing decl instructions, or a path or PathLike pointing to such a file. Files are expected to use UTF-8 encoding.- Return type:
- Returns:
dict[str, Any] – The metadata read from the file, or an empty dictionary if the file did not contain any metadata.
list[dict[str, Any]] – The instruction stream.
capellambse.diagram_cache module¶
CLI for the diagram cache updating feature.
capellambse.helpers module¶
Miscellaneous utility functions used throughout the modules.
- class capellambse.helpers.EverythingContainer¶
-
A container that contains everything.
- class capellambse.helpers.UUIDString¶
A string that represents a unique ID within the model.
alias of
str
- capellambse.helpers.deterministic_ids(*, seed=None)¶
Enter a context during which generated IDs are deterministic.
This function is primarily intended for testing.
It can be used as a context manager, where deterministic IDs will be generated until the context ends:
>>> with deterministic_ids(): ... print(generate_id()) ... print(generate_id()) ... cd072cd8-be6f-4f62-ac4c-09c28206e7e3 5594aa6b-342f-4d0a-ba5e-4842fab428f7 >>> with deterministic_ids(): ... print(generate_id()) ... print(generate_id()) ... cd072cd8-be6f-4f62-ac4c-09c28206e7e3 5594aa6b-342f-4d0a-ba5e-4842fab428f7
It can also be used to annotate a function, in which case deterministic IDs will be generated while that function is being called:
>>> @deterministic_ids() ... def print_the_same_ids(): ... print(generate_id()) ... print(generate_id()) ... >>> print_the_same_ids() cd072cd8-be6f-4f62-ac4c-09c28206e7e3 5594aa6b-342f-4d0a-ba5e-4842fab428f7 >>> print_the_same_ids() cd072cd8-be6f-4f62-ac4c-09c28206e7e3 5594aa6b-342f-4d0a-ba5e-4842fab428f7
A seed for the PRNG may be passed using the seed keyword argument:
>>> with deterministic_ids(seed=1234): ... print(generate_id()) ... print(generate_id()) ... b97f69f7-5edf-45c7-9fda-d37066eae91d 14f6ea01-456b-4417-b0b8-35e942f549f1 >>> @deterministic_ids(seed=1234) ... def print_the_same_ids(): ... print(generate_id()) ... print(generate_id()) ... >>> print_the_same_ids() b97f69f7-5edf-45c7-9fda-d37066eae91d 14f6ea01-456b-4417-b0b8-35e942f549f1
- capellambse.helpers.embed_images(markup, /, resources)¶
Embed images into description text.
This function replaces
<img>tags linking to an image file in one of the given resources with a base64-encoded data URI containing the image data directly. The original path is preserved in thedata-capella-pathattribute. :rtype:MarkupSee also
unembed_imagesThe inverse operation.
- Parameters:
markup (str)
resources (Mapping[str, FileHandler])
- Return type:
- capellambse.helpers.escape_linked_text(loader, attr_text)¶
Transform simple HTML with object links into
LinkedText.This is the inverse operation of
unescape_linked_text().- Return type:
- Parameters:
loader (MelodyLoader)
attr_text (str)
- capellambse.helpers.extent_func(text, fonttype='OpenSans-Regular.ttf', size=10)¶
Calculate the display size of the given text.
- capellambse.helpers.flatten_html_string(text)¶
Convert an HTML-string to plain text.
- capellambse.helpers.generate_id()¶
Generate a new, random ID to be used in the model.
- Return type:
- capellambse.helpers.get_term_cell_size(stream=None)¶
Get the cell size of the terminal.
- Parameters:
stream – The stream that the terminal is connected to. If None, the stderr stream will be probed.
- Returns:
The width and height of a cell.
- Return type:
- Raises:
ValueError – Raised if the cell size could not be determined.
- capellambse.helpers.get_text_extent(text, width=inf, fonttype='OpenSans-Regular.ttf', fontsize=10)¶
Calculate the bounding box size of
textafter line wrapping.- Parameters:
- Return type:
- Returns:
width – The width of the text after word wrapping (px).
height – The height of the text after word wrapping (px).
- capellambse.helpers.get_transformation(class_, pos, size)¶
Calculate transformation for class.
The Scaling factor .725, translation constants (6, 5) are arbitrarily chosen to fit. Currently only ChoicePseudoState is tranformed.
- capellambse.helpers.is_uuid_string(string)¶
Validate that
stringis a valid UUID.
- capellambse.helpers.load_font(fonttype, size)¶
- Return type:
- Parameters:
- capellambse.helpers.make_short_html(clsname, uuid, name='', value='', *, icon='', iconsize=None)¶
Make HTML that briefly describes an element.
The layout of the generated HTML string is:
[icon and/or clsname] [name]: [value] ([uuid])
If an icon is used, the clsname is used for its alt and hover text.
All values passed except for icon will be HTML-escaped.
- Parameters:
clsname (
str) – The name of the object’s class.uuid (
str) – The object’s UUID.name (
str) – The human-readable name of the object.value (
str) – If the object contains a value of some sort, which is more interesting to the end user than the fact that the object exists, this parameter can be used to display the value.icon (
str) – The icon to use, encoded as data: URI. Note that this value must already be HTML-safe.iconsize (
int|None) – Fix the width and height of the icon to this pixel value. Needed if the client application has dumb CSS rules.
- Return type:
- capellambse.helpers.normalize_pure_path(path, *, base='/')¶
Make a PurePosixPath relative to base and collapse
..components.- Parameters:
path (
str|PurePosixPath) – The input path to normalize.base (
str|PurePosixPath) – The base directory to which relative paths should be interpreted. Ignored if the input path is not relative.
- Returns:
The normalized path.
- Return type:
- capellambse.helpers.ntuples(num, iterable, *, pad=False)¶
Yield N items of
iterableat once.- Parameters:
- Yields:
items – A
numlong tuple of items fromiterable.- Return type:
- capellambse.helpers.process_html_fragments(markup, node_callback)¶
Repair and modify HTML markup.
The original markup, which can be an HTML fragment (without a root element), is parsed and processed, and then reassembled into a Markup instance. If the original markup contained any errors or inconsistencies, these are repaired in the returned Markup instance.
- Parameters:
markup (
str) – The markup string to modify.node_callback (
Callable[[_Element],None]) –A callback function to process each node in the parsed markup. The function should accept a single
lxml.etree._Elementas argument; its return value is ignored.Note that, since the markup is parsed as fragments, more than the first element passed to the callback may have no parent.
The callback will not be invoked for leading text, if there is any, and thus it has no ability to influence it.
- Returns:
The processed markup.
- Return type:
- capellambse.helpers.qtype_of(element)¶
Get the qualified type of the element.
- capellambse.helpers.relpath_pure(path, start)¶
Calculate the relative path between two pure paths.
Unlike
pathlib.PurePath.relative_to(), this method can cope withpathnot being a subpath ofstart. And unlike theos.path.relpath()function, it does not involve any filesystem access.- Return type:
- Parameters:
path (PurePosixPath)
start (PurePosixPath)
- capellambse.helpers.repair_html(markup)¶
Try to repair broken HTML markup to prevent parse errors.
- Parameters:
markup (
str) – The markup to try and repair.- Returns:
The repaired markup.
- Return type:
- capellambse.helpers.replace_hlinks(markup, model, make_href, *, broken_link_css='color: red; text-decoration: line-through;')¶
Replace hlink:// links with arbitrary other links.
- Parameters:
markup (
str) – The markup to process.model (
MelodyModel) – The model to use for resolving UUIDs.make_href (
Callable[[ModelElement],str|None]) – A function that maps objects to URLs. This function is called once for each link (possibly multiple times for the same object), and must return a URL to be inserted in place of the originalhlink://...URL.broken_link_css (
str) – Broken links (links to objects that have been deleted, and links where themake_hrefcallback returned None or an empty string) are indicated by a<span>element with this CSS style applied to it.
- Return type:
- capellambse.helpers.resolve_namespace(tag)¶
Resolve a ‘:’-delimited symbolic namespace to its canonical form.
- capellambse.helpers.split_links(links)¶
Split a string containing intra- and inter-fragment links.
Intra-fragment links are simply “#UUID”, whereas inter-fragment links look like “xtype fragment#UUID”. Multiple such links are space-separated in a single long string to form a list. This function splits such a string back into its individual components (each being either an intra- or inter-fragment link), and yields them.
- capellambse.helpers.ssvparse(string, cast, *, parens=('', ''), sep=',', num=0)¶
Parse a string of
sep-separated values wrapped inparens.- Parameters:
string (
str) – The input string.cast (
Callable[[str],TypeVar(_T)]) – A type to cast the values into.parens (
Sequence[str]) – The parentheses that must exist around the input. Either a two-character string or a 2-tuple of strings.sep (
str) – The separator between values.num (
int) – If non-zero, only accept exactly this many values.
- Returns:
A list of values cast into the given type.
- Return type:
list[_T]
- Raises:
ValueError – If the parentheses are missing around the input string, or if the expected number of values doesn’t match the actual number.
- capellambse.helpers.unembed_images(markup, /, resources)¶
Unembed images from description text.
This function replaces
<img>tags containing data URIs with links that can be interpreted by Capella, and writes the image data into files in the provided model’s resources. :rtype:MarkupSee also
embed_imagesThe inverse operation.
- Parameters:
markup (str)
resources (Mapping[str, FileHandler])
- Return type:
- capellambse.helpers.unescape_linked_text(loader, attr_text)¶
Transform the
linkedTextinto regular HTML.- Return type:
- Parameters:
loader (MelodyLoader)
attr_text (str | None)
- capellambse.helpers.word_wrap(text, width)¶
Perform word wrapping for proportional fonts.
Whitespace at the beginning of input lines is preserved, but other whitespace is collapsed to single spaces. Words are kept as a whole, possibly leading to exceeding width bound.
- capellambse.helpers.xpath_fetch_unique(xpath, tree, elm_name, elm_uid=None, *, optional=False)¶
Fetch an XPath result from the tree, ensuring that it’s unique.
- Parameters:
xpath (
str|XPath) – Thelxml.etree.XPathobject to apply, or an XPath expression as str.tree (
_Element) – The (sub-)tree to which the XPath will be applied.elm_name (
str) – A human-readable element name for error messages.elm_uid (
str|None) – UID of the element which triggered this lookup. Will be included in the error message if an error occured.optional (
bool) – True to return None in case the element is not found. Otherwise a ValueError will be raised.
- Returns:
The Element found by given
xpath.- Return type:
lxml.etree._Element | None
- Raises:
ValueError – If more than one element was found matching the
xpath, or ifoptionalisFalseand no matching element was found.
- capellambse.helpers.xtype_of(elem)¶
Return the
xsi:typeof the element.If the element has an
xsi:typeattribute, its value is returned.If the element does not have an
xsi:type, this function resolves the tag’s namespace to the symbolic name and reconstructs the type with thenamespace:tagtemplate.- Parameters:
elem (
_Element) – Thelxml.etree._Elementobject to return thexsi:typefor.- Raises:
capellambse.UnsupportedPluginError – If the plugin is unknown and therefore not supported.
capellambse.UnsupportedPluginVersionError – If the plugin’s version is not supported.
- Returns:
The
xsi:typestring of the provided element orNoneif the type could not be determined.- Return type:
str | None