Skip to content

Commit

Permalink
Update to aas-core-meta, codegen, testgen 6d5411b, d06db62b, 8f749f00a
Browse files Browse the repository at this point in the history
We update the development requirements to and re-generate everything
with:
* [aas-core-meta 6d5411b],
* [aas-core-codegen d06db62b] and
* [aas-core3.0-testgen 8f749f00a].

[aas-core-meta 6d5411b]: aas-core-works/aas-core-meta@6d5411b
[aas-core-codegen d06db62b]: aas-core-works/aas-core-codegen@d06db62b
[aas-core3.0-testgen 8f749f00a]: aas-core-works/aas-core3.0-testgen@8f749f00a

Notably, we propagate [the fix #328 on aas-core-meta] related to
`Embedded_data_specification` where `data_specification` is made
optional.

[the fix #328 on aas-core-meta]: aas-core-works/aas-core-meta#328
  • Loading branch information
mristin committed Apr 16, 2024
1 parent 39dcabd commit 3c8556f
Show file tree
Hide file tree
Showing 2,222 changed files with 67 additions and 19,896 deletions.
32 changes: 14 additions & 18 deletions aas_core3/jsonization.py
Original file line number Diff line number Diff line change
Expand Up @@ -6545,23 +6545,15 @@ class _SetterForEmbeddedDataSpecification:

def __init__(self) -> None:
"""Initialize with all the properties unset."""
self.data_specification: Optional[aas_types.Reference] = None
self.data_specification_content: Optional[
aas_types.DataSpecificationContent
] = None
self.data_specification: Optional[aas_types.Reference] = None

def ignore(self, jsonable: Jsonable) -> None:
"""Ignore :paramref:`jsonable` and do not set anything."""
pass

def set_data_specification_from_jsonable(self, jsonable: Jsonable) -> None:
"""
Parse :paramref:`jsonable` as the value of :py:attr:`~data_specification`.
:param jsonable: input to be parsed
"""
self.data_specification = reference_from_jsonable(jsonable)

def set_data_specification_content_from_jsonable(self, jsonable: Jsonable) -> None:
"""
Parse :paramref:`jsonable` as the value of :py:attr:`~data_specification_content`.
Expand All @@ -6572,6 +6564,14 @@ def set_data_specification_content_from_jsonable(self, jsonable: Jsonable) -> No
jsonable
)

def set_data_specification_from_jsonable(self, jsonable: Jsonable) -> None:
"""
Parse :paramref:`jsonable` as the value of :py:attr:`~data_specification`.
:param jsonable: input to be parsed
"""
self.data_specification = reference_from_jsonable(jsonable)


def embedded_data_specification_from_jsonable(
jsonable: Jsonable,
Expand Down Expand Up @@ -6600,18 +6600,13 @@ def embedded_data_specification_from_jsonable(
exception.path._prepend(PropertySegment(jsonable_value, key))
raise exception

if setter.data_specification is None:
raise DeserializationException(
"The required property 'dataSpecification' is missing"
)

if setter.data_specification_content is None:
raise DeserializationException(
"The required property 'dataSpecificationContent' is missing"
)

return aas_types.EmbeddedDataSpecification(
setter.data_specification, setter.data_specification_content
setter.data_specification_content, setter.data_specification
)


Expand Down Expand Up @@ -7926,8 +7921,8 @@ def data_specification_iec_61360_from_jsonable(
_SETTER_MAP_FOR_EMBEDDED_DATA_SPECIFICATION: Mapping[
str, Callable[[_SetterForEmbeddedDataSpecification, Jsonable], None]
] = {
"dataSpecification": _SetterForEmbeddedDataSpecification.set_data_specification_from_jsonable,
"dataSpecificationContent": _SetterForEmbeddedDataSpecification.set_data_specification_content_from_jsonable,
"dataSpecification": _SetterForEmbeddedDataSpecification.set_data_specification_from_jsonable,
"modelType": _SetterForEmbeddedDataSpecification.ignore,
}

Expand Down Expand Up @@ -9154,12 +9149,13 @@ def transform_embedded_data_specification(
"""Serialize :paramref:`that` to a JSON-able representation."""
jsonable: MutableMapping[str, MutableJsonable] = dict()

jsonable["dataSpecification"] = self.transform(that.data_specification)

jsonable["dataSpecificationContent"] = self.transform(
that.data_specification_content
)

if that.data_specification is not None:
jsonable["dataSpecification"] = self.transform(that.data_specification)

return jsonable

# noinspection PyMethodMayBeStatic
Expand Down
24 changes: 13 additions & 11 deletions aas_core3/types.py
Original file line number Diff line number Diff line change
Expand Up @@ -5280,12 +5280,12 @@ class DataSpecificationContent(Class):
class EmbeddedDataSpecification(Class):
"""Embed the content of a data specification."""

#: Reference to the data specification
data_specification: "Reference"

#: Actual content of the data specification
data_specification_content: "DataSpecificationContent"

#: Reference to the data specification
data_specification: Optional["Reference"]

def descend_once(self) -> Iterator[Class]:
"""
Iterate over the instances referenced from this instance.
Expand All @@ -5294,24 +5294,26 @@ def descend_once(self) -> Iterator[Class]:
:yield: instances directly referenced from this instance
"""
yield self.data_specification

yield self.data_specification_content

if self.data_specification is not None:
yield self.data_specification

def descend(self) -> Iterator[Class]:
"""
Iterate recursively over the instances referenced from this one.
:yield: instances recursively referenced from this instance
"""
yield self.data_specification

yield from self.data_specification.descend()

yield self.data_specification_content

yield from self.data_specification_content.descend()

if self.data_specification is not None:
yield self.data_specification

yield from self.data_specification.descend()

def accept(self, visitor: "AbstractVisitor") -> None:
"""Dispatch the :paramref:`visitor` on this instance."""
visitor.visit_embedded_data_specification(self)
Expand Down Expand Up @@ -5340,12 +5342,12 @@ def transform_with_context(

def __init__(
self,
data_specification: "Reference",
data_specification_content: "DataSpecificationContent",
data_specification: Optional["Reference"] = None,
) -> None:
"""Initialize with the given values."""
self.data_specification = data_specification
self.data_specification_content = data_specification_content
self.data_specification = data_specification


class DataTypeIEC61360(enum.Enum):
Expand Down
9 changes: 5 additions & 4 deletions aas_core3/verification.py
Original file line number Diff line number Diff line change
Expand Up @@ -5587,14 +5587,15 @@ def transform_environment(self, that: aas_types.Environment) -> Iterator[Error]:
def transform_embedded_data_specification(
self, that: aas_types.EmbeddedDataSpecification
) -> Iterator[Error]:
for error in self.transform(that.data_specification):
error.path._prepend(PropertySegment(that, "data_specification"))
yield error

for error in self.transform(that.data_specification_content):
error.path._prepend(PropertySegment(that, "data_specification_content"))
yield error

if that.data_specification is not None:
for error in self.transform(that.data_specification):
error.path._prepend(PropertySegment(that, "data_specification"))
yield error

# noinspection PyMethodMayBeStatic
def transform_level_type(self, that: aas_types.LevelType) -> Iterator[Error]:
# No verification has been defined for LevelType.
Expand Down
38 changes: 17 additions & 21 deletions aas_core3/xmlization.py
Original file line number Diff line number Diff line change
Expand Up @@ -21099,19 +21099,10 @@ class _ReaderAndSetterForEmbeddedDataSpecification:

def __init__(self) -> None:
"""Initialize with all the properties unset."""
self.data_specification: Optional[aas_types.Reference] = None
self.data_specification_content: Optional[
aas_types.DataSpecificationContent
] = None

def read_and_set_data_specification(
self, element: Element, iterator: Iterator[Tuple[str, Element]]
) -> None:
"""
Read :paramref:`element` as the property
:py:attr:`.types.EmbeddedDataSpecification.data_specification` and set it.
"""
self.data_specification = _read_reference_as_sequence(element, iterator)
self.data_specification: Optional[aas_types.Reference] = None

def read_and_set_data_specification_content(
self, element: Element, iterator: Iterator[Tuple[str, Element]]
Expand Down Expand Up @@ -21145,6 +21136,15 @@ def read_and_set_data_specification_content(

self.data_specification_content = result

def read_and_set_data_specification(
self, element: Element, iterator: Iterator[Tuple[str, Element]]
) -> None:
"""
Read :paramref:`element` as the property
:py:attr:`.types.EmbeddedDataSpecification.data_specification` and set it.
"""
self.data_specification = _read_reference_as_sequence(element, iterator)


def _read_embedded_data_specification_as_sequence(
element: Element, iterator: Iterator[Tuple[str, Element]]
Expand Down Expand Up @@ -21216,19 +21216,14 @@ def _read_embedded_data_specification_as_sequence(
exception.path._prepend(ElementSegment(next_element))
raise

if reader_and_setter.data_specification is None:
raise DeserializationException(
"The required property 'dataSpecification' is missing"
)

if reader_and_setter.data_specification_content is None:
raise DeserializationException(
"The required property 'dataSpecificationContent' is missing"
)

return aas_types.EmbeddedDataSpecification(
reader_and_setter.data_specification,
reader_and_setter.data_specification_content,
reader_and_setter.data_specification,
)


Expand Down Expand Up @@ -23420,8 +23415,8 @@ def _read_data_specification_iec_61360_as_element(
None,
],
] = {
"dataSpecification": _ReaderAndSetterForEmbeddedDataSpecification.read_and_set_data_specification,
"dataSpecificationContent": _ReaderAndSetterForEmbeddedDataSpecification.read_and_set_data_specification_content,
"dataSpecification": _ReaderAndSetterForEmbeddedDataSpecification.read_and_set_data_specification,
}


Expand Down Expand Up @@ -26170,14 +26165,15 @@ def _write_embedded_data_specification_as_sequence(

:param that: instance to be serialized
"""
self._write_start_element("dataSpecification")
self._write_reference_as_sequence(that.data_specification)
self._write_end_element("dataSpecification")

self._write_start_element("dataSpecificationContent")
self.visit(that.data_specification_content)
self._write_end_element("dataSpecificationContent")

if that.data_specification is not None:
self._write_start_element("dataSpecification")
self._write_reference_as_sequence(that.data_specification)
self._write_end_element("dataSpecification")

def visit_embedded_data_specification(
self, that: aas_types.EmbeddedDataSpecification
) -> None:
Expand Down
4 changes: 2 additions & 2 deletions requirements-dev.txt
Original file line number Diff line number Diff line change
Expand Up @@ -4,5 +4,5 @@ pylint==2.15.4
coverage>=6.5.0,<7
pyinstaller>=5<6
twine
aas-core-meta@git+https://github.com/aas-core-works/aas-core-meta@cb28d18#egg=aas-core-meta
aas-core-codegen@git+https://github.com/aas-core-works/aas-core-codegen@c414f32#egg=aas-core-codegen
aas-core-meta@git+https://github.com/aas-core-works/aas-core-meta@6d5411b#egg=aas-core-meta
aas-core-codegen@git+https://github.com/aas-core-works/aas-core-codegen@d06db62b#egg=aas-core-codegen
Original file line number Diff line number Diff line change
Expand Up @@ -13,15 +13,6 @@
},
"embeddedDataSpecifications": [
{
"dataSpecification": {
"keys": [
{
"type": "GlobalReference",
"value": "urn:something14:18179b7a"
}
],
"type": "ExternalReference"
},
"dataSpecificationContent": {
"modelType": "DataSpecificationIec61360",
"preferredName": [
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,15 +13,6 @@
},
"embeddedDataSpecifications": [
{
"dataSpecification": {
"keys": [
{
"type": "GlobalReference",
"value": "urn:something14:18179b7a"
}
],
"type": "ExternalReference"
},
"dataSpecificationContent": {
"modelType": "DataSpecificationIec61360",
"preferredName": [
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,15 +13,6 @@
},
"embeddedDataSpecifications": [
{
"dataSpecification": {
"keys": [
{
"type": "GlobalReference",
"value": "urn:something14:18179b7a"
}
],
"type": "ExternalReference"
},
"dataSpecificationContent": {
"modelType": "DataSpecificationIec61360",
"preferredName": [
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,15 +13,6 @@
},
"embeddedDataSpecifications": [
{
"dataSpecification": {
"keys": [
{
"type": "GlobalReference",
"value": "urn:something14:18179b7a"
}
],
"type": "ExternalReference"
},
"dataSpecificationContent": {
"modelType": "DataSpecificationIec61360",
"preferredName": [
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,15 +13,6 @@
},
"embeddedDataSpecifications": [
{
"dataSpecification": {
"keys": [
{
"type": "GlobalReference",
"value": "urn:something14:18179b7a"
}
],
"type": "ExternalReference"
},
"dataSpecificationContent": {
"modelType": "DataSpecificationIec61360",
"preferredName": [
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,15 +13,6 @@
},
"embeddedDataSpecifications": [
{
"dataSpecification": {
"keys": [
{
"type": "GlobalReference",
"value": "urn:something14:18179b7a"
}
],
"type": "ExternalReference"
},
"dataSpecificationContent": {
"modelType": "DataSpecificationIec61360",
"preferredName": [
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,15 +13,6 @@
},
"embeddedDataSpecifications": [
{
"dataSpecification": {
"keys": [
{
"type": "GlobalReference",
"value": "urn:something14:18179b7a"
}
],
"type": "ExternalReference"
},
"dataSpecificationContent": {
"modelType": "DataSpecificationIec61360",
"preferredName": [
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,15 +13,6 @@
},
"embeddedDataSpecifications": [
{
"dataSpecification": {
"keys": [
{
"type": "GlobalReference",
"value": "urn:something14:18179b7a"
}
],
"type": "ExternalReference"
},
"dataSpecificationContent": {
"modelType": "DataSpecificationIec61360",
"preferredName": [
Expand Down
Loading

0 comments on commit 3c8556f

Please sign in to comment.