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

Update to aas-core3.0-python 1.0.4 #8

Merged
merged 1 commit into from
Apr 17, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion aas_core3/__init__.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
"""Manipulate and de/serialize Asset Administration Shells in Micropython."""

# Synchronize with __init__.py and changelog.rst!
__version__ = "1.0.3"
__version__ = "1.0.4"
__author__ = "Marko Ristin"
__copyright__ = "2024 Contributors to aas-core3.0-python"
__license__ = "License :: OSI Approved :: MIT License"
Expand Down
24 changes: 10 additions & 14 deletions aas_core3/jsonization.py
Original file line number Diff line number Diff line change
Expand Up @@ -4960,23 +4960,23 @@ class _SetterForEmbeddedDataSpecification:

def __init__(self):

self.data_specification = None
self.data_specification_content = None
self.data_specification = None

def ignore(self, jsonable):

pass

def set_data_specification_from_jsonable(self, jsonable):

self.data_specification = reference_from_jsonable(jsonable)

def set_data_specification_content_from_jsonable(self, jsonable):

self.data_specification_content = data_specification_content_from_jsonable(
jsonable
)

def set_data_specification_from_jsonable(self, jsonable):

self.data_specification = reference_from_jsonable(jsonable)


def embedded_data_specification_from_jsonable(
jsonable,
Expand All @@ -4998,18 +4998,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 @@ -6076,8 +6071,8 @@ def data_specification_iec_61360_from_jsonable(


_SETTER_MAP_FOR_EMBEDDED_DATA_SPECIFICATION = {
"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 @@ -7240,12 +7235,13 @@ def transform_embedded_data_specification(self, that):

jsonable = 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

def transform_level_type(self, that):
Expand Down
8 changes: 4 additions & 4 deletions aas_core3/jsonization.pyi
Original file line number Diff line number Diff line change
Expand Up @@ -3143,17 +3143,17 @@ class _SetterForEmbeddedDataSpecification:
"""Ignore :paramref:`jsonable` and do not set anything."""
...

def set_data_specification_from_jsonable(self, jsonable: Jsonable) -> None:
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
"""
...

def set_data_specification_content_from_jsonable(self, jsonable: Jsonable) -> None:
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
"""
Expand Down
18 changes: 10 additions & 8 deletions aas_core3/types.py
Original file line number Diff line number Diff line change
Expand Up @@ -3499,20 +3499,22 @@ class EmbeddedDataSpecification(Class):

def descend_once(self):

yield self.data_specification

yield self.data_specification_content

def descend(self):

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

yield from self.data_specification.descend()
def descend(self):

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):

visitor.visit_embedded_data_specification(self)
Expand All @@ -3537,12 +3539,12 @@ def transform_with_context(

def __init__(
self,
data_specification,
data_specification_content,
data_specification=None,
):

self.data_specification = data_specification
self.data_specification_content = data_specification_content
self.data_specification = data_specification


@aas_enum.decorator
Expand Down
8 changes: 4 additions & 4 deletions aas_core3/types.pyi
Original file line number Diff line number Diff line change
Expand Up @@ -3550,12 +3550,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 Down Expand Up @@ -3600,8 +3600,8 @@ class EmbeddedDataSpecification(Class):

def __init__(
self,
data_specification: "Reference",
data_specification_content: "DataSpecificationContent",
data_specification: Optional["Reference"] = None,
) -> None:
"""Initialize with the given values."""
...
Expand Down
9 changes: 5 additions & 4 deletions aas_core3/xmlization.py
Original file line number Diff line number Diff line change
Expand Up @@ -1987,14 +1987,15 @@ def visit_environment(self, that):

def _write_embedded_data_specification_as_sequence(self, that):

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):

self._write_start_element("embeddedDataSpecification")
Expand Down
2 changes: 1 addition & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
setup(
name='aas-core3.0-micropython',
# Synchronize with __init__.py and changelog.rst!
version="1.0.3",
version="1.0.4",
description="Manipulate and de/serialize Asset Administration Shells in Micropython.",
long_description=long_description,
url="https://github.com/aas-core-works/aas-core3.0-micropython",
Expand Down
Loading