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
#40)

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 authored Apr 16, 2024
1 parent b749f61 commit f317796
Show file tree
Hide file tree
Showing 2,598 changed files with 347 additions and 20,860 deletions.
2 changes: 1 addition & 1 deletion dev_scripts/aas_core3/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,5 +3,5 @@
This copy is necessary so that we can decouple from ``aas-core*-python`` repository.
The revision of aas-core-codegen was: c414f32
The revision of aas-core-codegen was: d06db62b
"""
36 changes: 16 additions & 20 deletions dev_scripts/aas_core3/jsonization.py
Original file line number Diff line number Diff line change
Expand Up @@ -9137,36 +9137,36 @@ 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(
def set_data_specification_content_from_jsonable(
self,
jsonable: Jsonable
) -> None:
"""
Parse :paramref:`jsonable` as the value of :py:attr:`~data_specification`.
Parse :paramref:`jsonable` as the value of :py:attr:`~data_specification_content`.
:param jsonable: input to be parsed
"""
self.data_specification = reference_from_jsonable(
self.data_specification_content = data_specification_content_from_jsonable(
jsonable
)

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

Expand Down Expand Up @@ -9209,19 +9209,14 @@ def embedded_data_specification_from_jsonable(
)
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 @@ -11229,10 +11224,10 @@ def data_specification_iec_61360_from_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 @@ -12793,14 +12788,15 @@ 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
26 changes: 14 additions & 12 deletions dev_scripts/aas_core3/types.py
Original file line number Diff line number Diff line change
Expand Up @@ -5554,12 +5554,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 @@ -5568,24 +5568,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 @@ -5618,12 +5620,12 @@ def transform_with_context(

def __init__(
self,
data_specification: 'Reference',
data_specification_content: 'DataSpecificationContent'
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
19 changes: 10 additions & 9 deletions dev_scripts/aas_core3/verification.py
Original file line number Diff line number Diff line change
Expand Up @@ -7895,15 +7895,6 @@ 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(
Expand All @@ -7913,6 +7904,16 @@ def transform_embedded_data_specification(
)
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,
Expand Down
56 changes: 26 additions & 30 deletions dev_scripts/aas_core3/xmlization.py
Original file line number Diff line number Diff line change
Expand Up @@ -24043,22 +24043,8 @@ 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,
Expand Down Expand Up @@ -24097,6 +24083,20 @@ 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,
Expand Down Expand Up @@ -24176,19 +24176,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_content,
reader_and_setter.data_specification
)


Expand Down Expand Up @@ -27070,10 +27065,10 @@ 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 @@ -30473,16 +30468,17 @@ 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
Expand Down
4 changes: 2 additions & 2 deletions dev_scripts/setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -29,8 +29,8 @@
keywords="asset administration shell code generation industry 4.0 industrie i4.0",
install_requires=[
"icontract>=2.6.1,<3",
"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",
],
# fmt: off
extras_require={
Expand Down
Loading

0 comments on commit f317796

Please sign in to comment.