Skip to content

NamespaceSet.update_nss_from incomplete for Qualifier and Extension branches #602

Description

@JAB1305

def update_nss_from(self, other: "NamespaceSet"):
"""
Update a NamespaceSet from a given NamespaceSet.
WARNING: By updating, the "other" NamespaceSet gets destroyed.
:param other: The NamespaceSet to update from
"""
objects_to_add: List[_NSO] = [] # objects from the other nss to add to self
objects_to_remove: List[_NSO] = [] # objects to remove from self
for other_object in other:
try:
if isinstance(other_object, Referable):
backend, case_sensitive = self._backend["id_short"]
referable = backend[other_object.id_short if case_sensitive else other_object.id_short.upper()]
referable.update_from(other_object) # type: ignore
elif isinstance(other_object, Qualifier):
backend, case_sensitive = self._backend["type"]
qualifier = backend[other_object.type if case_sensitive else other_object.type.upper()]
# qualifier.update_from(other_object) # TODO: What should happend here?
elif isinstance(other_object, Extension):
backend, case_sensitive = self._backend["name"]
extension = backend[other_object.name if case_sensitive else other_object.name.upper()]
# extension.update_from(other_object) # TODO: What should happend here?
else:
raise TypeError("Type not implemented")

Currently basyx.aas.model.base.NamespaceSet.update_nss_from() has branches marked TODO: What should happen here?. Only the Referable branch is implemented.

The behavior for Qualifierand Extension should be defined and implemented, or at least reported back that this functionality is not present instead of silently being dropped.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions