Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

WIP: change class AdministrativeInformation and Constraint AASd-005 #3

Closed
wants to merge 40 commits into from

Conversation

dxvidnrt
Copy link

Add creator, templateId
Change Constraint AASd-005
Change repr()

zrgt and others added 30 commits November 30, 2022 22:06
typing: make implicit optional types explicit optional
backend.couchdb: Remove usage of deprecated HTTPResponse.getheader()
model.base: Fix AASReference.resolve() error messages
This fixes a bug that caused values of integer "0" to be deserialized to `None`.
Due to missing calls to the initializer function (__init__) of parent
classes, not all superclasses were correctly initialized for classes
that inherit from multiple classes (e.g. Submodel, SubmodelElement).

https://stackoverflow.com/a/16310777/4780052
Rename supplementary_semantic_id to supplemental_semantic_id, as it's
named in the spec.

Use the official description of supplemental_semantic_id from the spec
in the docstrings.

Only implement the bare minimum of list functions for ConstrainedList.
Other functions such as `append()`, `pop()` and `remove()` are inherited
from MutableSequence and implemented via `__getitem__()`, `__len__()`,
`insert()`, and `__delitem__()`.

Document Constraint AASd-118 in HasSemantics docstring.

Change type of `supplemental_semantic_id` in `__init__()` of classes
that inherit from `HasSemantics`.
Optional[ConstrainedList[Reference]] creates an ambiguity between None
and an empty list, which both correspond to no supplemental semantic ids
being present. Insead, initialize the set with an empty iterable.
Also, instead of a ConstrainedList[Reference], use Iterable[Reference]
as we don't want the users of this SDK to worry about ConstrainedList,
it should be an implementation detail.

Add item_set_hook to ConstrainedList. Similar to item_del_hook, it is
actually not necessary for the HasSemantics constraint, but I only
noticed that later when I re-read the HasSemantics constraint.

Instead of raising a ValueError when a constraint is violated, raise an
AASConstraintViolation, which is a special class of this SDK for exactly
this purpose.

Clean up the tests a bit, e.g. use pythons unittest assertion functions
instead of raising a ValueError on error. Also split the tests by
functionality in separate functions.

Improve the ConstrainedListTest by verifying which values are passed to
the hook functions.
- Use a dictionary called mapping that maps each object type to its corresponding serialization method.
annotation->in JSON: annotations
inputVariable->in JSON: inputVariables
outputVariable->in JSON: outputVariables
inoutputVariable->in JSON: inoutputVariables
externalAssetIds->specificAssetIds
thumbnail->defaultThumbnail
externalAssetIds->specificAssetIds
subjectId->externalSubjectId
@dxvidnrt dxvidnrt closed this Apr 7, 2023
@dxvidnrt dxvidnrt changed the title change class AdministrativeInformation and Constraint AASd-005 WIP: change class AdministrativeInformation and Constraint AASd-005 Apr 18, 2023
@dxvidnrt dxvidnrt deleted the V30/AdministrativeInformation branch June 24, 2023 15:40
@dxvidnrt dxvidnrt restored the V30/AdministrativeInformation branch June 24, 2023 15:40
@dxvidnrt dxvidnrt deleted the V30/AdministrativeInformation branch June 24, 2023 15:41
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants