Skip to content

Improve/model

Leon Mauritz Möller requested to merge improve/model into master

Improve our implementation of the DotAAS metamodel by making abstract classes really abstract (so they can't be instantiated), removing the _-suffix of function parameters in the model and more. See commits for details.

When removing the underscore suffix from function parameters, I only removed the suffix from parameters that were keyword arguments, because the value of positional parameters is usual given without specifying the parameter name.
Thus a few parameters still have their _-suffix in the model:

$ grep -Pn "\w+_: " --exclude-dir=__pycache__ aas/model/*
aas/model/base.py:221:                 type_: KeyElements,
aas/model/base.py:228:        :param type_: Denote which kind of entity is referenced. In case type = GlobalReference then the element is a
aas/model/base.py:363:                 id_: str,
aas/model/base.py:368:        :param id_: Identifier of the element. Its type is defined in id_type.
aas/model/base.py:669:                 type_: Type[_RT]):
aas/model/base.py:676:        :param: type_: The type of the referenced object (additional parameter, not from the AAS Metamodel)
aas/model/base.py:685:    def resolve(self, provider_: "provider.AbstractObjectProvider") -> _RT:
aas/model/base.py:901:                 type_: QualifierType,
aas/model/base.py:909:        :param type_: The type of the qualifier that is applied to the element.
aas/model/base.py:1195:    def insert(self, index: int, object_: _RT) -> None:
aas/model/datatypes.py:401:def trivial_cast(value, type_: Type[AnyXSDType]) -> AnyXSDType:  # workaround. We should be able to use a TypeVar here
aas/model/datatypes.py:416:    :param type_: Target type to cast into. Must be an XSD type from this module
aas/model/datatypes.py:513:def from_xsd(value: str, type_: Type[AnyXSDType]) -> AnyXSDType:  # workaround. We should be able to use a TypeVar here
aas/model/datatypes.py:517:    :param type_: The expected XSD type (from this module). It is required to chose the correct conversion.

Let's discuss here whether we also want to remove the suffix of the type_ and id_ parameters in base.py. I checked, type() or id() isn't used in the respective scopes (only in datatypes.py).

Edited by Leon Mauritz Möller

Merge request reports