Source code for aas_core3_2.xmlization

"""
Read and write model instances as XML.

For reading, we provide different reading functions, each handling a different kind
of input. All the reading functions operate in one pass, *i.e.*, the source is read
incrementally and the complete XML is not held in memory.

We provide the following four reading functions (where ``X`` represents the name of
the class):

1) ``X_from_iterparse`` reads from a stream of ``(event, element)`` tuples coming from
   :py:func:`xml.etree.ElementTree.iterparse` with the argument
   ``events=["start", "end"]``. If you do not trust the source, please consider
   using `defusedxml.ElementTree`_.
2) ``X_from_stream`` reads from the given text stream.
3) ``X_from_file`` reads from a file on disk.
4) ``X_from_str`` reads from the given string.

The functions ``X_from_stream``, ``X_from_file`` and ``X_from_str`` provide
an extra parameter, ``has_iterparse``, which allows you to use a parsing library
different from :py:mod:`xml.etree.ElementTree`. For example, you can pass in
`defusedxml.ElementTree`_.

.. _defusedxml.ElementTree: https://pypi.org/project/defusedxml/#defusedxml-elementtree

All XML elements are expected to live in the :py:attr:`~NAMESPACE`. The elements of
the XML-RPC subset, over which a JSON-able value is de/serialized, are the one
exception: they live in no namespace at all.

For writing, use the function :py:func:`aas_core3_2.xmlization.write` which
translates the instance of the model into an XML document and writes it in one pass
to the stream.

The writing raises a :py:class:`SerializationException` if it can not serialize
the instance, be it because the stream failed or because a value could not be
written. The path of the exception points to the culprit as a Python access
expression, *e.g.*, ``.submodels[0].id``, so that you can find it in the instance
which you handed over.

Here is an example usage how to de-serialize from a file:

.. code-block::

    import pathlib
    import xml.etree.ElementTree as ET

    import aas_core3_2.xmlization as our_xmlization

    path = pathlib.Path(...)
    instance = our_xmlization.read_extension_from_file(
        path
    )

    # Do something with the ``instance``

Here is another code example where we serialize the instance:

.. code-block::

    import pathlib

    import aas_core3_2.types as our_types
    import aas_core3_2.xmlization as our_xmlization

    instance = Extension(
       ... # some constructor arguments
    )

    pth = pathlib.Path(...)
    with pth.open("wt") as fid:
        our_xmlization.write(instance, fid)
"""

# This code has been automatically generated by aas-core-codegen.
# Do NOT edit or append.


import base64
import enum
import io
import math
import os
import re
import sys
from typing import (
    Any,
    Callable,
    Dict,
    Iterator,
    List,
    Mapping,
    NoReturn,
    Optional,
    Sequence,
    TextIO,
    Tuple,
    TypeVar,
    TYPE_CHECKING,
)
import xml.etree.ElementTree

if sys.version_info >= (3, 8):
    from typing import Final
else:
    from typing_extensions import Final

import aas_core3_2.stringification as our_stringification
import aas_core3_2.types as our_types
import aas_core3_2.xmlcommon as our_xmlcommon
import aas_core3_2.xmlrpc as our_xmlrpc
from aas_core3_2.xmlcommon import (
    XS_WHITESPACE_RE,
    collapse_whitespace,
    parse_element_tag,
    raise_if_has_tail_or_attrib,
    read_end_element,
    read_next_start_element,
    read_str_from_element_text,
    read_text_from_element,
)

# See: https://stackoverflow.com/questions/55076778/why-isnt-this-function-type-annotated-correctly-error-missing-type-parameters
if TYPE_CHECKING:
    PathLike = os.PathLike[Any]
else:
    PathLike = os.PathLike


#: XML namespace in which all the elements are expected to reside
NAMESPACE = our_xmlcommon.NAMESPACE


# region De-serialization


Element = our_xmlcommon.Element
HasIterparse = our_xmlcommon.HasIterparse

ElementSegment = our_xmlcommon.ElementSegment
IndexSegment = our_xmlcommon.IndexSegment
KeySegment = our_xmlcommon.KeySegment
Segment = our_xmlcommon.Segment
Path = our_xmlcommon.Path

DeserializationException = our_xmlcommon.DeserializationException
SerializationException = our_xmlcommon.SerializationException


def _with_elements_cleared_after_yield(
    iterator: Iterator[Tuple[str, Element]],
) -> Iterator[Tuple[str, Element]]:
    """
    Map the :paramref:`iterator` such that the element is ``clear()``'ed
    *after* every ``yield``.

    :param iterator: to be mapped
    :yield: event and element from :paramref:`iterator`
    """
    for event, element in iterator:
        yield event, element
        element.clear()


[docs]def has_semantics_from_iterparse( iterator: Iterator[Tuple[str, Element]], ) -> our_types.HasSemantics: """ Read an instance of :py:class:`.types.HasSemantics` from the :paramref:`iterator`. Example usage: .. code-block:: import pathlib import xml.etree.ElementTree as ET import aas_core3_2.xmlization as our_xmlization path = pathlib.Path(...) with path.open("rt") as fid: iterator = ET.iterparse( source=fid, events=['start', 'end'] ) instance = our_xmlization.has_semantics_from_iterparse( iterator ) # Do something with the ``instance`` :param iterator: Input stream of ``(event, element)`` coming from :py:func:`xml.etree.ElementTree.iterparse` with the argument ``events=["start", "end"]`` :raise: :py:class:`DeserializationException` if unexpected input :return: Instance of :py:class:`.types.HasSemantics` read from :paramref:`iterator` """ return _read_instance_from_iterparse( iterator, _read_has_semantics_as_element, "HasSemantics" )
[docs]def has_semantics_from_stream( stream: TextIO, has_iterparse: HasIterparse = xml.etree.ElementTree ) -> our_types.HasSemantics: """ Read an instance of :py:class:`.types.HasSemantics` from the :paramref:`stream`. Example usage: .. code-block:: import aas_core3_2.xmlization as our_xmlization with open_some_stream_over_network(...) as stream: instance = our_xmlization.has_semantics_from_stream( stream ) # Do something with the ``instance`` :param stream: representing an instance of :py:class:`.types.HasSemantics` in XML :param has_iterparse: Module containing ``iterparse`` function. Default is to use :py:mod:`xml.etree.ElementTree` from the standard library. If you have to deal with malicious input, consider using a library such as `defusedxml.ElementTree`_. :raise: :py:class:`DeserializationException` if unexpected input :return: Instance of :py:class:`.types.HasSemantics` read from :paramref:`stream` """ iterator = has_iterparse.iterparse(stream, ["start", "end"]) return has_semantics_from_iterparse(_with_elements_cleared_after_yield(iterator))
[docs]def has_semantics_from_file( path: PathLike, has_iterparse: HasIterparse = xml.etree.ElementTree ) -> our_types.HasSemantics: """ Read an instance of :py:class:`.types.HasSemantics` from the :paramref:`path`. Example usage: .. code-block:: import pathlib import aas_core3_2.xmlization as our_xmlization path = pathlib.Path(...) instance = our_xmlization.has_semantics_from_file( path ) # Do something with the ``instance`` :param path: to the file representing an instance of :py:class:`.types.HasSemantics` in XML :param has_iterparse: Module containing ``iterparse`` function. Default is to use :py:mod:`xml.etree.ElementTree` from the standard library. If you have to deal with malicious input, consider using a library such as `defusedxml.ElementTree`_. :raise: :py:class:`DeserializationException` if unexpected input :return: Instance of :py:class:`.types.HasSemantics` read from :paramref:`path` """ with open(os.fspath(path), encoding="utf-8") as fid: iterator = has_iterparse.iterparse(fid, ["start", "end"]) return has_semantics_from_iterparse( _with_elements_cleared_after_yield(iterator) )
[docs]def has_semantics_from_str( text: str, has_iterparse: HasIterparse = xml.etree.ElementTree ) -> our_types.HasSemantics: """ Read an instance of :py:class:`.types.HasSemantics` from the :paramref:`text`. Example usage: .. code-block:: import pathlib import aas_core3_2.xmlization as our_xmlization text = "<...>...</...>" instance = our_xmlization.has_semantics_from_str( text ) # Do something with the ``instance`` :param text: representing an instance of :py:class:`.types.HasSemantics` in XML :param has_iterparse: Module containing ``iterparse`` function. Default is to use :py:mod:`xml.etree.ElementTree` from the standard library. If you have to deal with malicious input, consider using a library such as `defusedxml.ElementTree`_. :raise: :py:class:`DeserializationException` if unexpected input :return: Instance of :py:class:`.types.HasSemantics` read from :paramref:`text` """ iterator = has_iterparse.iterparse(io.StringIO(text), ["start", "end"]) return has_semantics_from_iterparse(_with_elements_cleared_after_yield(iterator))
[docs]def extension_from_iterparse( iterator: Iterator[Tuple[str, Element]], ) -> our_types.Extension: """ Read an instance of :py:class:`.types.Extension` from the :paramref:`iterator`. Example usage: .. code-block:: import pathlib import xml.etree.ElementTree as ET import aas_core3_2.xmlization as our_xmlization path = pathlib.Path(...) with path.open("rt") as fid: iterator = ET.iterparse( source=fid, events=['start', 'end'] ) instance = our_xmlization.extension_from_iterparse( iterator ) # Do something with the ``instance`` :param iterator: Input stream of ``(event, element)`` coming from :py:func:`xml.etree.ElementTree.iterparse` with the argument ``events=["start", "end"]`` :raise: :py:class:`DeserializationException` if unexpected input :return: Instance of :py:class:`.types.Extension` read from :paramref:`iterator` """ return _read_instance_from_iterparse( iterator, _read_extension_as_element, "Extension" )
[docs]def extension_from_stream( stream: TextIO, has_iterparse: HasIterparse = xml.etree.ElementTree ) -> our_types.Extension: """ Read an instance of :py:class:`.types.Extension` from the :paramref:`stream`. Example usage: .. code-block:: import aas_core3_2.xmlization as our_xmlization with open_some_stream_over_network(...) as stream: instance = our_xmlization.extension_from_stream( stream ) # Do something with the ``instance`` :param stream: representing an instance of :py:class:`.types.Extension` in XML :param has_iterparse: Module containing ``iterparse`` function. Default is to use :py:mod:`xml.etree.ElementTree` from the standard library. If you have to deal with malicious input, consider using a library such as `defusedxml.ElementTree`_. :raise: :py:class:`DeserializationException` if unexpected input :return: Instance of :py:class:`.types.Extension` read from :paramref:`stream` """ iterator = has_iterparse.iterparse(stream, ["start", "end"]) return extension_from_iterparse(_with_elements_cleared_after_yield(iterator))
[docs]def extension_from_file( path: PathLike, has_iterparse: HasIterparse = xml.etree.ElementTree ) -> our_types.Extension: """ Read an instance of :py:class:`.types.Extension` from the :paramref:`path`. Example usage: .. code-block:: import pathlib import aas_core3_2.xmlization as our_xmlization path = pathlib.Path(...) instance = our_xmlization.extension_from_file( path ) # Do something with the ``instance`` :param path: to the file representing an instance of :py:class:`.types.Extension` in XML :param has_iterparse: Module containing ``iterparse`` function. Default is to use :py:mod:`xml.etree.ElementTree` from the standard library. If you have to deal with malicious input, consider using a library such as `defusedxml.ElementTree`_. :raise: :py:class:`DeserializationException` if unexpected input :return: Instance of :py:class:`.types.Extension` read from :paramref:`path` """ with open(os.fspath(path), encoding="utf-8") as fid: iterator = has_iterparse.iterparse(fid, ["start", "end"]) return extension_from_iterparse(_with_elements_cleared_after_yield(iterator))
[docs]def extension_from_str( text: str, has_iterparse: HasIterparse = xml.etree.ElementTree ) -> our_types.Extension: """ Read an instance of :py:class:`.types.Extension` from the :paramref:`text`. Example usage: .. code-block:: import pathlib import aas_core3_2.xmlization as our_xmlization text = "<...>...</...>" instance = our_xmlization.extension_from_str( text ) # Do something with the ``instance`` :param text: representing an instance of :py:class:`.types.Extension` in XML :param has_iterparse: Module containing ``iterparse`` function. Default is to use :py:mod:`xml.etree.ElementTree` from the standard library. If you have to deal with malicious input, consider using a library such as `defusedxml.ElementTree`_. :raise: :py:class:`DeserializationException` if unexpected input :return: Instance of :py:class:`.types.Extension` read from :paramref:`text` """ iterator = has_iterparse.iterparse(io.StringIO(text), ["start", "end"]) return extension_from_iterparse(_with_elements_cleared_after_yield(iterator))
[docs]def has_extensions_from_iterparse( iterator: Iterator[Tuple[str, Element]], ) -> our_types.HasExtensions: """ Read an instance of :py:class:`.types.HasExtensions` from the :paramref:`iterator`. Example usage: .. code-block:: import pathlib import xml.etree.ElementTree as ET import aas_core3_2.xmlization as our_xmlization path = pathlib.Path(...) with path.open("rt") as fid: iterator = ET.iterparse( source=fid, events=['start', 'end'] ) instance = our_xmlization.has_extensions_from_iterparse( iterator ) # Do something with the ``instance`` :param iterator: Input stream of ``(event, element)`` coming from :py:func:`xml.etree.ElementTree.iterparse` with the argument ``events=["start", "end"]`` :raise: :py:class:`DeserializationException` if unexpected input :return: Instance of :py:class:`.types.HasExtensions` read from :paramref:`iterator` """ return _read_instance_from_iterparse( iterator, _read_has_extensions_as_element, "HasExtensions" )
[docs]def has_extensions_from_stream( stream: TextIO, has_iterparse: HasIterparse = xml.etree.ElementTree ) -> our_types.HasExtensions: """ Read an instance of :py:class:`.types.HasExtensions` from the :paramref:`stream`. Example usage: .. code-block:: import aas_core3_2.xmlization as our_xmlization with open_some_stream_over_network(...) as stream: instance = our_xmlization.has_extensions_from_stream( stream ) # Do something with the ``instance`` :param stream: representing an instance of :py:class:`.types.HasExtensions` in XML :param has_iterparse: Module containing ``iterparse`` function. Default is to use :py:mod:`xml.etree.ElementTree` from the standard library. If you have to deal with malicious input, consider using a library such as `defusedxml.ElementTree`_. :raise: :py:class:`DeserializationException` if unexpected input :return: Instance of :py:class:`.types.HasExtensions` read from :paramref:`stream` """ iterator = has_iterparse.iterparse(stream, ["start", "end"]) return has_extensions_from_iterparse(_with_elements_cleared_after_yield(iterator))
[docs]def has_extensions_from_file( path: PathLike, has_iterparse: HasIterparse = xml.etree.ElementTree ) -> our_types.HasExtensions: """ Read an instance of :py:class:`.types.HasExtensions` from the :paramref:`path`. Example usage: .. code-block:: import pathlib import aas_core3_2.xmlization as our_xmlization path = pathlib.Path(...) instance = our_xmlization.has_extensions_from_file( path ) # Do something with the ``instance`` :param path: to the file representing an instance of :py:class:`.types.HasExtensions` in XML :param has_iterparse: Module containing ``iterparse`` function. Default is to use :py:mod:`xml.etree.ElementTree` from the standard library. If you have to deal with malicious input, consider using a library such as `defusedxml.ElementTree`_. :raise: :py:class:`DeserializationException` if unexpected input :return: Instance of :py:class:`.types.HasExtensions` read from :paramref:`path` """ with open(os.fspath(path), encoding="utf-8") as fid: iterator = has_iterparse.iterparse(fid, ["start", "end"]) return has_extensions_from_iterparse( _with_elements_cleared_after_yield(iterator) )
[docs]def has_extensions_from_str( text: str, has_iterparse: HasIterparse = xml.etree.ElementTree ) -> our_types.HasExtensions: """ Read an instance of :py:class:`.types.HasExtensions` from the :paramref:`text`. Example usage: .. code-block:: import pathlib import aas_core3_2.xmlization as our_xmlization text = "<...>...</...>" instance = our_xmlization.has_extensions_from_str( text ) # Do something with the ``instance`` :param text: representing an instance of :py:class:`.types.HasExtensions` in XML :param has_iterparse: Module containing ``iterparse`` function. Default is to use :py:mod:`xml.etree.ElementTree` from the standard library. If you have to deal with malicious input, consider using a library such as `defusedxml.ElementTree`_. :raise: :py:class:`DeserializationException` if unexpected input :return: Instance of :py:class:`.types.HasExtensions` read from :paramref:`text` """ iterator = has_iterparse.iterparse(io.StringIO(text), ["start", "end"]) return has_extensions_from_iterparse(_with_elements_cleared_after_yield(iterator))
[docs]def referable_from_iterparse( iterator: Iterator[Tuple[str, Element]], ) -> our_types.Referable: """ Read an instance of :py:class:`.types.Referable` from the :paramref:`iterator`. Example usage: .. code-block:: import pathlib import xml.etree.ElementTree as ET import aas_core3_2.xmlization as our_xmlization path = pathlib.Path(...) with path.open("rt") as fid: iterator = ET.iterparse( source=fid, events=['start', 'end'] ) instance = our_xmlization.referable_from_iterparse( iterator ) # Do something with the ``instance`` :param iterator: Input stream of ``(event, element)`` coming from :py:func:`xml.etree.ElementTree.iterparse` with the argument ``events=["start", "end"]`` :raise: :py:class:`DeserializationException` if unexpected input :return: Instance of :py:class:`.types.Referable` read from :paramref:`iterator` """ return _read_instance_from_iterparse( iterator, _read_referable_as_element, "Referable" )
[docs]def referable_from_stream( stream: TextIO, has_iterparse: HasIterparse = xml.etree.ElementTree ) -> our_types.Referable: """ Read an instance of :py:class:`.types.Referable` from the :paramref:`stream`. Example usage: .. code-block:: import aas_core3_2.xmlization as our_xmlization with open_some_stream_over_network(...) as stream: instance = our_xmlization.referable_from_stream( stream ) # Do something with the ``instance`` :param stream: representing an instance of :py:class:`.types.Referable` in XML :param has_iterparse: Module containing ``iterparse`` function. Default is to use :py:mod:`xml.etree.ElementTree` from the standard library. If you have to deal with malicious input, consider using a library such as `defusedxml.ElementTree`_. :raise: :py:class:`DeserializationException` if unexpected input :return: Instance of :py:class:`.types.Referable` read from :paramref:`stream` """ iterator = has_iterparse.iterparse(stream, ["start", "end"]) return referable_from_iterparse(_with_elements_cleared_after_yield(iterator))
[docs]def referable_from_file( path: PathLike, has_iterparse: HasIterparse = xml.etree.ElementTree ) -> our_types.Referable: """ Read an instance of :py:class:`.types.Referable` from the :paramref:`path`. Example usage: .. code-block:: import pathlib import aas_core3_2.xmlization as our_xmlization path = pathlib.Path(...) instance = our_xmlization.referable_from_file( path ) # Do something with the ``instance`` :param path: to the file representing an instance of :py:class:`.types.Referable` in XML :param has_iterparse: Module containing ``iterparse`` function. Default is to use :py:mod:`xml.etree.ElementTree` from the standard library. If you have to deal with malicious input, consider using a library such as `defusedxml.ElementTree`_. :raise: :py:class:`DeserializationException` if unexpected input :return: Instance of :py:class:`.types.Referable` read from :paramref:`path` """ with open(os.fspath(path), encoding="utf-8") as fid: iterator = has_iterparse.iterparse(fid, ["start", "end"]) return referable_from_iterparse(_with_elements_cleared_after_yield(iterator))
[docs]def referable_from_str( text: str, has_iterparse: HasIterparse = xml.etree.ElementTree ) -> our_types.Referable: """ Read an instance of :py:class:`.types.Referable` from the :paramref:`text`. Example usage: .. code-block:: import pathlib import aas_core3_2.xmlization as our_xmlization text = "<...>...</...>" instance = our_xmlization.referable_from_str( text ) # Do something with the ``instance`` :param text: representing an instance of :py:class:`.types.Referable` in XML :param has_iterparse: Module containing ``iterparse`` function. Default is to use :py:mod:`xml.etree.ElementTree` from the standard library. If you have to deal with malicious input, consider using a library such as `defusedxml.ElementTree`_. :raise: :py:class:`DeserializationException` if unexpected input :return: Instance of :py:class:`.types.Referable` read from :paramref:`text` """ iterator = has_iterparse.iterparse(io.StringIO(text), ["start", "end"]) return referable_from_iterparse(_with_elements_cleared_after_yield(iterator))
[docs]def identifiable_from_iterparse( iterator: Iterator[Tuple[str, Element]], ) -> our_types.Identifiable: """ Read an instance of :py:class:`.types.Identifiable` from the :paramref:`iterator`. Example usage: .. code-block:: import pathlib import xml.etree.ElementTree as ET import aas_core3_2.xmlization as our_xmlization path = pathlib.Path(...) with path.open("rt") as fid: iterator = ET.iterparse( source=fid, events=['start', 'end'] ) instance = our_xmlization.identifiable_from_iterparse( iterator ) # Do something with the ``instance`` :param iterator: Input stream of ``(event, element)`` coming from :py:func:`xml.etree.ElementTree.iterparse` with the argument ``events=["start", "end"]`` :raise: :py:class:`DeserializationException` if unexpected input :return: Instance of :py:class:`.types.Identifiable` read from :paramref:`iterator` """ return _read_instance_from_iterparse( iterator, _read_identifiable_as_element, "Identifiable" )
[docs]def identifiable_from_stream( stream: TextIO, has_iterparse: HasIterparse = xml.etree.ElementTree ) -> our_types.Identifiable: """ Read an instance of :py:class:`.types.Identifiable` from the :paramref:`stream`. Example usage: .. code-block:: import aas_core3_2.xmlization as our_xmlization with open_some_stream_over_network(...) as stream: instance = our_xmlization.identifiable_from_stream( stream ) # Do something with the ``instance`` :param stream: representing an instance of :py:class:`.types.Identifiable` in XML :param has_iterparse: Module containing ``iterparse`` function. Default is to use :py:mod:`xml.etree.ElementTree` from the standard library. If you have to deal with malicious input, consider using a library such as `defusedxml.ElementTree`_. :raise: :py:class:`DeserializationException` if unexpected input :return: Instance of :py:class:`.types.Identifiable` read from :paramref:`stream` """ iterator = has_iterparse.iterparse(stream, ["start", "end"]) return identifiable_from_iterparse(_with_elements_cleared_after_yield(iterator))
[docs]def identifiable_from_file( path: PathLike, has_iterparse: HasIterparse = xml.etree.ElementTree ) -> our_types.Identifiable: """ Read an instance of :py:class:`.types.Identifiable` from the :paramref:`path`. Example usage: .. code-block:: import pathlib import aas_core3_2.xmlization as our_xmlization path = pathlib.Path(...) instance = our_xmlization.identifiable_from_file( path ) # Do something with the ``instance`` :param path: to the file representing an instance of :py:class:`.types.Identifiable` in XML :param has_iterparse: Module containing ``iterparse`` function. Default is to use :py:mod:`xml.etree.ElementTree` from the standard library. If you have to deal with malicious input, consider using a library such as `defusedxml.ElementTree`_. :raise: :py:class:`DeserializationException` if unexpected input :return: Instance of :py:class:`.types.Identifiable` read from :paramref:`path` """ with open(os.fspath(path), encoding="utf-8") as fid: iterator = has_iterparse.iterparse(fid, ["start", "end"]) return identifiable_from_iterparse(_with_elements_cleared_after_yield(iterator))
[docs]def identifiable_from_str( text: str, has_iterparse: HasIterparse = xml.etree.ElementTree ) -> our_types.Identifiable: """ Read an instance of :py:class:`.types.Identifiable` from the :paramref:`text`. Example usage: .. code-block:: import pathlib import aas_core3_2.xmlization as our_xmlization text = "<...>...</...>" instance = our_xmlization.identifiable_from_str( text ) # Do something with the ``instance`` :param text: representing an instance of :py:class:`.types.Identifiable` in XML :param has_iterparse: Module containing ``iterparse`` function. Default is to use :py:mod:`xml.etree.ElementTree` from the standard library. If you have to deal with malicious input, consider using a library such as `defusedxml.ElementTree`_. :raise: :py:class:`DeserializationException` if unexpected input :return: Instance of :py:class:`.types.Identifiable` read from :paramref:`text` """ iterator = has_iterparse.iterparse(io.StringIO(text), ["start", "end"]) return identifiable_from_iterparse(_with_elements_cleared_after_yield(iterator))
[docs]def has_kind_from_iterparse( iterator: Iterator[Tuple[str, Element]], ) -> our_types.HasKind: """ Read an instance of :py:class:`.types.HasKind` from the :paramref:`iterator`. Example usage: .. code-block:: import pathlib import xml.etree.ElementTree as ET import aas_core3_2.xmlization as our_xmlization path = pathlib.Path(...) with path.open("rt") as fid: iterator = ET.iterparse( source=fid, events=['start', 'end'] ) instance = our_xmlization.has_kind_from_iterparse( iterator ) # Do something with the ``instance`` :param iterator: Input stream of ``(event, element)`` coming from :py:func:`xml.etree.ElementTree.iterparse` with the argument ``events=["start", "end"]`` :raise: :py:class:`DeserializationException` if unexpected input :return: Instance of :py:class:`.types.HasKind` read from :paramref:`iterator` """ return _read_instance_from_iterparse(iterator, _read_has_kind_as_element, "HasKind")
[docs]def has_kind_from_stream( stream: TextIO, has_iterparse: HasIterparse = xml.etree.ElementTree ) -> our_types.HasKind: """ Read an instance of :py:class:`.types.HasKind` from the :paramref:`stream`. Example usage: .. code-block:: import aas_core3_2.xmlization as our_xmlization with open_some_stream_over_network(...) as stream: instance = our_xmlization.has_kind_from_stream( stream ) # Do something with the ``instance`` :param stream: representing an instance of :py:class:`.types.HasKind` in XML :param has_iterparse: Module containing ``iterparse`` function. Default is to use :py:mod:`xml.etree.ElementTree` from the standard library. If you have to deal with malicious input, consider using a library such as `defusedxml.ElementTree`_. :raise: :py:class:`DeserializationException` if unexpected input :return: Instance of :py:class:`.types.HasKind` read from :paramref:`stream` """ iterator = has_iterparse.iterparse(stream, ["start", "end"]) return has_kind_from_iterparse(_with_elements_cleared_after_yield(iterator))
[docs]def has_kind_from_file( path: PathLike, has_iterparse: HasIterparse = xml.etree.ElementTree ) -> our_types.HasKind: """ Read an instance of :py:class:`.types.HasKind` from the :paramref:`path`. Example usage: .. code-block:: import pathlib import aas_core3_2.xmlization as our_xmlization path = pathlib.Path(...) instance = our_xmlization.has_kind_from_file( path ) # Do something with the ``instance`` :param path: to the file representing an instance of :py:class:`.types.HasKind` in XML :param has_iterparse: Module containing ``iterparse`` function. Default is to use :py:mod:`xml.etree.ElementTree` from the standard library. If you have to deal with malicious input, consider using a library such as `defusedxml.ElementTree`_. :raise: :py:class:`DeserializationException` if unexpected input :return: Instance of :py:class:`.types.HasKind` read from :paramref:`path` """ with open(os.fspath(path), encoding="utf-8") as fid: iterator = has_iterparse.iterparse(fid, ["start", "end"]) return has_kind_from_iterparse(_with_elements_cleared_after_yield(iterator))
[docs]def has_kind_from_str( text: str, has_iterparse: HasIterparse = xml.etree.ElementTree ) -> our_types.HasKind: """ Read an instance of :py:class:`.types.HasKind` from the :paramref:`text`. Example usage: .. code-block:: import pathlib import aas_core3_2.xmlization as our_xmlization text = "<...>...</...>" instance = our_xmlization.has_kind_from_str( text ) # Do something with the ``instance`` :param text: representing an instance of :py:class:`.types.HasKind` in XML :param has_iterparse: Module containing ``iterparse`` function. Default is to use :py:mod:`xml.etree.ElementTree` from the standard library. If you have to deal with malicious input, consider using a library such as `defusedxml.ElementTree`_. :raise: :py:class:`DeserializationException` if unexpected input :return: Instance of :py:class:`.types.HasKind` read from :paramref:`text` """ iterator = has_iterparse.iterparse(io.StringIO(text), ["start", "end"]) return has_kind_from_iterparse(_with_elements_cleared_after_yield(iterator))
[docs]def has_data_specification_from_iterparse( iterator: Iterator[Tuple[str, Element]], ) -> our_types.HasDataSpecification: """ Read an instance of :py:class:`.types.HasDataSpecification` from the :paramref:`iterator`. Example usage: .. code-block:: import pathlib import xml.etree.ElementTree as ET import aas_core3_2.xmlization as our_xmlization path = pathlib.Path(...) with path.open("rt") as fid: iterator = ET.iterparse( source=fid, events=['start', 'end'] ) instance = our_xmlization.has_data_specification_from_iterparse( iterator ) # Do something with the ``instance`` :param iterator: Input stream of ``(event, element)`` coming from :py:func:`xml.etree.ElementTree.iterparse` with the argument ``events=["start", "end"]`` :raise: :py:class:`DeserializationException` if unexpected input :return: Instance of :py:class:`.types.HasDataSpecification` read from :paramref:`iterator` """ return _read_instance_from_iterparse( iterator, _read_has_data_specification_as_element, "HasDataSpecification" )
[docs]def has_data_specification_from_stream( stream: TextIO, has_iterparse: HasIterparse = xml.etree.ElementTree ) -> our_types.HasDataSpecification: """ Read an instance of :py:class:`.types.HasDataSpecification` from the :paramref:`stream`. Example usage: .. code-block:: import aas_core3_2.xmlization as our_xmlization with open_some_stream_over_network(...) as stream: instance = our_xmlization.has_data_specification_from_stream( stream ) # Do something with the ``instance`` :param stream: representing an instance of :py:class:`.types.HasDataSpecification` in XML :param has_iterparse: Module containing ``iterparse`` function. Default is to use :py:mod:`xml.etree.ElementTree` from the standard library. If you have to deal with malicious input, consider using a library such as `defusedxml.ElementTree`_. :raise: :py:class:`DeserializationException` if unexpected input :return: Instance of :py:class:`.types.HasDataSpecification` read from :paramref:`stream` """ iterator = has_iterparse.iterparse(stream, ["start", "end"]) return has_data_specification_from_iterparse( _with_elements_cleared_after_yield(iterator) )
[docs]def has_data_specification_from_file( path: PathLike, has_iterparse: HasIterparse = xml.etree.ElementTree ) -> our_types.HasDataSpecification: """ Read an instance of :py:class:`.types.HasDataSpecification` from the :paramref:`path`. Example usage: .. code-block:: import pathlib import aas_core3_2.xmlization as our_xmlization path = pathlib.Path(...) instance = our_xmlization.has_data_specification_from_file( path ) # Do something with the ``instance`` :param path: to the file representing an instance of :py:class:`.types.HasDataSpecification` in XML :param has_iterparse: Module containing ``iterparse`` function. Default is to use :py:mod:`xml.etree.ElementTree` from the standard library. If you have to deal with malicious input, consider using a library such as `defusedxml.ElementTree`_. :raise: :py:class:`DeserializationException` if unexpected input :return: Instance of :py:class:`.types.HasDataSpecification` read from :paramref:`path` """ with open(os.fspath(path), encoding="utf-8") as fid: iterator = has_iterparse.iterparse(fid, ["start", "end"]) return has_data_specification_from_iterparse( _with_elements_cleared_after_yield(iterator) )
[docs]def has_data_specification_from_str( text: str, has_iterparse: HasIterparse = xml.etree.ElementTree ) -> our_types.HasDataSpecification: """ Read an instance of :py:class:`.types.HasDataSpecification` from the :paramref:`text`. Example usage: .. code-block:: import pathlib import aas_core3_2.xmlization as our_xmlization text = "<...>...</...>" instance = our_xmlization.has_data_specification_from_str( text ) # Do something with the ``instance`` :param text: representing an instance of :py:class:`.types.HasDataSpecification` in XML :param has_iterparse: Module containing ``iterparse`` function. Default is to use :py:mod:`xml.etree.ElementTree` from the standard library. If you have to deal with malicious input, consider using a library such as `defusedxml.ElementTree`_. :raise: :py:class:`DeserializationException` if unexpected input :return: Instance of :py:class:`.types.HasDataSpecification` read from :paramref:`text` """ iterator = has_iterparse.iterparse(io.StringIO(text), ["start", "end"]) return has_data_specification_from_iterparse( _with_elements_cleared_after_yield(iterator) )
[docs]def administrative_information_from_iterparse( iterator: Iterator[Tuple[str, Element]], ) -> our_types.AdministrativeInformation: """ Read an instance of :py:class:`.types.AdministrativeInformation` from the :paramref:`iterator`. Example usage: .. code-block:: import pathlib import xml.etree.ElementTree as ET import aas_core3_2.xmlization as our_xmlization path = pathlib.Path(...) with path.open("rt") as fid: iterator = ET.iterparse( source=fid, events=['start', 'end'] ) instance = our_xmlization.administrative_information_from_iterparse( iterator ) # Do something with the ``instance`` :param iterator: Input stream of ``(event, element)`` coming from :py:func:`xml.etree.ElementTree.iterparse` with the argument ``events=["start", "end"]`` :raise: :py:class:`DeserializationException` if unexpected input :return: Instance of :py:class:`.types.AdministrativeInformation` read from :paramref:`iterator` """ return _read_instance_from_iterparse( iterator, _read_administrative_information_as_element, "AdministrativeInformation", )
[docs]def administrative_information_from_stream( stream: TextIO, has_iterparse: HasIterparse = xml.etree.ElementTree ) -> our_types.AdministrativeInformation: """ Read an instance of :py:class:`.types.AdministrativeInformation` from the :paramref:`stream`. Example usage: .. code-block:: import aas_core3_2.xmlization as our_xmlization with open_some_stream_over_network(...) as stream: instance = our_xmlization.administrative_information_from_stream( stream ) # Do something with the ``instance`` :param stream: representing an instance of :py:class:`.types.AdministrativeInformation` in XML :param has_iterparse: Module containing ``iterparse`` function. Default is to use :py:mod:`xml.etree.ElementTree` from the standard library. If you have to deal with malicious input, consider using a library such as `defusedxml.ElementTree`_. :raise: :py:class:`DeserializationException` if unexpected input :return: Instance of :py:class:`.types.AdministrativeInformation` read from :paramref:`stream` """ iterator = has_iterparse.iterparse(stream, ["start", "end"]) return administrative_information_from_iterparse( _with_elements_cleared_after_yield(iterator) )
[docs]def administrative_information_from_file( path: PathLike, has_iterparse: HasIterparse = xml.etree.ElementTree ) -> our_types.AdministrativeInformation: """ Read an instance of :py:class:`.types.AdministrativeInformation` from the :paramref:`path`. Example usage: .. code-block:: import pathlib import aas_core3_2.xmlization as our_xmlization path = pathlib.Path(...) instance = our_xmlization.administrative_information_from_file( path ) # Do something with the ``instance`` :param path: to the file representing an instance of :py:class:`.types.AdministrativeInformation` in XML :param has_iterparse: Module containing ``iterparse`` function. Default is to use :py:mod:`xml.etree.ElementTree` from the standard library. If you have to deal with malicious input, consider using a library such as `defusedxml.ElementTree`_. :raise: :py:class:`DeserializationException` if unexpected input :return: Instance of :py:class:`.types.AdministrativeInformation` read from :paramref:`path` """ with open(os.fspath(path), encoding="utf-8") as fid: iterator = has_iterparse.iterparse(fid, ["start", "end"]) return administrative_information_from_iterparse( _with_elements_cleared_after_yield(iterator) )
[docs]def administrative_information_from_str( text: str, has_iterparse: HasIterparse = xml.etree.ElementTree ) -> our_types.AdministrativeInformation: """ Read an instance of :py:class:`.types.AdministrativeInformation` from the :paramref:`text`. Example usage: .. code-block:: import pathlib import aas_core3_2.xmlization as our_xmlization text = "<...>...</...>" instance = our_xmlization.administrative_information_from_str( text ) # Do something with the ``instance`` :param text: representing an instance of :py:class:`.types.AdministrativeInformation` in XML :param has_iterparse: Module containing ``iterparse`` function. Default is to use :py:mod:`xml.etree.ElementTree` from the standard library. If you have to deal with malicious input, consider using a library such as `defusedxml.ElementTree`_. :raise: :py:class:`DeserializationException` if unexpected input :return: Instance of :py:class:`.types.AdministrativeInformation` read from :paramref:`text` """ iterator = has_iterparse.iterparse(io.StringIO(text), ["start", "end"]) return administrative_information_from_iterparse( _with_elements_cleared_after_yield(iterator) )
[docs]def qualifiable_from_iterparse( iterator: Iterator[Tuple[str, Element]], ) -> our_types.Qualifiable: """ Read an instance of :py:class:`.types.Qualifiable` from the :paramref:`iterator`. Example usage: .. code-block:: import pathlib import xml.etree.ElementTree as ET import aas_core3_2.xmlization as our_xmlization path = pathlib.Path(...) with path.open("rt") as fid: iterator = ET.iterparse( source=fid, events=['start', 'end'] ) instance = our_xmlization.qualifiable_from_iterparse( iterator ) # Do something with the ``instance`` :param iterator: Input stream of ``(event, element)`` coming from :py:func:`xml.etree.ElementTree.iterparse` with the argument ``events=["start", "end"]`` :raise: :py:class:`DeserializationException` if unexpected input :return: Instance of :py:class:`.types.Qualifiable` read from :paramref:`iterator` """ return _read_instance_from_iterparse( iterator, _read_qualifiable_as_element, "Qualifiable" )
[docs]def qualifiable_from_stream( stream: TextIO, has_iterparse: HasIterparse = xml.etree.ElementTree ) -> our_types.Qualifiable: """ Read an instance of :py:class:`.types.Qualifiable` from the :paramref:`stream`. Example usage: .. code-block:: import aas_core3_2.xmlization as our_xmlization with open_some_stream_over_network(...) as stream: instance = our_xmlization.qualifiable_from_stream( stream ) # Do something with the ``instance`` :param stream: representing an instance of :py:class:`.types.Qualifiable` in XML :param has_iterparse: Module containing ``iterparse`` function. Default is to use :py:mod:`xml.etree.ElementTree` from the standard library. If you have to deal with malicious input, consider using a library such as `defusedxml.ElementTree`_. :raise: :py:class:`DeserializationException` if unexpected input :return: Instance of :py:class:`.types.Qualifiable` read from :paramref:`stream` """ iterator = has_iterparse.iterparse(stream, ["start", "end"]) return qualifiable_from_iterparse(_with_elements_cleared_after_yield(iterator))
[docs]def qualifiable_from_file( path: PathLike, has_iterparse: HasIterparse = xml.etree.ElementTree ) -> our_types.Qualifiable: """ Read an instance of :py:class:`.types.Qualifiable` from the :paramref:`path`. Example usage: .. code-block:: import pathlib import aas_core3_2.xmlization as our_xmlization path = pathlib.Path(...) instance = our_xmlization.qualifiable_from_file( path ) # Do something with the ``instance`` :param path: to the file representing an instance of :py:class:`.types.Qualifiable` in XML :param has_iterparse: Module containing ``iterparse`` function. Default is to use :py:mod:`xml.etree.ElementTree` from the standard library. If you have to deal with malicious input, consider using a library such as `defusedxml.ElementTree`_. :raise: :py:class:`DeserializationException` if unexpected input :return: Instance of :py:class:`.types.Qualifiable` read from :paramref:`path` """ with open(os.fspath(path), encoding="utf-8") as fid: iterator = has_iterparse.iterparse(fid, ["start", "end"]) return qualifiable_from_iterparse(_with_elements_cleared_after_yield(iterator))
[docs]def qualifiable_from_str( text: str, has_iterparse: HasIterparse = xml.etree.ElementTree ) -> our_types.Qualifiable: """ Read an instance of :py:class:`.types.Qualifiable` from the :paramref:`text`. Example usage: .. code-block:: import pathlib import aas_core3_2.xmlization as our_xmlization text = "<...>...</...>" instance = our_xmlization.qualifiable_from_str( text ) # Do something with the ``instance`` :param text: representing an instance of :py:class:`.types.Qualifiable` in XML :param has_iterparse: Module containing ``iterparse`` function. Default is to use :py:mod:`xml.etree.ElementTree` from the standard library. If you have to deal with malicious input, consider using a library such as `defusedxml.ElementTree`_. :raise: :py:class:`DeserializationException` if unexpected input :return: Instance of :py:class:`.types.Qualifiable` read from :paramref:`text` """ iterator = has_iterparse.iterparse(io.StringIO(text), ["start", "end"]) return qualifiable_from_iterparse(_with_elements_cleared_after_yield(iterator))
[docs]def qualifier_from_iterparse( iterator: Iterator[Tuple[str, Element]], ) -> our_types.Qualifier: """ Read an instance of :py:class:`.types.Qualifier` from the :paramref:`iterator`. Example usage: .. code-block:: import pathlib import xml.etree.ElementTree as ET import aas_core3_2.xmlization as our_xmlization path = pathlib.Path(...) with path.open("rt") as fid: iterator = ET.iterparse( source=fid, events=['start', 'end'] ) instance = our_xmlization.qualifier_from_iterparse( iterator ) # Do something with the ``instance`` :param iterator: Input stream of ``(event, element)`` coming from :py:func:`xml.etree.ElementTree.iterparse` with the argument ``events=["start", "end"]`` :raise: :py:class:`DeserializationException` if unexpected input :return: Instance of :py:class:`.types.Qualifier` read from :paramref:`iterator` """ return _read_instance_from_iterparse( iterator, _read_qualifier_as_element, "Qualifier" )
[docs]def qualifier_from_stream( stream: TextIO, has_iterparse: HasIterparse = xml.etree.ElementTree ) -> our_types.Qualifier: """ Read an instance of :py:class:`.types.Qualifier` from the :paramref:`stream`. Example usage: .. code-block:: import aas_core3_2.xmlization as our_xmlization with open_some_stream_over_network(...) as stream: instance = our_xmlization.qualifier_from_stream( stream ) # Do something with the ``instance`` :param stream: representing an instance of :py:class:`.types.Qualifier` in XML :param has_iterparse: Module containing ``iterparse`` function. Default is to use :py:mod:`xml.etree.ElementTree` from the standard library. If you have to deal with malicious input, consider using a library such as `defusedxml.ElementTree`_. :raise: :py:class:`DeserializationException` if unexpected input :return: Instance of :py:class:`.types.Qualifier` read from :paramref:`stream` """ iterator = has_iterparse.iterparse(stream, ["start", "end"]) return qualifier_from_iterparse(_with_elements_cleared_after_yield(iterator))
[docs]def qualifier_from_file( path: PathLike, has_iterparse: HasIterparse = xml.etree.ElementTree ) -> our_types.Qualifier: """ Read an instance of :py:class:`.types.Qualifier` from the :paramref:`path`. Example usage: .. code-block:: import pathlib import aas_core3_2.xmlization as our_xmlization path = pathlib.Path(...) instance = our_xmlization.qualifier_from_file( path ) # Do something with the ``instance`` :param path: to the file representing an instance of :py:class:`.types.Qualifier` in XML :param has_iterparse: Module containing ``iterparse`` function. Default is to use :py:mod:`xml.etree.ElementTree` from the standard library. If you have to deal with malicious input, consider using a library such as `defusedxml.ElementTree`_. :raise: :py:class:`DeserializationException` if unexpected input :return: Instance of :py:class:`.types.Qualifier` read from :paramref:`path` """ with open(os.fspath(path), encoding="utf-8") as fid: iterator = has_iterparse.iterparse(fid, ["start", "end"]) return qualifier_from_iterparse(_with_elements_cleared_after_yield(iterator))
[docs]def qualifier_from_str( text: str, has_iterparse: HasIterparse = xml.etree.ElementTree ) -> our_types.Qualifier: """ Read an instance of :py:class:`.types.Qualifier` from the :paramref:`text`. Example usage: .. code-block:: import pathlib import aas_core3_2.xmlization as our_xmlization text = "<...>...</...>" instance = our_xmlization.qualifier_from_str( text ) # Do something with the ``instance`` :param text: representing an instance of :py:class:`.types.Qualifier` in XML :param has_iterparse: Module containing ``iterparse`` function. Default is to use :py:mod:`xml.etree.ElementTree` from the standard library. If you have to deal with malicious input, consider using a library such as `defusedxml.ElementTree`_. :raise: :py:class:`DeserializationException` if unexpected input :return: Instance of :py:class:`.types.Qualifier` read from :paramref:`text` """ iterator = has_iterparse.iterparse(io.StringIO(text), ["start", "end"]) return qualifier_from_iterparse(_with_elements_cleared_after_yield(iterator))
[docs]def asset_administration_shell_from_iterparse( iterator: Iterator[Tuple[str, Element]], ) -> our_types.AssetAdministrationShell: """ Read an instance of :py:class:`.types.AssetAdministrationShell` from the :paramref:`iterator`. Example usage: .. code-block:: import pathlib import xml.etree.ElementTree as ET import aas_core3_2.xmlization as our_xmlization path = pathlib.Path(...) with path.open("rt") as fid: iterator = ET.iterparse( source=fid, events=['start', 'end'] ) instance = our_xmlization.asset_administration_shell_from_iterparse( iterator ) # Do something with the ``instance`` :param iterator: Input stream of ``(event, element)`` coming from :py:func:`xml.etree.ElementTree.iterparse` with the argument ``events=["start", "end"]`` :raise: :py:class:`DeserializationException` if unexpected input :return: Instance of :py:class:`.types.AssetAdministrationShell` read from :paramref:`iterator` """ return _read_instance_from_iterparse( iterator, _read_asset_administration_shell_as_element, "AssetAdministrationShell", )
[docs]def asset_administration_shell_from_stream( stream: TextIO, has_iterparse: HasIterparse = xml.etree.ElementTree ) -> our_types.AssetAdministrationShell: """ Read an instance of :py:class:`.types.AssetAdministrationShell` from the :paramref:`stream`. Example usage: .. code-block:: import aas_core3_2.xmlization as our_xmlization with open_some_stream_over_network(...) as stream: instance = our_xmlization.asset_administration_shell_from_stream( stream ) # Do something with the ``instance`` :param stream: representing an instance of :py:class:`.types.AssetAdministrationShell` in XML :param has_iterparse: Module containing ``iterparse`` function. Default is to use :py:mod:`xml.etree.ElementTree` from the standard library. If you have to deal with malicious input, consider using a library such as `defusedxml.ElementTree`_. :raise: :py:class:`DeserializationException` if unexpected input :return: Instance of :py:class:`.types.AssetAdministrationShell` read from :paramref:`stream` """ iterator = has_iterparse.iterparse(stream, ["start", "end"]) return asset_administration_shell_from_iterparse( _with_elements_cleared_after_yield(iterator) )
[docs]def asset_administration_shell_from_file( path: PathLike, has_iterparse: HasIterparse = xml.etree.ElementTree ) -> our_types.AssetAdministrationShell: """ Read an instance of :py:class:`.types.AssetAdministrationShell` from the :paramref:`path`. Example usage: .. code-block:: import pathlib import aas_core3_2.xmlization as our_xmlization path = pathlib.Path(...) instance = our_xmlization.asset_administration_shell_from_file( path ) # Do something with the ``instance`` :param path: to the file representing an instance of :py:class:`.types.AssetAdministrationShell` in XML :param has_iterparse: Module containing ``iterparse`` function. Default is to use :py:mod:`xml.etree.ElementTree` from the standard library. If you have to deal with malicious input, consider using a library such as `defusedxml.ElementTree`_. :raise: :py:class:`DeserializationException` if unexpected input :return: Instance of :py:class:`.types.AssetAdministrationShell` read from :paramref:`path` """ with open(os.fspath(path), encoding="utf-8") as fid: iterator = has_iterparse.iterparse(fid, ["start", "end"]) return asset_administration_shell_from_iterparse( _with_elements_cleared_after_yield(iterator) )
[docs]def asset_administration_shell_from_str( text: str, has_iterparse: HasIterparse = xml.etree.ElementTree ) -> our_types.AssetAdministrationShell: """ Read an instance of :py:class:`.types.AssetAdministrationShell` from the :paramref:`text`. Example usage: .. code-block:: import pathlib import aas_core3_2.xmlization as our_xmlization text = "<...>...</...>" instance = our_xmlization.asset_administration_shell_from_str( text ) # Do something with the ``instance`` :param text: representing an instance of :py:class:`.types.AssetAdministrationShell` in XML :param has_iterparse: Module containing ``iterparse`` function. Default is to use :py:mod:`xml.etree.ElementTree` from the standard library. If you have to deal with malicious input, consider using a library such as `defusedxml.ElementTree`_. :raise: :py:class:`DeserializationException` if unexpected input :return: Instance of :py:class:`.types.AssetAdministrationShell` read from :paramref:`text` """ iterator = has_iterparse.iterparse(io.StringIO(text), ["start", "end"]) return asset_administration_shell_from_iterparse( _with_elements_cleared_after_yield(iterator) )
[docs]def asset_information_from_iterparse( iterator: Iterator[Tuple[str, Element]], ) -> our_types.AssetInformation: """ Read an instance of :py:class:`.types.AssetInformation` from the :paramref:`iterator`. Example usage: .. code-block:: import pathlib import xml.etree.ElementTree as ET import aas_core3_2.xmlization as our_xmlization path = pathlib.Path(...) with path.open("rt") as fid: iterator = ET.iterparse( source=fid, events=['start', 'end'] ) instance = our_xmlization.asset_information_from_iterparse( iterator ) # Do something with the ``instance`` :param iterator: Input stream of ``(event, element)`` coming from :py:func:`xml.etree.ElementTree.iterparse` with the argument ``events=["start", "end"]`` :raise: :py:class:`DeserializationException` if unexpected input :return: Instance of :py:class:`.types.AssetInformation` read from :paramref:`iterator` """ return _read_instance_from_iterparse( iterator, _read_asset_information_as_element, "AssetInformation" )
[docs]def asset_information_from_stream( stream: TextIO, has_iterparse: HasIterparse = xml.etree.ElementTree ) -> our_types.AssetInformation: """ Read an instance of :py:class:`.types.AssetInformation` from the :paramref:`stream`. Example usage: .. code-block:: import aas_core3_2.xmlization as our_xmlization with open_some_stream_over_network(...) as stream: instance = our_xmlization.asset_information_from_stream( stream ) # Do something with the ``instance`` :param stream: representing an instance of :py:class:`.types.AssetInformation` in XML :param has_iterparse: Module containing ``iterparse`` function. Default is to use :py:mod:`xml.etree.ElementTree` from the standard library. If you have to deal with malicious input, consider using a library such as `defusedxml.ElementTree`_. :raise: :py:class:`DeserializationException` if unexpected input :return: Instance of :py:class:`.types.AssetInformation` read from :paramref:`stream` """ iterator = has_iterparse.iterparse(stream, ["start", "end"]) return asset_information_from_iterparse( _with_elements_cleared_after_yield(iterator) )
[docs]def asset_information_from_file( path: PathLike, has_iterparse: HasIterparse = xml.etree.ElementTree ) -> our_types.AssetInformation: """ Read an instance of :py:class:`.types.AssetInformation` from the :paramref:`path`. Example usage: .. code-block:: import pathlib import aas_core3_2.xmlization as our_xmlization path = pathlib.Path(...) instance = our_xmlization.asset_information_from_file( path ) # Do something with the ``instance`` :param path: to the file representing an instance of :py:class:`.types.AssetInformation` in XML :param has_iterparse: Module containing ``iterparse`` function. Default is to use :py:mod:`xml.etree.ElementTree` from the standard library. If you have to deal with malicious input, consider using a library such as `defusedxml.ElementTree`_. :raise: :py:class:`DeserializationException` if unexpected input :return: Instance of :py:class:`.types.AssetInformation` read from :paramref:`path` """ with open(os.fspath(path), encoding="utf-8") as fid: iterator = has_iterparse.iterparse(fid, ["start", "end"]) return asset_information_from_iterparse( _with_elements_cleared_after_yield(iterator) )
[docs]def asset_information_from_str( text: str, has_iterparse: HasIterparse = xml.etree.ElementTree ) -> our_types.AssetInformation: """ Read an instance of :py:class:`.types.AssetInformation` from the :paramref:`text`. Example usage: .. code-block:: import pathlib import aas_core3_2.xmlization as our_xmlization text = "<...>...</...>" instance = our_xmlization.asset_information_from_str( text ) # Do something with the ``instance`` :param text: representing an instance of :py:class:`.types.AssetInformation` in XML :param has_iterparse: Module containing ``iterparse`` function. Default is to use :py:mod:`xml.etree.ElementTree` from the standard library. If you have to deal with malicious input, consider using a library such as `defusedxml.ElementTree`_. :raise: :py:class:`DeserializationException` if unexpected input :return: Instance of :py:class:`.types.AssetInformation` read from :paramref:`text` """ iterator = has_iterparse.iterparse(io.StringIO(text), ["start", "end"]) return asset_information_from_iterparse( _with_elements_cleared_after_yield(iterator) )
[docs]def resource_from_iterparse( iterator: Iterator[Tuple[str, Element]], ) -> our_types.Resource: """ Read an instance of :py:class:`.types.Resource` from the :paramref:`iterator`. Example usage: .. code-block:: import pathlib import xml.etree.ElementTree as ET import aas_core3_2.xmlization as our_xmlization path = pathlib.Path(...) with path.open("rt") as fid: iterator = ET.iterparse( source=fid, events=['start', 'end'] ) instance = our_xmlization.resource_from_iterparse( iterator ) # Do something with the ``instance`` :param iterator: Input stream of ``(event, element)`` coming from :py:func:`xml.etree.ElementTree.iterparse` with the argument ``events=["start", "end"]`` :raise: :py:class:`DeserializationException` if unexpected input :return: Instance of :py:class:`.types.Resource` read from :paramref:`iterator` """ return _read_instance_from_iterparse( iterator, _read_resource_as_element, "Resource" )
[docs]def resource_from_stream( stream: TextIO, has_iterparse: HasIterparse = xml.etree.ElementTree ) -> our_types.Resource: """ Read an instance of :py:class:`.types.Resource` from the :paramref:`stream`. Example usage: .. code-block:: import aas_core3_2.xmlization as our_xmlization with open_some_stream_over_network(...) as stream: instance = our_xmlization.resource_from_stream( stream ) # Do something with the ``instance`` :param stream: representing an instance of :py:class:`.types.Resource` in XML :param has_iterparse: Module containing ``iterparse`` function. Default is to use :py:mod:`xml.etree.ElementTree` from the standard library. If you have to deal with malicious input, consider using a library such as `defusedxml.ElementTree`_. :raise: :py:class:`DeserializationException` if unexpected input :return: Instance of :py:class:`.types.Resource` read from :paramref:`stream` """ iterator = has_iterparse.iterparse(stream, ["start", "end"]) return resource_from_iterparse(_with_elements_cleared_after_yield(iterator))
[docs]def resource_from_file( path: PathLike, has_iterparse: HasIterparse = xml.etree.ElementTree ) -> our_types.Resource: """ Read an instance of :py:class:`.types.Resource` from the :paramref:`path`. Example usage: .. code-block:: import pathlib import aas_core3_2.xmlization as our_xmlization path = pathlib.Path(...) instance = our_xmlization.resource_from_file( path ) # Do something with the ``instance`` :param path: to the file representing an instance of :py:class:`.types.Resource` in XML :param has_iterparse: Module containing ``iterparse`` function. Default is to use :py:mod:`xml.etree.ElementTree` from the standard library. If you have to deal with malicious input, consider using a library such as `defusedxml.ElementTree`_. :raise: :py:class:`DeserializationException` if unexpected input :return: Instance of :py:class:`.types.Resource` read from :paramref:`path` """ with open(os.fspath(path), encoding="utf-8") as fid: iterator = has_iterparse.iterparse(fid, ["start", "end"]) return resource_from_iterparse(_with_elements_cleared_after_yield(iterator))
[docs]def resource_from_str( text: str, has_iterparse: HasIterparse = xml.etree.ElementTree ) -> our_types.Resource: """ Read an instance of :py:class:`.types.Resource` from the :paramref:`text`. Example usage: .. code-block:: import pathlib import aas_core3_2.xmlization as our_xmlization text = "<...>...</...>" instance = our_xmlization.resource_from_str( text ) # Do something with the ``instance`` :param text: representing an instance of :py:class:`.types.Resource` in XML :param has_iterparse: Module containing ``iterparse`` function. Default is to use :py:mod:`xml.etree.ElementTree` from the standard library. If you have to deal with malicious input, consider using a library such as `defusedxml.ElementTree`_. :raise: :py:class:`DeserializationException` if unexpected input :return: Instance of :py:class:`.types.Resource` read from :paramref:`text` """ iterator = has_iterparse.iterparse(io.StringIO(text), ["start", "end"]) return resource_from_iterparse(_with_elements_cleared_after_yield(iterator))
[docs]def specific_asset_id_from_iterparse( iterator: Iterator[Tuple[str, Element]], ) -> our_types.SpecificAssetID: """ Read an instance of :py:class:`.types.SpecificAssetID` from the :paramref:`iterator`. Example usage: .. code-block:: import pathlib import xml.etree.ElementTree as ET import aas_core3_2.xmlization as our_xmlization path = pathlib.Path(...) with path.open("rt") as fid: iterator = ET.iterparse( source=fid, events=['start', 'end'] ) instance = our_xmlization.specific_asset_id_from_iterparse( iterator ) # Do something with the ``instance`` :param iterator: Input stream of ``(event, element)`` coming from :py:func:`xml.etree.ElementTree.iterparse` with the argument ``events=["start", "end"]`` :raise: :py:class:`DeserializationException` if unexpected input :return: Instance of :py:class:`.types.SpecificAssetID` read from :paramref:`iterator` """ return _read_instance_from_iterparse( iterator, _read_specific_asset_id_as_element, "SpecificAssetID" )
[docs]def specific_asset_id_from_stream( stream: TextIO, has_iterparse: HasIterparse = xml.etree.ElementTree ) -> our_types.SpecificAssetID: """ Read an instance of :py:class:`.types.SpecificAssetID` from the :paramref:`stream`. Example usage: .. code-block:: import aas_core3_2.xmlization as our_xmlization with open_some_stream_over_network(...) as stream: instance = our_xmlization.specific_asset_id_from_stream( stream ) # Do something with the ``instance`` :param stream: representing an instance of :py:class:`.types.SpecificAssetID` in XML :param has_iterparse: Module containing ``iterparse`` function. Default is to use :py:mod:`xml.etree.ElementTree` from the standard library. If you have to deal with malicious input, consider using a library such as `defusedxml.ElementTree`_. :raise: :py:class:`DeserializationException` if unexpected input :return: Instance of :py:class:`.types.SpecificAssetID` read from :paramref:`stream` """ iterator = has_iterparse.iterparse(stream, ["start", "end"]) return specific_asset_id_from_iterparse( _with_elements_cleared_after_yield(iterator) )
[docs]def specific_asset_id_from_file( path: PathLike, has_iterparse: HasIterparse = xml.etree.ElementTree ) -> our_types.SpecificAssetID: """ Read an instance of :py:class:`.types.SpecificAssetID` from the :paramref:`path`. Example usage: .. code-block:: import pathlib import aas_core3_2.xmlization as our_xmlization path = pathlib.Path(...) instance = our_xmlization.specific_asset_id_from_file( path ) # Do something with the ``instance`` :param path: to the file representing an instance of :py:class:`.types.SpecificAssetID` in XML :param has_iterparse: Module containing ``iterparse`` function. Default is to use :py:mod:`xml.etree.ElementTree` from the standard library. If you have to deal with malicious input, consider using a library such as `defusedxml.ElementTree`_. :raise: :py:class:`DeserializationException` if unexpected input :return: Instance of :py:class:`.types.SpecificAssetID` read from :paramref:`path` """ with open(os.fspath(path), encoding="utf-8") as fid: iterator = has_iterparse.iterparse(fid, ["start", "end"]) return specific_asset_id_from_iterparse( _with_elements_cleared_after_yield(iterator) )
[docs]def specific_asset_id_from_str( text: str, has_iterparse: HasIterparse = xml.etree.ElementTree ) -> our_types.SpecificAssetID: """ Read an instance of :py:class:`.types.SpecificAssetID` from the :paramref:`text`. Example usage: .. code-block:: import pathlib import aas_core3_2.xmlization as our_xmlization text = "<...>...</...>" instance = our_xmlization.specific_asset_id_from_str( text ) # Do something with the ``instance`` :param text: representing an instance of :py:class:`.types.SpecificAssetID` in XML :param has_iterparse: Module containing ``iterparse`` function. Default is to use :py:mod:`xml.etree.ElementTree` from the standard library. If you have to deal with malicious input, consider using a library such as `defusedxml.ElementTree`_. :raise: :py:class:`DeserializationException` if unexpected input :return: Instance of :py:class:`.types.SpecificAssetID` read from :paramref:`text` """ iterator = has_iterparse.iterparse(io.StringIO(text), ["start", "end"]) return specific_asset_id_from_iterparse( _with_elements_cleared_after_yield(iterator) )
[docs]def submodel_from_iterparse( iterator: Iterator[Tuple[str, Element]], ) -> our_types.Submodel: """ Read an instance of :py:class:`.types.Submodel` from the :paramref:`iterator`. Example usage: .. code-block:: import pathlib import xml.etree.ElementTree as ET import aas_core3_2.xmlization as our_xmlization path = pathlib.Path(...) with path.open("rt") as fid: iterator = ET.iterparse( source=fid, events=['start', 'end'] ) instance = our_xmlization.submodel_from_iterparse( iterator ) # Do something with the ``instance`` :param iterator: Input stream of ``(event, element)`` coming from :py:func:`xml.etree.ElementTree.iterparse` with the argument ``events=["start", "end"]`` :raise: :py:class:`DeserializationException` if unexpected input :return: Instance of :py:class:`.types.Submodel` read from :paramref:`iterator` """ return _read_instance_from_iterparse( iterator, _read_submodel_as_element, "Submodel" )
[docs]def submodel_from_stream( stream: TextIO, has_iterparse: HasIterparse = xml.etree.ElementTree ) -> our_types.Submodel: """ Read an instance of :py:class:`.types.Submodel` from the :paramref:`stream`. Example usage: .. code-block:: import aas_core3_2.xmlization as our_xmlization with open_some_stream_over_network(...) as stream: instance = our_xmlization.submodel_from_stream( stream ) # Do something with the ``instance`` :param stream: representing an instance of :py:class:`.types.Submodel` in XML :param has_iterparse: Module containing ``iterparse`` function. Default is to use :py:mod:`xml.etree.ElementTree` from the standard library. If you have to deal with malicious input, consider using a library such as `defusedxml.ElementTree`_. :raise: :py:class:`DeserializationException` if unexpected input :return: Instance of :py:class:`.types.Submodel` read from :paramref:`stream` """ iterator = has_iterparse.iterparse(stream, ["start", "end"]) return submodel_from_iterparse(_with_elements_cleared_after_yield(iterator))
[docs]def submodel_from_file( path: PathLike, has_iterparse: HasIterparse = xml.etree.ElementTree ) -> our_types.Submodel: """ Read an instance of :py:class:`.types.Submodel` from the :paramref:`path`. Example usage: .. code-block:: import pathlib import aas_core3_2.xmlization as our_xmlization path = pathlib.Path(...) instance = our_xmlization.submodel_from_file( path ) # Do something with the ``instance`` :param path: to the file representing an instance of :py:class:`.types.Submodel` in XML :param has_iterparse: Module containing ``iterparse`` function. Default is to use :py:mod:`xml.etree.ElementTree` from the standard library. If you have to deal with malicious input, consider using a library such as `defusedxml.ElementTree`_. :raise: :py:class:`DeserializationException` if unexpected input :return: Instance of :py:class:`.types.Submodel` read from :paramref:`path` """ with open(os.fspath(path), encoding="utf-8") as fid: iterator = has_iterparse.iterparse(fid, ["start", "end"]) return submodel_from_iterparse(_with_elements_cleared_after_yield(iterator))
[docs]def submodel_from_str( text: str, has_iterparse: HasIterparse = xml.etree.ElementTree ) -> our_types.Submodel: """ Read an instance of :py:class:`.types.Submodel` from the :paramref:`text`. Example usage: .. code-block:: import pathlib import aas_core3_2.xmlization as our_xmlization text = "<...>...</...>" instance = our_xmlization.submodel_from_str( text ) # Do something with the ``instance`` :param text: representing an instance of :py:class:`.types.Submodel` in XML :param has_iterparse: Module containing ``iterparse`` function. Default is to use :py:mod:`xml.etree.ElementTree` from the standard library. If you have to deal with malicious input, consider using a library such as `defusedxml.ElementTree`_. :raise: :py:class:`DeserializationException` if unexpected input :return: Instance of :py:class:`.types.Submodel` read from :paramref:`text` """ iterator = has_iterparse.iterparse(io.StringIO(text), ["start", "end"]) return submodel_from_iterparse(_with_elements_cleared_after_yield(iterator))
[docs]def submodel_element_from_iterparse( iterator: Iterator[Tuple[str, Element]], ) -> our_types.SubmodelElement: """ Read an instance of :py:class:`.types.SubmodelElement` from the :paramref:`iterator`. Example usage: .. code-block:: import pathlib import xml.etree.ElementTree as ET import aas_core3_2.xmlization as our_xmlization path = pathlib.Path(...) with path.open("rt") as fid: iterator = ET.iterparse( source=fid, events=['start', 'end'] ) instance = our_xmlization.submodel_element_from_iterparse( iterator ) # Do something with the ``instance`` :param iterator: Input stream of ``(event, element)`` coming from :py:func:`xml.etree.ElementTree.iterparse` with the argument ``events=["start", "end"]`` :raise: :py:class:`DeserializationException` if unexpected input :return: Instance of :py:class:`.types.SubmodelElement` read from :paramref:`iterator` """ return _read_instance_from_iterparse( iterator, _read_submodel_element_as_element, "SubmodelElement" )
[docs]def submodel_element_from_stream( stream: TextIO, has_iterparse: HasIterparse = xml.etree.ElementTree ) -> our_types.SubmodelElement: """ Read an instance of :py:class:`.types.SubmodelElement` from the :paramref:`stream`. Example usage: .. code-block:: import aas_core3_2.xmlization as our_xmlization with open_some_stream_over_network(...) as stream: instance = our_xmlization.submodel_element_from_stream( stream ) # Do something with the ``instance`` :param stream: representing an instance of :py:class:`.types.SubmodelElement` in XML :param has_iterparse: Module containing ``iterparse`` function. Default is to use :py:mod:`xml.etree.ElementTree` from the standard library. If you have to deal with malicious input, consider using a library such as `defusedxml.ElementTree`_. :raise: :py:class:`DeserializationException` if unexpected input :return: Instance of :py:class:`.types.SubmodelElement` read from :paramref:`stream` """ iterator = has_iterparse.iterparse(stream, ["start", "end"]) return submodel_element_from_iterparse(_with_elements_cleared_after_yield(iterator))
[docs]def submodel_element_from_file( path: PathLike, has_iterparse: HasIterparse = xml.etree.ElementTree ) -> our_types.SubmodelElement: """ Read an instance of :py:class:`.types.SubmodelElement` from the :paramref:`path`. Example usage: .. code-block:: import pathlib import aas_core3_2.xmlization as our_xmlization path = pathlib.Path(...) instance = our_xmlization.submodel_element_from_file( path ) # Do something with the ``instance`` :param path: to the file representing an instance of :py:class:`.types.SubmodelElement` in XML :param has_iterparse: Module containing ``iterparse`` function. Default is to use :py:mod:`xml.etree.ElementTree` from the standard library. If you have to deal with malicious input, consider using a library such as `defusedxml.ElementTree`_. :raise: :py:class:`DeserializationException` if unexpected input :return: Instance of :py:class:`.types.SubmodelElement` read from :paramref:`path` """ with open(os.fspath(path), encoding="utf-8") as fid: iterator = has_iterparse.iterparse(fid, ["start", "end"]) return submodel_element_from_iterparse( _with_elements_cleared_after_yield(iterator) )
[docs]def submodel_element_from_str( text: str, has_iterparse: HasIterparse = xml.etree.ElementTree ) -> our_types.SubmodelElement: """ Read an instance of :py:class:`.types.SubmodelElement` from the :paramref:`text`. Example usage: .. code-block:: import pathlib import aas_core3_2.xmlization as our_xmlization text = "<...>...</...>" instance = our_xmlization.submodel_element_from_str( text ) # Do something with the ``instance`` :param text: representing an instance of :py:class:`.types.SubmodelElement` in XML :param has_iterparse: Module containing ``iterparse`` function. Default is to use :py:mod:`xml.etree.ElementTree` from the standard library. If you have to deal with malicious input, consider using a library such as `defusedxml.ElementTree`_. :raise: :py:class:`DeserializationException` if unexpected input :return: Instance of :py:class:`.types.SubmodelElement` read from :paramref:`text` """ iterator = has_iterparse.iterparse(io.StringIO(text), ["start", "end"]) return submodel_element_from_iterparse(_with_elements_cleared_after_yield(iterator))
[docs]def relationship_element_from_iterparse( iterator: Iterator[Tuple[str, Element]], ) -> our_types.RelationshipElement: """ Read an instance of :py:class:`.types.RelationshipElement` from the :paramref:`iterator`. Example usage: .. code-block:: import pathlib import xml.etree.ElementTree as ET import aas_core3_2.xmlization as our_xmlization path = pathlib.Path(...) with path.open("rt") as fid: iterator = ET.iterparse( source=fid, events=['start', 'end'] ) instance = our_xmlization.relationship_element_from_iterparse( iterator ) # Do something with the ``instance`` :param iterator: Input stream of ``(event, element)`` coming from :py:func:`xml.etree.ElementTree.iterparse` with the argument ``events=["start", "end"]`` :raise: :py:class:`DeserializationException` if unexpected input :return: Instance of :py:class:`.types.RelationshipElement` read from :paramref:`iterator` """ return _read_instance_from_iterparse( iterator, _read_relationship_element_as_element, "RelationshipElement" )
[docs]def relationship_element_from_stream( stream: TextIO, has_iterparse: HasIterparse = xml.etree.ElementTree ) -> our_types.RelationshipElement: """ Read an instance of :py:class:`.types.RelationshipElement` from the :paramref:`stream`. Example usage: .. code-block:: import aas_core3_2.xmlization as our_xmlization with open_some_stream_over_network(...) as stream: instance = our_xmlization.relationship_element_from_stream( stream ) # Do something with the ``instance`` :param stream: representing an instance of :py:class:`.types.RelationshipElement` in XML :param has_iterparse: Module containing ``iterparse`` function. Default is to use :py:mod:`xml.etree.ElementTree` from the standard library. If you have to deal with malicious input, consider using a library such as `defusedxml.ElementTree`_. :raise: :py:class:`DeserializationException` if unexpected input :return: Instance of :py:class:`.types.RelationshipElement` read from :paramref:`stream` """ iterator = has_iterparse.iterparse(stream, ["start", "end"]) return relationship_element_from_iterparse( _with_elements_cleared_after_yield(iterator) )
[docs]def relationship_element_from_file( path: PathLike, has_iterparse: HasIterparse = xml.etree.ElementTree ) -> our_types.RelationshipElement: """ Read an instance of :py:class:`.types.RelationshipElement` from the :paramref:`path`. Example usage: .. code-block:: import pathlib import aas_core3_2.xmlization as our_xmlization path = pathlib.Path(...) instance = our_xmlization.relationship_element_from_file( path ) # Do something with the ``instance`` :param path: to the file representing an instance of :py:class:`.types.RelationshipElement` in XML :param has_iterparse: Module containing ``iterparse`` function. Default is to use :py:mod:`xml.etree.ElementTree` from the standard library. If you have to deal with malicious input, consider using a library such as `defusedxml.ElementTree`_. :raise: :py:class:`DeserializationException` if unexpected input :return: Instance of :py:class:`.types.RelationshipElement` read from :paramref:`path` """ with open(os.fspath(path), encoding="utf-8") as fid: iterator = has_iterparse.iterparse(fid, ["start", "end"]) return relationship_element_from_iterparse( _with_elements_cleared_after_yield(iterator) )
[docs]def relationship_element_from_str( text: str, has_iterparse: HasIterparse = xml.etree.ElementTree ) -> our_types.RelationshipElement: """ Read an instance of :py:class:`.types.RelationshipElement` from the :paramref:`text`. Example usage: .. code-block:: import pathlib import aas_core3_2.xmlization as our_xmlization text = "<...>...</...>" instance = our_xmlization.relationship_element_from_str( text ) # Do something with the ``instance`` :param text: representing an instance of :py:class:`.types.RelationshipElement` in XML :param has_iterparse: Module containing ``iterparse`` function. Default is to use :py:mod:`xml.etree.ElementTree` from the standard library. If you have to deal with malicious input, consider using a library such as `defusedxml.ElementTree`_. :raise: :py:class:`DeserializationException` if unexpected input :return: Instance of :py:class:`.types.RelationshipElement` read from :paramref:`text` """ iterator = has_iterparse.iterparse(io.StringIO(text), ["start", "end"]) return relationship_element_from_iterparse( _with_elements_cleared_after_yield(iterator) )
[docs]def submodel_element_list_from_iterparse( iterator: Iterator[Tuple[str, Element]], ) -> our_types.SubmodelElementList: """ Read an instance of :py:class:`.types.SubmodelElementList` from the :paramref:`iterator`. Example usage: .. code-block:: import pathlib import xml.etree.ElementTree as ET import aas_core3_2.xmlization as our_xmlization path = pathlib.Path(...) with path.open("rt") as fid: iterator = ET.iterparse( source=fid, events=['start', 'end'] ) instance = our_xmlization.submodel_element_list_from_iterparse( iterator ) # Do something with the ``instance`` :param iterator: Input stream of ``(event, element)`` coming from :py:func:`xml.etree.ElementTree.iterparse` with the argument ``events=["start", "end"]`` :raise: :py:class:`DeserializationException` if unexpected input :return: Instance of :py:class:`.types.SubmodelElementList` read from :paramref:`iterator` """ return _read_instance_from_iterparse( iterator, _read_submodel_element_list_as_element, "SubmodelElementList" )
[docs]def submodel_element_list_from_stream( stream: TextIO, has_iterparse: HasIterparse = xml.etree.ElementTree ) -> our_types.SubmodelElementList: """ Read an instance of :py:class:`.types.SubmodelElementList` from the :paramref:`stream`. Example usage: .. code-block:: import aas_core3_2.xmlization as our_xmlization with open_some_stream_over_network(...) as stream: instance = our_xmlization.submodel_element_list_from_stream( stream ) # Do something with the ``instance`` :param stream: representing an instance of :py:class:`.types.SubmodelElementList` in XML :param has_iterparse: Module containing ``iterparse`` function. Default is to use :py:mod:`xml.etree.ElementTree` from the standard library. If you have to deal with malicious input, consider using a library such as `defusedxml.ElementTree`_. :raise: :py:class:`DeserializationException` if unexpected input :return: Instance of :py:class:`.types.SubmodelElementList` read from :paramref:`stream` """ iterator = has_iterparse.iterparse(stream, ["start", "end"]) return submodel_element_list_from_iterparse( _with_elements_cleared_after_yield(iterator) )
[docs]def submodel_element_list_from_file( path: PathLike, has_iterparse: HasIterparse = xml.etree.ElementTree ) -> our_types.SubmodelElementList: """ Read an instance of :py:class:`.types.SubmodelElementList` from the :paramref:`path`. Example usage: .. code-block:: import pathlib import aas_core3_2.xmlization as our_xmlization path = pathlib.Path(...) instance = our_xmlization.submodel_element_list_from_file( path ) # Do something with the ``instance`` :param path: to the file representing an instance of :py:class:`.types.SubmodelElementList` in XML :param has_iterparse: Module containing ``iterparse`` function. Default is to use :py:mod:`xml.etree.ElementTree` from the standard library. If you have to deal with malicious input, consider using a library such as `defusedxml.ElementTree`_. :raise: :py:class:`DeserializationException` if unexpected input :return: Instance of :py:class:`.types.SubmodelElementList` read from :paramref:`path` """ with open(os.fspath(path), encoding="utf-8") as fid: iterator = has_iterparse.iterparse(fid, ["start", "end"]) return submodel_element_list_from_iterparse( _with_elements_cleared_after_yield(iterator) )
[docs]def submodel_element_list_from_str( text: str, has_iterparse: HasIterparse = xml.etree.ElementTree ) -> our_types.SubmodelElementList: """ Read an instance of :py:class:`.types.SubmodelElementList` from the :paramref:`text`. Example usage: .. code-block:: import pathlib import aas_core3_2.xmlization as our_xmlization text = "<...>...</...>" instance = our_xmlization.submodel_element_list_from_str( text ) # Do something with the ``instance`` :param text: representing an instance of :py:class:`.types.SubmodelElementList` in XML :param has_iterparse: Module containing ``iterparse`` function. Default is to use :py:mod:`xml.etree.ElementTree` from the standard library. If you have to deal with malicious input, consider using a library such as `defusedxml.ElementTree`_. :raise: :py:class:`DeserializationException` if unexpected input :return: Instance of :py:class:`.types.SubmodelElementList` read from :paramref:`text` """ iterator = has_iterparse.iterparse(io.StringIO(text), ["start", "end"]) return submodel_element_list_from_iterparse( _with_elements_cleared_after_yield(iterator) )
[docs]def submodel_element_collection_from_iterparse( iterator: Iterator[Tuple[str, Element]], ) -> our_types.SubmodelElementCollection: """ Read an instance of :py:class:`.types.SubmodelElementCollection` from the :paramref:`iterator`. Example usage: .. code-block:: import pathlib import xml.etree.ElementTree as ET import aas_core3_2.xmlization as our_xmlization path = pathlib.Path(...) with path.open("rt") as fid: iterator = ET.iterparse( source=fid, events=['start', 'end'] ) instance = our_xmlization.submodel_element_collection_from_iterparse( iterator ) # Do something with the ``instance`` :param iterator: Input stream of ``(event, element)`` coming from :py:func:`xml.etree.ElementTree.iterparse` with the argument ``events=["start", "end"]`` :raise: :py:class:`DeserializationException` if unexpected input :return: Instance of :py:class:`.types.SubmodelElementCollection` read from :paramref:`iterator` """ return _read_instance_from_iterparse( iterator, _read_submodel_element_collection_as_element, "SubmodelElementCollection", )
[docs]def submodel_element_collection_from_stream( stream: TextIO, has_iterparse: HasIterparse = xml.etree.ElementTree ) -> our_types.SubmodelElementCollection: """ Read an instance of :py:class:`.types.SubmodelElementCollection` from the :paramref:`stream`. Example usage: .. code-block:: import aas_core3_2.xmlization as our_xmlization with open_some_stream_over_network(...) as stream: instance = our_xmlization.submodel_element_collection_from_stream( stream ) # Do something with the ``instance`` :param stream: representing an instance of :py:class:`.types.SubmodelElementCollection` in XML :param has_iterparse: Module containing ``iterparse`` function. Default is to use :py:mod:`xml.etree.ElementTree` from the standard library. If you have to deal with malicious input, consider using a library such as `defusedxml.ElementTree`_. :raise: :py:class:`DeserializationException` if unexpected input :return: Instance of :py:class:`.types.SubmodelElementCollection` read from :paramref:`stream` """ iterator = has_iterparse.iterparse(stream, ["start", "end"]) return submodel_element_collection_from_iterparse( _with_elements_cleared_after_yield(iterator) )
[docs]def submodel_element_collection_from_file( path: PathLike, has_iterparse: HasIterparse = xml.etree.ElementTree ) -> our_types.SubmodelElementCollection: """ Read an instance of :py:class:`.types.SubmodelElementCollection` from the :paramref:`path`. Example usage: .. code-block:: import pathlib import aas_core3_2.xmlization as our_xmlization path = pathlib.Path(...) instance = our_xmlization.submodel_element_collection_from_file( path ) # Do something with the ``instance`` :param path: to the file representing an instance of :py:class:`.types.SubmodelElementCollection` in XML :param has_iterparse: Module containing ``iterparse`` function. Default is to use :py:mod:`xml.etree.ElementTree` from the standard library. If you have to deal with malicious input, consider using a library such as `defusedxml.ElementTree`_. :raise: :py:class:`DeserializationException` if unexpected input :return: Instance of :py:class:`.types.SubmodelElementCollection` read from :paramref:`path` """ with open(os.fspath(path), encoding="utf-8") as fid: iterator = has_iterparse.iterparse(fid, ["start", "end"]) return submodel_element_collection_from_iterparse( _with_elements_cleared_after_yield(iterator) )
[docs]def submodel_element_collection_from_str( text: str, has_iterparse: HasIterparse = xml.etree.ElementTree ) -> our_types.SubmodelElementCollection: """ Read an instance of :py:class:`.types.SubmodelElementCollection` from the :paramref:`text`. Example usage: .. code-block:: import pathlib import aas_core3_2.xmlization as our_xmlization text = "<...>...</...>" instance = our_xmlization.submodel_element_collection_from_str( text ) # Do something with the ``instance`` :param text: representing an instance of :py:class:`.types.SubmodelElementCollection` in XML :param has_iterparse: Module containing ``iterparse`` function. Default is to use :py:mod:`xml.etree.ElementTree` from the standard library. If you have to deal with malicious input, consider using a library such as `defusedxml.ElementTree`_. :raise: :py:class:`DeserializationException` if unexpected input :return: Instance of :py:class:`.types.SubmodelElementCollection` read from :paramref:`text` """ iterator = has_iterparse.iterparse(io.StringIO(text), ["start", "end"]) return submodel_element_collection_from_iterparse( _with_elements_cleared_after_yield(iterator) )
[docs]def data_element_from_iterparse( iterator: Iterator[Tuple[str, Element]], ) -> our_types.DataElement: """ Read an instance of :py:class:`.types.DataElement` from the :paramref:`iterator`. Example usage: .. code-block:: import pathlib import xml.etree.ElementTree as ET import aas_core3_2.xmlization as our_xmlization path = pathlib.Path(...) with path.open("rt") as fid: iterator = ET.iterparse( source=fid, events=['start', 'end'] ) instance = our_xmlization.data_element_from_iterparse( iterator ) # Do something with the ``instance`` :param iterator: Input stream of ``(event, element)`` coming from :py:func:`xml.etree.ElementTree.iterparse` with the argument ``events=["start", "end"]`` :raise: :py:class:`DeserializationException` if unexpected input :return: Instance of :py:class:`.types.DataElement` read from :paramref:`iterator` """ return _read_instance_from_iterparse( iterator, _read_data_element_as_element, "DataElement" )
[docs]def data_element_from_stream( stream: TextIO, has_iterparse: HasIterparse = xml.etree.ElementTree ) -> our_types.DataElement: """ Read an instance of :py:class:`.types.DataElement` from the :paramref:`stream`. Example usage: .. code-block:: import aas_core3_2.xmlization as our_xmlization with open_some_stream_over_network(...) as stream: instance = our_xmlization.data_element_from_stream( stream ) # Do something with the ``instance`` :param stream: representing an instance of :py:class:`.types.DataElement` in XML :param has_iterparse: Module containing ``iterparse`` function. Default is to use :py:mod:`xml.etree.ElementTree` from the standard library. If you have to deal with malicious input, consider using a library such as `defusedxml.ElementTree`_. :raise: :py:class:`DeserializationException` if unexpected input :return: Instance of :py:class:`.types.DataElement` read from :paramref:`stream` """ iterator = has_iterparse.iterparse(stream, ["start", "end"]) return data_element_from_iterparse(_with_elements_cleared_after_yield(iterator))
[docs]def data_element_from_file( path: PathLike, has_iterparse: HasIterparse = xml.etree.ElementTree ) -> our_types.DataElement: """ Read an instance of :py:class:`.types.DataElement` from the :paramref:`path`. Example usage: .. code-block:: import pathlib import aas_core3_2.xmlization as our_xmlization path = pathlib.Path(...) instance = our_xmlization.data_element_from_file( path ) # Do something with the ``instance`` :param path: to the file representing an instance of :py:class:`.types.DataElement` in XML :param has_iterparse: Module containing ``iterparse`` function. Default is to use :py:mod:`xml.etree.ElementTree` from the standard library. If you have to deal with malicious input, consider using a library such as `defusedxml.ElementTree`_. :raise: :py:class:`DeserializationException` if unexpected input :return: Instance of :py:class:`.types.DataElement` read from :paramref:`path` """ with open(os.fspath(path), encoding="utf-8") as fid: iterator = has_iterparse.iterparse(fid, ["start", "end"]) return data_element_from_iterparse(_with_elements_cleared_after_yield(iterator))
[docs]def data_element_from_str( text: str, has_iterparse: HasIterparse = xml.etree.ElementTree ) -> our_types.DataElement: """ Read an instance of :py:class:`.types.DataElement` from the :paramref:`text`. Example usage: .. code-block:: import pathlib import aas_core3_2.xmlization as our_xmlization text = "<...>...</...>" instance = our_xmlization.data_element_from_str( text ) # Do something with the ``instance`` :param text: representing an instance of :py:class:`.types.DataElement` in XML :param has_iterparse: Module containing ``iterparse`` function. Default is to use :py:mod:`xml.etree.ElementTree` from the standard library. If you have to deal with malicious input, consider using a library such as `defusedxml.ElementTree`_. :raise: :py:class:`DeserializationException` if unexpected input :return: Instance of :py:class:`.types.DataElement` read from :paramref:`text` """ iterator = has_iterparse.iterparse(io.StringIO(text), ["start", "end"]) return data_element_from_iterparse(_with_elements_cleared_after_yield(iterator))
[docs]def property_from_iterparse( iterator: Iterator[Tuple[str, Element]], ) -> our_types.Property: """ Read an instance of :py:class:`.types.Property` from the :paramref:`iterator`. Example usage: .. code-block:: import pathlib import xml.etree.ElementTree as ET import aas_core3_2.xmlization as our_xmlization path = pathlib.Path(...) with path.open("rt") as fid: iterator = ET.iterparse( source=fid, events=['start', 'end'] ) instance = our_xmlization.property_from_iterparse( iterator ) # Do something with the ``instance`` :param iterator: Input stream of ``(event, element)`` coming from :py:func:`xml.etree.ElementTree.iterparse` with the argument ``events=["start", "end"]`` :raise: :py:class:`DeserializationException` if unexpected input :return: Instance of :py:class:`.types.Property` read from :paramref:`iterator` """ return _read_instance_from_iterparse( iterator, _read_property_as_element, "Property" )
[docs]def property_from_stream( stream: TextIO, has_iterparse: HasIterparse = xml.etree.ElementTree ) -> our_types.Property: """ Read an instance of :py:class:`.types.Property` from the :paramref:`stream`. Example usage: .. code-block:: import aas_core3_2.xmlization as our_xmlization with open_some_stream_over_network(...) as stream: instance = our_xmlization.property_from_stream( stream ) # Do something with the ``instance`` :param stream: representing an instance of :py:class:`.types.Property` in XML :param has_iterparse: Module containing ``iterparse`` function. Default is to use :py:mod:`xml.etree.ElementTree` from the standard library. If you have to deal with malicious input, consider using a library such as `defusedxml.ElementTree`_. :raise: :py:class:`DeserializationException` if unexpected input :return: Instance of :py:class:`.types.Property` read from :paramref:`stream` """ iterator = has_iterparse.iterparse(stream, ["start", "end"]) return property_from_iterparse(_with_elements_cleared_after_yield(iterator))
[docs]def property_from_file( path: PathLike, has_iterparse: HasIterparse = xml.etree.ElementTree ) -> our_types.Property: """ Read an instance of :py:class:`.types.Property` from the :paramref:`path`. Example usage: .. code-block:: import pathlib import aas_core3_2.xmlization as our_xmlization path = pathlib.Path(...) instance = our_xmlization.property_from_file( path ) # Do something with the ``instance`` :param path: to the file representing an instance of :py:class:`.types.Property` in XML :param has_iterparse: Module containing ``iterparse`` function. Default is to use :py:mod:`xml.etree.ElementTree` from the standard library. If you have to deal with malicious input, consider using a library such as `defusedxml.ElementTree`_. :raise: :py:class:`DeserializationException` if unexpected input :return: Instance of :py:class:`.types.Property` read from :paramref:`path` """ with open(os.fspath(path), encoding="utf-8") as fid: iterator = has_iterparse.iterparse(fid, ["start", "end"]) return property_from_iterparse(_with_elements_cleared_after_yield(iterator))
[docs]def property_from_str( text: str, has_iterparse: HasIterparse = xml.etree.ElementTree ) -> our_types.Property: """ Read an instance of :py:class:`.types.Property` from the :paramref:`text`. Example usage: .. code-block:: import pathlib import aas_core3_2.xmlization as our_xmlization text = "<...>...</...>" instance = our_xmlization.property_from_str( text ) # Do something with the ``instance`` :param text: representing an instance of :py:class:`.types.Property` in XML :param has_iterparse: Module containing ``iterparse`` function. Default is to use :py:mod:`xml.etree.ElementTree` from the standard library. If you have to deal with malicious input, consider using a library such as `defusedxml.ElementTree`_. :raise: :py:class:`DeserializationException` if unexpected input :return: Instance of :py:class:`.types.Property` read from :paramref:`text` """ iterator = has_iterparse.iterparse(io.StringIO(text), ["start", "end"]) return property_from_iterparse(_with_elements_cleared_after_yield(iterator))
[docs]def multi_language_property_from_iterparse( iterator: Iterator[Tuple[str, Element]], ) -> our_types.MultiLanguageProperty: """ Read an instance of :py:class:`.types.MultiLanguageProperty` from the :paramref:`iterator`. Example usage: .. code-block:: import pathlib import xml.etree.ElementTree as ET import aas_core3_2.xmlization as our_xmlization path = pathlib.Path(...) with path.open("rt") as fid: iterator = ET.iterparse( source=fid, events=['start', 'end'] ) instance = our_xmlization.multi_language_property_from_iterparse( iterator ) # Do something with the ``instance`` :param iterator: Input stream of ``(event, element)`` coming from :py:func:`xml.etree.ElementTree.iterparse` with the argument ``events=["start", "end"]`` :raise: :py:class:`DeserializationException` if unexpected input :return: Instance of :py:class:`.types.MultiLanguageProperty` read from :paramref:`iterator` """ return _read_instance_from_iterparse( iterator, _read_multi_language_property_as_element, "MultiLanguageProperty" )
[docs]def multi_language_property_from_stream( stream: TextIO, has_iterparse: HasIterparse = xml.etree.ElementTree ) -> our_types.MultiLanguageProperty: """ Read an instance of :py:class:`.types.MultiLanguageProperty` from the :paramref:`stream`. Example usage: .. code-block:: import aas_core3_2.xmlization as our_xmlization with open_some_stream_over_network(...) as stream: instance = our_xmlization.multi_language_property_from_stream( stream ) # Do something with the ``instance`` :param stream: representing an instance of :py:class:`.types.MultiLanguageProperty` in XML :param has_iterparse: Module containing ``iterparse`` function. Default is to use :py:mod:`xml.etree.ElementTree` from the standard library. If you have to deal with malicious input, consider using a library such as `defusedxml.ElementTree`_. :raise: :py:class:`DeserializationException` if unexpected input :return: Instance of :py:class:`.types.MultiLanguageProperty` read from :paramref:`stream` """ iterator = has_iterparse.iterparse(stream, ["start", "end"]) return multi_language_property_from_iterparse( _with_elements_cleared_after_yield(iterator) )
[docs]def multi_language_property_from_file( path: PathLike, has_iterparse: HasIterparse = xml.etree.ElementTree ) -> our_types.MultiLanguageProperty: """ Read an instance of :py:class:`.types.MultiLanguageProperty` from the :paramref:`path`. Example usage: .. code-block:: import pathlib import aas_core3_2.xmlization as our_xmlization path = pathlib.Path(...) instance = our_xmlization.multi_language_property_from_file( path ) # Do something with the ``instance`` :param path: to the file representing an instance of :py:class:`.types.MultiLanguageProperty` in XML :param has_iterparse: Module containing ``iterparse`` function. Default is to use :py:mod:`xml.etree.ElementTree` from the standard library. If you have to deal with malicious input, consider using a library such as `defusedxml.ElementTree`_. :raise: :py:class:`DeserializationException` if unexpected input :return: Instance of :py:class:`.types.MultiLanguageProperty` read from :paramref:`path` """ with open(os.fspath(path), encoding="utf-8") as fid: iterator = has_iterparse.iterparse(fid, ["start", "end"]) return multi_language_property_from_iterparse( _with_elements_cleared_after_yield(iterator) )
[docs]def multi_language_property_from_str( text: str, has_iterparse: HasIterparse = xml.etree.ElementTree ) -> our_types.MultiLanguageProperty: """ Read an instance of :py:class:`.types.MultiLanguageProperty` from the :paramref:`text`. Example usage: .. code-block:: import pathlib import aas_core3_2.xmlization as our_xmlization text = "<...>...</...>" instance = our_xmlization.multi_language_property_from_str( text ) # Do something with the ``instance`` :param text: representing an instance of :py:class:`.types.MultiLanguageProperty` in XML :param has_iterparse: Module containing ``iterparse`` function. Default is to use :py:mod:`xml.etree.ElementTree` from the standard library. If you have to deal with malicious input, consider using a library such as `defusedxml.ElementTree`_. :raise: :py:class:`DeserializationException` if unexpected input :return: Instance of :py:class:`.types.MultiLanguageProperty` read from :paramref:`text` """ iterator = has_iterparse.iterparse(io.StringIO(text), ["start", "end"]) return multi_language_property_from_iterparse( _with_elements_cleared_after_yield(iterator) )
[docs]def range_from_iterparse(iterator: Iterator[Tuple[str, Element]]) -> our_types.Range: """ Read an instance of :py:class:`.types.Range` from the :paramref:`iterator`. Example usage: .. code-block:: import pathlib import xml.etree.ElementTree as ET import aas_core3_2.xmlization as our_xmlization path = pathlib.Path(...) with path.open("rt") as fid: iterator = ET.iterparse( source=fid, events=['start', 'end'] ) instance = our_xmlization.range_from_iterparse( iterator ) # Do something with the ``instance`` :param iterator: Input stream of ``(event, element)`` coming from :py:func:`xml.etree.ElementTree.iterparse` with the argument ``events=["start", "end"]`` :raise: :py:class:`DeserializationException` if unexpected input :return: Instance of :py:class:`.types.Range` read from :paramref:`iterator` """ return _read_instance_from_iterparse(iterator, _read_range_as_element, "Range")
[docs]def range_from_stream( stream: TextIO, has_iterparse: HasIterparse = xml.etree.ElementTree ) -> our_types.Range: """ Read an instance of :py:class:`.types.Range` from the :paramref:`stream`. Example usage: .. code-block:: import aas_core3_2.xmlization as our_xmlization with open_some_stream_over_network(...) as stream: instance = our_xmlization.range_from_stream( stream ) # Do something with the ``instance`` :param stream: representing an instance of :py:class:`.types.Range` in XML :param has_iterparse: Module containing ``iterparse`` function. Default is to use :py:mod:`xml.etree.ElementTree` from the standard library. If you have to deal with malicious input, consider using a library such as `defusedxml.ElementTree`_. :raise: :py:class:`DeserializationException` if unexpected input :return: Instance of :py:class:`.types.Range` read from :paramref:`stream` """ iterator = has_iterparse.iterparse(stream, ["start", "end"]) return range_from_iterparse(_with_elements_cleared_after_yield(iterator))
[docs]def range_from_file( path: PathLike, has_iterparse: HasIterparse = xml.etree.ElementTree ) -> our_types.Range: """ Read an instance of :py:class:`.types.Range` from the :paramref:`path`. Example usage: .. code-block:: import pathlib import aas_core3_2.xmlization as our_xmlization path = pathlib.Path(...) instance = our_xmlization.range_from_file( path ) # Do something with the ``instance`` :param path: to the file representing an instance of :py:class:`.types.Range` in XML :param has_iterparse: Module containing ``iterparse`` function. Default is to use :py:mod:`xml.etree.ElementTree` from the standard library. If you have to deal with malicious input, consider using a library such as `defusedxml.ElementTree`_. :raise: :py:class:`DeserializationException` if unexpected input :return: Instance of :py:class:`.types.Range` read from :paramref:`path` """ with open(os.fspath(path), encoding="utf-8") as fid: iterator = has_iterparse.iterparse(fid, ["start", "end"]) return range_from_iterparse(_with_elements_cleared_after_yield(iterator))
[docs]def range_from_str( text: str, has_iterparse: HasIterparse = xml.etree.ElementTree ) -> our_types.Range: """ Read an instance of :py:class:`.types.Range` from the :paramref:`text`. Example usage: .. code-block:: import pathlib import aas_core3_2.xmlization as our_xmlization text = "<...>...</...>" instance = our_xmlization.range_from_str( text ) # Do something with the ``instance`` :param text: representing an instance of :py:class:`.types.Range` in XML :param has_iterparse: Module containing ``iterparse`` function. Default is to use :py:mod:`xml.etree.ElementTree` from the standard library. If you have to deal with malicious input, consider using a library such as `defusedxml.ElementTree`_. :raise: :py:class:`DeserializationException` if unexpected input :return: Instance of :py:class:`.types.Range` read from :paramref:`text` """ iterator = has_iterparse.iterparse(io.StringIO(text), ["start", "end"]) return range_from_iterparse(_with_elements_cleared_after_yield(iterator))
[docs]def reference_element_from_iterparse( iterator: Iterator[Tuple[str, Element]], ) -> our_types.ReferenceElement: """ Read an instance of :py:class:`.types.ReferenceElement` from the :paramref:`iterator`. Example usage: .. code-block:: import pathlib import xml.etree.ElementTree as ET import aas_core3_2.xmlization as our_xmlization path = pathlib.Path(...) with path.open("rt") as fid: iterator = ET.iterparse( source=fid, events=['start', 'end'] ) instance = our_xmlization.reference_element_from_iterparse( iterator ) # Do something with the ``instance`` :param iterator: Input stream of ``(event, element)`` coming from :py:func:`xml.etree.ElementTree.iterparse` with the argument ``events=["start", "end"]`` :raise: :py:class:`DeserializationException` if unexpected input :return: Instance of :py:class:`.types.ReferenceElement` read from :paramref:`iterator` """ return _read_instance_from_iterparse( iterator, _read_reference_element_as_element, "ReferenceElement" )
[docs]def reference_element_from_stream( stream: TextIO, has_iterparse: HasIterparse = xml.etree.ElementTree ) -> our_types.ReferenceElement: """ Read an instance of :py:class:`.types.ReferenceElement` from the :paramref:`stream`. Example usage: .. code-block:: import aas_core3_2.xmlization as our_xmlization with open_some_stream_over_network(...) as stream: instance = our_xmlization.reference_element_from_stream( stream ) # Do something with the ``instance`` :param stream: representing an instance of :py:class:`.types.ReferenceElement` in XML :param has_iterparse: Module containing ``iterparse`` function. Default is to use :py:mod:`xml.etree.ElementTree` from the standard library. If you have to deal with malicious input, consider using a library such as `defusedxml.ElementTree`_. :raise: :py:class:`DeserializationException` if unexpected input :return: Instance of :py:class:`.types.ReferenceElement` read from :paramref:`stream` """ iterator = has_iterparse.iterparse(stream, ["start", "end"]) return reference_element_from_iterparse( _with_elements_cleared_after_yield(iterator) )
[docs]def reference_element_from_file( path: PathLike, has_iterparse: HasIterparse = xml.etree.ElementTree ) -> our_types.ReferenceElement: """ Read an instance of :py:class:`.types.ReferenceElement` from the :paramref:`path`. Example usage: .. code-block:: import pathlib import aas_core3_2.xmlization as our_xmlization path = pathlib.Path(...) instance = our_xmlization.reference_element_from_file( path ) # Do something with the ``instance`` :param path: to the file representing an instance of :py:class:`.types.ReferenceElement` in XML :param has_iterparse: Module containing ``iterparse`` function. Default is to use :py:mod:`xml.etree.ElementTree` from the standard library. If you have to deal with malicious input, consider using a library such as `defusedxml.ElementTree`_. :raise: :py:class:`DeserializationException` if unexpected input :return: Instance of :py:class:`.types.ReferenceElement` read from :paramref:`path` """ with open(os.fspath(path), encoding="utf-8") as fid: iterator = has_iterparse.iterparse(fid, ["start", "end"]) return reference_element_from_iterparse( _with_elements_cleared_after_yield(iterator) )
[docs]def reference_element_from_str( text: str, has_iterparse: HasIterparse = xml.etree.ElementTree ) -> our_types.ReferenceElement: """ Read an instance of :py:class:`.types.ReferenceElement` from the :paramref:`text`. Example usage: .. code-block:: import pathlib import aas_core3_2.xmlization as our_xmlization text = "<...>...</...>" instance = our_xmlization.reference_element_from_str( text ) # Do something with the ``instance`` :param text: representing an instance of :py:class:`.types.ReferenceElement` in XML :param has_iterparse: Module containing ``iterparse`` function. Default is to use :py:mod:`xml.etree.ElementTree` from the standard library. If you have to deal with malicious input, consider using a library such as `defusedxml.ElementTree`_. :raise: :py:class:`DeserializationException` if unexpected input :return: Instance of :py:class:`.types.ReferenceElement` read from :paramref:`text` """ iterator = has_iterparse.iterparse(io.StringIO(text), ["start", "end"]) return reference_element_from_iterparse( _with_elements_cleared_after_yield(iterator) )
[docs]def blob_from_iterparse(iterator: Iterator[Tuple[str, Element]]) -> our_types.Blob: """ Read an instance of :py:class:`.types.Blob` from the :paramref:`iterator`. Example usage: .. code-block:: import pathlib import xml.etree.ElementTree as ET import aas_core3_2.xmlization as our_xmlization path = pathlib.Path(...) with path.open("rt") as fid: iterator = ET.iterparse( source=fid, events=['start', 'end'] ) instance = our_xmlization.blob_from_iterparse( iterator ) # Do something with the ``instance`` :param iterator: Input stream of ``(event, element)`` coming from :py:func:`xml.etree.ElementTree.iterparse` with the argument ``events=["start", "end"]`` :raise: :py:class:`DeserializationException` if unexpected input :return: Instance of :py:class:`.types.Blob` read from :paramref:`iterator` """ return _read_instance_from_iterparse(iterator, _read_blob_as_element, "Blob")
[docs]def blob_from_stream( stream: TextIO, has_iterparse: HasIterparse = xml.etree.ElementTree ) -> our_types.Blob: """ Read an instance of :py:class:`.types.Blob` from the :paramref:`stream`. Example usage: .. code-block:: import aas_core3_2.xmlization as our_xmlization with open_some_stream_over_network(...) as stream: instance = our_xmlization.blob_from_stream( stream ) # Do something with the ``instance`` :param stream: representing an instance of :py:class:`.types.Blob` in XML :param has_iterparse: Module containing ``iterparse`` function. Default is to use :py:mod:`xml.etree.ElementTree` from the standard library. If you have to deal with malicious input, consider using a library such as `defusedxml.ElementTree`_. :raise: :py:class:`DeserializationException` if unexpected input :return: Instance of :py:class:`.types.Blob` read from :paramref:`stream` """ iterator = has_iterparse.iterparse(stream, ["start", "end"]) return blob_from_iterparse(_with_elements_cleared_after_yield(iterator))
[docs]def blob_from_file( path: PathLike, has_iterparse: HasIterparse = xml.etree.ElementTree ) -> our_types.Blob: """ Read an instance of :py:class:`.types.Blob` from the :paramref:`path`. Example usage: .. code-block:: import pathlib import aas_core3_2.xmlization as our_xmlization path = pathlib.Path(...) instance = our_xmlization.blob_from_file( path ) # Do something with the ``instance`` :param path: to the file representing an instance of :py:class:`.types.Blob` in XML :param has_iterparse: Module containing ``iterparse`` function. Default is to use :py:mod:`xml.etree.ElementTree` from the standard library. If you have to deal with malicious input, consider using a library such as `defusedxml.ElementTree`_. :raise: :py:class:`DeserializationException` if unexpected input :return: Instance of :py:class:`.types.Blob` read from :paramref:`path` """ with open(os.fspath(path), encoding="utf-8") as fid: iterator = has_iterparse.iterparse(fid, ["start", "end"]) return blob_from_iterparse(_with_elements_cleared_after_yield(iterator))
[docs]def blob_from_str( text: str, has_iterparse: HasIterparse = xml.etree.ElementTree ) -> our_types.Blob: """ Read an instance of :py:class:`.types.Blob` from the :paramref:`text`. Example usage: .. code-block:: import pathlib import aas_core3_2.xmlization as our_xmlization text = "<...>...</...>" instance = our_xmlization.blob_from_str( text ) # Do something with the ``instance`` :param text: representing an instance of :py:class:`.types.Blob` in XML :param has_iterparse: Module containing ``iterparse`` function. Default is to use :py:mod:`xml.etree.ElementTree` from the standard library. If you have to deal with malicious input, consider using a library such as `defusedxml.ElementTree`_. :raise: :py:class:`DeserializationException` if unexpected input :return: Instance of :py:class:`.types.Blob` read from :paramref:`text` """ iterator = has_iterparse.iterparse(io.StringIO(text), ["start", "end"]) return blob_from_iterparse(_with_elements_cleared_after_yield(iterator))
[docs]def file_from_iterparse(iterator: Iterator[Tuple[str, Element]]) -> our_types.File: """ Read an instance of :py:class:`.types.File` from the :paramref:`iterator`. Example usage: .. code-block:: import pathlib import xml.etree.ElementTree as ET import aas_core3_2.xmlization as our_xmlization path = pathlib.Path(...) with path.open("rt") as fid: iterator = ET.iterparse( source=fid, events=['start', 'end'] ) instance = our_xmlization.file_from_iterparse( iterator ) # Do something with the ``instance`` :param iterator: Input stream of ``(event, element)`` coming from :py:func:`xml.etree.ElementTree.iterparse` with the argument ``events=["start", "end"]`` :raise: :py:class:`DeserializationException` if unexpected input :return: Instance of :py:class:`.types.File` read from :paramref:`iterator` """ return _read_instance_from_iterparse(iterator, _read_file_as_element, "File")
[docs]def file_from_stream( stream: TextIO, has_iterparse: HasIterparse = xml.etree.ElementTree ) -> our_types.File: """ Read an instance of :py:class:`.types.File` from the :paramref:`stream`. Example usage: .. code-block:: import aas_core3_2.xmlization as our_xmlization with open_some_stream_over_network(...) as stream: instance = our_xmlization.file_from_stream( stream ) # Do something with the ``instance`` :param stream: representing an instance of :py:class:`.types.File` in XML :param has_iterparse: Module containing ``iterparse`` function. Default is to use :py:mod:`xml.etree.ElementTree` from the standard library. If you have to deal with malicious input, consider using a library such as `defusedxml.ElementTree`_. :raise: :py:class:`DeserializationException` if unexpected input :return: Instance of :py:class:`.types.File` read from :paramref:`stream` """ iterator = has_iterparse.iterparse(stream, ["start", "end"]) return file_from_iterparse(_with_elements_cleared_after_yield(iterator))
[docs]def file_from_file( path: PathLike, has_iterparse: HasIterparse = xml.etree.ElementTree ) -> our_types.File: """ Read an instance of :py:class:`.types.File` from the :paramref:`path`. Example usage: .. code-block:: import pathlib import aas_core3_2.xmlization as our_xmlization path = pathlib.Path(...) instance = our_xmlization.file_from_file( path ) # Do something with the ``instance`` :param path: to the file representing an instance of :py:class:`.types.File` in XML :param has_iterparse: Module containing ``iterparse`` function. Default is to use :py:mod:`xml.etree.ElementTree` from the standard library. If you have to deal with malicious input, consider using a library such as `defusedxml.ElementTree`_. :raise: :py:class:`DeserializationException` if unexpected input :return: Instance of :py:class:`.types.File` read from :paramref:`path` """ with open(os.fspath(path), encoding="utf-8") as fid: iterator = has_iterparse.iterparse(fid, ["start", "end"]) return file_from_iterparse(_with_elements_cleared_after_yield(iterator))
[docs]def file_from_str( text: str, has_iterparse: HasIterparse = xml.etree.ElementTree ) -> our_types.File: """ Read an instance of :py:class:`.types.File` from the :paramref:`text`. Example usage: .. code-block:: import pathlib import aas_core3_2.xmlization as our_xmlization text = "<...>...</...>" instance = our_xmlization.file_from_str( text ) # Do something with the ``instance`` :param text: representing an instance of :py:class:`.types.File` in XML :param has_iterparse: Module containing ``iterparse`` function. Default is to use :py:mod:`xml.etree.ElementTree` from the standard library. If you have to deal with malicious input, consider using a library such as `defusedxml.ElementTree`_. :raise: :py:class:`DeserializationException` if unexpected input :return: Instance of :py:class:`.types.File` read from :paramref:`text` """ iterator = has_iterparse.iterparse(io.StringIO(text), ["start", "end"]) return file_from_iterparse(_with_elements_cleared_after_yield(iterator))
[docs]def annotated_relationship_element_from_iterparse( iterator: Iterator[Tuple[str, Element]], ) -> our_types.AnnotatedRelationshipElement: """ Read an instance of :py:class:`.types.AnnotatedRelationshipElement` from the :paramref:`iterator`. Example usage: .. code-block:: import pathlib import xml.etree.ElementTree as ET import aas_core3_2.xmlization as our_xmlization path = pathlib.Path(...) with path.open("rt") as fid: iterator = ET.iterparse( source=fid, events=['start', 'end'] ) instance = our_xmlization.annotated_relationship_element_from_iterparse( iterator ) # Do something with the ``instance`` :param iterator: Input stream of ``(event, element)`` coming from :py:func:`xml.etree.ElementTree.iterparse` with the argument ``events=["start", "end"]`` :raise: :py:class:`DeserializationException` if unexpected input :return: Instance of :py:class:`.types.AnnotatedRelationshipElement` read from :paramref:`iterator` """ return _read_instance_from_iterparse( iterator, _read_annotated_relationship_element_as_element, "AnnotatedRelationshipElement", )
[docs]def annotated_relationship_element_from_stream( stream: TextIO, has_iterparse: HasIterparse = xml.etree.ElementTree ) -> our_types.AnnotatedRelationshipElement: """ Read an instance of :py:class:`.types.AnnotatedRelationshipElement` from the :paramref:`stream`. Example usage: .. code-block:: import aas_core3_2.xmlization as our_xmlization with open_some_stream_over_network(...) as stream: instance = our_xmlization.annotated_relationship_element_from_stream( stream ) # Do something with the ``instance`` :param stream: representing an instance of :py:class:`.types.AnnotatedRelationshipElement` in XML :param has_iterparse: Module containing ``iterparse`` function. Default is to use :py:mod:`xml.etree.ElementTree` from the standard library. If you have to deal with malicious input, consider using a library such as `defusedxml.ElementTree`_. :raise: :py:class:`DeserializationException` if unexpected input :return: Instance of :py:class:`.types.AnnotatedRelationshipElement` read from :paramref:`stream` """ iterator = has_iterparse.iterparse(stream, ["start", "end"]) return annotated_relationship_element_from_iterparse( _with_elements_cleared_after_yield(iterator) )
[docs]def annotated_relationship_element_from_file( path: PathLike, has_iterparse: HasIterparse = xml.etree.ElementTree ) -> our_types.AnnotatedRelationshipElement: """ Read an instance of :py:class:`.types.AnnotatedRelationshipElement` from the :paramref:`path`. Example usage: .. code-block:: import pathlib import aas_core3_2.xmlization as our_xmlization path = pathlib.Path(...) instance = our_xmlization.annotated_relationship_element_from_file( path ) # Do something with the ``instance`` :param path: to the file representing an instance of :py:class:`.types.AnnotatedRelationshipElement` in XML :param has_iterparse: Module containing ``iterparse`` function. Default is to use :py:mod:`xml.etree.ElementTree` from the standard library. If you have to deal with malicious input, consider using a library such as `defusedxml.ElementTree`_. :raise: :py:class:`DeserializationException` if unexpected input :return: Instance of :py:class:`.types.AnnotatedRelationshipElement` read from :paramref:`path` """ with open(os.fspath(path), encoding="utf-8") as fid: iterator = has_iterparse.iterparse(fid, ["start", "end"]) return annotated_relationship_element_from_iterparse( _with_elements_cleared_after_yield(iterator) )
[docs]def annotated_relationship_element_from_str( text: str, has_iterparse: HasIterparse = xml.etree.ElementTree ) -> our_types.AnnotatedRelationshipElement: """ Read an instance of :py:class:`.types.AnnotatedRelationshipElement` from the :paramref:`text`. Example usage: .. code-block:: import pathlib import aas_core3_2.xmlization as our_xmlization text = "<...>...</...>" instance = our_xmlization.annotated_relationship_element_from_str( text ) # Do something with the ``instance`` :param text: representing an instance of :py:class:`.types.AnnotatedRelationshipElement` in XML :param has_iterparse: Module containing ``iterparse`` function. Default is to use :py:mod:`xml.etree.ElementTree` from the standard library. If you have to deal with malicious input, consider using a library such as `defusedxml.ElementTree`_. :raise: :py:class:`DeserializationException` if unexpected input :return: Instance of :py:class:`.types.AnnotatedRelationshipElement` read from :paramref:`text` """ iterator = has_iterparse.iterparse(io.StringIO(text), ["start", "end"]) return annotated_relationship_element_from_iterparse( _with_elements_cleared_after_yield(iterator) )
[docs]def entity_from_iterparse(iterator: Iterator[Tuple[str, Element]]) -> our_types.Entity: """ Read an instance of :py:class:`.types.Entity` from the :paramref:`iterator`. Example usage: .. code-block:: import pathlib import xml.etree.ElementTree as ET import aas_core3_2.xmlization as our_xmlization path = pathlib.Path(...) with path.open("rt") as fid: iterator = ET.iterparse( source=fid, events=['start', 'end'] ) instance = our_xmlization.entity_from_iterparse( iterator ) # Do something with the ``instance`` :param iterator: Input stream of ``(event, element)`` coming from :py:func:`xml.etree.ElementTree.iterparse` with the argument ``events=["start", "end"]`` :raise: :py:class:`DeserializationException` if unexpected input :return: Instance of :py:class:`.types.Entity` read from :paramref:`iterator` """ return _read_instance_from_iterparse(iterator, _read_entity_as_element, "Entity")
[docs]def entity_from_stream( stream: TextIO, has_iterparse: HasIterparse = xml.etree.ElementTree ) -> our_types.Entity: """ Read an instance of :py:class:`.types.Entity` from the :paramref:`stream`. Example usage: .. code-block:: import aas_core3_2.xmlization as our_xmlization with open_some_stream_over_network(...) as stream: instance = our_xmlization.entity_from_stream( stream ) # Do something with the ``instance`` :param stream: representing an instance of :py:class:`.types.Entity` in XML :param has_iterparse: Module containing ``iterparse`` function. Default is to use :py:mod:`xml.etree.ElementTree` from the standard library. If you have to deal with malicious input, consider using a library such as `defusedxml.ElementTree`_. :raise: :py:class:`DeserializationException` if unexpected input :return: Instance of :py:class:`.types.Entity` read from :paramref:`stream` """ iterator = has_iterparse.iterparse(stream, ["start", "end"]) return entity_from_iterparse(_with_elements_cleared_after_yield(iterator))
[docs]def entity_from_file( path: PathLike, has_iterparse: HasIterparse = xml.etree.ElementTree ) -> our_types.Entity: """ Read an instance of :py:class:`.types.Entity` from the :paramref:`path`. Example usage: .. code-block:: import pathlib import aas_core3_2.xmlization as our_xmlization path = pathlib.Path(...) instance = our_xmlization.entity_from_file( path ) # Do something with the ``instance`` :param path: to the file representing an instance of :py:class:`.types.Entity` in XML :param has_iterparse: Module containing ``iterparse`` function. Default is to use :py:mod:`xml.etree.ElementTree` from the standard library. If you have to deal with malicious input, consider using a library such as `defusedxml.ElementTree`_. :raise: :py:class:`DeserializationException` if unexpected input :return: Instance of :py:class:`.types.Entity` read from :paramref:`path` """ with open(os.fspath(path), encoding="utf-8") as fid: iterator = has_iterparse.iterparse(fid, ["start", "end"]) return entity_from_iterparse(_with_elements_cleared_after_yield(iterator))
[docs]def entity_from_str( text: str, has_iterparse: HasIterparse = xml.etree.ElementTree ) -> our_types.Entity: """ Read an instance of :py:class:`.types.Entity` from the :paramref:`text`. Example usage: .. code-block:: import pathlib import aas_core3_2.xmlization as our_xmlization text = "<...>...</...>" instance = our_xmlization.entity_from_str( text ) # Do something with the ``instance`` :param text: representing an instance of :py:class:`.types.Entity` in XML :param has_iterparse: Module containing ``iterparse`` function. Default is to use :py:mod:`xml.etree.ElementTree` from the standard library. If you have to deal with malicious input, consider using a library such as `defusedxml.ElementTree`_. :raise: :py:class:`DeserializationException` if unexpected input :return: Instance of :py:class:`.types.Entity` read from :paramref:`text` """ iterator = has_iterparse.iterparse(io.StringIO(text), ["start", "end"]) return entity_from_iterparse(_with_elements_cleared_after_yield(iterator))
[docs]def event_payload_from_iterparse( iterator: Iterator[Tuple[str, Element]], ) -> our_types.EventPayload: """ Read an instance of :py:class:`.types.EventPayload` from the :paramref:`iterator`. Example usage: .. code-block:: import pathlib import xml.etree.ElementTree as ET import aas_core3_2.xmlization as our_xmlization path = pathlib.Path(...) with path.open("rt") as fid: iterator = ET.iterparse( source=fid, events=['start', 'end'] ) instance = our_xmlization.event_payload_from_iterparse( iterator ) # Do something with the ``instance`` :param iterator: Input stream of ``(event, element)`` coming from :py:func:`xml.etree.ElementTree.iterparse` with the argument ``events=["start", "end"]`` :raise: :py:class:`DeserializationException` if unexpected input :return: Instance of :py:class:`.types.EventPayload` read from :paramref:`iterator` """ return _read_instance_from_iterparse( iterator, _read_event_payload_as_element, "EventPayload" )
[docs]def event_payload_from_stream( stream: TextIO, has_iterparse: HasIterparse = xml.etree.ElementTree ) -> our_types.EventPayload: """ Read an instance of :py:class:`.types.EventPayload` from the :paramref:`stream`. Example usage: .. code-block:: import aas_core3_2.xmlization as our_xmlization with open_some_stream_over_network(...) as stream: instance = our_xmlization.event_payload_from_stream( stream ) # Do something with the ``instance`` :param stream: representing an instance of :py:class:`.types.EventPayload` in XML :param has_iterparse: Module containing ``iterparse`` function. Default is to use :py:mod:`xml.etree.ElementTree` from the standard library. If you have to deal with malicious input, consider using a library such as `defusedxml.ElementTree`_. :raise: :py:class:`DeserializationException` if unexpected input :return: Instance of :py:class:`.types.EventPayload` read from :paramref:`stream` """ iterator = has_iterparse.iterparse(stream, ["start", "end"]) return event_payload_from_iterparse(_with_elements_cleared_after_yield(iterator))
[docs]def event_payload_from_file( path: PathLike, has_iterparse: HasIterparse = xml.etree.ElementTree ) -> our_types.EventPayload: """ Read an instance of :py:class:`.types.EventPayload` from the :paramref:`path`. Example usage: .. code-block:: import pathlib import aas_core3_2.xmlization as our_xmlization path = pathlib.Path(...) instance = our_xmlization.event_payload_from_file( path ) # Do something with the ``instance`` :param path: to the file representing an instance of :py:class:`.types.EventPayload` in XML :param has_iterparse: Module containing ``iterparse`` function. Default is to use :py:mod:`xml.etree.ElementTree` from the standard library. If you have to deal with malicious input, consider using a library such as `defusedxml.ElementTree`_. :raise: :py:class:`DeserializationException` if unexpected input :return: Instance of :py:class:`.types.EventPayload` read from :paramref:`path` """ with open(os.fspath(path), encoding="utf-8") as fid: iterator = has_iterparse.iterparse(fid, ["start", "end"]) return event_payload_from_iterparse( _with_elements_cleared_after_yield(iterator) )
[docs]def event_payload_from_str( text: str, has_iterparse: HasIterparse = xml.etree.ElementTree ) -> our_types.EventPayload: """ Read an instance of :py:class:`.types.EventPayload` from the :paramref:`text`. Example usage: .. code-block:: import pathlib import aas_core3_2.xmlization as our_xmlization text = "<...>...</...>" instance = our_xmlization.event_payload_from_str( text ) # Do something with the ``instance`` :param text: representing an instance of :py:class:`.types.EventPayload` in XML :param has_iterparse: Module containing ``iterparse`` function. Default is to use :py:mod:`xml.etree.ElementTree` from the standard library. If you have to deal with malicious input, consider using a library such as `defusedxml.ElementTree`_. :raise: :py:class:`DeserializationException` if unexpected input :return: Instance of :py:class:`.types.EventPayload` read from :paramref:`text` """ iterator = has_iterparse.iterparse(io.StringIO(text), ["start", "end"]) return event_payload_from_iterparse(_with_elements_cleared_after_yield(iterator))
[docs]def event_element_from_iterparse( iterator: Iterator[Tuple[str, Element]], ) -> our_types.EventElement: """ Read an instance of :py:class:`.types.EventElement` from the :paramref:`iterator`. Example usage: .. code-block:: import pathlib import xml.etree.ElementTree as ET import aas_core3_2.xmlization as our_xmlization path = pathlib.Path(...) with path.open("rt") as fid: iterator = ET.iterparse( source=fid, events=['start', 'end'] ) instance = our_xmlization.event_element_from_iterparse( iterator ) # Do something with the ``instance`` :param iterator: Input stream of ``(event, element)`` coming from :py:func:`xml.etree.ElementTree.iterparse` with the argument ``events=["start", "end"]`` :raise: :py:class:`DeserializationException` if unexpected input :return: Instance of :py:class:`.types.EventElement` read from :paramref:`iterator` """ return _read_instance_from_iterparse( iterator, _read_event_element_as_element, "EventElement" )
[docs]def event_element_from_stream( stream: TextIO, has_iterparse: HasIterparse = xml.etree.ElementTree ) -> our_types.EventElement: """ Read an instance of :py:class:`.types.EventElement` from the :paramref:`stream`. Example usage: .. code-block:: import aas_core3_2.xmlization as our_xmlization with open_some_stream_over_network(...) as stream: instance = our_xmlization.event_element_from_stream( stream ) # Do something with the ``instance`` :param stream: representing an instance of :py:class:`.types.EventElement` in XML :param has_iterparse: Module containing ``iterparse`` function. Default is to use :py:mod:`xml.etree.ElementTree` from the standard library. If you have to deal with malicious input, consider using a library such as `defusedxml.ElementTree`_. :raise: :py:class:`DeserializationException` if unexpected input :return: Instance of :py:class:`.types.EventElement` read from :paramref:`stream` """ iterator = has_iterparse.iterparse(stream, ["start", "end"]) return event_element_from_iterparse(_with_elements_cleared_after_yield(iterator))
[docs]def event_element_from_file( path: PathLike, has_iterparse: HasIterparse = xml.etree.ElementTree ) -> our_types.EventElement: """ Read an instance of :py:class:`.types.EventElement` from the :paramref:`path`. Example usage: .. code-block:: import pathlib import aas_core3_2.xmlization as our_xmlization path = pathlib.Path(...) instance = our_xmlization.event_element_from_file( path ) # Do something with the ``instance`` :param path: to the file representing an instance of :py:class:`.types.EventElement` in XML :param has_iterparse: Module containing ``iterparse`` function. Default is to use :py:mod:`xml.etree.ElementTree` from the standard library. If you have to deal with malicious input, consider using a library such as `defusedxml.ElementTree`_. :raise: :py:class:`DeserializationException` if unexpected input :return: Instance of :py:class:`.types.EventElement` read from :paramref:`path` """ with open(os.fspath(path), encoding="utf-8") as fid: iterator = has_iterparse.iterparse(fid, ["start", "end"]) return event_element_from_iterparse( _with_elements_cleared_after_yield(iterator) )
[docs]def event_element_from_str( text: str, has_iterparse: HasIterparse = xml.etree.ElementTree ) -> our_types.EventElement: """ Read an instance of :py:class:`.types.EventElement` from the :paramref:`text`. Example usage: .. code-block:: import pathlib import aas_core3_2.xmlization as our_xmlization text = "<...>...</...>" instance = our_xmlization.event_element_from_str( text ) # Do something with the ``instance`` :param text: representing an instance of :py:class:`.types.EventElement` in XML :param has_iterparse: Module containing ``iterparse`` function. Default is to use :py:mod:`xml.etree.ElementTree` from the standard library. If you have to deal with malicious input, consider using a library such as `defusedxml.ElementTree`_. :raise: :py:class:`DeserializationException` if unexpected input :return: Instance of :py:class:`.types.EventElement` read from :paramref:`text` """ iterator = has_iterparse.iterparse(io.StringIO(text), ["start", "end"]) return event_element_from_iterparse(_with_elements_cleared_after_yield(iterator))
[docs]def basic_event_element_from_iterparse( iterator: Iterator[Tuple[str, Element]], ) -> our_types.BasicEventElement: """ Read an instance of :py:class:`.types.BasicEventElement` from the :paramref:`iterator`. Example usage: .. code-block:: import pathlib import xml.etree.ElementTree as ET import aas_core3_2.xmlization as our_xmlization path = pathlib.Path(...) with path.open("rt") as fid: iterator = ET.iterparse( source=fid, events=['start', 'end'] ) instance = our_xmlization.basic_event_element_from_iterparse( iterator ) # Do something with the ``instance`` :param iterator: Input stream of ``(event, element)`` coming from :py:func:`xml.etree.ElementTree.iterparse` with the argument ``events=["start", "end"]`` :raise: :py:class:`DeserializationException` if unexpected input :return: Instance of :py:class:`.types.BasicEventElement` read from :paramref:`iterator` """ return _read_instance_from_iterparse( iterator, _read_basic_event_element_as_element, "BasicEventElement" )
[docs]def basic_event_element_from_stream( stream: TextIO, has_iterparse: HasIterparse = xml.etree.ElementTree ) -> our_types.BasicEventElement: """ Read an instance of :py:class:`.types.BasicEventElement` from the :paramref:`stream`. Example usage: .. code-block:: import aas_core3_2.xmlization as our_xmlization with open_some_stream_over_network(...) as stream: instance = our_xmlization.basic_event_element_from_stream( stream ) # Do something with the ``instance`` :param stream: representing an instance of :py:class:`.types.BasicEventElement` in XML :param has_iterparse: Module containing ``iterparse`` function. Default is to use :py:mod:`xml.etree.ElementTree` from the standard library. If you have to deal with malicious input, consider using a library such as `defusedxml.ElementTree`_. :raise: :py:class:`DeserializationException` if unexpected input :return: Instance of :py:class:`.types.BasicEventElement` read from :paramref:`stream` """ iterator = has_iterparse.iterparse(stream, ["start", "end"]) return basic_event_element_from_iterparse( _with_elements_cleared_after_yield(iterator) )
[docs]def basic_event_element_from_file( path: PathLike, has_iterparse: HasIterparse = xml.etree.ElementTree ) -> our_types.BasicEventElement: """ Read an instance of :py:class:`.types.BasicEventElement` from the :paramref:`path`. Example usage: .. code-block:: import pathlib import aas_core3_2.xmlization as our_xmlization path = pathlib.Path(...) instance = our_xmlization.basic_event_element_from_file( path ) # Do something with the ``instance`` :param path: to the file representing an instance of :py:class:`.types.BasicEventElement` in XML :param has_iterparse: Module containing ``iterparse`` function. Default is to use :py:mod:`xml.etree.ElementTree` from the standard library. If you have to deal with malicious input, consider using a library such as `defusedxml.ElementTree`_. :raise: :py:class:`DeserializationException` if unexpected input :return: Instance of :py:class:`.types.BasicEventElement` read from :paramref:`path` """ with open(os.fspath(path), encoding="utf-8") as fid: iterator = has_iterparse.iterparse(fid, ["start", "end"]) return basic_event_element_from_iterparse( _with_elements_cleared_after_yield(iterator) )
[docs]def basic_event_element_from_str( text: str, has_iterparse: HasIterparse = xml.etree.ElementTree ) -> our_types.BasicEventElement: """ Read an instance of :py:class:`.types.BasicEventElement` from the :paramref:`text`. Example usage: .. code-block:: import pathlib import aas_core3_2.xmlization as our_xmlization text = "<...>...</...>" instance = our_xmlization.basic_event_element_from_str( text ) # Do something with the ``instance`` :param text: representing an instance of :py:class:`.types.BasicEventElement` in XML :param has_iterparse: Module containing ``iterparse`` function. Default is to use :py:mod:`xml.etree.ElementTree` from the standard library. If you have to deal with malicious input, consider using a library such as `defusedxml.ElementTree`_. :raise: :py:class:`DeserializationException` if unexpected input :return: Instance of :py:class:`.types.BasicEventElement` read from :paramref:`text` """ iterator = has_iterparse.iterparse(io.StringIO(text), ["start", "end"]) return basic_event_element_from_iterparse( _with_elements_cleared_after_yield(iterator) )
[docs]def operation_from_iterparse( iterator: Iterator[Tuple[str, Element]], ) -> our_types.Operation: """ Read an instance of :py:class:`.types.Operation` from the :paramref:`iterator`. Example usage: .. code-block:: import pathlib import xml.etree.ElementTree as ET import aas_core3_2.xmlization as our_xmlization path = pathlib.Path(...) with path.open("rt") as fid: iterator = ET.iterparse( source=fid, events=['start', 'end'] ) instance = our_xmlization.operation_from_iterparse( iterator ) # Do something with the ``instance`` :param iterator: Input stream of ``(event, element)`` coming from :py:func:`xml.etree.ElementTree.iterparse` with the argument ``events=["start", "end"]`` :raise: :py:class:`DeserializationException` if unexpected input :return: Instance of :py:class:`.types.Operation` read from :paramref:`iterator` """ return _read_instance_from_iterparse( iterator, _read_operation_as_element, "Operation" )
[docs]def operation_from_stream( stream: TextIO, has_iterparse: HasIterparse = xml.etree.ElementTree ) -> our_types.Operation: """ Read an instance of :py:class:`.types.Operation` from the :paramref:`stream`. Example usage: .. code-block:: import aas_core3_2.xmlization as our_xmlization with open_some_stream_over_network(...) as stream: instance = our_xmlization.operation_from_stream( stream ) # Do something with the ``instance`` :param stream: representing an instance of :py:class:`.types.Operation` in XML :param has_iterparse: Module containing ``iterparse`` function. Default is to use :py:mod:`xml.etree.ElementTree` from the standard library. If you have to deal with malicious input, consider using a library such as `defusedxml.ElementTree`_. :raise: :py:class:`DeserializationException` if unexpected input :return: Instance of :py:class:`.types.Operation` read from :paramref:`stream` """ iterator = has_iterparse.iterparse(stream, ["start", "end"]) return operation_from_iterparse(_with_elements_cleared_after_yield(iterator))
[docs]def operation_from_file( path: PathLike, has_iterparse: HasIterparse = xml.etree.ElementTree ) -> our_types.Operation: """ Read an instance of :py:class:`.types.Operation` from the :paramref:`path`. Example usage: .. code-block:: import pathlib import aas_core3_2.xmlization as our_xmlization path = pathlib.Path(...) instance = our_xmlization.operation_from_file( path ) # Do something with the ``instance`` :param path: to the file representing an instance of :py:class:`.types.Operation` in XML :param has_iterparse: Module containing ``iterparse`` function. Default is to use :py:mod:`xml.etree.ElementTree` from the standard library. If you have to deal with malicious input, consider using a library such as `defusedxml.ElementTree`_. :raise: :py:class:`DeserializationException` if unexpected input :return: Instance of :py:class:`.types.Operation` read from :paramref:`path` """ with open(os.fspath(path), encoding="utf-8") as fid: iterator = has_iterparse.iterparse(fid, ["start", "end"]) return operation_from_iterparse(_with_elements_cleared_after_yield(iterator))
[docs]def operation_from_str( text: str, has_iterparse: HasIterparse = xml.etree.ElementTree ) -> our_types.Operation: """ Read an instance of :py:class:`.types.Operation` from the :paramref:`text`. Example usage: .. code-block:: import pathlib import aas_core3_2.xmlization as our_xmlization text = "<...>...</...>" instance = our_xmlization.operation_from_str( text ) # Do something with the ``instance`` :param text: representing an instance of :py:class:`.types.Operation` in XML :param has_iterparse: Module containing ``iterparse`` function. Default is to use :py:mod:`xml.etree.ElementTree` from the standard library. If you have to deal with malicious input, consider using a library such as `defusedxml.ElementTree`_. :raise: :py:class:`DeserializationException` if unexpected input :return: Instance of :py:class:`.types.Operation` read from :paramref:`text` """ iterator = has_iterparse.iterparse(io.StringIO(text), ["start", "end"]) return operation_from_iterparse(_with_elements_cleared_after_yield(iterator))
[docs]def operation_variable_from_iterparse( iterator: Iterator[Tuple[str, Element]], ) -> our_types.OperationVariable: """ Read an instance of :py:class:`.types.OperationVariable` from the :paramref:`iterator`. Example usage: .. code-block:: import pathlib import xml.etree.ElementTree as ET import aas_core3_2.xmlization as our_xmlization path = pathlib.Path(...) with path.open("rt") as fid: iterator = ET.iterparse( source=fid, events=['start', 'end'] ) instance = our_xmlization.operation_variable_from_iterparse( iterator ) # Do something with the ``instance`` :param iterator: Input stream of ``(event, element)`` coming from :py:func:`xml.etree.ElementTree.iterparse` with the argument ``events=["start", "end"]`` :raise: :py:class:`DeserializationException` if unexpected input :return: Instance of :py:class:`.types.OperationVariable` read from :paramref:`iterator` """ return _read_instance_from_iterparse( iterator, _read_operation_variable_as_element, "OperationVariable" )
[docs]def operation_variable_from_stream( stream: TextIO, has_iterparse: HasIterparse = xml.etree.ElementTree ) -> our_types.OperationVariable: """ Read an instance of :py:class:`.types.OperationVariable` from the :paramref:`stream`. Example usage: .. code-block:: import aas_core3_2.xmlization as our_xmlization with open_some_stream_over_network(...) as stream: instance = our_xmlization.operation_variable_from_stream( stream ) # Do something with the ``instance`` :param stream: representing an instance of :py:class:`.types.OperationVariable` in XML :param has_iterparse: Module containing ``iterparse`` function. Default is to use :py:mod:`xml.etree.ElementTree` from the standard library. If you have to deal with malicious input, consider using a library such as `defusedxml.ElementTree`_. :raise: :py:class:`DeserializationException` if unexpected input :return: Instance of :py:class:`.types.OperationVariable` read from :paramref:`stream` """ iterator = has_iterparse.iterparse(stream, ["start", "end"]) return operation_variable_from_iterparse( _with_elements_cleared_after_yield(iterator) )
[docs]def operation_variable_from_file( path: PathLike, has_iterparse: HasIterparse = xml.etree.ElementTree ) -> our_types.OperationVariable: """ Read an instance of :py:class:`.types.OperationVariable` from the :paramref:`path`. Example usage: .. code-block:: import pathlib import aas_core3_2.xmlization as our_xmlization path = pathlib.Path(...) instance = our_xmlization.operation_variable_from_file( path ) # Do something with the ``instance`` :param path: to the file representing an instance of :py:class:`.types.OperationVariable` in XML :param has_iterparse: Module containing ``iterparse`` function. Default is to use :py:mod:`xml.etree.ElementTree` from the standard library. If you have to deal with malicious input, consider using a library such as `defusedxml.ElementTree`_. :raise: :py:class:`DeserializationException` if unexpected input :return: Instance of :py:class:`.types.OperationVariable` read from :paramref:`path` """ with open(os.fspath(path), encoding="utf-8") as fid: iterator = has_iterparse.iterparse(fid, ["start", "end"]) return operation_variable_from_iterparse( _with_elements_cleared_after_yield(iterator) )
[docs]def operation_variable_from_str( text: str, has_iterparse: HasIterparse = xml.etree.ElementTree ) -> our_types.OperationVariable: """ Read an instance of :py:class:`.types.OperationVariable` from the :paramref:`text`. Example usage: .. code-block:: import pathlib import aas_core3_2.xmlization as our_xmlization text = "<...>...</...>" instance = our_xmlization.operation_variable_from_str( text ) # Do something with the ``instance`` :param text: representing an instance of :py:class:`.types.OperationVariable` in XML :param has_iterparse: Module containing ``iterparse`` function. Default is to use :py:mod:`xml.etree.ElementTree` from the standard library. If you have to deal with malicious input, consider using a library such as `defusedxml.ElementTree`_. :raise: :py:class:`DeserializationException` if unexpected input :return: Instance of :py:class:`.types.OperationVariable` read from :paramref:`text` """ iterator = has_iterparse.iterparse(io.StringIO(text), ["start", "end"]) return operation_variable_from_iterparse( _with_elements_cleared_after_yield(iterator) )
[docs]def capability_from_iterparse( iterator: Iterator[Tuple[str, Element]], ) -> our_types.Capability: """ Read an instance of :py:class:`.types.Capability` from the :paramref:`iterator`. Example usage: .. code-block:: import pathlib import xml.etree.ElementTree as ET import aas_core3_2.xmlization as our_xmlization path = pathlib.Path(...) with path.open("rt") as fid: iterator = ET.iterparse( source=fid, events=['start', 'end'] ) instance = our_xmlization.capability_from_iterparse( iterator ) # Do something with the ``instance`` :param iterator: Input stream of ``(event, element)`` coming from :py:func:`xml.etree.ElementTree.iterparse` with the argument ``events=["start", "end"]`` :raise: :py:class:`DeserializationException` if unexpected input :return: Instance of :py:class:`.types.Capability` read from :paramref:`iterator` """ return _read_instance_from_iterparse( iterator, _read_capability_as_element, "Capability" )
[docs]def capability_from_stream( stream: TextIO, has_iterparse: HasIterparse = xml.etree.ElementTree ) -> our_types.Capability: """ Read an instance of :py:class:`.types.Capability` from the :paramref:`stream`. Example usage: .. code-block:: import aas_core3_2.xmlization as our_xmlization with open_some_stream_over_network(...) as stream: instance = our_xmlization.capability_from_stream( stream ) # Do something with the ``instance`` :param stream: representing an instance of :py:class:`.types.Capability` in XML :param has_iterparse: Module containing ``iterparse`` function. Default is to use :py:mod:`xml.etree.ElementTree` from the standard library. If you have to deal with malicious input, consider using a library such as `defusedxml.ElementTree`_. :raise: :py:class:`DeserializationException` if unexpected input :return: Instance of :py:class:`.types.Capability` read from :paramref:`stream` """ iterator = has_iterparse.iterparse(stream, ["start", "end"]) return capability_from_iterparse(_with_elements_cleared_after_yield(iterator))
[docs]def capability_from_file( path: PathLike, has_iterparse: HasIterparse = xml.etree.ElementTree ) -> our_types.Capability: """ Read an instance of :py:class:`.types.Capability` from the :paramref:`path`. Example usage: .. code-block:: import pathlib import aas_core3_2.xmlization as our_xmlization path = pathlib.Path(...) instance = our_xmlization.capability_from_file( path ) # Do something with the ``instance`` :param path: to the file representing an instance of :py:class:`.types.Capability` in XML :param has_iterparse: Module containing ``iterparse`` function. Default is to use :py:mod:`xml.etree.ElementTree` from the standard library. If you have to deal with malicious input, consider using a library such as `defusedxml.ElementTree`_. :raise: :py:class:`DeserializationException` if unexpected input :return: Instance of :py:class:`.types.Capability` read from :paramref:`path` """ with open(os.fspath(path), encoding="utf-8") as fid: iterator = has_iterparse.iterparse(fid, ["start", "end"]) return capability_from_iterparse(_with_elements_cleared_after_yield(iterator))
[docs]def capability_from_str( text: str, has_iterparse: HasIterparse = xml.etree.ElementTree ) -> our_types.Capability: """ Read an instance of :py:class:`.types.Capability` from the :paramref:`text`. Example usage: .. code-block:: import pathlib import aas_core3_2.xmlization as our_xmlization text = "<...>...</...>" instance = our_xmlization.capability_from_str( text ) # Do something with the ``instance`` :param text: representing an instance of :py:class:`.types.Capability` in XML :param has_iterparse: Module containing ``iterparse`` function. Default is to use :py:mod:`xml.etree.ElementTree` from the standard library. If you have to deal with malicious input, consider using a library such as `defusedxml.ElementTree`_. :raise: :py:class:`DeserializationException` if unexpected input :return: Instance of :py:class:`.types.Capability` read from :paramref:`text` """ iterator = has_iterparse.iterparse(io.StringIO(text), ["start", "end"]) return capability_from_iterparse(_with_elements_cleared_after_yield(iterator))
[docs]def concept_description_from_iterparse( iterator: Iterator[Tuple[str, Element]], ) -> our_types.ConceptDescription: """ Read an instance of :py:class:`.types.ConceptDescription` from the :paramref:`iterator`. Example usage: .. code-block:: import pathlib import xml.etree.ElementTree as ET import aas_core3_2.xmlization as our_xmlization path = pathlib.Path(...) with path.open("rt") as fid: iterator = ET.iterparse( source=fid, events=['start', 'end'] ) instance = our_xmlization.concept_description_from_iterparse( iterator ) # Do something with the ``instance`` :param iterator: Input stream of ``(event, element)`` coming from :py:func:`xml.etree.ElementTree.iterparse` with the argument ``events=["start", "end"]`` :raise: :py:class:`DeserializationException` if unexpected input :return: Instance of :py:class:`.types.ConceptDescription` read from :paramref:`iterator` """ return _read_instance_from_iterparse( iterator, _read_concept_description_as_element, "ConceptDescription" )
[docs]def concept_description_from_stream( stream: TextIO, has_iterparse: HasIterparse = xml.etree.ElementTree ) -> our_types.ConceptDescription: """ Read an instance of :py:class:`.types.ConceptDescription` from the :paramref:`stream`. Example usage: .. code-block:: import aas_core3_2.xmlization as our_xmlization with open_some_stream_over_network(...) as stream: instance = our_xmlization.concept_description_from_stream( stream ) # Do something with the ``instance`` :param stream: representing an instance of :py:class:`.types.ConceptDescription` in XML :param has_iterparse: Module containing ``iterparse`` function. Default is to use :py:mod:`xml.etree.ElementTree` from the standard library. If you have to deal with malicious input, consider using a library such as `defusedxml.ElementTree`_. :raise: :py:class:`DeserializationException` if unexpected input :return: Instance of :py:class:`.types.ConceptDescription` read from :paramref:`stream` """ iterator = has_iterparse.iterparse(stream, ["start", "end"]) return concept_description_from_iterparse( _with_elements_cleared_after_yield(iterator) )
[docs]def concept_description_from_file( path: PathLike, has_iterparse: HasIterparse = xml.etree.ElementTree ) -> our_types.ConceptDescription: """ Read an instance of :py:class:`.types.ConceptDescription` from the :paramref:`path`. Example usage: .. code-block:: import pathlib import aas_core3_2.xmlization as our_xmlization path = pathlib.Path(...) instance = our_xmlization.concept_description_from_file( path ) # Do something with the ``instance`` :param path: to the file representing an instance of :py:class:`.types.ConceptDescription` in XML :param has_iterparse: Module containing ``iterparse`` function. Default is to use :py:mod:`xml.etree.ElementTree` from the standard library. If you have to deal with malicious input, consider using a library such as `defusedxml.ElementTree`_. :raise: :py:class:`DeserializationException` if unexpected input :return: Instance of :py:class:`.types.ConceptDescription` read from :paramref:`path` """ with open(os.fspath(path), encoding="utf-8") as fid: iterator = has_iterparse.iterparse(fid, ["start", "end"]) return concept_description_from_iterparse( _with_elements_cleared_after_yield(iterator) )
[docs]def concept_description_from_str( text: str, has_iterparse: HasIterparse = xml.etree.ElementTree ) -> our_types.ConceptDescription: """ Read an instance of :py:class:`.types.ConceptDescription` from the :paramref:`text`. Example usage: .. code-block:: import pathlib import aas_core3_2.xmlization as our_xmlization text = "<...>...</...>" instance = our_xmlization.concept_description_from_str( text ) # Do something with the ``instance`` :param text: representing an instance of :py:class:`.types.ConceptDescription` in XML :param has_iterparse: Module containing ``iterparse`` function. Default is to use :py:mod:`xml.etree.ElementTree` from the standard library. If you have to deal with malicious input, consider using a library such as `defusedxml.ElementTree`_. :raise: :py:class:`DeserializationException` if unexpected input :return: Instance of :py:class:`.types.ConceptDescription` read from :paramref:`text` """ iterator = has_iterparse.iterparse(io.StringIO(text), ["start", "end"]) return concept_description_from_iterparse( _with_elements_cleared_after_yield(iterator) )
[docs]def reference_from_iterparse( iterator: Iterator[Tuple[str, Element]], ) -> our_types.Reference: """ Read an instance of :py:class:`.types.Reference` from the :paramref:`iterator`. Example usage: .. code-block:: import pathlib import xml.etree.ElementTree as ET import aas_core3_2.xmlization as our_xmlization path = pathlib.Path(...) with path.open("rt") as fid: iterator = ET.iterparse( source=fid, events=['start', 'end'] ) instance = our_xmlization.reference_from_iterparse( iterator ) # Do something with the ``instance`` :param iterator: Input stream of ``(event, element)`` coming from :py:func:`xml.etree.ElementTree.iterparse` with the argument ``events=["start", "end"]`` :raise: :py:class:`DeserializationException` if unexpected input :return: Instance of :py:class:`.types.Reference` read from :paramref:`iterator` """ return _read_instance_from_iterparse( iterator, _read_reference_as_element, "Reference" )
[docs]def reference_from_stream( stream: TextIO, has_iterparse: HasIterparse = xml.etree.ElementTree ) -> our_types.Reference: """ Read an instance of :py:class:`.types.Reference` from the :paramref:`stream`. Example usage: .. code-block:: import aas_core3_2.xmlization as our_xmlization with open_some_stream_over_network(...) as stream: instance = our_xmlization.reference_from_stream( stream ) # Do something with the ``instance`` :param stream: representing an instance of :py:class:`.types.Reference` in XML :param has_iterparse: Module containing ``iterparse`` function. Default is to use :py:mod:`xml.etree.ElementTree` from the standard library. If you have to deal with malicious input, consider using a library such as `defusedxml.ElementTree`_. :raise: :py:class:`DeserializationException` if unexpected input :return: Instance of :py:class:`.types.Reference` read from :paramref:`stream` """ iterator = has_iterparse.iterparse(stream, ["start", "end"]) return reference_from_iterparse(_with_elements_cleared_after_yield(iterator))
[docs]def reference_from_file( path: PathLike, has_iterparse: HasIterparse = xml.etree.ElementTree ) -> our_types.Reference: """ Read an instance of :py:class:`.types.Reference` from the :paramref:`path`. Example usage: .. code-block:: import pathlib import aas_core3_2.xmlization as our_xmlization path = pathlib.Path(...) instance = our_xmlization.reference_from_file( path ) # Do something with the ``instance`` :param path: to the file representing an instance of :py:class:`.types.Reference` in XML :param has_iterparse: Module containing ``iterparse`` function. Default is to use :py:mod:`xml.etree.ElementTree` from the standard library. If you have to deal with malicious input, consider using a library such as `defusedxml.ElementTree`_. :raise: :py:class:`DeserializationException` if unexpected input :return: Instance of :py:class:`.types.Reference` read from :paramref:`path` """ with open(os.fspath(path), encoding="utf-8") as fid: iterator = has_iterparse.iterparse(fid, ["start", "end"]) return reference_from_iterparse(_with_elements_cleared_after_yield(iterator))
[docs]def reference_from_str( text: str, has_iterparse: HasIterparse = xml.etree.ElementTree ) -> our_types.Reference: """ Read an instance of :py:class:`.types.Reference` from the :paramref:`text`. Example usage: .. code-block:: import pathlib import aas_core3_2.xmlization as our_xmlization text = "<...>...</...>" instance = our_xmlization.reference_from_str( text ) # Do something with the ``instance`` :param text: representing an instance of :py:class:`.types.Reference` in XML :param has_iterparse: Module containing ``iterparse`` function. Default is to use :py:mod:`xml.etree.ElementTree` from the standard library. If you have to deal with malicious input, consider using a library such as `defusedxml.ElementTree`_. :raise: :py:class:`DeserializationException` if unexpected input :return: Instance of :py:class:`.types.Reference` read from :paramref:`text` """ iterator = has_iterparse.iterparse(io.StringIO(text), ["start", "end"]) return reference_from_iterparse(_with_elements_cleared_after_yield(iterator))
[docs]def key_from_iterparse(iterator: Iterator[Tuple[str, Element]]) -> our_types.Key: """ Read an instance of :py:class:`.types.Key` from the :paramref:`iterator`. Example usage: .. code-block:: import pathlib import xml.etree.ElementTree as ET import aas_core3_2.xmlization as our_xmlization path = pathlib.Path(...) with path.open("rt") as fid: iterator = ET.iterparse( source=fid, events=['start', 'end'] ) instance = our_xmlization.key_from_iterparse( iterator ) # Do something with the ``instance`` :param iterator: Input stream of ``(event, element)`` coming from :py:func:`xml.etree.ElementTree.iterparse` with the argument ``events=["start", "end"]`` :raise: :py:class:`DeserializationException` if unexpected input :return: Instance of :py:class:`.types.Key` read from :paramref:`iterator` """ return _read_instance_from_iterparse(iterator, _read_key_as_element, "Key")
[docs]def key_from_stream( stream: TextIO, has_iterparse: HasIterparse = xml.etree.ElementTree ) -> our_types.Key: """ Read an instance of :py:class:`.types.Key` from the :paramref:`stream`. Example usage: .. code-block:: import aas_core3_2.xmlization as our_xmlization with open_some_stream_over_network(...) as stream: instance = our_xmlization.key_from_stream( stream ) # Do something with the ``instance`` :param stream: representing an instance of :py:class:`.types.Key` in XML :param has_iterparse: Module containing ``iterparse`` function. Default is to use :py:mod:`xml.etree.ElementTree` from the standard library. If you have to deal with malicious input, consider using a library such as `defusedxml.ElementTree`_. :raise: :py:class:`DeserializationException` if unexpected input :return: Instance of :py:class:`.types.Key` read from :paramref:`stream` """ iterator = has_iterparse.iterparse(stream, ["start", "end"]) return key_from_iterparse(_with_elements_cleared_after_yield(iterator))
[docs]def key_from_file( path: PathLike, has_iterparse: HasIterparse = xml.etree.ElementTree ) -> our_types.Key: """ Read an instance of :py:class:`.types.Key` from the :paramref:`path`. Example usage: .. code-block:: import pathlib import aas_core3_2.xmlization as our_xmlization path = pathlib.Path(...) instance = our_xmlization.key_from_file( path ) # Do something with the ``instance`` :param path: to the file representing an instance of :py:class:`.types.Key` in XML :param has_iterparse: Module containing ``iterparse`` function. Default is to use :py:mod:`xml.etree.ElementTree` from the standard library. If you have to deal with malicious input, consider using a library such as `defusedxml.ElementTree`_. :raise: :py:class:`DeserializationException` if unexpected input :return: Instance of :py:class:`.types.Key` read from :paramref:`path` """ with open(os.fspath(path), encoding="utf-8") as fid: iterator = has_iterparse.iterparse(fid, ["start", "end"]) return key_from_iterparse(_with_elements_cleared_after_yield(iterator))
[docs]def key_from_str( text: str, has_iterparse: HasIterparse = xml.etree.ElementTree ) -> our_types.Key: """ Read an instance of :py:class:`.types.Key` from the :paramref:`text`. Example usage: .. code-block:: import pathlib import aas_core3_2.xmlization as our_xmlization text = "<...>...</...>" instance = our_xmlization.key_from_str( text ) # Do something with the ``instance`` :param text: representing an instance of :py:class:`.types.Key` in XML :param has_iterparse: Module containing ``iterparse`` function. Default is to use :py:mod:`xml.etree.ElementTree` from the standard library. If you have to deal with malicious input, consider using a library such as `defusedxml.ElementTree`_. :raise: :py:class:`DeserializationException` if unexpected input :return: Instance of :py:class:`.types.Key` read from :paramref:`text` """ iterator = has_iterparse.iterparse(io.StringIO(text), ["start", "end"]) return key_from_iterparse(_with_elements_cleared_after_yield(iterator))
[docs]def abstract_lang_string_from_iterparse( iterator: Iterator[Tuple[str, Element]], ) -> our_types.AbstractLangString: """ Read an instance of :py:class:`.types.AbstractLangString` from the :paramref:`iterator`. Example usage: .. code-block:: import pathlib import xml.etree.ElementTree as ET import aas_core3_2.xmlization as our_xmlization path = pathlib.Path(...) with path.open("rt") as fid: iterator = ET.iterparse( source=fid, events=['start', 'end'] ) instance = our_xmlization.abstract_lang_string_from_iterparse( iterator ) # Do something with the ``instance`` :param iterator: Input stream of ``(event, element)`` coming from :py:func:`xml.etree.ElementTree.iterparse` with the argument ``events=["start", "end"]`` :raise: :py:class:`DeserializationException` if unexpected input :return: Instance of :py:class:`.types.AbstractLangString` read from :paramref:`iterator` """ return _read_instance_from_iterparse( iterator, _read_abstract_lang_string_as_element, "AbstractLangString" )
[docs]def abstract_lang_string_from_stream( stream: TextIO, has_iterparse: HasIterparse = xml.etree.ElementTree ) -> our_types.AbstractLangString: """ Read an instance of :py:class:`.types.AbstractLangString` from the :paramref:`stream`. Example usage: .. code-block:: import aas_core3_2.xmlization as our_xmlization with open_some_stream_over_network(...) as stream: instance = our_xmlization.abstract_lang_string_from_stream( stream ) # Do something with the ``instance`` :param stream: representing an instance of :py:class:`.types.AbstractLangString` in XML :param has_iterparse: Module containing ``iterparse`` function. Default is to use :py:mod:`xml.etree.ElementTree` from the standard library. If you have to deal with malicious input, consider using a library such as `defusedxml.ElementTree`_. :raise: :py:class:`DeserializationException` if unexpected input :return: Instance of :py:class:`.types.AbstractLangString` read from :paramref:`stream` """ iterator = has_iterparse.iterparse(stream, ["start", "end"]) return abstract_lang_string_from_iterparse( _with_elements_cleared_after_yield(iterator) )
[docs]def abstract_lang_string_from_file( path: PathLike, has_iterparse: HasIterparse = xml.etree.ElementTree ) -> our_types.AbstractLangString: """ Read an instance of :py:class:`.types.AbstractLangString` from the :paramref:`path`. Example usage: .. code-block:: import pathlib import aas_core3_2.xmlization as our_xmlization path = pathlib.Path(...) instance = our_xmlization.abstract_lang_string_from_file( path ) # Do something with the ``instance`` :param path: to the file representing an instance of :py:class:`.types.AbstractLangString` in XML :param has_iterparse: Module containing ``iterparse`` function. Default is to use :py:mod:`xml.etree.ElementTree` from the standard library. If you have to deal with malicious input, consider using a library such as `defusedxml.ElementTree`_. :raise: :py:class:`DeserializationException` if unexpected input :return: Instance of :py:class:`.types.AbstractLangString` read from :paramref:`path` """ with open(os.fspath(path), encoding="utf-8") as fid: iterator = has_iterparse.iterparse(fid, ["start", "end"]) return abstract_lang_string_from_iterparse( _with_elements_cleared_after_yield(iterator) )
[docs]def abstract_lang_string_from_str( text: str, has_iterparse: HasIterparse = xml.etree.ElementTree ) -> our_types.AbstractLangString: """ Read an instance of :py:class:`.types.AbstractLangString` from the :paramref:`text`. Example usage: .. code-block:: import pathlib import aas_core3_2.xmlization as our_xmlization text = "<...>...</...>" instance = our_xmlization.abstract_lang_string_from_str( text ) # Do something with the ``instance`` :param text: representing an instance of :py:class:`.types.AbstractLangString` in XML :param has_iterparse: Module containing ``iterparse`` function. Default is to use :py:mod:`xml.etree.ElementTree` from the standard library. If you have to deal with malicious input, consider using a library such as `defusedxml.ElementTree`_. :raise: :py:class:`DeserializationException` if unexpected input :return: Instance of :py:class:`.types.AbstractLangString` read from :paramref:`text` """ iterator = has_iterparse.iterparse(io.StringIO(text), ["start", "end"]) return abstract_lang_string_from_iterparse( _with_elements_cleared_after_yield(iterator) )
[docs]def lang_string_name_type_from_iterparse( iterator: Iterator[Tuple[str, Element]], ) -> our_types.LangStringNameType: """ Read an instance of :py:class:`.types.LangStringNameType` from the :paramref:`iterator`. Example usage: .. code-block:: import pathlib import xml.etree.ElementTree as ET import aas_core3_2.xmlization as our_xmlization path = pathlib.Path(...) with path.open("rt") as fid: iterator = ET.iterparse( source=fid, events=['start', 'end'] ) instance = our_xmlization.lang_string_name_type_from_iterparse( iterator ) # Do something with the ``instance`` :param iterator: Input stream of ``(event, element)`` coming from :py:func:`xml.etree.ElementTree.iterparse` with the argument ``events=["start", "end"]`` :raise: :py:class:`DeserializationException` if unexpected input :return: Instance of :py:class:`.types.LangStringNameType` read from :paramref:`iterator` """ return _read_instance_from_iterparse( iterator, _read_lang_string_name_type_as_element, "LangStringNameType" )
[docs]def lang_string_name_type_from_stream( stream: TextIO, has_iterparse: HasIterparse = xml.etree.ElementTree ) -> our_types.LangStringNameType: """ Read an instance of :py:class:`.types.LangStringNameType` from the :paramref:`stream`. Example usage: .. code-block:: import aas_core3_2.xmlization as our_xmlization with open_some_stream_over_network(...) as stream: instance = our_xmlization.lang_string_name_type_from_stream( stream ) # Do something with the ``instance`` :param stream: representing an instance of :py:class:`.types.LangStringNameType` in XML :param has_iterparse: Module containing ``iterparse`` function. Default is to use :py:mod:`xml.etree.ElementTree` from the standard library. If you have to deal with malicious input, consider using a library such as `defusedxml.ElementTree`_. :raise: :py:class:`DeserializationException` if unexpected input :return: Instance of :py:class:`.types.LangStringNameType` read from :paramref:`stream` """ iterator = has_iterparse.iterparse(stream, ["start", "end"]) return lang_string_name_type_from_iterparse( _with_elements_cleared_after_yield(iterator) )
[docs]def lang_string_name_type_from_file( path: PathLike, has_iterparse: HasIterparse = xml.etree.ElementTree ) -> our_types.LangStringNameType: """ Read an instance of :py:class:`.types.LangStringNameType` from the :paramref:`path`. Example usage: .. code-block:: import pathlib import aas_core3_2.xmlization as our_xmlization path = pathlib.Path(...) instance = our_xmlization.lang_string_name_type_from_file( path ) # Do something with the ``instance`` :param path: to the file representing an instance of :py:class:`.types.LangStringNameType` in XML :param has_iterparse: Module containing ``iterparse`` function. Default is to use :py:mod:`xml.etree.ElementTree` from the standard library. If you have to deal with malicious input, consider using a library such as `defusedxml.ElementTree`_. :raise: :py:class:`DeserializationException` if unexpected input :return: Instance of :py:class:`.types.LangStringNameType` read from :paramref:`path` """ with open(os.fspath(path), encoding="utf-8") as fid: iterator = has_iterparse.iterparse(fid, ["start", "end"]) return lang_string_name_type_from_iterparse( _with_elements_cleared_after_yield(iterator) )
[docs]def lang_string_name_type_from_str( text: str, has_iterparse: HasIterparse = xml.etree.ElementTree ) -> our_types.LangStringNameType: """ Read an instance of :py:class:`.types.LangStringNameType` from the :paramref:`text`. Example usage: .. code-block:: import pathlib import aas_core3_2.xmlization as our_xmlization text = "<...>...</...>" instance = our_xmlization.lang_string_name_type_from_str( text ) # Do something with the ``instance`` :param text: representing an instance of :py:class:`.types.LangStringNameType` in XML :param has_iterparse: Module containing ``iterparse`` function. Default is to use :py:mod:`xml.etree.ElementTree` from the standard library. If you have to deal with malicious input, consider using a library such as `defusedxml.ElementTree`_. :raise: :py:class:`DeserializationException` if unexpected input :return: Instance of :py:class:`.types.LangStringNameType` read from :paramref:`text` """ iterator = has_iterparse.iterparse(io.StringIO(text), ["start", "end"]) return lang_string_name_type_from_iterparse( _with_elements_cleared_after_yield(iterator) )
[docs]def lang_string_text_type_from_iterparse( iterator: Iterator[Tuple[str, Element]], ) -> our_types.LangStringTextType: """ Read an instance of :py:class:`.types.LangStringTextType` from the :paramref:`iterator`. Example usage: .. code-block:: import pathlib import xml.etree.ElementTree as ET import aas_core3_2.xmlization as our_xmlization path = pathlib.Path(...) with path.open("rt") as fid: iterator = ET.iterparse( source=fid, events=['start', 'end'] ) instance = our_xmlization.lang_string_text_type_from_iterparse( iterator ) # Do something with the ``instance`` :param iterator: Input stream of ``(event, element)`` coming from :py:func:`xml.etree.ElementTree.iterparse` with the argument ``events=["start", "end"]`` :raise: :py:class:`DeserializationException` if unexpected input :return: Instance of :py:class:`.types.LangStringTextType` read from :paramref:`iterator` """ return _read_instance_from_iterparse( iterator, _read_lang_string_text_type_as_element, "LangStringTextType" )
[docs]def lang_string_text_type_from_stream( stream: TextIO, has_iterparse: HasIterparse = xml.etree.ElementTree ) -> our_types.LangStringTextType: """ Read an instance of :py:class:`.types.LangStringTextType` from the :paramref:`stream`. Example usage: .. code-block:: import aas_core3_2.xmlization as our_xmlization with open_some_stream_over_network(...) as stream: instance = our_xmlization.lang_string_text_type_from_stream( stream ) # Do something with the ``instance`` :param stream: representing an instance of :py:class:`.types.LangStringTextType` in XML :param has_iterparse: Module containing ``iterparse`` function. Default is to use :py:mod:`xml.etree.ElementTree` from the standard library. If you have to deal with malicious input, consider using a library such as `defusedxml.ElementTree`_. :raise: :py:class:`DeserializationException` if unexpected input :return: Instance of :py:class:`.types.LangStringTextType` read from :paramref:`stream` """ iterator = has_iterparse.iterparse(stream, ["start", "end"]) return lang_string_text_type_from_iterparse( _with_elements_cleared_after_yield(iterator) )
[docs]def lang_string_text_type_from_file( path: PathLike, has_iterparse: HasIterparse = xml.etree.ElementTree ) -> our_types.LangStringTextType: """ Read an instance of :py:class:`.types.LangStringTextType` from the :paramref:`path`. Example usage: .. code-block:: import pathlib import aas_core3_2.xmlization as our_xmlization path = pathlib.Path(...) instance = our_xmlization.lang_string_text_type_from_file( path ) # Do something with the ``instance`` :param path: to the file representing an instance of :py:class:`.types.LangStringTextType` in XML :param has_iterparse: Module containing ``iterparse`` function. Default is to use :py:mod:`xml.etree.ElementTree` from the standard library. If you have to deal with malicious input, consider using a library such as `defusedxml.ElementTree`_. :raise: :py:class:`DeserializationException` if unexpected input :return: Instance of :py:class:`.types.LangStringTextType` read from :paramref:`path` """ with open(os.fspath(path), encoding="utf-8") as fid: iterator = has_iterparse.iterparse(fid, ["start", "end"]) return lang_string_text_type_from_iterparse( _with_elements_cleared_after_yield(iterator) )
[docs]def lang_string_text_type_from_str( text: str, has_iterparse: HasIterparse = xml.etree.ElementTree ) -> our_types.LangStringTextType: """ Read an instance of :py:class:`.types.LangStringTextType` from the :paramref:`text`. Example usage: .. code-block:: import pathlib import aas_core3_2.xmlization as our_xmlization text = "<...>...</...>" instance = our_xmlization.lang_string_text_type_from_str( text ) # Do something with the ``instance`` :param text: representing an instance of :py:class:`.types.LangStringTextType` in XML :param has_iterparse: Module containing ``iterparse`` function. Default is to use :py:mod:`xml.etree.ElementTree` from the standard library. If you have to deal with malicious input, consider using a library such as `defusedxml.ElementTree`_. :raise: :py:class:`DeserializationException` if unexpected input :return: Instance of :py:class:`.types.LangStringTextType` read from :paramref:`text` """ iterator = has_iterparse.iterparse(io.StringIO(text), ["start", "end"]) return lang_string_text_type_from_iterparse( _with_elements_cleared_after_yield(iterator) )
[docs]def environment_from_iterparse( iterator: Iterator[Tuple[str, Element]], ) -> our_types.Environment: """ Read an instance of :py:class:`.types.Environment` from the :paramref:`iterator`. Example usage: .. code-block:: import pathlib import xml.etree.ElementTree as ET import aas_core3_2.xmlization as our_xmlization path = pathlib.Path(...) with path.open("rt") as fid: iterator = ET.iterparse( source=fid, events=['start', 'end'] ) instance = our_xmlization.environment_from_iterparse( iterator ) # Do something with the ``instance`` :param iterator: Input stream of ``(event, element)`` coming from :py:func:`xml.etree.ElementTree.iterparse` with the argument ``events=["start", "end"]`` :raise: :py:class:`DeserializationException` if unexpected input :return: Instance of :py:class:`.types.Environment` read from :paramref:`iterator` """ return _read_instance_from_iterparse( iterator, _read_environment_as_element, "Environment" )
[docs]def environment_from_stream( stream: TextIO, has_iterparse: HasIterparse = xml.etree.ElementTree ) -> our_types.Environment: """ Read an instance of :py:class:`.types.Environment` from the :paramref:`stream`. Example usage: .. code-block:: import aas_core3_2.xmlization as our_xmlization with open_some_stream_over_network(...) as stream: instance = our_xmlization.environment_from_stream( stream ) # Do something with the ``instance`` :param stream: representing an instance of :py:class:`.types.Environment` in XML :param has_iterparse: Module containing ``iterparse`` function. Default is to use :py:mod:`xml.etree.ElementTree` from the standard library. If you have to deal with malicious input, consider using a library such as `defusedxml.ElementTree`_. :raise: :py:class:`DeserializationException` if unexpected input :return: Instance of :py:class:`.types.Environment` read from :paramref:`stream` """ iterator = has_iterparse.iterparse(stream, ["start", "end"]) return environment_from_iterparse(_with_elements_cleared_after_yield(iterator))
[docs]def environment_from_file( path: PathLike, has_iterparse: HasIterparse = xml.etree.ElementTree ) -> our_types.Environment: """ Read an instance of :py:class:`.types.Environment` from the :paramref:`path`. Example usage: .. code-block:: import pathlib import aas_core3_2.xmlization as our_xmlization path = pathlib.Path(...) instance = our_xmlization.environment_from_file( path ) # Do something with the ``instance`` :param path: to the file representing an instance of :py:class:`.types.Environment` in XML :param has_iterparse: Module containing ``iterparse`` function. Default is to use :py:mod:`xml.etree.ElementTree` from the standard library. If you have to deal with malicious input, consider using a library such as `defusedxml.ElementTree`_. :raise: :py:class:`DeserializationException` if unexpected input :return: Instance of :py:class:`.types.Environment` read from :paramref:`path` """ with open(os.fspath(path), encoding="utf-8") as fid: iterator = has_iterparse.iterparse(fid, ["start", "end"]) return environment_from_iterparse(_with_elements_cleared_after_yield(iterator))
[docs]def environment_from_str( text: str, has_iterparse: HasIterparse = xml.etree.ElementTree ) -> our_types.Environment: """ Read an instance of :py:class:`.types.Environment` from the :paramref:`text`. Example usage: .. code-block:: import pathlib import aas_core3_2.xmlization as our_xmlization text = "<...>...</...>" instance = our_xmlization.environment_from_str( text ) # Do something with the ``instance`` :param text: representing an instance of :py:class:`.types.Environment` in XML :param has_iterparse: Module containing ``iterparse`` function. Default is to use :py:mod:`xml.etree.ElementTree` from the standard library. If you have to deal with malicious input, consider using a library such as `defusedxml.ElementTree`_. :raise: :py:class:`DeserializationException` if unexpected input :return: Instance of :py:class:`.types.Environment` read from :paramref:`text` """ iterator = has_iterparse.iterparse(io.StringIO(text), ["start", "end"]) return environment_from_iterparse(_with_elements_cleared_after_yield(iterator))
[docs]def data_specification_content_from_iterparse( iterator: Iterator[Tuple[str, Element]], ) -> our_types.DataSpecificationContent: """ Read an instance of :py:class:`.types.DataSpecificationContent` from the :paramref:`iterator`. Example usage: .. code-block:: import pathlib import xml.etree.ElementTree as ET import aas_core3_2.xmlization as our_xmlization path = pathlib.Path(...) with path.open("rt") as fid: iterator = ET.iterparse( source=fid, events=['start', 'end'] ) instance = our_xmlization.data_specification_content_from_iterparse( iterator ) # Do something with the ``instance`` :param iterator: Input stream of ``(event, element)`` coming from :py:func:`xml.etree.ElementTree.iterparse` with the argument ``events=["start", "end"]`` :raise: :py:class:`DeserializationException` if unexpected input :return: Instance of :py:class:`.types.DataSpecificationContent` read from :paramref:`iterator` """ return _read_instance_from_iterparse( iterator, _read_data_specification_content_as_element, "DataSpecificationContent", )
[docs]def data_specification_content_from_stream( stream: TextIO, has_iterparse: HasIterparse = xml.etree.ElementTree ) -> our_types.DataSpecificationContent: """ Read an instance of :py:class:`.types.DataSpecificationContent` from the :paramref:`stream`. Example usage: .. code-block:: import aas_core3_2.xmlization as our_xmlization with open_some_stream_over_network(...) as stream: instance = our_xmlization.data_specification_content_from_stream( stream ) # Do something with the ``instance`` :param stream: representing an instance of :py:class:`.types.DataSpecificationContent` in XML :param has_iterparse: Module containing ``iterparse`` function. Default is to use :py:mod:`xml.etree.ElementTree` from the standard library. If you have to deal with malicious input, consider using a library such as `defusedxml.ElementTree`_. :raise: :py:class:`DeserializationException` if unexpected input :return: Instance of :py:class:`.types.DataSpecificationContent` read from :paramref:`stream` """ iterator = has_iterparse.iterparse(stream, ["start", "end"]) return data_specification_content_from_iterparse( _with_elements_cleared_after_yield(iterator) )
[docs]def data_specification_content_from_file( path: PathLike, has_iterparse: HasIterparse = xml.etree.ElementTree ) -> our_types.DataSpecificationContent: """ Read an instance of :py:class:`.types.DataSpecificationContent` from the :paramref:`path`. Example usage: .. code-block:: import pathlib import aas_core3_2.xmlization as our_xmlization path = pathlib.Path(...) instance = our_xmlization.data_specification_content_from_file( path ) # Do something with the ``instance`` :param path: to the file representing an instance of :py:class:`.types.DataSpecificationContent` in XML :param has_iterparse: Module containing ``iterparse`` function. Default is to use :py:mod:`xml.etree.ElementTree` from the standard library. If you have to deal with malicious input, consider using a library such as `defusedxml.ElementTree`_. :raise: :py:class:`DeserializationException` if unexpected input :return: Instance of :py:class:`.types.DataSpecificationContent` read from :paramref:`path` """ with open(os.fspath(path), encoding="utf-8") as fid: iterator = has_iterparse.iterparse(fid, ["start", "end"]) return data_specification_content_from_iterparse( _with_elements_cleared_after_yield(iterator) )
[docs]def data_specification_content_from_str( text: str, has_iterparse: HasIterparse = xml.etree.ElementTree ) -> our_types.DataSpecificationContent: """ Read an instance of :py:class:`.types.DataSpecificationContent` from the :paramref:`text`. Example usage: .. code-block:: import pathlib import aas_core3_2.xmlization as our_xmlization text = "<...>...</...>" instance = our_xmlization.data_specification_content_from_str( text ) # Do something with the ``instance`` :param text: representing an instance of :py:class:`.types.DataSpecificationContent` in XML :param has_iterparse: Module containing ``iterparse`` function. Default is to use :py:mod:`xml.etree.ElementTree` from the standard library. If you have to deal with malicious input, consider using a library such as `defusedxml.ElementTree`_. :raise: :py:class:`DeserializationException` if unexpected input :return: Instance of :py:class:`.types.DataSpecificationContent` read from :paramref:`text` """ iterator = has_iterparse.iterparse(io.StringIO(text), ["start", "end"]) return data_specification_content_from_iterparse( _with_elements_cleared_after_yield(iterator) )
[docs]def embedded_data_specification_from_iterparse( iterator: Iterator[Tuple[str, Element]], ) -> our_types.EmbeddedDataSpecification: """ Read an instance of :py:class:`.types.EmbeddedDataSpecification` from the :paramref:`iterator`. Example usage: .. code-block:: import pathlib import xml.etree.ElementTree as ET import aas_core3_2.xmlization as our_xmlization path = pathlib.Path(...) with path.open("rt") as fid: iterator = ET.iterparse( source=fid, events=['start', 'end'] ) instance = our_xmlization.embedded_data_specification_from_iterparse( iterator ) # Do something with the ``instance`` :param iterator: Input stream of ``(event, element)`` coming from :py:func:`xml.etree.ElementTree.iterparse` with the argument ``events=["start", "end"]`` :raise: :py:class:`DeserializationException` if unexpected input :return: Instance of :py:class:`.types.EmbeddedDataSpecification` read from :paramref:`iterator` """ return _read_instance_from_iterparse( iterator, _read_embedded_data_specification_as_element, "EmbeddedDataSpecification", )
[docs]def embedded_data_specification_from_stream( stream: TextIO, has_iterparse: HasIterparse = xml.etree.ElementTree ) -> our_types.EmbeddedDataSpecification: """ Read an instance of :py:class:`.types.EmbeddedDataSpecification` from the :paramref:`stream`. Example usage: .. code-block:: import aas_core3_2.xmlization as our_xmlization with open_some_stream_over_network(...) as stream: instance = our_xmlization.embedded_data_specification_from_stream( stream ) # Do something with the ``instance`` :param stream: representing an instance of :py:class:`.types.EmbeddedDataSpecification` in XML :param has_iterparse: Module containing ``iterparse`` function. Default is to use :py:mod:`xml.etree.ElementTree` from the standard library. If you have to deal with malicious input, consider using a library such as `defusedxml.ElementTree`_. :raise: :py:class:`DeserializationException` if unexpected input :return: Instance of :py:class:`.types.EmbeddedDataSpecification` read from :paramref:`stream` """ iterator = has_iterparse.iterparse(stream, ["start", "end"]) return embedded_data_specification_from_iterparse( _with_elements_cleared_after_yield(iterator) )
[docs]def embedded_data_specification_from_file( path: PathLike, has_iterparse: HasIterparse = xml.etree.ElementTree ) -> our_types.EmbeddedDataSpecification: """ Read an instance of :py:class:`.types.EmbeddedDataSpecification` from the :paramref:`path`. Example usage: .. code-block:: import pathlib import aas_core3_2.xmlization as our_xmlization path = pathlib.Path(...) instance = our_xmlization.embedded_data_specification_from_file( path ) # Do something with the ``instance`` :param path: to the file representing an instance of :py:class:`.types.EmbeddedDataSpecification` in XML :param has_iterparse: Module containing ``iterparse`` function. Default is to use :py:mod:`xml.etree.ElementTree` from the standard library. If you have to deal with malicious input, consider using a library such as `defusedxml.ElementTree`_. :raise: :py:class:`DeserializationException` if unexpected input :return: Instance of :py:class:`.types.EmbeddedDataSpecification` read from :paramref:`path` """ with open(os.fspath(path), encoding="utf-8") as fid: iterator = has_iterparse.iterparse(fid, ["start", "end"]) return embedded_data_specification_from_iterparse( _with_elements_cleared_after_yield(iterator) )
[docs]def embedded_data_specification_from_str( text: str, has_iterparse: HasIterparse = xml.etree.ElementTree ) -> our_types.EmbeddedDataSpecification: """ Read an instance of :py:class:`.types.EmbeddedDataSpecification` from the :paramref:`text`. Example usage: .. code-block:: import pathlib import aas_core3_2.xmlization as our_xmlization text = "<...>...</...>" instance = our_xmlization.embedded_data_specification_from_str( text ) # Do something with the ``instance`` :param text: representing an instance of :py:class:`.types.EmbeddedDataSpecification` in XML :param has_iterparse: Module containing ``iterparse`` function. Default is to use :py:mod:`xml.etree.ElementTree` from the standard library. If you have to deal with malicious input, consider using a library such as `defusedxml.ElementTree`_. :raise: :py:class:`DeserializationException` if unexpected input :return: Instance of :py:class:`.types.EmbeddedDataSpecification` read from :paramref:`text` """ iterator = has_iterparse.iterparse(io.StringIO(text), ["start", "end"]) return embedded_data_specification_from_iterparse( _with_elements_cleared_after_yield(iterator) )
[docs]def level_type_from_iterparse( iterator: Iterator[Tuple[str, Element]], ) -> our_types.LevelType: """ Read an instance of :py:class:`.types.LevelType` from the :paramref:`iterator`. Example usage: .. code-block:: import pathlib import xml.etree.ElementTree as ET import aas_core3_2.xmlization as our_xmlization path = pathlib.Path(...) with path.open("rt") as fid: iterator = ET.iterparse( source=fid, events=['start', 'end'] ) instance = our_xmlization.level_type_from_iterparse( iterator ) # Do something with the ``instance`` :param iterator: Input stream of ``(event, element)`` coming from :py:func:`xml.etree.ElementTree.iterparse` with the argument ``events=["start", "end"]`` :raise: :py:class:`DeserializationException` if unexpected input :return: Instance of :py:class:`.types.LevelType` read from :paramref:`iterator` """ return _read_instance_from_iterparse( iterator, _read_level_type_as_element, "LevelType" )
[docs]def level_type_from_stream( stream: TextIO, has_iterparse: HasIterparse = xml.etree.ElementTree ) -> our_types.LevelType: """ Read an instance of :py:class:`.types.LevelType` from the :paramref:`stream`. Example usage: .. code-block:: import aas_core3_2.xmlization as our_xmlization with open_some_stream_over_network(...) as stream: instance = our_xmlization.level_type_from_stream( stream ) # Do something with the ``instance`` :param stream: representing an instance of :py:class:`.types.LevelType` in XML :param has_iterparse: Module containing ``iterparse`` function. Default is to use :py:mod:`xml.etree.ElementTree` from the standard library. If you have to deal with malicious input, consider using a library such as `defusedxml.ElementTree`_. :raise: :py:class:`DeserializationException` if unexpected input :return: Instance of :py:class:`.types.LevelType` read from :paramref:`stream` """ iterator = has_iterparse.iterparse(stream, ["start", "end"]) return level_type_from_iterparse(_with_elements_cleared_after_yield(iterator))
[docs]def level_type_from_file( path: PathLike, has_iterparse: HasIterparse = xml.etree.ElementTree ) -> our_types.LevelType: """ Read an instance of :py:class:`.types.LevelType` from the :paramref:`path`. Example usage: .. code-block:: import pathlib import aas_core3_2.xmlization as our_xmlization path = pathlib.Path(...) instance = our_xmlization.level_type_from_file( path ) # Do something with the ``instance`` :param path: to the file representing an instance of :py:class:`.types.LevelType` in XML :param has_iterparse: Module containing ``iterparse`` function. Default is to use :py:mod:`xml.etree.ElementTree` from the standard library. If you have to deal with malicious input, consider using a library such as `defusedxml.ElementTree`_. :raise: :py:class:`DeserializationException` if unexpected input :return: Instance of :py:class:`.types.LevelType` read from :paramref:`path` """ with open(os.fspath(path), encoding="utf-8") as fid: iterator = has_iterparse.iterparse(fid, ["start", "end"]) return level_type_from_iterparse(_with_elements_cleared_after_yield(iterator))
[docs]def level_type_from_str( text: str, has_iterparse: HasIterparse = xml.etree.ElementTree ) -> our_types.LevelType: """ Read an instance of :py:class:`.types.LevelType` from the :paramref:`text`. Example usage: .. code-block:: import pathlib import aas_core3_2.xmlization as our_xmlization text = "<...>...</...>" instance = our_xmlization.level_type_from_str( text ) # Do something with the ``instance`` :param text: representing an instance of :py:class:`.types.LevelType` in XML :param has_iterparse: Module containing ``iterparse`` function. Default is to use :py:mod:`xml.etree.ElementTree` from the standard library. If you have to deal with malicious input, consider using a library such as `defusedxml.ElementTree`_. :raise: :py:class:`DeserializationException` if unexpected input :return: Instance of :py:class:`.types.LevelType` read from :paramref:`text` """ iterator = has_iterparse.iterparse(io.StringIO(text), ["start", "end"]) return level_type_from_iterparse(_with_elements_cleared_after_yield(iterator))
[docs]def value_reference_pair_from_iterparse( iterator: Iterator[Tuple[str, Element]], ) -> our_types.ValueReferencePair: """ Read an instance of :py:class:`.types.ValueReferencePair` from the :paramref:`iterator`. Example usage: .. code-block:: import pathlib import xml.etree.ElementTree as ET import aas_core3_2.xmlization as our_xmlization path = pathlib.Path(...) with path.open("rt") as fid: iterator = ET.iterparse( source=fid, events=['start', 'end'] ) instance = our_xmlization.value_reference_pair_from_iterparse( iterator ) # Do something with the ``instance`` :param iterator: Input stream of ``(event, element)`` coming from :py:func:`xml.etree.ElementTree.iterparse` with the argument ``events=["start", "end"]`` :raise: :py:class:`DeserializationException` if unexpected input :return: Instance of :py:class:`.types.ValueReferencePair` read from :paramref:`iterator` """ return _read_instance_from_iterparse( iterator, _read_value_reference_pair_as_element, "ValueReferencePair" )
[docs]def value_reference_pair_from_stream( stream: TextIO, has_iterparse: HasIterparse = xml.etree.ElementTree ) -> our_types.ValueReferencePair: """ Read an instance of :py:class:`.types.ValueReferencePair` from the :paramref:`stream`. Example usage: .. code-block:: import aas_core3_2.xmlization as our_xmlization with open_some_stream_over_network(...) as stream: instance = our_xmlization.value_reference_pair_from_stream( stream ) # Do something with the ``instance`` :param stream: representing an instance of :py:class:`.types.ValueReferencePair` in XML :param has_iterparse: Module containing ``iterparse`` function. Default is to use :py:mod:`xml.etree.ElementTree` from the standard library. If you have to deal with malicious input, consider using a library such as `defusedxml.ElementTree`_. :raise: :py:class:`DeserializationException` if unexpected input :return: Instance of :py:class:`.types.ValueReferencePair` read from :paramref:`stream` """ iterator = has_iterparse.iterparse(stream, ["start", "end"]) return value_reference_pair_from_iterparse( _with_elements_cleared_after_yield(iterator) )
[docs]def value_reference_pair_from_file( path: PathLike, has_iterparse: HasIterparse = xml.etree.ElementTree ) -> our_types.ValueReferencePair: """ Read an instance of :py:class:`.types.ValueReferencePair` from the :paramref:`path`. Example usage: .. code-block:: import pathlib import aas_core3_2.xmlization as our_xmlization path = pathlib.Path(...) instance = our_xmlization.value_reference_pair_from_file( path ) # Do something with the ``instance`` :param path: to the file representing an instance of :py:class:`.types.ValueReferencePair` in XML :param has_iterparse: Module containing ``iterparse`` function. Default is to use :py:mod:`xml.etree.ElementTree` from the standard library. If you have to deal with malicious input, consider using a library such as `defusedxml.ElementTree`_. :raise: :py:class:`DeserializationException` if unexpected input :return: Instance of :py:class:`.types.ValueReferencePair` read from :paramref:`path` """ with open(os.fspath(path), encoding="utf-8") as fid: iterator = has_iterparse.iterparse(fid, ["start", "end"]) return value_reference_pair_from_iterparse( _with_elements_cleared_after_yield(iterator) )
[docs]def value_reference_pair_from_str( text: str, has_iterparse: HasIterparse = xml.etree.ElementTree ) -> our_types.ValueReferencePair: """ Read an instance of :py:class:`.types.ValueReferencePair` from the :paramref:`text`. Example usage: .. code-block:: import pathlib import aas_core3_2.xmlization as our_xmlization text = "<...>...</...>" instance = our_xmlization.value_reference_pair_from_str( text ) # Do something with the ``instance`` :param text: representing an instance of :py:class:`.types.ValueReferencePair` in XML :param has_iterparse: Module containing ``iterparse`` function. Default is to use :py:mod:`xml.etree.ElementTree` from the standard library. If you have to deal with malicious input, consider using a library such as `defusedxml.ElementTree`_. :raise: :py:class:`DeserializationException` if unexpected input :return: Instance of :py:class:`.types.ValueReferencePair` read from :paramref:`text` """ iterator = has_iterparse.iterparse(io.StringIO(text), ["start", "end"]) return value_reference_pair_from_iterparse( _with_elements_cleared_after_yield(iterator) )
[docs]def value_list_from_iterparse( iterator: Iterator[Tuple[str, Element]], ) -> our_types.ValueList: """ Read an instance of :py:class:`.types.ValueList` from the :paramref:`iterator`. Example usage: .. code-block:: import pathlib import xml.etree.ElementTree as ET import aas_core3_2.xmlization as our_xmlization path = pathlib.Path(...) with path.open("rt") as fid: iterator = ET.iterparse( source=fid, events=['start', 'end'] ) instance = our_xmlization.value_list_from_iterparse( iterator ) # Do something with the ``instance`` :param iterator: Input stream of ``(event, element)`` coming from :py:func:`xml.etree.ElementTree.iterparse` with the argument ``events=["start", "end"]`` :raise: :py:class:`DeserializationException` if unexpected input :return: Instance of :py:class:`.types.ValueList` read from :paramref:`iterator` """ return _read_instance_from_iterparse( iterator, _read_value_list_as_element, "ValueList" )
[docs]def value_list_from_stream( stream: TextIO, has_iterparse: HasIterparse = xml.etree.ElementTree ) -> our_types.ValueList: """ Read an instance of :py:class:`.types.ValueList` from the :paramref:`stream`. Example usage: .. code-block:: import aas_core3_2.xmlization as our_xmlization with open_some_stream_over_network(...) as stream: instance = our_xmlization.value_list_from_stream( stream ) # Do something with the ``instance`` :param stream: representing an instance of :py:class:`.types.ValueList` in XML :param has_iterparse: Module containing ``iterparse`` function. Default is to use :py:mod:`xml.etree.ElementTree` from the standard library. If you have to deal with malicious input, consider using a library such as `defusedxml.ElementTree`_. :raise: :py:class:`DeserializationException` if unexpected input :return: Instance of :py:class:`.types.ValueList` read from :paramref:`stream` """ iterator = has_iterparse.iterparse(stream, ["start", "end"]) return value_list_from_iterparse(_with_elements_cleared_after_yield(iterator))
[docs]def value_list_from_file( path: PathLike, has_iterparse: HasIterparse = xml.etree.ElementTree ) -> our_types.ValueList: """ Read an instance of :py:class:`.types.ValueList` from the :paramref:`path`. Example usage: .. code-block:: import pathlib import aas_core3_2.xmlization as our_xmlization path = pathlib.Path(...) instance = our_xmlization.value_list_from_file( path ) # Do something with the ``instance`` :param path: to the file representing an instance of :py:class:`.types.ValueList` in XML :param has_iterparse: Module containing ``iterparse`` function. Default is to use :py:mod:`xml.etree.ElementTree` from the standard library. If you have to deal with malicious input, consider using a library such as `defusedxml.ElementTree`_. :raise: :py:class:`DeserializationException` if unexpected input :return: Instance of :py:class:`.types.ValueList` read from :paramref:`path` """ with open(os.fspath(path), encoding="utf-8") as fid: iterator = has_iterparse.iterparse(fid, ["start", "end"]) return value_list_from_iterparse(_with_elements_cleared_after_yield(iterator))
[docs]def value_list_from_str( text: str, has_iterparse: HasIterparse = xml.etree.ElementTree ) -> our_types.ValueList: """ Read an instance of :py:class:`.types.ValueList` from the :paramref:`text`. Example usage: .. code-block:: import pathlib import aas_core3_2.xmlization as our_xmlization text = "<...>...</...>" instance = our_xmlization.value_list_from_str( text ) # Do something with the ``instance`` :param text: representing an instance of :py:class:`.types.ValueList` in XML :param has_iterparse: Module containing ``iterparse`` function. Default is to use :py:mod:`xml.etree.ElementTree` from the standard library. If you have to deal with malicious input, consider using a library such as `defusedxml.ElementTree`_. :raise: :py:class:`DeserializationException` if unexpected input :return: Instance of :py:class:`.types.ValueList` read from :paramref:`text` """ iterator = has_iterparse.iterparse(io.StringIO(text), ["start", "end"]) return value_list_from_iterparse(_with_elements_cleared_after_yield(iterator))
[docs]def lang_string_preferred_name_type_iec_61360_from_iterparse( iterator: Iterator[Tuple[str, Element]], ) -> our_types.LangStringPreferredNameTypeIEC61360: """ Read an instance of :py:class:`.types.LangStringPreferredNameTypeIEC61360` from the :paramref:`iterator`. Example usage: .. code-block:: import pathlib import xml.etree.ElementTree as ET import aas_core3_2.xmlization as our_xmlization path = pathlib.Path(...) with path.open("rt") as fid: iterator = ET.iterparse( source=fid, events=['start', 'end'] ) instance = our_xmlization.lang_string_preferred_name_type_iec_61360_from_iterparse( iterator ) # Do something with the ``instance`` :param iterator: Input stream of ``(event, element)`` coming from :py:func:`xml.etree.ElementTree.iterparse` with the argument ``events=["start", "end"]`` :raise: :py:class:`DeserializationException` if unexpected input :return: Instance of :py:class:`.types.LangStringPreferredNameTypeIEC61360` read from :paramref:`iterator` """ return _read_instance_from_iterparse( iterator, _read_lang_string_preferred_name_type_iec_61360_as_element, "LangStringPreferredNameTypeIEC61360", )
[docs]def lang_string_preferred_name_type_iec_61360_from_stream( stream: TextIO, has_iterparse: HasIterparse = xml.etree.ElementTree ) -> our_types.LangStringPreferredNameTypeIEC61360: """ Read an instance of :py:class:`.types.LangStringPreferredNameTypeIEC61360` from the :paramref:`stream`. Example usage: .. code-block:: import aas_core3_2.xmlization as our_xmlization with open_some_stream_over_network(...) as stream: instance = our_xmlization.lang_string_preferred_name_type_iec_61360_from_stream( stream ) # Do something with the ``instance`` :param stream: representing an instance of :py:class:`.types.LangStringPreferredNameTypeIEC61360` in XML :param has_iterparse: Module containing ``iterparse`` function. Default is to use :py:mod:`xml.etree.ElementTree` from the standard library. If you have to deal with malicious input, consider using a library such as `defusedxml.ElementTree`_. :raise: :py:class:`DeserializationException` if unexpected input :return: Instance of :py:class:`.types.LangStringPreferredNameTypeIEC61360` read from :paramref:`stream` """ iterator = has_iterparse.iterparse(stream, ["start", "end"]) return lang_string_preferred_name_type_iec_61360_from_iterparse( _with_elements_cleared_after_yield(iterator) )
[docs]def lang_string_preferred_name_type_iec_61360_from_file( path: PathLike, has_iterparse: HasIterparse = xml.etree.ElementTree ) -> our_types.LangStringPreferredNameTypeIEC61360: """ Read an instance of :py:class:`.types.LangStringPreferredNameTypeIEC61360` from the :paramref:`path`. Example usage: .. code-block:: import pathlib import aas_core3_2.xmlization as our_xmlization path = pathlib.Path(...) instance = our_xmlization.lang_string_preferred_name_type_iec_61360_from_file( path ) # Do something with the ``instance`` :param path: to the file representing an instance of :py:class:`.types.LangStringPreferredNameTypeIEC61360` in XML :param has_iterparse: Module containing ``iterparse`` function. Default is to use :py:mod:`xml.etree.ElementTree` from the standard library. If you have to deal with malicious input, consider using a library such as `defusedxml.ElementTree`_. :raise: :py:class:`DeserializationException` if unexpected input :return: Instance of :py:class:`.types.LangStringPreferredNameTypeIEC61360` read from :paramref:`path` """ with open(os.fspath(path), encoding="utf-8") as fid: iterator = has_iterparse.iterparse(fid, ["start", "end"]) return lang_string_preferred_name_type_iec_61360_from_iterparse( _with_elements_cleared_after_yield(iterator) )
[docs]def lang_string_preferred_name_type_iec_61360_from_str( text: str, has_iterparse: HasIterparse = xml.etree.ElementTree ) -> our_types.LangStringPreferredNameTypeIEC61360: """ Read an instance of :py:class:`.types.LangStringPreferredNameTypeIEC61360` from the :paramref:`text`. Example usage: .. code-block:: import pathlib import aas_core3_2.xmlization as our_xmlization text = "<...>...</...>" instance = our_xmlization.lang_string_preferred_name_type_iec_61360_from_str( text ) # Do something with the ``instance`` :param text: representing an instance of :py:class:`.types.LangStringPreferredNameTypeIEC61360` in XML :param has_iterparse: Module containing ``iterparse`` function. Default is to use :py:mod:`xml.etree.ElementTree` from the standard library. If you have to deal with malicious input, consider using a library such as `defusedxml.ElementTree`_. :raise: :py:class:`DeserializationException` if unexpected input :return: Instance of :py:class:`.types.LangStringPreferredNameTypeIEC61360` read from :paramref:`text` """ iterator = has_iterparse.iterparse(io.StringIO(text), ["start", "end"]) return lang_string_preferred_name_type_iec_61360_from_iterparse( _with_elements_cleared_after_yield(iterator) )
[docs]def lang_string_short_name_type_iec_61360_from_iterparse( iterator: Iterator[Tuple[str, Element]], ) -> our_types.LangStringShortNameTypeIEC61360: """ Read an instance of :py:class:`.types.LangStringShortNameTypeIEC61360` from the :paramref:`iterator`. Example usage: .. code-block:: import pathlib import xml.etree.ElementTree as ET import aas_core3_2.xmlization as our_xmlization path = pathlib.Path(...) with path.open("rt") as fid: iterator = ET.iterparse( source=fid, events=['start', 'end'] ) instance = our_xmlization.lang_string_short_name_type_iec_61360_from_iterparse( iterator ) # Do something with the ``instance`` :param iterator: Input stream of ``(event, element)`` coming from :py:func:`xml.etree.ElementTree.iterparse` with the argument ``events=["start", "end"]`` :raise: :py:class:`DeserializationException` if unexpected input :return: Instance of :py:class:`.types.LangStringShortNameTypeIEC61360` read from :paramref:`iterator` """ return _read_instance_from_iterparse( iterator, _read_lang_string_short_name_type_iec_61360_as_element, "LangStringShortNameTypeIEC61360", )
[docs]def lang_string_short_name_type_iec_61360_from_stream( stream: TextIO, has_iterparse: HasIterparse = xml.etree.ElementTree ) -> our_types.LangStringShortNameTypeIEC61360: """ Read an instance of :py:class:`.types.LangStringShortNameTypeIEC61360` from the :paramref:`stream`. Example usage: .. code-block:: import aas_core3_2.xmlization as our_xmlization with open_some_stream_over_network(...) as stream: instance = our_xmlization.lang_string_short_name_type_iec_61360_from_stream( stream ) # Do something with the ``instance`` :param stream: representing an instance of :py:class:`.types.LangStringShortNameTypeIEC61360` in XML :param has_iterparse: Module containing ``iterparse`` function. Default is to use :py:mod:`xml.etree.ElementTree` from the standard library. If you have to deal with malicious input, consider using a library such as `defusedxml.ElementTree`_. :raise: :py:class:`DeserializationException` if unexpected input :return: Instance of :py:class:`.types.LangStringShortNameTypeIEC61360` read from :paramref:`stream` """ iterator = has_iterparse.iterparse(stream, ["start", "end"]) return lang_string_short_name_type_iec_61360_from_iterparse( _with_elements_cleared_after_yield(iterator) )
[docs]def lang_string_short_name_type_iec_61360_from_file( path: PathLike, has_iterparse: HasIterparse = xml.etree.ElementTree ) -> our_types.LangStringShortNameTypeIEC61360: """ Read an instance of :py:class:`.types.LangStringShortNameTypeIEC61360` from the :paramref:`path`. Example usage: .. code-block:: import pathlib import aas_core3_2.xmlization as our_xmlization path = pathlib.Path(...) instance = our_xmlization.lang_string_short_name_type_iec_61360_from_file( path ) # Do something with the ``instance`` :param path: to the file representing an instance of :py:class:`.types.LangStringShortNameTypeIEC61360` in XML :param has_iterparse: Module containing ``iterparse`` function. Default is to use :py:mod:`xml.etree.ElementTree` from the standard library. If you have to deal with malicious input, consider using a library such as `defusedxml.ElementTree`_. :raise: :py:class:`DeserializationException` if unexpected input :return: Instance of :py:class:`.types.LangStringShortNameTypeIEC61360` read from :paramref:`path` """ with open(os.fspath(path), encoding="utf-8") as fid: iterator = has_iterparse.iterparse(fid, ["start", "end"]) return lang_string_short_name_type_iec_61360_from_iterparse( _with_elements_cleared_after_yield(iterator) )
[docs]def lang_string_short_name_type_iec_61360_from_str( text: str, has_iterparse: HasIterparse = xml.etree.ElementTree ) -> our_types.LangStringShortNameTypeIEC61360: """ Read an instance of :py:class:`.types.LangStringShortNameTypeIEC61360` from the :paramref:`text`. Example usage: .. code-block:: import pathlib import aas_core3_2.xmlization as our_xmlization text = "<...>...</...>" instance = our_xmlization.lang_string_short_name_type_iec_61360_from_str( text ) # Do something with the ``instance`` :param text: representing an instance of :py:class:`.types.LangStringShortNameTypeIEC61360` in XML :param has_iterparse: Module containing ``iterparse`` function. Default is to use :py:mod:`xml.etree.ElementTree` from the standard library. If you have to deal with malicious input, consider using a library such as `defusedxml.ElementTree`_. :raise: :py:class:`DeserializationException` if unexpected input :return: Instance of :py:class:`.types.LangStringShortNameTypeIEC61360` read from :paramref:`text` """ iterator = has_iterparse.iterparse(io.StringIO(text), ["start", "end"]) return lang_string_short_name_type_iec_61360_from_iterparse( _with_elements_cleared_after_yield(iterator) )
[docs]def lang_string_definition_type_iec_61360_from_iterparse( iterator: Iterator[Tuple[str, Element]], ) -> our_types.LangStringDefinitionTypeIEC61360: """ Read an instance of :py:class:`.types.LangStringDefinitionTypeIEC61360` from the :paramref:`iterator`. Example usage: .. code-block:: import pathlib import xml.etree.ElementTree as ET import aas_core3_2.xmlization as our_xmlization path = pathlib.Path(...) with path.open("rt") as fid: iterator = ET.iterparse( source=fid, events=['start', 'end'] ) instance = our_xmlization.lang_string_definition_type_iec_61360_from_iterparse( iterator ) # Do something with the ``instance`` :param iterator: Input stream of ``(event, element)`` coming from :py:func:`xml.etree.ElementTree.iterparse` with the argument ``events=["start", "end"]`` :raise: :py:class:`DeserializationException` if unexpected input :return: Instance of :py:class:`.types.LangStringDefinitionTypeIEC61360` read from :paramref:`iterator` """ return _read_instance_from_iterparse( iterator, _read_lang_string_definition_type_iec_61360_as_element, "LangStringDefinitionTypeIEC61360", )
[docs]def lang_string_definition_type_iec_61360_from_stream( stream: TextIO, has_iterparse: HasIterparse = xml.etree.ElementTree ) -> our_types.LangStringDefinitionTypeIEC61360: """ Read an instance of :py:class:`.types.LangStringDefinitionTypeIEC61360` from the :paramref:`stream`. Example usage: .. code-block:: import aas_core3_2.xmlization as our_xmlization with open_some_stream_over_network(...) as stream: instance = our_xmlization.lang_string_definition_type_iec_61360_from_stream( stream ) # Do something with the ``instance`` :param stream: representing an instance of :py:class:`.types.LangStringDefinitionTypeIEC61360` in XML :param has_iterparse: Module containing ``iterparse`` function. Default is to use :py:mod:`xml.etree.ElementTree` from the standard library. If you have to deal with malicious input, consider using a library such as `defusedxml.ElementTree`_. :raise: :py:class:`DeserializationException` if unexpected input :return: Instance of :py:class:`.types.LangStringDefinitionTypeIEC61360` read from :paramref:`stream` """ iterator = has_iterparse.iterparse(stream, ["start", "end"]) return lang_string_definition_type_iec_61360_from_iterparse( _with_elements_cleared_after_yield(iterator) )
[docs]def lang_string_definition_type_iec_61360_from_file( path: PathLike, has_iterparse: HasIterparse = xml.etree.ElementTree ) -> our_types.LangStringDefinitionTypeIEC61360: """ Read an instance of :py:class:`.types.LangStringDefinitionTypeIEC61360` from the :paramref:`path`. Example usage: .. code-block:: import pathlib import aas_core3_2.xmlization as our_xmlization path = pathlib.Path(...) instance = our_xmlization.lang_string_definition_type_iec_61360_from_file( path ) # Do something with the ``instance`` :param path: to the file representing an instance of :py:class:`.types.LangStringDefinitionTypeIEC61360` in XML :param has_iterparse: Module containing ``iterparse`` function. Default is to use :py:mod:`xml.etree.ElementTree` from the standard library. If you have to deal with malicious input, consider using a library such as `defusedxml.ElementTree`_. :raise: :py:class:`DeserializationException` if unexpected input :return: Instance of :py:class:`.types.LangStringDefinitionTypeIEC61360` read from :paramref:`path` """ with open(os.fspath(path), encoding="utf-8") as fid: iterator = has_iterparse.iterparse(fid, ["start", "end"]) return lang_string_definition_type_iec_61360_from_iterparse( _with_elements_cleared_after_yield(iterator) )
[docs]def lang_string_definition_type_iec_61360_from_str( text: str, has_iterparse: HasIterparse = xml.etree.ElementTree ) -> our_types.LangStringDefinitionTypeIEC61360: """ Read an instance of :py:class:`.types.LangStringDefinitionTypeIEC61360` from the :paramref:`text`. Example usage: .. code-block:: import pathlib import aas_core3_2.xmlization as our_xmlization text = "<...>...</...>" instance = our_xmlization.lang_string_definition_type_iec_61360_from_str( text ) # Do something with the ``instance`` :param text: representing an instance of :py:class:`.types.LangStringDefinitionTypeIEC61360` in XML :param has_iterparse: Module containing ``iterparse`` function. Default is to use :py:mod:`xml.etree.ElementTree` from the standard library. If you have to deal with malicious input, consider using a library such as `defusedxml.ElementTree`_. :raise: :py:class:`DeserializationException` if unexpected input :return: Instance of :py:class:`.types.LangStringDefinitionTypeIEC61360` read from :paramref:`text` """ iterator = has_iterparse.iterparse(io.StringIO(text), ["start", "end"]) return lang_string_definition_type_iec_61360_from_iterparse( _with_elements_cleared_after_yield(iterator) )
[docs]def lang_string_uom_from_iterparse( iterator: Iterator[Tuple[str, Element]], ) -> our_types.LangStringUom: """ Read an instance of :py:class:`.types.LangStringUom` from the :paramref:`iterator`. Example usage: .. code-block:: import pathlib import xml.etree.ElementTree as ET import aas_core3_2.xmlization as our_xmlization path = pathlib.Path(...) with path.open("rt") as fid: iterator = ET.iterparse( source=fid, events=['start', 'end'] ) instance = our_xmlization.lang_string_uom_from_iterparse( iterator ) # Do something with the ``instance`` :param iterator: Input stream of ``(event, element)`` coming from :py:func:`xml.etree.ElementTree.iterparse` with the argument ``events=["start", "end"]`` :raise: :py:class:`DeserializationException` if unexpected input :return: Instance of :py:class:`.types.LangStringUom` read from :paramref:`iterator` """ return _read_instance_from_iterparse( iterator, _read_lang_string_uom_as_element, "LangStringUom" )
[docs]def lang_string_uom_from_stream( stream: TextIO, has_iterparse: HasIterparse = xml.etree.ElementTree ) -> our_types.LangStringUom: """ Read an instance of :py:class:`.types.LangStringUom` from the :paramref:`stream`. Example usage: .. code-block:: import aas_core3_2.xmlization as our_xmlization with open_some_stream_over_network(...) as stream: instance = our_xmlization.lang_string_uom_from_stream( stream ) # Do something with the ``instance`` :param stream: representing an instance of :py:class:`.types.LangStringUom` in XML :param has_iterparse: Module containing ``iterparse`` function. Default is to use :py:mod:`xml.etree.ElementTree` from the standard library. If you have to deal with malicious input, consider using a library such as `defusedxml.ElementTree`_. :raise: :py:class:`DeserializationException` if unexpected input :return: Instance of :py:class:`.types.LangStringUom` read from :paramref:`stream` """ iterator = has_iterparse.iterparse(stream, ["start", "end"]) return lang_string_uom_from_iterparse(_with_elements_cleared_after_yield(iterator))
[docs]def lang_string_uom_from_file( path: PathLike, has_iterparse: HasIterparse = xml.etree.ElementTree ) -> our_types.LangStringUom: """ Read an instance of :py:class:`.types.LangStringUom` from the :paramref:`path`. Example usage: .. code-block:: import pathlib import aas_core3_2.xmlization as our_xmlization path = pathlib.Path(...) instance = our_xmlization.lang_string_uom_from_file( path ) # Do something with the ``instance`` :param path: to the file representing an instance of :py:class:`.types.LangStringUom` in XML :param has_iterparse: Module containing ``iterparse`` function. Default is to use :py:mod:`xml.etree.ElementTree` from the standard library. If you have to deal with malicious input, consider using a library such as `defusedxml.ElementTree`_. :raise: :py:class:`DeserializationException` if unexpected input :return: Instance of :py:class:`.types.LangStringUom` read from :paramref:`path` """ with open(os.fspath(path), encoding="utf-8") as fid: iterator = has_iterparse.iterparse(fid, ["start", "end"]) return lang_string_uom_from_iterparse( _with_elements_cleared_after_yield(iterator) )
[docs]def lang_string_uom_from_str( text: str, has_iterparse: HasIterparse = xml.etree.ElementTree ) -> our_types.LangStringUom: """ Read an instance of :py:class:`.types.LangStringUom` from the :paramref:`text`. Example usage: .. code-block:: import pathlib import aas_core3_2.xmlization as our_xmlization text = "<...>...</...>" instance = our_xmlization.lang_string_uom_from_str( text ) # Do something with the ``instance`` :param text: representing an instance of :py:class:`.types.LangStringUom` in XML :param has_iterparse: Module containing ``iterparse`` function. Default is to use :py:mod:`xml.etree.ElementTree` from the standard library. If you have to deal with malicious input, consider using a library such as `defusedxml.ElementTree`_. :raise: :py:class:`DeserializationException` if unexpected input :return: Instance of :py:class:`.types.LangStringUom` read from :paramref:`text` """ iterator = has_iterparse.iterparse(io.StringIO(text), ["start", "end"]) return lang_string_uom_from_iterparse(_with_elements_cleared_after_yield(iterator))
[docs]def definition_type_uom_from_iterparse( iterator: Iterator[Tuple[str, Element]], ) -> our_types.DefinitionTypeUom: """ Read an instance of :py:class:`.types.DefinitionTypeUom` from the :paramref:`iterator`. Example usage: .. code-block:: import pathlib import xml.etree.ElementTree as ET import aas_core3_2.xmlization as our_xmlization path = pathlib.Path(...) with path.open("rt") as fid: iterator = ET.iterparse( source=fid, events=['start', 'end'] ) instance = our_xmlization.definition_type_uom_from_iterparse( iterator ) # Do something with the ``instance`` :param iterator: Input stream of ``(event, element)`` coming from :py:func:`xml.etree.ElementTree.iterparse` with the argument ``events=["start", "end"]`` :raise: :py:class:`DeserializationException` if unexpected input :return: Instance of :py:class:`.types.DefinitionTypeUom` read from :paramref:`iterator` """ return _read_instance_from_iterparse( iterator, _read_definition_type_uom_as_element, "DefinitionTypeUom" )
[docs]def definition_type_uom_from_stream( stream: TextIO, has_iterparse: HasIterparse = xml.etree.ElementTree ) -> our_types.DefinitionTypeUom: """ Read an instance of :py:class:`.types.DefinitionTypeUom` from the :paramref:`stream`. Example usage: .. code-block:: import aas_core3_2.xmlization as our_xmlization with open_some_stream_over_network(...) as stream: instance = our_xmlization.definition_type_uom_from_stream( stream ) # Do something with the ``instance`` :param stream: representing an instance of :py:class:`.types.DefinitionTypeUom` in XML :param has_iterparse: Module containing ``iterparse`` function. Default is to use :py:mod:`xml.etree.ElementTree` from the standard library. If you have to deal with malicious input, consider using a library such as `defusedxml.ElementTree`_. :raise: :py:class:`DeserializationException` if unexpected input :return: Instance of :py:class:`.types.DefinitionTypeUom` read from :paramref:`stream` """ iterator = has_iterparse.iterparse(stream, ["start", "end"]) return definition_type_uom_from_iterparse( _with_elements_cleared_after_yield(iterator) )
[docs]def definition_type_uom_from_file( path: PathLike, has_iterparse: HasIterparse = xml.etree.ElementTree ) -> our_types.DefinitionTypeUom: """ Read an instance of :py:class:`.types.DefinitionTypeUom` from the :paramref:`path`. Example usage: .. code-block:: import pathlib import aas_core3_2.xmlization as our_xmlization path = pathlib.Path(...) instance = our_xmlization.definition_type_uom_from_file( path ) # Do something with the ``instance`` :param path: to the file representing an instance of :py:class:`.types.DefinitionTypeUom` in XML :param has_iterparse: Module containing ``iterparse`` function. Default is to use :py:mod:`xml.etree.ElementTree` from the standard library. If you have to deal with malicious input, consider using a library such as `defusedxml.ElementTree`_. :raise: :py:class:`DeserializationException` if unexpected input :return: Instance of :py:class:`.types.DefinitionTypeUom` read from :paramref:`path` """ with open(os.fspath(path), encoding="utf-8") as fid: iterator = has_iterparse.iterparse(fid, ["start", "end"]) return definition_type_uom_from_iterparse( _with_elements_cleared_after_yield(iterator) )
[docs]def definition_type_uom_from_str( text: str, has_iterparse: HasIterparse = xml.etree.ElementTree ) -> our_types.DefinitionTypeUom: """ Read an instance of :py:class:`.types.DefinitionTypeUom` from the :paramref:`text`. Example usage: .. code-block:: import pathlib import aas_core3_2.xmlization as our_xmlization text = "<...>...</...>" instance = our_xmlization.definition_type_uom_from_str( text ) # Do something with the ``instance`` :param text: representing an instance of :py:class:`.types.DefinitionTypeUom` in XML :param has_iterparse: Module containing ``iterparse`` function. Default is to use :py:mod:`xml.etree.ElementTree` from the standard library. If you have to deal with malicious input, consider using a library such as `defusedxml.ElementTree`_. :raise: :py:class:`DeserializationException` if unexpected input :return: Instance of :py:class:`.types.DefinitionTypeUom` read from :paramref:`text` """ iterator = has_iterparse.iterparse(io.StringIO(text), ["start", "end"]) return definition_type_uom_from_iterparse( _with_elements_cleared_after_yield(iterator) )
[docs]def data_specification_uom_from_iterparse( iterator: Iterator[Tuple[str, Element]], ) -> our_types.DataSpecificationUom: """ Read an instance of :py:class:`.types.DataSpecificationUom` from the :paramref:`iterator`. Example usage: .. code-block:: import pathlib import xml.etree.ElementTree as ET import aas_core3_2.xmlization as our_xmlization path = pathlib.Path(...) with path.open("rt") as fid: iterator = ET.iterparse( source=fid, events=['start', 'end'] ) instance = our_xmlization.data_specification_uom_from_iterparse( iterator ) # Do something with the ``instance`` :param iterator: Input stream of ``(event, element)`` coming from :py:func:`xml.etree.ElementTree.iterparse` with the argument ``events=["start", "end"]`` :raise: :py:class:`DeserializationException` if unexpected input :return: Instance of :py:class:`.types.DataSpecificationUom` read from :paramref:`iterator` """ return _read_instance_from_iterparse( iterator, _read_data_specification_uom_as_element, "DataSpecificationUom" )
[docs]def data_specification_uom_from_stream( stream: TextIO, has_iterparse: HasIterparse = xml.etree.ElementTree ) -> our_types.DataSpecificationUom: """ Read an instance of :py:class:`.types.DataSpecificationUom` from the :paramref:`stream`. Example usage: .. code-block:: import aas_core3_2.xmlization as our_xmlization with open_some_stream_over_network(...) as stream: instance = our_xmlization.data_specification_uom_from_stream( stream ) # Do something with the ``instance`` :param stream: representing an instance of :py:class:`.types.DataSpecificationUom` in XML :param has_iterparse: Module containing ``iterparse`` function. Default is to use :py:mod:`xml.etree.ElementTree` from the standard library. If you have to deal with malicious input, consider using a library such as `defusedxml.ElementTree`_. :raise: :py:class:`DeserializationException` if unexpected input :return: Instance of :py:class:`.types.DataSpecificationUom` read from :paramref:`stream` """ iterator = has_iterparse.iterparse(stream, ["start", "end"]) return data_specification_uom_from_iterparse( _with_elements_cleared_after_yield(iterator) )
[docs]def data_specification_uom_from_file( path: PathLike, has_iterparse: HasIterparse = xml.etree.ElementTree ) -> our_types.DataSpecificationUom: """ Read an instance of :py:class:`.types.DataSpecificationUom` from the :paramref:`path`. Example usage: .. code-block:: import pathlib import aas_core3_2.xmlization as our_xmlization path = pathlib.Path(...) instance = our_xmlization.data_specification_uom_from_file( path ) # Do something with the ``instance`` :param path: to the file representing an instance of :py:class:`.types.DataSpecificationUom` in XML :param has_iterparse: Module containing ``iterparse`` function. Default is to use :py:mod:`xml.etree.ElementTree` from the standard library. If you have to deal with malicious input, consider using a library such as `defusedxml.ElementTree`_. :raise: :py:class:`DeserializationException` if unexpected input :return: Instance of :py:class:`.types.DataSpecificationUom` read from :paramref:`path` """ with open(os.fspath(path), encoding="utf-8") as fid: iterator = has_iterparse.iterparse(fid, ["start", "end"]) return data_specification_uom_from_iterparse( _with_elements_cleared_after_yield(iterator) )
[docs]def data_specification_uom_from_str( text: str, has_iterparse: HasIterparse = xml.etree.ElementTree ) -> our_types.DataSpecificationUom: """ Read an instance of :py:class:`.types.DataSpecificationUom` from the :paramref:`text`. Example usage: .. code-block:: import pathlib import aas_core3_2.xmlization as our_xmlization text = "<...>...</...>" instance = our_xmlization.data_specification_uom_from_str( text ) # Do something with the ``instance`` :param text: representing an instance of :py:class:`.types.DataSpecificationUom` in XML :param has_iterparse: Module containing ``iterparse`` function. Default is to use :py:mod:`xml.etree.ElementTree` from the standard library. If you have to deal with malicious input, consider using a library such as `defusedxml.ElementTree`_. :raise: :py:class:`DeserializationException` if unexpected input :return: Instance of :py:class:`.types.DataSpecificationUom` read from :paramref:`text` """ iterator = has_iterparse.iterparse(io.StringIO(text), ["start", "end"]) return data_specification_uom_from_iterparse( _with_elements_cleared_after_yield(iterator) )
[docs]def data_specification_iec_61360_from_iterparse( iterator: Iterator[Tuple[str, Element]], ) -> our_types.DataSpecificationIEC61360: """ Read an instance of :py:class:`.types.DataSpecificationIEC61360` from the :paramref:`iterator`. Example usage: .. code-block:: import pathlib import xml.etree.ElementTree as ET import aas_core3_2.xmlization as our_xmlization path = pathlib.Path(...) with path.open("rt") as fid: iterator = ET.iterparse( source=fid, events=['start', 'end'] ) instance = our_xmlization.data_specification_iec_61360_from_iterparse( iterator ) # Do something with the ``instance`` :param iterator: Input stream of ``(event, element)`` coming from :py:func:`xml.etree.ElementTree.iterparse` with the argument ``events=["start", "end"]`` :raise: :py:class:`DeserializationException` if unexpected input :return: Instance of :py:class:`.types.DataSpecificationIEC61360` read from :paramref:`iterator` """ return _read_instance_from_iterparse( iterator, _read_data_specification_iec_61360_as_element, "DataSpecificationIEC61360", )
[docs]def data_specification_iec_61360_from_stream( stream: TextIO, has_iterparse: HasIterparse = xml.etree.ElementTree ) -> our_types.DataSpecificationIEC61360: """ Read an instance of :py:class:`.types.DataSpecificationIEC61360` from the :paramref:`stream`. Example usage: .. code-block:: import aas_core3_2.xmlization as our_xmlization with open_some_stream_over_network(...) as stream: instance = our_xmlization.data_specification_iec_61360_from_stream( stream ) # Do something with the ``instance`` :param stream: representing an instance of :py:class:`.types.DataSpecificationIEC61360` in XML :param has_iterparse: Module containing ``iterparse`` function. Default is to use :py:mod:`xml.etree.ElementTree` from the standard library. If you have to deal with malicious input, consider using a library such as `defusedxml.ElementTree`_. :raise: :py:class:`DeserializationException` if unexpected input :return: Instance of :py:class:`.types.DataSpecificationIEC61360` read from :paramref:`stream` """ iterator = has_iterparse.iterparse(stream, ["start", "end"]) return data_specification_iec_61360_from_iterparse( _with_elements_cleared_after_yield(iterator) )
[docs]def data_specification_iec_61360_from_file( path: PathLike, has_iterparse: HasIterparse = xml.etree.ElementTree ) -> our_types.DataSpecificationIEC61360: """ Read an instance of :py:class:`.types.DataSpecificationIEC61360` from the :paramref:`path`. Example usage: .. code-block:: import pathlib import aas_core3_2.xmlization as our_xmlization path = pathlib.Path(...) instance = our_xmlization.data_specification_iec_61360_from_file( path ) # Do something with the ``instance`` :param path: to the file representing an instance of :py:class:`.types.DataSpecificationIEC61360` in XML :param has_iterparse: Module containing ``iterparse`` function. Default is to use :py:mod:`xml.etree.ElementTree` from the standard library. If you have to deal with malicious input, consider using a library such as `defusedxml.ElementTree`_. :raise: :py:class:`DeserializationException` if unexpected input :return: Instance of :py:class:`.types.DataSpecificationIEC61360` read from :paramref:`path` """ with open(os.fspath(path), encoding="utf-8") as fid: iterator = has_iterparse.iterparse(fid, ["start", "end"]) return data_specification_iec_61360_from_iterparse( _with_elements_cleared_after_yield(iterator) )
[docs]def data_specification_iec_61360_from_str( text: str, has_iterparse: HasIterparse = xml.etree.ElementTree ) -> our_types.DataSpecificationIEC61360: """ Read an instance of :py:class:`.types.DataSpecificationIEC61360` from the :paramref:`text`. Example usage: .. code-block:: import pathlib import aas_core3_2.xmlization as our_xmlization text = "<...>...</...>" instance = our_xmlization.data_specification_iec_61360_from_str( text ) # Do something with the ``instance`` :param text: representing an instance of :py:class:`.types.DataSpecificationIEC61360` in XML :param has_iterparse: Module containing ``iterparse`` function. Default is to use :py:mod:`xml.etree.ElementTree` from the standard library. If you have to deal with malicious input, consider using a library such as `defusedxml.ElementTree`_. :raise: :py:class:`DeserializationException` if unexpected input :return: Instance of :py:class:`.types.DataSpecificationIEC61360` read from :paramref:`text` """ iterator = has_iterparse.iterparse(io.StringIO(text), ["start", "end"]) return data_specification_iec_61360_from_iterparse( _with_elements_cleared_after_yield(iterator) )
[docs]def descriptor_from_iterparse( iterator: Iterator[Tuple[str, Element]], ) -> our_types.Descriptor: """ Read an instance of :py:class:`.types.Descriptor` from the :paramref:`iterator`. Example usage: .. code-block:: import pathlib import xml.etree.ElementTree as ET import aas_core3_2.xmlization as our_xmlization path = pathlib.Path(...) with path.open("rt") as fid: iterator = ET.iterparse( source=fid, events=['start', 'end'] ) instance = our_xmlization.descriptor_from_iterparse( iterator ) # Do something with the ``instance`` :param iterator: Input stream of ``(event, element)`` coming from :py:func:`xml.etree.ElementTree.iterparse` with the argument ``events=["start", "end"]`` :raise: :py:class:`DeserializationException` if unexpected input :return: Instance of :py:class:`.types.Descriptor` read from :paramref:`iterator` """ return _read_instance_from_iterparse( iterator, _read_descriptor_as_element, "Descriptor" )
[docs]def descriptor_from_stream( stream: TextIO, has_iterparse: HasIterparse = xml.etree.ElementTree ) -> our_types.Descriptor: """ Read an instance of :py:class:`.types.Descriptor` from the :paramref:`stream`. Example usage: .. code-block:: import aas_core3_2.xmlization as our_xmlization with open_some_stream_over_network(...) as stream: instance = our_xmlization.descriptor_from_stream( stream ) # Do something with the ``instance`` :param stream: representing an instance of :py:class:`.types.Descriptor` in XML :param has_iterparse: Module containing ``iterparse`` function. Default is to use :py:mod:`xml.etree.ElementTree` from the standard library. If you have to deal with malicious input, consider using a library such as `defusedxml.ElementTree`_. :raise: :py:class:`DeserializationException` if unexpected input :return: Instance of :py:class:`.types.Descriptor` read from :paramref:`stream` """ iterator = has_iterparse.iterparse(stream, ["start", "end"]) return descriptor_from_iterparse(_with_elements_cleared_after_yield(iterator))
[docs]def descriptor_from_file( path: PathLike, has_iterparse: HasIterparse = xml.etree.ElementTree ) -> our_types.Descriptor: """ Read an instance of :py:class:`.types.Descriptor` from the :paramref:`path`. Example usage: .. code-block:: import pathlib import aas_core3_2.xmlization as our_xmlization path = pathlib.Path(...) instance = our_xmlization.descriptor_from_file( path ) # Do something with the ``instance`` :param path: to the file representing an instance of :py:class:`.types.Descriptor` in XML :param has_iterparse: Module containing ``iterparse`` function. Default is to use :py:mod:`xml.etree.ElementTree` from the standard library. If you have to deal with malicious input, consider using a library such as `defusedxml.ElementTree`_. :raise: :py:class:`DeserializationException` if unexpected input :return: Instance of :py:class:`.types.Descriptor` read from :paramref:`path` """ with open(os.fspath(path), encoding="utf-8") as fid: iterator = has_iterparse.iterparse(fid, ["start", "end"]) return descriptor_from_iterparse(_with_elements_cleared_after_yield(iterator))
[docs]def descriptor_from_str( text: str, has_iterparse: HasIterparse = xml.etree.ElementTree ) -> our_types.Descriptor: """ Read an instance of :py:class:`.types.Descriptor` from the :paramref:`text`. Example usage: .. code-block:: import pathlib import aas_core3_2.xmlization as our_xmlization text = "<...>...</...>" instance = our_xmlization.descriptor_from_str( text ) # Do something with the ``instance`` :param text: representing an instance of :py:class:`.types.Descriptor` in XML :param has_iterparse: Module containing ``iterparse`` function. Default is to use :py:mod:`xml.etree.ElementTree` from the standard library. If you have to deal with malicious input, consider using a library such as `defusedxml.ElementTree`_. :raise: :py:class:`DeserializationException` if unexpected input :return: Instance of :py:class:`.types.Descriptor` read from :paramref:`text` """ iterator = has_iterparse.iterparse(io.StringIO(text), ["start", "end"]) return descriptor_from_iterparse(_with_elements_cleared_after_yield(iterator))
[docs]def asset_administration_shell_descriptor_from_iterparse( iterator: Iterator[Tuple[str, Element]], ) -> our_types.AssetAdministrationShellDescriptor: """ Read an instance of :py:class:`.types.AssetAdministrationShellDescriptor` from the :paramref:`iterator`. Example usage: .. code-block:: import pathlib import xml.etree.ElementTree as ET import aas_core3_2.xmlization as our_xmlization path = pathlib.Path(...) with path.open("rt") as fid: iterator = ET.iterparse( source=fid, events=['start', 'end'] ) instance = our_xmlization.asset_administration_shell_descriptor_from_iterparse( iterator ) # Do something with the ``instance`` :param iterator: Input stream of ``(event, element)`` coming from :py:func:`xml.etree.ElementTree.iterparse` with the argument ``events=["start", "end"]`` :raise: :py:class:`DeserializationException` if unexpected input :return: Instance of :py:class:`.types.AssetAdministrationShellDescriptor` read from :paramref:`iterator` """ return _read_instance_from_iterparse( iterator, _read_asset_administration_shell_descriptor_as_element, "AssetAdministrationShellDescriptor", )
[docs]def asset_administration_shell_descriptor_from_stream( stream: TextIO, has_iterparse: HasIterparse = xml.etree.ElementTree ) -> our_types.AssetAdministrationShellDescriptor: """ Read an instance of :py:class:`.types.AssetAdministrationShellDescriptor` from the :paramref:`stream`. Example usage: .. code-block:: import aas_core3_2.xmlization as our_xmlization with open_some_stream_over_network(...) as stream: instance = our_xmlization.asset_administration_shell_descriptor_from_stream( stream ) # Do something with the ``instance`` :param stream: representing an instance of :py:class:`.types.AssetAdministrationShellDescriptor` in XML :param has_iterparse: Module containing ``iterparse`` function. Default is to use :py:mod:`xml.etree.ElementTree` from the standard library. If you have to deal with malicious input, consider using a library such as `defusedxml.ElementTree`_. :raise: :py:class:`DeserializationException` if unexpected input :return: Instance of :py:class:`.types.AssetAdministrationShellDescriptor` read from :paramref:`stream` """ iterator = has_iterparse.iterparse(stream, ["start", "end"]) return asset_administration_shell_descriptor_from_iterparse( _with_elements_cleared_after_yield(iterator) )
[docs]def asset_administration_shell_descriptor_from_file( path: PathLike, has_iterparse: HasIterparse = xml.etree.ElementTree ) -> our_types.AssetAdministrationShellDescriptor: """ Read an instance of :py:class:`.types.AssetAdministrationShellDescriptor` from the :paramref:`path`. Example usage: .. code-block:: import pathlib import aas_core3_2.xmlization as our_xmlization path = pathlib.Path(...) instance = our_xmlization.asset_administration_shell_descriptor_from_file( path ) # Do something with the ``instance`` :param path: to the file representing an instance of :py:class:`.types.AssetAdministrationShellDescriptor` in XML :param has_iterparse: Module containing ``iterparse`` function. Default is to use :py:mod:`xml.etree.ElementTree` from the standard library. If you have to deal with malicious input, consider using a library such as `defusedxml.ElementTree`_. :raise: :py:class:`DeserializationException` if unexpected input :return: Instance of :py:class:`.types.AssetAdministrationShellDescriptor` read from :paramref:`path` """ with open(os.fspath(path), encoding="utf-8") as fid: iterator = has_iterparse.iterparse(fid, ["start", "end"]) return asset_administration_shell_descriptor_from_iterparse( _with_elements_cleared_after_yield(iterator) )
[docs]def asset_administration_shell_descriptor_from_str( text: str, has_iterparse: HasIterparse = xml.etree.ElementTree ) -> our_types.AssetAdministrationShellDescriptor: """ Read an instance of :py:class:`.types.AssetAdministrationShellDescriptor` from the :paramref:`text`. Example usage: .. code-block:: import pathlib import aas_core3_2.xmlization as our_xmlization text = "<...>...</...>" instance = our_xmlization.asset_administration_shell_descriptor_from_str( text ) # Do something with the ``instance`` :param text: representing an instance of :py:class:`.types.AssetAdministrationShellDescriptor` in XML :param has_iterparse: Module containing ``iterparse`` function. Default is to use :py:mod:`xml.etree.ElementTree` from the standard library. If you have to deal with malicious input, consider using a library such as `defusedxml.ElementTree`_. :raise: :py:class:`DeserializationException` if unexpected input :return: Instance of :py:class:`.types.AssetAdministrationShellDescriptor` read from :paramref:`text` """ iterator = has_iterparse.iterparse(io.StringIO(text), ["start", "end"]) return asset_administration_shell_descriptor_from_iterparse( _with_elements_cleared_after_yield(iterator) )
[docs]def submodel_descriptor_from_iterparse( iterator: Iterator[Tuple[str, Element]], ) -> our_types.SubmodelDescriptor: """ Read an instance of :py:class:`.types.SubmodelDescriptor` from the :paramref:`iterator`. Example usage: .. code-block:: import pathlib import xml.etree.ElementTree as ET import aas_core3_2.xmlization as our_xmlization path = pathlib.Path(...) with path.open("rt") as fid: iterator = ET.iterparse( source=fid, events=['start', 'end'] ) instance = our_xmlization.submodel_descriptor_from_iterparse( iterator ) # Do something with the ``instance`` :param iterator: Input stream of ``(event, element)`` coming from :py:func:`xml.etree.ElementTree.iterparse` with the argument ``events=["start", "end"]`` :raise: :py:class:`DeserializationException` if unexpected input :return: Instance of :py:class:`.types.SubmodelDescriptor` read from :paramref:`iterator` """ return _read_instance_from_iterparse( iterator, _read_submodel_descriptor_as_element, "SubmodelDescriptor" )
[docs]def submodel_descriptor_from_stream( stream: TextIO, has_iterparse: HasIterparse = xml.etree.ElementTree ) -> our_types.SubmodelDescriptor: """ Read an instance of :py:class:`.types.SubmodelDescriptor` from the :paramref:`stream`. Example usage: .. code-block:: import aas_core3_2.xmlization as our_xmlization with open_some_stream_over_network(...) as stream: instance = our_xmlization.submodel_descriptor_from_stream( stream ) # Do something with the ``instance`` :param stream: representing an instance of :py:class:`.types.SubmodelDescriptor` in XML :param has_iterparse: Module containing ``iterparse`` function. Default is to use :py:mod:`xml.etree.ElementTree` from the standard library. If you have to deal with malicious input, consider using a library such as `defusedxml.ElementTree`_. :raise: :py:class:`DeserializationException` if unexpected input :return: Instance of :py:class:`.types.SubmodelDescriptor` read from :paramref:`stream` """ iterator = has_iterparse.iterparse(stream, ["start", "end"]) return submodel_descriptor_from_iterparse( _with_elements_cleared_after_yield(iterator) )
[docs]def submodel_descriptor_from_file( path: PathLike, has_iterparse: HasIterparse = xml.etree.ElementTree ) -> our_types.SubmodelDescriptor: """ Read an instance of :py:class:`.types.SubmodelDescriptor` from the :paramref:`path`. Example usage: .. code-block:: import pathlib import aas_core3_2.xmlization as our_xmlization path = pathlib.Path(...) instance = our_xmlization.submodel_descriptor_from_file( path ) # Do something with the ``instance`` :param path: to the file representing an instance of :py:class:`.types.SubmodelDescriptor` in XML :param has_iterparse: Module containing ``iterparse`` function. Default is to use :py:mod:`xml.etree.ElementTree` from the standard library. If you have to deal with malicious input, consider using a library such as `defusedxml.ElementTree`_. :raise: :py:class:`DeserializationException` if unexpected input :return: Instance of :py:class:`.types.SubmodelDescriptor` read from :paramref:`path` """ with open(os.fspath(path), encoding="utf-8") as fid: iterator = has_iterparse.iterparse(fid, ["start", "end"]) return submodel_descriptor_from_iterparse( _with_elements_cleared_after_yield(iterator) )
[docs]def submodel_descriptor_from_str( text: str, has_iterparse: HasIterparse = xml.etree.ElementTree ) -> our_types.SubmodelDescriptor: """ Read an instance of :py:class:`.types.SubmodelDescriptor` from the :paramref:`text`. Example usage: .. code-block:: import pathlib import aas_core3_2.xmlization as our_xmlization text = "<...>...</...>" instance = our_xmlization.submodel_descriptor_from_str( text ) # Do something with the ``instance`` :param text: representing an instance of :py:class:`.types.SubmodelDescriptor` in XML :param has_iterparse: Module containing ``iterparse`` function. Default is to use :py:mod:`xml.etree.ElementTree` from the standard library. If you have to deal with malicious input, consider using a library such as `defusedxml.ElementTree`_. :raise: :py:class:`DeserializationException` if unexpected input :return: Instance of :py:class:`.types.SubmodelDescriptor` read from :paramref:`text` """ iterator = has_iterparse.iterparse(io.StringIO(text), ["start", "end"]) return submodel_descriptor_from_iterparse( _with_elements_cleared_after_yield(iterator) )
[docs]def endpoint_from_iterparse( iterator: Iterator[Tuple[str, Element]], ) -> our_types.Endpoint: """ Read an instance of :py:class:`.types.Endpoint` from the :paramref:`iterator`. Example usage: .. code-block:: import pathlib import xml.etree.ElementTree as ET import aas_core3_2.xmlization as our_xmlization path = pathlib.Path(...) with path.open("rt") as fid: iterator = ET.iterparse( source=fid, events=['start', 'end'] ) instance = our_xmlization.endpoint_from_iterparse( iterator ) # Do something with the ``instance`` :param iterator: Input stream of ``(event, element)`` coming from :py:func:`xml.etree.ElementTree.iterparse` with the argument ``events=["start", "end"]`` :raise: :py:class:`DeserializationException` if unexpected input :return: Instance of :py:class:`.types.Endpoint` read from :paramref:`iterator` """ return _read_instance_from_iterparse( iterator, _read_endpoint_as_element, "Endpoint" )
[docs]def endpoint_from_stream( stream: TextIO, has_iterparse: HasIterparse = xml.etree.ElementTree ) -> our_types.Endpoint: """ Read an instance of :py:class:`.types.Endpoint` from the :paramref:`stream`. Example usage: .. code-block:: import aas_core3_2.xmlization as our_xmlization with open_some_stream_over_network(...) as stream: instance = our_xmlization.endpoint_from_stream( stream ) # Do something with the ``instance`` :param stream: representing an instance of :py:class:`.types.Endpoint` in XML :param has_iterparse: Module containing ``iterparse`` function. Default is to use :py:mod:`xml.etree.ElementTree` from the standard library. If you have to deal with malicious input, consider using a library such as `defusedxml.ElementTree`_. :raise: :py:class:`DeserializationException` if unexpected input :return: Instance of :py:class:`.types.Endpoint` read from :paramref:`stream` """ iterator = has_iterparse.iterparse(stream, ["start", "end"]) return endpoint_from_iterparse(_with_elements_cleared_after_yield(iterator))
[docs]def endpoint_from_file( path: PathLike, has_iterparse: HasIterparse = xml.etree.ElementTree ) -> our_types.Endpoint: """ Read an instance of :py:class:`.types.Endpoint` from the :paramref:`path`. Example usage: .. code-block:: import pathlib import aas_core3_2.xmlization as our_xmlization path = pathlib.Path(...) instance = our_xmlization.endpoint_from_file( path ) # Do something with the ``instance`` :param path: to the file representing an instance of :py:class:`.types.Endpoint` in XML :param has_iterparse: Module containing ``iterparse`` function. Default is to use :py:mod:`xml.etree.ElementTree` from the standard library. If you have to deal with malicious input, consider using a library such as `defusedxml.ElementTree`_. :raise: :py:class:`DeserializationException` if unexpected input :return: Instance of :py:class:`.types.Endpoint` read from :paramref:`path` """ with open(os.fspath(path), encoding="utf-8") as fid: iterator = has_iterparse.iterparse(fid, ["start", "end"]) return endpoint_from_iterparse(_with_elements_cleared_after_yield(iterator))
[docs]def endpoint_from_str( text: str, has_iterparse: HasIterparse = xml.etree.ElementTree ) -> our_types.Endpoint: """ Read an instance of :py:class:`.types.Endpoint` from the :paramref:`text`. Example usage: .. code-block:: import pathlib import aas_core3_2.xmlization as our_xmlization text = "<...>...</...>" instance = our_xmlization.endpoint_from_str( text ) # Do something with the ``instance`` :param text: representing an instance of :py:class:`.types.Endpoint` in XML :param has_iterparse: Module containing ``iterparse`` function. Default is to use :py:mod:`xml.etree.ElementTree` from the standard library. If you have to deal with malicious input, consider using a library such as `defusedxml.ElementTree`_. :raise: :py:class:`DeserializationException` if unexpected input :return: Instance of :py:class:`.types.Endpoint` read from :paramref:`text` """ iterator = has_iterparse.iterparse(io.StringIO(text), ["start", "end"]) return endpoint_from_iterparse(_with_elements_cleared_after_yield(iterator))
[docs]def protocol_information_from_iterparse( iterator: Iterator[Tuple[str, Element]], ) -> our_types.ProtocolInformation: """ Read an instance of :py:class:`.types.ProtocolInformation` from the :paramref:`iterator`. Example usage: .. code-block:: import pathlib import xml.etree.ElementTree as ET import aas_core3_2.xmlization as our_xmlization path = pathlib.Path(...) with path.open("rt") as fid: iterator = ET.iterparse( source=fid, events=['start', 'end'] ) instance = our_xmlization.protocol_information_from_iterparse( iterator ) # Do something with the ``instance`` :param iterator: Input stream of ``(event, element)`` coming from :py:func:`xml.etree.ElementTree.iterparse` with the argument ``events=["start", "end"]`` :raise: :py:class:`DeserializationException` if unexpected input :return: Instance of :py:class:`.types.ProtocolInformation` read from :paramref:`iterator` """ return _read_instance_from_iterparse( iterator, _read_protocol_information_as_element, "ProtocolInformation" )
[docs]def protocol_information_from_stream( stream: TextIO, has_iterparse: HasIterparse = xml.etree.ElementTree ) -> our_types.ProtocolInformation: """ Read an instance of :py:class:`.types.ProtocolInformation` from the :paramref:`stream`. Example usage: .. code-block:: import aas_core3_2.xmlization as our_xmlization with open_some_stream_over_network(...) as stream: instance = our_xmlization.protocol_information_from_stream( stream ) # Do something with the ``instance`` :param stream: representing an instance of :py:class:`.types.ProtocolInformation` in XML :param has_iterparse: Module containing ``iterparse`` function. Default is to use :py:mod:`xml.etree.ElementTree` from the standard library. If you have to deal with malicious input, consider using a library such as `defusedxml.ElementTree`_. :raise: :py:class:`DeserializationException` if unexpected input :return: Instance of :py:class:`.types.ProtocolInformation` read from :paramref:`stream` """ iterator = has_iterparse.iterparse(stream, ["start", "end"]) return protocol_information_from_iterparse( _with_elements_cleared_after_yield(iterator) )
[docs]def protocol_information_from_file( path: PathLike, has_iterparse: HasIterparse = xml.etree.ElementTree ) -> our_types.ProtocolInformation: """ Read an instance of :py:class:`.types.ProtocolInformation` from the :paramref:`path`. Example usage: .. code-block:: import pathlib import aas_core3_2.xmlization as our_xmlization path = pathlib.Path(...) instance = our_xmlization.protocol_information_from_file( path ) # Do something with the ``instance`` :param path: to the file representing an instance of :py:class:`.types.ProtocolInformation` in XML :param has_iterparse: Module containing ``iterparse`` function. Default is to use :py:mod:`xml.etree.ElementTree` from the standard library. If you have to deal with malicious input, consider using a library such as `defusedxml.ElementTree`_. :raise: :py:class:`DeserializationException` if unexpected input :return: Instance of :py:class:`.types.ProtocolInformation` read from :paramref:`path` """ with open(os.fspath(path), encoding="utf-8") as fid: iterator = has_iterparse.iterparse(fid, ["start", "end"]) return protocol_information_from_iterparse( _with_elements_cleared_after_yield(iterator) )
[docs]def protocol_information_from_str( text: str, has_iterparse: HasIterparse = xml.etree.ElementTree ) -> our_types.ProtocolInformation: """ Read an instance of :py:class:`.types.ProtocolInformation` from the :paramref:`text`. Example usage: .. code-block:: import pathlib import aas_core3_2.xmlization as our_xmlization text = "<...>...</...>" instance = our_xmlization.protocol_information_from_str( text ) # Do something with the ``instance`` :param text: representing an instance of :py:class:`.types.ProtocolInformation` in XML :param has_iterparse: Module containing ``iterparse`` function. Default is to use :py:mod:`xml.etree.ElementTree` from the standard library. If you have to deal with malicious input, consider using a library such as `defusedxml.ElementTree`_. :raise: :py:class:`DeserializationException` if unexpected input :return: Instance of :py:class:`.types.ProtocolInformation` read from :paramref:`text` """ iterator = has_iterparse.iterparse(io.StringIO(text), ["start", "end"]) return protocol_information_from_iterparse( _with_elements_cleared_after_yield(iterator) )
[docs]def security_attribute_object_from_iterparse( iterator: Iterator[Tuple[str, Element]], ) -> our_types.SecurityAttributeObject: """ Read an instance of :py:class:`.types.SecurityAttributeObject` from the :paramref:`iterator`. Example usage: .. code-block:: import pathlib import xml.etree.ElementTree as ET import aas_core3_2.xmlization as our_xmlization path = pathlib.Path(...) with path.open("rt") as fid: iterator = ET.iterparse( source=fid, events=['start', 'end'] ) instance = our_xmlization.security_attribute_object_from_iterparse( iterator ) # Do something with the ``instance`` :param iterator: Input stream of ``(event, element)`` coming from :py:func:`xml.etree.ElementTree.iterparse` with the argument ``events=["start", "end"]`` :raise: :py:class:`DeserializationException` if unexpected input :return: Instance of :py:class:`.types.SecurityAttributeObject` read from :paramref:`iterator` """ return _read_instance_from_iterparse( iterator, _read_security_attribute_object_as_element, "SecurityAttributeObject" )
[docs]def security_attribute_object_from_stream( stream: TextIO, has_iterparse: HasIterparse = xml.etree.ElementTree ) -> our_types.SecurityAttributeObject: """ Read an instance of :py:class:`.types.SecurityAttributeObject` from the :paramref:`stream`. Example usage: .. code-block:: import aas_core3_2.xmlization as our_xmlization with open_some_stream_over_network(...) as stream: instance = our_xmlization.security_attribute_object_from_stream( stream ) # Do something with the ``instance`` :param stream: representing an instance of :py:class:`.types.SecurityAttributeObject` in XML :param has_iterparse: Module containing ``iterparse`` function. Default is to use :py:mod:`xml.etree.ElementTree` from the standard library. If you have to deal with malicious input, consider using a library such as `defusedxml.ElementTree`_. :raise: :py:class:`DeserializationException` if unexpected input :return: Instance of :py:class:`.types.SecurityAttributeObject` read from :paramref:`stream` """ iterator = has_iterparse.iterparse(stream, ["start", "end"]) return security_attribute_object_from_iterparse( _with_elements_cleared_after_yield(iterator) )
[docs]def security_attribute_object_from_file( path: PathLike, has_iterparse: HasIterparse = xml.etree.ElementTree ) -> our_types.SecurityAttributeObject: """ Read an instance of :py:class:`.types.SecurityAttributeObject` from the :paramref:`path`. Example usage: .. code-block:: import pathlib import aas_core3_2.xmlization as our_xmlization path = pathlib.Path(...) instance = our_xmlization.security_attribute_object_from_file( path ) # Do something with the ``instance`` :param path: to the file representing an instance of :py:class:`.types.SecurityAttributeObject` in XML :param has_iterparse: Module containing ``iterparse`` function. Default is to use :py:mod:`xml.etree.ElementTree` from the standard library. If you have to deal with malicious input, consider using a library such as `defusedxml.ElementTree`_. :raise: :py:class:`DeserializationException` if unexpected input :return: Instance of :py:class:`.types.SecurityAttributeObject` read from :paramref:`path` """ with open(os.fspath(path), encoding="utf-8") as fid: iterator = has_iterparse.iterparse(fid, ["start", "end"]) return security_attribute_object_from_iterparse( _with_elements_cleared_after_yield(iterator) )
[docs]def security_attribute_object_from_str( text: str, has_iterparse: HasIterparse = xml.etree.ElementTree ) -> our_types.SecurityAttributeObject: """ Read an instance of :py:class:`.types.SecurityAttributeObject` from the :paramref:`text`. Example usage: .. code-block:: import pathlib import aas_core3_2.xmlization as our_xmlization text = "<...>...</...>" instance = our_xmlization.security_attribute_object_from_str( text ) # Do something with the ``instance`` :param text: representing an instance of :py:class:`.types.SecurityAttributeObject` in XML :param has_iterparse: Module containing ``iterparse`` function. Default is to use :py:mod:`xml.etree.ElementTree` from the standard library. If you have to deal with malicious input, consider using a library such as `defusedxml.ElementTree`_. :raise: :py:class:`DeserializationException` if unexpected input :return: Instance of :py:class:`.types.SecurityAttributeObject` read from :paramref:`text` """ iterator = has_iterparse.iterparse(io.StringIO(text), ["start", "end"]) return security_attribute_object_from_iterparse( _with_elements_cleared_after_yield(iterator) )
[docs]def service_description_from_iterparse( iterator: Iterator[Tuple[str, Element]], ) -> our_types.ServiceDescription: """ Read an instance of :py:class:`.types.ServiceDescription` from the :paramref:`iterator`. Example usage: .. code-block:: import pathlib import xml.etree.ElementTree as ET import aas_core3_2.xmlization as our_xmlization path = pathlib.Path(...) with path.open("rt") as fid: iterator = ET.iterparse( source=fid, events=['start', 'end'] ) instance = our_xmlization.service_description_from_iterparse( iterator ) # Do something with the ``instance`` :param iterator: Input stream of ``(event, element)`` coming from :py:func:`xml.etree.ElementTree.iterparse` with the argument ``events=["start", "end"]`` :raise: :py:class:`DeserializationException` if unexpected input :return: Instance of :py:class:`.types.ServiceDescription` read from :paramref:`iterator` """ return _read_instance_from_iterparse( iterator, _read_service_description_as_element, "ServiceDescription" )
[docs]def service_description_from_stream( stream: TextIO, has_iterparse: HasIterparse = xml.etree.ElementTree ) -> our_types.ServiceDescription: """ Read an instance of :py:class:`.types.ServiceDescription` from the :paramref:`stream`. Example usage: .. code-block:: import aas_core3_2.xmlization as our_xmlization with open_some_stream_over_network(...) as stream: instance = our_xmlization.service_description_from_stream( stream ) # Do something with the ``instance`` :param stream: representing an instance of :py:class:`.types.ServiceDescription` in XML :param has_iterparse: Module containing ``iterparse`` function. Default is to use :py:mod:`xml.etree.ElementTree` from the standard library. If you have to deal with malicious input, consider using a library such as `defusedxml.ElementTree`_. :raise: :py:class:`DeserializationException` if unexpected input :return: Instance of :py:class:`.types.ServiceDescription` read from :paramref:`stream` """ iterator = has_iterparse.iterparse(stream, ["start", "end"]) return service_description_from_iterparse( _with_elements_cleared_after_yield(iterator) )
[docs]def service_description_from_file( path: PathLike, has_iterparse: HasIterparse = xml.etree.ElementTree ) -> our_types.ServiceDescription: """ Read an instance of :py:class:`.types.ServiceDescription` from the :paramref:`path`. Example usage: .. code-block:: import pathlib import aas_core3_2.xmlization as our_xmlization path = pathlib.Path(...) instance = our_xmlization.service_description_from_file( path ) # Do something with the ``instance`` :param path: to the file representing an instance of :py:class:`.types.ServiceDescription` in XML :param has_iterparse: Module containing ``iterparse`` function. Default is to use :py:mod:`xml.etree.ElementTree` from the standard library. If you have to deal with malicious input, consider using a library such as `defusedxml.ElementTree`_. :raise: :py:class:`DeserializationException` if unexpected input :return: Instance of :py:class:`.types.ServiceDescription` read from :paramref:`path` """ with open(os.fspath(path), encoding="utf-8") as fid: iterator = has_iterparse.iterparse(fid, ["start", "end"]) return service_description_from_iterparse( _with_elements_cleared_after_yield(iterator) )
[docs]def service_description_from_str( text: str, has_iterparse: HasIterparse = xml.etree.ElementTree ) -> our_types.ServiceDescription: """ Read an instance of :py:class:`.types.ServiceDescription` from the :paramref:`text`. Example usage: .. code-block:: import pathlib import aas_core3_2.xmlization as our_xmlization text = "<...>...</...>" instance = our_xmlization.service_description_from_str( text ) # Do something with the ``instance`` :param text: representing an instance of :py:class:`.types.ServiceDescription` in XML :param has_iterparse: Module containing ``iterparse`` function. Default is to use :py:mod:`xml.etree.ElementTree` from the standard library. If you have to deal with malicious input, consider using a library such as `defusedxml.ElementTree`_. :raise: :py:class:`DeserializationException` if unexpected input :return: Instance of :py:class:`.types.ServiceDescription` read from :paramref:`text` """ iterator = has_iterparse.iterparse(io.StringIO(text), ["start", "end"]) return service_description_from_iterparse( _with_elements_cleared_after_yield(iterator) )
[docs]def recent_change_from_iterparse( iterator: Iterator[Tuple[str, Element]], ) -> our_types.RecentChange: """ Read an instance of :py:class:`.types.RecentChange` from the :paramref:`iterator`. Example usage: .. code-block:: import pathlib import xml.etree.ElementTree as ET import aas_core3_2.xmlization as our_xmlization path = pathlib.Path(...) with path.open("rt") as fid: iterator = ET.iterparse( source=fid, events=['start', 'end'] ) instance = our_xmlization.recent_change_from_iterparse( iterator ) # Do something with the ``instance`` :param iterator: Input stream of ``(event, element)`` coming from :py:func:`xml.etree.ElementTree.iterparse` with the argument ``events=["start", "end"]`` :raise: :py:class:`DeserializationException` if unexpected input :return: Instance of :py:class:`.types.RecentChange` read from :paramref:`iterator` """ return _read_instance_from_iterparse( iterator, _read_recent_change_as_element, "RecentChange" )
[docs]def recent_change_from_stream( stream: TextIO, has_iterparse: HasIterparse = xml.etree.ElementTree ) -> our_types.RecentChange: """ Read an instance of :py:class:`.types.RecentChange` from the :paramref:`stream`. Example usage: .. code-block:: import aas_core3_2.xmlization as our_xmlization with open_some_stream_over_network(...) as stream: instance = our_xmlization.recent_change_from_stream( stream ) # Do something with the ``instance`` :param stream: representing an instance of :py:class:`.types.RecentChange` in XML :param has_iterparse: Module containing ``iterparse`` function. Default is to use :py:mod:`xml.etree.ElementTree` from the standard library. If you have to deal with malicious input, consider using a library such as `defusedxml.ElementTree`_. :raise: :py:class:`DeserializationException` if unexpected input :return: Instance of :py:class:`.types.RecentChange` read from :paramref:`stream` """ iterator = has_iterparse.iterparse(stream, ["start", "end"]) return recent_change_from_iterparse(_with_elements_cleared_after_yield(iterator))
[docs]def recent_change_from_file( path: PathLike, has_iterparse: HasIterparse = xml.etree.ElementTree ) -> our_types.RecentChange: """ Read an instance of :py:class:`.types.RecentChange` from the :paramref:`path`. Example usage: .. code-block:: import pathlib import aas_core3_2.xmlization as our_xmlization path = pathlib.Path(...) instance = our_xmlization.recent_change_from_file( path ) # Do something with the ``instance`` :param path: to the file representing an instance of :py:class:`.types.RecentChange` in XML :param has_iterparse: Module containing ``iterparse`` function. Default is to use :py:mod:`xml.etree.ElementTree` from the standard library. If you have to deal with malicious input, consider using a library such as `defusedxml.ElementTree`_. :raise: :py:class:`DeserializationException` if unexpected input :return: Instance of :py:class:`.types.RecentChange` read from :paramref:`path` """ with open(os.fspath(path), encoding="utf-8") as fid: iterator = has_iterparse.iterparse(fid, ["start", "end"]) return recent_change_from_iterparse( _with_elements_cleared_after_yield(iterator) )
[docs]def recent_change_from_str( text: str, has_iterparse: HasIterparse = xml.etree.ElementTree ) -> our_types.RecentChange: """ Read an instance of :py:class:`.types.RecentChange` from the :paramref:`text`. Example usage: .. code-block:: import pathlib import aas_core3_2.xmlization as our_xmlization text = "<...>...</...>" instance = our_xmlization.recent_change_from_str( text ) # Do something with the ``instance`` :param text: representing an instance of :py:class:`.types.RecentChange` in XML :param has_iterparse: Module containing ``iterparse`` function. Default is to use :py:mod:`xml.etree.ElementTree` from the standard library. If you have to deal with malicious input, consider using a library such as `defusedxml.ElementTree`_. :raise: :py:class:`DeserializationException` if unexpected input :return: Instance of :py:class:`.types.RecentChange` read from :paramref:`text` """ iterator = has_iterparse.iterparse(io.StringIO(text), ["start", "end"]) return recent_change_from_iterparse(_with_elements_cleared_after_yield(iterator))
[docs]def asset_administration_shell_recent_change_from_iterparse( iterator: Iterator[Tuple[str, Element]], ) -> our_types.AssetAdministrationShellRecentChange: """ Read an instance of :py:class:`.types.AssetAdministrationShellRecentChange` from the :paramref:`iterator`. Example usage: .. code-block:: import pathlib import xml.etree.ElementTree as ET import aas_core3_2.xmlization as our_xmlization path = pathlib.Path(...) with path.open("rt") as fid: iterator = ET.iterparse( source=fid, events=['start', 'end'] ) instance = our_xmlization.asset_administration_shell_recent_change_from_iterparse( iterator ) # Do something with the ``instance`` :param iterator: Input stream of ``(event, element)`` coming from :py:func:`xml.etree.ElementTree.iterparse` with the argument ``events=["start", "end"]`` :raise: :py:class:`DeserializationException` if unexpected input :return: Instance of :py:class:`.types.AssetAdministrationShellRecentChange` read from :paramref:`iterator` """ return _read_instance_from_iterparse( iterator, _read_asset_administration_shell_recent_change_as_element, "AssetAdministrationShellRecentChange", )
[docs]def asset_administration_shell_recent_change_from_stream( stream: TextIO, has_iterparse: HasIterparse = xml.etree.ElementTree ) -> our_types.AssetAdministrationShellRecentChange: """ Read an instance of :py:class:`.types.AssetAdministrationShellRecentChange` from the :paramref:`stream`. Example usage: .. code-block:: import aas_core3_2.xmlization as our_xmlization with open_some_stream_over_network(...) as stream: instance = our_xmlization.asset_administration_shell_recent_change_from_stream( stream ) # Do something with the ``instance`` :param stream: representing an instance of :py:class:`.types.AssetAdministrationShellRecentChange` in XML :param has_iterparse: Module containing ``iterparse`` function. Default is to use :py:mod:`xml.etree.ElementTree` from the standard library. If you have to deal with malicious input, consider using a library such as `defusedxml.ElementTree`_. :raise: :py:class:`DeserializationException` if unexpected input :return: Instance of :py:class:`.types.AssetAdministrationShellRecentChange` read from :paramref:`stream` """ iterator = has_iterparse.iterparse(stream, ["start", "end"]) return asset_administration_shell_recent_change_from_iterparse( _with_elements_cleared_after_yield(iterator) )
[docs]def asset_administration_shell_recent_change_from_file( path: PathLike, has_iterparse: HasIterparse = xml.etree.ElementTree ) -> our_types.AssetAdministrationShellRecentChange: """ Read an instance of :py:class:`.types.AssetAdministrationShellRecentChange` from the :paramref:`path`. Example usage: .. code-block:: import pathlib import aas_core3_2.xmlization as our_xmlization path = pathlib.Path(...) instance = our_xmlization.asset_administration_shell_recent_change_from_file( path ) # Do something with the ``instance`` :param path: to the file representing an instance of :py:class:`.types.AssetAdministrationShellRecentChange` in XML :param has_iterparse: Module containing ``iterparse`` function. Default is to use :py:mod:`xml.etree.ElementTree` from the standard library. If you have to deal with malicious input, consider using a library such as `defusedxml.ElementTree`_. :raise: :py:class:`DeserializationException` if unexpected input :return: Instance of :py:class:`.types.AssetAdministrationShellRecentChange` read from :paramref:`path` """ with open(os.fspath(path), encoding="utf-8") as fid: iterator = has_iterparse.iterparse(fid, ["start", "end"]) return asset_administration_shell_recent_change_from_iterparse( _with_elements_cleared_after_yield(iterator) )
[docs]def asset_administration_shell_recent_change_from_str( text: str, has_iterparse: HasIterparse = xml.etree.ElementTree ) -> our_types.AssetAdministrationShellRecentChange: """ Read an instance of :py:class:`.types.AssetAdministrationShellRecentChange` from the :paramref:`text`. Example usage: .. code-block:: import pathlib import aas_core3_2.xmlization as our_xmlization text = "<...>...</...>" instance = our_xmlization.asset_administration_shell_recent_change_from_str( text ) # Do something with the ``instance`` :param text: representing an instance of :py:class:`.types.AssetAdministrationShellRecentChange` in XML :param has_iterparse: Module containing ``iterparse`` function. Default is to use :py:mod:`xml.etree.ElementTree` from the standard library. If you have to deal with malicious input, consider using a library such as `defusedxml.ElementTree`_. :raise: :py:class:`DeserializationException` if unexpected input :return: Instance of :py:class:`.types.AssetAdministrationShellRecentChange` read from :paramref:`text` """ iterator = has_iterparse.iterparse(io.StringIO(text), ["start", "end"]) return asset_administration_shell_recent_change_from_iterparse( _with_elements_cleared_after_yield(iterator) )
[docs]def concept_description_recent_change_from_iterparse( iterator: Iterator[Tuple[str, Element]], ) -> our_types.ConceptDescriptionRecentChange: """ Read an instance of :py:class:`.types.ConceptDescriptionRecentChange` from the :paramref:`iterator`. Example usage: .. code-block:: import pathlib import xml.etree.ElementTree as ET import aas_core3_2.xmlization as our_xmlization path = pathlib.Path(...) with path.open("rt") as fid: iterator = ET.iterparse( source=fid, events=['start', 'end'] ) instance = our_xmlization.concept_description_recent_change_from_iterparse( iterator ) # Do something with the ``instance`` :param iterator: Input stream of ``(event, element)`` coming from :py:func:`xml.etree.ElementTree.iterparse` with the argument ``events=["start", "end"]`` :raise: :py:class:`DeserializationException` if unexpected input :return: Instance of :py:class:`.types.ConceptDescriptionRecentChange` read from :paramref:`iterator` """ return _read_instance_from_iterparse( iterator, _read_concept_description_recent_change_as_element, "ConceptDescriptionRecentChange", )
[docs]def concept_description_recent_change_from_stream( stream: TextIO, has_iterparse: HasIterparse = xml.etree.ElementTree ) -> our_types.ConceptDescriptionRecentChange: """ Read an instance of :py:class:`.types.ConceptDescriptionRecentChange` from the :paramref:`stream`. Example usage: .. code-block:: import aas_core3_2.xmlization as our_xmlization with open_some_stream_over_network(...) as stream: instance = our_xmlization.concept_description_recent_change_from_stream( stream ) # Do something with the ``instance`` :param stream: representing an instance of :py:class:`.types.ConceptDescriptionRecentChange` in XML :param has_iterparse: Module containing ``iterparse`` function. Default is to use :py:mod:`xml.etree.ElementTree` from the standard library. If you have to deal with malicious input, consider using a library such as `defusedxml.ElementTree`_. :raise: :py:class:`DeserializationException` if unexpected input :return: Instance of :py:class:`.types.ConceptDescriptionRecentChange` read from :paramref:`stream` """ iterator = has_iterparse.iterparse(stream, ["start", "end"]) return concept_description_recent_change_from_iterparse( _with_elements_cleared_after_yield(iterator) )
[docs]def concept_description_recent_change_from_file( path: PathLike, has_iterparse: HasIterparse = xml.etree.ElementTree ) -> our_types.ConceptDescriptionRecentChange: """ Read an instance of :py:class:`.types.ConceptDescriptionRecentChange` from the :paramref:`path`. Example usage: .. code-block:: import pathlib import aas_core3_2.xmlization as our_xmlization path = pathlib.Path(...) instance = our_xmlization.concept_description_recent_change_from_file( path ) # Do something with the ``instance`` :param path: to the file representing an instance of :py:class:`.types.ConceptDescriptionRecentChange` in XML :param has_iterparse: Module containing ``iterparse`` function. Default is to use :py:mod:`xml.etree.ElementTree` from the standard library. If you have to deal with malicious input, consider using a library such as `defusedxml.ElementTree`_. :raise: :py:class:`DeserializationException` if unexpected input :return: Instance of :py:class:`.types.ConceptDescriptionRecentChange` read from :paramref:`path` """ with open(os.fspath(path), encoding="utf-8") as fid: iterator = has_iterparse.iterparse(fid, ["start", "end"]) return concept_description_recent_change_from_iterparse( _with_elements_cleared_after_yield(iterator) )
[docs]def concept_description_recent_change_from_str( text: str, has_iterparse: HasIterparse = xml.etree.ElementTree ) -> our_types.ConceptDescriptionRecentChange: """ Read an instance of :py:class:`.types.ConceptDescriptionRecentChange` from the :paramref:`text`. Example usage: .. code-block:: import pathlib import aas_core3_2.xmlization as our_xmlization text = "<...>...</...>" instance = our_xmlization.concept_description_recent_change_from_str( text ) # Do something with the ``instance`` :param text: representing an instance of :py:class:`.types.ConceptDescriptionRecentChange` in XML :param has_iterparse: Module containing ``iterparse`` function. Default is to use :py:mod:`xml.etree.ElementTree` from the standard library. If you have to deal with malicious input, consider using a library such as `defusedxml.ElementTree`_. :raise: :py:class:`DeserializationException` if unexpected input :return: Instance of :py:class:`.types.ConceptDescriptionRecentChange` read from :paramref:`text` """ iterator = has_iterparse.iterparse(io.StringIO(text), ["start", "end"]) return concept_description_recent_change_from_iterparse( _with_elements_cleared_after_yield(iterator) )
[docs]def submodel_recent_change_from_iterparse( iterator: Iterator[Tuple[str, Element]], ) -> our_types.SubmodelRecentChange: """ Read an instance of :py:class:`.types.SubmodelRecentChange` from the :paramref:`iterator`. Example usage: .. code-block:: import pathlib import xml.etree.ElementTree as ET import aas_core3_2.xmlization as our_xmlization path = pathlib.Path(...) with path.open("rt") as fid: iterator = ET.iterparse( source=fid, events=['start', 'end'] ) instance = our_xmlization.submodel_recent_change_from_iterparse( iterator ) # Do something with the ``instance`` :param iterator: Input stream of ``(event, element)`` coming from :py:func:`xml.etree.ElementTree.iterparse` with the argument ``events=["start", "end"]`` :raise: :py:class:`DeserializationException` if unexpected input :return: Instance of :py:class:`.types.SubmodelRecentChange` read from :paramref:`iterator` """ return _read_instance_from_iterparse( iterator, _read_submodel_recent_change_as_element, "SubmodelRecentChange" )
[docs]def submodel_recent_change_from_stream( stream: TextIO, has_iterparse: HasIterparse = xml.etree.ElementTree ) -> our_types.SubmodelRecentChange: """ Read an instance of :py:class:`.types.SubmodelRecentChange` from the :paramref:`stream`. Example usage: .. code-block:: import aas_core3_2.xmlization as our_xmlization with open_some_stream_over_network(...) as stream: instance = our_xmlization.submodel_recent_change_from_stream( stream ) # Do something with the ``instance`` :param stream: representing an instance of :py:class:`.types.SubmodelRecentChange` in XML :param has_iterparse: Module containing ``iterparse`` function. Default is to use :py:mod:`xml.etree.ElementTree` from the standard library. If you have to deal with malicious input, consider using a library such as `defusedxml.ElementTree`_. :raise: :py:class:`DeserializationException` if unexpected input :return: Instance of :py:class:`.types.SubmodelRecentChange` read from :paramref:`stream` """ iterator = has_iterparse.iterparse(stream, ["start", "end"]) return submodel_recent_change_from_iterparse( _with_elements_cleared_after_yield(iterator) )
[docs]def submodel_recent_change_from_file( path: PathLike, has_iterparse: HasIterparse = xml.etree.ElementTree ) -> our_types.SubmodelRecentChange: """ Read an instance of :py:class:`.types.SubmodelRecentChange` from the :paramref:`path`. Example usage: .. code-block:: import pathlib import aas_core3_2.xmlization as our_xmlization path = pathlib.Path(...) instance = our_xmlization.submodel_recent_change_from_file( path ) # Do something with the ``instance`` :param path: to the file representing an instance of :py:class:`.types.SubmodelRecentChange` in XML :param has_iterparse: Module containing ``iterparse`` function. Default is to use :py:mod:`xml.etree.ElementTree` from the standard library. If you have to deal with malicious input, consider using a library such as `defusedxml.ElementTree`_. :raise: :py:class:`DeserializationException` if unexpected input :return: Instance of :py:class:`.types.SubmodelRecentChange` read from :paramref:`path` """ with open(os.fspath(path), encoding="utf-8") as fid: iterator = has_iterparse.iterparse(fid, ["start", "end"]) return submodel_recent_change_from_iterparse( _with_elements_cleared_after_yield(iterator) )
[docs]def submodel_recent_change_from_str( text: str, has_iterparse: HasIterparse = xml.etree.ElementTree ) -> our_types.SubmodelRecentChange: """ Read an instance of :py:class:`.types.SubmodelRecentChange` from the :paramref:`text`. Example usage: .. code-block:: import pathlib import aas_core3_2.xmlization as our_xmlization text = "<...>...</...>" instance = our_xmlization.submodel_recent_change_from_str( text ) # Do something with the ``instance`` :param text: representing an instance of :py:class:`.types.SubmodelRecentChange` in XML :param has_iterparse: Module containing ``iterparse`` function. Default is to use :py:mod:`xml.etree.ElementTree` from the standard library. If you have to deal with malicious input, consider using a library such as `defusedxml.ElementTree`_. :raise: :py:class:`DeserializationException` if unexpected input :return: Instance of :py:class:`.types.SubmodelRecentChange` read from :paramref:`text` """ iterator = has_iterparse.iterparse(io.StringIO(text), ["start", "end"]) return submodel_recent_change_from_iterparse( _with_elements_cleared_after_yield(iterator) )
[docs]def result_from_iterparse(iterator: Iterator[Tuple[str, Element]]) -> our_types.Result: """ Read an instance of :py:class:`.types.Result` from the :paramref:`iterator`. Example usage: .. code-block:: import pathlib import xml.etree.ElementTree as ET import aas_core3_2.xmlization as our_xmlization path = pathlib.Path(...) with path.open("rt") as fid: iterator = ET.iterparse( source=fid, events=['start', 'end'] ) instance = our_xmlization.result_from_iterparse( iterator ) # Do something with the ``instance`` :param iterator: Input stream of ``(event, element)`` coming from :py:func:`xml.etree.ElementTree.iterparse` with the argument ``events=["start", "end"]`` :raise: :py:class:`DeserializationException` if unexpected input :return: Instance of :py:class:`.types.Result` read from :paramref:`iterator` """ return _read_instance_from_iterparse(iterator, _read_result_as_element, "Result")
[docs]def result_from_stream( stream: TextIO, has_iterparse: HasIterparse = xml.etree.ElementTree ) -> our_types.Result: """ Read an instance of :py:class:`.types.Result` from the :paramref:`stream`. Example usage: .. code-block:: import aas_core3_2.xmlization as our_xmlization with open_some_stream_over_network(...) as stream: instance = our_xmlization.result_from_stream( stream ) # Do something with the ``instance`` :param stream: representing an instance of :py:class:`.types.Result` in XML :param has_iterparse: Module containing ``iterparse`` function. Default is to use :py:mod:`xml.etree.ElementTree` from the standard library. If you have to deal with malicious input, consider using a library such as `defusedxml.ElementTree`_. :raise: :py:class:`DeserializationException` if unexpected input :return: Instance of :py:class:`.types.Result` read from :paramref:`stream` """ iterator = has_iterparse.iterparse(stream, ["start", "end"]) return result_from_iterparse(_with_elements_cleared_after_yield(iterator))
[docs]def result_from_file( path: PathLike, has_iterparse: HasIterparse = xml.etree.ElementTree ) -> our_types.Result: """ Read an instance of :py:class:`.types.Result` from the :paramref:`path`. Example usage: .. code-block:: import pathlib import aas_core3_2.xmlization as our_xmlization path = pathlib.Path(...) instance = our_xmlization.result_from_file( path ) # Do something with the ``instance`` :param path: to the file representing an instance of :py:class:`.types.Result` in XML :param has_iterparse: Module containing ``iterparse`` function. Default is to use :py:mod:`xml.etree.ElementTree` from the standard library. If you have to deal with malicious input, consider using a library such as `defusedxml.ElementTree`_. :raise: :py:class:`DeserializationException` if unexpected input :return: Instance of :py:class:`.types.Result` read from :paramref:`path` """ with open(os.fspath(path), encoding="utf-8") as fid: iterator = has_iterparse.iterparse(fid, ["start", "end"]) return result_from_iterparse(_with_elements_cleared_after_yield(iterator))
[docs]def result_from_str( text: str, has_iterparse: HasIterparse = xml.etree.ElementTree ) -> our_types.Result: """ Read an instance of :py:class:`.types.Result` from the :paramref:`text`. Example usage: .. code-block:: import pathlib import aas_core3_2.xmlization as our_xmlization text = "<...>...</...>" instance = our_xmlization.result_from_str( text ) # Do something with the ``instance`` :param text: representing an instance of :py:class:`.types.Result` in XML :param has_iterparse: Module containing ``iterparse`` function. Default is to use :py:mod:`xml.etree.ElementTree` from the standard library. If you have to deal with malicious input, consider using a library such as `defusedxml.ElementTree`_. :raise: :py:class:`DeserializationException` if unexpected input :return: Instance of :py:class:`.types.Result` read from :paramref:`text` """ iterator = has_iterparse.iterparse(io.StringIO(text), ["start", "end"]) return result_from_iterparse(_with_elements_cleared_after_yield(iterator))
[docs]def message_from_iterparse( iterator: Iterator[Tuple[str, Element]], ) -> our_types.Message: """ Read an instance of :py:class:`.types.Message` from the :paramref:`iterator`. Example usage: .. code-block:: import pathlib import xml.etree.ElementTree as ET import aas_core3_2.xmlization as our_xmlization path = pathlib.Path(...) with path.open("rt") as fid: iterator = ET.iterparse( source=fid, events=['start', 'end'] ) instance = our_xmlization.message_from_iterparse( iterator ) # Do something with the ``instance`` :param iterator: Input stream of ``(event, element)`` coming from :py:func:`xml.etree.ElementTree.iterparse` with the argument ``events=["start", "end"]`` :raise: :py:class:`DeserializationException` if unexpected input :return: Instance of :py:class:`.types.Message` read from :paramref:`iterator` """ return _read_instance_from_iterparse(iterator, _read_message_as_element, "Message")
[docs]def message_from_stream( stream: TextIO, has_iterparse: HasIterparse = xml.etree.ElementTree ) -> our_types.Message: """ Read an instance of :py:class:`.types.Message` from the :paramref:`stream`. Example usage: .. code-block:: import aas_core3_2.xmlization as our_xmlization with open_some_stream_over_network(...) as stream: instance = our_xmlization.message_from_stream( stream ) # Do something with the ``instance`` :param stream: representing an instance of :py:class:`.types.Message` in XML :param has_iterparse: Module containing ``iterparse`` function. Default is to use :py:mod:`xml.etree.ElementTree` from the standard library. If you have to deal with malicious input, consider using a library such as `defusedxml.ElementTree`_. :raise: :py:class:`DeserializationException` if unexpected input :return: Instance of :py:class:`.types.Message` read from :paramref:`stream` """ iterator = has_iterparse.iterparse(stream, ["start", "end"]) return message_from_iterparse(_with_elements_cleared_after_yield(iterator))
[docs]def message_from_file( path: PathLike, has_iterparse: HasIterparse = xml.etree.ElementTree ) -> our_types.Message: """ Read an instance of :py:class:`.types.Message` from the :paramref:`path`. Example usage: .. code-block:: import pathlib import aas_core3_2.xmlization as our_xmlization path = pathlib.Path(...) instance = our_xmlization.message_from_file( path ) # Do something with the ``instance`` :param path: to the file representing an instance of :py:class:`.types.Message` in XML :param has_iterparse: Module containing ``iterparse`` function. Default is to use :py:mod:`xml.etree.ElementTree` from the standard library. If you have to deal with malicious input, consider using a library such as `defusedxml.ElementTree`_. :raise: :py:class:`DeserializationException` if unexpected input :return: Instance of :py:class:`.types.Message` read from :paramref:`path` """ with open(os.fspath(path), encoding="utf-8") as fid: iterator = has_iterparse.iterparse(fid, ["start", "end"]) return message_from_iterparse(_with_elements_cleared_after_yield(iterator))
[docs]def message_from_str( text: str, has_iterparse: HasIterparse = xml.etree.ElementTree ) -> our_types.Message: """ Read an instance of :py:class:`.types.Message` from the :paramref:`text`. Example usage: .. code-block:: import pathlib import aas_core3_2.xmlization as our_xmlization text = "<...>...</...>" instance = our_xmlization.message_from_str( text ) # Do something with the ``instance`` :param text: representing an instance of :py:class:`.types.Message` in XML :param has_iterparse: Module containing ``iterparse`` function. Default is to use :py:mod:`xml.etree.ElementTree` from the standard library. If you have to deal with malicious input, consider using a library such as `defusedxml.ElementTree`_. :raise: :py:class:`DeserializationException` if unexpected input :return: Instance of :py:class:`.types.Message` read from :paramref:`text` """ iterator = has_iterparse.iterparse(io.StringIO(text), ["start", "end"]) return message_from_iterparse(_with_elements_cleared_after_yield(iterator))
[docs]def operation_request_from_iterparse( iterator: Iterator[Tuple[str, Element]], ) -> our_types.OperationRequest: """ Read an instance of :py:class:`.types.OperationRequest` from the :paramref:`iterator`. Example usage: .. code-block:: import pathlib import xml.etree.ElementTree as ET import aas_core3_2.xmlization as our_xmlization path = pathlib.Path(...) with path.open("rt") as fid: iterator = ET.iterparse( source=fid, events=['start', 'end'] ) instance = our_xmlization.operation_request_from_iterparse( iterator ) # Do something with the ``instance`` :param iterator: Input stream of ``(event, element)`` coming from :py:func:`xml.etree.ElementTree.iterparse` with the argument ``events=["start", "end"]`` :raise: :py:class:`DeserializationException` if unexpected input :return: Instance of :py:class:`.types.OperationRequest` read from :paramref:`iterator` """ return _read_instance_from_iterparse( iterator, _read_operation_request_as_element, "OperationRequest" )
[docs]def operation_request_from_stream( stream: TextIO, has_iterparse: HasIterparse = xml.etree.ElementTree ) -> our_types.OperationRequest: """ Read an instance of :py:class:`.types.OperationRequest` from the :paramref:`stream`. Example usage: .. code-block:: import aas_core3_2.xmlization as our_xmlization with open_some_stream_over_network(...) as stream: instance = our_xmlization.operation_request_from_stream( stream ) # Do something with the ``instance`` :param stream: representing an instance of :py:class:`.types.OperationRequest` in XML :param has_iterparse: Module containing ``iterparse`` function. Default is to use :py:mod:`xml.etree.ElementTree` from the standard library. If you have to deal with malicious input, consider using a library such as `defusedxml.ElementTree`_. :raise: :py:class:`DeserializationException` if unexpected input :return: Instance of :py:class:`.types.OperationRequest` read from :paramref:`stream` """ iterator = has_iterparse.iterparse(stream, ["start", "end"]) return operation_request_from_iterparse( _with_elements_cleared_after_yield(iterator) )
[docs]def operation_request_from_file( path: PathLike, has_iterparse: HasIterparse = xml.etree.ElementTree ) -> our_types.OperationRequest: """ Read an instance of :py:class:`.types.OperationRequest` from the :paramref:`path`. Example usage: .. code-block:: import pathlib import aas_core3_2.xmlization as our_xmlization path = pathlib.Path(...) instance = our_xmlization.operation_request_from_file( path ) # Do something with the ``instance`` :param path: to the file representing an instance of :py:class:`.types.OperationRequest` in XML :param has_iterparse: Module containing ``iterparse`` function. Default is to use :py:mod:`xml.etree.ElementTree` from the standard library. If you have to deal with malicious input, consider using a library such as `defusedxml.ElementTree`_. :raise: :py:class:`DeserializationException` if unexpected input :return: Instance of :py:class:`.types.OperationRequest` read from :paramref:`path` """ with open(os.fspath(path), encoding="utf-8") as fid: iterator = has_iterparse.iterparse(fid, ["start", "end"]) return operation_request_from_iterparse( _with_elements_cleared_after_yield(iterator) )
[docs]def operation_request_from_str( text: str, has_iterparse: HasIterparse = xml.etree.ElementTree ) -> our_types.OperationRequest: """ Read an instance of :py:class:`.types.OperationRequest` from the :paramref:`text`. Example usage: .. code-block:: import pathlib import aas_core3_2.xmlization as our_xmlization text = "<...>...</...>" instance = our_xmlization.operation_request_from_str( text ) # Do something with the ``instance`` :param text: representing an instance of :py:class:`.types.OperationRequest` in XML :param has_iterparse: Module containing ``iterparse`` function. Default is to use :py:mod:`xml.etree.ElementTree` from the standard library. If you have to deal with malicious input, consider using a library such as `defusedxml.ElementTree`_. :raise: :py:class:`DeserializationException` if unexpected input :return: Instance of :py:class:`.types.OperationRequest` read from :paramref:`text` """ iterator = has_iterparse.iterparse(io.StringIO(text), ["start", "end"]) return operation_request_from_iterparse( _with_elements_cleared_after_yield(iterator) )
[docs]def operation_request_async_from_iterparse( iterator: Iterator[Tuple[str, Element]], ) -> our_types.OperationRequestAsync: """ Read an instance of :py:class:`.types.OperationRequestAsync` from the :paramref:`iterator`. Example usage: .. code-block:: import pathlib import xml.etree.ElementTree as ET import aas_core3_2.xmlization as our_xmlization path = pathlib.Path(...) with path.open("rt") as fid: iterator = ET.iterparse( source=fid, events=['start', 'end'] ) instance = our_xmlization.operation_request_async_from_iterparse( iterator ) # Do something with the ``instance`` :param iterator: Input stream of ``(event, element)`` coming from :py:func:`xml.etree.ElementTree.iterparse` with the argument ``events=["start", "end"]`` :raise: :py:class:`DeserializationException` if unexpected input :return: Instance of :py:class:`.types.OperationRequestAsync` read from :paramref:`iterator` """ return _read_instance_from_iterparse( iterator, _read_operation_request_async_as_element, "OperationRequestAsync" )
[docs]def operation_request_async_from_stream( stream: TextIO, has_iterparse: HasIterparse = xml.etree.ElementTree ) -> our_types.OperationRequestAsync: """ Read an instance of :py:class:`.types.OperationRequestAsync` from the :paramref:`stream`. Example usage: .. code-block:: import aas_core3_2.xmlization as our_xmlization with open_some_stream_over_network(...) as stream: instance = our_xmlization.operation_request_async_from_stream( stream ) # Do something with the ``instance`` :param stream: representing an instance of :py:class:`.types.OperationRequestAsync` in XML :param has_iterparse: Module containing ``iterparse`` function. Default is to use :py:mod:`xml.etree.ElementTree` from the standard library. If you have to deal with malicious input, consider using a library such as `defusedxml.ElementTree`_. :raise: :py:class:`DeserializationException` if unexpected input :return: Instance of :py:class:`.types.OperationRequestAsync` read from :paramref:`stream` """ iterator = has_iterparse.iterparse(stream, ["start", "end"]) return operation_request_async_from_iterparse( _with_elements_cleared_after_yield(iterator) )
[docs]def operation_request_async_from_file( path: PathLike, has_iterparse: HasIterparse = xml.etree.ElementTree ) -> our_types.OperationRequestAsync: """ Read an instance of :py:class:`.types.OperationRequestAsync` from the :paramref:`path`. Example usage: .. code-block:: import pathlib import aas_core3_2.xmlization as our_xmlization path = pathlib.Path(...) instance = our_xmlization.operation_request_async_from_file( path ) # Do something with the ``instance`` :param path: to the file representing an instance of :py:class:`.types.OperationRequestAsync` in XML :param has_iterparse: Module containing ``iterparse`` function. Default is to use :py:mod:`xml.etree.ElementTree` from the standard library. If you have to deal with malicious input, consider using a library such as `defusedxml.ElementTree`_. :raise: :py:class:`DeserializationException` if unexpected input :return: Instance of :py:class:`.types.OperationRequestAsync` read from :paramref:`path` """ with open(os.fspath(path), encoding="utf-8") as fid: iterator = has_iterparse.iterparse(fid, ["start", "end"]) return operation_request_async_from_iterparse( _with_elements_cleared_after_yield(iterator) )
[docs]def operation_request_async_from_str( text: str, has_iterparse: HasIterparse = xml.etree.ElementTree ) -> our_types.OperationRequestAsync: """ Read an instance of :py:class:`.types.OperationRequestAsync` from the :paramref:`text`. Example usage: .. code-block:: import pathlib import aas_core3_2.xmlization as our_xmlization text = "<...>...</...>" instance = our_xmlization.operation_request_async_from_str( text ) # Do something with the ``instance`` :param text: representing an instance of :py:class:`.types.OperationRequestAsync` in XML :param has_iterparse: Module containing ``iterparse`` function. Default is to use :py:mod:`xml.etree.ElementTree` from the standard library. If you have to deal with malicious input, consider using a library such as `defusedxml.ElementTree`_. :raise: :py:class:`DeserializationException` if unexpected input :return: Instance of :py:class:`.types.OperationRequestAsync` read from :paramref:`text` """ iterator = has_iterparse.iterparse(io.StringIO(text), ["start", "end"]) return operation_request_async_from_iterparse( _with_elements_cleared_after_yield(iterator) )
[docs]def operation_request_value_only_from_iterparse( iterator: Iterator[Tuple[str, Element]], ) -> our_types.OperationRequestValueOnly: """ Read an instance of :py:class:`.types.OperationRequestValueOnly` from the :paramref:`iterator`. Example usage: .. code-block:: import pathlib import xml.etree.ElementTree as ET import aas_core3_2.xmlization as our_xmlization path = pathlib.Path(...) with path.open("rt") as fid: iterator = ET.iterparse( source=fid, events=['start', 'end'] ) instance = our_xmlization.operation_request_value_only_from_iterparse( iterator ) # Do something with the ``instance`` :param iterator: Input stream of ``(event, element)`` coming from :py:func:`xml.etree.ElementTree.iterparse` with the argument ``events=["start", "end"]`` :raise: :py:class:`DeserializationException` if unexpected input :return: Instance of :py:class:`.types.OperationRequestValueOnly` read from :paramref:`iterator` """ return _read_instance_from_iterparse( iterator, _read_operation_request_value_only_as_element, "OperationRequestValueOnly", )
[docs]def operation_request_value_only_from_stream( stream: TextIO, has_iterparse: HasIterparse = xml.etree.ElementTree ) -> our_types.OperationRequestValueOnly: """ Read an instance of :py:class:`.types.OperationRequestValueOnly` from the :paramref:`stream`. Example usage: .. code-block:: import aas_core3_2.xmlization as our_xmlization with open_some_stream_over_network(...) as stream: instance = our_xmlization.operation_request_value_only_from_stream( stream ) # Do something with the ``instance`` :param stream: representing an instance of :py:class:`.types.OperationRequestValueOnly` in XML :param has_iterparse: Module containing ``iterparse`` function. Default is to use :py:mod:`xml.etree.ElementTree` from the standard library. If you have to deal with malicious input, consider using a library such as `defusedxml.ElementTree`_. :raise: :py:class:`DeserializationException` if unexpected input :return: Instance of :py:class:`.types.OperationRequestValueOnly` read from :paramref:`stream` """ iterator = has_iterparse.iterparse(stream, ["start", "end"]) return operation_request_value_only_from_iterparse( _with_elements_cleared_after_yield(iterator) )
[docs]def operation_request_value_only_from_file( path: PathLike, has_iterparse: HasIterparse = xml.etree.ElementTree ) -> our_types.OperationRequestValueOnly: """ Read an instance of :py:class:`.types.OperationRequestValueOnly` from the :paramref:`path`. Example usage: .. code-block:: import pathlib import aas_core3_2.xmlization as our_xmlization path = pathlib.Path(...) instance = our_xmlization.operation_request_value_only_from_file( path ) # Do something with the ``instance`` :param path: to the file representing an instance of :py:class:`.types.OperationRequestValueOnly` in XML :param has_iterparse: Module containing ``iterparse`` function. Default is to use :py:mod:`xml.etree.ElementTree` from the standard library. If you have to deal with malicious input, consider using a library such as `defusedxml.ElementTree`_. :raise: :py:class:`DeserializationException` if unexpected input :return: Instance of :py:class:`.types.OperationRequestValueOnly` read from :paramref:`path` """ with open(os.fspath(path), encoding="utf-8") as fid: iterator = has_iterparse.iterparse(fid, ["start", "end"]) return operation_request_value_only_from_iterparse( _with_elements_cleared_after_yield(iterator) )
[docs]def operation_request_value_only_from_str( text: str, has_iterparse: HasIterparse = xml.etree.ElementTree ) -> our_types.OperationRequestValueOnly: """ Read an instance of :py:class:`.types.OperationRequestValueOnly` from the :paramref:`text`. Example usage: .. code-block:: import pathlib import aas_core3_2.xmlization as our_xmlization text = "<...>...</...>" instance = our_xmlization.operation_request_value_only_from_str( text ) # Do something with the ``instance`` :param text: representing an instance of :py:class:`.types.OperationRequestValueOnly` in XML :param has_iterparse: Module containing ``iterparse`` function. Default is to use :py:mod:`xml.etree.ElementTree` from the standard library. If you have to deal with malicious input, consider using a library such as `defusedxml.ElementTree`_. :raise: :py:class:`DeserializationException` if unexpected input :return: Instance of :py:class:`.types.OperationRequestValueOnly` read from :paramref:`text` """ iterator = has_iterparse.iterparse(io.StringIO(text), ["start", "end"]) return operation_request_value_only_from_iterparse( _with_elements_cleared_after_yield(iterator) )
[docs]def operation_request_async_value_only_from_iterparse( iterator: Iterator[Tuple[str, Element]], ) -> our_types.OperationRequestAsyncValueOnly: """ Read an instance of :py:class:`.types.OperationRequestAsyncValueOnly` from the :paramref:`iterator`. Example usage: .. code-block:: import pathlib import xml.etree.ElementTree as ET import aas_core3_2.xmlization as our_xmlization path = pathlib.Path(...) with path.open("rt") as fid: iterator = ET.iterparse( source=fid, events=['start', 'end'] ) instance = our_xmlization.operation_request_async_value_only_from_iterparse( iterator ) # Do something with the ``instance`` :param iterator: Input stream of ``(event, element)`` coming from :py:func:`xml.etree.ElementTree.iterparse` with the argument ``events=["start", "end"]`` :raise: :py:class:`DeserializationException` if unexpected input :return: Instance of :py:class:`.types.OperationRequestAsyncValueOnly` read from :paramref:`iterator` """ return _read_instance_from_iterparse( iterator, _read_operation_request_async_value_only_as_element, "OperationRequestAsyncValueOnly", )
[docs]def operation_request_async_value_only_from_stream( stream: TextIO, has_iterparse: HasIterparse = xml.etree.ElementTree ) -> our_types.OperationRequestAsyncValueOnly: """ Read an instance of :py:class:`.types.OperationRequestAsyncValueOnly` from the :paramref:`stream`. Example usage: .. code-block:: import aas_core3_2.xmlization as our_xmlization with open_some_stream_over_network(...) as stream: instance = our_xmlization.operation_request_async_value_only_from_stream( stream ) # Do something with the ``instance`` :param stream: representing an instance of :py:class:`.types.OperationRequestAsyncValueOnly` in XML :param has_iterparse: Module containing ``iterparse`` function. Default is to use :py:mod:`xml.etree.ElementTree` from the standard library. If you have to deal with malicious input, consider using a library such as `defusedxml.ElementTree`_. :raise: :py:class:`DeserializationException` if unexpected input :return: Instance of :py:class:`.types.OperationRequestAsyncValueOnly` read from :paramref:`stream` """ iterator = has_iterparse.iterparse(stream, ["start", "end"]) return operation_request_async_value_only_from_iterparse( _with_elements_cleared_after_yield(iterator) )
[docs]def operation_request_async_value_only_from_file( path: PathLike, has_iterparse: HasIterparse = xml.etree.ElementTree ) -> our_types.OperationRequestAsyncValueOnly: """ Read an instance of :py:class:`.types.OperationRequestAsyncValueOnly` from the :paramref:`path`. Example usage: .. code-block:: import pathlib import aas_core3_2.xmlization as our_xmlization path = pathlib.Path(...) instance = our_xmlization.operation_request_async_value_only_from_file( path ) # Do something with the ``instance`` :param path: to the file representing an instance of :py:class:`.types.OperationRequestAsyncValueOnly` in XML :param has_iterparse: Module containing ``iterparse`` function. Default is to use :py:mod:`xml.etree.ElementTree` from the standard library. If you have to deal with malicious input, consider using a library such as `defusedxml.ElementTree`_. :raise: :py:class:`DeserializationException` if unexpected input :return: Instance of :py:class:`.types.OperationRequestAsyncValueOnly` read from :paramref:`path` """ with open(os.fspath(path), encoding="utf-8") as fid: iterator = has_iterparse.iterparse(fid, ["start", "end"]) return operation_request_async_value_only_from_iterparse( _with_elements_cleared_after_yield(iterator) )
[docs]def operation_request_async_value_only_from_str( text: str, has_iterparse: HasIterparse = xml.etree.ElementTree ) -> our_types.OperationRequestAsyncValueOnly: """ Read an instance of :py:class:`.types.OperationRequestAsyncValueOnly` from the :paramref:`text`. Example usage: .. code-block:: import pathlib import aas_core3_2.xmlization as our_xmlization text = "<...>...</...>" instance = our_xmlization.operation_request_async_value_only_from_str( text ) # Do something with the ``instance`` :param text: representing an instance of :py:class:`.types.OperationRequestAsyncValueOnly` in XML :param has_iterparse: Module containing ``iterparse`` function. Default is to use :py:mod:`xml.etree.ElementTree` from the standard library. If you have to deal with malicious input, consider using a library such as `defusedxml.ElementTree`_. :raise: :py:class:`DeserializationException` if unexpected input :return: Instance of :py:class:`.types.OperationRequestAsyncValueOnly` read from :paramref:`text` """ iterator = has_iterparse.iterparse(io.StringIO(text), ["start", "end"]) return operation_request_async_value_only_from_iterparse( _with_elements_cleared_after_yield(iterator) )
[docs]def base_operation_result_from_iterparse( iterator: Iterator[Tuple[str, Element]], ) -> our_types.BaseOperationResult: """ Read an instance of :py:class:`.types.BaseOperationResult` from the :paramref:`iterator`. Example usage: .. code-block:: import pathlib import xml.etree.ElementTree as ET import aas_core3_2.xmlization as our_xmlization path = pathlib.Path(...) with path.open("rt") as fid: iterator = ET.iterparse( source=fid, events=['start', 'end'] ) instance = our_xmlization.base_operation_result_from_iterparse( iterator ) # Do something with the ``instance`` :param iterator: Input stream of ``(event, element)`` coming from :py:func:`xml.etree.ElementTree.iterparse` with the argument ``events=["start", "end"]`` :raise: :py:class:`DeserializationException` if unexpected input :return: Instance of :py:class:`.types.BaseOperationResult` read from :paramref:`iterator` """ return _read_instance_from_iterparse( iterator, _read_base_operation_result_as_element, "BaseOperationResult" )
[docs]def base_operation_result_from_stream( stream: TextIO, has_iterparse: HasIterparse = xml.etree.ElementTree ) -> our_types.BaseOperationResult: """ Read an instance of :py:class:`.types.BaseOperationResult` from the :paramref:`stream`. Example usage: .. code-block:: import aas_core3_2.xmlization as our_xmlization with open_some_stream_over_network(...) as stream: instance = our_xmlization.base_operation_result_from_stream( stream ) # Do something with the ``instance`` :param stream: representing an instance of :py:class:`.types.BaseOperationResult` in XML :param has_iterparse: Module containing ``iterparse`` function. Default is to use :py:mod:`xml.etree.ElementTree` from the standard library. If you have to deal with malicious input, consider using a library such as `defusedxml.ElementTree`_. :raise: :py:class:`DeserializationException` if unexpected input :return: Instance of :py:class:`.types.BaseOperationResult` read from :paramref:`stream` """ iterator = has_iterparse.iterparse(stream, ["start", "end"]) return base_operation_result_from_iterparse( _with_elements_cleared_after_yield(iterator) )
[docs]def base_operation_result_from_file( path: PathLike, has_iterparse: HasIterparse = xml.etree.ElementTree ) -> our_types.BaseOperationResult: """ Read an instance of :py:class:`.types.BaseOperationResult` from the :paramref:`path`. Example usage: .. code-block:: import pathlib import aas_core3_2.xmlization as our_xmlization path = pathlib.Path(...) instance = our_xmlization.base_operation_result_from_file( path ) # Do something with the ``instance`` :param path: to the file representing an instance of :py:class:`.types.BaseOperationResult` in XML :param has_iterparse: Module containing ``iterparse`` function. Default is to use :py:mod:`xml.etree.ElementTree` from the standard library. If you have to deal with malicious input, consider using a library such as `defusedxml.ElementTree`_. :raise: :py:class:`DeserializationException` if unexpected input :return: Instance of :py:class:`.types.BaseOperationResult` read from :paramref:`path` """ with open(os.fspath(path), encoding="utf-8") as fid: iterator = has_iterparse.iterparse(fid, ["start", "end"]) return base_operation_result_from_iterparse( _with_elements_cleared_after_yield(iterator) )
[docs]def base_operation_result_from_str( text: str, has_iterparse: HasIterparse = xml.etree.ElementTree ) -> our_types.BaseOperationResult: """ Read an instance of :py:class:`.types.BaseOperationResult` from the :paramref:`text`. Example usage: .. code-block:: import pathlib import aas_core3_2.xmlization as our_xmlization text = "<...>...</...>" instance = our_xmlization.base_operation_result_from_str( text ) # Do something with the ``instance`` :param text: representing an instance of :py:class:`.types.BaseOperationResult` in XML :param has_iterparse: Module containing ``iterparse`` function. Default is to use :py:mod:`xml.etree.ElementTree` from the standard library. If you have to deal with malicious input, consider using a library such as `defusedxml.ElementTree`_. :raise: :py:class:`DeserializationException` if unexpected input :return: Instance of :py:class:`.types.BaseOperationResult` read from :paramref:`text` """ iterator = has_iterparse.iterparse(io.StringIO(text), ["start", "end"]) return base_operation_result_from_iterparse( _with_elements_cleared_after_yield(iterator) )
[docs]def operation_result_from_iterparse( iterator: Iterator[Tuple[str, Element]], ) -> our_types.OperationResult: """ Read an instance of :py:class:`.types.OperationResult` from the :paramref:`iterator`. Example usage: .. code-block:: import pathlib import xml.etree.ElementTree as ET import aas_core3_2.xmlization as our_xmlization path = pathlib.Path(...) with path.open("rt") as fid: iterator = ET.iterparse( source=fid, events=['start', 'end'] ) instance = our_xmlization.operation_result_from_iterparse( iterator ) # Do something with the ``instance`` :param iterator: Input stream of ``(event, element)`` coming from :py:func:`xml.etree.ElementTree.iterparse` with the argument ``events=["start", "end"]`` :raise: :py:class:`DeserializationException` if unexpected input :return: Instance of :py:class:`.types.OperationResult` read from :paramref:`iterator` """ return _read_instance_from_iterparse( iterator, _read_operation_result_as_element, "OperationResult" )
[docs]def operation_result_from_stream( stream: TextIO, has_iterparse: HasIterparse = xml.etree.ElementTree ) -> our_types.OperationResult: """ Read an instance of :py:class:`.types.OperationResult` from the :paramref:`stream`. Example usage: .. code-block:: import aas_core3_2.xmlization as our_xmlization with open_some_stream_over_network(...) as stream: instance = our_xmlization.operation_result_from_stream( stream ) # Do something with the ``instance`` :param stream: representing an instance of :py:class:`.types.OperationResult` in XML :param has_iterparse: Module containing ``iterparse`` function. Default is to use :py:mod:`xml.etree.ElementTree` from the standard library. If you have to deal with malicious input, consider using a library such as `defusedxml.ElementTree`_. :raise: :py:class:`DeserializationException` if unexpected input :return: Instance of :py:class:`.types.OperationResult` read from :paramref:`stream` """ iterator = has_iterparse.iterparse(stream, ["start", "end"]) return operation_result_from_iterparse(_with_elements_cleared_after_yield(iterator))
[docs]def operation_result_from_file( path: PathLike, has_iterparse: HasIterparse = xml.etree.ElementTree ) -> our_types.OperationResult: """ Read an instance of :py:class:`.types.OperationResult` from the :paramref:`path`. Example usage: .. code-block:: import pathlib import aas_core3_2.xmlization as our_xmlization path = pathlib.Path(...) instance = our_xmlization.operation_result_from_file( path ) # Do something with the ``instance`` :param path: to the file representing an instance of :py:class:`.types.OperationResult` in XML :param has_iterparse: Module containing ``iterparse`` function. Default is to use :py:mod:`xml.etree.ElementTree` from the standard library. If you have to deal with malicious input, consider using a library such as `defusedxml.ElementTree`_. :raise: :py:class:`DeserializationException` if unexpected input :return: Instance of :py:class:`.types.OperationResult` read from :paramref:`path` """ with open(os.fspath(path), encoding="utf-8") as fid: iterator = has_iterparse.iterparse(fid, ["start", "end"]) return operation_result_from_iterparse( _with_elements_cleared_after_yield(iterator) )
[docs]def operation_result_from_str( text: str, has_iterparse: HasIterparse = xml.etree.ElementTree ) -> our_types.OperationResult: """ Read an instance of :py:class:`.types.OperationResult` from the :paramref:`text`. Example usage: .. code-block:: import pathlib import aas_core3_2.xmlization as our_xmlization text = "<...>...</...>" instance = our_xmlization.operation_result_from_str( text ) # Do something with the ``instance`` :param text: representing an instance of :py:class:`.types.OperationResult` in XML :param has_iterparse: Module containing ``iterparse`` function. Default is to use :py:mod:`xml.etree.ElementTree` from the standard library. If you have to deal with malicious input, consider using a library such as `defusedxml.ElementTree`_. :raise: :py:class:`DeserializationException` if unexpected input :return: Instance of :py:class:`.types.OperationResult` read from :paramref:`text` """ iterator = has_iterparse.iterparse(io.StringIO(text), ["start", "end"]) return operation_result_from_iterparse(_with_elements_cleared_after_yield(iterator))
[docs]def operation_result_value_only_from_iterparse( iterator: Iterator[Tuple[str, Element]], ) -> our_types.OperationResultValueOnly: """ Read an instance of :py:class:`.types.OperationResultValueOnly` from the :paramref:`iterator`. Example usage: .. code-block:: import pathlib import xml.etree.ElementTree as ET import aas_core3_2.xmlization as our_xmlization path = pathlib.Path(...) with path.open("rt") as fid: iterator = ET.iterparse( source=fid, events=['start', 'end'] ) instance = our_xmlization.operation_result_value_only_from_iterparse( iterator ) # Do something with the ``instance`` :param iterator: Input stream of ``(event, element)`` coming from :py:func:`xml.etree.ElementTree.iterparse` with the argument ``events=["start", "end"]`` :raise: :py:class:`DeserializationException` if unexpected input :return: Instance of :py:class:`.types.OperationResultValueOnly` read from :paramref:`iterator` """ return _read_instance_from_iterparse( iterator, _read_operation_result_value_only_as_element, "OperationResultValueOnly", )
[docs]def operation_result_value_only_from_stream( stream: TextIO, has_iterparse: HasIterparse = xml.etree.ElementTree ) -> our_types.OperationResultValueOnly: """ Read an instance of :py:class:`.types.OperationResultValueOnly` from the :paramref:`stream`. Example usage: .. code-block:: import aas_core3_2.xmlization as our_xmlization with open_some_stream_over_network(...) as stream: instance = our_xmlization.operation_result_value_only_from_stream( stream ) # Do something with the ``instance`` :param stream: representing an instance of :py:class:`.types.OperationResultValueOnly` in XML :param has_iterparse: Module containing ``iterparse`` function. Default is to use :py:mod:`xml.etree.ElementTree` from the standard library. If you have to deal with malicious input, consider using a library such as `defusedxml.ElementTree`_. :raise: :py:class:`DeserializationException` if unexpected input :return: Instance of :py:class:`.types.OperationResultValueOnly` read from :paramref:`stream` """ iterator = has_iterparse.iterparse(stream, ["start", "end"]) return operation_result_value_only_from_iterparse( _with_elements_cleared_after_yield(iterator) )
[docs]def operation_result_value_only_from_file( path: PathLike, has_iterparse: HasIterparse = xml.etree.ElementTree ) -> our_types.OperationResultValueOnly: """ Read an instance of :py:class:`.types.OperationResultValueOnly` from the :paramref:`path`. Example usage: .. code-block:: import pathlib import aas_core3_2.xmlization as our_xmlization path = pathlib.Path(...) instance = our_xmlization.operation_result_value_only_from_file( path ) # Do something with the ``instance`` :param path: to the file representing an instance of :py:class:`.types.OperationResultValueOnly` in XML :param has_iterparse: Module containing ``iterparse`` function. Default is to use :py:mod:`xml.etree.ElementTree` from the standard library. If you have to deal with malicious input, consider using a library such as `defusedxml.ElementTree`_. :raise: :py:class:`DeserializationException` if unexpected input :return: Instance of :py:class:`.types.OperationResultValueOnly` read from :paramref:`path` """ with open(os.fspath(path), encoding="utf-8") as fid: iterator = has_iterparse.iterparse(fid, ["start", "end"]) return operation_result_value_only_from_iterparse( _with_elements_cleared_after_yield(iterator) )
[docs]def operation_result_value_only_from_str( text: str, has_iterparse: HasIterparse = xml.etree.ElementTree ) -> our_types.OperationResultValueOnly: """ Read an instance of :py:class:`.types.OperationResultValueOnly` from the :paramref:`text`. Example usage: .. code-block:: import pathlib import aas_core3_2.xmlization as our_xmlization text = "<...>...</...>" instance = our_xmlization.operation_result_value_only_from_str( text ) # Do something with the ``instance`` :param text: representing an instance of :py:class:`.types.OperationResultValueOnly` in XML :param has_iterparse: Module containing ``iterparse`` function. Default is to use :py:mod:`xml.etree.ElementTree` from the standard library. If you have to deal with malicious input, consider using a library such as `defusedxml.ElementTree`_. :raise: :py:class:`DeserializationException` if unexpected input :return: Instance of :py:class:`.types.OperationResultValueOnly` read from :paramref:`text` """ iterator = has_iterparse.iterparse(io.StringIO(text), ["start", "end"]) return operation_result_value_only_from_iterparse( _with_elements_cleared_after_yield(iterator) )
[docs]def operation_handle_from_iterparse( iterator: Iterator[Tuple[str, Element]], ) -> our_types.OperationHandle: """ Read an instance of :py:class:`.types.OperationHandle` from the :paramref:`iterator`. Example usage: .. code-block:: import pathlib import xml.etree.ElementTree as ET import aas_core3_2.xmlization as our_xmlization path = pathlib.Path(...) with path.open("rt") as fid: iterator = ET.iterparse( source=fid, events=['start', 'end'] ) instance = our_xmlization.operation_handle_from_iterparse( iterator ) # Do something with the ``instance`` :param iterator: Input stream of ``(event, element)`` coming from :py:func:`xml.etree.ElementTree.iterparse` with the argument ``events=["start", "end"]`` :raise: :py:class:`DeserializationException` if unexpected input :return: Instance of :py:class:`.types.OperationHandle` read from :paramref:`iterator` """ return _read_instance_from_iterparse( iterator, _read_operation_handle_as_element, "OperationHandle" )
[docs]def operation_handle_from_stream( stream: TextIO, has_iterparse: HasIterparse = xml.etree.ElementTree ) -> our_types.OperationHandle: """ Read an instance of :py:class:`.types.OperationHandle` from the :paramref:`stream`. Example usage: .. code-block:: import aas_core3_2.xmlization as our_xmlization with open_some_stream_over_network(...) as stream: instance = our_xmlization.operation_handle_from_stream( stream ) # Do something with the ``instance`` :param stream: representing an instance of :py:class:`.types.OperationHandle` in XML :param has_iterparse: Module containing ``iterparse`` function. Default is to use :py:mod:`xml.etree.ElementTree` from the standard library. If you have to deal with malicious input, consider using a library such as `defusedxml.ElementTree`_. :raise: :py:class:`DeserializationException` if unexpected input :return: Instance of :py:class:`.types.OperationHandle` read from :paramref:`stream` """ iterator = has_iterparse.iterparse(stream, ["start", "end"]) return operation_handle_from_iterparse(_with_elements_cleared_after_yield(iterator))
[docs]def operation_handle_from_file( path: PathLike, has_iterparse: HasIterparse = xml.etree.ElementTree ) -> our_types.OperationHandle: """ Read an instance of :py:class:`.types.OperationHandle` from the :paramref:`path`. Example usage: .. code-block:: import pathlib import aas_core3_2.xmlization as our_xmlization path = pathlib.Path(...) instance = our_xmlization.operation_handle_from_file( path ) # Do something with the ``instance`` :param path: to the file representing an instance of :py:class:`.types.OperationHandle` in XML :param has_iterparse: Module containing ``iterparse`` function. Default is to use :py:mod:`xml.etree.ElementTree` from the standard library. If you have to deal with malicious input, consider using a library such as `defusedxml.ElementTree`_. :raise: :py:class:`DeserializationException` if unexpected input :return: Instance of :py:class:`.types.OperationHandle` read from :paramref:`path` """ with open(os.fspath(path), encoding="utf-8") as fid: iterator = has_iterparse.iterparse(fid, ["start", "end"]) return operation_handle_from_iterparse( _with_elements_cleared_after_yield(iterator) )
[docs]def operation_handle_from_str( text: str, has_iterparse: HasIterparse = xml.etree.ElementTree ) -> our_types.OperationHandle: """ Read an instance of :py:class:`.types.OperationHandle` from the :paramref:`text`. Example usage: .. code-block:: import pathlib import aas_core3_2.xmlization as our_xmlization text = "<...>...</...>" instance = our_xmlization.operation_handle_from_str( text ) # Do something with the ``instance`` :param text: representing an instance of :py:class:`.types.OperationHandle` in XML :param has_iterparse: Module containing ``iterparse`` function. Default is to use :py:mod:`xml.etree.ElementTree` from the standard library. If you have to deal with malicious input, consider using a library such as `defusedxml.ElementTree`_. :raise: :py:class:`DeserializationException` if unexpected input :return: Instance of :py:class:`.types.OperationHandle` read from :paramref:`text` """ iterator = has_iterparse.iterparse(io.StringIO(text), ["start", "end"]) return operation_handle_from_iterparse(_with_elements_cleared_after_yield(iterator))
[docs]def paged_result_from_iterparse( iterator: Iterator[Tuple[str, Element]], ) -> our_types.PagedResult: """ Read an instance of :py:class:`.types.PagedResult` from the :paramref:`iterator`. Example usage: .. code-block:: import pathlib import xml.etree.ElementTree as ET import aas_core3_2.xmlization as our_xmlization path = pathlib.Path(...) with path.open("rt") as fid: iterator = ET.iterparse( source=fid, events=['start', 'end'] ) instance = our_xmlization.paged_result_from_iterparse( iterator ) # Do something with the ``instance`` :param iterator: Input stream of ``(event, element)`` coming from :py:func:`xml.etree.ElementTree.iterparse` with the argument ``events=["start", "end"]`` :raise: :py:class:`DeserializationException` if unexpected input :return: Instance of :py:class:`.types.PagedResult` read from :paramref:`iterator` """ return _read_instance_from_iterparse( iterator, _read_paged_result_as_element, "PagedResult" )
[docs]def paged_result_from_stream( stream: TextIO, has_iterparse: HasIterparse = xml.etree.ElementTree ) -> our_types.PagedResult: """ Read an instance of :py:class:`.types.PagedResult` from the :paramref:`stream`. Example usage: .. code-block:: import aas_core3_2.xmlization as our_xmlization with open_some_stream_over_network(...) as stream: instance = our_xmlization.paged_result_from_stream( stream ) # Do something with the ``instance`` :param stream: representing an instance of :py:class:`.types.PagedResult` in XML :param has_iterparse: Module containing ``iterparse`` function. Default is to use :py:mod:`xml.etree.ElementTree` from the standard library. If you have to deal with malicious input, consider using a library such as `defusedxml.ElementTree`_. :raise: :py:class:`DeserializationException` if unexpected input :return: Instance of :py:class:`.types.PagedResult` read from :paramref:`stream` """ iterator = has_iterparse.iterparse(stream, ["start", "end"]) return paged_result_from_iterparse(_with_elements_cleared_after_yield(iterator))
[docs]def paged_result_from_file( path: PathLike, has_iterparse: HasIterparse = xml.etree.ElementTree ) -> our_types.PagedResult: """ Read an instance of :py:class:`.types.PagedResult` from the :paramref:`path`. Example usage: .. code-block:: import pathlib import aas_core3_2.xmlization as our_xmlization path = pathlib.Path(...) instance = our_xmlization.paged_result_from_file( path ) # Do something with the ``instance`` :param path: to the file representing an instance of :py:class:`.types.PagedResult` in XML :param has_iterparse: Module containing ``iterparse`` function. Default is to use :py:mod:`xml.etree.ElementTree` from the standard library. If you have to deal with malicious input, consider using a library such as `defusedxml.ElementTree`_. :raise: :py:class:`DeserializationException` if unexpected input :return: Instance of :py:class:`.types.PagedResult` read from :paramref:`path` """ with open(os.fspath(path), encoding="utf-8") as fid: iterator = has_iterparse.iterparse(fid, ["start", "end"]) return paged_result_from_iterparse(_with_elements_cleared_after_yield(iterator))
[docs]def paged_result_from_str( text: str, has_iterparse: HasIterparse = xml.etree.ElementTree ) -> our_types.PagedResult: """ Read an instance of :py:class:`.types.PagedResult` from the :paramref:`text`. Example usage: .. code-block:: import pathlib import aas_core3_2.xmlization as our_xmlization text = "<...>...</...>" instance = our_xmlization.paged_result_from_str( text ) # Do something with the ``instance`` :param text: representing an instance of :py:class:`.types.PagedResult` in XML :param has_iterparse: Module containing ``iterparse`` function. Default is to use :py:mod:`xml.etree.ElementTree` from the standard library. If you have to deal with malicious input, consider using a library such as `defusedxml.ElementTree`_. :raise: :py:class:`DeserializationException` if unexpected input :return: Instance of :py:class:`.types.PagedResult` read from :paramref:`text` """ iterator = has_iterparse.iterparse(io.StringIO(text), ["start", "end"]) return paged_result_from_iterparse(_with_elements_cleared_after_yield(iterator))
[docs]def paging_metadata_from_iterparse( iterator: Iterator[Tuple[str, Element]], ) -> our_types.PagingMetadata: """ Read an instance of :py:class:`.types.PagingMetadata` from the :paramref:`iterator`. Example usage: .. code-block:: import pathlib import xml.etree.ElementTree as ET import aas_core3_2.xmlization as our_xmlization path = pathlib.Path(...) with path.open("rt") as fid: iterator = ET.iterparse( source=fid, events=['start', 'end'] ) instance = our_xmlization.paging_metadata_from_iterparse( iterator ) # Do something with the ``instance`` :param iterator: Input stream of ``(event, element)`` coming from :py:func:`xml.etree.ElementTree.iterparse` with the argument ``events=["start", "end"]`` :raise: :py:class:`DeserializationException` if unexpected input :return: Instance of :py:class:`.types.PagingMetadata` read from :paramref:`iterator` """ return _read_instance_from_iterparse( iterator, _read_paging_metadata_as_element, "PagingMetadata" )
[docs]def paging_metadata_from_stream( stream: TextIO, has_iterparse: HasIterparse = xml.etree.ElementTree ) -> our_types.PagingMetadata: """ Read an instance of :py:class:`.types.PagingMetadata` from the :paramref:`stream`. Example usage: .. code-block:: import aas_core3_2.xmlization as our_xmlization with open_some_stream_over_network(...) as stream: instance = our_xmlization.paging_metadata_from_stream( stream ) # Do something with the ``instance`` :param stream: representing an instance of :py:class:`.types.PagingMetadata` in XML :param has_iterparse: Module containing ``iterparse`` function. Default is to use :py:mod:`xml.etree.ElementTree` from the standard library. If you have to deal with malicious input, consider using a library such as `defusedxml.ElementTree`_. :raise: :py:class:`DeserializationException` if unexpected input :return: Instance of :py:class:`.types.PagingMetadata` read from :paramref:`stream` """ iterator = has_iterparse.iterparse(stream, ["start", "end"]) return paging_metadata_from_iterparse(_with_elements_cleared_after_yield(iterator))
[docs]def paging_metadata_from_file( path: PathLike, has_iterparse: HasIterparse = xml.etree.ElementTree ) -> our_types.PagingMetadata: """ Read an instance of :py:class:`.types.PagingMetadata` from the :paramref:`path`. Example usage: .. code-block:: import pathlib import aas_core3_2.xmlization as our_xmlization path = pathlib.Path(...) instance = our_xmlization.paging_metadata_from_file( path ) # Do something with the ``instance`` :param path: to the file representing an instance of :py:class:`.types.PagingMetadata` in XML :param has_iterparse: Module containing ``iterparse`` function. Default is to use :py:mod:`xml.etree.ElementTree` from the standard library. If you have to deal with malicious input, consider using a library such as `defusedxml.ElementTree`_. :raise: :py:class:`DeserializationException` if unexpected input :return: Instance of :py:class:`.types.PagingMetadata` read from :paramref:`path` """ with open(os.fspath(path), encoding="utf-8") as fid: iterator = has_iterparse.iterparse(fid, ["start", "end"]) return paging_metadata_from_iterparse( _with_elements_cleared_after_yield(iterator) )
[docs]def paging_metadata_from_str( text: str, has_iterparse: HasIterparse = xml.etree.ElementTree ) -> our_types.PagingMetadata: """ Read an instance of :py:class:`.types.PagingMetadata` from the :paramref:`text`. Example usage: .. code-block:: import pathlib import aas_core3_2.xmlization as our_xmlization text = "<...>...</...>" instance = our_xmlization.paging_metadata_from_str( text ) # Do something with the ``instance`` :param text: representing an instance of :py:class:`.types.PagingMetadata` in XML :param has_iterparse: Module containing ``iterparse`` function. Default is to use :py:mod:`xml.etree.ElementTree` from the standard library. If you have to deal with malicious input, consider using a library such as `defusedxml.ElementTree`_. :raise: :py:class:`DeserializationException` if unexpected input :return: Instance of :py:class:`.types.PagingMetadata` read from :paramref:`text` """ iterator = has_iterparse.iterparse(io.StringIO(text), ["start", "end"]) return paging_metadata_from_iterparse(_with_elements_cleared_after_yield(iterator))
[docs]def package_description_from_iterparse( iterator: Iterator[Tuple[str, Element]], ) -> our_types.PackageDescription: """ Read an instance of :py:class:`.types.PackageDescription` from the :paramref:`iterator`. Example usage: .. code-block:: import pathlib import xml.etree.ElementTree as ET import aas_core3_2.xmlization as our_xmlization path = pathlib.Path(...) with path.open("rt") as fid: iterator = ET.iterparse( source=fid, events=['start', 'end'] ) instance = our_xmlization.package_description_from_iterparse( iterator ) # Do something with the ``instance`` :param iterator: Input stream of ``(event, element)`` coming from :py:func:`xml.etree.ElementTree.iterparse` with the argument ``events=["start", "end"]`` :raise: :py:class:`DeserializationException` if unexpected input :return: Instance of :py:class:`.types.PackageDescription` read from :paramref:`iterator` """ return _read_instance_from_iterparse( iterator, _read_package_description_as_element, "PackageDescription" )
[docs]def package_description_from_stream( stream: TextIO, has_iterparse: HasIterparse = xml.etree.ElementTree ) -> our_types.PackageDescription: """ Read an instance of :py:class:`.types.PackageDescription` from the :paramref:`stream`. Example usage: .. code-block:: import aas_core3_2.xmlization as our_xmlization with open_some_stream_over_network(...) as stream: instance = our_xmlization.package_description_from_stream( stream ) # Do something with the ``instance`` :param stream: representing an instance of :py:class:`.types.PackageDescription` in XML :param has_iterparse: Module containing ``iterparse`` function. Default is to use :py:mod:`xml.etree.ElementTree` from the standard library. If you have to deal with malicious input, consider using a library such as `defusedxml.ElementTree`_. :raise: :py:class:`DeserializationException` if unexpected input :return: Instance of :py:class:`.types.PackageDescription` read from :paramref:`stream` """ iterator = has_iterparse.iterparse(stream, ["start", "end"]) return package_description_from_iterparse( _with_elements_cleared_after_yield(iterator) )
[docs]def package_description_from_file( path: PathLike, has_iterparse: HasIterparse = xml.etree.ElementTree ) -> our_types.PackageDescription: """ Read an instance of :py:class:`.types.PackageDescription` from the :paramref:`path`. Example usage: .. code-block:: import pathlib import aas_core3_2.xmlization as our_xmlization path = pathlib.Path(...) instance = our_xmlization.package_description_from_file( path ) # Do something with the ``instance`` :param path: to the file representing an instance of :py:class:`.types.PackageDescription` in XML :param has_iterparse: Module containing ``iterparse`` function. Default is to use :py:mod:`xml.etree.ElementTree` from the standard library. If you have to deal with malicious input, consider using a library such as `defusedxml.ElementTree`_. :raise: :py:class:`DeserializationException` if unexpected input :return: Instance of :py:class:`.types.PackageDescription` read from :paramref:`path` """ with open(os.fspath(path), encoding="utf-8") as fid: iterator = has_iterparse.iterparse(fid, ["start", "end"]) return package_description_from_iterparse( _with_elements_cleared_after_yield(iterator) )
[docs]def package_description_from_str( text: str, has_iterparse: HasIterparse = xml.etree.ElementTree ) -> our_types.PackageDescription: """ Read an instance of :py:class:`.types.PackageDescription` from the :paramref:`text`. Example usage: .. code-block:: import pathlib import aas_core3_2.xmlization as our_xmlization text = "<...>...</...>" instance = our_xmlization.package_description_from_str( text ) # Do something with the ``instance`` :param text: representing an instance of :py:class:`.types.PackageDescription` in XML :param has_iterparse: Module containing ``iterparse`` function. Default is to use :py:mod:`xml.etree.ElementTree` from the standard library. If you have to deal with malicious input, consider using a library such as `defusedxml.ElementTree`_. :raise: :py:class:`DeserializationException` if unexpected input :return: Instance of :py:class:`.types.PackageDescription` read from :paramref:`text` """ iterator = has_iterparse.iterparse(io.StringIO(text), ["start", "end"]) return package_description_from_iterparse( _with_elements_cleared_after_yield(iterator) )
[docs]def submodel_element_attributes_from_iterparse( iterator: Iterator[Tuple[str, Element]], ) -> our_types.SubmodelElementAttributes: """ Read an instance of :py:class:`.types.SubmodelElementAttributes` from the :paramref:`iterator`. Example usage: .. code-block:: import pathlib import xml.etree.ElementTree as ET import aas_core3_2.xmlization as our_xmlization path = pathlib.Path(...) with path.open("rt") as fid: iterator = ET.iterparse( source=fid, events=['start', 'end'] ) instance = our_xmlization.submodel_element_attributes_from_iterparse( iterator ) # Do something with the ``instance`` :param iterator: Input stream of ``(event, element)`` coming from :py:func:`xml.etree.ElementTree.iterparse` with the argument ``events=["start", "end"]`` :raise: :py:class:`DeserializationException` if unexpected input :return: Instance of :py:class:`.types.SubmodelElementAttributes` read from :paramref:`iterator` """ return _read_instance_from_iterparse( iterator, _read_submodel_element_attributes_as_element, "SubmodelElementAttributes", )
[docs]def submodel_element_attributes_from_stream( stream: TextIO, has_iterparse: HasIterparse = xml.etree.ElementTree ) -> our_types.SubmodelElementAttributes: """ Read an instance of :py:class:`.types.SubmodelElementAttributes` from the :paramref:`stream`. Example usage: .. code-block:: import aas_core3_2.xmlization as our_xmlization with open_some_stream_over_network(...) as stream: instance = our_xmlization.submodel_element_attributes_from_stream( stream ) # Do something with the ``instance`` :param stream: representing an instance of :py:class:`.types.SubmodelElementAttributes` in XML :param has_iterparse: Module containing ``iterparse`` function. Default is to use :py:mod:`xml.etree.ElementTree` from the standard library. If you have to deal with malicious input, consider using a library such as `defusedxml.ElementTree`_. :raise: :py:class:`DeserializationException` if unexpected input :return: Instance of :py:class:`.types.SubmodelElementAttributes` read from :paramref:`stream` """ iterator = has_iterparse.iterparse(stream, ["start", "end"]) return submodel_element_attributes_from_iterparse( _with_elements_cleared_after_yield(iterator) )
[docs]def submodel_element_attributes_from_file( path: PathLike, has_iterparse: HasIterparse = xml.etree.ElementTree ) -> our_types.SubmodelElementAttributes: """ Read an instance of :py:class:`.types.SubmodelElementAttributes` from the :paramref:`path`. Example usage: .. code-block:: import pathlib import aas_core3_2.xmlization as our_xmlization path = pathlib.Path(...) instance = our_xmlization.submodel_element_attributes_from_file( path ) # Do something with the ``instance`` :param path: to the file representing an instance of :py:class:`.types.SubmodelElementAttributes` in XML :param has_iterparse: Module containing ``iterparse`` function. Default is to use :py:mod:`xml.etree.ElementTree` from the standard library. If you have to deal with malicious input, consider using a library such as `defusedxml.ElementTree`_. :raise: :py:class:`DeserializationException` if unexpected input :return: Instance of :py:class:`.types.SubmodelElementAttributes` read from :paramref:`path` """ with open(os.fspath(path), encoding="utf-8") as fid: iterator = has_iterparse.iterparse(fid, ["start", "end"]) return submodel_element_attributes_from_iterparse( _with_elements_cleared_after_yield(iterator) )
[docs]def submodel_element_attributes_from_str( text: str, has_iterparse: HasIterparse = xml.etree.ElementTree ) -> our_types.SubmodelElementAttributes: """ Read an instance of :py:class:`.types.SubmodelElementAttributes` from the :paramref:`text`. Example usage: .. code-block:: import pathlib import aas_core3_2.xmlization as our_xmlization text = "<...>...</...>" instance = our_xmlization.submodel_element_attributes_from_str( text ) # Do something with the ``instance`` :param text: representing an instance of :py:class:`.types.SubmodelElementAttributes` in XML :param has_iterparse: Module containing ``iterparse`` function. Default is to use :py:mod:`xml.etree.ElementTree` from the standard library. If you have to deal with malicious input, consider using a library such as `defusedxml.ElementTree`_. :raise: :py:class:`DeserializationException` if unexpected input :return: Instance of :py:class:`.types.SubmodelElementAttributes` read from :paramref:`text` """ iterator = has_iterparse.iterparse(io.StringIO(text), ["start", "end"]) return submodel_element_attributes_from_iterparse( _with_elements_cleared_after_yield(iterator) )
[docs]def submodel_element_metadata_from_iterparse( iterator: Iterator[Tuple[str, Element]], ) -> our_types.SubmodelElementMetadata: """ Read an instance of :py:class:`.types.SubmodelElementMetadata` from the :paramref:`iterator`. Example usage: .. code-block:: import pathlib import xml.etree.ElementTree as ET import aas_core3_2.xmlization as our_xmlization path = pathlib.Path(...) with path.open("rt") as fid: iterator = ET.iterparse( source=fid, events=['start', 'end'] ) instance = our_xmlization.submodel_element_metadata_from_iterparse( iterator ) # Do something with the ``instance`` :param iterator: Input stream of ``(event, element)`` coming from :py:func:`xml.etree.ElementTree.iterparse` with the argument ``events=["start", "end"]`` :raise: :py:class:`DeserializationException` if unexpected input :return: Instance of :py:class:`.types.SubmodelElementMetadata` read from :paramref:`iterator` """ return _read_instance_from_iterparse( iterator, _read_submodel_element_metadata_as_element, "SubmodelElementMetadata" )
[docs]def submodel_element_metadata_from_stream( stream: TextIO, has_iterparse: HasIterparse = xml.etree.ElementTree ) -> our_types.SubmodelElementMetadata: """ Read an instance of :py:class:`.types.SubmodelElementMetadata` from the :paramref:`stream`. Example usage: .. code-block:: import aas_core3_2.xmlization as our_xmlization with open_some_stream_over_network(...) as stream: instance = our_xmlization.submodel_element_metadata_from_stream( stream ) # Do something with the ``instance`` :param stream: representing an instance of :py:class:`.types.SubmodelElementMetadata` in XML :param has_iterparse: Module containing ``iterparse`` function. Default is to use :py:mod:`xml.etree.ElementTree` from the standard library. If you have to deal with malicious input, consider using a library such as `defusedxml.ElementTree`_. :raise: :py:class:`DeserializationException` if unexpected input :return: Instance of :py:class:`.types.SubmodelElementMetadata` read from :paramref:`stream` """ iterator = has_iterparse.iterparse(stream, ["start", "end"]) return submodel_element_metadata_from_iterparse( _with_elements_cleared_after_yield(iterator) )
[docs]def submodel_element_metadata_from_file( path: PathLike, has_iterparse: HasIterparse = xml.etree.ElementTree ) -> our_types.SubmodelElementMetadata: """ Read an instance of :py:class:`.types.SubmodelElementMetadata` from the :paramref:`path`. Example usage: .. code-block:: import pathlib import aas_core3_2.xmlization as our_xmlization path = pathlib.Path(...) instance = our_xmlization.submodel_element_metadata_from_file( path ) # Do something with the ``instance`` :param path: to the file representing an instance of :py:class:`.types.SubmodelElementMetadata` in XML :param has_iterparse: Module containing ``iterparse`` function. Default is to use :py:mod:`xml.etree.ElementTree` from the standard library. If you have to deal with malicious input, consider using a library such as `defusedxml.ElementTree`_. :raise: :py:class:`DeserializationException` if unexpected input :return: Instance of :py:class:`.types.SubmodelElementMetadata` read from :paramref:`path` """ with open(os.fspath(path), encoding="utf-8") as fid: iterator = has_iterparse.iterparse(fid, ["start", "end"]) return submodel_element_metadata_from_iterparse( _with_elements_cleared_after_yield(iterator) )
[docs]def submodel_element_metadata_from_str( text: str, has_iterparse: HasIterparse = xml.etree.ElementTree ) -> our_types.SubmodelElementMetadata: """ Read an instance of :py:class:`.types.SubmodelElementMetadata` from the :paramref:`text`. Example usage: .. code-block:: import pathlib import aas_core3_2.xmlization as our_xmlization text = "<...>...</...>" instance = our_xmlization.submodel_element_metadata_from_str( text ) # Do something with the ``instance`` :param text: representing an instance of :py:class:`.types.SubmodelElementMetadata` in XML :param has_iterparse: Module containing ``iterparse`` function. Default is to use :py:mod:`xml.etree.ElementTree` from the standard library. If you have to deal with malicious input, consider using a library such as `defusedxml.ElementTree`_. :raise: :py:class:`DeserializationException` if unexpected input :return: Instance of :py:class:`.types.SubmodelElementMetadata` read from :paramref:`text` """ iterator = has_iterparse.iterparse(io.StringIO(text), ["start", "end"]) return submodel_element_metadata_from_iterparse( _with_elements_cleared_after_yield(iterator) )
[docs]def property_metadata_from_iterparse( iterator: Iterator[Tuple[str, Element]], ) -> our_types.PropertyMetadata: """ Read an instance of :py:class:`.types.PropertyMetadata` from the :paramref:`iterator`. Example usage: .. code-block:: import pathlib import xml.etree.ElementTree as ET import aas_core3_2.xmlization as our_xmlization path = pathlib.Path(...) with path.open("rt") as fid: iterator = ET.iterparse( source=fid, events=['start', 'end'] ) instance = our_xmlization.property_metadata_from_iterparse( iterator ) # Do something with the ``instance`` :param iterator: Input stream of ``(event, element)`` coming from :py:func:`xml.etree.ElementTree.iterparse` with the argument ``events=["start", "end"]`` :raise: :py:class:`DeserializationException` if unexpected input :return: Instance of :py:class:`.types.PropertyMetadata` read from :paramref:`iterator` """ return _read_instance_from_iterparse( iterator, _read_property_metadata_as_element, "PropertyMetadata" )
[docs]def property_metadata_from_stream( stream: TextIO, has_iterparse: HasIterparse = xml.etree.ElementTree ) -> our_types.PropertyMetadata: """ Read an instance of :py:class:`.types.PropertyMetadata` from the :paramref:`stream`. Example usage: .. code-block:: import aas_core3_2.xmlization as our_xmlization with open_some_stream_over_network(...) as stream: instance = our_xmlization.property_metadata_from_stream( stream ) # Do something with the ``instance`` :param stream: representing an instance of :py:class:`.types.PropertyMetadata` in XML :param has_iterparse: Module containing ``iterparse`` function. Default is to use :py:mod:`xml.etree.ElementTree` from the standard library. If you have to deal with malicious input, consider using a library such as `defusedxml.ElementTree`_. :raise: :py:class:`DeserializationException` if unexpected input :return: Instance of :py:class:`.types.PropertyMetadata` read from :paramref:`stream` """ iterator = has_iterparse.iterparse(stream, ["start", "end"]) return property_metadata_from_iterparse( _with_elements_cleared_after_yield(iterator) )
[docs]def property_metadata_from_file( path: PathLike, has_iterparse: HasIterparse = xml.etree.ElementTree ) -> our_types.PropertyMetadata: """ Read an instance of :py:class:`.types.PropertyMetadata` from the :paramref:`path`. Example usage: .. code-block:: import pathlib import aas_core3_2.xmlization as our_xmlization path = pathlib.Path(...) instance = our_xmlization.property_metadata_from_file( path ) # Do something with the ``instance`` :param path: to the file representing an instance of :py:class:`.types.PropertyMetadata` in XML :param has_iterparse: Module containing ``iterparse`` function. Default is to use :py:mod:`xml.etree.ElementTree` from the standard library. If you have to deal with malicious input, consider using a library such as `defusedxml.ElementTree`_. :raise: :py:class:`DeserializationException` if unexpected input :return: Instance of :py:class:`.types.PropertyMetadata` read from :paramref:`path` """ with open(os.fspath(path), encoding="utf-8") as fid: iterator = has_iterparse.iterparse(fid, ["start", "end"]) return property_metadata_from_iterparse( _with_elements_cleared_after_yield(iterator) )
[docs]def property_metadata_from_str( text: str, has_iterparse: HasIterparse = xml.etree.ElementTree ) -> our_types.PropertyMetadata: """ Read an instance of :py:class:`.types.PropertyMetadata` from the :paramref:`text`. Example usage: .. code-block:: import pathlib import aas_core3_2.xmlization as our_xmlization text = "<...>...</...>" instance = our_xmlization.property_metadata_from_str( text ) # Do something with the ``instance`` :param text: representing an instance of :py:class:`.types.PropertyMetadata` in XML :param has_iterparse: Module containing ``iterparse`` function. Default is to use :py:mod:`xml.etree.ElementTree` from the standard library. If you have to deal with malicious input, consider using a library such as `defusedxml.ElementTree`_. :raise: :py:class:`DeserializationException` if unexpected input :return: Instance of :py:class:`.types.PropertyMetadata` read from :paramref:`text` """ iterator = has_iterparse.iterparse(io.StringIO(text), ["start", "end"]) return property_metadata_from_iterparse( _with_elements_cleared_after_yield(iterator) )
[docs]def range_metadata_from_iterparse( iterator: Iterator[Tuple[str, Element]], ) -> our_types.RangeMetadata: """ Read an instance of :py:class:`.types.RangeMetadata` from the :paramref:`iterator`. Example usage: .. code-block:: import pathlib import xml.etree.ElementTree as ET import aas_core3_2.xmlization as our_xmlization path = pathlib.Path(...) with path.open("rt") as fid: iterator = ET.iterparse( source=fid, events=['start', 'end'] ) instance = our_xmlization.range_metadata_from_iterparse( iterator ) # Do something with the ``instance`` :param iterator: Input stream of ``(event, element)`` coming from :py:func:`xml.etree.ElementTree.iterparse` with the argument ``events=["start", "end"]`` :raise: :py:class:`DeserializationException` if unexpected input :return: Instance of :py:class:`.types.RangeMetadata` read from :paramref:`iterator` """ return _read_instance_from_iterparse( iterator, _read_range_metadata_as_element, "RangeMetadata" )
[docs]def range_metadata_from_stream( stream: TextIO, has_iterparse: HasIterparse = xml.etree.ElementTree ) -> our_types.RangeMetadata: """ Read an instance of :py:class:`.types.RangeMetadata` from the :paramref:`stream`. Example usage: .. code-block:: import aas_core3_2.xmlization as our_xmlization with open_some_stream_over_network(...) as stream: instance = our_xmlization.range_metadata_from_stream( stream ) # Do something with the ``instance`` :param stream: representing an instance of :py:class:`.types.RangeMetadata` in XML :param has_iterparse: Module containing ``iterparse`` function. Default is to use :py:mod:`xml.etree.ElementTree` from the standard library. If you have to deal with malicious input, consider using a library such as `defusedxml.ElementTree`_. :raise: :py:class:`DeserializationException` if unexpected input :return: Instance of :py:class:`.types.RangeMetadata` read from :paramref:`stream` """ iterator = has_iterparse.iterparse(stream, ["start", "end"]) return range_metadata_from_iterparse(_with_elements_cleared_after_yield(iterator))
[docs]def range_metadata_from_file( path: PathLike, has_iterparse: HasIterparse = xml.etree.ElementTree ) -> our_types.RangeMetadata: """ Read an instance of :py:class:`.types.RangeMetadata` from the :paramref:`path`. Example usage: .. code-block:: import pathlib import aas_core3_2.xmlization as our_xmlization path = pathlib.Path(...) instance = our_xmlization.range_metadata_from_file( path ) # Do something with the ``instance`` :param path: to the file representing an instance of :py:class:`.types.RangeMetadata` in XML :param has_iterparse: Module containing ``iterparse`` function. Default is to use :py:mod:`xml.etree.ElementTree` from the standard library. If you have to deal with malicious input, consider using a library such as `defusedxml.ElementTree`_. :raise: :py:class:`DeserializationException` if unexpected input :return: Instance of :py:class:`.types.RangeMetadata` read from :paramref:`path` """ with open(os.fspath(path), encoding="utf-8") as fid: iterator = has_iterparse.iterparse(fid, ["start", "end"]) return range_metadata_from_iterparse( _with_elements_cleared_after_yield(iterator) )
[docs]def range_metadata_from_str( text: str, has_iterparse: HasIterparse = xml.etree.ElementTree ) -> our_types.RangeMetadata: """ Read an instance of :py:class:`.types.RangeMetadata` from the :paramref:`text`. Example usage: .. code-block:: import pathlib import aas_core3_2.xmlization as our_xmlization text = "<...>...</...>" instance = our_xmlization.range_metadata_from_str( text ) # Do something with the ``instance`` :param text: representing an instance of :py:class:`.types.RangeMetadata` in XML :param has_iterparse: Module containing ``iterparse`` function. Default is to use :py:mod:`xml.etree.ElementTree` from the standard library. If you have to deal with malicious input, consider using a library such as `defusedxml.ElementTree`_. :raise: :py:class:`DeserializationException` if unexpected input :return: Instance of :py:class:`.types.RangeMetadata` read from :paramref:`text` """ iterator = has_iterparse.iterparse(io.StringIO(text), ["start", "end"]) return range_metadata_from_iterparse(_with_elements_cleared_after_yield(iterator))
[docs]def blob_metadata_from_iterparse( iterator: Iterator[Tuple[str, Element]], ) -> our_types.BlobMetadata: """ Read an instance of :py:class:`.types.BlobMetadata` from the :paramref:`iterator`. Example usage: .. code-block:: import pathlib import xml.etree.ElementTree as ET import aas_core3_2.xmlization as our_xmlization path = pathlib.Path(...) with path.open("rt") as fid: iterator = ET.iterparse( source=fid, events=['start', 'end'] ) instance = our_xmlization.blob_metadata_from_iterparse( iterator ) # Do something with the ``instance`` :param iterator: Input stream of ``(event, element)`` coming from :py:func:`xml.etree.ElementTree.iterparse` with the argument ``events=["start", "end"]`` :raise: :py:class:`DeserializationException` if unexpected input :return: Instance of :py:class:`.types.BlobMetadata` read from :paramref:`iterator` """ return _read_instance_from_iterparse( iterator, _read_blob_metadata_as_element, "BlobMetadata" )
[docs]def blob_metadata_from_stream( stream: TextIO, has_iterparse: HasIterparse = xml.etree.ElementTree ) -> our_types.BlobMetadata: """ Read an instance of :py:class:`.types.BlobMetadata` from the :paramref:`stream`. Example usage: .. code-block:: import aas_core3_2.xmlization as our_xmlization with open_some_stream_over_network(...) as stream: instance = our_xmlization.blob_metadata_from_stream( stream ) # Do something with the ``instance`` :param stream: representing an instance of :py:class:`.types.BlobMetadata` in XML :param has_iterparse: Module containing ``iterparse`` function. Default is to use :py:mod:`xml.etree.ElementTree` from the standard library. If you have to deal with malicious input, consider using a library such as `defusedxml.ElementTree`_. :raise: :py:class:`DeserializationException` if unexpected input :return: Instance of :py:class:`.types.BlobMetadata` read from :paramref:`stream` """ iterator = has_iterparse.iterparse(stream, ["start", "end"]) return blob_metadata_from_iterparse(_with_elements_cleared_after_yield(iterator))
[docs]def blob_metadata_from_file( path: PathLike, has_iterparse: HasIterparse = xml.etree.ElementTree ) -> our_types.BlobMetadata: """ Read an instance of :py:class:`.types.BlobMetadata` from the :paramref:`path`. Example usage: .. code-block:: import pathlib import aas_core3_2.xmlization as our_xmlization path = pathlib.Path(...) instance = our_xmlization.blob_metadata_from_file( path ) # Do something with the ``instance`` :param path: to the file representing an instance of :py:class:`.types.BlobMetadata` in XML :param has_iterparse: Module containing ``iterparse`` function. Default is to use :py:mod:`xml.etree.ElementTree` from the standard library. If you have to deal with malicious input, consider using a library such as `defusedxml.ElementTree`_. :raise: :py:class:`DeserializationException` if unexpected input :return: Instance of :py:class:`.types.BlobMetadata` read from :paramref:`path` """ with open(os.fspath(path), encoding="utf-8") as fid: iterator = has_iterparse.iterparse(fid, ["start", "end"]) return blob_metadata_from_iterparse( _with_elements_cleared_after_yield(iterator) )
[docs]def blob_metadata_from_str( text: str, has_iterparse: HasIterparse = xml.etree.ElementTree ) -> our_types.BlobMetadata: """ Read an instance of :py:class:`.types.BlobMetadata` from the :paramref:`text`. Example usage: .. code-block:: import pathlib import aas_core3_2.xmlization as our_xmlization text = "<...>...</...>" instance = our_xmlization.blob_metadata_from_str( text ) # Do something with the ``instance`` :param text: representing an instance of :py:class:`.types.BlobMetadata` in XML :param has_iterparse: Module containing ``iterparse`` function. Default is to use :py:mod:`xml.etree.ElementTree` from the standard library. If you have to deal with malicious input, consider using a library such as `defusedxml.ElementTree`_. :raise: :py:class:`DeserializationException` if unexpected input :return: Instance of :py:class:`.types.BlobMetadata` read from :paramref:`text` """ iterator = has_iterparse.iterparse(io.StringIO(text), ["start", "end"]) return blob_metadata_from_iterparse(_with_elements_cleared_after_yield(iterator))
[docs]def file_metadata_from_iterparse( iterator: Iterator[Tuple[str, Element]], ) -> our_types.FileMetadata: """ Read an instance of :py:class:`.types.FileMetadata` from the :paramref:`iterator`. Example usage: .. code-block:: import pathlib import xml.etree.ElementTree as ET import aas_core3_2.xmlization as our_xmlization path = pathlib.Path(...) with path.open("rt") as fid: iterator = ET.iterparse( source=fid, events=['start', 'end'] ) instance = our_xmlization.file_metadata_from_iterparse( iterator ) # Do something with the ``instance`` :param iterator: Input stream of ``(event, element)`` coming from :py:func:`xml.etree.ElementTree.iterparse` with the argument ``events=["start", "end"]`` :raise: :py:class:`DeserializationException` if unexpected input :return: Instance of :py:class:`.types.FileMetadata` read from :paramref:`iterator` """ return _read_instance_from_iterparse( iterator, _read_file_metadata_as_element, "FileMetadata" )
[docs]def file_metadata_from_stream( stream: TextIO, has_iterparse: HasIterparse = xml.etree.ElementTree ) -> our_types.FileMetadata: """ Read an instance of :py:class:`.types.FileMetadata` from the :paramref:`stream`. Example usage: .. code-block:: import aas_core3_2.xmlization as our_xmlization with open_some_stream_over_network(...) as stream: instance = our_xmlization.file_metadata_from_stream( stream ) # Do something with the ``instance`` :param stream: representing an instance of :py:class:`.types.FileMetadata` in XML :param has_iterparse: Module containing ``iterparse`` function. Default is to use :py:mod:`xml.etree.ElementTree` from the standard library. If you have to deal with malicious input, consider using a library such as `defusedxml.ElementTree`_. :raise: :py:class:`DeserializationException` if unexpected input :return: Instance of :py:class:`.types.FileMetadata` read from :paramref:`stream` """ iterator = has_iterparse.iterparse(stream, ["start", "end"]) return file_metadata_from_iterparse(_with_elements_cleared_after_yield(iterator))
[docs]def file_metadata_from_file( path: PathLike, has_iterparse: HasIterparse = xml.etree.ElementTree ) -> our_types.FileMetadata: """ Read an instance of :py:class:`.types.FileMetadata` from the :paramref:`path`. Example usage: .. code-block:: import pathlib import aas_core3_2.xmlization as our_xmlization path = pathlib.Path(...) instance = our_xmlization.file_metadata_from_file( path ) # Do something with the ``instance`` :param path: to the file representing an instance of :py:class:`.types.FileMetadata` in XML :param has_iterparse: Module containing ``iterparse`` function. Default is to use :py:mod:`xml.etree.ElementTree` from the standard library. If you have to deal with malicious input, consider using a library such as `defusedxml.ElementTree`_. :raise: :py:class:`DeserializationException` if unexpected input :return: Instance of :py:class:`.types.FileMetadata` read from :paramref:`path` """ with open(os.fspath(path), encoding="utf-8") as fid: iterator = has_iterparse.iterparse(fid, ["start", "end"]) return file_metadata_from_iterparse( _with_elements_cleared_after_yield(iterator) )
[docs]def file_metadata_from_str( text: str, has_iterparse: HasIterparse = xml.etree.ElementTree ) -> our_types.FileMetadata: """ Read an instance of :py:class:`.types.FileMetadata` from the :paramref:`text`. Example usage: .. code-block:: import pathlib import aas_core3_2.xmlization as our_xmlization text = "<...>...</...>" instance = our_xmlization.file_metadata_from_str( text ) # Do something with the ``instance`` :param text: representing an instance of :py:class:`.types.FileMetadata` in XML :param has_iterparse: Module containing ``iterparse`` function. Default is to use :py:mod:`xml.etree.ElementTree` from the standard library. If you have to deal with malicious input, consider using a library such as `defusedxml.ElementTree`_. :raise: :py:class:`DeserializationException` if unexpected input :return: Instance of :py:class:`.types.FileMetadata` read from :paramref:`text` """ iterator = has_iterparse.iterparse(io.StringIO(text), ["start", "end"]) return file_metadata_from_iterparse(_with_elements_cleared_after_yield(iterator))
[docs]def multi_language_property_metadata_from_iterparse( iterator: Iterator[Tuple[str, Element]], ) -> our_types.MultiLanguagePropertyMetadata: """ Read an instance of :py:class:`.types.MultiLanguagePropertyMetadata` from the :paramref:`iterator`. Example usage: .. code-block:: import pathlib import xml.etree.ElementTree as ET import aas_core3_2.xmlization as our_xmlization path = pathlib.Path(...) with path.open("rt") as fid: iterator = ET.iterparse( source=fid, events=['start', 'end'] ) instance = our_xmlization.multi_language_property_metadata_from_iterparse( iterator ) # Do something with the ``instance`` :param iterator: Input stream of ``(event, element)`` coming from :py:func:`xml.etree.ElementTree.iterparse` with the argument ``events=["start", "end"]`` :raise: :py:class:`DeserializationException` if unexpected input :return: Instance of :py:class:`.types.MultiLanguagePropertyMetadata` read from :paramref:`iterator` """ return _read_instance_from_iterparse( iterator, _read_multi_language_property_metadata_as_element, "MultiLanguagePropertyMetadata", )
[docs]def multi_language_property_metadata_from_stream( stream: TextIO, has_iterparse: HasIterparse = xml.etree.ElementTree ) -> our_types.MultiLanguagePropertyMetadata: """ Read an instance of :py:class:`.types.MultiLanguagePropertyMetadata` from the :paramref:`stream`. Example usage: .. code-block:: import aas_core3_2.xmlization as our_xmlization with open_some_stream_over_network(...) as stream: instance = our_xmlization.multi_language_property_metadata_from_stream( stream ) # Do something with the ``instance`` :param stream: representing an instance of :py:class:`.types.MultiLanguagePropertyMetadata` in XML :param has_iterparse: Module containing ``iterparse`` function. Default is to use :py:mod:`xml.etree.ElementTree` from the standard library. If you have to deal with malicious input, consider using a library such as `defusedxml.ElementTree`_. :raise: :py:class:`DeserializationException` if unexpected input :return: Instance of :py:class:`.types.MultiLanguagePropertyMetadata` read from :paramref:`stream` """ iterator = has_iterparse.iterparse(stream, ["start", "end"]) return multi_language_property_metadata_from_iterparse( _with_elements_cleared_after_yield(iterator) )
[docs]def multi_language_property_metadata_from_file( path: PathLike, has_iterparse: HasIterparse = xml.etree.ElementTree ) -> our_types.MultiLanguagePropertyMetadata: """ Read an instance of :py:class:`.types.MultiLanguagePropertyMetadata` from the :paramref:`path`. Example usage: .. code-block:: import pathlib import aas_core3_2.xmlization as our_xmlization path = pathlib.Path(...) instance = our_xmlization.multi_language_property_metadata_from_file( path ) # Do something with the ``instance`` :param path: to the file representing an instance of :py:class:`.types.MultiLanguagePropertyMetadata` in XML :param has_iterparse: Module containing ``iterparse`` function. Default is to use :py:mod:`xml.etree.ElementTree` from the standard library. If you have to deal with malicious input, consider using a library such as `defusedxml.ElementTree`_. :raise: :py:class:`DeserializationException` if unexpected input :return: Instance of :py:class:`.types.MultiLanguagePropertyMetadata` read from :paramref:`path` """ with open(os.fspath(path), encoding="utf-8") as fid: iterator = has_iterparse.iterparse(fid, ["start", "end"]) return multi_language_property_metadata_from_iterparse( _with_elements_cleared_after_yield(iterator) )
[docs]def multi_language_property_metadata_from_str( text: str, has_iterparse: HasIterparse = xml.etree.ElementTree ) -> our_types.MultiLanguagePropertyMetadata: """ Read an instance of :py:class:`.types.MultiLanguagePropertyMetadata` from the :paramref:`text`. Example usage: .. code-block:: import pathlib import aas_core3_2.xmlization as our_xmlization text = "<...>...</...>" instance = our_xmlization.multi_language_property_metadata_from_str( text ) # Do something with the ``instance`` :param text: representing an instance of :py:class:`.types.MultiLanguagePropertyMetadata` in XML :param has_iterparse: Module containing ``iterparse`` function. Default is to use :py:mod:`xml.etree.ElementTree` from the standard library. If you have to deal with malicious input, consider using a library such as `defusedxml.ElementTree`_. :raise: :py:class:`DeserializationException` if unexpected input :return: Instance of :py:class:`.types.MultiLanguagePropertyMetadata` read from :paramref:`text` """ iterator = has_iterparse.iterparse(io.StringIO(text), ["start", "end"]) return multi_language_property_metadata_from_iterparse( _with_elements_cleared_after_yield(iterator) )
[docs]def reference_element_metadata_from_iterparse( iterator: Iterator[Tuple[str, Element]], ) -> our_types.ReferenceElementMetadata: """ Read an instance of :py:class:`.types.ReferenceElementMetadata` from the :paramref:`iterator`. Example usage: .. code-block:: import pathlib import xml.etree.ElementTree as ET import aas_core3_2.xmlization as our_xmlization path = pathlib.Path(...) with path.open("rt") as fid: iterator = ET.iterparse( source=fid, events=['start', 'end'] ) instance = our_xmlization.reference_element_metadata_from_iterparse( iterator ) # Do something with the ``instance`` :param iterator: Input stream of ``(event, element)`` coming from :py:func:`xml.etree.ElementTree.iterparse` with the argument ``events=["start", "end"]`` :raise: :py:class:`DeserializationException` if unexpected input :return: Instance of :py:class:`.types.ReferenceElementMetadata` read from :paramref:`iterator` """ return _read_instance_from_iterparse( iterator, _read_reference_element_metadata_as_element, "ReferenceElementMetadata", )
[docs]def reference_element_metadata_from_stream( stream: TextIO, has_iterparse: HasIterparse = xml.etree.ElementTree ) -> our_types.ReferenceElementMetadata: """ Read an instance of :py:class:`.types.ReferenceElementMetadata` from the :paramref:`stream`. Example usage: .. code-block:: import aas_core3_2.xmlization as our_xmlization with open_some_stream_over_network(...) as stream: instance = our_xmlization.reference_element_metadata_from_stream( stream ) # Do something with the ``instance`` :param stream: representing an instance of :py:class:`.types.ReferenceElementMetadata` in XML :param has_iterparse: Module containing ``iterparse`` function. Default is to use :py:mod:`xml.etree.ElementTree` from the standard library. If you have to deal with malicious input, consider using a library such as `defusedxml.ElementTree`_. :raise: :py:class:`DeserializationException` if unexpected input :return: Instance of :py:class:`.types.ReferenceElementMetadata` read from :paramref:`stream` """ iterator = has_iterparse.iterparse(stream, ["start", "end"]) return reference_element_metadata_from_iterparse( _with_elements_cleared_after_yield(iterator) )
[docs]def reference_element_metadata_from_file( path: PathLike, has_iterparse: HasIterparse = xml.etree.ElementTree ) -> our_types.ReferenceElementMetadata: """ Read an instance of :py:class:`.types.ReferenceElementMetadata` from the :paramref:`path`. Example usage: .. code-block:: import pathlib import aas_core3_2.xmlization as our_xmlization path = pathlib.Path(...) instance = our_xmlization.reference_element_metadata_from_file( path ) # Do something with the ``instance`` :param path: to the file representing an instance of :py:class:`.types.ReferenceElementMetadata` in XML :param has_iterparse: Module containing ``iterparse`` function. Default is to use :py:mod:`xml.etree.ElementTree` from the standard library. If you have to deal with malicious input, consider using a library such as `defusedxml.ElementTree`_. :raise: :py:class:`DeserializationException` if unexpected input :return: Instance of :py:class:`.types.ReferenceElementMetadata` read from :paramref:`path` """ with open(os.fspath(path), encoding="utf-8") as fid: iterator = has_iterparse.iterparse(fid, ["start", "end"]) return reference_element_metadata_from_iterparse( _with_elements_cleared_after_yield(iterator) )
[docs]def reference_element_metadata_from_str( text: str, has_iterparse: HasIterparse = xml.etree.ElementTree ) -> our_types.ReferenceElementMetadata: """ Read an instance of :py:class:`.types.ReferenceElementMetadata` from the :paramref:`text`. Example usage: .. code-block:: import pathlib import aas_core3_2.xmlization as our_xmlization text = "<...>...</...>" instance = our_xmlization.reference_element_metadata_from_str( text ) # Do something with the ``instance`` :param text: representing an instance of :py:class:`.types.ReferenceElementMetadata` in XML :param has_iterparse: Module containing ``iterparse`` function. Default is to use :py:mod:`xml.etree.ElementTree` from the standard library. If you have to deal with malicious input, consider using a library such as `defusedxml.ElementTree`_. :raise: :py:class:`DeserializationException` if unexpected input :return: Instance of :py:class:`.types.ReferenceElementMetadata` read from :paramref:`text` """ iterator = has_iterparse.iterparse(io.StringIO(text), ["start", "end"]) return reference_element_metadata_from_iterparse( _with_elements_cleared_after_yield(iterator) )
[docs]def relationship_element_metadata_from_iterparse( iterator: Iterator[Tuple[str, Element]], ) -> our_types.RelationshipElementMetadata: """ Read an instance of :py:class:`.types.RelationshipElementMetadata` from the :paramref:`iterator`. Example usage: .. code-block:: import pathlib import xml.etree.ElementTree as ET import aas_core3_2.xmlization as our_xmlization path = pathlib.Path(...) with path.open("rt") as fid: iterator = ET.iterparse( source=fid, events=['start', 'end'] ) instance = our_xmlization.relationship_element_metadata_from_iterparse( iterator ) # Do something with the ``instance`` :param iterator: Input stream of ``(event, element)`` coming from :py:func:`xml.etree.ElementTree.iterparse` with the argument ``events=["start", "end"]`` :raise: :py:class:`DeserializationException` if unexpected input :return: Instance of :py:class:`.types.RelationshipElementMetadata` read from :paramref:`iterator` """ return _read_instance_from_iterparse( iterator, _read_relationship_element_metadata_as_element, "RelationshipElementMetadata", )
[docs]def relationship_element_metadata_from_stream( stream: TextIO, has_iterparse: HasIterparse = xml.etree.ElementTree ) -> our_types.RelationshipElementMetadata: """ Read an instance of :py:class:`.types.RelationshipElementMetadata` from the :paramref:`stream`. Example usage: .. code-block:: import aas_core3_2.xmlization as our_xmlization with open_some_stream_over_network(...) as stream: instance = our_xmlization.relationship_element_metadata_from_stream( stream ) # Do something with the ``instance`` :param stream: representing an instance of :py:class:`.types.RelationshipElementMetadata` in XML :param has_iterparse: Module containing ``iterparse`` function. Default is to use :py:mod:`xml.etree.ElementTree` from the standard library. If you have to deal with malicious input, consider using a library such as `defusedxml.ElementTree`_. :raise: :py:class:`DeserializationException` if unexpected input :return: Instance of :py:class:`.types.RelationshipElementMetadata` read from :paramref:`stream` """ iterator = has_iterparse.iterparse(stream, ["start", "end"]) return relationship_element_metadata_from_iterparse( _with_elements_cleared_after_yield(iterator) )
[docs]def relationship_element_metadata_from_file( path: PathLike, has_iterparse: HasIterparse = xml.etree.ElementTree ) -> our_types.RelationshipElementMetadata: """ Read an instance of :py:class:`.types.RelationshipElementMetadata` from the :paramref:`path`. Example usage: .. code-block:: import pathlib import aas_core3_2.xmlization as our_xmlization path = pathlib.Path(...) instance = our_xmlization.relationship_element_metadata_from_file( path ) # Do something with the ``instance`` :param path: to the file representing an instance of :py:class:`.types.RelationshipElementMetadata` in XML :param has_iterparse: Module containing ``iterparse`` function. Default is to use :py:mod:`xml.etree.ElementTree` from the standard library. If you have to deal with malicious input, consider using a library such as `defusedxml.ElementTree`_. :raise: :py:class:`DeserializationException` if unexpected input :return: Instance of :py:class:`.types.RelationshipElementMetadata` read from :paramref:`path` """ with open(os.fspath(path), encoding="utf-8") as fid: iterator = has_iterparse.iterparse(fid, ["start", "end"]) return relationship_element_metadata_from_iterparse( _with_elements_cleared_after_yield(iterator) )
[docs]def relationship_element_metadata_from_str( text: str, has_iterparse: HasIterparse = xml.etree.ElementTree ) -> our_types.RelationshipElementMetadata: """ Read an instance of :py:class:`.types.RelationshipElementMetadata` from the :paramref:`text`. Example usage: .. code-block:: import pathlib import aas_core3_2.xmlization as our_xmlization text = "<...>...</...>" instance = our_xmlization.relationship_element_metadata_from_str( text ) # Do something with the ``instance`` :param text: representing an instance of :py:class:`.types.RelationshipElementMetadata` in XML :param has_iterparse: Module containing ``iterparse`` function. Default is to use :py:mod:`xml.etree.ElementTree` from the standard library. If you have to deal with malicious input, consider using a library such as `defusedxml.ElementTree`_. :raise: :py:class:`DeserializationException` if unexpected input :return: Instance of :py:class:`.types.RelationshipElementMetadata` read from :paramref:`text` """ iterator = has_iterparse.iterparse(io.StringIO(text), ["start", "end"]) return relationship_element_metadata_from_iterparse( _with_elements_cleared_after_yield(iterator) )
[docs]def annotated_relationship_element_metadata_from_iterparse( iterator: Iterator[Tuple[str, Element]], ) -> our_types.AnnotatedRelationshipElementMetadata: """ Read an instance of :py:class:`.types.AnnotatedRelationshipElementMetadata` from the :paramref:`iterator`. Example usage: .. code-block:: import pathlib import xml.etree.ElementTree as ET import aas_core3_2.xmlization as our_xmlization path = pathlib.Path(...) with path.open("rt") as fid: iterator = ET.iterparse( source=fid, events=['start', 'end'] ) instance = our_xmlization.annotated_relationship_element_metadata_from_iterparse( iterator ) # Do something with the ``instance`` :param iterator: Input stream of ``(event, element)`` coming from :py:func:`xml.etree.ElementTree.iterparse` with the argument ``events=["start", "end"]`` :raise: :py:class:`DeserializationException` if unexpected input :return: Instance of :py:class:`.types.AnnotatedRelationshipElementMetadata` read from :paramref:`iterator` """ return _read_instance_from_iterparse( iterator, _read_annotated_relationship_element_metadata_as_element, "AnnotatedRelationshipElementMetadata", )
[docs]def annotated_relationship_element_metadata_from_stream( stream: TextIO, has_iterparse: HasIterparse = xml.etree.ElementTree ) -> our_types.AnnotatedRelationshipElementMetadata: """ Read an instance of :py:class:`.types.AnnotatedRelationshipElementMetadata` from the :paramref:`stream`. Example usage: .. code-block:: import aas_core3_2.xmlization as our_xmlization with open_some_stream_over_network(...) as stream: instance = our_xmlization.annotated_relationship_element_metadata_from_stream( stream ) # Do something with the ``instance`` :param stream: representing an instance of :py:class:`.types.AnnotatedRelationshipElementMetadata` in XML :param has_iterparse: Module containing ``iterparse`` function. Default is to use :py:mod:`xml.etree.ElementTree` from the standard library. If you have to deal with malicious input, consider using a library such as `defusedxml.ElementTree`_. :raise: :py:class:`DeserializationException` if unexpected input :return: Instance of :py:class:`.types.AnnotatedRelationshipElementMetadata` read from :paramref:`stream` """ iterator = has_iterparse.iterparse(stream, ["start", "end"]) return annotated_relationship_element_metadata_from_iterparse( _with_elements_cleared_after_yield(iterator) )
[docs]def annotated_relationship_element_metadata_from_file( path: PathLike, has_iterparse: HasIterparse = xml.etree.ElementTree ) -> our_types.AnnotatedRelationshipElementMetadata: """ Read an instance of :py:class:`.types.AnnotatedRelationshipElementMetadata` from the :paramref:`path`. Example usage: .. code-block:: import pathlib import aas_core3_2.xmlization as our_xmlization path = pathlib.Path(...) instance = our_xmlization.annotated_relationship_element_metadata_from_file( path ) # Do something with the ``instance`` :param path: to the file representing an instance of :py:class:`.types.AnnotatedRelationshipElementMetadata` in XML :param has_iterparse: Module containing ``iterparse`` function. Default is to use :py:mod:`xml.etree.ElementTree` from the standard library. If you have to deal with malicious input, consider using a library such as `defusedxml.ElementTree`_. :raise: :py:class:`DeserializationException` if unexpected input :return: Instance of :py:class:`.types.AnnotatedRelationshipElementMetadata` read from :paramref:`path` """ with open(os.fspath(path), encoding="utf-8") as fid: iterator = has_iterparse.iterparse(fid, ["start", "end"]) return annotated_relationship_element_metadata_from_iterparse( _with_elements_cleared_after_yield(iterator) )
[docs]def annotated_relationship_element_metadata_from_str( text: str, has_iterparse: HasIterparse = xml.etree.ElementTree ) -> our_types.AnnotatedRelationshipElementMetadata: """ Read an instance of :py:class:`.types.AnnotatedRelationshipElementMetadata` from the :paramref:`text`. Example usage: .. code-block:: import pathlib import aas_core3_2.xmlization as our_xmlization text = "<...>...</...>" instance = our_xmlization.annotated_relationship_element_metadata_from_str( text ) # Do something with the ``instance`` :param text: representing an instance of :py:class:`.types.AnnotatedRelationshipElementMetadata` in XML :param has_iterparse: Module containing ``iterparse`` function. Default is to use :py:mod:`xml.etree.ElementTree` from the standard library. If you have to deal with malicious input, consider using a library such as `defusedxml.ElementTree`_. :raise: :py:class:`DeserializationException` if unexpected input :return: Instance of :py:class:`.types.AnnotatedRelationshipElementMetadata` read from :paramref:`text` """ iterator = has_iterparse.iterparse(io.StringIO(text), ["start", "end"]) return annotated_relationship_element_metadata_from_iterparse( _with_elements_cleared_after_yield(iterator) )
[docs]def entity_metadata_from_iterparse( iterator: Iterator[Tuple[str, Element]], ) -> our_types.EntityMetadata: """ Read an instance of :py:class:`.types.EntityMetadata` from the :paramref:`iterator`. Example usage: .. code-block:: import pathlib import xml.etree.ElementTree as ET import aas_core3_2.xmlization as our_xmlization path = pathlib.Path(...) with path.open("rt") as fid: iterator = ET.iterparse( source=fid, events=['start', 'end'] ) instance = our_xmlization.entity_metadata_from_iterparse( iterator ) # Do something with the ``instance`` :param iterator: Input stream of ``(event, element)`` coming from :py:func:`xml.etree.ElementTree.iterparse` with the argument ``events=["start", "end"]`` :raise: :py:class:`DeserializationException` if unexpected input :return: Instance of :py:class:`.types.EntityMetadata` read from :paramref:`iterator` """ return _read_instance_from_iterparse( iterator, _read_entity_metadata_as_element, "EntityMetadata" )
[docs]def entity_metadata_from_stream( stream: TextIO, has_iterparse: HasIterparse = xml.etree.ElementTree ) -> our_types.EntityMetadata: """ Read an instance of :py:class:`.types.EntityMetadata` from the :paramref:`stream`. Example usage: .. code-block:: import aas_core3_2.xmlization as our_xmlization with open_some_stream_over_network(...) as stream: instance = our_xmlization.entity_metadata_from_stream( stream ) # Do something with the ``instance`` :param stream: representing an instance of :py:class:`.types.EntityMetadata` in XML :param has_iterparse: Module containing ``iterparse`` function. Default is to use :py:mod:`xml.etree.ElementTree` from the standard library. If you have to deal with malicious input, consider using a library such as `defusedxml.ElementTree`_. :raise: :py:class:`DeserializationException` if unexpected input :return: Instance of :py:class:`.types.EntityMetadata` read from :paramref:`stream` """ iterator = has_iterparse.iterparse(stream, ["start", "end"]) return entity_metadata_from_iterparse(_with_elements_cleared_after_yield(iterator))
[docs]def entity_metadata_from_file( path: PathLike, has_iterparse: HasIterparse = xml.etree.ElementTree ) -> our_types.EntityMetadata: """ Read an instance of :py:class:`.types.EntityMetadata` from the :paramref:`path`. Example usage: .. code-block:: import pathlib import aas_core3_2.xmlization as our_xmlization path = pathlib.Path(...) instance = our_xmlization.entity_metadata_from_file( path ) # Do something with the ``instance`` :param path: to the file representing an instance of :py:class:`.types.EntityMetadata` in XML :param has_iterparse: Module containing ``iterparse`` function. Default is to use :py:mod:`xml.etree.ElementTree` from the standard library. If you have to deal with malicious input, consider using a library such as `defusedxml.ElementTree`_. :raise: :py:class:`DeserializationException` if unexpected input :return: Instance of :py:class:`.types.EntityMetadata` read from :paramref:`path` """ with open(os.fspath(path), encoding="utf-8") as fid: iterator = has_iterparse.iterparse(fid, ["start", "end"]) return entity_metadata_from_iterparse( _with_elements_cleared_after_yield(iterator) )
[docs]def entity_metadata_from_str( text: str, has_iterparse: HasIterparse = xml.etree.ElementTree ) -> our_types.EntityMetadata: """ Read an instance of :py:class:`.types.EntityMetadata` from the :paramref:`text`. Example usage: .. code-block:: import pathlib import aas_core3_2.xmlization as our_xmlization text = "<...>...</...>" instance = our_xmlization.entity_metadata_from_str( text ) # Do something with the ``instance`` :param text: representing an instance of :py:class:`.types.EntityMetadata` in XML :param has_iterparse: Module containing ``iterparse`` function. Default is to use :py:mod:`xml.etree.ElementTree` from the standard library. If you have to deal with malicious input, consider using a library such as `defusedxml.ElementTree`_. :raise: :py:class:`DeserializationException` if unexpected input :return: Instance of :py:class:`.types.EntityMetadata` read from :paramref:`text` """ iterator = has_iterparse.iterparse(io.StringIO(text), ["start", "end"]) return entity_metadata_from_iterparse(_with_elements_cleared_after_yield(iterator))
[docs]def capability_metadata_from_iterparse( iterator: Iterator[Tuple[str, Element]], ) -> our_types.CapabilityMetadata: """ Read an instance of :py:class:`.types.CapabilityMetadata` from the :paramref:`iterator`. Example usage: .. code-block:: import pathlib import xml.etree.ElementTree as ET import aas_core3_2.xmlization as our_xmlization path = pathlib.Path(...) with path.open("rt") as fid: iterator = ET.iterparse( source=fid, events=['start', 'end'] ) instance = our_xmlization.capability_metadata_from_iterparse( iterator ) # Do something with the ``instance`` :param iterator: Input stream of ``(event, element)`` coming from :py:func:`xml.etree.ElementTree.iterparse` with the argument ``events=["start", "end"]`` :raise: :py:class:`DeserializationException` if unexpected input :return: Instance of :py:class:`.types.CapabilityMetadata` read from :paramref:`iterator` """ return _read_instance_from_iterparse( iterator, _read_capability_metadata_as_element, "CapabilityMetadata" )
[docs]def capability_metadata_from_stream( stream: TextIO, has_iterparse: HasIterparse = xml.etree.ElementTree ) -> our_types.CapabilityMetadata: """ Read an instance of :py:class:`.types.CapabilityMetadata` from the :paramref:`stream`. Example usage: .. code-block:: import aas_core3_2.xmlization as our_xmlization with open_some_stream_over_network(...) as stream: instance = our_xmlization.capability_metadata_from_stream( stream ) # Do something with the ``instance`` :param stream: representing an instance of :py:class:`.types.CapabilityMetadata` in XML :param has_iterparse: Module containing ``iterparse`` function. Default is to use :py:mod:`xml.etree.ElementTree` from the standard library. If you have to deal with malicious input, consider using a library such as `defusedxml.ElementTree`_. :raise: :py:class:`DeserializationException` if unexpected input :return: Instance of :py:class:`.types.CapabilityMetadata` read from :paramref:`stream` """ iterator = has_iterparse.iterparse(stream, ["start", "end"]) return capability_metadata_from_iterparse( _with_elements_cleared_after_yield(iterator) )
[docs]def capability_metadata_from_file( path: PathLike, has_iterparse: HasIterparse = xml.etree.ElementTree ) -> our_types.CapabilityMetadata: """ Read an instance of :py:class:`.types.CapabilityMetadata` from the :paramref:`path`. Example usage: .. code-block:: import pathlib import aas_core3_2.xmlization as our_xmlization path = pathlib.Path(...) instance = our_xmlization.capability_metadata_from_file( path ) # Do something with the ``instance`` :param path: to the file representing an instance of :py:class:`.types.CapabilityMetadata` in XML :param has_iterparse: Module containing ``iterparse`` function. Default is to use :py:mod:`xml.etree.ElementTree` from the standard library. If you have to deal with malicious input, consider using a library such as `defusedxml.ElementTree`_. :raise: :py:class:`DeserializationException` if unexpected input :return: Instance of :py:class:`.types.CapabilityMetadata` read from :paramref:`path` """ with open(os.fspath(path), encoding="utf-8") as fid: iterator = has_iterparse.iterparse(fid, ["start", "end"]) return capability_metadata_from_iterparse( _with_elements_cleared_after_yield(iterator) )
[docs]def capability_metadata_from_str( text: str, has_iterparse: HasIterparse = xml.etree.ElementTree ) -> our_types.CapabilityMetadata: """ Read an instance of :py:class:`.types.CapabilityMetadata` from the :paramref:`text`. Example usage: .. code-block:: import pathlib import aas_core3_2.xmlization as our_xmlization text = "<...>...</...>" instance = our_xmlization.capability_metadata_from_str( text ) # Do something with the ``instance`` :param text: representing an instance of :py:class:`.types.CapabilityMetadata` in XML :param has_iterparse: Module containing ``iterparse`` function. Default is to use :py:mod:`xml.etree.ElementTree` from the standard library. If you have to deal with malicious input, consider using a library such as `defusedxml.ElementTree`_. :raise: :py:class:`DeserializationException` if unexpected input :return: Instance of :py:class:`.types.CapabilityMetadata` read from :paramref:`text` """ iterator = has_iterparse.iterparse(io.StringIO(text), ["start", "end"]) return capability_metadata_from_iterparse( _with_elements_cleared_after_yield(iterator) )
[docs]def operation_metadata_from_iterparse( iterator: Iterator[Tuple[str, Element]], ) -> our_types.OperationMetadata: """ Read an instance of :py:class:`.types.OperationMetadata` from the :paramref:`iterator`. Example usage: .. code-block:: import pathlib import xml.etree.ElementTree as ET import aas_core3_2.xmlization as our_xmlization path = pathlib.Path(...) with path.open("rt") as fid: iterator = ET.iterparse( source=fid, events=['start', 'end'] ) instance = our_xmlization.operation_metadata_from_iterparse( iterator ) # Do something with the ``instance`` :param iterator: Input stream of ``(event, element)`` coming from :py:func:`xml.etree.ElementTree.iterparse` with the argument ``events=["start", "end"]`` :raise: :py:class:`DeserializationException` if unexpected input :return: Instance of :py:class:`.types.OperationMetadata` read from :paramref:`iterator` """ return _read_instance_from_iterparse( iterator, _read_operation_metadata_as_element, "OperationMetadata" )
[docs]def operation_metadata_from_stream( stream: TextIO, has_iterparse: HasIterparse = xml.etree.ElementTree ) -> our_types.OperationMetadata: """ Read an instance of :py:class:`.types.OperationMetadata` from the :paramref:`stream`. Example usage: .. code-block:: import aas_core3_2.xmlization as our_xmlization with open_some_stream_over_network(...) as stream: instance = our_xmlization.operation_metadata_from_stream( stream ) # Do something with the ``instance`` :param stream: representing an instance of :py:class:`.types.OperationMetadata` in XML :param has_iterparse: Module containing ``iterparse`` function. Default is to use :py:mod:`xml.etree.ElementTree` from the standard library. If you have to deal with malicious input, consider using a library such as `defusedxml.ElementTree`_. :raise: :py:class:`DeserializationException` if unexpected input :return: Instance of :py:class:`.types.OperationMetadata` read from :paramref:`stream` """ iterator = has_iterparse.iterparse(stream, ["start", "end"]) return operation_metadata_from_iterparse( _with_elements_cleared_after_yield(iterator) )
[docs]def operation_metadata_from_file( path: PathLike, has_iterparse: HasIterparse = xml.etree.ElementTree ) -> our_types.OperationMetadata: """ Read an instance of :py:class:`.types.OperationMetadata` from the :paramref:`path`. Example usage: .. code-block:: import pathlib import aas_core3_2.xmlization as our_xmlization path = pathlib.Path(...) instance = our_xmlization.operation_metadata_from_file( path ) # Do something with the ``instance`` :param path: to the file representing an instance of :py:class:`.types.OperationMetadata` in XML :param has_iterparse: Module containing ``iterparse`` function. Default is to use :py:mod:`xml.etree.ElementTree` from the standard library. If you have to deal with malicious input, consider using a library such as `defusedxml.ElementTree`_. :raise: :py:class:`DeserializationException` if unexpected input :return: Instance of :py:class:`.types.OperationMetadata` read from :paramref:`path` """ with open(os.fspath(path), encoding="utf-8") as fid: iterator = has_iterparse.iterparse(fid, ["start", "end"]) return operation_metadata_from_iterparse( _with_elements_cleared_after_yield(iterator) )
[docs]def operation_metadata_from_str( text: str, has_iterparse: HasIterparse = xml.etree.ElementTree ) -> our_types.OperationMetadata: """ Read an instance of :py:class:`.types.OperationMetadata` from the :paramref:`text`. Example usage: .. code-block:: import pathlib import aas_core3_2.xmlization as our_xmlization text = "<...>...</...>" instance = our_xmlization.operation_metadata_from_str( text ) # Do something with the ``instance`` :param text: representing an instance of :py:class:`.types.OperationMetadata` in XML :param has_iterparse: Module containing ``iterparse`` function. Default is to use :py:mod:`xml.etree.ElementTree` from the standard library. If you have to deal with malicious input, consider using a library such as `defusedxml.ElementTree`_. :raise: :py:class:`DeserializationException` if unexpected input :return: Instance of :py:class:`.types.OperationMetadata` read from :paramref:`text` """ iterator = has_iterparse.iterparse(io.StringIO(text), ["start", "end"]) return operation_metadata_from_iterparse( _with_elements_cleared_after_yield(iterator) )
[docs]def submodel_element_collection_metadata_from_iterparse( iterator: Iterator[Tuple[str, Element]], ) -> our_types.SubmodelElementCollectionMetadata: """ Read an instance of :py:class:`.types.SubmodelElementCollectionMetadata` from the :paramref:`iterator`. Example usage: .. code-block:: import pathlib import xml.etree.ElementTree as ET import aas_core3_2.xmlization as our_xmlization path = pathlib.Path(...) with path.open("rt") as fid: iterator = ET.iterparse( source=fid, events=['start', 'end'] ) instance = our_xmlization.submodel_element_collection_metadata_from_iterparse( iterator ) # Do something with the ``instance`` :param iterator: Input stream of ``(event, element)`` coming from :py:func:`xml.etree.ElementTree.iterparse` with the argument ``events=["start", "end"]`` :raise: :py:class:`DeserializationException` if unexpected input :return: Instance of :py:class:`.types.SubmodelElementCollectionMetadata` read from :paramref:`iterator` """ return _read_instance_from_iterparse( iterator, _read_submodel_element_collection_metadata_as_element, "SubmodelElementCollectionMetadata", )
[docs]def submodel_element_collection_metadata_from_stream( stream: TextIO, has_iterparse: HasIterparse = xml.etree.ElementTree ) -> our_types.SubmodelElementCollectionMetadata: """ Read an instance of :py:class:`.types.SubmodelElementCollectionMetadata` from the :paramref:`stream`. Example usage: .. code-block:: import aas_core3_2.xmlization as our_xmlization with open_some_stream_over_network(...) as stream: instance = our_xmlization.submodel_element_collection_metadata_from_stream( stream ) # Do something with the ``instance`` :param stream: representing an instance of :py:class:`.types.SubmodelElementCollectionMetadata` in XML :param has_iterparse: Module containing ``iterparse`` function. Default is to use :py:mod:`xml.etree.ElementTree` from the standard library. If you have to deal with malicious input, consider using a library such as `defusedxml.ElementTree`_. :raise: :py:class:`DeserializationException` if unexpected input :return: Instance of :py:class:`.types.SubmodelElementCollectionMetadata` read from :paramref:`stream` """ iterator = has_iterparse.iterparse(stream, ["start", "end"]) return submodel_element_collection_metadata_from_iterparse( _with_elements_cleared_after_yield(iterator) )
[docs]def submodel_element_collection_metadata_from_file( path: PathLike, has_iterparse: HasIterparse = xml.etree.ElementTree ) -> our_types.SubmodelElementCollectionMetadata: """ Read an instance of :py:class:`.types.SubmodelElementCollectionMetadata` from the :paramref:`path`. Example usage: .. code-block:: import pathlib import aas_core3_2.xmlization as our_xmlization path = pathlib.Path(...) instance = our_xmlization.submodel_element_collection_metadata_from_file( path ) # Do something with the ``instance`` :param path: to the file representing an instance of :py:class:`.types.SubmodelElementCollectionMetadata` in XML :param has_iterparse: Module containing ``iterparse`` function. Default is to use :py:mod:`xml.etree.ElementTree` from the standard library. If you have to deal with malicious input, consider using a library such as `defusedxml.ElementTree`_. :raise: :py:class:`DeserializationException` if unexpected input :return: Instance of :py:class:`.types.SubmodelElementCollectionMetadata` read from :paramref:`path` """ with open(os.fspath(path), encoding="utf-8") as fid: iterator = has_iterparse.iterparse(fid, ["start", "end"]) return submodel_element_collection_metadata_from_iterparse( _with_elements_cleared_after_yield(iterator) )
[docs]def submodel_element_collection_metadata_from_str( text: str, has_iterparse: HasIterparse = xml.etree.ElementTree ) -> our_types.SubmodelElementCollectionMetadata: """ Read an instance of :py:class:`.types.SubmodelElementCollectionMetadata` from the :paramref:`text`. Example usage: .. code-block:: import pathlib import aas_core3_2.xmlization as our_xmlization text = "<...>...</...>" instance = our_xmlization.submodel_element_collection_metadata_from_str( text ) # Do something with the ``instance`` :param text: representing an instance of :py:class:`.types.SubmodelElementCollectionMetadata` in XML :param has_iterparse: Module containing ``iterparse`` function. Default is to use :py:mod:`xml.etree.ElementTree` from the standard library. If you have to deal with malicious input, consider using a library such as `defusedxml.ElementTree`_. :raise: :py:class:`DeserializationException` if unexpected input :return: Instance of :py:class:`.types.SubmodelElementCollectionMetadata` read from :paramref:`text` """ iterator = has_iterparse.iterparse(io.StringIO(text), ["start", "end"]) return submodel_element_collection_metadata_from_iterparse( _with_elements_cleared_after_yield(iterator) )
[docs]def basic_event_element_metadata_from_iterparse( iterator: Iterator[Tuple[str, Element]], ) -> our_types.BasicEventElementMetadata: """ Read an instance of :py:class:`.types.BasicEventElementMetadata` from the :paramref:`iterator`. Example usage: .. code-block:: import pathlib import xml.etree.ElementTree as ET import aas_core3_2.xmlization as our_xmlization path = pathlib.Path(...) with path.open("rt") as fid: iterator = ET.iterparse( source=fid, events=['start', 'end'] ) instance = our_xmlization.basic_event_element_metadata_from_iterparse( iterator ) # Do something with the ``instance`` :param iterator: Input stream of ``(event, element)`` coming from :py:func:`xml.etree.ElementTree.iterparse` with the argument ``events=["start", "end"]`` :raise: :py:class:`DeserializationException` if unexpected input :return: Instance of :py:class:`.types.BasicEventElementMetadata` read from :paramref:`iterator` """ return _read_instance_from_iterparse( iterator, _read_basic_event_element_metadata_as_element, "BasicEventElementMetadata", )
[docs]def basic_event_element_metadata_from_stream( stream: TextIO, has_iterparse: HasIterparse = xml.etree.ElementTree ) -> our_types.BasicEventElementMetadata: """ Read an instance of :py:class:`.types.BasicEventElementMetadata` from the :paramref:`stream`. Example usage: .. code-block:: import aas_core3_2.xmlization as our_xmlization with open_some_stream_over_network(...) as stream: instance = our_xmlization.basic_event_element_metadata_from_stream( stream ) # Do something with the ``instance`` :param stream: representing an instance of :py:class:`.types.BasicEventElementMetadata` in XML :param has_iterparse: Module containing ``iterparse`` function. Default is to use :py:mod:`xml.etree.ElementTree` from the standard library. If you have to deal with malicious input, consider using a library such as `defusedxml.ElementTree`_. :raise: :py:class:`DeserializationException` if unexpected input :return: Instance of :py:class:`.types.BasicEventElementMetadata` read from :paramref:`stream` """ iterator = has_iterparse.iterparse(stream, ["start", "end"]) return basic_event_element_metadata_from_iterparse( _with_elements_cleared_after_yield(iterator) )
[docs]def basic_event_element_metadata_from_file( path: PathLike, has_iterparse: HasIterparse = xml.etree.ElementTree ) -> our_types.BasicEventElementMetadata: """ Read an instance of :py:class:`.types.BasicEventElementMetadata` from the :paramref:`path`. Example usage: .. code-block:: import pathlib import aas_core3_2.xmlization as our_xmlization path = pathlib.Path(...) instance = our_xmlization.basic_event_element_metadata_from_file( path ) # Do something with the ``instance`` :param path: to the file representing an instance of :py:class:`.types.BasicEventElementMetadata` in XML :param has_iterparse: Module containing ``iterparse`` function. Default is to use :py:mod:`xml.etree.ElementTree` from the standard library. If you have to deal with malicious input, consider using a library such as `defusedxml.ElementTree`_. :raise: :py:class:`DeserializationException` if unexpected input :return: Instance of :py:class:`.types.BasicEventElementMetadata` read from :paramref:`path` """ with open(os.fspath(path), encoding="utf-8") as fid: iterator = has_iterparse.iterparse(fid, ["start", "end"]) return basic_event_element_metadata_from_iterparse( _with_elements_cleared_after_yield(iterator) )
[docs]def basic_event_element_metadata_from_str( text: str, has_iterparse: HasIterparse = xml.etree.ElementTree ) -> our_types.BasicEventElementMetadata: """ Read an instance of :py:class:`.types.BasicEventElementMetadata` from the :paramref:`text`. Example usage: .. code-block:: import pathlib import aas_core3_2.xmlization as our_xmlization text = "<...>...</...>" instance = our_xmlization.basic_event_element_metadata_from_str( text ) # Do something with the ``instance`` :param text: representing an instance of :py:class:`.types.BasicEventElementMetadata` in XML :param has_iterparse: Module containing ``iterparse`` function. Default is to use :py:mod:`xml.etree.ElementTree` from the standard library. If you have to deal with malicious input, consider using a library such as `defusedxml.ElementTree`_. :raise: :py:class:`DeserializationException` if unexpected input :return: Instance of :py:class:`.types.BasicEventElementMetadata` read from :paramref:`text` """ iterator = has_iterparse.iterparse(io.StringIO(text), ["start", "end"]) return basic_event_element_metadata_from_iterparse( _with_elements_cleared_after_yield(iterator) )
[docs]def submodel_element_list_metadata_from_iterparse( iterator: Iterator[Tuple[str, Element]], ) -> our_types.SubmodelElementListMetadata: """ Read an instance of :py:class:`.types.SubmodelElementListMetadata` from the :paramref:`iterator`. Example usage: .. code-block:: import pathlib import xml.etree.ElementTree as ET import aas_core3_2.xmlization as our_xmlization path = pathlib.Path(...) with path.open("rt") as fid: iterator = ET.iterparse( source=fid, events=['start', 'end'] ) instance = our_xmlization.submodel_element_list_metadata_from_iterparse( iterator ) # Do something with the ``instance`` :param iterator: Input stream of ``(event, element)`` coming from :py:func:`xml.etree.ElementTree.iterparse` with the argument ``events=["start", "end"]`` :raise: :py:class:`DeserializationException` if unexpected input :return: Instance of :py:class:`.types.SubmodelElementListMetadata` read from :paramref:`iterator` """ return _read_instance_from_iterparse( iterator, _read_submodel_element_list_metadata_as_element, "SubmodelElementListMetadata", )
[docs]def submodel_element_list_metadata_from_stream( stream: TextIO, has_iterparse: HasIterparse = xml.etree.ElementTree ) -> our_types.SubmodelElementListMetadata: """ Read an instance of :py:class:`.types.SubmodelElementListMetadata` from the :paramref:`stream`. Example usage: .. code-block:: import aas_core3_2.xmlization as our_xmlization with open_some_stream_over_network(...) as stream: instance = our_xmlization.submodel_element_list_metadata_from_stream( stream ) # Do something with the ``instance`` :param stream: representing an instance of :py:class:`.types.SubmodelElementListMetadata` in XML :param has_iterparse: Module containing ``iterparse`` function. Default is to use :py:mod:`xml.etree.ElementTree` from the standard library. If you have to deal with malicious input, consider using a library such as `defusedxml.ElementTree`_. :raise: :py:class:`DeserializationException` if unexpected input :return: Instance of :py:class:`.types.SubmodelElementListMetadata` read from :paramref:`stream` """ iterator = has_iterparse.iterparse(stream, ["start", "end"]) return submodel_element_list_metadata_from_iterparse( _with_elements_cleared_after_yield(iterator) )
[docs]def submodel_element_list_metadata_from_file( path: PathLike, has_iterparse: HasIterparse = xml.etree.ElementTree ) -> our_types.SubmodelElementListMetadata: """ Read an instance of :py:class:`.types.SubmodelElementListMetadata` from the :paramref:`path`. Example usage: .. code-block:: import pathlib import aas_core3_2.xmlization as our_xmlization path = pathlib.Path(...) instance = our_xmlization.submodel_element_list_metadata_from_file( path ) # Do something with the ``instance`` :param path: to the file representing an instance of :py:class:`.types.SubmodelElementListMetadata` in XML :param has_iterparse: Module containing ``iterparse`` function. Default is to use :py:mod:`xml.etree.ElementTree` from the standard library. If you have to deal with malicious input, consider using a library such as `defusedxml.ElementTree`_. :raise: :py:class:`DeserializationException` if unexpected input :return: Instance of :py:class:`.types.SubmodelElementListMetadata` read from :paramref:`path` """ with open(os.fspath(path), encoding="utf-8") as fid: iterator = has_iterparse.iterparse(fid, ["start", "end"]) return submodel_element_list_metadata_from_iterparse( _with_elements_cleared_after_yield(iterator) )
[docs]def submodel_element_list_metadata_from_str( text: str, has_iterparse: HasIterparse = xml.etree.ElementTree ) -> our_types.SubmodelElementListMetadata: """ Read an instance of :py:class:`.types.SubmodelElementListMetadata` from the :paramref:`text`. Example usage: .. code-block:: import pathlib import aas_core3_2.xmlization as our_xmlization text = "<...>...</...>" instance = our_xmlization.submodel_element_list_metadata_from_str( text ) # Do something with the ``instance`` :param text: representing an instance of :py:class:`.types.SubmodelElementListMetadata` in XML :param has_iterparse: Module containing ``iterparse`` function. Default is to use :py:mod:`xml.etree.ElementTree` from the standard library. If you have to deal with malicious input, consider using a library such as `defusedxml.ElementTree`_. :raise: :py:class:`DeserializationException` if unexpected input :return: Instance of :py:class:`.types.SubmodelElementListMetadata` read from :paramref:`text` """ iterator = has_iterparse.iterparse(io.StringIO(text), ["start", "end"]) return submodel_element_list_metadata_from_iterparse( _with_elements_cleared_after_yield(iterator) )
[docs]def submodel_metadata_from_iterparse( iterator: Iterator[Tuple[str, Element]], ) -> our_types.SubmodelMetadata: """ Read an instance of :py:class:`.types.SubmodelMetadata` from the :paramref:`iterator`. Example usage: .. code-block:: import pathlib import xml.etree.ElementTree as ET import aas_core3_2.xmlization as our_xmlization path = pathlib.Path(...) with path.open("rt") as fid: iterator = ET.iterparse( source=fid, events=['start', 'end'] ) instance = our_xmlization.submodel_metadata_from_iterparse( iterator ) # Do something with the ``instance`` :param iterator: Input stream of ``(event, element)`` coming from :py:func:`xml.etree.ElementTree.iterparse` with the argument ``events=["start", "end"]`` :raise: :py:class:`DeserializationException` if unexpected input :return: Instance of :py:class:`.types.SubmodelMetadata` read from :paramref:`iterator` """ return _read_instance_from_iterparse( iterator, _read_submodel_metadata_as_element, "SubmodelMetadata" )
[docs]def submodel_metadata_from_stream( stream: TextIO, has_iterparse: HasIterparse = xml.etree.ElementTree ) -> our_types.SubmodelMetadata: """ Read an instance of :py:class:`.types.SubmodelMetadata` from the :paramref:`stream`. Example usage: .. code-block:: import aas_core3_2.xmlization as our_xmlization with open_some_stream_over_network(...) as stream: instance = our_xmlization.submodel_metadata_from_stream( stream ) # Do something with the ``instance`` :param stream: representing an instance of :py:class:`.types.SubmodelMetadata` in XML :param has_iterparse: Module containing ``iterparse`` function. Default is to use :py:mod:`xml.etree.ElementTree` from the standard library. If you have to deal with malicious input, consider using a library such as `defusedxml.ElementTree`_. :raise: :py:class:`DeserializationException` if unexpected input :return: Instance of :py:class:`.types.SubmodelMetadata` read from :paramref:`stream` """ iterator = has_iterparse.iterparse(stream, ["start", "end"]) return submodel_metadata_from_iterparse( _with_elements_cleared_after_yield(iterator) )
[docs]def submodel_metadata_from_file( path: PathLike, has_iterparse: HasIterparse = xml.etree.ElementTree ) -> our_types.SubmodelMetadata: """ Read an instance of :py:class:`.types.SubmodelMetadata` from the :paramref:`path`. Example usage: .. code-block:: import pathlib import aas_core3_2.xmlization as our_xmlization path = pathlib.Path(...) instance = our_xmlization.submodel_metadata_from_file( path ) # Do something with the ``instance`` :param path: to the file representing an instance of :py:class:`.types.SubmodelMetadata` in XML :param has_iterparse: Module containing ``iterparse`` function. Default is to use :py:mod:`xml.etree.ElementTree` from the standard library. If you have to deal with malicious input, consider using a library such as `defusedxml.ElementTree`_. :raise: :py:class:`DeserializationException` if unexpected input :return: Instance of :py:class:`.types.SubmodelMetadata` read from :paramref:`path` """ with open(os.fspath(path), encoding="utf-8") as fid: iterator = has_iterparse.iterparse(fid, ["start", "end"]) return submodel_metadata_from_iterparse( _with_elements_cleared_after_yield(iterator) )
[docs]def submodel_metadata_from_str( text: str, has_iterparse: HasIterparse = xml.etree.ElementTree ) -> our_types.SubmodelMetadata: """ Read an instance of :py:class:`.types.SubmodelMetadata` from the :paramref:`text`. Example usage: .. code-block:: import pathlib import aas_core3_2.xmlization as our_xmlization text = "<...>...</...>" instance = our_xmlization.submodel_metadata_from_str( text ) # Do something with the ``instance`` :param text: representing an instance of :py:class:`.types.SubmodelMetadata` in XML :param has_iterparse: Module containing ``iterparse`` function. Default is to use :py:mod:`xml.etree.ElementTree` from the standard library. If you have to deal with malicious input, consider using a library such as `defusedxml.ElementTree`_. :raise: :py:class:`DeserializationException` if unexpected input :return: Instance of :py:class:`.types.SubmodelMetadata` read from :paramref:`text` """ iterator = has_iterparse.iterparse(io.StringIO(text), ["start", "end"]) return submodel_metadata_from_iterparse( _with_elements_cleared_after_yield(iterator) )
[docs]def asset_administration_shell_metadata_from_iterparse( iterator: Iterator[Tuple[str, Element]], ) -> our_types.AssetAdministrationShellMetadata: """ Read an instance of :py:class:`.types.AssetAdministrationShellMetadata` from the :paramref:`iterator`. Example usage: .. code-block:: import pathlib import xml.etree.ElementTree as ET import aas_core3_2.xmlization as our_xmlization path = pathlib.Path(...) with path.open("rt") as fid: iterator = ET.iterparse( source=fid, events=['start', 'end'] ) instance = our_xmlization.asset_administration_shell_metadata_from_iterparse( iterator ) # Do something with the ``instance`` :param iterator: Input stream of ``(event, element)`` coming from :py:func:`xml.etree.ElementTree.iterparse` with the argument ``events=["start", "end"]`` :raise: :py:class:`DeserializationException` if unexpected input :return: Instance of :py:class:`.types.AssetAdministrationShellMetadata` read from :paramref:`iterator` """ return _read_instance_from_iterparse( iterator, _read_asset_administration_shell_metadata_as_element, "AssetAdministrationShellMetadata", )
[docs]def asset_administration_shell_metadata_from_stream( stream: TextIO, has_iterparse: HasIterparse = xml.etree.ElementTree ) -> our_types.AssetAdministrationShellMetadata: """ Read an instance of :py:class:`.types.AssetAdministrationShellMetadata` from the :paramref:`stream`. Example usage: .. code-block:: import aas_core3_2.xmlization as our_xmlization with open_some_stream_over_network(...) as stream: instance = our_xmlization.asset_administration_shell_metadata_from_stream( stream ) # Do something with the ``instance`` :param stream: representing an instance of :py:class:`.types.AssetAdministrationShellMetadata` in XML :param has_iterparse: Module containing ``iterparse`` function. Default is to use :py:mod:`xml.etree.ElementTree` from the standard library. If you have to deal with malicious input, consider using a library such as `defusedxml.ElementTree`_. :raise: :py:class:`DeserializationException` if unexpected input :return: Instance of :py:class:`.types.AssetAdministrationShellMetadata` read from :paramref:`stream` """ iterator = has_iterparse.iterparse(stream, ["start", "end"]) return asset_administration_shell_metadata_from_iterparse( _with_elements_cleared_after_yield(iterator) )
[docs]def asset_administration_shell_metadata_from_file( path: PathLike, has_iterparse: HasIterparse = xml.etree.ElementTree ) -> our_types.AssetAdministrationShellMetadata: """ Read an instance of :py:class:`.types.AssetAdministrationShellMetadata` from the :paramref:`path`. Example usage: .. code-block:: import pathlib import aas_core3_2.xmlization as our_xmlization path = pathlib.Path(...) instance = our_xmlization.asset_administration_shell_metadata_from_file( path ) # Do something with the ``instance`` :param path: to the file representing an instance of :py:class:`.types.AssetAdministrationShellMetadata` in XML :param has_iterparse: Module containing ``iterparse`` function. Default is to use :py:mod:`xml.etree.ElementTree` from the standard library. If you have to deal with malicious input, consider using a library such as `defusedxml.ElementTree`_. :raise: :py:class:`DeserializationException` if unexpected input :return: Instance of :py:class:`.types.AssetAdministrationShellMetadata` read from :paramref:`path` """ with open(os.fspath(path), encoding="utf-8") as fid: iterator = has_iterparse.iterparse(fid, ["start", "end"]) return asset_administration_shell_metadata_from_iterparse( _with_elements_cleared_after_yield(iterator) )
[docs]def asset_administration_shell_metadata_from_str( text: str, has_iterparse: HasIterparse = xml.etree.ElementTree ) -> our_types.AssetAdministrationShellMetadata: """ Read an instance of :py:class:`.types.AssetAdministrationShellMetadata` from the :paramref:`text`. Example usage: .. code-block:: import pathlib import aas_core3_2.xmlization as our_xmlization text = "<...>...</...>" instance = our_xmlization.asset_administration_shell_metadata_from_str( text ) # Do something with the ``instance`` :param text: representing an instance of :py:class:`.types.AssetAdministrationShellMetadata` in XML :param has_iterparse: Module containing ``iterparse`` function. Default is to use :py:mod:`xml.etree.ElementTree` from the standard library. If you have to deal with malicious input, consider using a library such as `defusedxml.ElementTree`_. :raise: :py:class:`DeserializationException` if unexpected input :return: Instance of :py:class:`.types.AssetAdministrationShellMetadata` read from :paramref:`text` """ iterator = has_iterparse.iterparse(io.StringIO(text), ["start", "end"]) return asset_administration_shell_metadata_from_iterparse( _with_elements_cleared_after_yield(iterator) )
[docs]def reference_element_value_from_iterparse( iterator: Iterator[Tuple[str, Element]], ) -> our_types.ReferenceElementValue: """ Read an instance of :py:class:`.types.ReferenceElementValue` from the :paramref:`iterator`. Example usage: .. code-block:: import pathlib import xml.etree.ElementTree as ET import aas_core3_2.xmlization as our_xmlization path = pathlib.Path(...) with path.open("rt") as fid: iterator = ET.iterparse( source=fid, events=['start', 'end'] ) instance = our_xmlization.reference_element_value_from_iterparse( iterator ) # Do something with the ``instance`` :param iterator: Input stream of ``(event, element)`` coming from :py:func:`xml.etree.ElementTree.iterparse` with the argument ``events=["start", "end"]`` :raise: :py:class:`DeserializationException` if unexpected input :return: Instance of :py:class:`.types.ReferenceElementValue` read from :paramref:`iterator` """ return _read_instance_from_iterparse( iterator, _read_reference_element_value_as_element, "ReferenceElementValue" )
[docs]def reference_element_value_from_stream( stream: TextIO, has_iterparse: HasIterparse = xml.etree.ElementTree ) -> our_types.ReferenceElementValue: """ Read an instance of :py:class:`.types.ReferenceElementValue` from the :paramref:`stream`. Example usage: .. code-block:: import aas_core3_2.xmlization as our_xmlization with open_some_stream_over_network(...) as stream: instance = our_xmlization.reference_element_value_from_stream( stream ) # Do something with the ``instance`` :param stream: representing an instance of :py:class:`.types.ReferenceElementValue` in XML :param has_iterparse: Module containing ``iterparse`` function. Default is to use :py:mod:`xml.etree.ElementTree` from the standard library. If you have to deal with malicious input, consider using a library such as `defusedxml.ElementTree`_. :raise: :py:class:`DeserializationException` if unexpected input :return: Instance of :py:class:`.types.ReferenceElementValue` read from :paramref:`stream` """ iterator = has_iterparse.iterparse(stream, ["start", "end"]) return reference_element_value_from_iterparse( _with_elements_cleared_after_yield(iterator) )
[docs]def reference_element_value_from_file( path: PathLike, has_iterparse: HasIterparse = xml.etree.ElementTree ) -> our_types.ReferenceElementValue: """ Read an instance of :py:class:`.types.ReferenceElementValue` from the :paramref:`path`. Example usage: .. code-block:: import pathlib import aas_core3_2.xmlization as our_xmlization path = pathlib.Path(...) instance = our_xmlization.reference_element_value_from_file( path ) # Do something with the ``instance`` :param path: to the file representing an instance of :py:class:`.types.ReferenceElementValue` in XML :param has_iterparse: Module containing ``iterparse`` function. Default is to use :py:mod:`xml.etree.ElementTree` from the standard library. If you have to deal with malicious input, consider using a library such as `defusedxml.ElementTree`_. :raise: :py:class:`DeserializationException` if unexpected input :return: Instance of :py:class:`.types.ReferenceElementValue` read from :paramref:`path` """ with open(os.fspath(path), encoding="utf-8") as fid: iterator = has_iterparse.iterparse(fid, ["start", "end"]) return reference_element_value_from_iterparse( _with_elements_cleared_after_yield(iterator) )
[docs]def reference_element_value_from_str( text: str, has_iterparse: HasIterparse = xml.etree.ElementTree ) -> our_types.ReferenceElementValue: """ Read an instance of :py:class:`.types.ReferenceElementValue` from the :paramref:`text`. Example usage: .. code-block:: import pathlib import aas_core3_2.xmlization as our_xmlization text = "<...>...</...>" instance = our_xmlization.reference_element_value_from_str( text ) # Do something with the ``instance`` :param text: representing an instance of :py:class:`.types.ReferenceElementValue` in XML :param has_iterparse: Module containing ``iterparse`` function. Default is to use :py:mod:`xml.etree.ElementTree` from the standard library. If you have to deal with malicious input, consider using a library such as `defusedxml.ElementTree`_. :raise: :py:class:`DeserializationException` if unexpected input :return: Instance of :py:class:`.types.ReferenceElementValue` read from :paramref:`text` """ iterator = has_iterparse.iterparse(io.StringIO(text), ["start", "end"]) return reference_element_value_from_iterparse( _with_elements_cleared_after_yield(iterator) )
[docs]def blob_value_from_iterparse( iterator: Iterator[Tuple[str, Element]], ) -> our_types.BlobValue: """ Read an instance of :py:class:`.types.BlobValue` from the :paramref:`iterator`. Example usage: .. code-block:: import pathlib import xml.etree.ElementTree as ET import aas_core3_2.xmlization as our_xmlization path = pathlib.Path(...) with path.open("rt") as fid: iterator = ET.iterparse( source=fid, events=['start', 'end'] ) instance = our_xmlization.blob_value_from_iterparse( iterator ) # Do something with the ``instance`` :param iterator: Input stream of ``(event, element)`` coming from :py:func:`xml.etree.ElementTree.iterparse` with the argument ``events=["start", "end"]`` :raise: :py:class:`DeserializationException` if unexpected input :return: Instance of :py:class:`.types.BlobValue` read from :paramref:`iterator` """ return _read_instance_from_iterparse( iterator, _read_blob_value_as_element, "BlobValue" )
[docs]def blob_value_from_stream( stream: TextIO, has_iterparse: HasIterparse = xml.etree.ElementTree ) -> our_types.BlobValue: """ Read an instance of :py:class:`.types.BlobValue` from the :paramref:`stream`. Example usage: .. code-block:: import aas_core3_2.xmlization as our_xmlization with open_some_stream_over_network(...) as stream: instance = our_xmlization.blob_value_from_stream( stream ) # Do something with the ``instance`` :param stream: representing an instance of :py:class:`.types.BlobValue` in XML :param has_iterparse: Module containing ``iterparse`` function. Default is to use :py:mod:`xml.etree.ElementTree` from the standard library. If you have to deal with malicious input, consider using a library such as `defusedxml.ElementTree`_. :raise: :py:class:`DeserializationException` if unexpected input :return: Instance of :py:class:`.types.BlobValue` read from :paramref:`stream` """ iterator = has_iterparse.iterparse(stream, ["start", "end"]) return blob_value_from_iterparse(_with_elements_cleared_after_yield(iterator))
[docs]def blob_value_from_file( path: PathLike, has_iterparse: HasIterparse = xml.etree.ElementTree ) -> our_types.BlobValue: """ Read an instance of :py:class:`.types.BlobValue` from the :paramref:`path`. Example usage: .. code-block:: import pathlib import aas_core3_2.xmlization as our_xmlization path = pathlib.Path(...) instance = our_xmlization.blob_value_from_file( path ) # Do something with the ``instance`` :param path: to the file representing an instance of :py:class:`.types.BlobValue` in XML :param has_iterparse: Module containing ``iterparse`` function. Default is to use :py:mod:`xml.etree.ElementTree` from the standard library. If you have to deal with malicious input, consider using a library such as `defusedxml.ElementTree`_. :raise: :py:class:`DeserializationException` if unexpected input :return: Instance of :py:class:`.types.BlobValue` read from :paramref:`path` """ with open(os.fspath(path), encoding="utf-8") as fid: iterator = has_iterparse.iterparse(fid, ["start", "end"]) return blob_value_from_iterparse(_with_elements_cleared_after_yield(iterator))
[docs]def blob_value_from_str( text: str, has_iterparse: HasIterparse = xml.etree.ElementTree ) -> our_types.BlobValue: """ Read an instance of :py:class:`.types.BlobValue` from the :paramref:`text`. Example usage: .. code-block:: import pathlib import aas_core3_2.xmlization as our_xmlization text = "<...>...</...>" instance = our_xmlization.blob_value_from_str( text ) # Do something with the ``instance`` :param text: representing an instance of :py:class:`.types.BlobValue` in XML :param has_iterparse: Module containing ``iterparse`` function. Default is to use :py:mod:`xml.etree.ElementTree` from the standard library. If you have to deal with malicious input, consider using a library such as `defusedxml.ElementTree`_. :raise: :py:class:`DeserializationException` if unexpected input :return: Instance of :py:class:`.types.BlobValue` read from :paramref:`text` """ iterator = has_iterparse.iterparse(io.StringIO(text), ["start", "end"]) return blob_value_from_iterparse(_with_elements_cleared_after_yield(iterator))
[docs]def file_value_from_iterparse( iterator: Iterator[Tuple[str, Element]], ) -> our_types.FileValue: """ Read an instance of :py:class:`.types.FileValue` from the :paramref:`iterator`. Example usage: .. code-block:: import pathlib import xml.etree.ElementTree as ET import aas_core3_2.xmlization as our_xmlization path = pathlib.Path(...) with path.open("rt") as fid: iterator = ET.iterparse( source=fid, events=['start', 'end'] ) instance = our_xmlization.file_value_from_iterparse( iterator ) # Do something with the ``instance`` :param iterator: Input stream of ``(event, element)`` coming from :py:func:`xml.etree.ElementTree.iterparse` with the argument ``events=["start", "end"]`` :raise: :py:class:`DeserializationException` if unexpected input :return: Instance of :py:class:`.types.FileValue` read from :paramref:`iterator` """ return _read_instance_from_iterparse( iterator, _read_file_value_as_element, "FileValue" )
[docs]def file_value_from_stream( stream: TextIO, has_iterparse: HasIterparse = xml.etree.ElementTree ) -> our_types.FileValue: """ Read an instance of :py:class:`.types.FileValue` from the :paramref:`stream`. Example usage: .. code-block:: import aas_core3_2.xmlization as our_xmlization with open_some_stream_over_network(...) as stream: instance = our_xmlization.file_value_from_stream( stream ) # Do something with the ``instance`` :param stream: representing an instance of :py:class:`.types.FileValue` in XML :param has_iterparse: Module containing ``iterparse`` function. Default is to use :py:mod:`xml.etree.ElementTree` from the standard library. If you have to deal with malicious input, consider using a library such as `defusedxml.ElementTree`_. :raise: :py:class:`DeserializationException` if unexpected input :return: Instance of :py:class:`.types.FileValue` read from :paramref:`stream` """ iterator = has_iterparse.iterparse(stream, ["start", "end"]) return file_value_from_iterparse(_with_elements_cleared_after_yield(iterator))
[docs]def file_value_from_file( path: PathLike, has_iterparse: HasIterparse = xml.etree.ElementTree ) -> our_types.FileValue: """ Read an instance of :py:class:`.types.FileValue` from the :paramref:`path`. Example usage: .. code-block:: import pathlib import aas_core3_2.xmlization as our_xmlization path = pathlib.Path(...) instance = our_xmlization.file_value_from_file( path ) # Do something with the ``instance`` :param path: to the file representing an instance of :py:class:`.types.FileValue` in XML :param has_iterparse: Module containing ``iterparse`` function. Default is to use :py:mod:`xml.etree.ElementTree` from the standard library. If you have to deal with malicious input, consider using a library such as `defusedxml.ElementTree`_. :raise: :py:class:`DeserializationException` if unexpected input :return: Instance of :py:class:`.types.FileValue` read from :paramref:`path` """ with open(os.fspath(path), encoding="utf-8") as fid: iterator = has_iterparse.iterparse(fid, ["start", "end"]) return file_value_from_iterparse(_with_elements_cleared_after_yield(iterator))
[docs]def file_value_from_str( text: str, has_iterparse: HasIterparse = xml.etree.ElementTree ) -> our_types.FileValue: """ Read an instance of :py:class:`.types.FileValue` from the :paramref:`text`. Example usage: .. code-block:: import pathlib import aas_core3_2.xmlization as our_xmlization text = "<...>...</...>" instance = our_xmlization.file_value_from_str( text ) # Do something with the ``instance`` :param text: representing an instance of :py:class:`.types.FileValue` in XML :param has_iterparse: Module containing ``iterparse`` function. Default is to use :py:mod:`xml.etree.ElementTree` from the standard library. If you have to deal with malicious input, consider using a library such as `defusedxml.ElementTree`_. :raise: :py:class:`DeserializationException` if unexpected input :return: Instance of :py:class:`.types.FileValue` read from :paramref:`text` """ iterator = has_iterparse.iterparse(io.StringIO(text), ["start", "end"]) return file_value_from_iterparse(_with_elements_cleared_after_yield(iterator))
[docs]def range_value_from_iterparse( iterator: Iterator[Tuple[str, Element]], ) -> our_types.RangeValue: """ Read an instance of :py:class:`.types.RangeValue` from the :paramref:`iterator`. Example usage: .. code-block:: import pathlib import xml.etree.ElementTree as ET import aas_core3_2.xmlization as our_xmlization path = pathlib.Path(...) with path.open("rt") as fid: iterator = ET.iterparse( source=fid, events=['start', 'end'] ) instance = our_xmlization.range_value_from_iterparse( iterator ) # Do something with the ``instance`` :param iterator: Input stream of ``(event, element)`` coming from :py:func:`xml.etree.ElementTree.iterparse` with the argument ``events=["start", "end"]`` :raise: :py:class:`DeserializationException` if unexpected input :return: Instance of :py:class:`.types.RangeValue` read from :paramref:`iterator` """ return _read_instance_from_iterparse( iterator, _read_range_value_as_element, "RangeValue" )
[docs]def range_value_from_stream( stream: TextIO, has_iterparse: HasIterparse = xml.etree.ElementTree ) -> our_types.RangeValue: """ Read an instance of :py:class:`.types.RangeValue` from the :paramref:`stream`. Example usage: .. code-block:: import aas_core3_2.xmlization as our_xmlization with open_some_stream_over_network(...) as stream: instance = our_xmlization.range_value_from_stream( stream ) # Do something with the ``instance`` :param stream: representing an instance of :py:class:`.types.RangeValue` in XML :param has_iterparse: Module containing ``iterparse`` function. Default is to use :py:mod:`xml.etree.ElementTree` from the standard library. If you have to deal with malicious input, consider using a library such as `defusedxml.ElementTree`_. :raise: :py:class:`DeserializationException` if unexpected input :return: Instance of :py:class:`.types.RangeValue` read from :paramref:`stream` """ iterator = has_iterparse.iterparse(stream, ["start", "end"]) return range_value_from_iterparse(_with_elements_cleared_after_yield(iterator))
[docs]def range_value_from_file( path: PathLike, has_iterparse: HasIterparse = xml.etree.ElementTree ) -> our_types.RangeValue: """ Read an instance of :py:class:`.types.RangeValue` from the :paramref:`path`. Example usage: .. code-block:: import pathlib import aas_core3_2.xmlization as our_xmlization path = pathlib.Path(...) instance = our_xmlization.range_value_from_file( path ) # Do something with the ``instance`` :param path: to the file representing an instance of :py:class:`.types.RangeValue` in XML :param has_iterparse: Module containing ``iterparse`` function. Default is to use :py:mod:`xml.etree.ElementTree` from the standard library. If you have to deal with malicious input, consider using a library such as `defusedxml.ElementTree`_. :raise: :py:class:`DeserializationException` if unexpected input :return: Instance of :py:class:`.types.RangeValue` read from :paramref:`path` """ with open(os.fspath(path), encoding="utf-8") as fid: iterator = has_iterparse.iterparse(fid, ["start", "end"]) return range_value_from_iterparse(_with_elements_cleared_after_yield(iterator))
[docs]def range_value_from_str( text: str, has_iterparse: HasIterparse = xml.etree.ElementTree ) -> our_types.RangeValue: """ Read an instance of :py:class:`.types.RangeValue` from the :paramref:`text`. Example usage: .. code-block:: import pathlib import aas_core3_2.xmlization as our_xmlization text = "<...>...</...>" instance = our_xmlization.range_value_from_str( text ) # Do something with the ``instance`` :param text: representing an instance of :py:class:`.types.RangeValue` in XML :param has_iterparse: Module containing ``iterparse`` function. Default is to use :py:mod:`xml.etree.ElementTree` from the standard library. If you have to deal with malicious input, consider using a library such as `defusedxml.ElementTree`_. :raise: :py:class:`DeserializationException` if unexpected input :return: Instance of :py:class:`.types.RangeValue` read from :paramref:`text` """ iterator = has_iterparse.iterparse(io.StringIO(text), ["start", "end"]) return range_value_from_iterparse(_with_elements_cleared_after_yield(iterator))
[docs]def relationship_element_value_from_iterparse( iterator: Iterator[Tuple[str, Element]], ) -> our_types.RelationshipElementValue: """ Read an instance of :py:class:`.types.RelationshipElementValue` from the :paramref:`iterator`. Example usage: .. code-block:: import pathlib import xml.etree.ElementTree as ET import aas_core3_2.xmlization as our_xmlization path = pathlib.Path(...) with path.open("rt") as fid: iterator = ET.iterparse( source=fid, events=['start', 'end'] ) instance = our_xmlization.relationship_element_value_from_iterparse( iterator ) # Do something with the ``instance`` :param iterator: Input stream of ``(event, element)`` coming from :py:func:`xml.etree.ElementTree.iterparse` with the argument ``events=["start", "end"]`` :raise: :py:class:`DeserializationException` if unexpected input :return: Instance of :py:class:`.types.RelationshipElementValue` read from :paramref:`iterator` """ return _read_instance_from_iterparse( iterator, _read_relationship_element_value_as_element, "RelationshipElementValue", )
[docs]def relationship_element_value_from_stream( stream: TextIO, has_iterparse: HasIterparse = xml.etree.ElementTree ) -> our_types.RelationshipElementValue: """ Read an instance of :py:class:`.types.RelationshipElementValue` from the :paramref:`stream`. Example usage: .. code-block:: import aas_core3_2.xmlization as our_xmlization with open_some_stream_over_network(...) as stream: instance = our_xmlization.relationship_element_value_from_stream( stream ) # Do something with the ``instance`` :param stream: representing an instance of :py:class:`.types.RelationshipElementValue` in XML :param has_iterparse: Module containing ``iterparse`` function. Default is to use :py:mod:`xml.etree.ElementTree` from the standard library. If you have to deal with malicious input, consider using a library such as `defusedxml.ElementTree`_. :raise: :py:class:`DeserializationException` if unexpected input :return: Instance of :py:class:`.types.RelationshipElementValue` read from :paramref:`stream` """ iterator = has_iterparse.iterparse(stream, ["start", "end"]) return relationship_element_value_from_iterparse( _with_elements_cleared_after_yield(iterator) )
[docs]def relationship_element_value_from_file( path: PathLike, has_iterparse: HasIterparse = xml.etree.ElementTree ) -> our_types.RelationshipElementValue: """ Read an instance of :py:class:`.types.RelationshipElementValue` from the :paramref:`path`. Example usage: .. code-block:: import pathlib import aas_core3_2.xmlization as our_xmlization path = pathlib.Path(...) instance = our_xmlization.relationship_element_value_from_file( path ) # Do something with the ``instance`` :param path: to the file representing an instance of :py:class:`.types.RelationshipElementValue` in XML :param has_iterparse: Module containing ``iterparse`` function. Default is to use :py:mod:`xml.etree.ElementTree` from the standard library. If you have to deal with malicious input, consider using a library such as `defusedxml.ElementTree`_. :raise: :py:class:`DeserializationException` if unexpected input :return: Instance of :py:class:`.types.RelationshipElementValue` read from :paramref:`path` """ with open(os.fspath(path), encoding="utf-8") as fid: iterator = has_iterparse.iterparse(fid, ["start", "end"]) return relationship_element_value_from_iterparse( _with_elements_cleared_after_yield(iterator) )
[docs]def relationship_element_value_from_str( text: str, has_iterparse: HasIterparse = xml.etree.ElementTree ) -> our_types.RelationshipElementValue: """ Read an instance of :py:class:`.types.RelationshipElementValue` from the :paramref:`text`. Example usage: .. code-block:: import pathlib import aas_core3_2.xmlization as our_xmlization text = "<...>...</...>" instance = our_xmlization.relationship_element_value_from_str( text ) # Do something with the ``instance`` :param text: representing an instance of :py:class:`.types.RelationshipElementValue` in XML :param has_iterparse: Module containing ``iterparse`` function. Default is to use :py:mod:`xml.etree.ElementTree` from the standard library. If you have to deal with malicious input, consider using a library such as `defusedxml.ElementTree`_. :raise: :py:class:`DeserializationException` if unexpected input :return: Instance of :py:class:`.types.RelationshipElementValue` read from :paramref:`text` """ iterator = has_iterparse.iterparse(io.StringIO(text), ["start", "end"]) return relationship_element_value_from_iterparse( _with_elements_cleared_after_yield(iterator) )
[docs]def basic_event_element_value_from_iterparse( iterator: Iterator[Tuple[str, Element]], ) -> our_types.BasicEventElementValue: """ Read an instance of :py:class:`.types.BasicEventElementValue` from the :paramref:`iterator`. Example usage: .. code-block:: import pathlib import xml.etree.ElementTree as ET import aas_core3_2.xmlization as our_xmlization path = pathlib.Path(...) with path.open("rt") as fid: iterator = ET.iterparse( source=fid, events=['start', 'end'] ) instance = our_xmlization.basic_event_element_value_from_iterparse( iterator ) # Do something with the ``instance`` :param iterator: Input stream of ``(event, element)`` coming from :py:func:`xml.etree.ElementTree.iterparse` with the argument ``events=["start", "end"]`` :raise: :py:class:`DeserializationException` if unexpected input :return: Instance of :py:class:`.types.BasicEventElementValue` read from :paramref:`iterator` """ return _read_instance_from_iterparse( iterator, _read_basic_event_element_value_as_element, "BasicEventElementValue" )
[docs]def basic_event_element_value_from_stream( stream: TextIO, has_iterparse: HasIterparse = xml.etree.ElementTree ) -> our_types.BasicEventElementValue: """ Read an instance of :py:class:`.types.BasicEventElementValue` from the :paramref:`stream`. Example usage: .. code-block:: import aas_core3_2.xmlization as our_xmlization with open_some_stream_over_network(...) as stream: instance = our_xmlization.basic_event_element_value_from_stream( stream ) # Do something with the ``instance`` :param stream: representing an instance of :py:class:`.types.BasicEventElementValue` in XML :param has_iterparse: Module containing ``iterparse`` function. Default is to use :py:mod:`xml.etree.ElementTree` from the standard library. If you have to deal with malicious input, consider using a library such as `defusedxml.ElementTree`_. :raise: :py:class:`DeserializationException` if unexpected input :return: Instance of :py:class:`.types.BasicEventElementValue` read from :paramref:`stream` """ iterator = has_iterparse.iterparse(stream, ["start", "end"]) return basic_event_element_value_from_iterparse( _with_elements_cleared_after_yield(iterator) )
[docs]def basic_event_element_value_from_file( path: PathLike, has_iterparse: HasIterparse = xml.etree.ElementTree ) -> our_types.BasicEventElementValue: """ Read an instance of :py:class:`.types.BasicEventElementValue` from the :paramref:`path`. Example usage: .. code-block:: import pathlib import aas_core3_2.xmlization as our_xmlization path = pathlib.Path(...) instance = our_xmlization.basic_event_element_value_from_file( path ) # Do something with the ``instance`` :param path: to the file representing an instance of :py:class:`.types.BasicEventElementValue` in XML :param has_iterparse: Module containing ``iterparse`` function. Default is to use :py:mod:`xml.etree.ElementTree` from the standard library. If you have to deal with malicious input, consider using a library such as `defusedxml.ElementTree`_. :raise: :py:class:`DeserializationException` if unexpected input :return: Instance of :py:class:`.types.BasicEventElementValue` read from :paramref:`path` """ with open(os.fspath(path), encoding="utf-8") as fid: iterator = has_iterparse.iterparse(fid, ["start", "end"]) return basic_event_element_value_from_iterparse( _with_elements_cleared_after_yield(iterator) )
[docs]def basic_event_element_value_from_str( text: str, has_iterparse: HasIterparse = xml.etree.ElementTree ) -> our_types.BasicEventElementValue: """ Read an instance of :py:class:`.types.BasicEventElementValue` from the :paramref:`text`. Example usage: .. code-block:: import pathlib import aas_core3_2.xmlization as our_xmlization text = "<...>...</...>" instance = our_xmlization.basic_event_element_value_from_str( text ) # Do something with the ``instance`` :param text: representing an instance of :py:class:`.types.BasicEventElementValue` in XML :param has_iterparse: Module containing ``iterparse`` function. Default is to use :py:mod:`xml.etree.ElementTree` from the standard library. If you have to deal with malicious input, consider using a library such as `defusedxml.ElementTree`_. :raise: :py:class:`DeserializationException` if unexpected input :return: Instance of :py:class:`.types.BasicEventElementValue` read from :paramref:`text` """ iterator = has_iterparse.iterparse(io.StringIO(text), ["start", "end"]) return basic_event_element_value_from_iterparse( _with_elements_cleared_after_yield(iterator) )
[docs]def annotated_relationship_element_value_from_iterparse( iterator: Iterator[Tuple[str, Element]], ) -> our_types.AnnotatedRelationshipElementValue: """ Read an instance of :py:class:`.types.AnnotatedRelationshipElementValue` from the :paramref:`iterator`. Example usage: .. code-block:: import pathlib import xml.etree.ElementTree as ET import aas_core3_2.xmlization as our_xmlization path = pathlib.Path(...) with path.open("rt") as fid: iterator = ET.iterparse( source=fid, events=['start', 'end'] ) instance = our_xmlization.annotated_relationship_element_value_from_iterparse( iterator ) # Do something with the ``instance`` :param iterator: Input stream of ``(event, element)`` coming from :py:func:`xml.etree.ElementTree.iterparse` with the argument ``events=["start", "end"]`` :raise: :py:class:`DeserializationException` if unexpected input :return: Instance of :py:class:`.types.AnnotatedRelationshipElementValue` read from :paramref:`iterator` """ return _read_instance_from_iterparse( iterator, _read_annotated_relationship_element_value_as_element, "AnnotatedRelationshipElementValue", )
[docs]def annotated_relationship_element_value_from_stream( stream: TextIO, has_iterparse: HasIterparse = xml.etree.ElementTree ) -> our_types.AnnotatedRelationshipElementValue: """ Read an instance of :py:class:`.types.AnnotatedRelationshipElementValue` from the :paramref:`stream`. Example usage: .. code-block:: import aas_core3_2.xmlization as our_xmlization with open_some_stream_over_network(...) as stream: instance = our_xmlization.annotated_relationship_element_value_from_stream( stream ) # Do something with the ``instance`` :param stream: representing an instance of :py:class:`.types.AnnotatedRelationshipElementValue` in XML :param has_iterparse: Module containing ``iterparse`` function. Default is to use :py:mod:`xml.etree.ElementTree` from the standard library. If you have to deal with malicious input, consider using a library such as `defusedxml.ElementTree`_. :raise: :py:class:`DeserializationException` if unexpected input :return: Instance of :py:class:`.types.AnnotatedRelationshipElementValue` read from :paramref:`stream` """ iterator = has_iterparse.iterparse(stream, ["start", "end"]) return annotated_relationship_element_value_from_iterparse( _with_elements_cleared_after_yield(iterator) )
[docs]def annotated_relationship_element_value_from_file( path: PathLike, has_iterparse: HasIterparse = xml.etree.ElementTree ) -> our_types.AnnotatedRelationshipElementValue: """ Read an instance of :py:class:`.types.AnnotatedRelationshipElementValue` from the :paramref:`path`. Example usage: .. code-block:: import pathlib import aas_core3_2.xmlization as our_xmlization path = pathlib.Path(...) instance = our_xmlization.annotated_relationship_element_value_from_file( path ) # Do something with the ``instance`` :param path: to the file representing an instance of :py:class:`.types.AnnotatedRelationshipElementValue` in XML :param has_iterparse: Module containing ``iterparse`` function. Default is to use :py:mod:`xml.etree.ElementTree` from the standard library. If you have to deal with malicious input, consider using a library such as `defusedxml.ElementTree`_. :raise: :py:class:`DeserializationException` if unexpected input :return: Instance of :py:class:`.types.AnnotatedRelationshipElementValue` read from :paramref:`path` """ with open(os.fspath(path), encoding="utf-8") as fid: iterator = has_iterparse.iterparse(fid, ["start", "end"]) return annotated_relationship_element_value_from_iterparse( _with_elements_cleared_after_yield(iterator) )
[docs]def annotated_relationship_element_value_from_str( text: str, has_iterparse: HasIterparse = xml.etree.ElementTree ) -> our_types.AnnotatedRelationshipElementValue: """ Read an instance of :py:class:`.types.AnnotatedRelationshipElementValue` from the :paramref:`text`. Example usage: .. code-block:: import pathlib import aas_core3_2.xmlization as our_xmlization text = "<...>...</...>" instance = our_xmlization.annotated_relationship_element_value_from_str( text ) # Do something with the ``instance`` :param text: representing an instance of :py:class:`.types.AnnotatedRelationshipElementValue` in XML :param has_iterparse: Module containing ``iterparse`` function. Default is to use :py:mod:`xml.etree.ElementTree` from the standard library. If you have to deal with malicious input, consider using a library such as `defusedxml.ElementTree`_. :raise: :py:class:`DeserializationException` if unexpected input :return: Instance of :py:class:`.types.AnnotatedRelationshipElementValue` read from :paramref:`text` """ iterator = has_iterparse.iterparse(io.StringIO(text), ["start", "end"]) return annotated_relationship_element_value_from_iterparse( _with_elements_cleared_after_yield(iterator) )
[docs]def entity_value_from_iterparse( iterator: Iterator[Tuple[str, Element]], ) -> our_types.EntityValue: """ Read an instance of :py:class:`.types.EntityValue` from the :paramref:`iterator`. Example usage: .. code-block:: import pathlib import xml.etree.ElementTree as ET import aas_core3_2.xmlization as our_xmlization path = pathlib.Path(...) with path.open("rt") as fid: iterator = ET.iterparse( source=fid, events=['start', 'end'] ) instance = our_xmlization.entity_value_from_iterparse( iterator ) # Do something with the ``instance`` :param iterator: Input stream of ``(event, element)`` coming from :py:func:`xml.etree.ElementTree.iterparse` with the argument ``events=["start", "end"]`` :raise: :py:class:`DeserializationException` if unexpected input :return: Instance of :py:class:`.types.EntityValue` read from :paramref:`iterator` """ return _read_instance_from_iterparse( iterator, _read_entity_value_as_element, "EntityValue" )
[docs]def entity_value_from_stream( stream: TextIO, has_iterparse: HasIterparse = xml.etree.ElementTree ) -> our_types.EntityValue: """ Read an instance of :py:class:`.types.EntityValue` from the :paramref:`stream`. Example usage: .. code-block:: import aas_core3_2.xmlization as our_xmlization with open_some_stream_over_network(...) as stream: instance = our_xmlization.entity_value_from_stream( stream ) # Do something with the ``instance`` :param stream: representing an instance of :py:class:`.types.EntityValue` in XML :param has_iterparse: Module containing ``iterparse`` function. Default is to use :py:mod:`xml.etree.ElementTree` from the standard library. If you have to deal with malicious input, consider using a library such as `defusedxml.ElementTree`_. :raise: :py:class:`DeserializationException` if unexpected input :return: Instance of :py:class:`.types.EntityValue` read from :paramref:`stream` """ iterator = has_iterparse.iterparse(stream, ["start", "end"]) return entity_value_from_iterparse(_with_elements_cleared_after_yield(iterator))
[docs]def entity_value_from_file( path: PathLike, has_iterparse: HasIterparse = xml.etree.ElementTree ) -> our_types.EntityValue: """ Read an instance of :py:class:`.types.EntityValue` from the :paramref:`path`. Example usage: .. code-block:: import pathlib import aas_core3_2.xmlization as our_xmlization path = pathlib.Path(...) instance = our_xmlization.entity_value_from_file( path ) # Do something with the ``instance`` :param path: to the file representing an instance of :py:class:`.types.EntityValue` in XML :param has_iterparse: Module containing ``iterparse`` function. Default is to use :py:mod:`xml.etree.ElementTree` from the standard library. If you have to deal with malicious input, consider using a library such as `defusedxml.ElementTree`_. :raise: :py:class:`DeserializationException` if unexpected input :return: Instance of :py:class:`.types.EntityValue` read from :paramref:`path` """ with open(os.fspath(path), encoding="utf-8") as fid: iterator = has_iterparse.iterparse(fid, ["start", "end"]) return entity_value_from_iterparse(_with_elements_cleared_after_yield(iterator))
[docs]def entity_value_from_str( text: str, has_iterparse: HasIterparse = xml.etree.ElementTree ) -> our_types.EntityValue: """ Read an instance of :py:class:`.types.EntityValue` from the :paramref:`text`. Example usage: .. code-block:: import pathlib import aas_core3_2.xmlization as our_xmlization text = "<...>...</...>" instance = our_xmlization.entity_value_from_str( text ) # Do something with the ``instance`` :param text: representing an instance of :py:class:`.types.EntityValue` in XML :param has_iterparse: Module containing ``iterparse`` function. Default is to use :py:mod:`xml.etree.ElementTree` from the standard library. If you have to deal with malicious input, consider using a library such as `defusedxml.ElementTree`_. :raise: :py:class:`DeserializationException` if unexpected input :return: Instance of :py:class:`.types.EntityValue` read from :paramref:`text` """ iterator = has_iterparse.iterparse(io.StringIO(text), ["start", "end"]) return entity_value_from_iterparse(_with_elements_cleared_after_yield(iterator))
[docs]def get_asset_administration_shells_result_from_iterparse( iterator: Iterator[Tuple[str, Element]], ) -> our_types.GetAssetAdministrationShellsResult: """ Read an instance of :py:class:`.types.GetAssetAdministrationShellsResult` from the :paramref:`iterator`. Example usage: .. code-block:: import pathlib import xml.etree.ElementTree as ET import aas_core3_2.xmlization as our_xmlization path = pathlib.Path(...) with path.open("rt") as fid: iterator = ET.iterparse( source=fid, events=['start', 'end'] ) instance = our_xmlization.get_asset_administration_shells_result_from_iterparse( iterator ) # Do something with the ``instance`` :param iterator: Input stream of ``(event, element)`` coming from :py:func:`xml.etree.ElementTree.iterparse` with the argument ``events=["start", "end"]`` :raise: :py:class:`DeserializationException` if unexpected input :return: Instance of :py:class:`.types.GetAssetAdministrationShellsResult` read from :paramref:`iterator` """ return _read_instance_from_iterparse( iterator, _read_get_asset_administration_shells_result_as_element, "GetAssetAdministrationShellsResult", )
[docs]def get_asset_administration_shells_result_from_stream( stream: TextIO, has_iterparse: HasIterparse = xml.etree.ElementTree ) -> our_types.GetAssetAdministrationShellsResult: """ Read an instance of :py:class:`.types.GetAssetAdministrationShellsResult` from the :paramref:`stream`. Example usage: .. code-block:: import aas_core3_2.xmlization as our_xmlization with open_some_stream_over_network(...) as stream: instance = our_xmlization.get_asset_administration_shells_result_from_stream( stream ) # Do something with the ``instance`` :param stream: representing an instance of :py:class:`.types.GetAssetAdministrationShellsResult` in XML :param has_iterparse: Module containing ``iterparse`` function. Default is to use :py:mod:`xml.etree.ElementTree` from the standard library. If you have to deal with malicious input, consider using a library such as `defusedxml.ElementTree`_. :raise: :py:class:`DeserializationException` if unexpected input :return: Instance of :py:class:`.types.GetAssetAdministrationShellsResult` read from :paramref:`stream` """ iterator = has_iterparse.iterparse(stream, ["start", "end"]) return get_asset_administration_shells_result_from_iterparse( _with_elements_cleared_after_yield(iterator) )
[docs]def get_asset_administration_shells_result_from_file( path: PathLike, has_iterparse: HasIterparse = xml.etree.ElementTree ) -> our_types.GetAssetAdministrationShellsResult: """ Read an instance of :py:class:`.types.GetAssetAdministrationShellsResult` from the :paramref:`path`. Example usage: .. code-block:: import pathlib import aas_core3_2.xmlization as our_xmlization path = pathlib.Path(...) instance = our_xmlization.get_asset_administration_shells_result_from_file( path ) # Do something with the ``instance`` :param path: to the file representing an instance of :py:class:`.types.GetAssetAdministrationShellsResult` in XML :param has_iterparse: Module containing ``iterparse`` function. Default is to use :py:mod:`xml.etree.ElementTree` from the standard library. If you have to deal with malicious input, consider using a library such as `defusedxml.ElementTree`_. :raise: :py:class:`DeserializationException` if unexpected input :return: Instance of :py:class:`.types.GetAssetAdministrationShellsResult` read from :paramref:`path` """ with open(os.fspath(path), encoding="utf-8") as fid: iterator = has_iterparse.iterparse(fid, ["start", "end"]) return get_asset_administration_shells_result_from_iterparse( _with_elements_cleared_after_yield(iterator) )
[docs]def get_asset_administration_shells_result_from_str( text: str, has_iterparse: HasIterparse = xml.etree.ElementTree ) -> our_types.GetAssetAdministrationShellsResult: """ Read an instance of :py:class:`.types.GetAssetAdministrationShellsResult` from the :paramref:`text`. Example usage: .. code-block:: import pathlib import aas_core3_2.xmlization as our_xmlization text = "<...>...</...>" instance = our_xmlization.get_asset_administration_shells_result_from_str( text ) # Do something with the ``instance`` :param text: representing an instance of :py:class:`.types.GetAssetAdministrationShellsResult` in XML :param has_iterparse: Module containing ``iterparse`` function. Default is to use :py:mod:`xml.etree.ElementTree` from the standard library. If you have to deal with malicious input, consider using a library such as `defusedxml.ElementTree`_. :raise: :py:class:`DeserializationException` if unexpected input :return: Instance of :py:class:`.types.GetAssetAdministrationShellsResult` read from :paramref:`text` """ iterator = has_iterparse.iterparse(io.StringIO(text), ["start", "end"]) return get_asset_administration_shells_result_from_iterparse( _with_elements_cleared_after_yield(iterator) )
[docs]def get_asset_administration_shells_metadata_result_from_iterparse( iterator: Iterator[Tuple[str, Element]], ) -> our_types.GetAssetAdministrationShellsMetadataResult: """ Read an instance of :py:class:`.types.GetAssetAdministrationShellsMetadataResult` from the :paramref:`iterator`. Example usage: .. code-block:: import pathlib import xml.etree.ElementTree as ET import aas_core3_2.xmlization as our_xmlization path = pathlib.Path(...) with path.open("rt") as fid: iterator = ET.iterparse( source=fid, events=['start', 'end'] ) instance = our_xmlization.get_asset_administration_shells_metadata_result_from_iterparse( iterator ) # Do something with the ``instance`` :param iterator: Input stream of ``(event, element)`` coming from :py:func:`xml.etree.ElementTree.iterparse` with the argument ``events=["start", "end"]`` :raise: :py:class:`DeserializationException` if unexpected input :return: Instance of :py:class:`.types.GetAssetAdministrationShellsMetadataResult` read from :paramref:`iterator` """ return _read_instance_from_iterparse( iterator, _read_get_asset_administration_shells_metadata_result_as_element, "GetAssetAdministrationShellsMetadataResult", )
[docs]def get_asset_administration_shells_metadata_result_from_stream( stream: TextIO, has_iterparse: HasIterparse = xml.etree.ElementTree ) -> our_types.GetAssetAdministrationShellsMetadataResult: """ Read an instance of :py:class:`.types.GetAssetAdministrationShellsMetadataResult` from the :paramref:`stream`. Example usage: .. code-block:: import aas_core3_2.xmlization as our_xmlization with open_some_stream_over_network(...) as stream: instance = our_xmlization.get_asset_administration_shells_metadata_result_from_stream( stream ) # Do something with the ``instance`` :param stream: representing an instance of :py:class:`.types.GetAssetAdministrationShellsMetadataResult` in XML :param has_iterparse: Module containing ``iterparse`` function. Default is to use :py:mod:`xml.etree.ElementTree` from the standard library. If you have to deal with malicious input, consider using a library such as `defusedxml.ElementTree`_. :raise: :py:class:`DeserializationException` if unexpected input :return: Instance of :py:class:`.types.GetAssetAdministrationShellsMetadataResult` read from :paramref:`stream` """ iterator = has_iterparse.iterparse(stream, ["start", "end"]) return get_asset_administration_shells_metadata_result_from_iterparse( _with_elements_cleared_after_yield(iterator) )
[docs]def get_asset_administration_shells_metadata_result_from_file( path: PathLike, has_iterparse: HasIterparse = xml.etree.ElementTree ) -> our_types.GetAssetAdministrationShellsMetadataResult: """ Read an instance of :py:class:`.types.GetAssetAdministrationShellsMetadataResult` from the :paramref:`path`. Example usage: .. code-block:: import pathlib import aas_core3_2.xmlization as our_xmlization path = pathlib.Path(...) instance = our_xmlization.get_asset_administration_shells_metadata_result_from_file( path ) # Do something with the ``instance`` :param path: to the file representing an instance of :py:class:`.types.GetAssetAdministrationShellsMetadataResult` in XML :param has_iterparse: Module containing ``iterparse`` function. Default is to use :py:mod:`xml.etree.ElementTree` from the standard library. If you have to deal with malicious input, consider using a library such as `defusedxml.ElementTree`_. :raise: :py:class:`DeserializationException` if unexpected input :return: Instance of :py:class:`.types.GetAssetAdministrationShellsMetadataResult` read from :paramref:`path` """ with open(os.fspath(path), encoding="utf-8") as fid: iterator = has_iterparse.iterparse(fid, ["start", "end"]) return get_asset_administration_shells_metadata_result_from_iterparse( _with_elements_cleared_after_yield(iterator) )
[docs]def get_asset_administration_shells_metadata_result_from_str( text: str, has_iterparse: HasIterparse = xml.etree.ElementTree ) -> our_types.GetAssetAdministrationShellsMetadataResult: """ Read an instance of :py:class:`.types.GetAssetAdministrationShellsMetadataResult` from the :paramref:`text`. Example usage: .. code-block:: import pathlib import aas_core3_2.xmlization as our_xmlization text = "<...>...</...>" instance = our_xmlization.get_asset_administration_shells_metadata_result_from_str( text ) # Do something with the ``instance`` :param text: representing an instance of :py:class:`.types.GetAssetAdministrationShellsMetadataResult` in XML :param has_iterparse: Module containing ``iterparse`` function. Default is to use :py:mod:`xml.etree.ElementTree` from the standard library. If you have to deal with malicious input, consider using a library such as `defusedxml.ElementTree`_. :raise: :py:class:`DeserializationException` if unexpected input :return: Instance of :py:class:`.types.GetAssetAdministrationShellsMetadataResult` read from :paramref:`text` """ iterator = has_iterparse.iterparse(io.StringIO(text), ["start", "end"]) return get_asset_administration_shells_metadata_result_from_iterparse( _with_elements_cleared_after_yield(iterator) )
[docs]def get_all_asset_administration_shells_recent_changes_result_from_iterparse( iterator: Iterator[Tuple[str, Element]], ) -> our_types.GetAllAssetAdministrationShellsRecentChangesResult: """ Read an instance of :py:class:`.types.GetAllAssetAdministrationShellsRecentChangesResult` from the :paramref:`iterator`. Example usage: .. code-block:: import pathlib import xml.etree.ElementTree as ET import aas_core3_2.xmlization as our_xmlization path = pathlib.Path(...) with path.open("rt") as fid: iterator = ET.iterparse( source=fid, events=['start', 'end'] ) instance = our_xmlization.get_all_asset_administration_shells_recent_changes_result_from_iterparse( iterator ) # Do something with the ``instance`` :param iterator: Input stream of ``(event, element)`` coming from :py:func:`xml.etree.ElementTree.iterparse` with the argument ``events=["start", "end"]`` :raise: :py:class:`DeserializationException` if unexpected input :return: Instance of :py:class:`.types.GetAllAssetAdministrationShellsRecentChangesResult` read from :paramref:`iterator` """ return _read_instance_from_iterparse( iterator, _read_get_all_asset_administration_shells_recent_changes_result_as_element, "GetAllAssetAdministrationShellsRecentChangesResult", )
[docs]def get_all_asset_administration_shells_recent_changes_result_from_stream( stream: TextIO, has_iterparse: HasIterparse = xml.etree.ElementTree ) -> our_types.GetAllAssetAdministrationShellsRecentChangesResult: """ Read an instance of :py:class:`.types.GetAllAssetAdministrationShellsRecentChangesResult` from the :paramref:`stream`. Example usage: .. code-block:: import aas_core3_2.xmlization as our_xmlization with open_some_stream_over_network(...) as stream: instance = our_xmlization.get_all_asset_administration_shells_recent_changes_result_from_stream( stream ) # Do something with the ``instance`` :param stream: representing an instance of :py:class:`.types.GetAllAssetAdministrationShellsRecentChangesResult` in XML :param has_iterparse: Module containing ``iterparse`` function. Default is to use :py:mod:`xml.etree.ElementTree` from the standard library. If you have to deal with malicious input, consider using a library such as `defusedxml.ElementTree`_. :raise: :py:class:`DeserializationException` if unexpected input :return: Instance of :py:class:`.types.GetAllAssetAdministrationShellsRecentChangesResult` read from :paramref:`stream` """ iterator = has_iterparse.iterparse(stream, ["start", "end"]) return get_all_asset_administration_shells_recent_changes_result_from_iterparse( _with_elements_cleared_after_yield(iterator) )
[docs]def get_all_asset_administration_shells_recent_changes_result_from_file( path: PathLike, has_iterparse: HasIterparse = xml.etree.ElementTree ) -> our_types.GetAllAssetAdministrationShellsRecentChangesResult: """ Read an instance of :py:class:`.types.GetAllAssetAdministrationShellsRecentChangesResult` from the :paramref:`path`. Example usage: .. code-block:: import pathlib import aas_core3_2.xmlization as our_xmlization path = pathlib.Path(...) instance = our_xmlization.get_all_asset_administration_shells_recent_changes_result_from_file( path ) # Do something with the ``instance`` :param path: to the file representing an instance of :py:class:`.types.GetAllAssetAdministrationShellsRecentChangesResult` in XML :param has_iterparse: Module containing ``iterparse`` function. Default is to use :py:mod:`xml.etree.ElementTree` from the standard library. If you have to deal with malicious input, consider using a library such as `defusedxml.ElementTree`_. :raise: :py:class:`DeserializationException` if unexpected input :return: Instance of :py:class:`.types.GetAllAssetAdministrationShellsRecentChangesResult` read from :paramref:`path` """ with open(os.fspath(path), encoding="utf-8") as fid: iterator = has_iterparse.iterparse(fid, ["start", "end"]) return get_all_asset_administration_shells_recent_changes_result_from_iterparse( _with_elements_cleared_after_yield(iterator) )
[docs]def get_all_asset_administration_shells_recent_changes_result_from_str( text: str, has_iterparse: HasIterparse = xml.etree.ElementTree ) -> our_types.GetAllAssetAdministrationShellsRecentChangesResult: """ Read an instance of :py:class:`.types.GetAllAssetAdministrationShellsRecentChangesResult` from the :paramref:`text`. Example usage: .. code-block:: import pathlib import aas_core3_2.xmlization as our_xmlization text = "<...>...</...>" instance = our_xmlization.get_all_asset_administration_shells_recent_changes_result_from_str( text ) # Do something with the ``instance`` :param text: representing an instance of :py:class:`.types.GetAllAssetAdministrationShellsRecentChangesResult` in XML :param has_iterparse: Module containing ``iterparse`` function. Default is to use :py:mod:`xml.etree.ElementTree` from the standard library. If you have to deal with malicious input, consider using a library such as `defusedxml.ElementTree`_. :raise: :py:class:`DeserializationException` if unexpected input :return: Instance of :py:class:`.types.GetAllAssetAdministrationShellsRecentChangesResult` read from :paramref:`text` """ iterator = has_iterparse.iterparse(io.StringIO(text), ["start", "end"]) return get_all_asset_administration_shells_recent_changes_result_from_iterparse( _with_elements_cleared_after_yield(iterator) )
[docs]def get_asset_administration_shell_descriptors_result_from_iterparse( iterator: Iterator[Tuple[str, Element]], ) -> our_types.GetAssetAdministrationShellDescriptorsResult: """ Read an instance of :py:class:`.types.GetAssetAdministrationShellDescriptorsResult` from the :paramref:`iterator`. Example usage: .. code-block:: import pathlib import xml.etree.ElementTree as ET import aas_core3_2.xmlization as our_xmlization path = pathlib.Path(...) with path.open("rt") as fid: iterator = ET.iterparse( source=fid, events=['start', 'end'] ) instance = our_xmlization.get_asset_administration_shell_descriptors_result_from_iterparse( iterator ) # Do something with the ``instance`` :param iterator: Input stream of ``(event, element)`` coming from :py:func:`xml.etree.ElementTree.iterparse` with the argument ``events=["start", "end"]`` :raise: :py:class:`DeserializationException` if unexpected input :return: Instance of :py:class:`.types.GetAssetAdministrationShellDescriptorsResult` read from :paramref:`iterator` """ return _read_instance_from_iterparse( iterator, _read_get_asset_administration_shell_descriptors_result_as_element, "GetAssetAdministrationShellDescriptorsResult", )
[docs]def get_asset_administration_shell_descriptors_result_from_stream( stream: TextIO, has_iterparse: HasIterparse = xml.etree.ElementTree ) -> our_types.GetAssetAdministrationShellDescriptorsResult: """ Read an instance of :py:class:`.types.GetAssetAdministrationShellDescriptorsResult` from the :paramref:`stream`. Example usage: .. code-block:: import aas_core3_2.xmlization as our_xmlization with open_some_stream_over_network(...) as stream: instance = our_xmlization.get_asset_administration_shell_descriptors_result_from_stream( stream ) # Do something with the ``instance`` :param stream: representing an instance of :py:class:`.types.GetAssetAdministrationShellDescriptorsResult` in XML :param has_iterparse: Module containing ``iterparse`` function. Default is to use :py:mod:`xml.etree.ElementTree` from the standard library. If you have to deal with malicious input, consider using a library such as `defusedxml.ElementTree`_. :raise: :py:class:`DeserializationException` if unexpected input :return: Instance of :py:class:`.types.GetAssetAdministrationShellDescriptorsResult` read from :paramref:`stream` """ iterator = has_iterparse.iterparse(stream, ["start", "end"]) return get_asset_administration_shell_descriptors_result_from_iterparse( _with_elements_cleared_after_yield(iterator) )
[docs]def get_asset_administration_shell_descriptors_result_from_file( path: PathLike, has_iterparse: HasIterparse = xml.etree.ElementTree ) -> our_types.GetAssetAdministrationShellDescriptorsResult: """ Read an instance of :py:class:`.types.GetAssetAdministrationShellDescriptorsResult` from the :paramref:`path`. Example usage: .. code-block:: import pathlib import aas_core3_2.xmlization as our_xmlization path = pathlib.Path(...) instance = our_xmlization.get_asset_administration_shell_descriptors_result_from_file( path ) # Do something with the ``instance`` :param path: to the file representing an instance of :py:class:`.types.GetAssetAdministrationShellDescriptorsResult` in XML :param has_iterparse: Module containing ``iterparse`` function. Default is to use :py:mod:`xml.etree.ElementTree` from the standard library. If you have to deal with malicious input, consider using a library such as `defusedxml.ElementTree`_. :raise: :py:class:`DeserializationException` if unexpected input :return: Instance of :py:class:`.types.GetAssetAdministrationShellDescriptorsResult` read from :paramref:`path` """ with open(os.fspath(path), encoding="utf-8") as fid: iterator = has_iterparse.iterparse(fid, ["start", "end"]) return get_asset_administration_shell_descriptors_result_from_iterparse( _with_elements_cleared_after_yield(iterator) )
[docs]def get_asset_administration_shell_descriptors_result_from_str( text: str, has_iterparse: HasIterparse = xml.etree.ElementTree ) -> our_types.GetAssetAdministrationShellDescriptorsResult: """ Read an instance of :py:class:`.types.GetAssetAdministrationShellDescriptorsResult` from the :paramref:`text`. Example usage: .. code-block:: import pathlib import aas_core3_2.xmlization as our_xmlization text = "<...>...</...>" instance = our_xmlization.get_asset_administration_shell_descriptors_result_from_str( text ) # Do something with the ``instance`` :param text: representing an instance of :py:class:`.types.GetAssetAdministrationShellDescriptorsResult` in XML :param has_iterparse: Module containing ``iterparse`` function. Default is to use :py:mod:`xml.etree.ElementTree` from the standard library. If you have to deal with malicious input, consider using a library such as `defusedxml.ElementTree`_. :raise: :py:class:`DeserializationException` if unexpected input :return: Instance of :py:class:`.types.GetAssetAdministrationShellDescriptorsResult` read from :paramref:`text` """ iterator = has_iterparse.iterparse(io.StringIO(text), ["start", "end"]) return get_asset_administration_shell_descriptors_result_from_iterparse( _with_elements_cleared_after_yield(iterator) )
[docs]def get_concept_descriptions_result_from_iterparse( iterator: Iterator[Tuple[str, Element]], ) -> our_types.GetConceptDescriptionsResult: """ Read an instance of :py:class:`.types.GetConceptDescriptionsResult` from the :paramref:`iterator`. Example usage: .. code-block:: import pathlib import xml.etree.ElementTree as ET import aas_core3_2.xmlization as our_xmlization path = pathlib.Path(...) with path.open("rt") as fid: iterator = ET.iterparse( source=fid, events=['start', 'end'] ) instance = our_xmlization.get_concept_descriptions_result_from_iterparse( iterator ) # Do something with the ``instance`` :param iterator: Input stream of ``(event, element)`` coming from :py:func:`xml.etree.ElementTree.iterparse` with the argument ``events=["start", "end"]`` :raise: :py:class:`DeserializationException` if unexpected input :return: Instance of :py:class:`.types.GetConceptDescriptionsResult` read from :paramref:`iterator` """ return _read_instance_from_iterparse( iterator, _read_get_concept_descriptions_result_as_element, "GetConceptDescriptionsResult", )
[docs]def get_concept_descriptions_result_from_stream( stream: TextIO, has_iterparse: HasIterparse = xml.etree.ElementTree ) -> our_types.GetConceptDescriptionsResult: """ Read an instance of :py:class:`.types.GetConceptDescriptionsResult` from the :paramref:`stream`. Example usage: .. code-block:: import aas_core3_2.xmlization as our_xmlization with open_some_stream_over_network(...) as stream: instance = our_xmlization.get_concept_descriptions_result_from_stream( stream ) # Do something with the ``instance`` :param stream: representing an instance of :py:class:`.types.GetConceptDescriptionsResult` in XML :param has_iterparse: Module containing ``iterparse`` function. Default is to use :py:mod:`xml.etree.ElementTree` from the standard library. If you have to deal with malicious input, consider using a library such as `defusedxml.ElementTree`_. :raise: :py:class:`DeserializationException` if unexpected input :return: Instance of :py:class:`.types.GetConceptDescriptionsResult` read from :paramref:`stream` """ iterator = has_iterparse.iterparse(stream, ["start", "end"]) return get_concept_descriptions_result_from_iterparse( _with_elements_cleared_after_yield(iterator) )
[docs]def get_concept_descriptions_result_from_file( path: PathLike, has_iterparse: HasIterparse = xml.etree.ElementTree ) -> our_types.GetConceptDescriptionsResult: """ Read an instance of :py:class:`.types.GetConceptDescriptionsResult` from the :paramref:`path`. Example usage: .. code-block:: import pathlib import aas_core3_2.xmlization as our_xmlization path = pathlib.Path(...) instance = our_xmlization.get_concept_descriptions_result_from_file( path ) # Do something with the ``instance`` :param path: to the file representing an instance of :py:class:`.types.GetConceptDescriptionsResult` in XML :param has_iterparse: Module containing ``iterparse`` function. Default is to use :py:mod:`xml.etree.ElementTree` from the standard library. If you have to deal with malicious input, consider using a library such as `defusedxml.ElementTree`_. :raise: :py:class:`DeserializationException` if unexpected input :return: Instance of :py:class:`.types.GetConceptDescriptionsResult` read from :paramref:`path` """ with open(os.fspath(path), encoding="utf-8") as fid: iterator = has_iterparse.iterparse(fid, ["start", "end"]) return get_concept_descriptions_result_from_iterparse( _with_elements_cleared_after_yield(iterator) )
[docs]def get_concept_descriptions_result_from_str( text: str, has_iterparse: HasIterparse = xml.etree.ElementTree ) -> our_types.GetConceptDescriptionsResult: """ Read an instance of :py:class:`.types.GetConceptDescriptionsResult` from the :paramref:`text`. Example usage: .. code-block:: import pathlib import aas_core3_2.xmlization as our_xmlization text = "<...>...</...>" instance = our_xmlization.get_concept_descriptions_result_from_str( text ) # Do something with the ``instance`` :param text: representing an instance of :py:class:`.types.GetConceptDescriptionsResult` in XML :param has_iterparse: Module containing ``iterparse`` function. Default is to use :py:mod:`xml.etree.ElementTree` from the standard library. If you have to deal with malicious input, consider using a library such as `defusedxml.ElementTree`_. :raise: :py:class:`DeserializationException` if unexpected input :return: Instance of :py:class:`.types.GetConceptDescriptionsResult` read from :paramref:`text` """ iterator = has_iterparse.iterparse(io.StringIO(text), ["start", "end"]) return get_concept_descriptions_result_from_iterparse( _with_elements_cleared_after_yield(iterator) )
[docs]def get_all_concept_descriptions_recent_changes_result_from_iterparse( iterator: Iterator[Tuple[str, Element]], ) -> our_types.GetAllConceptDescriptionsRecentChangesResult: """ Read an instance of :py:class:`.types.GetAllConceptDescriptionsRecentChangesResult` from the :paramref:`iterator`. Example usage: .. code-block:: import pathlib import xml.etree.ElementTree as ET import aas_core3_2.xmlization as our_xmlization path = pathlib.Path(...) with path.open("rt") as fid: iterator = ET.iterparse( source=fid, events=['start', 'end'] ) instance = our_xmlization.get_all_concept_descriptions_recent_changes_result_from_iterparse( iterator ) # Do something with the ``instance`` :param iterator: Input stream of ``(event, element)`` coming from :py:func:`xml.etree.ElementTree.iterparse` with the argument ``events=["start", "end"]`` :raise: :py:class:`DeserializationException` if unexpected input :return: Instance of :py:class:`.types.GetAllConceptDescriptionsRecentChangesResult` read from :paramref:`iterator` """ return _read_instance_from_iterparse( iterator, _read_get_all_concept_descriptions_recent_changes_result_as_element, "GetAllConceptDescriptionsRecentChangesResult", )
[docs]def get_all_concept_descriptions_recent_changes_result_from_stream( stream: TextIO, has_iterparse: HasIterparse = xml.etree.ElementTree ) -> our_types.GetAllConceptDescriptionsRecentChangesResult: """ Read an instance of :py:class:`.types.GetAllConceptDescriptionsRecentChangesResult` from the :paramref:`stream`. Example usage: .. code-block:: import aas_core3_2.xmlization as our_xmlization with open_some_stream_over_network(...) as stream: instance = our_xmlization.get_all_concept_descriptions_recent_changes_result_from_stream( stream ) # Do something with the ``instance`` :param stream: representing an instance of :py:class:`.types.GetAllConceptDescriptionsRecentChangesResult` in XML :param has_iterparse: Module containing ``iterparse`` function. Default is to use :py:mod:`xml.etree.ElementTree` from the standard library. If you have to deal with malicious input, consider using a library such as `defusedxml.ElementTree`_. :raise: :py:class:`DeserializationException` if unexpected input :return: Instance of :py:class:`.types.GetAllConceptDescriptionsRecentChangesResult` read from :paramref:`stream` """ iterator = has_iterparse.iterparse(stream, ["start", "end"]) return get_all_concept_descriptions_recent_changes_result_from_iterparse( _with_elements_cleared_after_yield(iterator) )
[docs]def get_all_concept_descriptions_recent_changes_result_from_file( path: PathLike, has_iterparse: HasIterparse = xml.etree.ElementTree ) -> our_types.GetAllConceptDescriptionsRecentChangesResult: """ Read an instance of :py:class:`.types.GetAllConceptDescriptionsRecentChangesResult` from the :paramref:`path`. Example usage: .. code-block:: import pathlib import aas_core3_2.xmlization as our_xmlization path = pathlib.Path(...) instance = our_xmlization.get_all_concept_descriptions_recent_changes_result_from_file( path ) # Do something with the ``instance`` :param path: to the file representing an instance of :py:class:`.types.GetAllConceptDescriptionsRecentChangesResult` in XML :param has_iterparse: Module containing ``iterparse`` function. Default is to use :py:mod:`xml.etree.ElementTree` from the standard library. If you have to deal with malicious input, consider using a library such as `defusedxml.ElementTree`_. :raise: :py:class:`DeserializationException` if unexpected input :return: Instance of :py:class:`.types.GetAllConceptDescriptionsRecentChangesResult` read from :paramref:`path` """ with open(os.fspath(path), encoding="utf-8") as fid: iterator = has_iterparse.iterparse(fid, ["start", "end"]) return get_all_concept_descriptions_recent_changes_result_from_iterparse( _with_elements_cleared_after_yield(iterator) )
[docs]def get_all_concept_descriptions_recent_changes_result_from_str( text: str, has_iterparse: HasIterparse = xml.etree.ElementTree ) -> our_types.GetAllConceptDescriptionsRecentChangesResult: """ Read an instance of :py:class:`.types.GetAllConceptDescriptionsRecentChangesResult` from the :paramref:`text`. Example usage: .. code-block:: import pathlib import aas_core3_2.xmlization as our_xmlization text = "<...>...</...>" instance = our_xmlization.get_all_concept_descriptions_recent_changes_result_from_str( text ) # Do something with the ``instance`` :param text: representing an instance of :py:class:`.types.GetAllConceptDescriptionsRecentChangesResult` in XML :param has_iterparse: Module containing ``iterparse`` function. Default is to use :py:mod:`xml.etree.ElementTree` from the standard library. If you have to deal with malicious input, consider using a library such as `defusedxml.ElementTree`_. :raise: :py:class:`DeserializationException` if unexpected input :return: Instance of :py:class:`.types.GetAllConceptDescriptionsRecentChangesResult` read from :paramref:`text` """ iterator = has_iterparse.iterparse(io.StringIO(text), ["start", "end"]) return get_all_concept_descriptions_recent_changes_result_from_iterparse( _with_elements_cleared_after_yield(iterator) )
[docs]def get_package_descriptions_result_from_iterparse( iterator: Iterator[Tuple[str, Element]], ) -> our_types.GetPackageDescriptionsResult: """ Read an instance of :py:class:`.types.GetPackageDescriptionsResult` from the :paramref:`iterator`. Example usage: .. code-block:: import pathlib import xml.etree.ElementTree as ET import aas_core3_2.xmlization as our_xmlization path = pathlib.Path(...) with path.open("rt") as fid: iterator = ET.iterparse( source=fid, events=['start', 'end'] ) instance = our_xmlization.get_package_descriptions_result_from_iterparse( iterator ) # Do something with the ``instance`` :param iterator: Input stream of ``(event, element)`` coming from :py:func:`xml.etree.ElementTree.iterparse` with the argument ``events=["start", "end"]`` :raise: :py:class:`DeserializationException` if unexpected input :return: Instance of :py:class:`.types.GetPackageDescriptionsResult` read from :paramref:`iterator` """ return _read_instance_from_iterparse( iterator, _read_get_package_descriptions_result_as_element, "GetPackageDescriptionsResult", )
[docs]def get_package_descriptions_result_from_stream( stream: TextIO, has_iterparse: HasIterparse = xml.etree.ElementTree ) -> our_types.GetPackageDescriptionsResult: """ Read an instance of :py:class:`.types.GetPackageDescriptionsResult` from the :paramref:`stream`. Example usage: .. code-block:: import aas_core3_2.xmlization as our_xmlization with open_some_stream_over_network(...) as stream: instance = our_xmlization.get_package_descriptions_result_from_stream( stream ) # Do something with the ``instance`` :param stream: representing an instance of :py:class:`.types.GetPackageDescriptionsResult` in XML :param has_iterparse: Module containing ``iterparse`` function. Default is to use :py:mod:`xml.etree.ElementTree` from the standard library. If you have to deal with malicious input, consider using a library such as `defusedxml.ElementTree`_. :raise: :py:class:`DeserializationException` if unexpected input :return: Instance of :py:class:`.types.GetPackageDescriptionsResult` read from :paramref:`stream` """ iterator = has_iterparse.iterparse(stream, ["start", "end"]) return get_package_descriptions_result_from_iterparse( _with_elements_cleared_after_yield(iterator) )
[docs]def get_package_descriptions_result_from_file( path: PathLike, has_iterparse: HasIterparse = xml.etree.ElementTree ) -> our_types.GetPackageDescriptionsResult: """ Read an instance of :py:class:`.types.GetPackageDescriptionsResult` from the :paramref:`path`. Example usage: .. code-block:: import pathlib import aas_core3_2.xmlization as our_xmlization path = pathlib.Path(...) instance = our_xmlization.get_package_descriptions_result_from_file( path ) # Do something with the ``instance`` :param path: to the file representing an instance of :py:class:`.types.GetPackageDescriptionsResult` in XML :param has_iterparse: Module containing ``iterparse`` function. Default is to use :py:mod:`xml.etree.ElementTree` from the standard library. If you have to deal with malicious input, consider using a library such as `defusedxml.ElementTree`_. :raise: :py:class:`DeserializationException` if unexpected input :return: Instance of :py:class:`.types.GetPackageDescriptionsResult` read from :paramref:`path` """ with open(os.fspath(path), encoding="utf-8") as fid: iterator = has_iterparse.iterparse(fid, ["start", "end"]) return get_package_descriptions_result_from_iterparse( _with_elements_cleared_after_yield(iterator) )
[docs]def get_package_descriptions_result_from_str( text: str, has_iterparse: HasIterparse = xml.etree.ElementTree ) -> our_types.GetPackageDescriptionsResult: """ Read an instance of :py:class:`.types.GetPackageDescriptionsResult` from the :paramref:`text`. Example usage: .. code-block:: import pathlib import aas_core3_2.xmlization as our_xmlization text = "<...>...</...>" instance = our_xmlization.get_package_descriptions_result_from_str( text ) # Do something with the ``instance`` :param text: representing an instance of :py:class:`.types.GetPackageDescriptionsResult` in XML :param has_iterparse: Module containing ``iterparse`` function. Default is to use :py:mod:`xml.etree.ElementTree` from the standard library. If you have to deal with malicious input, consider using a library such as `defusedxml.ElementTree`_. :raise: :py:class:`DeserializationException` if unexpected input :return: Instance of :py:class:`.types.GetPackageDescriptionsResult` read from :paramref:`text` """ iterator = has_iterparse.iterparse(io.StringIO(text), ["start", "end"]) return get_package_descriptions_result_from_iterparse( _with_elements_cleared_after_yield(iterator) )
[docs]def get_path_items_result_from_iterparse( iterator: Iterator[Tuple[str, Element]], ) -> our_types.GetPathItemsResult: """ Read an instance of :py:class:`.types.GetPathItemsResult` from the :paramref:`iterator`. Example usage: .. code-block:: import pathlib import xml.etree.ElementTree as ET import aas_core3_2.xmlization as our_xmlization path = pathlib.Path(...) with path.open("rt") as fid: iterator = ET.iterparse( source=fid, events=['start', 'end'] ) instance = our_xmlization.get_path_items_result_from_iterparse( iterator ) # Do something with the ``instance`` :param iterator: Input stream of ``(event, element)`` coming from :py:func:`xml.etree.ElementTree.iterparse` with the argument ``events=["start", "end"]`` :raise: :py:class:`DeserializationException` if unexpected input :return: Instance of :py:class:`.types.GetPathItemsResult` read from :paramref:`iterator` """ return _read_instance_from_iterparse( iterator, _read_get_path_items_result_as_element, "GetPathItemsResult" )
[docs]def get_path_items_result_from_stream( stream: TextIO, has_iterparse: HasIterparse = xml.etree.ElementTree ) -> our_types.GetPathItemsResult: """ Read an instance of :py:class:`.types.GetPathItemsResult` from the :paramref:`stream`. Example usage: .. code-block:: import aas_core3_2.xmlization as our_xmlization with open_some_stream_over_network(...) as stream: instance = our_xmlization.get_path_items_result_from_stream( stream ) # Do something with the ``instance`` :param stream: representing an instance of :py:class:`.types.GetPathItemsResult` in XML :param has_iterparse: Module containing ``iterparse`` function. Default is to use :py:mod:`xml.etree.ElementTree` from the standard library. If you have to deal with malicious input, consider using a library such as `defusedxml.ElementTree`_. :raise: :py:class:`DeserializationException` if unexpected input :return: Instance of :py:class:`.types.GetPathItemsResult` read from :paramref:`stream` """ iterator = has_iterparse.iterparse(stream, ["start", "end"]) return get_path_items_result_from_iterparse( _with_elements_cleared_after_yield(iterator) )
[docs]def get_path_items_result_from_file( path: PathLike, has_iterparse: HasIterparse = xml.etree.ElementTree ) -> our_types.GetPathItemsResult: """ Read an instance of :py:class:`.types.GetPathItemsResult` from the :paramref:`path`. Example usage: .. code-block:: import pathlib import aas_core3_2.xmlization as our_xmlization path = pathlib.Path(...) instance = our_xmlization.get_path_items_result_from_file( path ) # Do something with the ``instance`` :param path: to the file representing an instance of :py:class:`.types.GetPathItemsResult` in XML :param has_iterparse: Module containing ``iterparse`` function. Default is to use :py:mod:`xml.etree.ElementTree` from the standard library. If you have to deal with malicious input, consider using a library such as `defusedxml.ElementTree`_. :raise: :py:class:`DeserializationException` if unexpected input :return: Instance of :py:class:`.types.GetPathItemsResult` read from :paramref:`path` """ with open(os.fspath(path), encoding="utf-8") as fid: iterator = has_iterparse.iterparse(fid, ["start", "end"]) return get_path_items_result_from_iterparse( _with_elements_cleared_after_yield(iterator) )
[docs]def get_path_items_result_from_str( text: str, has_iterparse: HasIterparse = xml.etree.ElementTree ) -> our_types.GetPathItemsResult: """ Read an instance of :py:class:`.types.GetPathItemsResult` from the :paramref:`text`. Example usage: .. code-block:: import pathlib import aas_core3_2.xmlization as our_xmlization text = "<...>...</...>" instance = our_xmlization.get_path_items_result_from_str( text ) # Do something with the ``instance`` :param text: representing an instance of :py:class:`.types.GetPathItemsResult` in XML :param has_iterparse: Module containing ``iterparse`` function. Default is to use :py:mod:`xml.etree.ElementTree` from the standard library. If you have to deal with malicious input, consider using a library such as `defusedxml.ElementTree`_. :raise: :py:class:`DeserializationException` if unexpected input :return: Instance of :py:class:`.types.GetPathItemsResult` read from :paramref:`text` """ iterator = has_iterparse.iterparse(io.StringIO(text), ["start", "end"]) return get_path_items_result_from_iterparse( _with_elements_cleared_after_yield(iterator) )
[docs]def get_references_result_from_iterparse( iterator: Iterator[Tuple[str, Element]], ) -> our_types.GetReferencesResult: """ Read an instance of :py:class:`.types.GetReferencesResult` from the :paramref:`iterator`. Example usage: .. code-block:: import pathlib import xml.etree.ElementTree as ET import aas_core3_2.xmlization as our_xmlization path = pathlib.Path(...) with path.open("rt") as fid: iterator = ET.iterparse( source=fid, events=['start', 'end'] ) instance = our_xmlization.get_references_result_from_iterparse( iterator ) # Do something with the ``instance`` :param iterator: Input stream of ``(event, element)`` coming from :py:func:`xml.etree.ElementTree.iterparse` with the argument ``events=["start", "end"]`` :raise: :py:class:`DeserializationException` if unexpected input :return: Instance of :py:class:`.types.GetReferencesResult` read from :paramref:`iterator` """ return _read_instance_from_iterparse( iterator, _read_get_references_result_as_element, "GetReferencesResult" )
[docs]def get_references_result_from_stream( stream: TextIO, has_iterparse: HasIterparse = xml.etree.ElementTree ) -> our_types.GetReferencesResult: """ Read an instance of :py:class:`.types.GetReferencesResult` from the :paramref:`stream`. Example usage: .. code-block:: import aas_core3_2.xmlization as our_xmlization with open_some_stream_over_network(...) as stream: instance = our_xmlization.get_references_result_from_stream( stream ) # Do something with the ``instance`` :param stream: representing an instance of :py:class:`.types.GetReferencesResult` in XML :param has_iterparse: Module containing ``iterparse`` function. Default is to use :py:mod:`xml.etree.ElementTree` from the standard library. If you have to deal with malicious input, consider using a library such as `defusedxml.ElementTree`_. :raise: :py:class:`DeserializationException` if unexpected input :return: Instance of :py:class:`.types.GetReferencesResult` read from :paramref:`stream` """ iterator = has_iterparse.iterparse(stream, ["start", "end"]) return get_references_result_from_iterparse( _with_elements_cleared_after_yield(iterator) )
[docs]def get_references_result_from_file( path: PathLike, has_iterparse: HasIterparse = xml.etree.ElementTree ) -> our_types.GetReferencesResult: """ Read an instance of :py:class:`.types.GetReferencesResult` from the :paramref:`path`. Example usage: .. code-block:: import pathlib import aas_core3_2.xmlization as our_xmlization path = pathlib.Path(...) instance = our_xmlization.get_references_result_from_file( path ) # Do something with the ``instance`` :param path: to the file representing an instance of :py:class:`.types.GetReferencesResult` in XML :param has_iterparse: Module containing ``iterparse`` function. Default is to use :py:mod:`xml.etree.ElementTree` from the standard library. If you have to deal with malicious input, consider using a library such as `defusedxml.ElementTree`_. :raise: :py:class:`DeserializationException` if unexpected input :return: Instance of :py:class:`.types.GetReferencesResult` read from :paramref:`path` """ with open(os.fspath(path), encoding="utf-8") as fid: iterator = has_iterparse.iterparse(fid, ["start", "end"]) return get_references_result_from_iterparse( _with_elements_cleared_after_yield(iterator) )
[docs]def get_references_result_from_str( text: str, has_iterparse: HasIterparse = xml.etree.ElementTree ) -> our_types.GetReferencesResult: """ Read an instance of :py:class:`.types.GetReferencesResult` from the :paramref:`text`. Example usage: .. code-block:: import pathlib import aas_core3_2.xmlization as our_xmlization text = "<...>...</...>" instance = our_xmlization.get_references_result_from_str( text ) # Do something with the ``instance`` :param text: representing an instance of :py:class:`.types.GetReferencesResult` in XML :param has_iterparse: Module containing ``iterparse`` function. Default is to use :py:mod:`xml.etree.ElementTree` from the standard library. If you have to deal with malicious input, consider using a library such as `defusedxml.ElementTree`_. :raise: :py:class:`DeserializationException` if unexpected input :return: Instance of :py:class:`.types.GetReferencesResult` read from :paramref:`text` """ iterator = has_iterparse.iterparse(io.StringIO(text), ["start", "end"]) return get_references_result_from_iterparse( _with_elements_cleared_after_yield(iterator) )
[docs]def get_submodel_descriptors_result_from_iterparse( iterator: Iterator[Tuple[str, Element]], ) -> our_types.GetSubmodelDescriptorsResult: """ Read an instance of :py:class:`.types.GetSubmodelDescriptorsResult` from the :paramref:`iterator`. Example usage: .. code-block:: import pathlib import xml.etree.ElementTree as ET import aas_core3_2.xmlization as our_xmlization path = pathlib.Path(...) with path.open("rt") as fid: iterator = ET.iterparse( source=fid, events=['start', 'end'] ) instance = our_xmlization.get_submodel_descriptors_result_from_iterparse( iterator ) # Do something with the ``instance`` :param iterator: Input stream of ``(event, element)`` coming from :py:func:`xml.etree.ElementTree.iterparse` with the argument ``events=["start", "end"]`` :raise: :py:class:`DeserializationException` if unexpected input :return: Instance of :py:class:`.types.GetSubmodelDescriptorsResult` read from :paramref:`iterator` """ return _read_instance_from_iterparse( iterator, _read_get_submodel_descriptors_result_as_element, "GetSubmodelDescriptorsResult", )
[docs]def get_submodel_descriptors_result_from_stream( stream: TextIO, has_iterparse: HasIterparse = xml.etree.ElementTree ) -> our_types.GetSubmodelDescriptorsResult: """ Read an instance of :py:class:`.types.GetSubmodelDescriptorsResult` from the :paramref:`stream`. Example usage: .. code-block:: import aas_core3_2.xmlization as our_xmlization with open_some_stream_over_network(...) as stream: instance = our_xmlization.get_submodel_descriptors_result_from_stream( stream ) # Do something with the ``instance`` :param stream: representing an instance of :py:class:`.types.GetSubmodelDescriptorsResult` in XML :param has_iterparse: Module containing ``iterparse`` function. Default is to use :py:mod:`xml.etree.ElementTree` from the standard library. If you have to deal with malicious input, consider using a library such as `defusedxml.ElementTree`_. :raise: :py:class:`DeserializationException` if unexpected input :return: Instance of :py:class:`.types.GetSubmodelDescriptorsResult` read from :paramref:`stream` """ iterator = has_iterparse.iterparse(stream, ["start", "end"]) return get_submodel_descriptors_result_from_iterparse( _with_elements_cleared_after_yield(iterator) )
[docs]def get_submodel_descriptors_result_from_file( path: PathLike, has_iterparse: HasIterparse = xml.etree.ElementTree ) -> our_types.GetSubmodelDescriptorsResult: """ Read an instance of :py:class:`.types.GetSubmodelDescriptorsResult` from the :paramref:`path`. Example usage: .. code-block:: import pathlib import aas_core3_2.xmlization as our_xmlization path = pathlib.Path(...) instance = our_xmlization.get_submodel_descriptors_result_from_file( path ) # Do something with the ``instance`` :param path: to the file representing an instance of :py:class:`.types.GetSubmodelDescriptorsResult` in XML :param has_iterparse: Module containing ``iterparse`` function. Default is to use :py:mod:`xml.etree.ElementTree` from the standard library. If you have to deal with malicious input, consider using a library such as `defusedxml.ElementTree`_. :raise: :py:class:`DeserializationException` if unexpected input :return: Instance of :py:class:`.types.GetSubmodelDescriptorsResult` read from :paramref:`path` """ with open(os.fspath(path), encoding="utf-8") as fid: iterator = has_iterparse.iterparse(fid, ["start", "end"]) return get_submodel_descriptors_result_from_iterparse( _with_elements_cleared_after_yield(iterator) )
[docs]def get_submodel_descriptors_result_from_str( text: str, has_iterparse: HasIterparse = xml.etree.ElementTree ) -> our_types.GetSubmodelDescriptorsResult: """ Read an instance of :py:class:`.types.GetSubmodelDescriptorsResult` from the :paramref:`text`. Example usage: .. code-block:: import pathlib import aas_core3_2.xmlization as our_xmlization text = "<...>...</...>" instance = our_xmlization.get_submodel_descriptors_result_from_str( text ) # Do something with the ``instance`` :param text: representing an instance of :py:class:`.types.GetSubmodelDescriptorsResult` in XML :param has_iterparse: Module containing ``iterparse`` function. Default is to use :py:mod:`xml.etree.ElementTree` from the standard library. If you have to deal with malicious input, consider using a library such as `defusedxml.ElementTree`_. :raise: :py:class:`DeserializationException` if unexpected input :return: Instance of :py:class:`.types.GetSubmodelDescriptorsResult` read from :paramref:`text` """ iterator = has_iterparse.iterparse(io.StringIO(text), ["start", "end"]) return get_submodel_descriptors_result_from_iterparse( _with_elements_cleared_after_yield(iterator) )
[docs]def get_submodel_elements_metadata_result_from_iterparse( iterator: Iterator[Tuple[str, Element]], ) -> our_types.GetSubmodelElementsMetadataResult: """ Read an instance of :py:class:`.types.GetSubmodelElementsMetadataResult` from the :paramref:`iterator`. Example usage: .. code-block:: import pathlib import xml.etree.ElementTree as ET import aas_core3_2.xmlization as our_xmlization path = pathlib.Path(...) with path.open("rt") as fid: iterator = ET.iterparse( source=fid, events=['start', 'end'] ) instance = our_xmlization.get_submodel_elements_metadata_result_from_iterparse( iterator ) # Do something with the ``instance`` :param iterator: Input stream of ``(event, element)`` coming from :py:func:`xml.etree.ElementTree.iterparse` with the argument ``events=["start", "end"]`` :raise: :py:class:`DeserializationException` if unexpected input :return: Instance of :py:class:`.types.GetSubmodelElementsMetadataResult` read from :paramref:`iterator` """ return _read_instance_from_iterparse( iterator, _read_get_submodel_elements_metadata_result_as_element, "GetSubmodelElementsMetadataResult", )
[docs]def get_submodel_elements_metadata_result_from_stream( stream: TextIO, has_iterparse: HasIterparse = xml.etree.ElementTree ) -> our_types.GetSubmodelElementsMetadataResult: """ Read an instance of :py:class:`.types.GetSubmodelElementsMetadataResult` from the :paramref:`stream`. Example usage: .. code-block:: import aas_core3_2.xmlization as our_xmlization with open_some_stream_over_network(...) as stream: instance = our_xmlization.get_submodel_elements_metadata_result_from_stream( stream ) # Do something with the ``instance`` :param stream: representing an instance of :py:class:`.types.GetSubmodelElementsMetadataResult` in XML :param has_iterparse: Module containing ``iterparse`` function. Default is to use :py:mod:`xml.etree.ElementTree` from the standard library. If you have to deal with malicious input, consider using a library such as `defusedxml.ElementTree`_. :raise: :py:class:`DeserializationException` if unexpected input :return: Instance of :py:class:`.types.GetSubmodelElementsMetadataResult` read from :paramref:`stream` """ iterator = has_iterparse.iterparse(stream, ["start", "end"]) return get_submodel_elements_metadata_result_from_iterparse( _with_elements_cleared_after_yield(iterator) )
[docs]def get_submodel_elements_metadata_result_from_file( path: PathLike, has_iterparse: HasIterparse = xml.etree.ElementTree ) -> our_types.GetSubmodelElementsMetadataResult: """ Read an instance of :py:class:`.types.GetSubmodelElementsMetadataResult` from the :paramref:`path`. Example usage: .. code-block:: import pathlib import aas_core3_2.xmlization as our_xmlization path = pathlib.Path(...) instance = our_xmlization.get_submodel_elements_metadata_result_from_file( path ) # Do something with the ``instance`` :param path: to the file representing an instance of :py:class:`.types.GetSubmodelElementsMetadataResult` in XML :param has_iterparse: Module containing ``iterparse`` function. Default is to use :py:mod:`xml.etree.ElementTree` from the standard library. If you have to deal with malicious input, consider using a library such as `defusedxml.ElementTree`_. :raise: :py:class:`DeserializationException` if unexpected input :return: Instance of :py:class:`.types.GetSubmodelElementsMetadataResult` read from :paramref:`path` """ with open(os.fspath(path), encoding="utf-8") as fid: iterator = has_iterparse.iterparse(fid, ["start", "end"]) return get_submodel_elements_metadata_result_from_iterparse( _with_elements_cleared_after_yield(iterator) )
[docs]def get_submodel_elements_metadata_result_from_str( text: str, has_iterparse: HasIterparse = xml.etree.ElementTree ) -> our_types.GetSubmodelElementsMetadataResult: """ Read an instance of :py:class:`.types.GetSubmodelElementsMetadataResult` from the :paramref:`text`. Example usage: .. code-block:: import pathlib import aas_core3_2.xmlization as our_xmlization text = "<...>...</...>" instance = our_xmlization.get_submodel_elements_metadata_result_from_str( text ) # Do something with the ``instance`` :param text: representing an instance of :py:class:`.types.GetSubmodelElementsMetadataResult` in XML :param has_iterparse: Module containing ``iterparse`` function. Default is to use :py:mod:`xml.etree.ElementTree` from the standard library. If you have to deal with malicious input, consider using a library such as `defusedxml.ElementTree`_. :raise: :py:class:`DeserializationException` if unexpected input :return: Instance of :py:class:`.types.GetSubmodelElementsMetadataResult` read from :paramref:`text` """ iterator = has_iterparse.iterparse(io.StringIO(text), ["start", "end"]) return get_submodel_elements_metadata_result_from_iterparse( _with_elements_cleared_after_yield(iterator) )
[docs]def get_submodel_elements_result_from_iterparse( iterator: Iterator[Tuple[str, Element]], ) -> our_types.GetSubmodelElementsResult: """ Read an instance of :py:class:`.types.GetSubmodelElementsResult` from the :paramref:`iterator`. Example usage: .. code-block:: import pathlib import xml.etree.ElementTree as ET import aas_core3_2.xmlization as our_xmlization path = pathlib.Path(...) with path.open("rt") as fid: iterator = ET.iterparse( source=fid, events=['start', 'end'] ) instance = our_xmlization.get_submodel_elements_result_from_iterparse( iterator ) # Do something with the ``instance`` :param iterator: Input stream of ``(event, element)`` coming from :py:func:`xml.etree.ElementTree.iterparse` with the argument ``events=["start", "end"]`` :raise: :py:class:`DeserializationException` if unexpected input :return: Instance of :py:class:`.types.GetSubmodelElementsResult` read from :paramref:`iterator` """ return _read_instance_from_iterparse( iterator, _read_get_submodel_elements_result_as_element, "GetSubmodelElementsResult", )
[docs]def get_submodel_elements_result_from_stream( stream: TextIO, has_iterparse: HasIterparse = xml.etree.ElementTree ) -> our_types.GetSubmodelElementsResult: """ Read an instance of :py:class:`.types.GetSubmodelElementsResult` from the :paramref:`stream`. Example usage: .. code-block:: import aas_core3_2.xmlization as our_xmlization with open_some_stream_over_network(...) as stream: instance = our_xmlization.get_submodel_elements_result_from_stream( stream ) # Do something with the ``instance`` :param stream: representing an instance of :py:class:`.types.GetSubmodelElementsResult` in XML :param has_iterparse: Module containing ``iterparse`` function. Default is to use :py:mod:`xml.etree.ElementTree` from the standard library. If you have to deal with malicious input, consider using a library such as `defusedxml.ElementTree`_. :raise: :py:class:`DeserializationException` if unexpected input :return: Instance of :py:class:`.types.GetSubmodelElementsResult` read from :paramref:`stream` """ iterator = has_iterparse.iterparse(stream, ["start", "end"]) return get_submodel_elements_result_from_iterparse( _with_elements_cleared_after_yield(iterator) )
[docs]def get_submodel_elements_result_from_file( path: PathLike, has_iterparse: HasIterparse = xml.etree.ElementTree ) -> our_types.GetSubmodelElementsResult: """ Read an instance of :py:class:`.types.GetSubmodelElementsResult` from the :paramref:`path`. Example usage: .. code-block:: import pathlib import aas_core3_2.xmlization as our_xmlization path = pathlib.Path(...) instance = our_xmlization.get_submodel_elements_result_from_file( path ) # Do something with the ``instance`` :param path: to the file representing an instance of :py:class:`.types.GetSubmodelElementsResult` in XML :param has_iterparse: Module containing ``iterparse`` function. Default is to use :py:mod:`xml.etree.ElementTree` from the standard library. If you have to deal with malicious input, consider using a library such as `defusedxml.ElementTree`_. :raise: :py:class:`DeserializationException` if unexpected input :return: Instance of :py:class:`.types.GetSubmodelElementsResult` read from :paramref:`path` """ with open(os.fspath(path), encoding="utf-8") as fid: iterator = has_iterparse.iterparse(fid, ["start", "end"]) return get_submodel_elements_result_from_iterparse( _with_elements_cleared_after_yield(iterator) )
[docs]def get_submodel_elements_result_from_str( text: str, has_iterparse: HasIterparse = xml.etree.ElementTree ) -> our_types.GetSubmodelElementsResult: """ Read an instance of :py:class:`.types.GetSubmodelElementsResult` from the :paramref:`text`. Example usage: .. code-block:: import pathlib import aas_core3_2.xmlization as our_xmlization text = "<...>...</...>" instance = our_xmlization.get_submodel_elements_result_from_str( text ) # Do something with the ``instance`` :param text: representing an instance of :py:class:`.types.GetSubmodelElementsResult` in XML :param has_iterparse: Module containing ``iterparse`` function. Default is to use :py:mod:`xml.etree.ElementTree` from the standard library. If you have to deal with malicious input, consider using a library such as `defusedxml.ElementTree`_. :raise: :py:class:`DeserializationException` if unexpected input :return: Instance of :py:class:`.types.GetSubmodelElementsResult` read from :paramref:`text` """ iterator = has_iterparse.iterparse(io.StringIO(text), ["start", "end"]) return get_submodel_elements_result_from_iterparse( _with_elements_cleared_after_yield(iterator) )
[docs]def get_submodel_elements_value_result_from_iterparse( iterator: Iterator[Tuple[str, Element]], ) -> our_types.GetSubmodelElementsValueResult: """ Read an instance of :py:class:`.types.GetSubmodelElementsValueResult` from the :paramref:`iterator`. Example usage: .. code-block:: import pathlib import xml.etree.ElementTree as ET import aas_core3_2.xmlization as our_xmlization path = pathlib.Path(...) with path.open("rt") as fid: iterator = ET.iterparse( source=fid, events=['start', 'end'] ) instance = our_xmlization.get_submodel_elements_value_result_from_iterparse( iterator ) # Do something with the ``instance`` :param iterator: Input stream of ``(event, element)`` coming from :py:func:`xml.etree.ElementTree.iterparse` with the argument ``events=["start", "end"]`` :raise: :py:class:`DeserializationException` if unexpected input :return: Instance of :py:class:`.types.GetSubmodelElementsValueResult` read from :paramref:`iterator` """ return _read_instance_from_iterparse( iterator, _read_get_submodel_elements_value_result_as_element, "GetSubmodelElementsValueResult", )
[docs]def get_submodel_elements_value_result_from_stream( stream: TextIO, has_iterparse: HasIterparse = xml.etree.ElementTree ) -> our_types.GetSubmodelElementsValueResult: """ Read an instance of :py:class:`.types.GetSubmodelElementsValueResult` from the :paramref:`stream`. Example usage: .. code-block:: import aas_core3_2.xmlization as our_xmlization with open_some_stream_over_network(...) as stream: instance = our_xmlization.get_submodel_elements_value_result_from_stream( stream ) # Do something with the ``instance`` :param stream: representing an instance of :py:class:`.types.GetSubmodelElementsValueResult` in XML :param has_iterparse: Module containing ``iterparse`` function. Default is to use :py:mod:`xml.etree.ElementTree` from the standard library. If you have to deal with malicious input, consider using a library such as `defusedxml.ElementTree`_. :raise: :py:class:`DeserializationException` if unexpected input :return: Instance of :py:class:`.types.GetSubmodelElementsValueResult` read from :paramref:`stream` """ iterator = has_iterparse.iterparse(stream, ["start", "end"]) return get_submodel_elements_value_result_from_iterparse( _with_elements_cleared_after_yield(iterator) )
[docs]def get_submodel_elements_value_result_from_file( path: PathLike, has_iterparse: HasIterparse = xml.etree.ElementTree ) -> our_types.GetSubmodelElementsValueResult: """ Read an instance of :py:class:`.types.GetSubmodelElementsValueResult` from the :paramref:`path`. Example usage: .. code-block:: import pathlib import aas_core3_2.xmlization as our_xmlization path = pathlib.Path(...) instance = our_xmlization.get_submodel_elements_value_result_from_file( path ) # Do something with the ``instance`` :param path: to the file representing an instance of :py:class:`.types.GetSubmodelElementsValueResult` in XML :param has_iterparse: Module containing ``iterparse`` function. Default is to use :py:mod:`xml.etree.ElementTree` from the standard library. If you have to deal with malicious input, consider using a library such as `defusedxml.ElementTree`_. :raise: :py:class:`DeserializationException` if unexpected input :return: Instance of :py:class:`.types.GetSubmodelElementsValueResult` read from :paramref:`path` """ with open(os.fspath(path), encoding="utf-8") as fid: iterator = has_iterparse.iterparse(fid, ["start", "end"]) return get_submodel_elements_value_result_from_iterparse( _with_elements_cleared_after_yield(iterator) )
[docs]def get_submodel_elements_value_result_from_str( text: str, has_iterparse: HasIterparse = xml.etree.ElementTree ) -> our_types.GetSubmodelElementsValueResult: """ Read an instance of :py:class:`.types.GetSubmodelElementsValueResult` from the :paramref:`text`. Example usage: .. code-block:: import pathlib import aas_core3_2.xmlization as our_xmlization text = "<...>...</...>" instance = our_xmlization.get_submodel_elements_value_result_from_str( text ) # Do something with the ``instance`` :param text: representing an instance of :py:class:`.types.GetSubmodelElementsValueResult` in XML :param has_iterparse: Module containing ``iterparse`` function. Default is to use :py:mod:`xml.etree.ElementTree` from the standard library. If you have to deal with malicious input, consider using a library such as `defusedxml.ElementTree`_. :raise: :py:class:`DeserializationException` if unexpected input :return: Instance of :py:class:`.types.GetSubmodelElementsValueResult` read from :paramref:`text` """ iterator = has_iterparse.iterparse(io.StringIO(text), ["start", "end"]) return get_submodel_elements_value_result_from_iterparse( _with_elements_cleared_after_yield(iterator) )
[docs]def get_all_submodels_recent_changes_result_from_iterparse( iterator: Iterator[Tuple[str, Element]], ) -> our_types.GetAllSubmodelsRecentChangesResult: """ Read an instance of :py:class:`.types.GetAllSubmodelsRecentChangesResult` from the :paramref:`iterator`. Example usage: .. code-block:: import pathlib import xml.etree.ElementTree as ET import aas_core3_2.xmlization as our_xmlization path = pathlib.Path(...) with path.open("rt") as fid: iterator = ET.iterparse( source=fid, events=['start', 'end'] ) instance = our_xmlization.get_all_submodels_recent_changes_result_from_iterparse( iterator ) # Do something with the ``instance`` :param iterator: Input stream of ``(event, element)`` coming from :py:func:`xml.etree.ElementTree.iterparse` with the argument ``events=["start", "end"]`` :raise: :py:class:`DeserializationException` if unexpected input :return: Instance of :py:class:`.types.GetAllSubmodelsRecentChangesResult` read from :paramref:`iterator` """ return _read_instance_from_iterparse( iterator, _read_get_all_submodels_recent_changes_result_as_element, "GetAllSubmodelsRecentChangesResult", )
[docs]def get_all_submodels_recent_changes_result_from_stream( stream: TextIO, has_iterparse: HasIterparse = xml.etree.ElementTree ) -> our_types.GetAllSubmodelsRecentChangesResult: """ Read an instance of :py:class:`.types.GetAllSubmodelsRecentChangesResult` from the :paramref:`stream`. Example usage: .. code-block:: import aas_core3_2.xmlization as our_xmlization with open_some_stream_over_network(...) as stream: instance = our_xmlization.get_all_submodels_recent_changes_result_from_stream( stream ) # Do something with the ``instance`` :param stream: representing an instance of :py:class:`.types.GetAllSubmodelsRecentChangesResult` in XML :param has_iterparse: Module containing ``iterparse`` function. Default is to use :py:mod:`xml.etree.ElementTree` from the standard library. If you have to deal with malicious input, consider using a library such as `defusedxml.ElementTree`_. :raise: :py:class:`DeserializationException` if unexpected input :return: Instance of :py:class:`.types.GetAllSubmodelsRecentChangesResult` read from :paramref:`stream` """ iterator = has_iterparse.iterparse(stream, ["start", "end"]) return get_all_submodels_recent_changes_result_from_iterparse( _with_elements_cleared_after_yield(iterator) )
[docs]def get_all_submodels_recent_changes_result_from_file( path: PathLike, has_iterparse: HasIterparse = xml.etree.ElementTree ) -> our_types.GetAllSubmodelsRecentChangesResult: """ Read an instance of :py:class:`.types.GetAllSubmodelsRecentChangesResult` from the :paramref:`path`. Example usage: .. code-block:: import pathlib import aas_core3_2.xmlization as our_xmlization path = pathlib.Path(...) instance = our_xmlization.get_all_submodels_recent_changes_result_from_file( path ) # Do something with the ``instance`` :param path: to the file representing an instance of :py:class:`.types.GetAllSubmodelsRecentChangesResult` in XML :param has_iterparse: Module containing ``iterparse`` function. Default is to use :py:mod:`xml.etree.ElementTree` from the standard library. If you have to deal with malicious input, consider using a library such as `defusedxml.ElementTree`_. :raise: :py:class:`DeserializationException` if unexpected input :return: Instance of :py:class:`.types.GetAllSubmodelsRecentChangesResult` read from :paramref:`path` """ with open(os.fspath(path), encoding="utf-8") as fid: iterator = has_iterparse.iterparse(fid, ["start", "end"]) return get_all_submodels_recent_changes_result_from_iterparse( _with_elements_cleared_after_yield(iterator) )
[docs]def get_all_submodels_recent_changes_result_from_str( text: str, has_iterparse: HasIterparse = xml.etree.ElementTree ) -> our_types.GetAllSubmodelsRecentChangesResult: """ Read an instance of :py:class:`.types.GetAllSubmodelsRecentChangesResult` from the :paramref:`text`. Example usage: .. code-block:: import pathlib import aas_core3_2.xmlization as our_xmlization text = "<...>...</...>" instance = our_xmlization.get_all_submodels_recent_changes_result_from_str( text ) # Do something with the ``instance`` :param text: representing an instance of :py:class:`.types.GetAllSubmodelsRecentChangesResult` in XML :param has_iterparse: Module containing ``iterparse`` function. Default is to use :py:mod:`xml.etree.ElementTree` from the standard library. If you have to deal with malicious input, consider using a library such as `defusedxml.ElementTree`_. :raise: :py:class:`DeserializationException` if unexpected input :return: Instance of :py:class:`.types.GetAllSubmodelsRecentChangesResult` read from :paramref:`text` """ iterator = has_iterparse.iterparse(io.StringIO(text), ["start", "end"]) return get_all_submodels_recent_changes_result_from_iterparse( _with_elements_cleared_after_yield(iterator) )
[docs]def get_submodels_metadata_result_from_iterparse( iterator: Iterator[Tuple[str, Element]], ) -> our_types.GetSubmodelsMetadataResult: """ Read an instance of :py:class:`.types.GetSubmodelsMetadataResult` from the :paramref:`iterator`. Example usage: .. code-block:: import pathlib import xml.etree.ElementTree as ET import aas_core3_2.xmlization as our_xmlization path = pathlib.Path(...) with path.open("rt") as fid: iterator = ET.iterparse( source=fid, events=['start', 'end'] ) instance = our_xmlization.get_submodels_metadata_result_from_iterparse( iterator ) # Do something with the ``instance`` :param iterator: Input stream of ``(event, element)`` coming from :py:func:`xml.etree.ElementTree.iterparse` with the argument ``events=["start", "end"]`` :raise: :py:class:`DeserializationException` if unexpected input :return: Instance of :py:class:`.types.GetSubmodelsMetadataResult` read from :paramref:`iterator` """ return _read_instance_from_iterparse( iterator, _read_get_submodels_metadata_result_as_element, "GetSubmodelsMetadataResult", )
[docs]def get_submodels_metadata_result_from_stream( stream: TextIO, has_iterparse: HasIterparse = xml.etree.ElementTree ) -> our_types.GetSubmodelsMetadataResult: """ Read an instance of :py:class:`.types.GetSubmodelsMetadataResult` from the :paramref:`stream`. Example usage: .. code-block:: import aas_core3_2.xmlization as our_xmlization with open_some_stream_over_network(...) as stream: instance = our_xmlization.get_submodels_metadata_result_from_stream( stream ) # Do something with the ``instance`` :param stream: representing an instance of :py:class:`.types.GetSubmodelsMetadataResult` in XML :param has_iterparse: Module containing ``iterparse`` function. Default is to use :py:mod:`xml.etree.ElementTree` from the standard library. If you have to deal with malicious input, consider using a library such as `defusedxml.ElementTree`_. :raise: :py:class:`DeserializationException` if unexpected input :return: Instance of :py:class:`.types.GetSubmodelsMetadataResult` read from :paramref:`stream` """ iterator = has_iterparse.iterparse(stream, ["start", "end"]) return get_submodels_metadata_result_from_iterparse( _with_elements_cleared_after_yield(iterator) )
[docs]def get_submodels_metadata_result_from_file( path: PathLike, has_iterparse: HasIterparse = xml.etree.ElementTree ) -> our_types.GetSubmodelsMetadataResult: """ Read an instance of :py:class:`.types.GetSubmodelsMetadataResult` from the :paramref:`path`. Example usage: .. code-block:: import pathlib import aas_core3_2.xmlization as our_xmlization path = pathlib.Path(...) instance = our_xmlization.get_submodels_metadata_result_from_file( path ) # Do something with the ``instance`` :param path: to the file representing an instance of :py:class:`.types.GetSubmodelsMetadataResult` in XML :param has_iterparse: Module containing ``iterparse`` function. Default is to use :py:mod:`xml.etree.ElementTree` from the standard library. If you have to deal with malicious input, consider using a library such as `defusedxml.ElementTree`_. :raise: :py:class:`DeserializationException` if unexpected input :return: Instance of :py:class:`.types.GetSubmodelsMetadataResult` read from :paramref:`path` """ with open(os.fspath(path), encoding="utf-8") as fid: iterator = has_iterparse.iterparse(fid, ["start", "end"]) return get_submodels_metadata_result_from_iterparse( _with_elements_cleared_after_yield(iterator) )
[docs]def get_submodels_metadata_result_from_str( text: str, has_iterparse: HasIterparse = xml.etree.ElementTree ) -> our_types.GetSubmodelsMetadataResult: """ Read an instance of :py:class:`.types.GetSubmodelsMetadataResult` from the :paramref:`text`. Example usage: .. code-block:: import pathlib import aas_core3_2.xmlization as our_xmlization text = "<...>...</...>" instance = our_xmlization.get_submodels_metadata_result_from_str( text ) # Do something with the ``instance`` :param text: representing an instance of :py:class:`.types.GetSubmodelsMetadataResult` in XML :param has_iterparse: Module containing ``iterparse`` function. Default is to use :py:mod:`xml.etree.ElementTree` from the standard library. If you have to deal with malicious input, consider using a library such as `defusedxml.ElementTree`_. :raise: :py:class:`DeserializationException` if unexpected input :return: Instance of :py:class:`.types.GetSubmodelsMetadataResult` read from :paramref:`text` """ iterator = has_iterparse.iterparse(io.StringIO(text), ["start", "end"]) return get_submodels_metadata_result_from_iterparse( _with_elements_cleared_after_yield(iterator) )
[docs]def get_submodels_result_from_iterparse( iterator: Iterator[Tuple[str, Element]], ) -> our_types.GetSubmodelsResult: """ Read an instance of :py:class:`.types.GetSubmodelsResult` from the :paramref:`iterator`. Example usage: .. code-block:: import pathlib import xml.etree.ElementTree as ET import aas_core3_2.xmlization as our_xmlization path = pathlib.Path(...) with path.open("rt") as fid: iterator = ET.iterparse( source=fid, events=['start', 'end'] ) instance = our_xmlization.get_submodels_result_from_iterparse( iterator ) # Do something with the ``instance`` :param iterator: Input stream of ``(event, element)`` coming from :py:func:`xml.etree.ElementTree.iterparse` with the argument ``events=["start", "end"]`` :raise: :py:class:`DeserializationException` if unexpected input :return: Instance of :py:class:`.types.GetSubmodelsResult` read from :paramref:`iterator` """ return _read_instance_from_iterparse( iterator, _read_get_submodels_result_as_element, "GetSubmodelsResult" )
[docs]def get_submodels_result_from_stream( stream: TextIO, has_iterparse: HasIterparse = xml.etree.ElementTree ) -> our_types.GetSubmodelsResult: """ Read an instance of :py:class:`.types.GetSubmodelsResult` from the :paramref:`stream`. Example usage: .. code-block:: import aas_core3_2.xmlization as our_xmlization with open_some_stream_over_network(...) as stream: instance = our_xmlization.get_submodels_result_from_stream( stream ) # Do something with the ``instance`` :param stream: representing an instance of :py:class:`.types.GetSubmodelsResult` in XML :param has_iterparse: Module containing ``iterparse`` function. Default is to use :py:mod:`xml.etree.ElementTree` from the standard library. If you have to deal with malicious input, consider using a library such as `defusedxml.ElementTree`_. :raise: :py:class:`DeserializationException` if unexpected input :return: Instance of :py:class:`.types.GetSubmodelsResult` read from :paramref:`stream` """ iterator = has_iterparse.iterparse(stream, ["start", "end"]) return get_submodels_result_from_iterparse( _with_elements_cleared_after_yield(iterator) )
[docs]def get_submodels_result_from_file( path: PathLike, has_iterparse: HasIterparse = xml.etree.ElementTree ) -> our_types.GetSubmodelsResult: """ Read an instance of :py:class:`.types.GetSubmodelsResult` from the :paramref:`path`. Example usage: .. code-block:: import pathlib import aas_core3_2.xmlization as our_xmlization path = pathlib.Path(...) instance = our_xmlization.get_submodels_result_from_file( path ) # Do something with the ``instance`` :param path: to the file representing an instance of :py:class:`.types.GetSubmodelsResult` in XML :param has_iterparse: Module containing ``iterparse`` function. Default is to use :py:mod:`xml.etree.ElementTree` from the standard library. If you have to deal with malicious input, consider using a library such as `defusedxml.ElementTree`_. :raise: :py:class:`DeserializationException` if unexpected input :return: Instance of :py:class:`.types.GetSubmodelsResult` read from :paramref:`path` """ with open(os.fspath(path), encoding="utf-8") as fid: iterator = has_iterparse.iterparse(fid, ["start", "end"]) return get_submodels_result_from_iterparse( _with_elements_cleared_after_yield(iterator) )
[docs]def get_submodels_result_from_str( text: str, has_iterparse: HasIterparse = xml.etree.ElementTree ) -> our_types.GetSubmodelsResult: """ Read an instance of :py:class:`.types.GetSubmodelsResult` from the :paramref:`text`. Example usage: .. code-block:: import pathlib import aas_core3_2.xmlization as our_xmlization text = "<...>...</...>" instance = our_xmlization.get_submodels_result_from_str( text ) # Do something with the ``instance`` :param text: representing an instance of :py:class:`.types.GetSubmodelsResult` in XML :param has_iterparse: Module containing ``iterparse`` function. Default is to use :py:mod:`xml.etree.ElementTree` from the standard library. If you have to deal with malicious input, consider using a library such as `defusedxml.ElementTree`_. :raise: :py:class:`DeserializationException` if unexpected input :return: Instance of :py:class:`.types.GetSubmodelsResult` read from :paramref:`text` """ iterator = has_iterparse.iterparse(io.StringIO(text), ["start", "end"]) return get_submodels_result_from_iterparse( _with_elements_cleared_after_yield(iterator) )
[docs]def get_submodels_value_result_from_iterparse( iterator: Iterator[Tuple[str, Element]], ) -> our_types.GetSubmodelsValueResult: """ Read an instance of :py:class:`.types.GetSubmodelsValueResult` from the :paramref:`iterator`. Example usage: .. code-block:: import pathlib import xml.etree.ElementTree as ET import aas_core3_2.xmlization as our_xmlization path = pathlib.Path(...) with path.open("rt") as fid: iterator = ET.iterparse( source=fid, events=['start', 'end'] ) instance = our_xmlization.get_submodels_value_result_from_iterparse( iterator ) # Do something with the ``instance`` :param iterator: Input stream of ``(event, element)`` coming from :py:func:`xml.etree.ElementTree.iterparse` with the argument ``events=["start", "end"]`` :raise: :py:class:`DeserializationException` if unexpected input :return: Instance of :py:class:`.types.GetSubmodelsValueResult` read from :paramref:`iterator` """ return _read_instance_from_iterparse( iterator, _read_get_submodels_value_result_as_element, "GetSubmodelsValueResult" )
[docs]def get_submodels_value_result_from_stream( stream: TextIO, has_iterparse: HasIterparse = xml.etree.ElementTree ) -> our_types.GetSubmodelsValueResult: """ Read an instance of :py:class:`.types.GetSubmodelsValueResult` from the :paramref:`stream`. Example usage: .. code-block:: import aas_core3_2.xmlization as our_xmlization with open_some_stream_over_network(...) as stream: instance = our_xmlization.get_submodels_value_result_from_stream( stream ) # Do something with the ``instance`` :param stream: representing an instance of :py:class:`.types.GetSubmodelsValueResult` in XML :param has_iterparse: Module containing ``iterparse`` function. Default is to use :py:mod:`xml.etree.ElementTree` from the standard library. If you have to deal with malicious input, consider using a library such as `defusedxml.ElementTree`_. :raise: :py:class:`DeserializationException` if unexpected input :return: Instance of :py:class:`.types.GetSubmodelsValueResult` read from :paramref:`stream` """ iterator = has_iterparse.iterparse(stream, ["start", "end"]) return get_submodels_value_result_from_iterparse( _with_elements_cleared_after_yield(iterator) )
[docs]def get_submodels_value_result_from_file( path: PathLike, has_iterparse: HasIterparse = xml.etree.ElementTree ) -> our_types.GetSubmodelsValueResult: """ Read an instance of :py:class:`.types.GetSubmodelsValueResult` from the :paramref:`path`. Example usage: .. code-block:: import pathlib import aas_core3_2.xmlization as our_xmlization path = pathlib.Path(...) instance = our_xmlization.get_submodels_value_result_from_file( path ) # Do something with the ``instance`` :param path: to the file representing an instance of :py:class:`.types.GetSubmodelsValueResult` in XML :param has_iterparse: Module containing ``iterparse`` function. Default is to use :py:mod:`xml.etree.ElementTree` from the standard library. If you have to deal with malicious input, consider using a library such as `defusedxml.ElementTree`_. :raise: :py:class:`DeserializationException` if unexpected input :return: Instance of :py:class:`.types.GetSubmodelsValueResult` read from :paramref:`path` """ with open(os.fspath(path), encoding="utf-8") as fid: iterator = has_iterparse.iterparse(fid, ["start", "end"]) return get_submodels_value_result_from_iterparse( _with_elements_cleared_after_yield(iterator) )
[docs]def get_submodels_value_result_from_str( text: str, has_iterparse: HasIterparse = xml.etree.ElementTree ) -> our_types.GetSubmodelsValueResult: """ Read an instance of :py:class:`.types.GetSubmodelsValueResult` from the :paramref:`text`. Example usage: .. code-block:: import pathlib import aas_core3_2.xmlization as our_xmlization text = "<...>...</...>" instance = our_xmlization.get_submodels_value_result_from_str( text ) # Do something with the ``instance`` :param text: representing an instance of :py:class:`.types.GetSubmodelsValueResult` in XML :param has_iterparse: Module containing ``iterparse`` function. Default is to use :py:mod:`xml.etree.ElementTree` from the standard library. If you have to deal with malicious input, consider using a library such as `defusedxml.ElementTree`_. :raise: :py:class:`DeserializationException` if unexpected input :return: Instance of :py:class:`.types.GetSubmodelsValueResult` read from :paramref:`text` """ iterator = has_iterparse.iterparse(io.StringIO(text), ["start", "end"]) return get_submodels_value_result_from_iterparse( _with_elements_cleared_after_yield(iterator) )
[docs]def claim_attribute_from_iterparse( iterator: Iterator[Tuple[str, Element]], ) -> our_types.ClaimAttribute: """ Read an instance of :py:class:`.types.ClaimAttribute` from the :paramref:`iterator`. Example usage: .. code-block:: import pathlib import xml.etree.ElementTree as ET import aas_core3_2.xmlization as our_xmlization path = pathlib.Path(...) with path.open("rt") as fid: iterator = ET.iterparse( source=fid, events=['start', 'end'] ) instance = our_xmlization.claim_attribute_from_iterparse( iterator ) # Do something with the ``instance`` :param iterator: Input stream of ``(event, element)`` coming from :py:func:`xml.etree.ElementTree.iterparse` with the argument ``events=["start", "end"]`` :raise: :py:class:`DeserializationException` if unexpected input :return: Instance of :py:class:`.types.ClaimAttribute` read from :paramref:`iterator` """ return _read_instance_from_iterparse( iterator, _read_claim_attribute_as_element, "ClaimAttribute" )
[docs]def claim_attribute_from_stream( stream: TextIO, has_iterparse: HasIterparse = xml.etree.ElementTree ) -> our_types.ClaimAttribute: """ Read an instance of :py:class:`.types.ClaimAttribute` from the :paramref:`stream`. Example usage: .. code-block:: import aas_core3_2.xmlization as our_xmlization with open_some_stream_over_network(...) as stream: instance = our_xmlization.claim_attribute_from_stream( stream ) # Do something with the ``instance`` :param stream: representing an instance of :py:class:`.types.ClaimAttribute` in XML :param has_iterparse: Module containing ``iterparse`` function. Default is to use :py:mod:`xml.etree.ElementTree` from the standard library. If you have to deal with malicious input, consider using a library such as `defusedxml.ElementTree`_. :raise: :py:class:`DeserializationException` if unexpected input :return: Instance of :py:class:`.types.ClaimAttribute` read from :paramref:`stream` """ iterator = has_iterparse.iterparse(stream, ["start", "end"]) return claim_attribute_from_iterparse(_with_elements_cleared_after_yield(iterator))
[docs]def claim_attribute_from_file( path: PathLike, has_iterparse: HasIterparse = xml.etree.ElementTree ) -> our_types.ClaimAttribute: """ Read an instance of :py:class:`.types.ClaimAttribute` from the :paramref:`path`. Example usage: .. code-block:: import pathlib import aas_core3_2.xmlization as our_xmlization path = pathlib.Path(...) instance = our_xmlization.claim_attribute_from_file( path ) # Do something with the ``instance`` :param path: to the file representing an instance of :py:class:`.types.ClaimAttribute` in XML :param has_iterparse: Module containing ``iterparse`` function. Default is to use :py:mod:`xml.etree.ElementTree` from the standard library. If you have to deal with malicious input, consider using a library such as `defusedxml.ElementTree`_. :raise: :py:class:`DeserializationException` if unexpected input :return: Instance of :py:class:`.types.ClaimAttribute` read from :paramref:`path` """ with open(os.fspath(path), encoding="utf-8") as fid: iterator = has_iterparse.iterparse(fid, ["start", "end"]) return claim_attribute_from_iterparse( _with_elements_cleared_after_yield(iterator) )
[docs]def claim_attribute_from_str( text: str, has_iterparse: HasIterparse = xml.etree.ElementTree ) -> our_types.ClaimAttribute: """ Read an instance of :py:class:`.types.ClaimAttribute` from the :paramref:`text`. Example usage: .. code-block:: import pathlib import aas_core3_2.xmlization as our_xmlization text = "<...>...</...>" instance = our_xmlization.claim_attribute_from_str( text ) # Do something with the ``instance`` :param text: representing an instance of :py:class:`.types.ClaimAttribute` in XML :param has_iterparse: Module containing ``iterparse`` function. Default is to use :py:mod:`xml.etree.ElementTree` from the standard library. If you have to deal with malicious input, consider using a library such as `defusedxml.ElementTree`_. :raise: :py:class:`DeserializationException` if unexpected input :return: Instance of :py:class:`.types.ClaimAttribute` read from :paramref:`text` """ iterator = has_iterparse.iterparse(io.StringIO(text), ["start", "end"]) return claim_attribute_from_iterparse(_with_elements_cleared_after_yield(iterator))
[docs]def global_attribute_from_iterparse( iterator: Iterator[Tuple[str, Element]], ) -> our_types.GlobalAttribute: """ Read an instance of :py:class:`.types.GlobalAttribute` from the :paramref:`iterator`. Example usage: .. code-block:: import pathlib import xml.etree.ElementTree as ET import aas_core3_2.xmlization as our_xmlization path = pathlib.Path(...) with path.open("rt") as fid: iterator = ET.iterparse( source=fid, events=['start', 'end'] ) instance = our_xmlization.global_attribute_from_iterparse( iterator ) # Do something with the ``instance`` :param iterator: Input stream of ``(event, element)`` coming from :py:func:`xml.etree.ElementTree.iterparse` with the argument ``events=["start", "end"]`` :raise: :py:class:`DeserializationException` if unexpected input :return: Instance of :py:class:`.types.GlobalAttribute` read from :paramref:`iterator` """ return _read_instance_from_iterparse( iterator, _read_global_attribute_as_element, "GlobalAttribute" )
[docs]def global_attribute_from_stream( stream: TextIO, has_iterparse: HasIterparse = xml.etree.ElementTree ) -> our_types.GlobalAttribute: """ Read an instance of :py:class:`.types.GlobalAttribute` from the :paramref:`stream`. Example usage: .. code-block:: import aas_core3_2.xmlization as our_xmlization with open_some_stream_over_network(...) as stream: instance = our_xmlization.global_attribute_from_stream( stream ) # Do something with the ``instance`` :param stream: representing an instance of :py:class:`.types.GlobalAttribute` in XML :param has_iterparse: Module containing ``iterparse`` function. Default is to use :py:mod:`xml.etree.ElementTree` from the standard library. If you have to deal with malicious input, consider using a library such as `defusedxml.ElementTree`_. :raise: :py:class:`DeserializationException` if unexpected input :return: Instance of :py:class:`.types.GlobalAttribute` read from :paramref:`stream` """ iterator = has_iterparse.iterparse(stream, ["start", "end"]) return global_attribute_from_iterparse(_with_elements_cleared_after_yield(iterator))
[docs]def global_attribute_from_file( path: PathLike, has_iterparse: HasIterparse = xml.etree.ElementTree ) -> our_types.GlobalAttribute: """ Read an instance of :py:class:`.types.GlobalAttribute` from the :paramref:`path`. Example usage: .. code-block:: import pathlib import aas_core3_2.xmlization as our_xmlization path = pathlib.Path(...) instance = our_xmlization.global_attribute_from_file( path ) # Do something with the ``instance`` :param path: to the file representing an instance of :py:class:`.types.GlobalAttribute` in XML :param has_iterparse: Module containing ``iterparse`` function. Default is to use :py:mod:`xml.etree.ElementTree` from the standard library. If you have to deal with malicious input, consider using a library such as `defusedxml.ElementTree`_. :raise: :py:class:`DeserializationException` if unexpected input :return: Instance of :py:class:`.types.GlobalAttribute` read from :paramref:`path` """ with open(os.fspath(path), encoding="utf-8") as fid: iterator = has_iterparse.iterparse(fid, ["start", "end"]) return global_attribute_from_iterparse( _with_elements_cleared_after_yield(iterator) )
[docs]def global_attribute_from_str( text: str, has_iterparse: HasIterparse = xml.etree.ElementTree ) -> our_types.GlobalAttribute: """ Read an instance of :py:class:`.types.GlobalAttribute` from the :paramref:`text`. Example usage: .. code-block:: import pathlib import aas_core3_2.xmlization as our_xmlization text = "<...>...</...>" instance = our_xmlization.global_attribute_from_str( text ) # Do something with the ``instance`` :param text: representing an instance of :py:class:`.types.GlobalAttribute` in XML :param has_iterparse: Module containing ``iterparse`` function. Default is to use :py:mod:`xml.etree.ElementTree` from the standard library. If you have to deal with malicious input, consider using a library such as `defusedxml.ElementTree`_. :raise: :py:class:`DeserializationException` if unexpected input :return: Instance of :py:class:`.types.GlobalAttribute` read from :paramref:`text` """ iterator = has_iterparse.iterparse(io.StringIO(text), ["start", "end"]) return global_attribute_from_iterparse(_with_elements_cleared_after_yield(iterator))
[docs]def reference_attribute_from_iterparse( iterator: Iterator[Tuple[str, Element]], ) -> our_types.ReferenceAttribute: """ Read an instance of :py:class:`.types.ReferenceAttribute` from the :paramref:`iterator`. Example usage: .. code-block:: import pathlib import xml.etree.ElementTree as ET import aas_core3_2.xmlization as our_xmlization path = pathlib.Path(...) with path.open("rt") as fid: iterator = ET.iterparse( source=fid, events=['start', 'end'] ) instance = our_xmlization.reference_attribute_from_iterparse( iterator ) # Do something with the ``instance`` :param iterator: Input stream of ``(event, element)`` coming from :py:func:`xml.etree.ElementTree.iterparse` with the argument ``events=["start", "end"]`` :raise: :py:class:`DeserializationException` if unexpected input :return: Instance of :py:class:`.types.ReferenceAttribute` read from :paramref:`iterator` """ return _read_instance_from_iterparse( iterator, _read_reference_attribute_as_element, "ReferenceAttribute" )
[docs]def reference_attribute_from_stream( stream: TextIO, has_iterparse: HasIterparse = xml.etree.ElementTree ) -> our_types.ReferenceAttribute: """ Read an instance of :py:class:`.types.ReferenceAttribute` from the :paramref:`stream`. Example usage: .. code-block:: import aas_core3_2.xmlization as our_xmlization with open_some_stream_over_network(...) as stream: instance = our_xmlization.reference_attribute_from_stream( stream ) # Do something with the ``instance`` :param stream: representing an instance of :py:class:`.types.ReferenceAttribute` in XML :param has_iterparse: Module containing ``iterparse`` function. Default is to use :py:mod:`xml.etree.ElementTree` from the standard library. If you have to deal with malicious input, consider using a library such as `defusedxml.ElementTree`_. :raise: :py:class:`DeserializationException` if unexpected input :return: Instance of :py:class:`.types.ReferenceAttribute` read from :paramref:`stream` """ iterator = has_iterparse.iterparse(stream, ["start", "end"]) return reference_attribute_from_iterparse( _with_elements_cleared_after_yield(iterator) )
[docs]def reference_attribute_from_file( path: PathLike, has_iterparse: HasIterparse = xml.etree.ElementTree ) -> our_types.ReferenceAttribute: """ Read an instance of :py:class:`.types.ReferenceAttribute` from the :paramref:`path`. Example usage: .. code-block:: import pathlib import aas_core3_2.xmlization as our_xmlization path = pathlib.Path(...) instance = our_xmlization.reference_attribute_from_file( path ) # Do something with the ``instance`` :param path: to the file representing an instance of :py:class:`.types.ReferenceAttribute` in XML :param has_iterparse: Module containing ``iterparse`` function. Default is to use :py:mod:`xml.etree.ElementTree` from the standard library. If you have to deal with malicious input, consider using a library such as `defusedxml.ElementTree`_. :raise: :py:class:`DeserializationException` if unexpected input :return: Instance of :py:class:`.types.ReferenceAttribute` read from :paramref:`path` """ with open(os.fspath(path), encoding="utf-8") as fid: iterator = has_iterparse.iterparse(fid, ["start", "end"]) return reference_attribute_from_iterparse( _with_elements_cleared_after_yield(iterator) )
[docs]def reference_attribute_from_str( text: str, has_iterparse: HasIterparse = xml.etree.ElementTree ) -> our_types.ReferenceAttribute: """ Read an instance of :py:class:`.types.ReferenceAttribute` from the :paramref:`text`. Example usage: .. code-block:: import pathlib import aas_core3_2.xmlization as our_xmlization text = "<...>...</...>" instance = our_xmlization.reference_attribute_from_str( text ) # Do something with the ``instance`` :param text: representing an instance of :py:class:`.types.ReferenceAttribute` in XML :param has_iterparse: Module containing ``iterparse`` function. Default is to use :py:mod:`xml.etree.ElementTree` from the standard library. If you have to deal with malicious input, consider using a library such as `defusedxml.ElementTree`_. :raise: :py:class:`DeserializationException` if unexpected input :return: Instance of :py:class:`.types.ReferenceAttribute` read from :paramref:`text` """ iterator = has_iterparse.iterparse(io.StringIO(text), ["start", "end"]) return reference_attribute_from_iterparse( _with_elements_cleared_after_yield(iterator) )
[docs]def date_time_attribute_item_from_iterparse( iterator: Iterator[Tuple[str, Element]], ) -> our_types.DateTimeAttributeItem: """ Read an instance of :py:class:`.types.DateTimeAttributeItem` from the :paramref:`iterator`. Example usage: .. code-block:: import pathlib import xml.etree.ElementTree as ET import aas_core3_2.xmlization as our_xmlization path = pathlib.Path(...) with path.open("rt") as fid: iterator = ET.iterparse( source=fid, events=['start', 'end'] ) instance = our_xmlization.date_time_attribute_item_from_iterparse( iterator ) # Do something with the ``instance`` :param iterator: Input stream of ``(event, element)`` coming from :py:func:`xml.etree.ElementTree.iterparse` with the argument ``events=["start", "end"]`` :raise: :py:class:`DeserializationException` if unexpected input :return: Instance of :py:class:`.types.DateTimeAttributeItem` read from :paramref:`iterator` """ return _read_instance_from_iterparse( iterator, _read_date_time_attribute_item_as_element, "DateTimeAttributeItem" )
[docs]def date_time_attribute_item_from_stream( stream: TextIO, has_iterparse: HasIterparse = xml.etree.ElementTree ) -> our_types.DateTimeAttributeItem: """ Read an instance of :py:class:`.types.DateTimeAttributeItem` from the :paramref:`stream`. Example usage: .. code-block:: import aas_core3_2.xmlization as our_xmlization with open_some_stream_over_network(...) as stream: instance = our_xmlization.date_time_attribute_item_from_stream( stream ) # Do something with the ``instance`` :param stream: representing an instance of :py:class:`.types.DateTimeAttributeItem` in XML :param has_iterparse: Module containing ``iterparse`` function. Default is to use :py:mod:`xml.etree.ElementTree` from the standard library. If you have to deal with malicious input, consider using a library such as `defusedxml.ElementTree`_. :raise: :py:class:`DeserializationException` if unexpected input :return: Instance of :py:class:`.types.DateTimeAttributeItem` read from :paramref:`stream` """ iterator = has_iterparse.iterparse(stream, ["start", "end"]) return date_time_attribute_item_from_iterparse( _with_elements_cleared_after_yield(iterator) )
[docs]def date_time_attribute_item_from_file( path: PathLike, has_iterparse: HasIterparse = xml.etree.ElementTree ) -> our_types.DateTimeAttributeItem: """ Read an instance of :py:class:`.types.DateTimeAttributeItem` from the :paramref:`path`. Example usage: .. code-block:: import pathlib import aas_core3_2.xmlization as our_xmlization path = pathlib.Path(...) instance = our_xmlization.date_time_attribute_item_from_file( path ) # Do something with the ``instance`` :param path: to the file representing an instance of :py:class:`.types.DateTimeAttributeItem` in XML :param has_iterparse: Module containing ``iterparse`` function. Default is to use :py:mod:`xml.etree.ElementTree` from the standard library. If you have to deal with malicious input, consider using a library such as `defusedxml.ElementTree`_. :raise: :py:class:`DeserializationException` if unexpected input :return: Instance of :py:class:`.types.DateTimeAttributeItem` read from :paramref:`path` """ with open(os.fspath(path), encoding="utf-8") as fid: iterator = has_iterparse.iterparse(fid, ["start", "end"]) return date_time_attribute_item_from_iterparse( _with_elements_cleared_after_yield(iterator) )
[docs]def date_time_attribute_item_from_str( text: str, has_iterparse: HasIterparse = xml.etree.ElementTree ) -> our_types.DateTimeAttributeItem: """ Read an instance of :py:class:`.types.DateTimeAttributeItem` from the :paramref:`text`. Example usage: .. code-block:: import pathlib import aas_core3_2.xmlization as our_xmlization text = "<...>...</...>" instance = our_xmlization.date_time_attribute_item_from_str( text ) # Do something with the ``instance`` :param text: representing an instance of :py:class:`.types.DateTimeAttributeItem` in XML :param has_iterparse: Module containing ``iterparse`` function. Default is to use :py:mod:`xml.etree.ElementTree` from the standard library. If you have to deal with malicious input, consider using a library such as `defusedxml.ElementTree`_. :raise: :py:class:`DeserializationException` if unexpected input :return: Instance of :py:class:`.types.DateTimeAttributeItem` read from :paramref:`text` """ iterator = has_iterparse.iterparse(io.StringIO(text), ["start", "end"]) return date_time_attribute_item_from_iterparse( _with_elements_cleared_after_yield(iterator) )
[docs]def field_operand_from_iterparse( iterator: Iterator[Tuple[str, Element]], ) -> our_types.FieldOperand: """ Read an instance of :py:class:`.types.FieldOperand` from the :paramref:`iterator`. Example usage: .. code-block:: import pathlib import xml.etree.ElementTree as ET import aas_core3_2.xmlization as our_xmlization path = pathlib.Path(...) with path.open("rt") as fid: iterator = ET.iterparse( source=fid, events=['start', 'end'] ) instance = our_xmlization.field_operand_from_iterparse( iterator ) # Do something with the ``instance`` :param iterator: Input stream of ``(event, element)`` coming from :py:func:`xml.etree.ElementTree.iterparse` with the argument ``events=["start", "end"]`` :raise: :py:class:`DeserializationException` if unexpected input :return: Instance of :py:class:`.types.FieldOperand` read from :paramref:`iterator` """ return _read_instance_from_iterparse( iterator, _read_field_operand_as_element, "FieldOperand" )
[docs]def field_operand_from_stream( stream: TextIO, has_iterparse: HasIterparse = xml.etree.ElementTree ) -> our_types.FieldOperand: """ Read an instance of :py:class:`.types.FieldOperand` from the :paramref:`stream`. Example usage: .. code-block:: import aas_core3_2.xmlization as our_xmlization with open_some_stream_over_network(...) as stream: instance = our_xmlization.field_operand_from_stream( stream ) # Do something with the ``instance`` :param stream: representing an instance of :py:class:`.types.FieldOperand` in XML :param has_iterparse: Module containing ``iterparse`` function. Default is to use :py:mod:`xml.etree.ElementTree` from the standard library. If you have to deal with malicious input, consider using a library such as `defusedxml.ElementTree`_. :raise: :py:class:`DeserializationException` if unexpected input :return: Instance of :py:class:`.types.FieldOperand` read from :paramref:`stream` """ iterator = has_iterparse.iterparse(stream, ["start", "end"]) return field_operand_from_iterparse(_with_elements_cleared_after_yield(iterator))
[docs]def field_operand_from_file( path: PathLike, has_iterparse: HasIterparse = xml.etree.ElementTree ) -> our_types.FieldOperand: """ Read an instance of :py:class:`.types.FieldOperand` from the :paramref:`path`. Example usage: .. code-block:: import pathlib import aas_core3_2.xmlization as our_xmlization path = pathlib.Path(...) instance = our_xmlization.field_operand_from_file( path ) # Do something with the ``instance`` :param path: to the file representing an instance of :py:class:`.types.FieldOperand` in XML :param has_iterparse: Module containing ``iterparse`` function. Default is to use :py:mod:`xml.etree.ElementTree` from the standard library. If you have to deal with malicious input, consider using a library such as `defusedxml.ElementTree`_. :raise: :py:class:`DeserializationException` if unexpected input :return: Instance of :py:class:`.types.FieldOperand` read from :paramref:`path` """ with open(os.fspath(path), encoding="utf-8") as fid: iterator = has_iterparse.iterparse(fid, ["start", "end"]) return field_operand_from_iterparse( _with_elements_cleared_after_yield(iterator) )
[docs]def field_operand_from_str( text: str, has_iterparse: HasIterparse = xml.etree.ElementTree ) -> our_types.FieldOperand: """ Read an instance of :py:class:`.types.FieldOperand` from the :paramref:`text`. Example usage: .. code-block:: import pathlib import aas_core3_2.xmlization as our_xmlization text = "<...>...</...>" instance = our_xmlization.field_operand_from_str( text ) # Do something with the ``instance`` :param text: representing an instance of :py:class:`.types.FieldOperand` in XML :param has_iterparse: Module containing ``iterparse`` function. Default is to use :py:mod:`xml.etree.ElementTree` from the standard library. If you have to deal with malicious input, consider using a library such as `defusedxml.ElementTree`_. :raise: :py:class:`DeserializationException` if unexpected input :return: Instance of :py:class:`.types.FieldOperand` read from :paramref:`text` """ iterator = has_iterparse.iterparse(io.StringIO(text), ["start", "end"]) return field_operand_from_iterparse(_with_elements_cleared_after_yield(iterator))
[docs]def string_literal_from_iterparse( iterator: Iterator[Tuple[str, Element]], ) -> our_types.StringLiteral: """ Read an instance of :py:class:`.types.StringLiteral` from the :paramref:`iterator`. Example usage: .. code-block:: import pathlib import xml.etree.ElementTree as ET import aas_core3_2.xmlization as our_xmlization path = pathlib.Path(...) with path.open("rt") as fid: iterator = ET.iterparse( source=fid, events=['start', 'end'] ) instance = our_xmlization.string_literal_from_iterparse( iterator ) # Do something with the ``instance`` :param iterator: Input stream of ``(event, element)`` coming from :py:func:`xml.etree.ElementTree.iterparse` with the argument ``events=["start", "end"]`` :raise: :py:class:`DeserializationException` if unexpected input :return: Instance of :py:class:`.types.StringLiteral` read from :paramref:`iterator` """ return _read_instance_from_iterparse( iterator, _read_string_literal_as_element, "StringLiteral" )
[docs]def string_literal_from_stream( stream: TextIO, has_iterparse: HasIterparse = xml.etree.ElementTree ) -> our_types.StringLiteral: """ Read an instance of :py:class:`.types.StringLiteral` from the :paramref:`stream`. Example usage: .. code-block:: import aas_core3_2.xmlization as our_xmlization with open_some_stream_over_network(...) as stream: instance = our_xmlization.string_literal_from_stream( stream ) # Do something with the ``instance`` :param stream: representing an instance of :py:class:`.types.StringLiteral` in XML :param has_iterparse: Module containing ``iterparse`` function. Default is to use :py:mod:`xml.etree.ElementTree` from the standard library. If you have to deal with malicious input, consider using a library such as `defusedxml.ElementTree`_. :raise: :py:class:`DeserializationException` if unexpected input :return: Instance of :py:class:`.types.StringLiteral` read from :paramref:`stream` """ iterator = has_iterparse.iterparse(stream, ["start", "end"]) return string_literal_from_iterparse(_with_elements_cleared_after_yield(iterator))
[docs]def string_literal_from_file( path: PathLike, has_iterparse: HasIterparse = xml.etree.ElementTree ) -> our_types.StringLiteral: """ Read an instance of :py:class:`.types.StringLiteral` from the :paramref:`path`. Example usage: .. code-block:: import pathlib import aas_core3_2.xmlization as our_xmlization path = pathlib.Path(...) instance = our_xmlization.string_literal_from_file( path ) # Do something with the ``instance`` :param path: to the file representing an instance of :py:class:`.types.StringLiteral` in XML :param has_iterparse: Module containing ``iterparse`` function. Default is to use :py:mod:`xml.etree.ElementTree` from the standard library. If you have to deal with malicious input, consider using a library such as `defusedxml.ElementTree`_. :raise: :py:class:`DeserializationException` if unexpected input :return: Instance of :py:class:`.types.StringLiteral` read from :paramref:`path` """ with open(os.fspath(path), encoding="utf-8") as fid: iterator = has_iterparse.iterparse(fid, ["start", "end"]) return string_literal_from_iterparse( _with_elements_cleared_after_yield(iterator) )
[docs]def string_literal_from_str( text: str, has_iterparse: HasIterparse = xml.etree.ElementTree ) -> our_types.StringLiteral: """ Read an instance of :py:class:`.types.StringLiteral` from the :paramref:`text`. Example usage: .. code-block:: import pathlib import aas_core3_2.xmlization as our_xmlization text = "<...>...</...>" instance = our_xmlization.string_literal_from_str( text ) # Do something with the ``instance`` :param text: representing an instance of :py:class:`.types.StringLiteral` in XML :param has_iterparse: Module containing ``iterparse`` function. Default is to use :py:mod:`xml.etree.ElementTree` from the standard library. If you have to deal with malicious input, consider using a library such as `defusedxml.ElementTree`_. :raise: :py:class:`DeserializationException` if unexpected input :return: Instance of :py:class:`.types.StringLiteral` read from :paramref:`text` """ iterator = has_iterparse.iterparse(io.StringIO(text), ["start", "end"]) return string_literal_from_iterparse(_with_elements_cleared_after_yield(iterator))
[docs]def attribute_operand_from_iterparse( iterator: Iterator[Tuple[str, Element]], ) -> our_types.AttributeOperand: """ Read an instance of :py:class:`.types.AttributeOperand` from the :paramref:`iterator`. Example usage: .. code-block:: import pathlib import xml.etree.ElementTree as ET import aas_core3_2.xmlization as our_xmlization path = pathlib.Path(...) with path.open("rt") as fid: iterator = ET.iterparse( source=fid, events=['start', 'end'] ) instance = our_xmlization.attribute_operand_from_iterparse( iterator ) # Do something with the ``instance`` :param iterator: Input stream of ``(event, element)`` coming from :py:func:`xml.etree.ElementTree.iterparse` with the argument ``events=["start", "end"]`` :raise: :py:class:`DeserializationException` if unexpected input :return: Instance of :py:class:`.types.AttributeOperand` read from :paramref:`iterator` """ return _read_instance_from_iterparse( iterator, _read_attribute_operand_as_element, "AttributeOperand" )
[docs]def attribute_operand_from_stream( stream: TextIO, has_iterparse: HasIterparse = xml.etree.ElementTree ) -> our_types.AttributeOperand: """ Read an instance of :py:class:`.types.AttributeOperand` from the :paramref:`stream`. Example usage: .. code-block:: import aas_core3_2.xmlization as our_xmlization with open_some_stream_over_network(...) as stream: instance = our_xmlization.attribute_operand_from_stream( stream ) # Do something with the ``instance`` :param stream: representing an instance of :py:class:`.types.AttributeOperand` in XML :param has_iterparse: Module containing ``iterparse`` function. Default is to use :py:mod:`xml.etree.ElementTree` from the standard library. If you have to deal with malicious input, consider using a library such as `defusedxml.ElementTree`_. :raise: :py:class:`DeserializationException` if unexpected input :return: Instance of :py:class:`.types.AttributeOperand` read from :paramref:`stream` """ iterator = has_iterparse.iterparse(stream, ["start", "end"]) return attribute_operand_from_iterparse( _with_elements_cleared_after_yield(iterator) )
[docs]def attribute_operand_from_file( path: PathLike, has_iterparse: HasIterparse = xml.etree.ElementTree ) -> our_types.AttributeOperand: """ Read an instance of :py:class:`.types.AttributeOperand` from the :paramref:`path`. Example usage: .. code-block:: import pathlib import aas_core3_2.xmlization as our_xmlization path = pathlib.Path(...) instance = our_xmlization.attribute_operand_from_file( path ) # Do something with the ``instance`` :param path: to the file representing an instance of :py:class:`.types.AttributeOperand` in XML :param has_iterparse: Module containing ``iterparse`` function. Default is to use :py:mod:`xml.etree.ElementTree` from the standard library. If you have to deal with malicious input, consider using a library such as `defusedxml.ElementTree`_. :raise: :py:class:`DeserializationException` if unexpected input :return: Instance of :py:class:`.types.AttributeOperand` read from :paramref:`path` """ with open(os.fspath(path), encoding="utf-8") as fid: iterator = has_iterparse.iterparse(fid, ["start", "end"]) return attribute_operand_from_iterparse( _with_elements_cleared_after_yield(iterator) )
[docs]def attribute_operand_from_str( text: str, has_iterparse: HasIterparse = xml.etree.ElementTree ) -> our_types.AttributeOperand: """ Read an instance of :py:class:`.types.AttributeOperand` from the :paramref:`text`. Example usage: .. code-block:: import pathlib import aas_core3_2.xmlization as our_xmlization text = "<...>...</...>" instance = our_xmlization.attribute_operand_from_str( text ) # Do something with the ``instance`` :param text: representing an instance of :py:class:`.types.AttributeOperand` in XML :param has_iterparse: Module containing ``iterparse`` function. Default is to use :py:mod:`xml.etree.ElementTree` from the standard library. If you have to deal with malicious input, consider using a library such as `defusedxml.ElementTree`_. :raise: :py:class:`DeserializationException` if unexpected input :return: Instance of :py:class:`.types.AttributeOperand` read from :paramref:`text` """ iterator = has_iterparse.iterparse(io.StringIO(text), ["start", "end"]) return attribute_operand_from_iterparse( _with_elements_cleared_after_yield(iterator) )
[docs]def number_literal_from_iterparse( iterator: Iterator[Tuple[str, Element]], ) -> our_types.NumberLiteral: """ Read an instance of :py:class:`.types.NumberLiteral` from the :paramref:`iterator`. Example usage: .. code-block:: import pathlib import xml.etree.ElementTree as ET import aas_core3_2.xmlization as our_xmlization path = pathlib.Path(...) with path.open("rt") as fid: iterator = ET.iterparse( source=fid, events=['start', 'end'] ) instance = our_xmlization.number_literal_from_iterparse( iterator ) # Do something with the ``instance`` :param iterator: Input stream of ``(event, element)`` coming from :py:func:`xml.etree.ElementTree.iterparse` with the argument ``events=["start", "end"]`` :raise: :py:class:`DeserializationException` if unexpected input :return: Instance of :py:class:`.types.NumberLiteral` read from :paramref:`iterator` """ return _read_instance_from_iterparse( iterator, _read_number_literal_as_element, "NumberLiteral" )
[docs]def number_literal_from_stream( stream: TextIO, has_iterparse: HasIterparse = xml.etree.ElementTree ) -> our_types.NumberLiteral: """ Read an instance of :py:class:`.types.NumberLiteral` from the :paramref:`stream`. Example usage: .. code-block:: import aas_core3_2.xmlization as our_xmlization with open_some_stream_over_network(...) as stream: instance = our_xmlization.number_literal_from_stream( stream ) # Do something with the ``instance`` :param stream: representing an instance of :py:class:`.types.NumberLiteral` in XML :param has_iterparse: Module containing ``iterparse`` function. Default is to use :py:mod:`xml.etree.ElementTree` from the standard library. If you have to deal with malicious input, consider using a library such as `defusedxml.ElementTree`_. :raise: :py:class:`DeserializationException` if unexpected input :return: Instance of :py:class:`.types.NumberLiteral` read from :paramref:`stream` """ iterator = has_iterparse.iterparse(stream, ["start", "end"]) return number_literal_from_iterparse(_with_elements_cleared_after_yield(iterator))
[docs]def number_literal_from_file( path: PathLike, has_iterparse: HasIterparse = xml.etree.ElementTree ) -> our_types.NumberLiteral: """ Read an instance of :py:class:`.types.NumberLiteral` from the :paramref:`path`. Example usage: .. code-block:: import pathlib import aas_core3_2.xmlization as our_xmlization path = pathlib.Path(...) instance = our_xmlization.number_literal_from_file( path ) # Do something with the ``instance`` :param path: to the file representing an instance of :py:class:`.types.NumberLiteral` in XML :param has_iterparse: Module containing ``iterparse`` function. Default is to use :py:mod:`xml.etree.ElementTree` from the standard library. If you have to deal with malicious input, consider using a library such as `defusedxml.ElementTree`_. :raise: :py:class:`DeserializationException` if unexpected input :return: Instance of :py:class:`.types.NumberLiteral` read from :paramref:`path` """ with open(os.fspath(path), encoding="utf-8") as fid: iterator = has_iterparse.iterparse(fid, ["start", "end"]) return number_literal_from_iterparse( _with_elements_cleared_after_yield(iterator) )
[docs]def number_literal_from_str( text: str, has_iterparse: HasIterparse = xml.etree.ElementTree ) -> our_types.NumberLiteral: """ Read an instance of :py:class:`.types.NumberLiteral` from the :paramref:`text`. Example usage: .. code-block:: import pathlib import aas_core3_2.xmlization as our_xmlization text = "<...>...</...>" instance = our_xmlization.number_literal_from_str( text ) # Do something with the ``instance`` :param text: representing an instance of :py:class:`.types.NumberLiteral` in XML :param has_iterparse: Module containing ``iterparse`` function. Default is to use :py:mod:`xml.etree.ElementTree` from the standard library. If you have to deal with malicious input, consider using a library such as `defusedxml.ElementTree`_. :raise: :py:class:`DeserializationException` if unexpected input :return: Instance of :py:class:`.types.NumberLiteral` read from :paramref:`text` """ iterator = has_iterparse.iterparse(io.StringIO(text), ["start", "end"]) return number_literal_from_iterparse(_with_elements_cleared_after_yield(iterator))
[docs]def hex_literal_from_iterparse( iterator: Iterator[Tuple[str, Element]], ) -> our_types.HexLiteral: """ Read an instance of :py:class:`.types.HexLiteral` from the :paramref:`iterator`. Example usage: .. code-block:: import pathlib import xml.etree.ElementTree as ET import aas_core3_2.xmlization as our_xmlization path = pathlib.Path(...) with path.open("rt") as fid: iterator = ET.iterparse( source=fid, events=['start', 'end'] ) instance = our_xmlization.hex_literal_from_iterparse( iterator ) # Do something with the ``instance`` :param iterator: Input stream of ``(event, element)`` coming from :py:func:`xml.etree.ElementTree.iterparse` with the argument ``events=["start", "end"]`` :raise: :py:class:`DeserializationException` if unexpected input :return: Instance of :py:class:`.types.HexLiteral` read from :paramref:`iterator` """ return _read_instance_from_iterparse( iterator, _read_hex_literal_as_element, "HexLiteral" )
[docs]def hex_literal_from_stream( stream: TextIO, has_iterparse: HasIterparse = xml.etree.ElementTree ) -> our_types.HexLiteral: """ Read an instance of :py:class:`.types.HexLiteral` from the :paramref:`stream`. Example usage: .. code-block:: import aas_core3_2.xmlization as our_xmlization with open_some_stream_over_network(...) as stream: instance = our_xmlization.hex_literal_from_stream( stream ) # Do something with the ``instance`` :param stream: representing an instance of :py:class:`.types.HexLiteral` in XML :param has_iterparse: Module containing ``iterparse`` function. Default is to use :py:mod:`xml.etree.ElementTree` from the standard library. If you have to deal with malicious input, consider using a library such as `defusedxml.ElementTree`_. :raise: :py:class:`DeserializationException` if unexpected input :return: Instance of :py:class:`.types.HexLiteral` read from :paramref:`stream` """ iterator = has_iterparse.iterparse(stream, ["start", "end"]) return hex_literal_from_iterparse(_with_elements_cleared_after_yield(iterator))
[docs]def hex_literal_from_file( path: PathLike, has_iterparse: HasIterparse = xml.etree.ElementTree ) -> our_types.HexLiteral: """ Read an instance of :py:class:`.types.HexLiteral` from the :paramref:`path`. Example usage: .. code-block:: import pathlib import aas_core3_2.xmlization as our_xmlization path = pathlib.Path(...) instance = our_xmlization.hex_literal_from_file( path ) # Do something with the ``instance`` :param path: to the file representing an instance of :py:class:`.types.HexLiteral` in XML :param has_iterparse: Module containing ``iterparse`` function. Default is to use :py:mod:`xml.etree.ElementTree` from the standard library. If you have to deal with malicious input, consider using a library such as `defusedxml.ElementTree`_. :raise: :py:class:`DeserializationException` if unexpected input :return: Instance of :py:class:`.types.HexLiteral` read from :paramref:`path` """ with open(os.fspath(path), encoding="utf-8") as fid: iterator = has_iterparse.iterparse(fid, ["start", "end"]) return hex_literal_from_iterparse(_with_elements_cleared_after_yield(iterator))
[docs]def hex_literal_from_str( text: str, has_iterparse: HasIterparse = xml.etree.ElementTree ) -> our_types.HexLiteral: """ Read an instance of :py:class:`.types.HexLiteral` from the :paramref:`text`. Example usage: .. code-block:: import pathlib import aas_core3_2.xmlization as our_xmlization text = "<...>...</...>" instance = our_xmlization.hex_literal_from_str( text ) # Do something with the ``instance`` :param text: representing an instance of :py:class:`.types.HexLiteral` in XML :param has_iterparse: Module containing ``iterparse`` function. Default is to use :py:mod:`xml.etree.ElementTree` from the standard library. If you have to deal with malicious input, consider using a library such as `defusedxml.ElementTree`_. :raise: :py:class:`DeserializationException` if unexpected input :return: Instance of :py:class:`.types.HexLiteral` read from :paramref:`text` """ iterator = has_iterparse.iterparse(io.StringIO(text), ["start", "end"]) return hex_literal_from_iterparse(_with_elements_cleared_after_yield(iterator))
[docs]def date_time_literal_from_iterparse( iterator: Iterator[Tuple[str, Element]], ) -> our_types.DateTimeLiteral: """ Read an instance of :py:class:`.types.DateTimeLiteral` from the :paramref:`iterator`. Example usage: .. code-block:: import pathlib import xml.etree.ElementTree as ET import aas_core3_2.xmlization as our_xmlization path = pathlib.Path(...) with path.open("rt") as fid: iterator = ET.iterparse( source=fid, events=['start', 'end'] ) instance = our_xmlization.date_time_literal_from_iterparse( iterator ) # Do something with the ``instance`` :param iterator: Input stream of ``(event, element)`` coming from :py:func:`xml.etree.ElementTree.iterparse` with the argument ``events=["start", "end"]`` :raise: :py:class:`DeserializationException` if unexpected input :return: Instance of :py:class:`.types.DateTimeLiteral` read from :paramref:`iterator` """ return _read_instance_from_iterparse( iterator, _read_date_time_literal_as_element, "DateTimeLiteral" )
[docs]def date_time_literal_from_stream( stream: TextIO, has_iterparse: HasIterparse = xml.etree.ElementTree ) -> our_types.DateTimeLiteral: """ Read an instance of :py:class:`.types.DateTimeLiteral` from the :paramref:`stream`. Example usage: .. code-block:: import aas_core3_2.xmlization as our_xmlization with open_some_stream_over_network(...) as stream: instance = our_xmlization.date_time_literal_from_stream( stream ) # Do something with the ``instance`` :param stream: representing an instance of :py:class:`.types.DateTimeLiteral` in XML :param has_iterparse: Module containing ``iterparse`` function. Default is to use :py:mod:`xml.etree.ElementTree` from the standard library. If you have to deal with malicious input, consider using a library such as `defusedxml.ElementTree`_. :raise: :py:class:`DeserializationException` if unexpected input :return: Instance of :py:class:`.types.DateTimeLiteral` read from :paramref:`stream` """ iterator = has_iterparse.iterparse(stream, ["start", "end"]) return date_time_literal_from_iterparse( _with_elements_cleared_after_yield(iterator) )
[docs]def date_time_literal_from_file( path: PathLike, has_iterparse: HasIterparse = xml.etree.ElementTree ) -> our_types.DateTimeLiteral: """ Read an instance of :py:class:`.types.DateTimeLiteral` from the :paramref:`path`. Example usage: .. code-block:: import pathlib import aas_core3_2.xmlization as our_xmlization path = pathlib.Path(...) instance = our_xmlization.date_time_literal_from_file( path ) # Do something with the ``instance`` :param path: to the file representing an instance of :py:class:`.types.DateTimeLiteral` in XML :param has_iterparse: Module containing ``iterparse`` function. Default is to use :py:mod:`xml.etree.ElementTree` from the standard library. If you have to deal with malicious input, consider using a library such as `defusedxml.ElementTree`_. :raise: :py:class:`DeserializationException` if unexpected input :return: Instance of :py:class:`.types.DateTimeLiteral` read from :paramref:`path` """ with open(os.fspath(path), encoding="utf-8") as fid: iterator = has_iterparse.iterparse(fid, ["start", "end"]) return date_time_literal_from_iterparse( _with_elements_cleared_after_yield(iterator) )
[docs]def date_time_literal_from_str( text: str, has_iterparse: HasIterparse = xml.etree.ElementTree ) -> our_types.DateTimeLiteral: """ Read an instance of :py:class:`.types.DateTimeLiteral` from the :paramref:`text`. Example usage: .. code-block:: import pathlib import aas_core3_2.xmlization as our_xmlization text = "<...>...</...>" instance = our_xmlization.date_time_literal_from_str( text ) # Do something with the ``instance`` :param text: representing an instance of :py:class:`.types.DateTimeLiteral` in XML :param has_iterparse: Module containing ``iterparse`` function. Default is to use :py:mod:`xml.etree.ElementTree` from the standard library. If you have to deal with malicious input, consider using a library such as `defusedxml.ElementTree`_. :raise: :py:class:`DeserializationException` if unexpected input :return: Instance of :py:class:`.types.DateTimeLiteral` read from :paramref:`text` """ iterator = has_iterparse.iterparse(io.StringIO(text), ["start", "end"]) return date_time_literal_from_iterparse( _with_elements_cleared_after_yield(iterator) )
[docs]def time_literal_from_iterparse( iterator: Iterator[Tuple[str, Element]], ) -> our_types.TimeLiteral: """ Read an instance of :py:class:`.types.TimeLiteral` from the :paramref:`iterator`. Example usage: .. code-block:: import pathlib import xml.etree.ElementTree as ET import aas_core3_2.xmlization as our_xmlization path = pathlib.Path(...) with path.open("rt") as fid: iterator = ET.iterparse( source=fid, events=['start', 'end'] ) instance = our_xmlization.time_literal_from_iterparse( iterator ) # Do something with the ``instance`` :param iterator: Input stream of ``(event, element)`` coming from :py:func:`xml.etree.ElementTree.iterparse` with the argument ``events=["start", "end"]`` :raise: :py:class:`DeserializationException` if unexpected input :return: Instance of :py:class:`.types.TimeLiteral` read from :paramref:`iterator` """ return _read_instance_from_iterparse( iterator, _read_time_literal_as_element, "TimeLiteral" )
[docs]def time_literal_from_stream( stream: TextIO, has_iterparse: HasIterparse = xml.etree.ElementTree ) -> our_types.TimeLiteral: """ Read an instance of :py:class:`.types.TimeLiteral` from the :paramref:`stream`. Example usage: .. code-block:: import aas_core3_2.xmlization as our_xmlization with open_some_stream_over_network(...) as stream: instance = our_xmlization.time_literal_from_stream( stream ) # Do something with the ``instance`` :param stream: representing an instance of :py:class:`.types.TimeLiteral` in XML :param has_iterparse: Module containing ``iterparse`` function. Default is to use :py:mod:`xml.etree.ElementTree` from the standard library. If you have to deal with malicious input, consider using a library such as `defusedxml.ElementTree`_. :raise: :py:class:`DeserializationException` if unexpected input :return: Instance of :py:class:`.types.TimeLiteral` read from :paramref:`stream` """ iterator = has_iterparse.iterparse(stream, ["start", "end"]) return time_literal_from_iterparse(_with_elements_cleared_after_yield(iterator))
[docs]def time_literal_from_file( path: PathLike, has_iterparse: HasIterparse = xml.etree.ElementTree ) -> our_types.TimeLiteral: """ Read an instance of :py:class:`.types.TimeLiteral` from the :paramref:`path`. Example usage: .. code-block:: import pathlib import aas_core3_2.xmlization as our_xmlization path = pathlib.Path(...) instance = our_xmlization.time_literal_from_file( path ) # Do something with the ``instance`` :param path: to the file representing an instance of :py:class:`.types.TimeLiteral` in XML :param has_iterparse: Module containing ``iterparse`` function. Default is to use :py:mod:`xml.etree.ElementTree` from the standard library. If you have to deal with malicious input, consider using a library such as `defusedxml.ElementTree`_. :raise: :py:class:`DeserializationException` if unexpected input :return: Instance of :py:class:`.types.TimeLiteral` read from :paramref:`path` """ with open(os.fspath(path), encoding="utf-8") as fid: iterator = has_iterparse.iterparse(fid, ["start", "end"]) return time_literal_from_iterparse(_with_elements_cleared_after_yield(iterator))
[docs]def time_literal_from_str( text: str, has_iterparse: HasIterparse = xml.etree.ElementTree ) -> our_types.TimeLiteral: """ Read an instance of :py:class:`.types.TimeLiteral` from the :paramref:`text`. Example usage: .. code-block:: import pathlib import aas_core3_2.xmlization as our_xmlization text = "<...>...</...>" instance = our_xmlization.time_literal_from_str( text ) # Do something with the ``instance`` :param text: representing an instance of :py:class:`.types.TimeLiteral` in XML :param has_iterparse: Module containing ``iterparse`` function. Default is to use :py:mod:`xml.etree.ElementTree` from the standard library. If you have to deal with malicious input, consider using a library such as `defusedxml.ElementTree`_. :raise: :py:class:`DeserializationException` if unexpected input :return: Instance of :py:class:`.types.TimeLiteral` read from :paramref:`text` """ iterator = has_iterparse.iterparse(io.StringIO(text), ["start", "end"]) return time_literal_from_iterparse(_with_elements_cleared_after_yield(iterator))
[docs]def boolean_literal_from_iterparse( iterator: Iterator[Tuple[str, Element]], ) -> our_types.BooleanLiteral: """ Read an instance of :py:class:`.types.BooleanLiteral` from the :paramref:`iterator`. Example usage: .. code-block:: import pathlib import xml.etree.ElementTree as ET import aas_core3_2.xmlization as our_xmlization path = pathlib.Path(...) with path.open("rt") as fid: iterator = ET.iterparse( source=fid, events=['start', 'end'] ) instance = our_xmlization.boolean_literal_from_iterparse( iterator ) # Do something with the ``instance`` :param iterator: Input stream of ``(event, element)`` coming from :py:func:`xml.etree.ElementTree.iterparse` with the argument ``events=["start", "end"]`` :raise: :py:class:`DeserializationException` if unexpected input :return: Instance of :py:class:`.types.BooleanLiteral` read from :paramref:`iterator` """ return _read_instance_from_iterparse( iterator, _read_boolean_literal_as_element, "BooleanLiteral" )
[docs]def boolean_literal_from_stream( stream: TextIO, has_iterparse: HasIterparse = xml.etree.ElementTree ) -> our_types.BooleanLiteral: """ Read an instance of :py:class:`.types.BooleanLiteral` from the :paramref:`stream`. Example usage: .. code-block:: import aas_core3_2.xmlization as our_xmlization with open_some_stream_over_network(...) as stream: instance = our_xmlization.boolean_literal_from_stream( stream ) # Do something with the ``instance`` :param stream: representing an instance of :py:class:`.types.BooleanLiteral` in XML :param has_iterparse: Module containing ``iterparse`` function. Default is to use :py:mod:`xml.etree.ElementTree` from the standard library. If you have to deal with malicious input, consider using a library such as `defusedxml.ElementTree`_. :raise: :py:class:`DeserializationException` if unexpected input :return: Instance of :py:class:`.types.BooleanLiteral` read from :paramref:`stream` """ iterator = has_iterparse.iterparse(stream, ["start", "end"]) return boolean_literal_from_iterparse(_with_elements_cleared_after_yield(iterator))
[docs]def boolean_literal_from_file( path: PathLike, has_iterparse: HasIterparse = xml.etree.ElementTree ) -> our_types.BooleanLiteral: """ Read an instance of :py:class:`.types.BooleanLiteral` from the :paramref:`path`. Example usage: .. code-block:: import pathlib import aas_core3_2.xmlization as our_xmlization path = pathlib.Path(...) instance = our_xmlization.boolean_literal_from_file( path ) # Do something with the ``instance`` :param path: to the file representing an instance of :py:class:`.types.BooleanLiteral` in XML :param has_iterparse: Module containing ``iterparse`` function. Default is to use :py:mod:`xml.etree.ElementTree` from the standard library. If you have to deal with malicious input, consider using a library such as `defusedxml.ElementTree`_. :raise: :py:class:`DeserializationException` if unexpected input :return: Instance of :py:class:`.types.BooleanLiteral` read from :paramref:`path` """ with open(os.fspath(path), encoding="utf-8") as fid: iterator = has_iterparse.iterparse(fid, ["start", "end"]) return boolean_literal_from_iterparse( _with_elements_cleared_after_yield(iterator) )
[docs]def boolean_literal_from_str( text: str, has_iterparse: HasIterparse = xml.etree.ElementTree ) -> our_types.BooleanLiteral: """ Read an instance of :py:class:`.types.BooleanLiteral` from the :paramref:`text`. Example usage: .. code-block:: import pathlib import aas_core3_2.xmlization as our_xmlization text = "<...>...</...>" instance = our_xmlization.boolean_literal_from_str( text ) # Do something with the ``instance`` :param text: representing an instance of :py:class:`.types.BooleanLiteral` in XML :param has_iterparse: Module containing ``iterparse`` function. Default is to use :py:mod:`xml.etree.ElementTree` from the standard library. If you have to deal with malicious input, consider using a library such as `defusedxml.ElementTree`_. :raise: :py:class:`DeserializationException` if unexpected input :return: Instance of :py:class:`.types.BooleanLiteral` read from :paramref:`text` """ iterator = has_iterparse.iterparse(io.StringIO(text), ["start", "end"]) return boolean_literal_from_iterparse(_with_elements_cleared_after_yield(iterator))
[docs]def string_cast_from_iterparse( iterator: Iterator[Tuple[str, Element]], ) -> our_types.StringCast: """ Read an instance of :py:class:`.types.StringCast` from the :paramref:`iterator`. Example usage: .. code-block:: import pathlib import xml.etree.ElementTree as ET import aas_core3_2.xmlization as our_xmlization path = pathlib.Path(...) with path.open("rt") as fid: iterator = ET.iterparse( source=fid, events=['start', 'end'] ) instance = our_xmlization.string_cast_from_iterparse( iterator ) # Do something with the ``instance`` :param iterator: Input stream of ``(event, element)`` coming from :py:func:`xml.etree.ElementTree.iterparse` with the argument ``events=["start", "end"]`` :raise: :py:class:`DeserializationException` if unexpected input :return: Instance of :py:class:`.types.StringCast` read from :paramref:`iterator` """ return _read_instance_from_iterparse( iterator, _read_string_cast_as_element, "StringCast" )
[docs]def string_cast_from_stream( stream: TextIO, has_iterparse: HasIterparse = xml.etree.ElementTree ) -> our_types.StringCast: """ Read an instance of :py:class:`.types.StringCast` from the :paramref:`stream`. Example usage: .. code-block:: import aas_core3_2.xmlization as our_xmlization with open_some_stream_over_network(...) as stream: instance = our_xmlization.string_cast_from_stream( stream ) # Do something with the ``instance`` :param stream: representing an instance of :py:class:`.types.StringCast` in XML :param has_iterparse: Module containing ``iterparse`` function. Default is to use :py:mod:`xml.etree.ElementTree` from the standard library. If you have to deal with malicious input, consider using a library such as `defusedxml.ElementTree`_. :raise: :py:class:`DeserializationException` if unexpected input :return: Instance of :py:class:`.types.StringCast` read from :paramref:`stream` """ iterator = has_iterparse.iterparse(stream, ["start", "end"]) return string_cast_from_iterparse(_with_elements_cleared_after_yield(iterator))
[docs]def string_cast_from_file( path: PathLike, has_iterparse: HasIterparse = xml.etree.ElementTree ) -> our_types.StringCast: """ Read an instance of :py:class:`.types.StringCast` from the :paramref:`path`. Example usage: .. code-block:: import pathlib import aas_core3_2.xmlization as our_xmlization path = pathlib.Path(...) instance = our_xmlization.string_cast_from_file( path ) # Do something with the ``instance`` :param path: to the file representing an instance of :py:class:`.types.StringCast` in XML :param has_iterparse: Module containing ``iterparse`` function. Default is to use :py:mod:`xml.etree.ElementTree` from the standard library. If you have to deal with malicious input, consider using a library such as `defusedxml.ElementTree`_. :raise: :py:class:`DeserializationException` if unexpected input :return: Instance of :py:class:`.types.StringCast` read from :paramref:`path` """ with open(os.fspath(path), encoding="utf-8") as fid: iterator = has_iterparse.iterparse(fid, ["start", "end"]) return string_cast_from_iterparse(_with_elements_cleared_after_yield(iterator))
[docs]def string_cast_from_str( text: str, has_iterparse: HasIterparse = xml.etree.ElementTree ) -> our_types.StringCast: """ Read an instance of :py:class:`.types.StringCast` from the :paramref:`text`. Example usage: .. code-block:: import pathlib import aas_core3_2.xmlization as our_xmlization text = "<...>...</...>" instance = our_xmlization.string_cast_from_str( text ) # Do something with the ``instance`` :param text: representing an instance of :py:class:`.types.StringCast` in XML :param has_iterparse: Module containing ``iterparse`` function. Default is to use :py:mod:`xml.etree.ElementTree` from the standard library. If you have to deal with malicious input, consider using a library such as `defusedxml.ElementTree`_. :raise: :py:class:`DeserializationException` if unexpected input :return: Instance of :py:class:`.types.StringCast` read from :paramref:`text` """ iterator = has_iterparse.iterparse(io.StringIO(text), ["start", "end"]) return string_cast_from_iterparse(_with_elements_cleared_after_yield(iterator))
[docs]def number_cast_from_iterparse( iterator: Iterator[Tuple[str, Element]], ) -> our_types.NumberCast: """ Read an instance of :py:class:`.types.NumberCast` from the :paramref:`iterator`. Example usage: .. code-block:: import pathlib import xml.etree.ElementTree as ET import aas_core3_2.xmlization as our_xmlization path = pathlib.Path(...) with path.open("rt") as fid: iterator = ET.iterparse( source=fid, events=['start', 'end'] ) instance = our_xmlization.number_cast_from_iterparse( iterator ) # Do something with the ``instance`` :param iterator: Input stream of ``(event, element)`` coming from :py:func:`xml.etree.ElementTree.iterparse` with the argument ``events=["start", "end"]`` :raise: :py:class:`DeserializationException` if unexpected input :return: Instance of :py:class:`.types.NumberCast` read from :paramref:`iterator` """ return _read_instance_from_iterparse( iterator, _read_number_cast_as_element, "NumberCast" )
[docs]def number_cast_from_stream( stream: TextIO, has_iterparse: HasIterparse = xml.etree.ElementTree ) -> our_types.NumberCast: """ Read an instance of :py:class:`.types.NumberCast` from the :paramref:`stream`. Example usage: .. code-block:: import aas_core3_2.xmlization as our_xmlization with open_some_stream_over_network(...) as stream: instance = our_xmlization.number_cast_from_stream( stream ) # Do something with the ``instance`` :param stream: representing an instance of :py:class:`.types.NumberCast` in XML :param has_iterparse: Module containing ``iterparse`` function. Default is to use :py:mod:`xml.etree.ElementTree` from the standard library. If you have to deal with malicious input, consider using a library such as `defusedxml.ElementTree`_. :raise: :py:class:`DeserializationException` if unexpected input :return: Instance of :py:class:`.types.NumberCast` read from :paramref:`stream` """ iterator = has_iterparse.iterparse(stream, ["start", "end"]) return number_cast_from_iterparse(_with_elements_cleared_after_yield(iterator))
[docs]def number_cast_from_file( path: PathLike, has_iterparse: HasIterparse = xml.etree.ElementTree ) -> our_types.NumberCast: """ Read an instance of :py:class:`.types.NumberCast` from the :paramref:`path`. Example usage: .. code-block:: import pathlib import aas_core3_2.xmlization as our_xmlization path = pathlib.Path(...) instance = our_xmlization.number_cast_from_file( path ) # Do something with the ``instance`` :param path: to the file representing an instance of :py:class:`.types.NumberCast` in XML :param has_iterparse: Module containing ``iterparse`` function. Default is to use :py:mod:`xml.etree.ElementTree` from the standard library. If you have to deal with malicious input, consider using a library such as `defusedxml.ElementTree`_. :raise: :py:class:`DeserializationException` if unexpected input :return: Instance of :py:class:`.types.NumberCast` read from :paramref:`path` """ with open(os.fspath(path), encoding="utf-8") as fid: iterator = has_iterparse.iterparse(fid, ["start", "end"]) return number_cast_from_iterparse(_with_elements_cleared_after_yield(iterator))
[docs]def number_cast_from_str( text: str, has_iterparse: HasIterparse = xml.etree.ElementTree ) -> our_types.NumberCast: """ Read an instance of :py:class:`.types.NumberCast` from the :paramref:`text`. Example usage: .. code-block:: import pathlib import aas_core3_2.xmlization as our_xmlization text = "<...>...</...>" instance = our_xmlization.number_cast_from_str( text ) # Do something with the ``instance`` :param text: representing an instance of :py:class:`.types.NumberCast` in XML :param has_iterparse: Module containing ``iterparse`` function. Default is to use :py:mod:`xml.etree.ElementTree` from the standard library. If you have to deal with malicious input, consider using a library such as `defusedxml.ElementTree`_. :raise: :py:class:`DeserializationException` if unexpected input :return: Instance of :py:class:`.types.NumberCast` read from :paramref:`text` """ iterator = has_iterparse.iterparse(io.StringIO(text), ["start", "end"]) return number_cast_from_iterparse(_with_elements_cleared_after_yield(iterator))
[docs]def hex_cast_from_iterparse( iterator: Iterator[Tuple[str, Element]], ) -> our_types.HexCast: """ Read an instance of :py:class:`.types.HexCast` from the :paramref:`iterator`. Example usage: .. code-block:: import pathlib import xml.etree.ElementTree as ET import aas_core3_2.xmlization as our_xmlization path = pathlib.Path(...) with path.open("rt") as fid: iterator = ET.iterparse( source=fid, events=['start', 'end'] ) instance = our_xmlization.hex_cast_from_iterparse( iterator ) # Do something with the ``instance`` :param iterator: Input stream of ``(event, element)`` coming from :py:func:`xml.etree.ElementTree.iterparse` with the argument ``events=["start", "end"]`` :raise: :py:class:`DeserializationException` if unexpected input :return: Instance of :py:class:`.types.HexCast` read from :paramref:`iterator` """ return _read_instance_from_iterparse(iterator, _read_hex_cast_as_element, "HexCast")
[docs]def hex_cast_from_stream( stream: TextIO, has_iterparse: HasIterparse = xml.etree.ElementTree ) -> our_types.HexCast: """ Read an instance of :py:class:`.types.HexCast` from the :paramref:`stream`. Example usage: .. code-block:: import aas_core3_2.xmlization as our_xmlization with open_some_stream_over_network(...) as stream: instance = our_xmlization.hex_cast_from_stream( stream ) # Do something with the ``instance`` :param stream: representing an instance of :py:class:`.types.HexCast` in XML :param has_iterparse: Module containing ``iterparse`` function. Default is to use :py:mod:`xml.etree.ElementTree` from the standard library. If you have to deal with malicious input, consider using a library such as `defusedxml.ElementTree`_. :raise: :py:class:`DeserializationException` if unexpected input :return: Instance of :py:class:`.types.HexCast` read from :paramref:`stream` """ iterator = has_iterparse.iterparse(stream, ["start", "end"]) return hex_cast_from_iterparse(_with_elements_cleared_after_yield(iterator))
[docs]def hex_cast_from_file( path: PathLike, has_iterparse: HasIterparse = xml.etree.ElementTree ) -> our_types.HexCast: """ Read an instance of :py:class:`.types.HexCast` from the :paramref:`path`. Example usage: .. code-block:: import pathlib import aas_core3_2.xmlization as our_xmlization path = pathlib.Path(...) instance = our_xmlization.hex_cast_from_file( path ) # Do something with the ``instance`` :param path: to the file representing an instance of :py:class:`.types.HexCast` in XML :param has_iterparse: Module containing ``iterparse`` function. Default is to use :py:mod:`xml.etree.ElementTree` from the standard library. If you have to deal with malicious input, consider using a library such as `defusedxml.ElementTree`_. :raise: :py:class:`DeserializationException` if unexpected input :return: Instance of :py:class:`.types.HexCast` read from :paramref:`path` """ with open(os.fspath(path), encoding="utf-8") as fid: iterator = has_iterparse.iterparse(fid, ["start", "end"]) return hex_cast_from_iterparse(_with_elements_cleared_after_yield(iterator))
[docs]def hex_cast_from_str( text: str, has_iterparse: HasIterparse = xml.etree.ElementTree ) -> our_types.HexCast: """ Read an instance of :py:class:`.types.HexCast` from the :paramref:`text`. Example usage: .. code-block:: import pathlib import aas_core3_2.xmlization as our_xmlization text = "<...>...</...>" instance = our_xmlization.hex_cast_from_str( text ) # Do something with the ``instance`` :param text: representing an instance of :py:class:`.types.HexCast` in XML :param has_iterparse: Module containing ``iterparse`` function. Default is to use :py:mod:`xml.etree.ElementTree` from the standard library. If you have to deal with malicious input, consider using a library such as `defusedxml.ElementTree`_. :raise: :py:class:`DeserializationException` if unexpected input :return: Instance of :py:class:`.types.HexCast` read from :paramref:`text` """ iterator = has_iterparse.iterparse(io.StringIO(text), ["start", "end"]) return hex_cast_from_iterparse(_with_elements_cleared_after_yield(iterator))
[docs]def boolean_cast_from_iterparse( iterator: Iterator[Tuple[str, Element]], ) -> our_types.BooleanCast: """ Read an instance of :py:class:`.types.BooleanCast` from the :paramref:`iterator`. Example usage: .. code-block:: import pathlib import xml.etree.ElementTree as ET import aas_core3_2.xmlization as our_xmlization path = pathlib.Path(...) with path.open("rt") as fid: iterator = ET.iterparse( source=fid, events=['start', 'end'] ) instance = our_xmlization.boolean_cast_from_iterparse( iterator ) # Do something with the ``instance`` :param iterator: Input stream of ``(event, element)`` coming from :py:func:`xml.etree.ElementTree.iterparse` with the argument ``events=["start", "end"]`` :raise: :py:class:`DeserializationException` if unexpected input :return: Instance of :py:class:`.types.BooleanCast` read from :paramref:`iterator` """ return _read_instance_from_iterparse( iterator, _read_boolean_cast_as_element, "BooleanCast" )
[docs]def boolean_cast_from_stream( stream: TextIO, has_iterparse: HasIterparse = xml.etree.ElementTree ) -> our_types.BooleanCast: """ Read an instance of :py:class:`.types.BooleanCast` from the :paramref:`stream`. Example usage: .. code-block:: import aas_core3_2.xmlization as our_xmlization with open_some_stream_over_network(...) as stream: instance = our_xmlization.boolean_cast_from_stream( stream ) # Do something with the ``instance`` :param stream: representing an instance of :py:class:`.types.BooleanCast` in XML :param has_iterparse: Module containing ``iterparse`` function. Default is to use :py:mod:`xml.etree.ElementTree` from the standard library. If you have to deal with malicious input, consider using a library such as `defusedxml.ElementTree`_. :raise: :py:class:`DeserializationException` if unexpected input :return: Instance of :py:class:`.types.BooleanCast` read from :paramref:`stream` """ iterator = has_iterparse.iterparse(stream, ["start", "end"]) return boolean_cast_from_iterparse(_with_elements_cleared_after_yield(iterator))
[docs]def boolean_cast_from_file( path: PathLike, has_iterparse: HasIterparse = xml.etree.ElementTree ) -> our_types.BooleanCast: """ Read an instance of :py:class:`.types.BooleanCast` from the :paramref:`path`. Example usage: .. code-block:: import pathlib import aas_core3_2.xmlization as our_xmlization path = pathlib.Path(...) instance = our_xmlization.boolean_cast_from_file( path ) # Do something with the ``instance`` :param path: to the file representing an instance of :py:class:`.types.BooleanCast` in XML :param has_iterparse: Module containing ``iterparse`` function. Default is to use :py:mod:`xml.etree.ElementTree` from the standard library. If you have to deal with malicious input, consider using a library such as `defusedxml.ElementTree`_. :raise: :py:class:`DeserializationException` if unexpected input :return: Instance of :py:class:`.types.BooleanCast` read from :paramref:`path` """ with open(os.fspath(path), encoding="utf-8") as fid: iterator = has_iterparse.iterparse(fid, ["start", "end"]) return boolean_cast_from_iterparse(_with_elements_cleared_after_yield(iterator))
[docs]def boolean_cast_from_str( text: str, has_iterparse: HasIterparse = xml.etree.ElementTree ) -> our_types.BooleanCast: """ Read an instance of :py:class:`.types.BooleanCast` from the :paramref:`text`. Example usage: .. code-block:: import pathlib import aas_core3_2.xmlization as our_xmlization text = "<...>...</...>" instance = our_xmlization.boolean_cast_from_str( text ) # Do something with the ``instance`` :param text: representing an instance of :py:class:`.types.BooleanCast` in XML :param has_iterparse: Module containing ``iterparse`` function. Default is to use :py:mod:`xml.etree.ElementTree` from the standard library. If you have to deal with malicious input, consider using a library such as `defusedxml.ElementTree`_. :raise: :py:class:`DeserializationException` if unexpected input :return: Instance of :py:class:`.types.BooleanCast` read from :paramref:`text` """ iterator = has_iterparse.iterparse(io.StringIO(text), ["start", "end"]) return boolean_cast_from_iterparse(_with_elements_cleared_after_yield(iterator))
[docs]def date_time_cast_from_iterparse( iterator: Iterator[Tuple[str, Element]], ) -> our_types.DateTimeCast: """ Read an instance of :py:class:`.types.DateTimeCast` from the :paramref:`iterator`. Example usage: .. code-block:: import pathlib import xml.etree.ElementTree as ET import aas_core3_2.xmlization as our_xmlization path = pathlib.Path(...) with path.open("rt") as fid: iterator = ET.iterparse( source=fid, events=['start', 'end'] ) instance = our_xmlization.date_time_cast_from_iterparse( iterator ) # Do something with the ``instance`` :param iterator: Input stream of ``(event, element)`` coming from :py:func:`xml.etree.ElementTree.iterparse` with the argument ``events=["start", "end"]`` :raise: :py:class:`DeserializationException` if unexpected input :return: Instance of :py:class:`.types.DateTimeCast` read from :paramref:`iterator` """ return _read_instance_from_iterparse( iterator, _read_date_time_cast_as_element, "DateTimeCast" )
[docs]def date_time_cast_from_stream( stream: TextIO, has_iterparse: HasIterparse = xml.etree.ElementTree ) -> our_types.DateTimeCast: """ Read an instance of :py:class:`.types.DateTimeCast` from the :paramref:`stream`. Example usage: .. code-block:: import aas_core3_2.xmlization as our_xmlization with open_some_stream_over_network(...) as stream: instance = our_xmlization.date_time_cast_from_stream( stream ) # Do something with the ``instance`` :param stream: representing an instance of :py:class:`.types.DateTimeCast` in XML :param has_iterparse: Module containing ``iterparse`` function. Default is to use :py:mod:`xml.etree.ElementTree` from the standard library. If you have to deal with malicious input, consider using a library such as `defusedxml.ElementTree`_. :raise: :py:class:`DeserializationException` if unexpected input :return: Instance of :py:class:`.types.DateTimeCast` read from :paramref:`stream` """ iterator = has_iterparse.iterparse(stream, ["start", "end"]) return date_time_cast_from_iterparse(_with_elements_cleared_after_yield(iterator))
[docs]def date_time_cast_from_file( path: PathLike, has_iterparse: HasIterparse = xml.etree.ElementTree ) -> our_types.DateTimeCast: """ Read an instance of :py:class:`.types.DateTimeCast` from the :paramref:`path`. Example usage: .. code-block:: import pathlib import aas_core3_2.xmlization as our_xmlization path = pathlib.Path(...) instance = our_xmlization.date_time_cast_from_file( path ) # Do something with the ``instance`` :param path: to the file representing an instance of :py:class:`.types.DateTimeCast` in XML :param has_iterparse: Module containing ``iterparse`` function. Default is to use :py:mod:`xml.etree.ElementTree` from the standard library. If you have to deal with malicious input, consider using a library such as `defusedxml.ElementTree`_. :raise: :py:class:`DeserializationException` if unexpected input :return: Instance of :py:class:`.types.DateTimeCast` read from :paramref:`path` """ with open(os.fspath(path), encoding="utf-8") as fid: iterator = has_iterparse.iterparse(fid, ["start", "end"]) return date_time_cast_from_iterparse( _with_elements_cleared_after_yield(iterator) )
[docs]def date_time_cast_from_str( text: str, has_iterparse: HasIterparse = xml.etree.ElementTree ) -> our_types.DateTimeCast: """ Read an instance of :py:class:`.types.DateTimeCast` from the :paramref:`text`. Example usage: .. code-block:: import pathlib import aas_core3_2.xmlization as our_xmlization text = "<...>...</...>" instance = our_xmlization.date_time_cast_from_str( text ) # Do something with the ``instance`` :param text: representing an instance of :py:class:`.types.DateTimeCast` in XML :param has_iterparse: Module containing ``iterparse`` function. Default is to use :py:mod:`xml.etree.ElementTree` from the standard library. If you have to deal with malicious input, consider using a library such as `defusedxml.ElementTree`_. :raise: :py:class:`DeserializationException` if unexpected input :return: Instance of :py:class:`.types.DateTimeCast` read from :paramref:`text` """ iterator = has_iterparse.iterparse(io.StringIO(text), ["start", "end"]) return date_time_cast_from_iterparse(_with_elements_cleared_after_yield(iterator))
[docs]def time_cast_from_iterparse( iterator: Iterator[Tuple[str, Element]], ) -> our_types.TimeCast: """ Read an instance of :py:class:`.types.TimeCast` from the :paramref:`iterator`. Example usage: .. code-block:: import pathlib import xml.etree.ElementTree as ET import aas_core3_2.xmlization as our_xmlization path = pathlib.Path(...) with path.open("rt") as fid: iterator = ET.iterparse( source=fid, events=['start', 'end'] ) instance = our_xmlization.time_cast_from_iterparse( iterator ) # Do something with the ``instance`` :param iterator: Input stream of ``(event, element)`` coming from :py:func:`xml.etree.ElementTree.iterparse` with the argument ``events=["start", "end"]`` :raise: :py:class:`DeserializationException` if unexpected input :return: Instance of :py:class:`.types.TimeCast` read from :paramref:`iterator` """ return _read_instance_from_iterparse( iterator, _read_time_cast_as_element, "TimeCast" )
[docs]def time_cast_from_stream( stream: TextIO, has_iterparse: HasIterparse = xml.etree.ElementTree ) -> our_types.TimeCast: """ Read an instance of :py:class:`.types.TimeCast` from the :paramref:`stream`. Example usage: .. code-block:: import aas_core3_2.xmlization as our_xmlization with open_some_stream_over_network(...) as stream: instance = our_xmlization.time_cast_from_stream( stream ) # Do something with the ``instance`` :param stream: representing an instance of :py:class:`.types.TimeCast` in XML :param has_iterparse: Module containing ``iterparse`` function. Default is to use :py:mod:`xml.etree.ElementTree` from the standard library. If you have to deal with malicious input, consider using a library such as `defusedxml.ElementTree`_. :raise: :py:class:`DeserializationException` if unexpected input :return: Instance of :py:class:`.types.TimeCast` read from :paramref:`stream` """ iterator = has_iterparse.iterparse(stream, ["start", "end"]) return time_cast_from_iterparse(_with_elements_cleared_after_yield(iterator))
[docs]def time_cast_from_file( path: PathLike, has_iterparse: HasIterparse = xml.etree.ElementTree ) -> our_types.TimeCast: """ Read an instance of :py:class:`.types.TimeCast` from the :paramref:`path`. Example usage: .. code-block:: import pathlib import aas_core3_2.xmlization as our_xmlization path = pathlib.Path(...) instance = our_xmlization.time_cast_from_file( path ) # Do something with the ``instance`` :param path: to the file representing an instance of :py:class:`.types.TimeCast` in XML :param has_iterparse: Module containing ``iterparse`` function. Default is to use :py:mod:`xml.etree.ElementTree` from the standard library. If you have to deal with malicious input, consider using a library such as `defusedxml.ElementTree`_. :raise: :py:class:`DeserializationException` if unexpected input :return: Instance of :py:class:`.types.TimeCast` read from :paramref:`path` """ with open(os.fspath(path), encoding="utf-8") as fid: iterator = has_iterparse.iterparse(fid, ["start", "end"]) return time_cast_from_iterparse(_with_elements_cleared_after_yield(iterator))
[docs]def time_cast_from_str( text: str, has_iterparse: HasIterparse = xml.etree.ElementTree ) -> our_types.TimeCast: """ Read an instance of :py:class:`.types.TimeCast` from the :paramref:`text`. Example usage: .. code-block:: import pathlib import aas_core3_2.xmlization as our_xmlization text = "<...>...</...>" instance = our_xmlization.time_cast_from_str( text ) # Do something with the ``instance`` :param text: representing an instance of :py:class:`.types.TimeCast` in XML :param has_iterparse: Module containing ``iterparse`` function. Default is to use :py:mod:`xml.etree.ElementTree` from the standard library. If you have to deal with malicious input, consider using a library such as `defusedxml.ElementTree`_. :raise: :py:class:`DeserializationException` if unexpected input :return: Instance of :py:class:`.types.TimeCast` read from :paramref:`text` """ iterator = has_iterparse.iterparse(io.StringIO(text), ["start", "end"]) return time_cast_from_iterparse(_with_elements_cleared_after_yield(iterator))
[docs]def day_of_week_from_iterparse( iterator: Iterator[Tuple[str, Element]], ) -> our_types.DayOfWeek: """ Read an instance of :py:class:`.types.DayOfWeek` from the :paramref:`iterator`. Example usage: .. code-block:: import pathlib import xml.etree.ElementTree as ET import aas_core3_2.xmlization as our_xmlization path = pathlib.Path(...) with path.open("rt") as fid: iterator = ET.iterparse( source=fid, events=['start', 'end'] ) instance = our_xmlization.day_of_week_from_iterparse( iterator ) # Do something with the ``instance`` :param iterator: Input stream of ``(event, element)`` coming from :py:func:`xml.etree.ElementTree.iterparse` with the argument ``events=["start", "end"]`` :raise: :py:class:`DeserializationException` if unexpected input :return: Instance of :py:class:`.types.DayOfWeek` read from :paramref:`iterator` """ return _read_instance_from_iterparse( iterator, _read_day_of_week_as_element, "DayOfWeek" )
[docs]def day_of_week_from_stream( stream: TextIO, has_iterparse: HasIterparse = xml.etree.ElementTree ) -> our_types.DayOfWeek: """ Read an instance of :py:class:`.types.DayOfWeek` from the :paramref:`stream`. Example usage: .. code-block:: import aas_core3_2.xmlization as our_xmlization with open_some_stream_over_network(...) as stream: instance = our_xmlization.day_of_week_from_stream( stream ) # Do something with the ``instance`` :param stream: representing an instance of :py:class:`.types.DayOfWeek` in XML :param has_iterparse: Module containing ``iterparse`` function. Default is to use :py:mod:`xml.etree.ElementTree` from the standard library. If you have to deal with malicious input, consider using a library such as `defusedxml.ElementTree`_. :raise: :py:class:`DeserializationException` if unexpected input :return: Instance of :py:class:`.types.DayOfWeek` read from :paramref:`stream` """ iterator = has_iterparse.iterparse(stream, ["start", "end"]) return day_of_week_from_iterparse(_with_elements_cleared_after_yield(iterator))
[docs]def day_of_week_from_file( path: PathLike, has_iterparse: HasIterparse = xml.etree.ElementTree ) -> our_types.DayOfWeek: """ Read an instance of :py:class:`.types.DayOfWeek` from the :paramref:`path`. Example usage: .. code-block:: import pathlib import aas_core3_2.xmlization as our_xmlization path = pathlib.Path(...) instance = our_xmlization.day_of_week_from_file( path ) # Do something with the ``instance`` :param path: to the file representing an instance of :py:class:`.types.DayOfWeek` in XML :param has_iterparse: Module containing ``iterparse`` function. Default is to use :py:mod:`xml.etree.ElementTree` from the standard library. If you have to deal with malicious input, consider using a library such as `defusedxml.ElementTree`_. :raise: :py:class:`DeserializationException` if unexpected input :return: Instance of :py:class:`.types.DayOfWeek` read from :paramref:`path` """ with open(os.fspath(path), encoding="utf-8") as fid: iterator = has_iterparse.iterparse(fid, ["start", "end"]) return day_of_week_from_iterparse(_with_elements_cleared_after_yield(iterator))
[docs]def day_of_week_from_str( text: str, has_iterparse: HasIterparse = xml.etree.ElementTree ) -> our_types.DayOfWeek: """ Read an instance of :py:class:`.types.DayOfWeek` from the :paramref:`text`. Example usage: .. code-block:: import pathlib import aas_core3_2.xmlization as our_xmlization text = "<...>...</...>" instance = our_xmlization.day_of_week_from_str( text ) # Do something with the ``instance`` :param text: representing an instance of :py:class:`.types.DayOfWeek` in XML :param has_iterparse: Module containing ``iterparse`` function. Default is to use :py:mod:`xml.etree.ElementTree` from the standard library. If you have to deal with malicious input, consider using a library such as `defusedxml.ElementTree`_. :raise: :py:class:`DeserializationException` if unexpected input :return: Instance of :py:class:`.types.DayOfWeek` read from :paramref:`text` """ iterator = has_iterparse.iterparse(io.StringIO(text), ["start", "end"]) return day_of_week_from_iterparse(_with_elements_cleared_after_yield(iterator))
[docs]def day_of_month_from_iterparse( iterator: Iterator[Tuple[str, Element]], ) -> our_types.DayOfMonth: """ Read an instance of :py:class:`.types.DayOfMonth` from the :paramref:`iterator`. Example usage: .. code-block:: import pathlib import xml.etree.ElementTree as ET import aas_core3_2.xmlization as our_xmlization path = pathlib.Path(...) with path.open("rt") as fid: iterator = ET.iterparse( source=fid, events=['start', 'end'] ) instance = our_xmlization.day_of_month_from_iterparse( iterator ) # Do something with the ``instance`` :param iterator: Input stream of ``(event, element)`` coming from :py:func:`xml.etree.ElementTree.iterparse` with the argument ``events=["start", "end"]`` :raise: :py:class:`DeserializationException` if unexpected input :return: Instance of :py:class:`.types.DayOfMonth` read from :paramref:`iterator` """ return _read_instance_from_iterparse( iterator, _read_day_of_month_as_element, "DayOfMonth" )
[docs]def day_of_month_from_stream( stream: TextIO, has_iterparse: HasIterparse = xml.etree.ElementTree ) -> our_types.DayOfMonth: """ Read an instance of :py:class:`.types.DayOfMonth` from the :paramref:`stream`. Example usage: .. code-block:: import aas_core3_2.xmlization as our_xmlization with open_some_stream_over_network(...) as stream: instance = our_xmlization.day_of_month_from_stream( stream ) # Do something with the ``instance`` :param stream: representing an instance of :py:class:`.types.DayOfMonth` in XML :param has_iterparse: Module containing ``iterparse`` function. Default is to use :py:mod:`xml.etree.ElementTree` from the standard library. If you have to deal with malicious input, consider using a library such as `defusedxml.ElementTree`_. :raise: :py:class:`DeserializationException` if unexpected input :return: Instance of :py:class:`.types.DayOfMonth` read from :paramref:`stream` """ iterator = has_iterparse.iterparse(stream, ["start", "end"]) return day_of_month_from_iterparse(_with_elements_cleared_after_yield(iterator))
[docs]def day_of_month_from_file( path: PathLike, has_iterparse: HasIterparse = xml.etree.ElementTree ) -> our_types.DayOfMonth: """ Read an instance of :py:class:`.types.DayOfMonth` from the :paramref:`path`. Example usage: .. code-block:: import pathlib import aas_core3_2.xmlization as our_xmlization path = pathlib.Path(...) instance = our_xmlization.day_of_month_from_file( path ) # Do something with the ``instance`` :param path: to the file representing an instance of :py:class:`.types.DayOfMonth` in XML :param has_iterparse: Module containing ``iterparse`` function. Default is to use :py:mod:`xml.etree.ElementTree` from the standard library. If you have to deal with malicious input, consider using a library such as `defusedxml.ElementTree`_. :raise: :py:class:`DeserializationException` if unexpected input :return: Instance of :py:class:`.types.DayOfMonth` read from :paramref:`path` """ with open(os.fspath(path), encoding="utf-8") as fid: iterator = has_iterparse.iterparse(fid, ["start", "end"]) return day_of_month_from_iterparse(_with_elements_cleared_after_yield(iterator))
[docs]def day_of_month_from_str( text: str, has_iterparse: HasIterparse = xml.etree.ElementTree ) -> our_types.DayOfMonth: """ Read an instance of :py:class:`.types.DayOfMonth` from the :paramref:`text`. Example usage: .. code-block:: import pathlib import aas_core3_2.xmlization as our_xmlization text = "<...>...</...>" instance = our_xmlization.day_of_month_from_str( text ) # Do something with the ``instance`` :param text: representing an instance of :py:class:`.types.DayOfMonth` in XML :param has_iterparse: Module containing ``iterparse`` function. Default is to use :py:mod:`xml.etree.ElementTree` from the standard library. If you have to deal with malicious input, consider using a library such as `defusedxml.ElementTree`_. :raise: :py:class:`DeserializationException` if unexpected input :return: Instance of :py:class:`.types.DayOfMonth` read from :paramref:`text` """ iterator = has_iterparse.iterparse(io.StringIO(text), ["start", "end"]) return day_of_month_from_iterparse(_with_elements_cleared_after_yield(iterator))
[docs]def month_from_iterparse(iterator: Iterator[Tuple[str, Element]]) -> our_types.Month: """ Read an instance of :py:class:`.types.Month` from the :paramref:`iterator`. Example usage: .. code-block:: import pathlib import xml.etree.ElementTree as ET import aas_core3_2.xmlization as our_xmlization path = pathlib.Path(...) with path.open("rt") as fid: iterator = ET.iterparse( source=fid, events=['start', 'end'] ) instance = our_xmlization.month_from_iterparse( iterator ) # Do something with the ``instance`` :param iterator: Input stream of ``(event, element)`` coming from :py:func:`xml.etree.ElementTree.iterparse` with the argument ``events=["start", "end"]`` :raise: :py:class:`DeserializationException` if unexpected input :return: Instance of :py:class:`.types.Month` read from :paramref:`iterator` """ return _read_instance_from_iterparse(iterator, _read_month_as_element, "Month")
[docs]def month_from_stream( stream: TextIO, has_iterparse: HasIterparse = xml.etree.ElementTree ) -> our_types.Month: """ Read an instance of :py:class:`.types.Month` from the :paramref:`stream`. Example usage: .. code-block:: import aas_core3_2.xmlization as our_xmlization with open_some_stream_over_network(...) as stream: instance = our_xmlization.month_from_stream( stream ) # Do something with the ``instance`` :param stream: representing an instance of :py:class:`.types.Month` in XML :param has_iterparse: Module containing ``iterparse`` function. Default is to use :py:mod:`xml.etree.ElementTree` from the standard library. If you have to deal with malicious input, consider using a library such as `defusedxml.ElementTree`_. :raise: :py:class:`DeserializationException` if unexpected input :return: Instance of :py:class:`.types.Month` read from :paramref:`stream` """ iterator = has_iterparse.iterparse(stream, ["start", "end"]) return month_from_iterparse(_with_elements_cleared_after_yield(iterator))
[docs]def month_from_file( path: PathLike, has_iterparse: HasIterparse = xml.etree.ElementTree ) -> our_types.Month: """ Read an instance of :py:class:`.types.Month` from the :paramref:`path`. Example usage: .. code-block:: import pathlib import aas_core3_2.xmlization as our_xmlization path = pathlib.Path(...) instance = our_xmlization.month_from_file( path ) # Do something with the ``instance`` :param path: to the file representing an instance of :py:class:`.types.Month` in XML :param has_iterparse: Module containing ``iterparse`` function. Default is to use :py:mod:`xml.etree.ElementTree` from the standard library. If you have to deal with malicious input, consider using a library such as `defusedxml.ElementTree`_. :raise: :py:class:`DeserializationException` if unexpected input :return: Instance of :py:class:`.types.Month` read from :paramref:`path` """ with open(os.fspath(path), encoding="utf-8") as fid: iterator = has_iterparse.iterparse(fid, ["start", "end"]) return month_from_iterparse(_with_elements_cleared_after_yield(iterator))
[docs]def month_from_str( text: str, has_iterparse: HasIterparse = xml.etree.ElementTree ) -> our_types.Month: """ Read an instance of :py:class:`.types.Month` from the :paramref:`text`. Example usage: .. code-block:: import pathlib import aas_core3_2.xmlization as our_xmlization text = "<...>...</...>" instance = our_xmlization.month_from_str( text ) # Do something with the ``instance`` :param text: representing an instance of :py:class:`.types.Month` in XML :param has_iterparse: Module containing ``iterparse`` function. Default is to use :py:mod:`xml.etree.ElementTree` from the standard library. If you have to deal with malicious input, consider using a library such as `defusedxml.ElementTree`_. :raise: :py:class:`DeserializationException` if unexpected input :return: Instance of :py:class:`.types.Month` read from :paramref:`text` """ iterator = has_iterparse.iterparse(io.StringIO(text), ["start", "end"]) return month_from_iterparse(_with_elements_cleared_after_yield(iterator))
[docs]def year_from_iterparse(iterator: Iterator[Tuple[str, Element]]) -> our_types.Year: """ Read an instance of :py:class:`.types.Year` from the :paramref:`iterator`. Example usage: .. code-block:: import pathlib import xml.etree.ElementTree as ET import aas_core3_2.xmlization as our_xmlization path = pathlib.Path(...) with path.open("rt") as fid: iterator = ET.iterparse( source=fid, events=['start', 'end'] ) instance = our_xmlization.year_from_iterparse( iterator ) # Do something with the ``instance`` :param iterator: Input stream of ``(event, element)`` coming from :py:func:`xml.etree.ElementTree.iterparse` with the argument ``events=["start", "end"]`` :raise: :py:class:`DeserializationException` if unexpected input :return: Instance of :py:class:`.types.Year` read from :paramref:`iterator` """ return _read_instance_from_iterparse(iterator, _read_year_as_element, "Year")
[docs]def year_from_stream( stream: TextIO, has_iterparse: HasIterparse = xml.etree.ElementTree ) -> our_types.Year: """ Read an instance of :py:class:`.types.Year` from the :paramref:`stream`. Example usage: .. code-block:: import aas_core3_2.xmlization as our_xmlization with open_some_stream_over_network(...) as stream: instance = our_xmlization.year_from_stream( stream ) # Do something with the ``instance`` :param stream: representing an instance of :py:class:`.types.Year` in XML :param has_iterparse: Module containing ``iterparse`` function. Default is to use :py:mod:`xml.etree.ElementTree` from the standard library. If you have to deal with malicious input, consider using a library such as `defusedxml.ElementTree`_. :raise: :py:class:`DeserializationException` if unexpected input :return: Instance of :py:class:`.types.Year` read from :paramref:`stream` """ iterator = has_iterparse.iterparse(stream, ["start", "end"]) return year_from_iterparse(_with_elements_cleared_after_yield(iterator))
[docs]def year_from_file( path: PathLike, has_iterparse: HasIterparse = xml.etree.ElementTree ) -> our_types.Year: """ Read an instance of :py:class:`.types.Year` from the :paramref:`path`. Example usage: .. code-block:: import pathlib import aas_core3_2.xmlization as our_xmlization path = pathlib.Path(...) instance = our_xmlization.year_from_file( path ) # Do something with the ``instance`` :param path: to the file representing an instance of :py:class:`.types.Year` in XML :param has_iterparse: Module containing ``iterparse`` function. Default is to use :py:mod:`xml.etree.ElementTree` from the standard library. If you have to deal with malicious input, consider using a library such as `defusedxml.ElementTree`_. :raise: :py:class:`DeserializationException` if unexpected input :return: Instance of :py:class:`.types.Year` read from :paramref:`path` """ with open(os.fspath(path), encoding="utf-8") as fid: iterator = has_iterparse.iterparse(fid, ["start", "end"]) return year_from_iterparse(_with_elements_cleared_after_yield(iterator))
[docs]def year_from_str( text: str, has_iterparse: HasIterparse = xml.etree.ElementTree ) -> our_types.Year: """ Read an instance of :py:class:`.types.Year` from the :paramref:`text`. Example usage: .. code-block:: import pathlib import aas_core3_2.xmlization as our_xmlization text = "<...>...</...>" instance = our_xmlization.year_from_str( text ) # Do something with the ``instance`` :param text: representing an instance of :py:class:`.types.Year` in XML :param has_iterparse: Module containing ``iterparse`` function. Default is to use :py:mod:`xml.etree.ElementTree` from the standard library. If you have to deal with malicious input, consider using a library such as `defusedxml.ElementTree`_. :raise: :py:class:`DeserializationException` if unexpected input :return: Instance of :py:class:`.types.Year` read from :paramref:`text` """ iterator = has_iterparse.iterparse(io.StringIO(text), ["start", "end"]) return year_from_iterparse(_with_elements_cleared_after_yield(iterator))
[docs]def date_time_attribute_operand_from_iterparse( iterator: Iterator[Tuple[str, Element]], ) -> our_types.DateTimeAttributeOperand: """ Read an instance of :py:class:`.types.DateTimeAttributeOperand` from the :paramref:`iterator`. Example usage: .. code-block:: import pathlib import xml.etree.ElementTree as ET import aas_core3_2.xmlization as our_xmlization path = pathlib.Path(...) with path.open("rt") as fid: iterator = ET.iterparse( source=fid, events=['start', 'end'] ) instance = our_xmlization.date_time_attribute_operand_from_iterparse( iterator ) # Do something with the ``instance`` :param iterator: Input stream of ``(event, element)`` coming from :py:func:`xml.etree.ElementTree.iterparse` with the argument ``events=["start", "end"]`` :raise: :py:class:`DeserializationException` if unexpected input :return: Instance of :py:class:`.types.DateTimeAttributeOperand` read from :paramref:`iterator` """ return _read_instance_from_iterparse( iterator, _read_date_time_attribute_operand_as_element, "DateTimeAttributeOperand", )
[docs]def date_time_attribute_operand_from_stream( stream: TextIO, has_iterparse: HasIterparse = xml.etree.ElementTree ) -> our_types.DateTimeAttributeOperand: """ Read an instance of :py:class:`.types.DateTimeAttributeOperand` from the :paramref:`stream`. Example usage: .. code-block:: import aas_core3_2.xmlization as our_xmlization with open_some_stream_over_network(...) as stream: instance = our_xmlization.date_time_attribute_operand_from_stream( stream ) # Do something with the ``instance`` :param stream: representing an instance of :py:class:`.types.DateTimeAttributeOperand` in XML :param has_iterparse: Module containing ``iterparse`` function. Default is to use :py:mod:`xml.etree.ElementTree` from the standard library. If you have to deal with malicious input, consider using a library such as `defusedxml.ElementTree`_. :raise: :py:class:`DeserializationException` if unexpected input :return: Instance of :py:class:`.types.DateTimeAttributeOperand` read from :paramref:`stream` """ iterator = has_iterparse.iterparse(stream, ["start", "end"]) return date_time_attribute_operand_from_iterparse( _with_elements_cleared_after_yield(iterator) )
[docs]def date_time_attribute_operand_from_file( path: PathLike, has_iterparse: HasIterparse = xml.etree.ElementTree ) -> our_types.DateTimeAttributeOperand: """ Read an instance of :py:class:`.types.DateTimeAttributeOperand` from the :paramref:`path`. Example usage: .. code-block:: import pathlib import aas_core3_2.xmlization as our_xmlization path = pathlib.Path(...) instance = our_xmlization.date_time_attribute_operand_from_file( path ) # Do something with the ``instance`` :param path: to the file representing an instance of :py:class:`.types.DateTimeAttributeOperand` in XML :param has_iterparse: Module containing ``iterparse`` function. Default is to use :py:mod:`xml.etree.ElementTree` from the standard library. If you have to deal with malicious input, consider using a library such as `defusedxml.ElementTree`_. :raise: :py:class:`DeserializationException` if unexpected input :return: Instance of :py:class:`.types.DateTimeAttributeOperand` read from :paramref:`path` """ with open(os.fspath(path), encoding="utf-8") as fid: iterator = has_iterparse.iterparse(fid, ["start", "end"]) return date_time_attribute_operand_from_iterparse( _with_elements_cleared_after_yield(iterator) )
[docs]def date_time_attribute_operand_from_str( text: str, has_iterparse: HasIterparse = xml.etree.ElementTree ) -> our_types.DateTimeAttributeOperand: """ Read an instance of :py:class:`.types.DateTimeAttributeOperand` from the :paramref:`text`. Example usage: .. code-block:: import pathlib import aas_core3_2.xmlization as our_xmlization text = "<...>...</...>" instance = our_xmlization.date_time_attribute_operand_from_str( text ) # Do something with the ``instance`` :param text: representing an instance of :py:class:`.types.DateTimeAttributeOperand` in XML :param has_iterparse: Module containing ``iterparse`` function. Default is to use :py:mod:`xml.etree.ElementTree` from the standard library. If you have to deal with malicious input, consider using a library such as `defusedxml.ElementTree`_. :raise: :py:class:`DeserializationException` if unexpected input :return: Instance of :py:class:`.types.DateTimeAttributeOperand` read from :paramref:`text` """ iterator = has_iterparse.iterparse(io.StringIO(text), ["start", "end"]) return date_time_attribute_operand_from_iterparse( _with_elements_cleared_after_yield(iterator) )
[docs]def equal_comparison_from_iterparse( iterator: Iterator[Tuple[str, Element]], ) -> our_types.EqualComparison: """ Read an instance of :py:class:`.types.EqualComparison` from the :paramref:`iterator`. Example usage: .. code-block:: import pathlib import xml.etree.ElementTree as ET import aas_core3_2.xmlization as our_xmlization path = pathlib.Path(...) with path.open("rt") as fid: iterator = ET.iterparse( source=fid, events=['start', 'end'] ) instance = our_xmlization.equal_comparison_from_iterparse( iterator ) # Do something with the ``instance`` :param iterator: Input stream of ``(event, element)`` coming from :py:func:`xml.etree.ElementTree.iterparse` with the argument ``events=["start", "end"]`` :raise: :py:class:`DeserializationException` if unexpected input :return: Instance of :py:class:`.types.EqualComparison` read from :paramref:`iterator` """ return _read_instance_from_iterparse( iterator, _read_equal_comparison_as_element, "EqualComparison" )
[docs]def equal_comparison_from_stream( stream: TextIO, has_iterparse: HasIterparse = xml.etree.ElementTree ) -> our_types.EqualComparison: """ Read an instance of :py:class:`.types.EqualComparison` from the :paramref:`stream`. Example usage: .. code-block:: import aas_core3_2.xmlization as our_xmlization with open_some_stream_over_network(...) as stream: instance = our_xmlization.equal_comparison_from_stream( stream ) # Do something with the ``instance`` :param stream: representing an instance of :py:class:`.types.EqualComparison` in XML :param has_iterparse: Module containing ``iterparse`` function. Default is to use :py:mod:`xml.etree.ElementTree` from the standard library. If you have to deal with malicious input, consider using a library such as `defusedxml.ElementTree`_. :raise: :py:class:`DeserializationException` if unexpected input :return: Instance of :py:class:`.types.EqualComparison` read from :paramref:`stream` """ iterator = has_iterparse.iterparse(stream, ["start", "end"]) return equal_comparison_from_iterparse(_with_elements_cleared_after_yield(iterator))
[docs]def equal_comparison_from_file( path: PathLike, has_iterparse: HasIterparse = xml.etree.ElementTree ) -> our_types.EqualComparison: """ Read an instance of :py:class:`.types.EqualComparison` from the :paramref:`path`. Example usage: .. code-block:: import pathlib import aas_core3_2.xmlization as our_xmlization path = pathlib.Path(...) instance = our_xmlization.equal_comparison_from_file( path ) # Do something with the ``instance`` :param path: to the file representing an instance of :py:class:`.types.EqualComparison` in XML :param has_iterparse: Module containing ``iterparse`` function. Default is to use :py:mod:`xml.etree.ElementTree` from the standard library. If you have to deal with malicious input, consider using a library such as `defusedxml.ElementTree`_. :raise: :py:class:`DeserializationException` if unexpected input :return: Instance of :py:class:`.types.EqualComparison` read from :paramref:`path` """ with open(os.fspath(path), encoding="utf-8") as fid: iterator = has_iterparse.iterparse(fid, ["start", "end"]) return equal_comparison_from_iterparse( _with_elements_cleared_after_yield(iterator) )
[docs]def equal_comparison_from_str( text: str, has_iterparse: HasIterparse = xml.etree.ElementTree ) -> our_types.EqualComparison: """ Read an instance of :py:class:`.types.EqualComparison` from the :paramref:`text`. Example usage: .. code-block:: import pathlib import aas_core3_2.xmlization as our_xmlization text = "<...>...</...>" instance = our_xmlization.equal_comparison_from_str( text ) # Do something with the ``instance`` :param text: representing an instance of :py:class:`.types.EqualComparison` in XML :param has_iterparse: Module containing ``iterparse`` function. Default is to use :py:mod:`xml.etree.ElementTree` from the standard library. If you have to deal with malicious input, consider using a library such as `defusedxml.ElementTree`_. :raise: :py:class:`DeserializationException` if unexpected input :return: Instance of :py:class:`.types.EqualComparison` read from :paramref:`text` """ iterator = has_iterparse.iterparse(io.StringIO(text), ["start", "end"]) return equal_comparison_from_iterparse(_with_elements_cleared_after_yield(iterator))
[docs]def not_equal_comparison_from_iterparse( iterator: Iterator[Tuple[str, Element]], ) -> our_types.NotEqualComparison: """ Read an instance of :py:class:`.types.NotEqualComparison` from the :paramref:`iterator`. Example usage: .. code-block:: import pathlib import xml.etree.ElementTree as ET import aas_core3_2.xmlization as our_xmlization path = pathlib.Path(...) with path.open("rt") as fid: iterator = ET.iterparse( source=fid, events=['start', 'end'] ) instance = our_xmlization.not_equal_comparison_from_iterparse( iterator ) # Do something with the ``instance`` :param iterator: Input stream of ``(event, element)`` coming from :py:func:`xml.etree.ElementTree.iterparse` with the argument ``events=["start", "end"]`` :raise: :py:class:`DeserializationException` if unexpected input :return: Instance of :py:class:`.types.NotEqualComparison` read from :paramref:`iterator` """ return _read_instance_from_iterparse( iterator, _read_not_equal_comparison_as_element, "NotEqualComparison" )
[docs]def not_equal_comparison_from_stream( stream: TextIO, has_iterparse: HasIterparse = xml.etree.ElementTree ) -> our_types.NotEqualComparison: """ Read an instance of :py:class:`.types.NotEqualComparison` from the :paramref:`stream`. Example usage: .. code-block:: import aas_core3_2.xmlization as our_xmlization with open_some_stream_over_network(...) as stream: instance = our_xmlization.not_equal_comparison_from_stream( stream ) # Do something with the ``instance`` :param stream: representing an instance of :py:class:`.types.NotEqualComparison` in XML :param has_iterparse: Module containing ``iterparse`` function. Default is to use :py:mod:`xml.etree.ElementTree` from the standard library. If you have to deal with malicious input, consider using a library such as `defusedxml.ElementTree`_. :raise: :py:class:`DeserializationException` if unexpected input :return: Instance of :py:class:`.types.NotEqualComparison` read from :paramref:`stream` """ iterator = has_iterparse.iterparse(stream, ["start", "end"]) return not_equal_comparison_from_iterparse( _with_elements_cleared_after_yield(iterator) )
[docs]def not_equal_comparison_from_file( path: PathLike, has_iterparse: HasIterparse = xml.etree.ElementTree ) -> our_types.NotEqualComparison: """ Read an instance of :py:class:`.types.NotEqualComparison` from the :paramref:`path`. Example usage: .. code-block:: import pathlib import aas_core3_2.xmlization as our_xmlization path = pathlib.Path(...) instance = our_xmlization.not_equal_comparison_from_file( path ) # Do something with the ``instance`` :param path: to the file representing an instance of :py:class:`.types.NotEqualComparison` in XML :param has_iterparse: Module containing ``iterparse`` function. Default is to use :py:mod:`xml.etree.ElementTree` from the standard library. If you have to deal with malicious input, consider using a library such as `defusedxml.ElementTree`_. :raise: :py:class:`DeserializationException` if unexpected input :return: Instance of :py:class:`.types.NotEqualComparison` read from :paramref:`path` """ with open(os.fspath(path), encoding="utf-8") as fid: iterator = has_iterparse.iterparse(fid, ["start", "end"]) return not_equal_comparison_from_iterparse( _with_elements_cleared_after_yield(iterator) )
[docs]def not_equal_comparison_from_str( text: str, has_iterparse: HasIterparse = xml.etree.ElementTree ) -> our_types.NotEqualComparison: """ Read an instance of :py:class:`.types.NotEqualComparison` from the :paramref:`text`. Example usage: .. code-block:: import pathlib import aas_core3_2.xmlization as our_xmlization text = "<...>...</...>" instance = our_xmlization.not_equal_comparison_from_str( text ) # Do something with the ``instance`` :param text: representing an instance of :py:class:`.types.NotEqualComparison` in XML :param has_iterparse: Module containing ``iterparse`` function. Default is to use :py:mod:`xml.etree.ElementTree` from the standard library. If you have to deal with malicious input, consider using a library such as `defusedxml.ElementTree`_. :raise: :py:class:`DeserializationException` if unexpected input :return: Instance of :py:class:`.types.NotEqualComparison` read from :paramref:`text` """ iterator = has_iterparse.iterparse(io.StringIO(text), ["start", "end"]) return not_equal_comparison_from_iterparse( _with_elements_cleared_after_yield(iterator) )
[docs]def greater_than_comparison_from_iterparse( iterator: Iterator[Tuple[str, Element]], ) -> our_types.GreaterThanComparison: """ Read an instance of :py:class:`.types.GreaterThanComparison` from the :paramref:`iterator`. Example usage: .. code-block:: import pathlib import xml.etree.ElementTree as ET import aas_core3_2.xmlization as our_xmlization path = pathlib.Path(...) with path.open("rt") as fid: iterator = ET.iterparse( source=fid, events=['start', 'end'] ) instance = our_xmlization.greater_than_comparison_from_iterparse( iterator ) # Do something with the ``instance`` :param iterator: Input stream of ``(event, element)`` coming from :py:func:`xml.etree.ElementTree.iterparse` with the argument ``events=["start", "end"]`` :raise: :py:class:`DeserializationException` if unexpected input :return: Instance of :py:class:`.types.GreaterThanComparison` read from :paramref:`iterator` """ return _read_instance_from_iterparse( iterator, _read_greater_than_comparison_as_element, "GreaterThanComparison" )
[docs]def greater_than_comparison_from_stream( stream: TextIO, has_iterparse: HasIterparse = xml.etree.ElementTree ) -> our_types.GreaterThanComparison: """ Read an instance of :py:class:`.types.GreaterThanComparison` from the :paramref:`stream`. Example usage: .. code-block:: import aas_core3_2.xmlization as our_xmlization with open_some_stream_over_network(...) as stream: instance = our_xmlization.greater_than_comparison_from_stream( stream ) # Do something with the ``instance`` :param stream: representing an instance of :py:class:`.types.GreaterThanComparison` in XML :param has_iterparse: Module containing ``iterparse`` function. Default is to use :py:mod:`xml.etree.ElementTree` from the standard library. If you have to deal with malicious input, consider using a library such as `defusedxml.ElementTree`_. :raise: :py:class:`DeserializationException` if unexpected input :return: Instance of :py:class:`.types.GreaterThanComparison` read from :paramref:`stream` """ iterator = has_iterparse.iterparse(stream, ["start", "end"]) return greater_than_comparison_from_iterparse( _with_elements_cleared_after_yield(iterator) )
[docs]def greater_than_comparison_from_file( path: PathLike, has_iterparse: HasIterparse = xml.etree.ElementTree ) -> our_types.GreaterThanComparison: """ Read an instance of :py:class:`.types.GreaterThanComparison` from the :paramref:`path`. Example usage: .. code-block:: import pathlib import aas_core3_2.xmlization as our_xmlization path = pathlib.Path(...) instance = our_xmlization.greater_than_comparison_from_file( path ) # Do something with the ``instance`` :param path: to the file representing an instance of :py:class:`.types.GreaterThanComparison` in XML :param has_iterparse: Module containing ``iterparse`` function. Default is to use :py:mod:`xml.etree.ElementTree` from the standard library. If you have to deal with malicious input, consider using a library such as `defusedxml.ElementTree`_. :raise: :py:class:`DeserializationException` if unexpected input :return: Instance of :py:class:`.types.GreaterThanComparison` read from :paramref:`path` """ with open(os.fspath(path), encoding="utf-8") as fid: iterator = has_iterparse.iterparse(fid, ["start", "end"]) return greater_than_comparison_from_iterparse( _with_elements_cleared_after_yield(iterator) )
[docs]def greater_than_comparison_from_str( text: str, has_iterparse: HasIterparse = xml.etree.ElementTree ) -> our_types.GreaterThanComparison: """ Read an instance of :py:class:`.types.GreaterThanComparison` from the :paramref:`text`. Example usage: .. code-block:: import pathlib import aas_core3_2.xmlization as our_xmlization text = "<...>...</...>" instance = our_xmlization.greater_than_comparison_from_str( text ) # Do something with the ``instance`` :param text: representing an instance of :py:class:`.types.GreaterThanComparison` in XML :param has_iterparse: Module containing ``iterparse`` function. Default is to use :py:mod:`xml.etree.ElementTree` from the standard library. If you have to deal with malicious input, consider using a library such as `defusedxml.ElementTree`_. :raise: :py:class:`DeserializationException` if unexpected input :return: Instance of :py:class:`.types.GreaterThanComparison` read from :paramref:`text` """ iterator = has_iterparse.iterparse(io.StringIO(text), ["start", "end"]) return greater_than_comparison_from_iterparse( _with_elements_cleared_after_yield(iterator) )
[docs]def greater_than_or_equal_comparison_from_iterparse( iterator: Iterator[Tuple[str, Element]], ) -> our_types.GreaterThanOrEqualComparison: """ Read an instance of :py:class:`.types.GreaterThanOrEqualComparison` from the :paramref:`iterator`. Example usage: .. code-block:: import pathlib import xml.etree.ElementTree as ET import aas_core3_2.xmlization as our_xmlization path = pathlib.Path(...) with path.open("rt") as fid: iterator = ET.iterparse( source=fid, events=['start', 'end'] ) instance = our_xmlization.greater_than_or_equal_comparison_from_iterparse( iterator ) # Do something with the ``instance`` :param iterator: Input stream of ``(event, element)`` coming from :py:func:`xml.etree.ElementTree.iterparse` with the argument ``events=["start", "end"]`` :raise: :py:class:`DeserializationException` if unexpected input :return: Instance of :py:class:`.types.GreaterThanOrEqualComparison` read from :paramref:`iterator` """ return _read_instance_from_iterparse( iterator, _read_greater_than_or_equal_comparison_as_element, "GreaterThanOrEqualComparison", )
[docs]def greater_than_or_equal_comparison_from_stream( stream: TextIO, has_iterparse: HasIterparse = xml.etree.ElementTree ) -> our_types.GreaterThanOrEqualComparison: """ Read an instance of :py:class:`.types.GreaterThanOrEqualComparison` from the :paramref:`stream`. Example usage: .. code-block:: import aas_core3_2.xmlization as our_xmlization with open_some_stream_over_network(...) as stream: instance = our_xmlization.greater_than_or_equal_comparison_from_stream( stream ) # Do something with the ``instance`` :param stream: representing an instance of :py:class:`.types.GreaterThanOrEqualComparison` in XML :param has_iterparse: Module containing ``iterparse`` function. Default is to use :py:mod:`xml.etree.ElementTree` from the standard library. If you have to deal with malicious input, consider using a library such as `defusedxml.ElementTree`_. :raise: :py:class:`DeserializationException` if unexpected input :return: Instance of :py:class:`.types.GreaterThanOrEqualComparison` read from :paramref:`stream` """ iterator = has_iterparse.iterparse(stream, ["start", "end"]) return greater_than_or_equal_comparison_from_iterparse( _with_elements_cleared_after_yield(iterator) )
[docs]def greater_than_or_equal_comparison_from_file( path: PathLike, has_iterparse: HasIterparse = xml.etree.ElementTree ) -> our_types.GreaterThanOrEqualComparison: """ Read an instance of :py:class:`.types.GreaterThanOrEqualComparison` from the :paramref:`path`. Example usage: .. code-block:: import pathlib import aas_core3_2.xmlization as our_xmlization path = pathlib.Path(...) instance = our_xmlization.greater_than_or_equal_comparison_from_file( path ) # Do something with the ``instance`` :param path: to the file representing an instance of :py:class:`.types.GreaterThanOrEqualComparison` in XML :param has_iterparse: Module containing ``iterparse`` function. Default is to use :py:mod:`xml.etree.ElementTree` from the standard library. If you have to deal with malicious input, consider using a library such as `defusedxml.ElementTree`_. :raise: :py:class:`DeserializationException` if unexpected input :return: Instance of :py:class:`.types.GreaterThanOrEqualComparison` read from :paramref:`path` """ with open(os.fspath(path), encoding="utf-8") as fid: iterator = has_iterparse.iterparse(fid, ["start", "end"]) return greater_than_or_equal_comparison_from_iterparse( _with_elements_cleared_after_yield(iterator) )
[docs]def greater_than_or_equal_comparison_from_str( text: str, has_iterparse: HasIterparse = xml.etree.ElementTree ) -> our_types.GreaterThanOrEqualComparison: """ Read an instance of :py:class:`.types.GreaterThanOrEqualComparison` from the :paramref:`text`. Example usage: .. code-block:: import pathlib import aas_core3_2.xmlization as our_xmlization text = "<...>...</...>" instance = our_xmlization.greater_than_or_equal_comparison_from_str( text ) # Do something with the ``instance`` :param text: representing an instance of :py:class:`.types.GreaterThanOrEqualComparison` in XML :param has_iterparse: Module containing ``iterparse`` function. Default is to use :py:mod:`xml.etree.ElementTree` from the standard library. If you have to deal with malicious input, consider using a library such as `defusedxml.ElementTree`_. :raise: :py:class:`DeserializationException` if unexpected input :return: Instance of :py:class:`.types.GreaterThanOrEqualComparison` read from :paramref:`text` """ iterator = has_iterparse.iterparse(io.StringIO(text), ["start", "end"]) return greater_than_or_equal_comparison_from_iterparse( _with_elements_cleared_after_yield(iterator) )
[docs]def less_than_comparison_from_iterparse( iterator: Iterator[Tuple[str, Element]], ) -> our_types.LessThanComparison: """ Read an instance of :py:class:`.types.LessThanComparison` from the :paramref:`iterator`. Example usage: .. code-block:: import pathlib import xml.etree.ElementTree as ET import aas_core3_2.xmlization as our_xmlization path = pathlib.Path(...) with path.open("rt") as fid: iterator = ET.iterparse( source=fid, events=['start', 'end'] ) instance = our_xmlization.less_than_comparison_from_iterparse( iterator ) # Do something with the ``instance`` :param iterator: Input stream of ``(event, element)`` coming from :py:func:`xml.etree.ElementTree.iterparse` with the argument ``events=["start", "end"]`` :raise: :py:class:`DeserializationException` if unexpected input :return: Instance of :py:class:`.types.LessThanComparison` read from :paramref:`iterator` """ return _read_instance_from_iterparse( iterator, _read_less_than_comparison_as_element, "LessThanComparison" )
[docs]def less_than_comparison_from_stream( stream: TextIO, has_iterparse: HasIterparse = xml.etree.ElementTree ) -> our_types.LessThanComparison: """ Read an instance of :py:class:`.types.LessThanComparison` from the :paramref:`stream`. Example usage: .. code-block:: import aas_core3_2.xmlization as our_xmlization with open_some_stream_over_network(...) as stream: instance = our_xmlization.less_than_comparison_from_stream( stream ) # Do something with the ``instance`` :param stream: representing an instance of :py:class:`.types.LessThanComparison` in XML :param has_iterparse: Module containing ``iterparse`` function. Default is to use :py:mod:`xml.etree.ElementTree` from the standard library. If you have to deal with malicious input, consider using a library such as `defusedxml.ElementTree`_. :raise: :py:class:`DeserializationException` if unexpected input :return: Instance of :py:class:`.types.LessThanComparison` read from :paramref:`stream` """ iterator = has_iterparse.iterparse(stream, ["start", "end"]) return less_than_comparison_from_iterparse( _with_elements_cleared_after_yield(iterator) )
[docs]def less_than_comparison_from_file( path: PathLike, has_iterparse: HasIterparse = xml.etree.ElementTree ) -> our_types.LessThanComparison: """ Read an instance of :py:class:`.types.LessThanComparison` from the :paramref:`path`. Example usage: .. code-block:: import pathlib import aas_core3_2.xmlization as our_xmlization path = pathlib.Path(...) instance = our_xmlization.less_than_comparison_from_file( path ) # Do something with the ``instance`` :param path: to the file representing an instance of :py:class:`.types.LessThanComparison` in XML :param has_iterparse: Module containing ``iterparse`` function. Default is to use :py:mod:`xml.etree.ElementTree` from the standard library. If you have to deal with malicious input, consider using a library such as `defusedxml.ElementTree`_. :raise: :py:class:`DeserializationException` if unexpected input :return: Instance of :py:class:`.types.LessThanComparison` read from :paramref:`path` """ with open(os.fspath(path), encoding="utf-8") as fid: iterator = has_iterparse.iterparse(fid, ["start", "end"]) return less_than_comparison_from_iterparse( _with_elements_cleared_after_yield(iterator) )
[docs]def less_than_comparison_from_str( text: str, has_iterparse: HasIterparse = xml.etree.ElementTree ) -> our_types.LessThanComparison: """ Read an instance of :py:class:`.types.LessThanComparison` from the :paramref:`text`. Example usage: .. code-block:: import pathlib import aas_core3_2.xmlization as our_xmlization text = "<...>...</...>" instance = our_xmlization.less_than_comparison_from_str( text ) # Do something with the ``instance`` :param text: representing an instance of :py:class:`.types.LessThanComparison` in XML :param has_iterparse: Module containing ``iterparse`` function. Default is to use :py:mod:`xml.etree.ElementTree` from the standard library. If you have to deal with malicious input, consider using a library such as `defusedxml.ElementTree`_. :raise: :py:class:`DeserializationException` if unexpected input :return: Instance of :py:class:`.types.LessThanComparison` read from :paramref:`text` """ iterator = has_iterparse.iterparse(io.StringIO(text), ["start", "end"]) return less_than_comparison_from_iterparse( _with_elements_cleared_after_yield(iterator) )
[docs]def less_than_or_equal_comparison_from_iterparse( iterator: Iterator[Tuple[str, Element]], ) -> our_types.LessThanOrEqualComparison: """ Read an instance of :py:class:`.types.LessThanOrEqualComparison` from the :paramref:`iterator`. Example usage: .. code-block:: import pathlib import xml.etree.ElementTree as ET import aas_core3_2.xmlization as our_xmlization path = pathlib.Path(...) with path.open("rt") as fid: iterator = ET.iterparse( source=fid, events=['start', 'end'] ) instance = our_xmlization.less_than_or_equal_comparison_from_iterparse( iterator ) # Do something with the ``instance`` :param iterator: Input stream of ``(event, element)`` coming from :py:func:`xml.etree.ElementTree.iterparse` with the argument ``events=["start", "end"]`` :raise: :py:class:`DeserializationException` if unexpected input :return: Instance of :py:class:`.types.LessThanOrEqualComparison` read from :paramref:`iterator` """ return _read_instance_from_iterparse( iterator, _read_less_than_or_equal_comparison_as_element, "LessThanOrEqualComparison", )
[docs]def less_than_or_equal_comparison_from_stream( stream: TextIO, has_iterparse: HasIterparse = xml.etree.ElementTree ) -> our_types.LessThanOrEqualComparison: """ Read an instance of :py:class:`.types.LessThanOrEqualComparison` from the :paramref:`stream`. Example usage: .. code-block:: import aas_core3_2.xmlization as our_xmlization with open_some_stream_over_network(...) as stream: instance = our_xmlization.less_than_or_equal_comparison_from_stream( stream ) # Do something with the ``instance`` :param stream: representing an instance of :py:class:`.types.LessThanOrEqualComparison` in XML :param has_iterparse: Module containing ``iterparse`` function. Default is to use :py:mod:`xml.etree.ElementTree` from the standard library. If you have to deal with malicious input, consider using a library such as `defusedxml.ElementTree`_. :raise: :py:class:`DeserializationException` if unexpected input :return: Instance of :py:class:`.types.LessThanOrEqualComparison` read from :paramref:`stream` """ iterator = has_iterparse.iterparse(stream, ["start", "end"]) return less_than_or_equal_comparison_from_iterparse( _with_elements_cleared_after_yield(iterator) )
[docs]def less_than_or_equal_comparison_from_file( path: PathLike, has_iterparse: HasIterparse = xml.etree.ElementTree ) -> our_types.LessThanOrEqualComparison: """ Read an instance of :py:class:`.types.LessThanOrEqualComparison` from the :paramref:`path`. Example usage: .. code-block:: import pathlib import aas_core3_2.xmlization as our_xmlization path = pathlib.Path(...) instance = our_xmlization.less_than_or_equal_comparison_from_file( path ) # Do something with the ``instance`` :param path: to the file representing an instance of :py:class:`.types.LessThanOrEqualComparison` in XML :param has_iterparse: Module containing ``iterparse`` function. Default is to use :py:mod:`xml.etree.ElementTree` from the standard library. If you have to deal with malicious input, consider using a library such as `defusedxml.ElementTree`_. :raise: :py:class:`DeserializationException` if unexpected input :return: Instance of :py:class:`.types.LessThanOrEqualComparison` read from :paramref:`path` """ with open(os.fspath(path), encoding="utf-8") as fid: iterator = has_iterparse.iterparse(fid, ["start", "end"]) return less_than_or_equal_comparison_from_iterparse( _with_elements_cleared_after_yield(iterator) )
[docs]def less_than_or_equal_comparison_from_str( text: str, has_iterparse: HasIterparse = xml.etree.ElementTree ) -> our_types.LessThanOrEqualComparison: """ Read an instance of :py:class:`.types.LessThanOrEqualComparison` from the :paramref:`text`. Example usage: .. code-block:: import pathlib import aas_core3_2.xmlization as our_xmlization text = "<...>...</...>" instance = our_xmlization.less_than_or_equal_comparison_from_str( text ) # Do something with the ``instance`` :param text: representing an instance of :py:class:`.types.LessThanOrEqualComparison` in XML :param has_iterparse: Module containing ``iterparse`` function. Default is to use :py:mod:`xml.etree.ElementTree` from the standard library. If you have to deal with malicious input, consider using a library such as `defusedxml.ElementTree`_. :raise: :py:class:`DeserializationException` if unexpected input :return: Instance of :py:class:`.types.LessThanOrEqualComparison` read from :paramref:`text` """ iterator = has_iterparse.iterparse(io.StringIO(text), ["start", "end"]) return less_than_or_equal_comparison_from_iterparse( _with_elements_cleared_after_yield(iterator) )
[docs]def contains_comparison_from_iterparse( iterator: Iterator[Tuple[str, Element]], ) -> our_types.ContainsComparison: """ Read an instance of :py:class:`.types.ContainsComparison` from the :paramref:`iterator`. Example usage: .. code-block:: import pathlib import xml.etree.ElementTree as ET import aas_core3_2.xmlization as our_xmlization path = pathlib.Path(...) with path.open("rt") as fid: iterator = ET.iterparse( source=fid, events=['start', 'end'] ) instance = our_xmlization.contains_comparison_from_iterparse( iterator ) # Do something with the ``instance`` :param iterator: Input stream of ``(event, element)`` coming from :py:func:`xml.etree.ElementTree.iterparse` with the argument ``events=["start", "end"]`` :raise: :py:class:`DeserializationException` if unexpected input :return: Instance of :py:class:`.types.ContainsComparison` read from :paramref:`iterator` """ return _read_instance_from_iterparse( iterator, _read_contains_comparison_as_element, "ContainsComparison" )
[docs]def contains_comparison_from_stream( stream: TextIO, has_iterparse: HasIterparse = xml.etree.ElementTree ) -> our_types.ContainsComparison: """ Read an instance of :py:class:`.types.ContainsComparison` from the :paramref:`stream`. Example usage: .. code-block:: import aas_core3_2.xmlization as our_xmlization with open_some_stream_over_network(...) as stream: instance = our_xmlization.contains_comparison_from_stream( stream ) # Do something with the ``instance`` :param stream: representing an instance of :py:class:`.types.ContainsComparison` in XML :param has_iterparse: Module containing ``iterparse`` function. Default is to use :py:mod:`xml.etree.ElementTree` from the standard library. If you have to deal with malicious input, consider using a library such as `defusedxml.ElementTree`_. :raise: :py:class:`DeserializationException` if unexpected input :return: Instance of :py:class:`.types.ContainsComparison` read from :paramref:`stream` """ iterator = has_iterparse.iterparse(stream, ["start", "end"]) return contains_comparison_from_iterparse( _with_elements_cleared_after_yield(iterator) )
[docs]def contains_comparison_from_file( path: PathLike, has_iterparse: HasIterparse = xml.etree.ElementTree ) -> our_types.ContainsComparison: """ Read an instance of :py:class:`.types.ContainsComparison` from the :paramref:`path`. Example usage: .. code-block:: import pathlib import aas_core3_2.xmlization as our_xmlization path = pathlib.Path(...) instance = our_xmlization.contains_comparison_from_file( path ) # Do something with the ``instance`` :param path: to the file representing an instance of :py:class:`.types.ContainsComparison` in XML :param has_iterparse: Module containing ``iterparse`` function. Default is to use :py:mod:`xml.etree.ElementTree` from the standard library. If you have to deal with malicious input, consider using a library such as `defusedxml.ElementTree`_. :raise: :py:class:`DeserializationException` if unexpected input :return: Instance of :py:class:`.types.ContainsComparison` read from :paramref:`path` """ with open(os.fspath(path), encoding="utf-8") as fid: iterator = has_iterparse.iterparse(fid, ["start", "end"]) return contains_comparison_from_iterparse( _with_elements_cleared_after_yield(iterator) )
[docs]def contains_comparison_from_str( text: str, has_iterparse: HasIterparse = xml.etree.ElementTree ) -> our_types.ContainsComparison: """ Read an instance of :py:class:`.types.ContainsComparison` from the :paramref:`text`. Example usage: .. code-block:: import pathlib import aas_core3_2.xmlization as our_xmlization text = "<...>...</...>" instance = our_xmlization.contains_comparison_from_str( text ) # Do something with the ``instance`` :param text: representing an instance of :py:class:`.types.ContainsComparison` in XML :param has_iterparse: Module containing ``iterparse`` function. Default is to use :py:mod:`xml.etree.ElementTree` from the standard library. If you have to deal with malicious input, consider using a library such as `defusedxml.ElementTree`_. :raise: :py:class:`DeserializationException` if unexpected input :return: Instance of :py:class:`.types.ContainsComparison` read from :paramref:`text` """ iterator = has_iterparse.iterparse(io.StringIO(text), ["start", "end"]) return contains_comparison_from_iterparse( _with_elements_cleared_after_yield(iterator) )
[docs]def starts_with_comparison_from_iterparse( iterator: Iterator[Tuple[str, Element]], ) -> our_types.StartsWithComparison: """ Read an instance of :py:class:`.types.StartsWithComparison` from the :paramref:`iterator`. Example usage: .. code-block:: import pathlib import xml.etree.ElementTree as ET import aas_core3_2.xmlization as our_xmlization path = pathlib.Path(...) with path.open("rt") as fid: iterator = ET.iterparse( source=fid, events=['start', 'end'] ) instance = our_xmlization.starts_with_comparison_from_iterparse( iterator ) # Do something with the ``instance`` :param iterator: Input stream of ``(event, element)`` coming from :py:func:`xml.etree.ElementTree.iterparse` with the argument ``events=["start", "end"]`` :raise: :py:class:`DeserializationException` if unexpected input :return: Instance of :py:class:`.types.StartsWithComparison` read from :paramref:`iterator` """ return _read_instance_from_iterparse( iterator, _read_starts_with_comparison_as_element, "StartsWithComparison" )
[docs]def starts_with_comparison_from_stream( stream: TextIO, has_iterparse: HasIterparse = xml.etree.ElementTree ) -> our_types.StartsWithComparison: """ Read an instance of :py:class:`.types.StartsWithComparison` from the :paramref:`stream`. Example usage: .. code-block:: import aas_core3_2.xmlization as our_xmlization with open_some_stream_over_network(...) as stream: instance = our_xmlization.starts_with_comparison_from_stream( stream ) # Do something with the ``instance`` :param stream: representing an instance of :py:class:`.types.StartsWithComparison` in XML :param has_iterparse: Module containing ``iterparse`` function. Default is to use :py:mod:`xml.etree.ElementTree` from the standard library. If you have to deal with malicious input, consider using a library such as `defusedxml.ElementTree`_. :raise: :py:class:`DeserializationException` if unexpected input :return: Instance of :py:class:`.types.StartsWithComparison` read from :paramref:`stream` """ iterator = has_iterparse.iterparse(stream, ["start", "end"]) return starts_with_comparison_from_iterparse( _with_elements_cleared_after_yield(iterator) )
[docs]def starts_with_comparison_from_file( path: PathLike, has_iterparse: HasIterparse = xml.etree.ElementTree ) -> our_types.StartsWithComparison: """ Read an instance of :py:class:`.types.StartsWithComparison` from the :paramref:`path`. Example usage: .. code-block:: import pathlib import aas_core3_2.xmlization as our_xmlization path = pathlib.Path(...) instance = our_xmlization.starts_with_comparison_from_file( path ) # Do something with the ``instance`` :param path: to the file representing an instance of :py:class:`.types.StartsWithComparison` in XML :param has_iterparse: Module containing ``iterparse`` function. Default is to use :py:mod:`xml.etree.ElementTree` from the standard library. If you have to deal with malicious input, consider using a library such as `defusedxml.ElementTree`_. :raise: :py:class:`DeserializationException` if unexpected input :return: Instance of :py:class:`.types.StartsWithComparison` read from :paramref:`path` """ with open(os.fspath(path), encoding="utf-8") as fid: iterator = has_iterparse.iterparse(fid, ["start", "end"]) return starts_with_comparison_from_iterparse( _with_elements_cleared_after_yield(iterator) )
[docs]def starts_with_comparison_from_str( text: str, has_iterparse: HasIterparse = xml.etree.ElementTree ) -> our_types.StartsWithComparison: """ Read an instance of :py:class:`.types.StartsWithComparison` from the :paramref:`text`. Example usage: .. code-block:: import pathlib import aas_core3_2.xmlization as our_xmlization text = "<...>...</...>" instance = our_xmlization.starts_with_comparison_from_str( text ) # Do something with the ``instance`` :param text: representing an instance of :py:class:`.types.StartsWithComparison` in XML :param has_iterparse: Module containing ``iterparse`` function. Default is to use :py:mod:`xml.etree.ElementTree` from the standard library. If you have to deal with malicious input, consider using a library such as `defusedxml.ElementTree`_. :raise: :py:class:`DeserializationException` if unexpected input :return: Instance of :py:class:`.types.StartsWithComparison` read from :paramref:`text` """ iterator = has_iterparse.iterparse(io.StringIO(text), ["start", "end"]) return starts_with_comparison_from_iterparse( _with_elements_cleared_after_yield(iterator) )
[docs]def ends_with_comparison_from_iterparse( iterator: Iterator[Tuple[str, Element]], ) -> our_types.EndsWithComparison: """ Read an instance of :py:class:`.types.EndsWithComparison` from the :paramref:`iterator`. Example usage: .. code-block:: import pathlib import xml.etree.ElementTree as ET import aas_core3_2.xmlization as our_xmlization path = pathlib.Path(...) with path.open("rt") as fid: iterator = ET.iterparse( source=fid, events=['start', 'end'] ) instance = our_xmlization.ends_with_comparison_from_iterparse( iterator ) # Do something with the ``instance`` :param iterator: Input stream of ``(event, element)`` coming from :py:func:`xml.etree.ElementTree.iterparse` with the argument ``events=["start", "end"]`` :raise: :py:class:`DeserializationException` if unexpected input :return: Instance of :py:class:`.types.EndsWithComparison` read from :paramref:`iterator` """ return _read_instance_from_iterparse( iterator, _read_ends_with_comparison_as_element, "EndsWithComparison" )
[docs]def ends_with_comparison_from_stream( stream: TextIO, has_iterparse: HasIterparse = xml.etree.ElementTree ) -> our_types.EndsWithComparison: """ Read an instance of :py:class:`.types.EndsWithComparison` from the :paramref:`stream`. Example usage: .. code-block:: import aas_core3_2.xmlization as our_xmlization with open_some_stream_over_network(...) as stream: instance = our_xmlization.ends_with_comparison_from_stream( stream ) # Do something with the ``instance`` :param stream: representing an instance of :py:class:`.types.EndsWithComparison` in XML :param has_iterparse: Module containing ``iterparse`` function. Default is to use :py:mod:`xml.etree.ElementTree` from the standard library. If you have to deal with malicious input, consider using a library such as `defusedxml.ElementTree`_. :raise: :py:class:`DeserializationException` if unexpected input :return: Instance of :py:class:`.types.EndsWithComparison` read from :paramref:`stream` """ iterator = has_iterparse.iterparse(stream, ["start", "end"]) return ends_with_comparison_from_iterparse( _with_elements_cleared_after_yield(iterator) )
[docs]def ends_with_comparison_from_file( path: PathLike, has_iterparse: HasIterparse = xml.etree.ElementTree ) -> our_types.EndsWithComparison: """ Read an instance of :py:class:`.types.EndsWithComparison` from the :paramref:`path`. Example usage: .. code-block:: import pathlib import aas_core3_2.xmlization as our_xmlization path = pathlib.Path(...) instance = our_xmlization.ends_with_comparison_from_file( path ) # Do something with the ``instance`` :param path: to the file representing an instance of :py:class:`.types.EndsWithComparison` in XML :param has_iterparse: Module containing ``iterparse`` function. Default is to use :py:mod:`xml.etree.ElementTree` from the standard library. If you have to deal with malicious input, consider using a library such as `defusedxml.ElementTree`_. :raise: :py:class:`DeserializationException` if unexpected input :return: Instance of :py:class:`.types.EndsWithComparison` read from :paramref:`path` """ with open(os.fspath(path), encoding="utf-8") as fid: iterator = has_iterparse.iterparse(fid, ["start", "end"]) return ends_with_comparison_from_iterparse( _with_elements_cleared_after_yield(iterator) )
[docs]def ends_with_comparison_from_str( text: str, has_iterparse: HasIterparse = xml.etree.ElementTree ) -> our_types.EndsWithComparison: """ Read an instance of :py:class:`.types.EndsWithComparison` from the :paramref:`text`. Example usage: .. code-block:: import pathlib import aas_core3_2.xmlization as our_xmlization text = "<...>...</...>" instance = our_xmlization.ends_with_comparison_from_str( text ) # Do something with the ``instance`` :param text: representing an instance of :py:class:`.types.EndsWithComparison` in XML :param has_iterparse: Module containing ``iterparse`` function. Default is to use :py:mod:`xml.etree.ElementTree` from the standard library. If you have to deal with malicious input, consider using a library such as `defusedxml.ElementTree`_. :raise: :py:class:`DeserializationException` if unexpected input :return: Instance of :py:class:`.types.EndsWithComparison` read from :paramref:`text` """ iterator = has_iterparse.iterparse(io.StringIO(text), ["start", "end"]) return ends_with_comparison_from_iterparse( _with_elements_cleared_after_yield(iterator) )
[docs]def regex_comparison_from_iterparse( iterator: Iterator[Tuple[str, Element]], ) -> our_types.RegexComparison: """ Read an instance of :py:class:`.types.RegexComparison` from the :paramref:`iterator`. Example usage: .. code-block:: import pathlib import xml.etree.ElementTree as ET import aas_core3_2.xmlization as our_xmlization path = pathlib.Path(...) with path.open("rt") as fid: iterator = ET.iterparse( source=fid, events=['start', 'end'] ) instance = our_xmlization.regex_comparison_from_iterparse( iterator ) # Do something with the ``instance`` :param iterator: Input stream of ``(event, element)`` coming from :py:func:`xml.etree.ElementTree.iterparse` with the argument ``events=["start", "end"]`` :raise: :py:class:`DeserializationException` if unexpected input :return: Instance of :py:class:`.types.RegexComparison` read from :paramref:`iterator` """ return _read_instance_from_iterparse( iterator, _read_regex_comparison_as_element, "RegexComparison" )
[docs]def regex_comparison_from_stream( stream: TextIO, has_iterparse: HasIterparse = xml.etree.ElementTree ) -> our_types.RegexComparison: """ Read an instance of :py:class:`.types.RegexComparison` from the :paramref:`stream`. Example usage: .. code-block:: import aas_core3_2.xmlization as our_xmlization with open_some_stream_over_network(...) as stream: instance = our_xmlization.regex_comparison_from_stream( stream ) # Do something with the ``instance`` :param stream: representing an instance of :py:class:`.types.RegexComparison` in XML :param has_iterparse: Module containing ``iterparse`` function. Default is to use :py:mod:`xml.etree.ElementTree` from the standard library. If you have to deal with malicious input, consider using a library such as `defusedxml.ElementTree`_. :raise: :py:class:`DeserializationException` if unexpected input :return: Instance of :py:class:`.types.RegexComparison` read from :paramref:`stream` """ iterator = has_iterparse.iterparse(stream, ["start", "end"]) return regex_comparison_from_iterparse(_with_elements_cleared_after_yield(iterator))
[docs]def regex_comparison_from_file( path: PathLike, has_iterparse: HasIterparse = xml.etree.ElementTree ) -> our_types.RegexComparison: """ Read an instance of :py:class:`.types.RegexComparison` from the :paramref:`path`. Example usage: .. code-block:: import pathlib import aas_core3_2.xmlization as our_xmlization path = pathlib.Path(...) instance = our_xmlization.regex_comparison_from_file( path ) # Do something with the ``instance`` :param path: to the file representing an instance of :py:class:`.types.RegexComparison` in XML :param has_iterparse: Module containing ``iterparse`` function. Default is to use :py:mod:`xml.etree.ElementTree` from the standard library. If you have to deal with malicious input, consider using a library such as `defusedxml.ElementTree`_. :raise: :py:class:`DeserializationException` if unexpected input :return: Instance of :py:class:`.types.RegexComparison` read from :paramref:`path` """ with open(os.fspath(path), encoding="utf-8") as fid: iterator = has_iterparse.iterparse(fid, ["start", "end"]) return regex_comparison_from_iterparse( _with_elements_cleared_after_yield(iterator) )
[docs]def regex_comparison_from_str( text: str, has_iterparse: HasIterparse = xml.etree.ElementTree ) -> our_types.RegexComparison: """ Read an instance of :py:class:`.types.RegexComparison` from the :paramref:`text`. Example usage: .. code-block:: import pathlib import aas_core3_2.xmlization as our_xmlization text = "<...>...</...>" instance = our_xmlization.regex_comparison_from_str( text ) # Do something with the ``instance`` :param text: representing an instance of :py:class:`.types.RegexComparison` in XML :param has_iterparse: Module containing ``iterparse`` function. Default is to use :py:mod:`xml.etree.ElementTree` from the standard library. If you have to deal with malicious input, consider using a library such as `defusedxml.ElementTree`_. :raise: :py:class:`DeserializationException` if unexpected input :return: Instance of :py:class:`.types.RegexComparison` read from :paramref:`text` """ iterator = has_iterparse.iterparse(io.StringIO(text), ["start", "end"]) return regex_comparison_from_iterparse(_with_elements_cleared_after_yield(iterator))
[docs]def match_clause_from_iterparse( iterator: Iterator[Tuple[str, Element]], ) -> our_types.MatchClause: """ Read an instance of :py:class:`.types.MatchClause` from the :paramref:`iterator`. Example usage: .. code-block:: import pathlib import xml.etree.ElementTree as ET import aas_core3_2.xmlization as our_xmlization path = pathlib.Path(...) with path.open("rt") as fid: iterator = ET.iterparse( source=fid, events=['start', 'end'] ) instance = our_xmlization.match_clause_from_iterparse( iterator ) # Do something with the ``instance`` :param iterator: Input stream of ``(event, element)`` coming from :py:func:`xml.etree.ElementTree.iterparse` with the argument ``events=["start", "end"]`` :raise: :py:class:`DeserializationException` if unexpected input :return: Instance of :py:class:`.types.MatchClause` read from :paramref:`iterator` """ return _read_instance_from_iterparse( iterator, _read_match_clause_as_element, "MatchClause" )
[docs]def match_clause_from_stream( stream: TextIO, has_iterparse: HasIterparse = xml.etree.ElementTree ) -> our_types.MatchClause: """ Read an instance of :py:class:`.types.MatchClause` from the :paramref:`stream`. Example usage: .. code-block:: import aas_core3_2.xmlization as our_xmlization with open_some_stream_over_network(...) as stream: instance = our_xmlization.match_clause_from_stream( stream ) # Do something with the ``instance`` :param stream: representing an instance of :py:class:`.types.MatchClause` in XML :param has_iterparse: Module containing ``iterparse`` function. Default is to use :py:mod:`xml.etree.ElementTree` from the standard library. If you have to deal with malicious input, consider using a library such as `defusedxml.ElementTree`_. :raise: :py:class:`DeserializationException` if unexpected input :return: Instance of :py:class:`.types.MatchClause` read from :paramref:`stream` """ iterator = has_iterparse.iterparse(stream, ["start", "end"]) return match_clause_from_iterparse(_with_elements_cleared_after_yield(iterator))
[docs]def match_clause_from_file( path: PathLike, has_iterparse: HasIterparse = xml.etree.ElementTree ) -> our_types.MatchClause: """ Read an instance of :py:class:`.types.MatchClause` from the :paramref:`path`. Example usage: .. code-block:: import pathlib import aas_core3_2.xmlization as our_xmlization path = pathlib.Path(...) instance = our_xmlization.match_clause_from_file( path ) # Do something with the ``instance`` :param path: to the file representing an instance of :py:class:`.types.MatchClause` in XML :param has_iterparse: Module containing ``iterparse`` function. Default is to use :py:mod:`xml.etree.ElementTree` from the standard library. If you have to deal with malicious input, consider using a library such as `defusedxml.ElementTree`_. :raise: :py:class:`DeserializationException` if unexpected input :return: Instance of :py:class:`.types.MatchClause` read from :paramref:`path` """ with open(os.fspath(path), encoding="utf-8") as fid: iterator = has_iterparse.iterparse(fid, ["start", "end"]) return match_clause_from_iterparse(_with_elements_cleared_after_yield(iterator))
[docs]def match_clause_from_str( text: str, has_iterparse: HasIterparse = xml.etree.ElementTree ) -> our_types.MatchClause: """ Read an instance of :py:class:`.types.MatchClause` from the :paramref:`text`. Example usage: .. code-block:: import pathlib import aas_core3_2.xmlization as our_xmlization text = "<...>...</...>" instance = our_xmlization.match_clause_from_str( text ) # Do something with the ``instance`` :param text: representing an instance of :py:class:`.types.MatchClause` in XML :param has_iterparse: Module containing ``iterparse`` function. Default is to use :py:mod:`xml.etree.ElementTree` from the standard library. If you have to deal with malicious input, consider using a library such as `defusedxml.ElementTree`_. :raise: :py:class:`DeserializationException` if unexpected input :return: Instance of :py:class:`.types.MatchClause` read from :paramref:`text` """ iterator = has_iterparse.iterparse(io.StringIO(text), ["start", "end"]) return match_clause_from_iterparse(_with_elements_cleared_after_yield(iterator))
[docs]def and_expression_from_iterparse( iterator: Iterator[Tuple[str, Element]], ) -> our_types.AndExpression: """ Read an instance of :py:class:`.types.AndExpression` from the :paramref:`iterator`. Example usage: .. code-block:: import pathlib import xml.etree.ElementTree as ET import aas_core3_2.xmlization as our_xmlization path = pathlib.Path(...) with path.open("rt") as fid: iterator = ET.iterparse( source=fid, events=['start', 'end'] ) instance = our_xmlization.and_expression_from_iterparse( iterator ) # Do something with the ``instance`` :param iterator: Input stream of ``(event, element)`` coming from :py:func:`xml.etree.ElementTree.iterparse` with the argument ``events=["start", "end"]`` :raise: :py:class:`DeserializationException` if unexpected input :return: Instance of :py:class:`.types.AndExpression` read from :paramref:`iterator` """ return _read_instance_from_iterparse( iterator, _read_and_expression_as_element, "AndExpression" )
[docs]def and_expression_from_stream( stream: TextIO, has_iterparse: HasIterparse = xml.etree.ElementTree ) -> our_types.AndExpression: """ Read an instance of :py:class:`.types.AndExpression` from the :paramref:`stream`. Example usage: .. code-block:: import aas_core3_2.xmlization as our_xmlization with open_some_stream_over_network(...) as stream: instance = our_xmlization.and_expression_from_stream( stream ) # Do something with the ``instance`` :param stream: representing an instance of :py:class:`.types.AndExpression` in XML :param has_iterparse: Module containing ``iterparse`` function. Default is to use :py:mod:`xml.etree.ElementTree` from the standard library. If you have to deal with malicious input, consider using a library such as `defusedxml.ElementTree`_. :raise: :py:class:`DeserializationException` if unexpected input :return: Instance of :py:class:`.types.AndExpression` read from :paramref:`stream` """ iterator = has_iterparse.iterparse(stream, ["start", "end"]) return and_expression_from_iterparse(_with_elements_cleared_after_yield(iterator))
[docs]def and_expression_from_file( path: PathLike, has_iterparse: HasIterparse = xml.etree.ElementTree ) -> our_types.AndExpression: """ Read an instance of :py:class:`.types.AndExpression` from the :paramref:`path`. Example usage: .. code-block:: import pathlib import aas_core3_2.xmlization as our_xmlization path = pathlib.Path(...) instance = our_xmlization.and_expression_from_file( path ) # Do something with the ``instance`` :param path: to the file representing an instance of :py:class:`.types.AndExpression` in XML :param has_iterparse: Module containing ``iterparse`` function. Default is to use :py:mod:`xml.etree.ElementTree` from the standard library. If you have to deal with malicious input, consider using a library such as `defusedxml.ElementTree`_. :raise: :py:class:`DeserializationException` if unexpected input :return: Instance of :py:class:`.types.AndExpression` read from :paramref:`path` """ with open(os.fspath(path), encoding="utf-8") as fid: iterator = has_iterparse.iterparse(fid, ["start", "end"]) return and_expression_from_iterparse( _with_elements_cleared_after_yield(iterator) )
[docs]def and_expression_from_str( text: str, has_iterparse: HasIterparse = xml.etree.ElementTree ) -> our_types.AndExpression: """ Read an instance of :py:class:`.types.AndExpression` from the :paramref:`text`. Example usage: .. code-block:: import pathlib import aas_core3_2.xmlization as our_xmlization text = "<...>...</...>" instance = our_xmlization.and_expression_from_str( text ) # Do something with the ``instance`` :param text: representing an instance of :py:class:`.types.AndExpression` in XML :param has_iterparse: Module containing ``iterparse`` function. Default is to use :py:mod:`xml.etree.ElementTree` from the standard library. If you have to deal with malicious input, consider using a library such as `defusedxml.ElementTree`_. :raise: :py:class:`DeserializationException` if unexpected input :return: Instance of :py:class:`.types.AndExpression` read from :paramref:`text` """ iterator = has_iterparse.iterparse(io.StringIO(text), ["start", "end"]) return and_expression_from_iterparse(_with_elements_cleared_after_yield(iterator))
[docs]def or_expression_from_iterparse( iterator: Iterator[Tuple[str, Element]], ) -> our_types.OrExpression: """ Read an instance of :py:class:`.types.OrExpression` from the :paramref:`iterator`. Example usage: .. code-block:: import pathlib import xml.etree.ElementTree as ET import aas_core3_2.xmlization as our_xmlization path = pathlib.Path(...) with path.open("rt") as fid: iterator = ET.iterparse( source=fid, events=['start', 'end'] ) instance = our_xmlization.or_expression_from_iterparse( iterator ) # Do something with the ``instance`` :param iterator: Input stream of ``(event, element)`` coming from :py:func:`xml.etree.ElementTree.iterparse` with the argument ``events=["start", "end"]`` :raise: :py:class:`DeserializationException` if unexpected input :return: Instance of :py:class:`.types.OrExpression` read from :paramref:`iterator` """ return _read_instance_from_iterparse( iterator, _read_or_expression_as_element, "OrExpression" )
[docs]def or_expression_from_stream( stream: TextIO, has_iterparse: HasIterparse = xml.etree.ElementTree ) -> our_types.OrExpression: """ Read an instance of :py:class:`.types.OrExpression` from the :paramref:`stream`. Example usage: .. code-block:: import aas_core3_2.xmlization as our_xmlization with open_some_stream_over_network(...) as stream: instance = our_xmlization.or_expression_from_stream( stream ) # Do something with the ``instance`` :param stream: representing an instance of :py:class:`.types.OrExpression` in XML :param has_iterparse: Module containing ``iterparse`` function. Default is to use :py:mod:`xml.etree.ElementTree` from the standard library. If you have to deal with malicious input, consider using a library such as `defusedxml.ElementTree`_. :raise: :py:class:`DeserializationException` if unexpected input :return: Instance of :py:class:`.types.OrExpression` read from :paramref:`stream` """ iterator = has_iterparse.iterparse(stream, ["start", "end"]) return or_expression_from_iterparse(_with_elements_cleared_after_yield(iterator))
[docs]def or_expression_from_file( path: PathLike, has_iterparse: HasIterparse = xml.etree.ElementTree ) -> our_types.OrExpression: """ Read an instance of :py:class:`.types.OrExpression` from the :paramref:`path`. Example usage: .. code-block:: import pathlib import aas_core3_2.xmlization as our_xmlization path = pathlib.Path(...) instance = our_xmlization.or_expression_from_file( path ) # Do something with the ``instance`` :param path: to the file representing an instance of :py:class:`.types.OrExpression` in XML :param has_iterparse: Module containing ``iterparse`` function. Default is to use :py:mod:`xml.etree.ElementTree` from the standard library. If you have to deal with malicious input, consider using a library such as `defusedxml.ElementTree`_. :raise: :py:class:`DeserializationException` if unexpected input :return: Instance of :py:class:`.types.OrExpression` read from :paramref:`path` """ with open(os.fspath(path), encoding="utf-8") as fid: iterator = has_iterparse.iterparse(fid, ["start", "end"]) return or_expression_from_iterparse( _with_elements_cleared_after_yield(iterator) )
[docs]def or_expression_from_str( text: str, has_iterparse: HasIterparse = xml.etree.ElementTree ) -> our_types.OrExpression: """ Read an instance of :py:class:`.types.OrExpression` from the :paramref:`text`. Example usage: .. code-block:: import pathlib import aas_core3_2.xmlization as our_xmlization text = "<...>...</...>" instance = our_xmlization.or_expression_from_str( text ) # Do something with the ``instance`` :param text: representing an instance of :py:class:`.types.OrExpression` in XML :param has_iterparse: Module containing ``iterparse`` function. Default is to use :py:mod:`xml.etree.ElementTree` from the standard library. If you have to deal with malicious input, consider using a library such as `defusedxml.ElementTree`_. :raise: :py:class:`DeserializationException` if unexpected input :return: Instance of :py:class:`.types.OrExpression` read from :paramref:`text` """ iterator = has_iterparse.iterparse(io.StringIO(text), ["start", "end"]) return or_expression_from_iterparse(_with_elements_cleared_after_yield(iterator))
[docs]def not_expression_from_iterparse( iterator: Iterator[Tuple[str, Element]], ) -> our_types.NotExpression: """ Read an instance of :py:class:`.types.NotExpression` from the :paramref:`iterator`. Example usage: .. code-block:: import pathlib import xml.etree.ElementTree as ET import aas_core3_2.xmlization as our_xmlization path = pathlib.Path(...) with path.open("rt") as fid: iterator = ET.iterparse( source=fid, events=['start', 'end'] ) instance = our_xmlization.not_expression_from_iterparse( iterator ) # Do something with the ``instance`` :param iterator: Input stream of ``(event, element)`` coming from :py:func:`xml.etree.ElementTree.iterparse` with the argument ``events=["start", "end"]`` :raise: :py:class:`DeserializationException` if unexpected input :return: Instance of :py:class:`.types.NotExpression` read from :paramref:`iterator` """ return _read_instance_from_iterparse( iterator, _read_not_expression_as_element, "NotExpression" )
[docs]def not_expression_from_stream( stream: TextIO, has_iterparse: HasIterparse = xml.etree.ElementTree ) -> our_types.NotExpression: """ Read an instance of :py:class:`.types.NotExpression` from the :paramref:`stream`. Example usage: .. code-block:: import aas_core3_2.xmlization as our_xmlization with open_some_stream_over_network(...) as stream: instance = our_xmlization.not_expression_from_stream( stream ) # Do something with the ``instance`` :param stream: representing an instance of :py:class:`.types.NotExpression` in XML :param has_iterparse: Module containing ``iterparse`` function. Default is to use :py:mod:`xml.etree.ElementTree` from the standard library. If you have to deal with malicious input, consider using a library such as `defusedxml.ElementTree`_. :raise: :py:class:`DeserializationException` if unexpected input :return: Instance of :py:class:`.types.NotExpression` read from :paramref:`stream` """ iterator = has_iterparse.iterparse(stream, ["start", "end"]) return not_expression_from_iterparse(_with_elements_cleared_after_yield(iterator))
[docs]def not_expression_from_file( path: PathLike, has_iterparse: HasIterparse = xml.etree.ElementTree ) -> our_types.NotExpression: """ Read an instance of :py:class:`.types.NotExpression` from the :paramref:`path`. Example usage: .. code-block:: import pathlib import aas_core3_2.xmlization as our_xmlization path = pathlib.Path(...) instance = our_xmlization.not_expression_from_file( path ) # Do something with the ``instance`` :param path: to the file representing an instance of :py:class:`.types.NotExpression` in XML :param has_iterparse: Module containing ``iterparse`` function. Default is to use :py:mod:`xml.etree.ElementTree` from the standard library. If you have to deal with malicious input, consider using a library such as `defusedxml.ElementTree`_. :raise: :py:class:`DeserializationException` if unexpected input :return: Instance of :py:class:`.types.NotExpression` read from :paramref:`path` """ with open(os.fspath(path), encoding="utf-8") as fid: iterator = has_iterparse.iterparse(fid, ["start", "end"]) return not_expression_from_iterparse( _with_elements_cleared_after_yield(iterator) )
[docs]def not_expression_from_str( text: str, has_iterparse: HasIterparse = xml.etree.ElementTree ) -> our_types.NotExpression: """ Read an instance of :py:class:`.types.NotExpression` from the :paramref:`text`. Example usage: .. code-block:: import pathlib import aas_core3_2.xmlization as our_xmlization text = "<...>...</...>" instance = our_xmlization.not_expression_from_str( text ) # Do something with the ``instance`` :param text: representing an instance of :py:class:`.types.NotExpression` in XML :param has_iterparse: Module containing ``iterparse`` function. Default is to use :py:mod:`xml.etree.ElementTree` from the standard library. If you have to deal with malicious input, consider using a library such as `defusedxml.ElementTree`_. :raise: :py:class:`DeserializationException` if unexpected input :return: Instance of :py:class:`.types.NotExpression` read from :paramref:`text` """ iterator = has_iterparse.iterparse(io.StringIO(text), ["start", "end"]) return not_expression_from_iterparse(_with_elements_cleared_after_yield(iterator))
[docs]def query_filter_from_iterparse( iterator: Iterator[Tuple[str, Element]], ) -> our_types.QueryFilter: """ Read an instance of :py:class:`.types.QueryFilter` from the :paramref:`iterator`. Example usage: .. code-block:: import pathlib import xml.etree.ElementTree as ET import aas_core3_2.xmlization as our_xmlization path = pathlib.Path(...) with path.open("rt") as fid: iterator = ET.iterparse( source=fid, events=['start', 'end'] ) instance = our_xmlization.query_filter_from_iterparse( iterator ) # Do something with the ``instance`` :param iterator: Input stream of ``(event, element)`` coming from :py:func:`xml.etree.ElementTree.iterparse` with the argument ``events=["start", "end"]`` :raise: :py:class:`DeserializationException` if unexpected input :return: Instance of :py:class:`.types.QueryFilter` read from :paramref:`iterator` """ return _read_instance_from_iterparse( iterator, _read_query_filter_as_element, "QueryFilter" )
[docs]def query_filter_from_stream( stream: TextIO, has_iterparse: HasIterparse = xml.etree.ElementTree ) -> our_types.QueryFilter: """ Read an instance of :py:class:`.types.QueryFilter` from the :paramref:`stream`. Example usage: .. code-block:: import aas_core3_2.xmlization as our_xmlization with open_some_stream_over_network(...) as stream: instance = our_xmlization.query_filter_from_stream( stream ) # Do something with the ``instance`` :param stream: representing an instance of :py:class:`.types.QueryFilter` in XML :param has_iterparse: Module containing ``iterparse`` function. Default is to use :py:mod:`xml.etree.ElementTree` from the standard library. If you have to deal with malicious input, consider using a library such as `defusedxml.ElementTree`_. :raise: :py:class:`DeserializationException` if unexpected input :return: Instance of :py:class:`.types.QueryFilter` read from :paramref:`stream` """ iterator = has_iterparse.iterparse(stream, ["start", "end"]) return query_filter_from_iterparse(_with_elements_cleared_after_yield(iterator))
[docs]def query_filter_from_file( path: PathLike, has_iterparse: HasIterparse = xml.etree.ElementTree ) -> our_types.QueryFilter: """ Read an instance of :py:class:`.types.QueryFilter` from the :paramref:`path`. Example usage: .. code-block:: import pathlib import aas_core3_2.xmlization as our_xmlization path = pathlib.Path(...) instance = our_xmlization.query_filter_from_file( path ) # Do something with the ``instance`` :param path: to the file representing an instance of :py:class:`.types.QueryFilter` in XML :param has_iterparse: Module containing ``iterparse`` function. Default is to use :py:mod:`xml.etree.ElementTree` from the standard library. If you have to deal with malicious input, consider using a library such as `defusedxml.ElementTree`_. :raise: :py:class:`DeserializationException` if unexpected input :return: Instance of :py:class:`.types.QueryFilter` read from :paramref:`path` """ with open(os.fspath(path), encoding="utf-8") as fid: iterator = has_iterparse.iterparse(fid, ["start", "end"]) return query_filter_from_iterparse(_with_elements_cleared_after_yield(iterator))
[docs]def query_filter_from_str( text: str, has_iterparse: HasIterparse = xml.etree.ElementTree ) -> our_types.QueryFilter: """ Read an instance of :py:class:`.types.QueryFilter` from the :paramref:`text`. Example usage: .. code-block:: import pathlib import aas_core3_2.xmlization as our_xmlization text = "<...>...</...>" instance = our_xmlization.query_filter_from_str( text ) # Do something with the ``instance`` :param text: representing an instance of :py:class:`.types.QueryFilter` in XML :param has_iterparse: Module containing ``iterparse`` function. Default is to use :py:mod:`xml.etree.ElementTree` from the standard library. If you have to deal with malicious input, consider using a library such as `defusedxml.ElementTree`_. :raise: :py:class:`DeserializationException` if unexpected input :return: Instance of :py:class:`.types.QueryFilter` read from :paramref:`text` """ iterator = has_iterparse.iterparse(io.StringIO(text), ["start", "end"]) return query_filter_from_iterparse(_with_elements_cleared_after_yield(iterator))
[docs]def query_from_iterparse(iterator: Iterator[Tuple[str, Element]]) -> our_types.Query: """ Read an instance of :py:class:`.types.Query` from the :paramref:`iterator`. Example usage: .. code-block:: import pathlib import xml.etree.ElementTree as ET import aas_core3_2.xmlization as our_xmlization path = pathlib.Path(...) with path.open("rt") as fid: iterator = ET.iterparse( source=fid, events=['start', 'end'] ) instance = our_xmlization.query_from_iterparse( iterator ) # Do something with the ``instance`` :param iterator: Input stream of ``(event, element)`` coming from :py:func:`xml.etree.ElementTree.iterparse` with the argument ``events=["start", "end"]`` :raise: :py:class:`DeserializationException` if unexpected input :return: Instance of :py:class:`.types.Query` read from :paramref:`iterator` """ return _read_instance_from_iterparse(iterator, _read_query_as_element, "Query")
[docs]def query_from_stream( stream: TextIO, has_iterparse: HasIterparse = xml.etree.ElementTree ) -> our_types.Query: """ Read an instance of :py:class:`.types.Query` from the :paramref:`stream`. Example usage: .. code-block:: import aas_core3_2.xmlization as our_xmlization with open_some_stream_over_network(...) as stream: instance = our_xmlization.query_from_stream( stream ) # Do something with the ``instance`` :param stream: representing an instance of :py:class:`.types.Query` in XML :param has_iterparse: Module containing ``iterparse`` function. Default is to use :py:mod:`xml.etree.ElementTree` from the standard library. If you have to deal with malicious input, consider using a library such as `defusedxml.ElementTree`_. :raise: :py:class:`DeserializationException` if unexpected input :return: Instance of :py:class:`.types.Query` read from :paramref:`stream` """ iterator = has_iterparse.iterparse(stream, ["start", "end"]) return query_from_iterparse(_with_elements_cleared_after_yield(iterator))
[docs]def query_from_file( path: PathLike, has_iterparse: HasIterparse = xml.etree.ElementTree ) -> our_types.Query: """ Read an instance of :py:class:`.types.Query` from the :paramref:`path`. Example usage: .. code-block:: import pathlib import aas_core3_2.xmlization as our_xmlization path = pathlib.Path(...) instance = our_xmlization.query_from_file( path ) # Do something with the ``instance`` :param path: to the file representing an instance of :py:class:`.types.Query` in XML :param has_iterparse: Module containing ``iterparse`` function. Default is to use :py:mod:`xml.etree.ElementTree` from the standard library. If you have to deal with malicious input, consider using a library such as `defusedxml.ElementTree`_. :raise: :py:class:`DeserializationException` if unexpected input :return: Instance of :py:class:`.types.Query` read from :paramref:`path` """ with open(os.fspath(path), encoding="utf-8") as fid: iterator = has_iterparse.iterparse(fid, ["start", "end"]) return query_from_iterparse(_with_elements_cleared_after_yield(iterator))
[docs]def query_from_str( text: str, has_iterparse: HasIterparse = xml.etree.ElementTree ) -> our_types.Query: """ Read an instance of :py:class:`.types.Query` from the :paramref:`text`. Example usage: .. code-block:: import pathlib import aas_core3_2.xmlization as our_xmlization text = "<...>...</...>" instance = our_xmlization.query_from_str( text ) # Do something with the ``instance`` :param text: representing an instance of :py:class:`.types.Query` in XML :param has_iterparse: Module containing ``iterparse`` function. Default is to use :py:mod:`xml.etree.ElementTree` from the standard library. If you have to deal with malicious input, consider using a library such as `defusedxml.ElementTree`_. :raise: :py:class:`DeserializationException` if unexpected input :return: Instance of :py:class:`.types.Query` read from :paramref:`text` """ iterator = has_iterparse.iterparse(io.StringIO(text), ["start", "end"]) return query_from_iterparse(_with_elements_cleared_after_yield(iterator))
[docs]def from_iterparse(iterator: Iterator[Tuple[str, Element]]) -> our_types.Class: """ Read an instance from the :paramref:`iterator`. The type of the instance is determined by the very first start element. Example usage: .. code-block:: import pathlib import xml.etree.ElementTree as ET import aas_core3_2.xmlization as our_xmlization path = pathlib.Path(...) with path.open("rt") as fid: iterator = ET.iterparse( source=fid, events=['start', 'end'] ) instance = our_xmlization.from_iterparse( iterator ) # Do something with the ``instance`` :param iterator: Input stream of ``(event, element)`` coming from :py:func:`xml.etree.ElementTree.iterparse` with the argument ``events=["start", "end"]`` :raise: :py:class:`DeserializationException` if unexpected input :return: Instance of :py:class:`.types.Class` read from the :paramref:`iterator` """ return _read_instance_from_iterparse(iterator, _read_as_element, "an instance")
[docs]def from_stream( stream: TextIO, has_iterparse: HasIterparse = xml.etree.ElementTree ) -> our_types.Class: """ Read an instance from the :paramref:`stream`. The type of the instance is determined by the very first start element. Example usage: .. code-block:: import aas_core3_2.xmlization as our_xmlization with open_some_stream_over_network(...) as stream: instance = our_xmlization.from_stream( stream ) # Do something with the ``instance`` :param stream: representing an instance in XML :param has_iterparse: Module containing ``iterparse`` function. Default is to use :py:mod:`xml.etree.ElementTree` from the standard library. If you have to deal with malicious input, consider using a library such as `defusedxml.ElementTree`_. :raise: :py:class:`DeserializationException` if unexpected input :return: Instance read from :paramref:`stream` """ iterator = has_iterparse.iterparse(stream, ["start", "end"]) return from_iterparse(_with_elements_cleared_after_yield(iterator))
[docs]def from_file( path: PathLike, has_iterparse: HasIterparse = xml.etree.ElementTree ) -> our_types.Class: """ Read an instance from the file at the :paramref:`path`. Example usage: .. code-block:: import pathlib import aas_core3_2.xmlization as our_xmlization path = pathlib.Path(...) instance = our_xmlization.from_file( path ) # Do something with the ``instance`` :param path: to the file representing an instance in XML :param has_iterparse: Module containing ``iterparse`` function. Default is to use :py:mod:`xml.etree.ElementTree` from the standard library. If you have to deal with malicious input, consider using a library such as `defusedxml.ElementTree`_. :raise: :py:class:`DeserializationException` if unexpected input :return: Instance read from the file at :paramref:`path` """ with open(os.fspath(path), encoding="utf-8") as fid: iterator = has_iterparse.iterparse(fid, ["start", "end"]) return from_iterparse(_with_elements_cleared_after_yield(iterator))
[docs]def from_str( text: str, has_iterparse: HasIterparse = xml.etree.ElementTree ) -> our_types.Class: """ Read an instance from the :paramref:`text`. Example usage: .. code-block:: import pathlib import aas_core3_2.xmlization as our_xmlization text = "<...>...</...>" instance = our_xmlization.from_str( text ) # Do something with the ``instance`` :param text: representing an instance in XML :param has_iterparse: Module containing ``iterparse`` function. Default is to use :py:mod:`xml.etree.ElementTree` from the standard library. If you have to deal with malicious input, consider using a library such as `defusedxml.ElementTree`_. :raise: :py:class:`DeserializationException` if unexpected input :return: Instance read from :paramref:`text` """ iterator = has_iterparse.iterparse(io.StringIO(text), ["start", "end"]) return from_iterparse(_with_elements_cleared_after_yield(iterator))
# NOTE (mristin): # Directly using the iterator turned out to result in very complex function # designs. The design became much simpler as soon as we considered one look-ahead # element. We came up finally with the following pattern which all the protected # reading functions below roughly follow: # # ..code-block:: # # _read_*( # look-ahead element, # iterator # ) -> result # # The reading functions all read from the ``iterator`` coming from # :py:func:`xml.etree.ElementTree.iterparse` with the argument # ``events=["start", "end"]``. The exception :py:class:`.DeserializationException` # is raised in case of unexpected input. # # The reading functions are responsible to read the end element corresponding to the # start look-ahead element. # # When it comes to error reporting, we use exceptions. The exceptions are raised in # the *callee*, as usual. However, the context of the exception, such as the error path, # is added in the *caller*, as only the caller knows the context of # the lookahead-element. In particular, prepending the path segment corresponding to # the lookahead-element is the responsibility of the *caller*, and not of # the *callee*. _ValueT = TypeVar("_ValueT") #: Read the content of an element which has already been opened, and read #: the corresponding end element as well _ContentReader = Callable[[Element, Iterator[Tuple[str, Element]]], _ValueT] def _read_named_element( element: Element, iterator: Iterator[Tuple[str, Element]], expected_tag: str, read_content: _ContentReader[_ValueT], ) -> _ValueT: """ Verify that :paramref:`element` bears the :paramref:`expected_tag`, and delegate the reading of its content to :paramref:`read_content`. This is the only place where an element's tag is checked against the tag which its container prescribes -- the XML name of a class, ``<v>`` for a list item, or ``<v1>``, ``<v2>``, *etc.* for a tuple item. :param element: look-ahead element :param iterator: Input stream of ``(event, element)`` coming from :py:func:`xml.etree.ElementTree.iterparse` with the argument ``events=["start", "end"]`` :param expected_tag: expected tag of :paramref:`element` :param read_content: to read the content of :paramref:`element` :raise: :py:class:`DeserializationException` if unexpected input :return: parsed value """ tag_wo_ns = parse_element_tag(element) if tag_wo_ns != expected_tag: raise DeserializationException( f"Expected an element with the tag {expected_tag!r}, " f"but got an element with tag: {tag_wo_ns!r}" ) return read_content(element, iterator) def _read_nested_element( element: Element, iterator: Iterator[Tuple[str, Element]], read_element: _ContentReader[_ValueT], expected_what: str, ) -> _ValueT: """ Read the instance nested in :paramref:`element` as a discriminator element. This looks redundant next to reading a list item, and it is not. A property wraps its instance in an element of its own, so the discriminator's name has to be prepended to the error path, which then reads ``value/property/idShort``. A list item is not wrapped -- the item element *is* the indexed child -- so the same prepend would give ``annotations/*[1]/property/idShort``, which walks one level past the element that ``*[1]`` already selects, and resolves to nothing. The end element corresponding to :paramref:`element` will be read as well. :param element: start element enclosing the discriminator element :param iterator: Input stream of ``(event, element)`` coming from :py:func:`xml.etree.ElementTree.iterparse` with the argument ``events=["start", "end"]`` :param read_element: to read the nested element, dispatching on its tag :param expected_what: name of the expected type, for the error messages :raise: :py:class:`DeserializationException` if unexpected input :return: parsed instance """ next_event_element = next(iterator, None) if next_event_element is None: raise DeserializationException( f"Expected a discriminator start element corresponding " f"to {expected_what}, but got end-of-input" ) next_event, nested_element = next_event_element if next_event != "start": raise DeserializationException( f"Expected a discriminator start element corresponding " f"to {expected_what}, " f"but got event {next_event!r} and element {nested_element.tag!r}" ) try: result = read_element(nested_element, iterator) except DeserializationException as exception: exception.path._prepend(ElementSegment(nested_element)) raise read_end_element(element, iterator) return result def _read_dispatched( element: Element, iterator: Iterator[Tuple[str, Element]], dispatch: Mapping[str, _ContentReader[_ValueT]], expected_what: str, ) -> _ValueT: """ Read the instance of :paramref:`element` by dispatching on its own tag. An instance element is self-describing: its tag *is* its model type. The end element corresponding to :paramref:`element` will be read as well. :param element: start element of the instance :param iterator: Input stream of ``(event, element)`` coming from :py:func:`xml.etree.ElementTree.iterparse` with the argument ``events=["start", "end"]`` :param dispatch: to read the instance as a sequence, by its model type :param expected_what: what we expected to read, for the error messages :raise: :py:class:`DeserializationException` if unexpected input :return: parsed instance """ tag_wo_ns = parse_element_tag(element) read_as_sequence = dispatch.get(tag_wo_ns) if read_as_sequence is None: raise DeserializationException( f"Expected the element tag to be a valid model type " f"of {expected_what}, " f"but got tag {tag_wo_ns!r}" ) return read_as_sequence(element, iterator) def _read_properties( element: Element, iterator: Iterator[Tuple[str, Element]], readers: Mapping[str, _ContentReader[Any]], ) -> Mapping[str, Any]: """ Read the properties of an instance as the children of :paramref:`element`. The end element corresponding to :paramref:`element` will be read as well. A property may come at most once, and an unknown tag is refused outright. The property is marked on the error path here, once for all the properties, instead of in every reader: the tag of the child element *is* the XML name of the property which we are reading. :param element: start element, parent of the properties :param iterator: Input stream of ``(event, element)`` coming from :py:func:`xml.etree.ElementTree.iterparse` with the argument ``events=["start", "end"]`` :param readers: to read the content of a property, by its XML name :raise: :py:class:`DeserializationException` if unexpected input :return: parsed values, by the XML name of the property """ if element.text is not None and len(element.text.strip()) != 0: raise DeserializationException( f"Expected only XML elements representing the properties " f"and whitespace text, but got text: {element.text!r}" ) raise_if_has_tail_or_attrib(element) values: Dict[str, Any] = {} while True: # NOTE (mristin): # We pull the next property element here instead of delegating it to # a helper. A call is not free in Python, and this loop runs once for # every property of every instance. next_event_element = next(iterator, None) if next_event_element is None: raise DeserializationException( f"Expected a property element or the end element corresponding " f"to {element.tag}, but got the end-of-input" ) next_event, prop_element = next_event_element if next_event == "end" and prop_element.tag == element.tag: # We reached the end element enclosing the properties. break if next_event != "start": raise DeserializationException( f"Expected a start element corresponding to a property, " f"but got event {next_event!r} " f"and element {prop_element.tag!r}" ) try: tag_wo_ns = parse_element_tag(prop_element) # NOTE (mristin): # A tag already in ``values`` can only have got there by being read, # so its presence means that the property comes a second time. if tag_wo_ns in values: raise DeserializationException( f"Property {tag_wo_ns!r} occurred more than once" ) reader = readers.get(tag_wo_ns) if reader is None: raise DeserializationException( f"Expected an element representing a property, " f"but got an element with unexpected tag: {tag_wo_ns!r}" ) values[tag_wo_ns] = reader(prop_element, iterator) except DeserializationException as exception: exception.path._prepend(ElementSegment(prop_element)) raise return values def _read_list_of_items( element: Element, iterator: Iterator[Tuple[str, Element]], read_item: _ContentReader[_ValueT], ) -> List[_ValueT]: """ Read the children of :paramref:`element` as a list of items. :paramref:`read_item` is responsible for verifying the tag of each item element itself -- *e.g.*, by wrapping a scalar/enumeration reader with :py:func:`_read_named_element`, or by relying on a class's own dispatch by its natural element tag. The end element corresponding to :paramref:`element` will be read as well. :param element: start element enclosing the list :param iterator: Input stream of ``(event, element)`` coming from :py:func:`xml.etree.ElementTree.iterparse` with the argument ``events=["start", "end"]`` :param read_item: to read a single item, including its own end element :raise: :py:class:`DeserializationException` if unexpected input :return: parsed items """ if element.text is not None and len(element.text.strip()) != 0: raise DeserializationException( f"Expected only item elements and whitespace text, " f"but got text: {element.text!r}" ) result: List[_ValueT] = [] while True: # NOTE (mristin): # We pull the next item element here instead of delegating it to a helper, # as this loop runs once for every item of every list. next_event_element = next(iterator, None) if next_event_element is None: raise DeserializationException( f"Expected an item element or the end element corresponding " f"to {element.tag}, but got the end-of-input" ) next_event, item_element = next_event_element if next_event == "end" and item_element.tag == element.tag: # We reached the end element enclosing the items. break if next_event != "start": raise DeserializationException( f"Expected a start element corresponding to an item, " f"but got event {next_event!r} " f"and element {item_element.tag!r}" ) try: item = read_item(item_element, iterator) except DeserializationException as exception: exception.path._prepend(IndexSegment(item_element, len(result))) raise result.append(item) return result def _read_tuple_item( element: Element, iterator: Iterator[Tuple[str, Element]], index: int, read_item: _ContentReader[_ValueT], ) -> _ValueT: """ Read the item at :paramref:`index` of the tuple enclosed in :paramref:`element`. :param element: start element enclosing the tuple :param iterator: Input stream of ``(event, element)`` coming from :py:func:`xml.etree.ElementTree.iterparse` with the argument ``events=["start", "end"]`` :param index: index of the item in the tuple :param read_item: to read the item, including its own end element :raise: :py:class:`DeserializationException` if unexpected input :return: parsed item """ next_event_element = next(iterator, None) if next_event_element is None: raise DeserializationException( f"Expected the item {index} of the tuple, " f"but got end-of-input" ) next_event, item_element = next_event_element if next_event != "start": raise DeserializationException( f"Expected a start element corresponding to the item {index} " f"of the tuple, but got event {next_event!r} " f"and element {item_element.tag!r}" ) try: return read_item(item_element, iterator) except DeserializationException as exception: exception.path._prepend(IndexSegment(item_element, index)) raise def _read_instance_from_iterparse( iterator: Iterator[Tuple[str, Element]], read_as_element: _ContentReader[_ValueT], expected_what: str, ) -> _ValueT: """ Read an instance from :paramref:`iterator`, starting at its start element. :param iterator: Input stream of ``(event, element)`` coming from :py:func:`xml.etree.ElementTree.iterparse` with the argument ``events=["start", "end"]`` :param read_as_element: to read the instance, including its end element :param expected_what: what we expected to read, for the error messages :raise: :py:class:`DeserializationException` if unexpected input :return: parsed instance """ next_element = read_next_start_element(iterator, expected_what) try: return read_as_element(next_element, iterator) except DeserializationException as exception: exception.path._prepend(ElementSegment(next_element)) raise def _remove_whitespace(text: str) -> str: """ Drop every whitespace character of :paramref:`text`. This is what ``xs:base64Binary`` needs: it allows whitespace between the characters and not only around them, so collapsing is not enough. :param text: to be stripped of its whitespace :return: text without any whitespace """ return XS_WHITESPACE_RE.sub("", text) _XS_BASE64_CHARACTERS = frozenset( "ABCDEFGHIJKLMNOPQRSTUVWXYZ" "abcdefghijklmnopqrstuvwxyz" "0123456789+/" ) #: Admit the characters which can precede a single ``=``. The two bits which #: the padding drops have to be zero, which only these sixteen satisfy. _XS_BASE64_BEFORE_ONE_PAD = frozenset("AEIMQUYcgkosw048") #: Admit the characters which can precede ``==``, by the same argument over #: the four bits which are dropped. _XS_BASE64_BEFORE_TWO_PADS = frozenset("AQgw") def _matches_xs_base64_binary(text: str) -> bool: """ Tell whether :paramref:`text` is a lexical form of ``xs:base64Binary``. The whitespace is expected to be gone already. What is left has to match:: (B64 B64 B64 B64)* ((B64 B64 B64 B64) | (B64 B64 B16 '=') | (B64 B04 '=='))? which is to say: a length which is a multiple of four, the alphabet and nothing else, an equals sign only at the very end, and -- easily missed -- a constrained character *before* the padding, since the bits which the padding drops have to be zero. The decoders do not agree on any of this. Some take ``SGk`` although it is three characters long, some quietly discard a character which is not in the alphabet, and some take an equals sign in the middle. Hence the check of our own, so that every target refuses the same texts. See: https://www.w3.org/TR/xmlschema-2/#base64Binary :param text: to be checked, with the whitespace already removed :return: True if :paramref:`text` is a lexical form of ``xs:base64Binary`` """ if len(text) % 4 != 0: return False if len(text) == 0: return True pads = 0 if text[-1] == "=": pads = 1 if text[-2] == "=": pads = 2 if any( character not in _XS_BASE64_CHARACTERS for character in text[: len(text) - pads] ): return False if pads == 1: return text[-2] in _XS_BASE64_BEFORE_ONE_PAD if pads == 2: return text[-3] in _XS_BASE64_BEFORE_TWO_PADS return True _XS_BOOLEAN_LITERAL_SET = { "1", "true", "0", "false", } def _read_bool_from_element_text( element: Element, iterator: Iterator[Tuple[str, Element]] ) -> bool: """ Parse the text of :paramref:`element` as a boolean, and read the corresponding end element from :paramref:`iterator`. :param element: start element :param iterator: Input stream of ``(event, element)`` coming from :py:func:`xml.etree.ElementTree.iterparse` with the argument ``events=["start", "end"]`` :raise: :py:class:`DeserializationException` if unexpected input :return: parsed value """ text = collapse_whitespace(read_text_from_element(element, iterator)) if text not in _XS_BOOLEAN_LITERAL_SET: raise DeserializationException( f"Expected a boolean, " f"but got an element with text: {text!r}" ) return text in ("1", "true") #: Map the named literals of ``xs:double`` onto their values. #: #: ``+INF`` is read although it is written as ``INF``: XSD 1.1 admits it -- #: the production is ``(\+|-)?INF`` -- and being liberal in what we accept #: costs nothing here, while a document from a 1.1 processor would otherwise #: be unreadable. #: #: See: https://www.w3.org/TR/xmlschema11-2/#double _TEXT_TO_XS_DOUBLE_LITERALS = { "NaN": math.nan, "INF": math.inf, "+INF": math.inf, "-INF": -math.inf, } #: Match the numeric part of the lexical space of ``xs:double``. The three #: named literals are looked up in :py:attr:`_TEXT_TO_XS_DOUBLE_LITERALS` #: before this is tried. #: #: Mind the explicit ``[0-9]``: ``\d`` would match a digit of any script, so #: the Arabic-Indic ``Ûµ`` would pass, and :py:func:`float` would read it #: as 5. #: #: See: https://www.w3.org/TR/xmlschema-2/#double _XS_DOUBLE_RE = re.compile(r"(\+|-)?([0-9]+(\.[0-9]*)?|\.[0-9]+)([Ee](\+|-)?[0-9]+)?") def _read_float_from_element_text( element: Element, iterator: Iterator[Tuple[str, Element]] ) -> float: """ Parse the text of :paramref:`element` as a floating-point number, and read the corresponding end element from :paramref:`iterator`. :param element: start element :param iterator: Input stream of ``(event, element)`` coming from :py:func:`xml.etree.ElementTree.iterparse` with the argument ``events=["start", "end"]`` :raise: :py:class:`DeserializationException` if unexpected input :return: parsed value """ text = collapse_whitespace(read_text_from_element(element, iterator)) value = _TEXT_TO_XS_DOUBLE_LITERALS.get(text) if value is None: # NOTE (mristin): # ``float`` is far too permissive to be handed the text directly: it # takes ``Infinity``, ``inf``, ``nan`` and ``NAN``, none of which is # a valid ``xs:double``, as well as a digit group separator as in # ``1_0`` and surrounding whitespace. Mind that it is checked with # ``fullmatch`` and not with ``match``: ``$`` would also match just # before a trailing newline. if _XS_DOUBLE_RE.fullmatch(text) is None: raise DeserializationException( f"Expected a value as xs:double, " f"but got an element with text: {text!r}" ) try: value = float(text) except ValueError: raise DeserializationException( f"Expected a floating-point number, " f"but got an element with text: {text!r}" ) from None return value def _read_bytes_from_element_text( element: Element, iterator: Iterator[Tuple[str, Element]] ) -> bytes: """ Parse the text of :paramref:`element` as base64-encoded bytes, and read the corresponding end element from :paramref:`iterator`. :param element: look-ahead element :param iterator: Input stream of ``(event, element)`` coming from :py:func:`xml.etree.ElementTree.iterparse` with the argument ``events=["start", "end"]`` :raise: :py:class:`DeserializationException` if unexpected input :return: parsed value """ # NOTE (mristin): # We do not use ``read_text_from_element`` as that function expects # the ``element`` to contain *some* text. An empty ``xs:base64Binary`` # is a lexical form of its own, and stands for zero bytes -- its whole # production is optional -- so it is read here just like an empty # ``xs:string`` is. raw_text = element.text end_element = read_end_element(element, iterator) if raw_text is None: raw_text = end_element.text raise_if_has_tail_or_attrib(element) text = _remove_whitespace(raw_text if raw_text is not None else "") if not _matches_xs_base64_binary(text): raise DeserializationException( f"Expected a text as base64-encoded bytes, " f"but got an element with text: {text!r}" ) try: value = base64.b64decode(text) except Exception: raise DeserializationException( f"Expected a text as base64-encoded bytes, " f"but got an element with text: {text!r}" ) from None return value def _read_enum_from_element_text( element: Element, iterator: Iterator[Tuple[str, Element]], literal_from_str: Callable[[str], Optional[_ValueT]], enum_name: str, ) -> _ValueT: """ Parse the text of :paramref:`element` as an enumeration literal, and read the corresponding end element from :paramref:`iterator`. :param element: start element :param iterator: Input stream of ``(event, element)`` coming from :py:func:`xml.etree.ElementTree.iterparse` with the argument ``events=["start", "end"]`` :param literal_from_str: to parse the literal from its string representation :param enum_name: name of the enumeration, for the error messages :raise: :py:class:`DeserializationException` if unexpected input :return: parsed literal """ text = read_text_from_element(element, iterator) literal = literal_from_str(text) if literal is None: raise DeserializationException( f"Not a valid string representation of " f"a literal of {enum_name}: {text}" ) return literal def _read_json_object_body( element: Element, iterator: Iterator[Tuple[str, Element]] ) -> our_types.JsonObject: """ Read the content of :paramref:`element` as a sequence of ``<member>``'s. :param element: start element enclosing the members :param iterator: Input stream of ``(event, element)`` coming from :py:func:`xml.etree.ElementTree.iterparse` with the argument ``events=["start", "end"]`` :raise: :py:class:`DeserializationException` if unexpected input :return: parsed JSON-able object """ return our_xmlrpc.read_struct_body(element, iterator) _TupleItem1T = TypeVar("_TupleItem1T") _TupleItem2T = TypeVar("_TupleItem2T") def _tuple2_from_element( element: Element, iterator: Iterator[Tuple[str, Element]], read_item_1: _ContentReader[_TupleItem1T], read_item_2: _ContentReader[_TupleItem2T], ) -> Tuple[_TupleItem1T, _TupleItem2T]: """ Read a tuple of 2 item(s) from :paramref:`iterator`. Each ``read_item_*`` function is responsible for verifying the tag of its own item element -- *e.g.*, by wrapping a scalar/enumeration reader with :py:func:`_read_named_element`, or by relying on a class's own dispatch by its natural element tag. The end element corresponding to :paramref:`element` will be read as well. :param element: start element enclosing the tuple :param iterator: Input stream of ``(event, element)`` coming from :py:func:`xml.etree.ElementTree.iterparse` with the argument ``events=["start", "end"]`` :param read_item_1: to read the item at the position 0, including its own end element :param read_item_2: to read the item at the position 1, including its own end element :raise: :py:class:`DeserializationException` if unexpected input :return: parsed tuple """ if element.text is not None and len(element.text.strip()) != 0: raise DeserializationException( f"Expected only item elements and whitespace text, " f"but got text: {element.text!r}" ) item_1 = _read_tuple_item(element, iterator, 0, read_item_1) item_2 = _read_tuple_item(element, iterator, 1, read_item_2) read_end_element(element, iterator) return (item_1, item_2) def _read_json_object__at_v( element: Element, iterator: Iterator[Tuple[str, Element]] ) -> our_types.JsonObject: """ Read the content of :paramref:`element`, which must be tagged ``v``, as a JSON-able object. """ return _read_named_element(element, iterator, "v", _read_json_object_body) def _read_list_of__asset_administration_shell( element: Element, iterator: Iterator[Tuple[str, Element]] ) -> List[our_types.AssetAdministrationShell]: """ Read the items of :paramref:`element` as a list of :py:class:`.types.AssetAdministrationShell`. """ return _read_list_of_items( element, iterator, _read_asset_administration_shell_as_element ) def _read_list_of__asset_administration_shell_descriptor( element: Element, iterator: Iterator[Tuple[str, Element]] ) -> List[our_types.AssetAdministrationShellDescriptor]: """ Read the items of :paramref:`element` as a list of :py:class:`.types.AssetAdministrationShellDescriptor`. """ return _read_list_of_items( element, iterator, _read_asset_administration_shell_descriptor_as_element ) def _read_list_of__asset_administration_shell_metadata( element: Element, iterator: Iterator[Tuple[str, Element]] ) -> List[our_types.AssetAdministrationShellMetadata]: """ Read the items of :paramref:`element` as a list of :py:class:`.types.AssetAdministrationShellMetadata`. """ return _read_list_of_items( element, iterator, _read_asset_administration_shell_metadata_as_element ) def _read_list_of__asset_administration_shell_recent_change( element: Element, iterator: Iterator[Tuple[str, Element]] ) -> List[our_types.AssetAdministrationShellRecentChange]: """ Read the items of :paramref:`element` as a list of :py:class:`.types.AssetAdministrationShellRecentChange`. """ return _read_list_of_items( element, iterator, _read_asset_administration_shell_recent_change_as_element ) def _read_list_of__concept_description( element: Element, iterator: Iterator[Tuple[str, Element]] ) -> List[our_types.ConceptDescription]: """ Read the items of :paramref:`element` as a list of :py:class:`.types.ConceptDescription`. """ return _read_list_of_items(element, iterator, _read_concept_description_as_element) def _read_list_of__concept_description_recent_change( element: Element, iterator: Iterator[Tuple[str, Element]] ) -> List[our_types.ConceptDescriptionRecentChange]: """ Read the items of :paramref:`element` as a list of :py:class:`.types.ConceptDescriptionRecentChange`. """ return _read_list_of_items( element, iterator, _read_concept_description_recent_change_as_element ) def _read_list_of__data_element( element: Element, iterator: Iterator[Tuple[str, Element]] ) -> List[our_types.DataElement]: """ Read the items of :paramref:`element` as a list of :py:class:`.types.DataElement`. """ return _read_list_of_items(element, iterator, _read_data_element_as_element) def _read_list_of__definition_type_uom( element: Element, iterator: Iterator[Tuple[str, Element]] ) -> List[our_types.DefinitionTypeUom]: """ Read the items of :paramref:`element` as a list of :py:class:`.types.DefinitionTypeUom`. """ return _read_list_of_items(element, iterator, _read_definition_type_uom_as_element) def _read_list_of__embedded_data_specification( element: Element, iterator: Iterator[Tuple[str, Element]] ) -> List[our_types.EmbeddedDataSpecification]: """ Read the items of :paramref:`element` as a list of :py:class:`.types.EmbeddedDataSpecification`. """ return _read_list_of_items( element, iterator, _read_embedded_data_specification_as_element ) def _read_list_of__endpoint( element: Element, iterator: Iterator[Tuple[str, Element]] ) -> List[our_types.Endpoint]: """ Read the items of :paramref:`element` as a list of :py:class:`.types.Endpoint`. """ return _read_list_of_items(element, iterator, _read_endpoint_as_element) def _read_list_of__extension( element: Element, iterator: Iterator[Tuple[str, Element]] ) -> List[our_types.Extension]: """ Read the items of :paramref:`element` as a list of :py:class:`.types.Extension`. """ return _read_list_of_items(element, iterator, _read_extension_as_element) def _read_list_of__json_object( element: Element, iterator: Iterator[Tuple[str, Element]] ) -> List[our_types.JsonObject]: """ Read the items of :paramref:`element` as a list of a JSON-able object. """ return _read_list_of_items(element, iterator, _read_json_object__at_v) def _read_list_of__key( element: Element, iterator: Iterator[Tuple[str, Element]] ) -> List[our_types.Key]: """ Read the items of :paramref:`element` as a list of :py:class:`.types.Key`. """ return _read_list_of_items(element, iterator, _read_key_as_element) def _read_list_of__lang_string_definition_type_iec_61360( element: Element, iterator: Iterator[Tuple[str, Element]] ) -> List[our_types.LangStringDefinitionTypeIEC61360]: """ Read the items of :paramref:`element` as a list of :py:class:`.types.LangStringDefinitionTypeIEC61360`. """ return _read_list_of_items( element, iterator, _read_lang_string_definition_type_iec_61360_as_element ) def _read_list_of__lang_string_name_type( element: Element, iterator: Iterator[Tuple[str, Element]] ) -> List[our_types.LangStringNameType]: """ Read the items of :paramref:`element` as a list of :py:class:`.types.LangStringNameType`. """ return _read_list_of_items( element, iterator, _read_lang_string_name_type_as_element ) def _read_list_of__lang_string_preferred_name_type_iec_61360( element: Element, iterator: Iterator[Tuple[str, Element]] ) -> List[our_types.LangStringPreferredNameTypeIEC61360]: """ Read the items of :paramref:`element` as a list of :py:class:`.types.LangStringPreferredNameTypeIEC61360`. """ return _read_list_of_items( element, iterator, _read_lang_string_preferred_name_type_iec_61360_as_element ) def _read_list_of__lang_string_short_name_type_iec_61360( element: Element, iterator: Iterator[Tuple[str, Element]] ) -> List[our_types.LangStringShortNameTypeIEC61360]: """ Read the items of :paramref:`element` as a list of :py:class:`.types.LangStringShortNameTypeIEC61360`. """ return _read_list_of_items( element, iterator, _read_lang_string_short_name_type_iec_61360_as_element ) def _read_list_of__lang_string_text_type( element: Element, iterator: Iterator[Tuple[str, Element]] ) -> List[our_types.LangStringTextType]: """ Read the items of :paramref:`element` as a list of :py:class:`.types.LangStringTextType`. """ return _read_list_of_items( element, iterator, _read_lang_string_text_type_as_element ) def _read_list_of__lang_string_uom( element: Element, iterator: Iterator[Tuple[str, Element]] ) -> List[our_types.LangStringUom]: """ Read the items of :paramref:`element` as a list of :py:class:`.types.LangStringUom`. """ return _read_list_of_items(element, iterator, _read_lang_string_uom_as_element) def _read_list_of__logical_expression( element: Element, iterator: Iterator[Tuple[str, Element]] ) -> List[our_types.LogicalExpression]: """ Read the items of :paramref:`element` as a list of :py:class:`.types.LogicalExpression`. """ return _read_list_of_items(element, iterator, _read_logical_expression_as_element) def _read_list_of__match_expression( element: Element, iterator: Iterator[Tuple[str, Element]] ) -> List[our_types.MatchExpression]: """ Read the items of :paramref:`element` as a list of :py:class:`.types.MatchExpression`. """ return _read_list_of_items(element, iterator, _read_match_expression_as_element) def _read_list_of__message( element: Element, iterator: Iterator[Tuple[str, Element]] ) -> List[our_types.Message]: """ Read the items of :paramref:`element` as a list of :py:class:`.types.Message`. """ return _read_list_of_items(element, iterator, _read_message_as_element) def _read_list_of__operation_variable( element: Element, iterator: Iterator[Tuple[str, Element]] ) -> List[our_types.OperationVariable]: """ Read the items of :paramref:`element` as a list of :py:class:`.types.OperationVariable`. """ return _read_list_of_items(element, iterator, _read_operation_variable_as_element) def _read_list_of__package_description( element: Element, iterator: Iterator[Tuple[str, Element]] ) -> List[our_types.PackageDescription]: """ Read the items of :paramref:`element` as a list of :py:class:`.types.PackageDescription`. """ return _read_list_of_items(element, iterator, _read_package_description_as_element) def _read_list_of__qualifier( element: Element, iterator: Iterator[Tuple[str, Element]] ) -> List[our_types.Qualifier]: """ Read the items of :paramref:`element` as a list of :py:class:`.types.Qualifier`. """ return _read_list_of_items(element, iterator, _read_qualifier_as_element) def _read_list_of__query_filter( element: Element, iterator: Iterator[Tuple[str, Element]] ) -> List[our_types.QueryFilter]: """ Read the items of :paramref:`element` as a list of :py:class:`.types.QueryFilter`. """ return _read_list_of_items(element, iterator, _read_query_filter_as_element) def _read_list_of__referable( element: Element, iterator: Iterator[Tuple[str, Element]] ) -> List[our_types.Referable]: """ Read the items of :paramref:`element` as a list of :py:class:`.types.Referable`. """ return _read_list_of_items(element, iterator, _read_referable_as_element) def _read_list_of__reference( element: Element, iterator: Iterator[Tuple[str, Element]] ) -> List[our_types.Reference]: """ Read the items of :paramref:`element` as a list of :py:class:`.types.Reference`. """ return _read_list_of_items(element, iterator, _read_reference_as_element) def _read_list_of__security_attribute_object( element: Element, iterator: Iterator[Tuple[str, Element]] ) -> List[our_types.SecurityAttributeObject]: """ Read the items of :paramref:`element` as a list of :py:class:`.types.SecurityAttributeObject`. """ return _read_list_of_items( element, iterator, _read_security_attribute_object_as_element ) def _read_list_of__service_specification_profile_enum( element: Element, iterator: Iterator[Tuple[str, Element]] ) -> List[our_types.ServiceSpecificationProfileEnum]: """ Read the items of :paramref:`element` as a list of :py:class:`.types.ServiceSpecificationProfileEnum`. """ return _read_list_of_items( element, iterator, _read_service_specification_profile_enum__at_v ) def _read_list_of__specific_asset_id( element: Element, iterator: Iterator[Tuple[str, Element]] ) -> List[our_types.SpecificAssetID]: """ Read the items of :paramref:`element` as a list of :py:class:`.types.SpecificAssetID`. """ return _read_list_of_items(element, iterator, _read_specific_asset_id_as_element) def _read_list_of__str( element: Element, iterator: Iterator[Tuple[str, Element]] ) -> List[str]: """ Read the items of :paramref:`element` as a list of :py:class:`.types.PathItem`. """ return _read_list_of_items(element, iterator, _read_str__at_v) def _read_list_of__submodel( element: Element, iterator: Iterator[Tuple[str, Element]] ) -> List[our_types.Submodel]: """ Read the items of :paramref:`element` as a list of :py:class:`.types.Submodel`. """ return _read_list_of_items(element, iterator, _read_submodel_as_element) def _read_list_of__submodel_descriptor( element: Element, iterator: Iterator[Tuple[str, Element]] ) -> List[our_types.SubmodelDescriptor]: """ Read the items of :paramref:`element` as a list of :py:class:`.types.SubmodelDescriptor`. """ return _read_list_of_items(element, iterator, _read_submodel_descriptor_as_element) def _read_list_of__submodel_element( element: Element, iterator: Iterator[Tuple[str, Element]] ) -> List[our_types.SubmodelElement]: """ Read the items of :paramref:`element` as a list of :py:class:`.types.SubmodelElement`. """ return _read_list_of_items(element, iterator, _read_submodel_element_as_element) def _read_list_of__submodel_element_metadata( element: Element, iterator: Iterator[Tuple[str, Element]] ) -> List[our_types.SubmodelElementMetadata]: """ Read the items of :paramref:`element` as a list of :py:class:`.types.SubmodelElementMetadata`. """ return _read_list_of_items( element, iterator, _read_submodel_element_metadata_as_element ) def _read_list_of__submodel_metadata( element: Element, iterator: Iterator[Tuple[str, Element]] ) -> List[our_types.SubmodelMetadata]: """ Read the items of :paramref:`element` as a list of :py:class:`.types.SubmodelMetadata`. """ return _read_list_of_items(element, iterator, _read_submodel_metadata_as_element) def _read_list_of__submodel_recent_change( element: Element, iterator: Iterator[Tuple[str, Element]] ) -> List[our_types.SubmodelRecentChange]: """ Read the items of :paramref:`element` as a list of :py:class:`.types.SubmodelRecentChange`. """ return _read_list_of_items( element, iterator, _read_submodel_recent_change_as_element ) def _read_list_of__value_reference_pair( element: Element, iterator: Iterator[Tuple[str, Element]] ) -> List[our_types.ValueReferencePair]: """ Read the items of :paramref:`element` as a list of :py:class:`.types.ValueReferencePair`. """ return _read_list_of_items(element, iterator, _read_value_reference_pair_as_element) def _read_nested__attribute_item( element: Element, iterator: Iterator[Tuple[str, Element]] ) -> our_types.AttributeItem: """ Read an instance of :py:class:`.types.AttributeItem` nested in :paramref:`element` as a discriminator element. """ return _read_nested_element( element, iterator, _read_attribute_item_as_element, "AttributeItem" ) def _read_nested__data_specification_content( element: Element, iterator: Iterator[Tuple[str, Element]] ) -> our_types.DataSpecificationContent: """ Read an instance of :py:class:`.types.DataSpecificationContent` nested in :paramref:`element` as a discriminator element. """ return _read_nested_element( element, iterator, _read_data_specification_content_as_element, "DataSpecificationContent", ) def _read_nested__date_time_operand( element: Element, iterator: Iterator[Tuple[str, Element]] ) -> our_types.DateTimeOperand: """ Read an instance of :py:class:`.types.DateTimeOperand` nested in :paramref:`element` as a discriminator element. """ return _read_nested_element( element, iterator, _read_date_time_operand_as_element, "DateTimeOperand" ) def _read_nested__logical_expression( element: Element, iterator: Iterator[Tuple[str, Element]] ) -> our_types.LogicalExpression: """ Read an instance of :py:class:`.types.LogicalExpression` nested in :paramref:`element` as a discriminator element. """ return _read_nested_element( element, iterator, _read_logical_expression_as_element, "LogicalExpression" ) def _read_nested__string_value( element: Element, iterator: Iterator[Tuple[str, Element]] ) -> our_types.StringValue: """ Read an instance of :py:class:`.types.StringValue` nested in :paramref:`element` as a discriminator element. """ return _read_nested_element( element, iterator, _read_string_value_as_element, "StringValue" ) def _read_nested__submodel_element( element: Element, iterator: Iterator[Tuple[str, Element]] ) -> our_types.SubmodelElement: """ Read an instance of :py:class:`.types.SubmodelElement` nested in :paramref:`element` as a discriminator element. """ return _read_nested_element( element, iterator, _read_submodel_element_as_element, "SubmodelElement" ) def _read_nested__time_cast_operand( element: Element, iterator: Iterator[Tuple[str, Element]] ) -> our_types.TimeCastOperand: """ Read an instance of :py:class:`.types.TimeCastOperand` nested in :paramref:`element` as a discriminator element. """ return _read_nested_element( element, iterator, _read_time_cast_operand_as_element, "TimeCastOperand" ) def _read_nested__value( element: Element, iterator: Iterator[Tuple[str, Element]] ) -> our_types.Value: """ Read an instance of :py:class:`.types.Value` nested in :paramref:`element` as a discriminator element. """ return _read_nested_element(element, iterator, _read_value_as_element, "Value") def _read_service_specification_profile_enum__at_v( element: Element, iterator: Iterator[Tuple[str, Element]] ) -> our_types.ServiceSpecificationProfileEnum: """ Read the content of :paramref:`element`, which must be tagged ``v``, as :py:class:`.types.ServiceSpecificationProfileEnum`. """ return _read_named_element( element, iterator, "v", _read_service_specification_profile_enum_from_element_text, ) def _read_str__at_v(element: Element, iterator: Iterator[Tuple[str, Element]]) -> str: """ Read the content of :paramref:`element`, which must be tagged ``v``, as :py:class:`.types.PathItem`. """ return _read_named_element(element, iterator, "v", read_str_from_element_text) def _read_tuple2_of__string_value__string_value( element: Element, iterator: Iterator[Tuple[str, Element]] ) -> Tuple[our_types.StringValue, our_types.StringValue]: """ Read the items of :paramref:`element` as a tuple of 2 item(s). """ return _tuple2_from_element( element, iterator, _read_string_value_as_element, _read_string_value_as_element ) def _read_tuple2_of__value__value( element: Element, iterator: Iterator[Tuple[str, Element]] ) -> Tuple[our_types.Value, our_types.Value]: """ Read the items of :paramref:`element` as a tuple of 2 item(s). """ return _tuple2_from_element( element, iterator, _read_value_as_element, _read_value_as_element ) def _read_has_semantics_as_element( element: Element, iterator: Iterator[Tuple[str, Element]] ) -> our_types.HasSemantics: """ Read an instance of :py:class:`.types.HasSemantics` from :paramref:`iterator`, including the end element. :param element: start element :param iterator: Input stream of ``(event, element)`` coming from :py:func:`xml.etree.ElementTree.iterparse` with the argument ``events=["start", "end"]`` :raise: :py:class:`DeserializationException` if unexpected input :return: parsed instance """ return _read_dispatched( element, iterator, _DISPATCH_FOR_HAS_SEMANTICS, "a concrete instance of 'HasSemantics'", ) def _read_extension_as_sequence( element: Element, iterator: Iterator[Tuple[str, Element]] ) -> our_types.Extension: """ Read an instance of :py:class:`.types.Extension` as a sequence of XML-encoded properties. The end element corresponding to the :paramref:`element` will be read as well. :param element: start element, parent of the sequence :param iterator: Input stream of ``(event, element)`` coming from :py:func:`xml.etree.ElementTree.iterparse` with the argument ``events=["start", "end"]`` :raise: :py:class:`DeserializationException` if unexpected input :return: parsed instance """ values = _read_properties(element, iterator, _READERS_FOR_EXTENSION) the_semantic_id: Optional[our_types.Reference] = values.get("semanticId") the_supplemental_semantic_ids: Optional[List[our_types.Reference]] = values.get( "supplementalSemanticIds" ) the_name: Optional[str] = values.get("name") the_value_type: Optional[our_types.DataTypeDefXSD] = values.get("valueType") the_value: Optional[str] = values.get("value") the_refers_to: Optional[List[our_types.Reference]] = values.get("refersTo") if the_name is None: raise DeserializationException("The required property 'name' is missing") return our_types.Extension( the_name, the_semantic_id, the_supplemental_semantic_ids, the_value_type, the_value, the_refers_to, ) def _read_extension_as_element( element: Element, iterator: Iterator[Tuple[str, Element]] ) -> our_types.Extension: """ Read an instance of :py:class:`.types.Extension` from :paramref:`iterator`, including the end element. :param element: start element :param iterator: Input stream of ``(event, element)`` coming from :py:func:`xml.etree.ElementTree.iterparse` with the argument ``events=["start", "end"]`` :raise: :py:class:`DeserializationException` if unexpected input :return: parsed instance """ return _read_named_element( element, iterator, "extension", _read_extension_as_sequence ) def _read_has_extensions_as_element( element: Element, iterator: Iterator[Tuple[str, Element]] ) -> our_types.HasExtensions: """ Read an instance of :py:class:`.types.HasExtensions` from :paramref:`iterator`, including the end element. :param element: start element :param iterator: Input stream of ``(event, element)`` coming from :py:func:`xml.etree.ElementTree.iterparse` with the argument ``events=["start", "end"]`` :raise: :py:class:`DeserializationException` if unexpected input :return: parsed instance """ return _read_dispatched( element, iterator, _DISPATCH_FOR_HAS_EXTENSIONS, "a concrete instance of 'HasExtensions'", ) def _read_referable_as_element( element: Element, iterator: Iterator[Tuple[str, Element]] ) -> our_types.Referable: """ Read an instance of :py:class:`.types.Referable` from :paramref:`iterator`, including the end element. :param element: start element :param iterator: Input stream of ``(event, element)`` coming from :py:func:`xml.etree.ElementTree.iterparse` with the argument ``events=["start", "end"]`` :raise: :py:class:`DeserializationException` if unexpected input :return: parsed instance """ return _read_dispatched( element, iterator, _DISPATCH_FOR_REFERABLE, "a concrete instance of 'Referable'" ) def _read_identifiable_as_element( element: Element, iterator: Iterator[Tuple[str, Element]] ) -> our_types.Identifiable: """ Read an instance of :py:class:`.types.Identifiable` from :paramref:`iterator`, including the end element. :param element: start element :param iterator: Input stream of ``(event, element)`` coming from :py:func:`xml.etree.ElementTree.iterparse` with the argument ``events=["start", "end"]`` :raise: :py:class:`DeserializationException` if unexpected input :return: parsed instance """ return _read_dispatched( element, iterator, _DISPATCH_FOR_IDENTIFIABLE, "a concrete instance of 'Identifiable'", ) def _read_modelling_kind_from_element_text( element: Element, iterator: Iterator[Tuple[str, Element]] ) -> our_types.ModellingKind: """ Parse the text of :paramref:`element` as a literal of :py:class:`.types.ModellingKind`, and read the corresponding end element from :paramref:`iterator`. :param element: start element :param iterator: Input stream of ``(event, element)`` coming from :py:func:`xml.etree.ElementTree.iterparse` with the argument ``events=["start", "end"]`` :raise: :py:class:`DeserializationException` if unexpected input :return: parsed value """ return _read_enum_from_element_text( element, iterator, our_stringification.modelling_kind_from_str, "ModellingKind" ) def _read_has_kind_as_element( element: Element, iterator: Iterator[Tuple[str, Element]] ) -> our_types.HasKind: """ Read an instance of :py:class:`.types.HasKind` from :paramref:`iterator`, including the end element. :param element: start element :param iterator: Input stream of ``(event, element)`` coming from :py:func:`xml.etree.ElementTree.iterparse` with the argument ``events=["start", "end"]`` :raise: :py:class:`DeserializationException` if unexpected input :return: parsed instance """ return _read_dispatched( element, iterator, _DISPATCH_FOR_HAS_KIND, "a concrete instance of 'HasKind'" ) def _read_has_data_specification_as_element( element: Element, iterator: Iterator[Tuple[str, Element]] ) -> our_types.HasDataSpecification: """ Read an instance of :py:class:`.types.HasDataSpecification` from :paramref:`iterator`, including the end element. :param element: start element :param iterator: Input stream of ``(event, element)`` coming from :py:func:`xml.etree.ElementTree.iterparse` with the argument ``events=["start", "end"]`` :raise: :py:class:`DeserializationException` if unexpected input :return: parsed instance """ return _read_dispatched( element, iterator, _DISPATCH_FOR_HAS_DATA_SPECIFICATION, "a concrete instance of 'HasDataSpecification'", ) def _read_administrative_information_as_sequence( element: Element, iterator: Iterator[Tuple[str, Element]] ) -> our_types.AdministrativeInformation: """ Read an instance of :py:class:`.types.AdministrativeInformation` as a sequence of XML-encoded properties. The end element corresponding to the :paramref:`element` will be read as well. :param element: start element, parent of the sequence :param iterator: Input stream of ``(event, element)`` coming from :py:func:`xml.etree.ElementTree.iterparse` with the argument ``events=["start", "end"]`` :raise: :py:class:`DeserializationException` if unexpected input :return: parsed instance """ values = _read_properties( element, iterator, _READERS_FOR_ADMINISTRATIVE_INFORMATION ) the_embedded_data_specifications: Optional[ List[our_types.EmbeddedDataSpecification] ] = values.get("embeddedDataSpecifications") the_version: Optional[str] = values.get("version") the_revision: Optional[str] = values.get("revision") the_creator: Optional[our_types.Reference] = values.get("creator") the_created_at: Optional[str] = values.get("createdAt") the_updated_at: Optional[str] = values.get("updatedAt") the_template_id: Optional[str] = values.get("templateId") return our_types.AdministrativeInformation( the_embedded_data_specifications, the_version, the_revision, the_creator, the_created_at, the_updated_at, the_template_id, ) def _read_administrative_information_as_element( element: Element, iterator: Iterator[Tuple[str, Element]] ) -> our_types.AdministrativeInformation: """ Read an instance of :py:class:`.types.AdministrativeInformation` from :paramref:`iterator`, including the end element. :param element: start element :param iterator: Input stream of ``(event, element)`` coming from :py:func:`xml.etree.ElementTree.iterparse` with the argument ``events=["start", "end"]`` :raise: :py:class:`DeserializationException` if unexpected input :return: parsed instance """ return _read_named_element( element, iterator, "administrativeInformation", _read_administrative_information_as_sequence, ) def _read_qualifiable_as_element( element: Element, iterator: Iterator[Tuple[str, Element]] ) -> our_types.Qualifiable: """ Read an instance of :py:class:`.types.Qualifiable` from :paramref:`iterator`, including the end element. :param element: start element :param iterator: Input stream of ``(event, element)`` coming from :py:func:`xml.etree.ElementTree.iterparse` with the argument ``events=["start", "end"]`` :raise: :py:class:`DeserializationException` if unexpected input :return: parsed instance """ return _read_dispatched( element, iterator, _DISPATCH_FOR_QUALIFIABLE, "a concrete instance of 'Qualifiable'", ) def _read_qualifier_kind_from_element_text( element: Element, iterator: Iterator[Tuple[str, Element]] ) -> our_types.QualifierKind: """ Parse the text of :paramref:`element` as a literal of :py:class:`.types.QualifierKind`, and read the corresponding end element from :paramref:`iterator`. :param element: start element :param iterator: Input stream of ``(event, element)`` coming from :py:func:`xml.etree.ElementTree.iterparse` with the argument ``events=["start", "end"]`` :raise: :py:class:`DeserializationException` if unexpected input :return: parsed value """ return _read_enum_from_element_text( element, iterator, our_stringification.qualifier_kind_from_str, "QualifierKind" ) def _read_qualifier_as_sequence( element: Element, iterator: Iterator[Tuple[str, Element]] ) -> our_types.Qualifier: """ Read an instance of :py:class:`.types.Qualifier` as a sequence of XML-encoded properties. The end element corresponding to the :paramref:`element` will be read as well. :param element: start element, parent of the sequence :param iterator: Input stream of ``(event, element)`` coming from :py:func:`xml.etree.ElementTree.iterparse` with the argument ``events=["start", "end"]`` :raise: :py:class:`DeserializationException` if unexpected input :return: parsed instance """ values = _read_properties(element, iterator, _READERS_FOR_QUALIFIER) the_semantic_id: Optional[our_types.Reference] = values.get("semanticId") the_supplemental_semantic_ids: Optional[List[our_types.Reference]] = values.get( "supplementalSemanticIds" ) the_kind: Optional[our_types.QualifierKind] = values.get("kind") the_type: Optional[str] = values.get("type") the_value_type: Optional[our_types.DataTypeDefXSD] = values.get("valueType") the_value: Optional[str] = values.get("value") the_value_id: Optional[our_types.Reference] = values.get("valueId") if the_type is None: raise DeserializationException("The required property 'type' is missing") if the_value_type is None: raise DeserializationException("The required property 'valueType' is missing") return our_types.Qualifier( the_type, the_value_type, the_semantic_id, the_supplemental_semantic_ids, the_kind, the_value, the_value_id, ) def _read_qualifier_as_element( element: Element, iterator: Iterator[Tuple[str, Element]] ) -> our_types.Qualifier: """ Read an instance of :py:class:`.types.Qualifier` from :paramref:`iterator`, including the end element. :param element: start element :param iterator: Input stream of ``(event, element)`` coming from :py:func:`xml.etree.ElementTree.iterparse` with the argument ``events=["start", "end"]`` :raise: :py:class:`DeserializationException` if unexpected input :return: parsed instance """ return _read_named_element( element, iterator, "qualifier", _read_qualifier_as_sequence ) def _read_asset_administration_shell_as_sequence( element: Element, iterator: Iterator[Tuple[str, Element]] ) -> our_types.AssetAdministrationShell: """ Read an instance of :py:class:`.types.AssetAdministrationShell` as a sequence of XML-encoded properties. The end element corresponding to the :paramref:`element` will be read as well. :param element: start element, parent of the sequence :param iterator: Input stream of ``(event, element)`` coming from :py:func:`xml.etree.ElementTree.iterparse` with the argument ``events=["start", "end"]`` :raise: :py:class:`DeserializationException` if unexpected input :return: parsed instance """ values = _read_properties( element, iterator, _READERS_FOR_ASSET_ADMINISTRATION_SHELL ) the_extensions: Optional[List[our_types.Extension]] = values.get("extensions") the_category: Optional[str] = values.get("category") the_id_short: Optional[str] = values.get("idShort") the_display_name: Optional[List[our_types.LangStringNameType]] = values.get( "displayName" ) the_description: Optional[List[our_types.LangStringTextType]] = values.get( "description" ) the_administration: Optional[our_types.AdministrativeInformation] = values.get( "administration" ) the_id: Optional[str] = values.get("id") the_embedded_data_specifications: Optional[ List[our_types.EmbeddedDataSpecification] ] = values.get("embeddedDataSpecifications") the_derived_from: Optional[our_types.Reference] = values.get("derivedFrom") the_asset_information: Optional[our_types.AssetInformation] = values.get( "assetInformation" ) the_submodels: Optional[List[our_types.Reference]] = values.get("submodels") if the_id is None: raise DeserializationException("The required property 'id' is missing") if the_asset_information is None: raise DeserializationException( "The required property 'assetInformation' is missing" ) return our_types.AssetAdministrationShell( the_id, the_asset_information, the_extensions, the_category, the_id_short, the_display_name, the_description, the_administration, the_embedded_data_specifications, the_derived_from, the_submodels, ) def _read_asset_administration_shell_as_element( element: Element, iterator: Iterator[Tuple[str, Element]] ) -> our_types.AssetAdministrationShell: """ Read an instance of :py:class:`.types.AssetAdministrationShell` from :paramref:`iterator`, including the end element. :param element: start element :param iterator: Input stream of ``(event, element)`` coming from :py:func:`xml.etree.ElementTree.iterparse` with the argument ``events=["start", "end"]`` :raise: :py:class:`DeserializationException` if unexpected input :return: parsed instance """ return _read_named_element( element, iterator, "assetAdministrationShell", _read_asset_administration_shell_as_sequence, ) def _read_asset_information_as_sequence( element: Element, iterator: Iterator[Tuple[str, Element]] ) -> our_types.AssetInformation: """ Read an instance of :py:class:`.types.AssetInformation` as a sequence of XML-encoded properties. The end element corresponding to the :paramref:`element` will be read as well. :param element: start element, parent of the sequence :param iterator: Input stream of ``(event, element)`` coming from :py:func:`xml.etree.ElementTree.iterparse` with the argument ``events=["start", "end"]`` :raise: :py:class:`DeserializationException` if unexpected input :return: parsed instance """ values = _read_properties(element, iterator, _READERS_FOR_ASSET_INFORMATION) the_asset_kind: Optional[our_types.AssetKind] = values.get("assetKind") the_global_asset_id: Optional[str] = values.get("globalAssetId") the_specific_asset_ids: Optional[List[our_types.SpecificAssetID]] = values.get( "specificAssetIds" ) the_asset_type: Optional[str] = values.get("assetType") the_default_thumbnail: Optional[our_types.Resource] = values.get("defaultThumbnail") if the_asset_kind is None: raise DeserializationException("The required property 'assetKind' is missing") return our_types.AssetInformation( the_asset_kind, the_global_asset_id, the_specific_asset_ids, the_asset_type, the_default_thumbnail, ) def _read_asset_information_as_element( element: Element, iterator: Iterator[Tuple[str, Element]] ) -> our_types.AssetInformation: """ Read an instance of :py:class:`.types.AssetInformation` from :paramref:`iterator`, including the end element. :param element: start element :param iterator: Input stream of ``(event, element)`` coming from :py:func:`xml.etree.ElementTree.iterparse` with the argument ``events=["start", "end"]`` :raise: :py:class:`DeserializationException` if unexpected input :return: parsed instance """ return _read_named_element( element, iterator, "assetInformation", _read_asset_information_as_sequence ) def _read_resource_as_sequence( element: Element, iterator: Iterator[Tuple[str, Element]] ) -> our_types.Resource: """ Read an instance of :py:class:`.types.Resource` as a sequence of XML-encoded properties. The end element corresponding to the :paramref:`element` will be read as well. :param element: start element, parent of the sequence :param iterator: Input stream of ``(event, element)`` coming from :py:func:`xml.etree.ElementTree.iterparse` with the argument ``events=["start", "end"]`` :raise: :py:class:`DeserializationException` if unexpected input :return: parsed instance """ values = _read_properties(element, iterator, _READERS_FOR_RESOURCE) the_path: Optional[str] = values.get("path") the_content_type: Optional[str] = values.get("contentType") if the_path is None: raise DeserializationException("The required property 'path' is missing") return our_types.Resource(the_path, the_content_type) def _read_resource_as_element( element: Element, iterator: Iterator[Tuple[str, Element]] ) -> our_types.Resource: """ Read an instance of :py:class:`.types.Resource` from :paramref:`iterator`, including the end element. :param element: start element :param iterator: Input stream of ``(event, element)`` coming from :py:func:`xml.etree.ElementTree.iterparse` with the argument ``events=["start", "end"]`` :raise: :py:class:`DeserializationException` if unexpected input :return: parsed instance """ return _read_named_element( element, iterator, "resource", _read_resource_as_sequence ) def _read_asset_kind_from_element_text( element: Element, iterator: Iterator[Tuple[str, Element]] ) -> our_types.AssetKind: """ Parse the text of :paramref:`element` as a literal of :py:class:`.types.AssetKind`, and read the corresponding end element from :paramref:`iterator`. :param element: start element :param iterator: Input stream of ``(event, element)`` coming from :py:func:`xml.etree.ElementTree.iterparse` with the argument ``events=["start", "end"]`` :raise: :py:class:`DeserializationException` if unexpected input :return: parsed value """ return _read_enum_from_element_text( element, iterator, our_stringification.asset_kind_from_str, "AssetKind" ) def _read_specific_asset_id_as_sequence( element: Element, iterator: Iterator[Tuple[str, Element]] ) -> our_types.SpecificAssetID: """ Read an instance of :py:class:`.types.SpecificAssetID` as a sequence of XML-encoded properties. The end element corresponding to the :paramref:`element` will be read as well. :param element: start element, parent of the sequence :param iterator: Input stream of ``(event, element)`` coming from :py:func:`xml.etree.ElementTree.iterparse` with the argument ``events=["start", "end"]`` :raise: :py:class:`DeserializationException` if unexpected input :return: parsed instance """ values = _read_properties(element, iterator, _READERS_FOR_SPECIFIC_ASSET_ID) the_semantic_id: Optional[our_types.Reference] = values.get("semanticId") the_supplemental_semantic_ids: Optional[List[our_types.Reference]] = values.get( "supplementalSemanticIds" ) the_name: Optional[str] = values.get("name") the_value: Optional[str] = values.get("value") the_external_subject_id: Optional[our_types.Reference] = values.get( "externalSubjectId" ) if the_name is None: raise DeserializationException("The required property 'name' is missing") if the_value is None: raise DeserializationException("The required property 'value' is missing") return our_types.SpecificAssetID( the_name, the_value, the_semantic_id, the_supplemental_semantic_ids, the_external_subject_id, ) def _read_specific_asset_id_as_element( element: Element, iterator: Iterator[Tuple[str, Element]] ) -> our_types.SpecificAssetID: """ Read an instance of :py:class:`.types.SpecificAssetID` from :paramref:`iterator`, including the end element. :param element: start element :param iterator: Input stream of ``(event, element)`` coming from :py:func:`xml.etree.ElementTree.iterparse` with the argument ``events=["start", "end"]`` :raise: :py:class:`DeserializationException` if unexpected input :return: parsed instance """ return _read_named_element( element, iterator, "specificAssetId", _read_specific_asset_id_as_sequence ) def _read_submodel_as_sequence( element: Element, iterator: Iterator[Tuple[str, Element]] ) -> our_types.Submodel: """ Read an instance of :py:class:`.types.Submodel` as a sequence of XML-encoded properties. The end element corresponding to the :paramref:`element` will be read as well. :param element: start element, parent of the sequence :param iterator: Input stream of ``(event, element)`` coming from :py:func:`xml.etree.ElementTree.iterparse` with the argument ``events=["start", "end"]`` :raise: :py:class:`DeserializationException` if unexpected input :return: parsed instance """ values = _read_properties(element, iterator, _READERS_FOR_SUBMODEL) the_extensions: Optional[List[our_types.Extension]] = values.get("extensions") the_category: Optional[str] = values.get("category") the_id_short: Optional[str] = values.get("idShort") the_display_name: Optional[List[our_types.LangStringNameType]] = values.get( "displayName" ) the_description: Optional[List[our_types.LangStringTextType]] = values.get( "description" ) the_administration: Optional[our_types.AdministrativeInformation] = values.get( "administration" ) the_id: Optional[str] = values.get("id") the_kind: Optional[our_types.ModellingKind] = values.get("kind") the_semantic_id: Optional[our_types.Reference] = values.get("semanticId") the_supplemental_semantic_ids: Optional[List[our_types.Reference]] = values.get( "supplementalSemanticIds" ) the_qualifiers: Optional[List[our_types.Qualifier]] = values.get("qualifiers") the_embedded_data_specifications: Optional[ List[our_types.EmbeddedDataSpecification] ] = values.get("embeddedDataSpecifications") the_submodel_elements: Optional[List[our_types.SubmodelElement]] = values.get( "submodelElements" ) if the_id is None: raise DeserializationException("The required property 'id' is missing") return our_types.Submodel( the_id, the_extensions, the_category, the_id_short, the_display_name, the_description, the_administration, the_kind, the_semantic_id, the_supplemental_semantic_ids, the_qualifiers, the_embedded_data_specifications, the_submodel_elements, ) def _read_submodel_as_element( element: Element, iterator: Iterator[Tuple[str, Element]] ) -> our_types.Submodel: """ Read an instance of :py:class:`.types.Submodel` from :paramref:`iterator`, including the end element. :param element: start element :param iterator: Input stream of ``(event, element)`` coming from :py:func:`xml.etree.ElementTree.iterparse` with the argument ``events=["start", "end"]`` :raise: :py:class:`DeserializationException` if unexpected input :return: parsed instance """ return _read_named_element( element, iterator, "submodel", _read_submodel_as_sequence ) def _read_submodel_element_as_element( element: Element, iterator: Iterator[Tuple[str, Element]] ) -> our_types.SubmodelElement: """ Read an instance of :py:class:`.types.SubmodelElement` from :paramref:`iterator`, including the end element. :param element: start element :param iterator: Input stream of ``(event, element)`` coming from :py:func:`xml.etree.ElementTree.iterparse` with the argument ``events=["start", "end"]`` :raise: :py:class:`DeserializationException` if unexpected input :return: parsed instance """ return _read_dispatched( element, iterator, _DISPATCH_FOR_SUBMODEL_ELEMENT, "a concrete instance of 'SubmodelElement'", ) def _read_relationship_element_as_sequence( element: Element, iterator: Iterator[Tuple[str, Element]] ) -> our_types.RelationshipElement: """ Read an instance of :py:class:`.types.RelationshipElement` as a sequence of XML-encoded properties. The end element corresponding to the :paramref:`element` will be read as well. :param element: start element, parent of the sequence :param iterator: Input stream of ``(event, element)`` coming from :py:func:`xml.etree.ElementTree.iterparse` with the argument ``events=["start", "end"]`` :raise: :py:class:`DeserializationException` if unexpected input :return: parsed instance """ values = _read_properties(element, iterator, _READERS_FOR_RELATIONSHIP_ELEMENT) the_extensions: Optional[List[our_types.Extension]] = values.get("extensions") the_category: Optional[str] = values.get("category") the_id_short: Optional[str] = values.get("idShort") the_display_name: Optional[List[our_types.LangStringNameType]] = values.get( "displayName" ) the_description: Optional[List[our_types.LangStringTextType]] = values.get( "description" ) the_semantic_id: Optional[our_types.Reference] = values.get("semanticId") the_supplemental_semantic_ids: Optional[List[our_types.Reference]] = values.get( "supplementalSemanticIds" ) the_qualifiers: Optional[List[our_types.Qualifier]] = values.get("qualifiers") the_embedded_data_specifications: Optional[ List[our_types.EmbeddedDataSpecification] ] = values.get("embeddedDataSpecifications") the_first: Optional[our_types.Reference] = values.get("first") the_second: Optional[our_types.Reference] = values.get("second") return our_types.RelationshipElement( the_extensions, the_category, the_id_short, the_display_name, the_description, the_semantic_id, the_supplemental_semantic_ids, the_qualifiers, the_embedded_data_specifications, the_first, the_second, ) def _read_relationship_element_as_element( element: Element, iterator: Iterator[Tuple[str, Element]] ) -> our_types.RelationshipElement: """ Read an instance of :py:class:`.types.RelationshipElement` from :paramref:`iterator`, including the end element. :param element: start element :param iterator: Input stream of ``(event, element)`` coming from :py:func:`xml.etree.ElementTree.iterparse` with the argument ``events=["start", "end"]`` :raise: :py:class:`DeserializationException` if unexpected input :return: parsed instance """ return _read_dispatched( element, iterator, _DISPATCH_FOR_RELATIONSHIP_ELEMENT, "a concrete instance of 'RelationshipElement'", ) def _read_aas_submodel_elements_from_element_text( element: Element, iterator: Iterator[Tuple[str, Element]] ) -> our_types.AASSubmodelElements: """ Parse the text of :paramref:`element` as a literal of :py:class:`.types.AASSubmodelElements`, and read the corresponding end element from :paramref:`iterator`. :param element: start element :param iterator: Input stream of ``(event, element)`` coming from :py:func:`xml.etree.ElementTree.iterparse` with the argument ``events=["start", "end"]`` :raise: :py:class:`DeserializationException` if unexpected input :return: parsed value """ return _read_enum_from_element_text( element, iterator, our_stringification.aas_submodel_elements_from_str, "AASSubmodelElements", ) def _read_submodel_element_list_as_sequence( element: Element, iterator: Iterator[Tuple[str, Element]] ) -> our_types.SubmodelElementList: """ Read an instance of :py:class:`.types.SubmodelElementList` as a sequence of XML-encoded properties. The end element corresponding to the :paramref:`element` will be read as well. :param element: start element, parent of the sequence :param iterator: Input stream of ``(event, element)`` coming from :py:func:`xml.etree.ElementTree.iterparse` with the argument ``events=["start", "end"]`` :raise: :py:class:`DeserializationException` if unexpected input :return: parsed instance """ values = _read_properties(element, iterator, _READERS_FOR_SUBMODEL_ELEMENT_LIST) the_extensions: Optional[List[our_types.Extension]] = values.get("extensions") the_category: Optional[str] = values.get("category") the_id_short: Optional[str] = values.get("idShort") the_display_name: Optional[List[our_types.LangStringNameType]] = values.get( "displayName" ) the_description: Optional[List[our_types.LangStringTextType]] = values.get( "description" ) the_semantic_id: Optional[our_types.Reference] = values.get("semanticId") the_supplemental_semantic_ids: Optional[List[our_types.Reference]] = values.get( "supplementalSemanticIds" ) the_qualifiers: Optional[List[our_types.Qualifier]] = values.get("qualifiers") the_embedded_data_specifications: Optional[ List[our_types.EmbeddedDataSpecification] ] = values.get("embeddedDataSpecifications") the_order_relevant: Optional[bool] = values.get("orderRelevant") the_semantic_id_list_element: Optional[our_types.Reference] = values.get( "semanticIdListElement" ) the_type_value_list_element: Optional[our_types.AASSubmodelElements] = values.get( "typeValueListElement" ) the_value_type_list_element: Optional[our_types.DataTypeDefXSD] = values.get( "valueTypeListElement" ) the_value: Optional[List[our_types.SubmodelElement]] = values.get("value") if the_type_value_list_element is None: raise DeserializationException( "The required property 'typeValueListElement' is missing" ) return our_types.SubmodelElementList( the_type_value_list_element, the_extensions, the_category, the_id_short, the_display_name, the_description, the_semantic_id, the_supplemental_semantic_ids, the_qualifiers, the_embedded_data_specifications, the_order_relevant, the_semantic_id_list_element, the_value_type_list_element, the_value, ) def _read_submodel_element_list_as_element( element: Element, iterator: Iterator[Tuple[str, Element]] ) -> our_types.SubmodelElementList: """ Read an instance of :py:class:`.types.SubmodelElementList` from :paramref:`iterator`, including the end element. :param element: start element :param iterator: Input stream of ``(event, element)`` coming from :py:func:`xml.etree.ElementTree.iterparse` with the argument ``events=["start", "end"]`` :raise: :py:class:`DeserializationException` if unexpected input :return: parsed instance """ return _read_named_element( element, iterator, "submodelElementList", _read_submodel_element_list_as_sequence, ) def _read_submodel_element_collection_as_sequence( element: Element, iterator: Iterator[Tuple[str, Element]] ) -> our_types.SubmodelElementCollection: """ Read an instance of :py:class:`.types.SubmodelElementCollection` as a sequence of XML-encoded properties. The end element corresponding to the :paramref:`element` will be read as well. :param element: start element, parent of the sequence :param iterator: Input stream of ``(event, element)`` coming from :py:func:`xml.etree.ElementTree.iterparse` with the argument ``events=["start", "end"]`` :raise: :py:class:`DeserializationException` if unexpected input :return: parsed instance """ values = _read_properties( element, iterator, _READERS_FOR_SUBMODEL_ELEMENT_COLLECTION ) the_extensions: Optional[List[our_types.Extension]] = values.get("extensions") the_category: Optional[str] = values.get("category") the_id_short: Optional[str] = values.get("idShort") the_display_name: Optional[List[our_types.LangStringNameType]] = values.get( "displayName" ) the_description: Optional[List[our_types.LangStringTextType]] = values.get( "description" ) the_semantic_id: Optional[our_types.Reference] = values.get("semanticId") the_supplemental_semantic_ids: Optional[List[our_types.Reference]] = values.get( "supplementalSemanticIds" ) the_qualifiers: Optional[List[our_types.Qualifier]] = values.get("qualifiers") the_embedded_data_specifications: Optional[ List[our_types.EmbeddedDataSpecification] ] = values.get("embeddedDataSpecifications") the_value: Optional[List[our_types.SubmodelElement]] = values.get("value") return our_types.SubmodelElementCollection( the_extensions, the_category, the_id_short, the_display_name, the_description, the_semantic_id, the_supplemental_semantic_ids, the_qualifiers, the_embedded_data_specifications, the_value, ) def _read_submodel_element_collection_as_element( element: Element, iterator: Iterator[Tuple[str, Element]] ) -> our_types.SubmodelElementCollection: """ Read an instance of :py:class:`.types.SubmodelElementCollection` from :paramref:`iterator`, including the end element. :param element: start element :param iterator: Input stream of ``(event, element)`` coming from :py:func:`xml.etree.ElementTree.iterparse` with the argument ``events=["start", "end"]`` :raise: :py:class:`DeserializationException` if unexpected input :return: parsed instance """ return _read_named_element( element, iterator, "submodelElementCollection", _read_submodel_element_collection_as_sequence, ) def _read_data_element_as_element( element: Element, iterator: Iterator[Tuple[str, Element]] ) -> our_types.DataElement: """ Read an instance of :py:class:`.types.DataElement` from :paramref:`iterator`, including the end element. :param element: start element :param iterator: Input stream of ``(event, element)`` coming from :py:func:`xml.etree.ElementTree.iterparse` with the argument ``events=["start", "end"]`` :raise: :py:class:`DeserializationException` if unexpected input :return: parsed instance """ return _read_dispatched( element, iterator, _DISPATCH_FOR_DATA_ELEMENT, "a concrete instance of 'DataElement'", ) def _read_property_as_sequence( element: Element, iterator: Iterator[Tuple[str, Element]] ) -> our_types.Property: """ Read an instance of :py:class:`.types.Property` as a sequence of XML-encoded properties. The end element corresponding to the :paramref:`element` will be read as well. :param element: start element, parent of the sequence :param iterator: Input stream of ``(event, element)`` coming from :py:func:`xml.etree.ElementTree.iterparse` with the argument ``events=["start", "end"]`` :raise: :py:class:`DeserializationException` if unexpected input :return: parsed instance """ values = _read_properties(element, iterator, _READERS_FOR_PROPERTY) the_extensions: Optional[List[our_types.Extension]] = values.get("extensions") the_category: Optional[str] = values.get("category") the_id_short: Optional[str] = values.get("idShort") the_display_name: Optional[List[our_types.LangStringNameType]] = values.get( "displayName" ) the_description: Optional[List[our_types.LangStringTextType]] = values.get( "description" ) the_semantic_id: Optional[our_types.Reference] = values.get("semanticId") the_supplemental_semantic_ids: Optional[List[our_types.Reference]] = values.get( "supplementalSemanticIds" ) the_qualifiers: Optional[List[our_types.Qualifier]] = values.get("qualifiers") the_embedded_data_specifications: Optional[ List[our_types.EmbeddedDataSpecification] ] = values.get("embeddedDataSpecifications") the_value_type: Optional[our_types.DataTypeDefXSD] = values.get("valueType") the_value: Optional[str] = values.get("value") the_value_id: Optional[our_types.Reference] = values.get("valueId") if the_value_type is None: raise DeserializationException("The required property 'valueType' is missing") return our_types.Property( the_value_type, the_extensions, the_category, the_id_short, the_display_name, the_description, the_semantic_id, the_supplemental_semantic_ids, the_qualifiers, the_embedded_data_specifications, the_value, the_value_id, ) def _read_property_as_element( element: Element, iterator: Iterator[Tuple[str, Element]] ) -> our_types.Property: """ Read an instance of :py:class:`.types.Property` from :paramref:`iterator`, including the end element. :param element: start element :param iterator: Input stream of ``(event, element)`` coming from :py:func:`xml.etree.ElementTree.iterparse` with the argument ``events=["start", "end"]`` :raise: :py:class:`DeserializationException` if unexpected input :return: parsed instance """ return _read_named_element( element, iterator, "property", _read_property_as_sequence ) def _read_multi_language_property_as_sequence( element: Element, iterator: Iterator[Tuple[str, Element]] ) -> our_types.MultiLanguageProperty: """ Read an instance of :py:class:`.types.MultiLanguageProperty` as a sequence of XML-encoded properties. The end element corresponding to the :paramref:`element` will be read as well. :param element: start element, parent of the sequence :param iterator: Input stream of ``(event, element)`` coming from :py:func:`xml.etree.ElementTree.iterparse` with the argument ``events=["start", "end"]`` :raise: :py:class:`DeserializationException` if unexpected input :return: parsed instance """ values = _read_properties(element, iterator, _READERS_FOR_MULTI_LANGUAGE_PROPERTY) the_extensions: Optional[List[our_types.Extension]] = values.get("extensions") the_category: Optional[str] = values.get("category") the_id_short: Optional[str] = values.get("idShort") the_display_name: Optional[List[our_types.LangStringNameType]] = values.get( "displayName" ) the_description: Optional[List[our_types.LangStringTextType]] = values.get( "description" ) the_semantic_id: Optional[our_types.Reference] = values.get("semanticId") the_supplemental_semantic_ids: Optional[List[our_types.Reference]] = values.get( "supplementalSemanticIds" ) the_qualifiers: Optional[List[our_types.Qualifier]] = values.get("qualifiers") the_embedded_data_specifications: Optional[ List[our_types.EmbeddedDataSpecification] ] = values.get("embeddedDataSpecifications") the_value: Optional[List[our_types.LangStringTextType]] = values.get("value") the_value_id: Optional[our_types.Reference] = values.get("valueId") return our_types.MultiLanguageProperty( the_extensions, the_category, the_id_short, the_display_name, the_description, the_semantic_id, the_supplemental_semantic_ids, the_qualifiers, the_embedded_data_specifications, the_value, the_value_id, ) def _read_multi_language_property_as_element( element: Element, iterator: Iterator[Tuple[str, Element]] ) -> our_types.MultiLanguageProperty: """ Read an instance of :py:class:`.types.MultiLanguageProperty` from :paramref:`iterator`, including the end element. :param element: start element :param iterator: Input stream of ``(event, element)`` coming from :py:func:`xml.etree.ElementTree.iterparse` with the argument ``events=["start", "end"]`` :raise: :py:class:`DeserializationException` if unexpected input :return: parsed instance """ return _read_named_element( element, iterator, "multiLanguageProperty", _read_multi_language_property_as_sequence, ) def _read_range_as_sequence( element: Element, iterator: Iterator[Tuple[str, Element]] ) -> our_types.Range: """ Read an instance of :py:class:`.types.Range` as a sequence of XML-encoded properties. The end element corresponding to the :paramref:`element` will be read as well. :param element: start element, parent of the sequence :param iterator: Input stream of ``(event, element)`` coming from :py:func:`xml.etree.ElementTree.iterparse` with the argument ``events=["start", "end"]`` :raise: :py:class:`DeserializationException` if unexpected input :return: parsed instance """ values = _read_properties(element, iterator, _READERS_FOR_RANGE) the_extensions: Optional[List[our_types.Extension]] = values.get("extensions") the_category: Optional[str] = values.get("category") the_id_short: Optional[str] = values.get("idShort") the_display_name: Optional[List[our_types.LangStringNameType]] = values.get( "displayName" ) the_description: Optional[List[our_types.LangStringTextType]] = values.get( "description" ) the_semantic_id: Optional[our_types.Reference] = values.get("semanticId") the_supplemental_semantic_ids: Optional[List[our_types.Reference]] = values.get( "supplementalSemanticIds" ) the_qualifiers: Optional[List[our_types.Qualifier]] = values.get("qualifiers") the_embedded_data_specifications: Optional[ List[our_types.EmbeddedDataSpecification] ] = values.get("embeddedDataSpecifications") the_value_type: Optional[our_types.DataTypeDefXSD] = values.get("valueType") the_min: Optional[str] = values.get("min") the_max: Optional[str] = values.get("max") if the_value_type is None: raise DeserializationException("The required property 'valueType' is missing") return our_types.Range( the_value_type, the_extensions, the_category, the_id_short, the_display_name, the_description, the_semantic_id, the_supplemental_semantic_ids, the_qualifiers, the_embedded_data_specifications, the_min, the_max, ) def _read_range_as_element( element: Element, iterator: Iterator[Tuple[str, Element]] ) -> our_types.Range: """ Read an instance of :py:class:`.types.Range` from :paramref:`iterator`, including the end element. :param element: start element :param iterator: Input stream of ``(event, element)`` coming from :py:func:`xml.etree.ElementTree.iterparse` with the argument ``events=["start", "end"]`` :raise: :py:class:`DeserializationException` if unexpected input :return: parsed instance """ return _read_named_element(element, iterator, "range", _read_range_as_sequence) def _read_reference_element_as_sequence( element: Element, iterator: Iterator[Tuple[str, Element]] ) -> our_types.ReferenceElement: """ Read an instance of :py:class:`.types.ReferenceElement` as a sequence of XML-encoded properties. The end element corresponding to the :paramref:`element` will be read as well. :param element: start element, parent of the sequence :param iterator: Input stream of ``(event, element)`` coming from :py:func:`xml.etree.ElementTree.iterparse` with the argument ``events=["start", "end"]`` :raise: :py:class:`DeserializationException` if unexpected input :return: parsed instance """ values = _read_properties(element, iterator, _READERS_FOR_REFERENCE_ELEMENT) the_extensions: Optional[List[our_types.Extension]] = values.get("extensions") the_category: Optional[str] = values.get("category") the_id_short: Optional[str] = values.get("idShort") the_display_name: Optional[List[our_types.LangStringNameType]] = values.get( "displayName" ) the_description: Optional[List[our_types.LangStringTextType]] = values.get( "description" ) the_semantic_id: Optional[our_types.Reference] = values.get("semanticId") the_supplemental_semantic_ids: Optional[List[our_types.Reference]] = values.get( "supplementalSemanticIds" ) the_qualifiers: Optional[List[our_types.Qualifier]] = values.get("qualifiers") the_embedded_data_specifications: Optional[ List[our_types.EmbeddedDataSpecification] ] = values.get("embeddedDataSpecifications") the_value: Optional[our_types.Reference] = values.get("value") return our_types.ReferenceElement( the_extensions, the_category, the_id_short, the_display_name, the_description, the_semantic_id, the_supplemental_semantic_ids, the_qualifiers, the_embedded_data_specifications, the_value, ) def _read_reference_element_as_element( element: Element, iterator: Iterator[Tuple[str, Element]] ) -> our_types.ReferenceElement: """ Read an instance of :py:class:`.types.ReferenceElement` from :paramref:`iterator`, including the end element. :param element: start element :param iterator: Input stream of ``(event, element)`` coming from :py:func:`xml.etree.ElementTree.iterparse` with the argument ``events=["start", "end"]`` :raise: :py:class:`DeserializationException` if unexpected input :return: parsed instance """ return _read_named_element( element, iterator, "referenceElement", _read_reference_element_as_sequence ) def _read_blob_as_sequence( element: Element, iterator: Iterator[Tuple[str, Element]] ) -> our_types.Blob: """ Read an instance of :py:class:`.types.Blob` as a sequence of XML-encoded properties. The end element corresponding to the :paramref:`element` will be read as well. :param element: start element, parent of the sequence :param iterator: Input stream of ``(event, element)`` coming from :py:func:`xml.etree.ElementTree.iterparse` with the argument ``events=["start", "end"]`` :raise: :py:class:`DeserializationException` if unexpected input :return: parsed instance """ values = _read_properties(element, iterator, _READERS_FOR_BLOB) the_extensions: Optional[List[our_types.Extension]] = values.get("extensions") the_category: Optional[str] = values.get("category") the_id_short: Optional[str] = values.get("idShort") the_display_name: Optional[List[our_types.LangStringNameType]] = values.get( "displayName" ) the_description: Optional[List[our_types.LangStringTextType]] = values.get( "description" ) the_semantic_id: Optional[our_types.Reference] = values.get("semanticId") the_supplemental_semantic_ids: Optional[List[our_types.Reference]] = values.get( "supplementalSemanticIds" ) the_qualifiers: Optional[List[our_types.Qualifier]] = values.get("qualifiers") the_embedded_data_specifications: Optional[ List[our_types.EmbeddedDataSpecification] ] = values.get("embeddedDataSpecifications") the_value: Optional[bytes] = values.get("value") the_content_type: Optional[str] = values.get("contentType") return our_types.Blob( the_extensions, the_category, the_id_short, the_display_name, the_description, the_semantic_id, the_supplemental_semantic_ids, the_qualifiers, the_embedded_data_specifications, the_value, the_content_type, ) def _read_blob_as_element( element: Element, iterator: Iterator[Tuple[str, Element]] ) -> our_types.Blob: """ Read an instance of :py:class:`.types.Blob` from :paramref:`iterator`, including the end element. :param element: start element :param iterator: Input stream of ``(event, element)`` coming from :py:func:`xml.etree.ElementTree.iterparse` with the argument ``events=["start", "end"]`` :raise: :py:class:`DeserializationException` if unexpected input :return: parsed instance """ return _read_named_element(element, iterator, "blob", _read_blob_as_sequence) def _read_file_as_sequence( element: Element, iterator: Iterator[Tuple[str, Element]] ) -> our_types.File: """ Read an instance of :py:class:`.types.File` as a sequence of XML-encoded properties. The end element corresponding to the :paramref:`element` will be read as well. :param element: start element, parent of the sequence :param iterator: Input stream of ``(event, element)`` coming from :py:func:`xml.etree.ElementTree.iterparse` with the argument ``events=["start", "end"]`` :raise: :py:class:`DeserializationException` if unexpected input :return: parsed instance """ values = _read_properties(element, iterator, _READERS_FOR_FILE) the_extensions: Optional[List[our_types.Extension]] = values.get("extensions") the_category: Optional[str] = values.get("category") the_id_short: Optional[str] = values.get("idShort") the_display_name: Optional[List[our_types.LangStringNameType]] = values.get( "displayName" ) the_description: Optional[List[our_types.LangStringTextType]] = values.get( "description" ) the_semantic_id: Optional[our_types.Reference] = values.get("semanticId") the_supplemental_semantic_ids: Optional[List[our_types.Reference]] = values.get( "supplementalSemanticIds" ) the_qualifiers: Optional[List[our_types.Qualifier]] = values.get("qualifiers") the_embedded_data_specifications: Optional[ List[our_types.EmbeddedDataSpecification] ] = values.get("embeddedDataSpecifications") the_value: Optional[str] = values.get("value") the_content_type: Optional[str] = values.get("contentType") return our_types.File( the_extensions, the_category, the_id_short, the_display_name, the_description, the_semantic_id, the_supplemental_semantic_ids, the_qualifiers, the_embedded_data_specifications, the_value, the_content_type, ) def _read_file_as_element( element: Element, iterator: Iterator[Tuple[str, Element]] ) -> our_types.File: """ Read an instance of :py:class:`.types.File` from :paramref:`iterator`, including the end element. :param element: start element :param iterator: Input stream of ``(event, element)`` coming from :py:func:`xml.etree.ElementTree.iterparse` with the argument ``events=["start", "end"]`` :raise: :py:class:`DeserializationException` if unexpected input :return: parsed instance """ return _read_named_element(element, iterator, "file", _read_file_as_sequence) def _read_annotated_relationship_element_as_sequence( element: Element, iterator: Iterator[Tuple[str, Element]] ) -> our_types.AnnotatedRelationshipElement: """ Read an instance of :py:class:`.types.AnnotatedRelationshipElement` as a sequence of XML-encoded properties. The end element corresponding to the :paramref:`element` will be read as well. :param element: start element, parent of the sequence :param iterator: Input stream of ``(event, element)`` coming from :py:func:`xml.etree.ElementTree.iterparse` with the argument ``events=["start", "end"]`` :raise: :py:class:`DeserializationException` if unexpected input :return: parsed instance """ values = _read_properties( element, iterator, _READERS_FOR_ANNOTATED_RELATIONSHIP_ELEMENT ) the_extensions: Optional[List[our_types.Extension]] = values.get("extensions") the_category: Optional[str] = values.get("category") the_id_short: Optional[str] = values.get("idShort") the_display_name: Optional[List[our_types.LangStringNameType]] = values.get( "displayName" ) the_description: Optional[List[our_types.LangStringTextType]] = values.get( "description" ) the_semantic_id: Optional[our_types.Reference] = values.get("semanticId") the_supplemental_semantic_ids: Optional[List[our_types.Reference]] = values.get( "supplementalSemanticIds" ) the_qualifiers: Optional[List[our_types.Qualifier]] = values.get("qualifiers") the_embedded_data_specifications: Optional[ List[our_types.EmbeddedDataSpecification] ] = values.get("embeddedDataSpecifications") the_first: Optional[our_types.Reference] = values.get("first") the_second: Optional[our_types.Reference] = values.get("second") the_annotations: Optional[List[our_types.DataElement]] = values.get("annotations") return our_types.AnnotatedRelationshipElement( the_extensions, the_category, the_id_short, the_display_name, the_description, the_semantic_id, the_supplemental_semantic_ids, the_qualifiers, the_embedded_data_specifications, the_first, the_second, the_annotations, ) def _read_annotated_relationship_element_as_element( element: Element, iterator: Iterator[Tuple[str, Element]] ) -> our_types.AnnotatedRelationshipElement: """ Read an instance of :py:class:`.types.AnnotatedRelationshipElement` from :paramref:`iterator`, including the end element. :param element: start element :param iterator: Input stream of ``(event, element)`` coming from :py:func:`xml.etree.ElementTree.iterparse` with the argument ``events=["start", "end"]`` :raise: :py:class:`DeserializationException` if unexpected input :return: parsed instance """ return _read_named_element( element, iterator, "annotatedRelationshipElement", _read_annotated_relationship_element_as_sequence, ) def _read_entity_as_sequence( element: Element, iterator: Iterator[Tuple[str, Element]] ) -> our_types.Entity: """ Read an instance of :py:class:`.types.Entity` as a sequence of XML-encoded properties. The end element corresponding to the :paramref:`element` will be read as well. :param element: start element, parent of the sequence :param iterator: Input stream of ``(event, element)`` coming from :py:func:`xml.etree.ElementTree.iterparse` with the argument ``events=["start", "end"]`` :raise: :py:class:`DeserializationException` if unexpected input :return: parsed instance """ values = _read_properties(element, iterator, _READERS_FOR_ENTITY) the_extensions: Optional[List[our_types.Extension]] = values.get("extensions") the_category: Optional[str] = values.get("category") the_id_short: Optional[str] = values.get("idShort") the_display_name: Optional[List[our_types.LangStringNameType]] = values.get( "displayName" ) the_description: Optional[List[our_types.LangStringTextType]] = values.get( "description" ) the_semantic_id: Optional[our_types.Reference] = values.get("semanticId") the_supplemental_semantic_ids: Optional[List[our_types.Reference]] = values.get( "supplementalSemanticIds" ) the_qualifiers: Optional[List[our_types.Qualifier]] = values.get("qualifiers") the_embedded_data_specifications: Optional[ List[our_types.EmbeddedDataSpecification] ] = values.get("embeddedDataSpecifications") the_statements: Optional[List[our_types.SubmodelElement]] = values.get("statements") the_entity_type: Optional[our_types.EntityType] = values.get("entityType") the_global_asset_id: Optional[str] = values.get("globalAssetId") the_specific_asset_ids: Optional[List[our_types.SpecificAssetID]] = values.get( "specificAssetIds" ) return our_types.Entity( the_extensions, the_category, the_id_short, the_display_name, the_description, the_semantic_id, the_supplemental_semantic_ids, the_qualifiers, the_embedded_data_specifications, the_statements, the_entity_type, the_global_asset_id, the_specific_asset_ids, ) def _read_entity_as_element( element: Element, iterator: Iterator[Tuple[str, Element]] ) -> our_types.Entity: """ Read an instance of :py:class:`.types.Entity` from :paramref:`iterator`, including the end element. :param element: start element :param iterator: Input stream of ``(event, element)`` coming from :py:func:`xml.etree.ElementTree.iterparse` with the argument ``events=["start", "end"]`` :raise: :py:class:`DeserializationException` if unexpected input :return: parsed instance """ return _read_named_element(element, iterator, "entity", _read_entity_as_sequence) def _read_entity_type_from_element_text( element: Element, iterator: Iterator[Tuple[str, Element]] ) -> our_types.EntityType: """ Parse the text of :paramref:`element` as a literal of :py:class:`.types.EntityType`, and read the corresponding end element from :paramref:`iterator`. :param element: start element :param iterator: Input stream of ``(event, element)`` coming from :py:func:`xml.etree.ElementTree.iterparse` with the argument ``events=["start", "end"]`` :raise: :py:class:`DeserializationException` if unexpected input :return: parsed value """ return _read_enum_from_element_text( element, iterator, our_stringification.entity_type_from_str, "EntityType" ) def _read_direction_from_element_text( element: Element, iterator: Iterator[Tuple[str, Element]] ) -> our_types.Direction: """ Parse the text of :paramref:`element` as a literal of :py:class:`.types.Direction`, and read the corresponding end element from :paramref:`iterator`. :param element: start element :param iterator: Input stream of ``(event, element)`` coming from :py:func:`xml.etree.ElementTree.iterparse` with the argument ``events=["start", "end"]`` :raise: :py:class:`DeserializationException` if unexpected input :return: parsed value """ return _read_enum_from_element_text( element, iterator, our_stringification.direction_from_str, "Direction" ) def _read_state_of_event_from_element_text( element: Element, iterator: Iterator[Tuple[str, Element]] ) -> our_types.StateOfEvent: """ Parse the text of :paramref:`element` as a literal of :py:class:`.types.StateOfEvent`, and read the corresponding end element from :paramref:`iterator`. :param element: start element :param iterator: Input stream of ``(event, element)`` coming from :py:func:`xml.etree.ElementTree.iterparse` with the argument ``events=["start", "end"]`` :raise: :py:class:`DeserializationException` if unexpected input :return: parsed value """ return _read_enum_from_element_text( element, iterator, our_stringification.state_of_event_from_str, "StateOfEvent" ) def _read_event_payload_as_sequence( element: Element, iterator: Iterator[Tuple[str, Element]] ) -> our_types.EventPayload: """ Read an instance of :py:class:`.types.EventPayload` as a sequence of XML-encoded properties. The end element corresponding to the :paramref:`element` will be read as well. :param element: start element, parent of the sequence :param iterator: Input stream of ``(event, element)`` coming from :py:func:`xml.etree.ElementTree.iterparse` with the argument ``events=["start", "end"]`` :raise: :py:class:`DeserializationException` if unexpected input :return: parsed instance """ values = _read_properties(element, iterator, _READERS_FOR_EVENT_PAYLOAD) the_source: Optional[our_types.Reference] = values.get("source") the_source_semantic_id: Optional[our_types.Reference] = values.get( "sourceSemanticId" ) the_observable_reference: Optional[our_types.Reference] = values.get( "observableReference" ) the_observable_semantic_id: Optional[our_types.Reference] = values.get( "observableSemanticId" ) the_topic: Optional[str] = values.get("topic") the_subject_id: Optional[our_types.Reference] = values.get("subjectId") the_time_stamp: Optional[str] = values.get("timeStamp") the_payload: Optional[bytes] = values.get("payload") if the_source is None: raise DeserializationException("The required property 'source' is missing") if the_observable_reference is None: raise DeserializationException( "The required property 'observableReference' is missing" ) if the_time_stamp is None: raise DeserializationException("The required property 'timeStamp' is missing") return our_types.EventPayload( the_source, the_observable_reference, the_time_stamp, the_source_semantic_id, the_observable_semantic_id, the_topic, the_subject_id, the_payload, ) def _read_event_payload_as_element( element: Element, iterator: Iterator[Tuple[str, Element]] ) -> our_types.EventPayload: """ Read an instance of :py:class:`.types.EventPayload` from :paramref:`iterator`, including the end element. :param element: start element :param iterator: Input stream of ``(event, element)`` coming from :py:func:`xml.etree.ElementTree.iterparse` with the argument ``events=["start", "end"]`` :raise: :py:class:`DeserializationException` if unexpected input :return: parsed instance """ return _read_named_element( element, iterator, "eventPayload", _read_event_payload_as_sequence ) def _read_event_element_as_element( element: Element, iterator: Iterator[Tuple[str, Element]] ) -> our_types.EventElement: """ Read an instance of :py:class:`.types.EventElement` from :paramref:`iterator`, including the end element. :param element: start element :param iterator: Input stream of ``(event, element)`` coming from :py:func:`xml.etree.ElementTree.iterparse` with the argument ``events=["start", "end"]`` :raise: :py:class:`DeserializationException` if unexpected input :return: parsed instance """ return _read_dispatched( element, iterator, _DISPATCH_FOR_EVENT_ELEMENT, "a concrete instance of 'EventElement'", ) def _read_basic_event_element_as_sequence( element: Element, iterator: Iterator[Tuple[str, Element]] ) -> our_types.BasicEventElement: """ Read an instance of :py:class:`.types.BasicEventElement` as a sequence of XML-encoded properties. The end element corresponding to the :paramref:`element` will be read as well. :param element: start element, parent of the sequence :param iterator: Input stream of ``(event, element)`` coming from :py:func:`xml.etree.ElementTree.iterparse` with the argument ``events=["start", "end"]`` :raise: :py:class:`DeserializationException` if unexpected input :return: parsed instance """ values = _read_properties(element, iterator, _READERS_FOR_BASIC_EVENT_ELEMENT) the_extensions: Optional[List[our_types.Extension]] = values.get("extensions") the_category: Optional[str] = values.get("category") the_id_short: Optional[str] = values.get("idShort") the_display_name: Optional[List[our_types.LangStringNameType]] = values.get( "displayName" ) the_description: Optional[List[our_types.LangStringTextType]] = values.get( "description" ) the_semantic_id: Optional[our_types.Reference] = values.get("semanticId") the_supplemental_semantic_ids: Optional[List[our_types.Reference]] = values.get( "supplementalSemanticIds" ) the_qualifiers: Optional[List[our_types.Qualifier]] = values.get("qualifiers") the_embedded_data_specifications: Optional[ List[our_types.EmbeddedDataSpecification] ] = values.get("embeddedDataSpecifications") the_observed: Optional[our_types.Reference] = values.get("observed") the_direction: Optional[our_types.Direction] = values.get("direction") the_state: Optional[our_types.StateOfEvent] = values.get("state") the_message_topic: Optional[str] = values.get("messageTopic") the_message_broker: Optional[our_types.Reference] = values.get("messageBroker") the_last_update: Optional[str] = values.get("lastUpdate") the_min_interval: Optional[str] = values.get("minInterval") the_max_interval: Optional[str] = values.get("maxInterval") if the_observed is None: raise DeserializationException("The required property 'observed' is missing") if the_direction is None: raise DeserializationException("The required property 'direction' is missing") if the_state is None: raise DeserializationException("The required property 'state' is missing") return our_types.BasicEventElement( the_observed, the_direction, the_state, the_extensions, the_category, the_id_short, the_display_name, the_description, the_semantic_id, the_supplemental_semantic_ids, the_qualifiers, the_embedded_data_specifications, the_message_topic, the_message_broker, the_last_update, the_min_interval, the_max_interval, ) def _read_basic_event_element_as_element( element: Element, iterator: Iterator[Tuple[str, Element]] ) -> our_types.BasicEventElement: """ Read an instance of :py:class:`.types.BasicEventElement` from :paramref:`iterator`, including the end element. :param element: start element :param iterator: Input stream of ``(event, element)`` coming from :py:func:`xml.etree.ElementTree.iterparse` with the argument ``events=["start", "end"]`` :raise: :py:class:`DeserializationException` if unexpected input :return: parsed instance """ return _read_named_element( element, iterator, "basicEventElement", _read_basic_event_element_as_sequence ) def _read_operation_as_sequence( element: Element, iterator: Iterator[Tuple[str, Element]] ) -> our_types.Operation: """ Read an instance of :py:class:`.types.Operation` as a sequence of XML-encoded properties. The end element corresponding to the :paramref:`element` will be read as well. :param element: start element, parent of the sequence :param iterator: Input stream of ``(event, element)`` coming from :py:func:`xml.etree.ElementTree.iterparse` with the argument ``events=["start", "end"]`` :raise: :py:class:`DeserializationException` if unexpected input :return: parsed instance """ values = _read_properties(element, iterator, _READERS_FOR_OPERATION) the_extensions: Optional[List[our_types.Extension]] = values.get("extensions") the_category: Optional[str] = values.get("category") the_id_short: Optional[str] = values.get("idShort") the_display_name: Optional[List[our_types.LangStringNameType]] = values.get( "displayName" ) the_description: Optional[List[our_types.LangStringTextType]] = values.get( "description" ) the_semantic_id: Optional[our_types.Reference] = values.get("semanticId") the_supplemental_semantic_ids: Optional[List[our_types.Reference]] = values.get( "supplementalSemanticIds" ) the_qualifiers: Optional[List[our_types.Qualifier]] = values.get("qualifiers") the_embedded_data_specifications: Optional[ List[our_types.EmbeddedDataSpecification] ] = values.get("embeddedDataSpecifications") the_input_variables: Optional[List[our_types.OperationVariable]] = values.get( "inputVariables" ) the_output_variables: Optional[List[our_types.OperationVariable]] = values.get( "outputVariables" ) the_inoutput_variables: Optional[List[our_types.OperationVariable]] = values.get( "inoutputVariables" ) return our_types.Operation( the_extensions, the_category, the_id_short, the_display_name, the_description, the_semantic_id, the_supplemental_semantic_ids, the_qualifiers, the_embedded_data_specifications, the_input_variables, the_output_variables, the_inoutput_variables, ) def _read_operation_as_element( element: Element, iterator: Iterator[Tuple[str, Element]] ) -> our_types.Operation: """ Read an instance of :py:class:`.types.Operation` from :paramref:`iterator`, including the end element. :param element: start element :param iterator: Input stream of ``(event, element)`` coming from :py:func:`xml.etree.ElementTree.iterparse` with the argument ``events=["start", "end"]`` :raise: :py:class:`DeserializationException` if unexpected input :return: parsed instance """ return _read_named_element( element, iterator, "operation", _read_operation_as_sequence ) def _read_operation_variable_as_sequence( element: Element, iterator: Iterator[Tuple[str, Element]] ) -> our_types.OperationVariable: """ Read an instance of :py:class:`.types.OperationVariable` as a sequence of XML-encoded properties. The end element corresponding to the :paramref:`element` will be read as well. :param element: start element, parent of the sequence :param iterator: Input stream of ``(event, element)`` coming from :py:func:`xml.etree.ElementTree.iterparse` with the argument ``events=["start", "end"]`` :raise: :py:class:`DeserializationException` if unexpected input :return: parsed instance """ values = _read_properties(element, iterator, _READERS_FOR_OPERATION_VARIABLE) the_value: Optional[our_types.SubmodelElement] = values.get("value") if the_value is None: raise DeserializationException("The required property 'value' is missing") return our_types.OperationVariable(the_value) def _read_operation_variable_as_element( element: Element, iterator: Iterator[Tuple[str, Element]] ) -> our_types.OperationVariable: """ Read an instance of :py:class:`.types.OperationVariable` from :paramref:`iterator`, including the end element. :param element: start element :param iterator: Input stream of ``(event, element)`` coming from :py:func:`xml.etree.ElementTree.iterparse` with the argument ``events=["start", "end"]`` :raise: :py:class:`DeserializationException` if unexpected input :return: parsed instance """ return _read_named_element( element, iterator, "operationVariable", _read_operation_variable_as_sequence ) def _read_capability_as_sequence( element: Element, iterator: Iterator[Tuple[str, Element]] ) -> our_types.Capability: """ Read an instance of :py:class:`.types.Capability` as a sequence of XML-encoded properties. The end element corresponding to the :paramref:`element` will be read as well. :param element: start element, parent of the sequence :param iterator: Input stream of ``(event, element)`` coming from :py:func:`xml.etree.ElementTree.iterparse` with the argument ``events=["start", "end"]`` :raise: :py:class:`DeserializationException` if unexpected input :return: parsed instance """ values = _read_properties(element, iterator, _READERS_FOR_CAPABILITY) the_extensions: Optional[List[our_types.Extension]] = values.get("extensions") the_category: Optional[str] = values.get("category") the_id_short: Optional[str] = values.get("idShort") the_display_name: Optional[List[our_types.LangStringNameType]] = values.get( "displayName" ) the_description: Optional[List[our_types.LangStringTextType]] = values.get( "description" ) the_semantic_id: Optional[our_types.Reference] = values.get("semanticId") the_supplemental_semantic_ids: Optional[List[our_types.Reference]] = values.get( "supplementalSemanticIds" ) the_qualifiers: Optional[List[our_types.Qualifier]] = values.get("qualifiers") the_embedded_data_specifications: Optional[ List[our_types.EmbeddedDataSpecification] ] = values.get("embeddedDataSpecifications") return our_types.Capability( the_extensions, the_category, the_id_short, the_display_name, the_description, the_semantic_id, the_supplemental_semantic_ids, the_qualifiers, the_embedded_data_specifications, ) def _read_capability_as_element( element: Element, iterator: Iterator[Tuple[str, Element]] ) -> our_types.Capability: """ Read an instance of :py:class:`.types.Capability` from :paramref:`iterator`, including the end element. :param element: start element :param iterator: Input stream of ``(event, element)`` coming from :py:func:`xml.etree.ElementTree.iterparse` with the argument ``events=["start", "end"]`` :raise: :py:class:`DeserializationException` if unexpected input :return: parsed instance """ return _read_named_element( element, iterator, "capability", _read_capability_as_sequence ) def _read_concept_description_as_sequence( element: Element, iterator: Iterator[Tuple[str, Element]] ) -> our_types.ConceptDescription: """ Read an instance of :py:class:`.types.ConceptDescription` as a sequence of XML-encoded properties. The end element corresponding to the :paramref:`element` will be read as well. :param element: start element, parent of the sequence :param iterator: Input stream of ``(event, element)`` coming from :py:func:`xml.etree.ElementTree.iterparse` with the argument ``events=["start", "end"]`` :raise: :py:class:`DeserializationException` if unexpected input :return: parsed instance """ values = _read_properties(element, iterator, _READERS_FOR_CONCEPT_DESCRIPTION) the_extensions: Optional[List[our_types.Extension]] = values.get("extensions") the_category: Optional[str] = values.get("category") the_id_short: Optional[str] = values.get("idShort") the_display_name: Optional[List[our_types.LangStringNameType]] = values.get( "displayName" ) the_description: Optional[List[our_types.LangStringTextType]] = values.get( "description" ) the_administration: Optional[our_types.AdministrativeInformation] = values.get( "administration" ) the_id: Optional[str] = values.get("id") the_embedded_data_specifications: Optional[ List[our_types.EmbeddedDataSpecification] ] = values.get("embeddedDataSpecifications") the_is_case_of: Optional[List[our_types.Reference]] = values.get("isCaseOf") if the_id is None: raise DeserializationException("The required property 'id' is missing") return our_types.ConceptDescription( the_id, the_extensions, the_category, the_id_short, the_display_name, the_description, the_administration, the_embedded_data_specifications, the_is_case_of, ) def _read_concept_description_as_element( element: Element, iterator: Iterator[Tuple[str, Element]] ) -> our_types.ConceptDescription: """ Read an instance of :py:class:`.types.ConceptDescription` from :paramref:`iterator`, including the end element. :param element: start element :param iterator: Input stream of ``(event, element)`` coming from :py:func:`xml.etree.ElementTree.iterparse` with the argument ``events=["start", "end"]`` :raise: :py:class:`DeserializationException` if unexpected input :return: parsed instance """ return _read_named_element( element, iterator, "conceptDescription", _read_concept_description_as_sequence ) def _read_reference_types_from_element_text( element: Element, iterator: Iterator[Tuple[str, Element]] ) -> our_types.ReferenceTypes: """ Parse the text of :paramref:`element` as a literal of :py:class:`.types.ReferenceTypes`, and read the corresponding end element from :paramref:`iterator`. :param element: start element :param iterator: Input stream of ``(event, element)`` coming from :py:func:`xml.etree.ElementTree.iterparse` with the argument ``events=["start", "end"]`` :raise: :py:class:`DeserializationException` if unexpected input :return: parsed value """ return _read_enum_from_element_text( element, iterator, our_stringification.reference_types_from_str, "ReferenceTypes", ) def _read_reference_as_sequence( element: Element, iterator: Iterator[Tuple[str, Element]] ) -> our_types.Reference: """ Read an instance of :py:class:`.types.Reference` as a sequence of XML-encoded properties. The end element corresponding to the :paramref:`element` will be read as well. :param element: start element, parent of the sequence :param iterator: Input stream of ``(event, element)`` coming from :py:func:`xml.etree.ElementTree.iterparse` with the argument ``events=["start", "end"]`` :raise: :py:class:`DeserializationException` if unexpected input :return: parsed instance """ values = _read_properties(element, iterator, _READERS_FOR_REFERENCE) the_type: Optional[our_types.ReferenceTypes] = values.get("type") the_referred_semantic_id: Optional[our_types.Reference] = values.get( "referredSemanticId" ) the_keys: Optional[List[our_types.Key]] = values.get("keys") if the_type is None: raise DeserializationException("The required property 'type' is missing") if the_keys is None: raise DeserializationException("The required property 'keys' is missing") return our_types.Reference(the_type, the_keys, the_referred_semantic_id) def _read_reference_as_element( element: Element, iterator: Iterator[Tuple[str, Element]] ) -> our_types.Reference: """ Read an instance of :py:class:`.types.Reference` from :paramref:`iterator`, including the end element. :param element: start element :param iterator: Input stream of ``(event, element)`` coming from :py:func:`xml.etree.ElementTree.iterparse` with the argument ``events=["start", "end"]`` :raise: :py:class:`DeserializationException` if unexpected input :return: parsed instance """ return _read_named_element( element, iterator, "reference", _read_reference_as_sequence ) def _read_key_as_sequence( element: Element, iterator: Iterator[Tuple[str, Element]] ) -> our_types.Key: """ Read an instance of :py:class:`.types.Key` as a sequence of XML-encoded properties. The end element corresponding to the :paramref:`element` will be read as well. :param element: start element, parent of the sequence :param iterator: Input stream of ``(event, element)`` coming from :py:func:`xml.etree.ElementTree.iterparse` with the argument ``events=["start", "end"]`` :raise: :py:class:`DeserializationException` if unexpected input :return: parsed instance """ values = _read_properties(element, iterator, _READERS_FOR_KEY) the_type: Optional[our_types.KeyTypes] = values.get("type") the_value: Optional[str] = values.get("value") if the_type is None: raise DeserializationException("The required property 'type' is missing") if the_value is None: raise DeserializationException("The required property 'value' is missing") return our_types.Key(the_type, the_value) def _read_key_as_element( element: Element, iterator: Iterator[Tuple[str, Element]] ) -> our_types.Key: """ Read an instance of :py:class:`.types.Key` from :paramref:`iterator`, including the end element. :param element: start element :param iterator: Input stream of ``(event, element)`` coming from :py:func:`xml.etree.ElementTree.iterparse` with the argument ``events=["start", "end"]`` :raise: :py:class:`DeserializationException` if unexpected input :return: parsed instance """ return _read_named_element(element, iterator, "key", _read_key_as_sequence) def _read_key_types_from_element_text( element: Element, iterator: Iterator[Tuple[str, Element]] ) -> our_types.KeyTypes: """ Parse the text of :paramref:`element` as a literal of :py:class:`.types.KeyTypes`, and read the corresponding end element from :paramref:`iterator`. :param element: start element :param iterator: Input stream of ``(event, element)`` coming from :py:func:`xml.etree.ElementTree.iterparse` with the argument ``events=["start", "end"]`` :raise: :py:class:`DeserializationException` if unexpected input :return: parsed value """ return _read_enum_from_element_text( element, iterator, our_stringification.key_types_from_str, "KeyTypes" ) def _read_data_type_def_xsd_from_element_text( element: Element, iterator: Iterator[Tuple[str, Element]] ) -> our_types.DataTypeDefXSD: """ Parse the text of :paramref:`element` as a literal of :py:class:`.types.DataTypeDefXSD`, and read the corresponding end element from :paramref:`iterator`. :param element: start element :param iterator: Input stream of ``(event, element)`` coming from :py:func:`xml.etree.ElementTree.iterparse` with the argument ``events=["start", "end"]`` :raise: :py:class:`DeserializationException` if unexpected input :return: parsed value """ return _read_enum_from_element_text( element, iterator, our_stringification.data_type_def_xsd_from_str, "DataTypeDefXSD", ) def _read_abstract_lang_string_as_element( element: Element, iterator: Iterator[Tuple[str, Element]] ) -> our_types.AbstractLangString: """ Read an instance of :py:class:`.types.AbstractLangString` from :paramref:`iterator`, including the end element. :param element: start element :param iterator: Input stream of ``(event, element)`` coming from :py:func:`xml.etree.ElementTree.iterparse` with the argument ``events=["start", "end"]`` :raise: :py:class:`DeserializationException` if unexpected input :return: parsed instance """ return _read_dispatched( element, iterator, _DISPATCH_FOR_ABSTRACT_LANG_STRING, "a concrete instance of 'AbstractLangString'", ) def _read_lang_string_name_type_as_sequence( element: Element, iterator: Iterator[Tuple[str, Element]] ) -> our_types.LangStringNameType: """ Read an instance of :py:class:`.types.LangStringNameType` as a sequence of XML-encoded properties. The end element corresponding to the :paramref:`element` will be read as well. :param element: start element, parent of the sequence :param iterator: Input stream of ``(event, element)`` coming from :py:func:`xml.etree.ElementTree.iterparse` with the argument ``events=["start", "end"]`` :raise: :py:class:`DeserializationException` if unexpected input :return: parsed instance """ values = _read_properties(element, iterator, _READERS_FOR_LANG_STRING_NAME_TYPE) the_language: Optional[str] = values.get("language") the_text: Optional[str] = values.get("text") if the_language is None: raise DeserializationException("The required property 'language' is missing") if the_text is None: raise DeserializationException("The required property 'text' is missing") return our_types.LangStringNameType(the_language, the_text) def _read_lang_string_name_type_as_element( element: Element, iterator: Iterator[Tuple[str, Element]] ) -> our_types.LangStringNameType: """ Read an instance of :py:class:`.types.LangStringNameType` from :paramref:`iterator`, including the end element. :param element: start element :param iterator: Input stream of ``(event, element)`` coming from :py:func:`xml.etree.ElementTree.iterparse` with the argument ``events=["start", "end"]`` :raise: :py:class:`DeserializationException` if unexpected input :return: parsed instance """ return _read_named_element( element, iterator, "langStringNameType", _read_lang_string_name_type_as_sequence ) def _read_lang_string_text_type_as_sequence( element: Element, iterator: Iterator[Tuple[str, Element]] ) -> our_types.LangStringTextType: """ Read an instance of :py:class:`.types.LangStringTextType` as a sequence of XML-encoded properties. The end element corresponding to the :paramref:`element` will be read as well. :param element: start element, parent of the sequence :param iterator: Input stream of ``(event, element)`` coming from :py:func:`xml.etree.ElementTree.iterparse` with the argument ``events=["start", "end"]`` :raise: :py:class:`DeserializationException` if unexpected input :return: parsed instance """ values = _read_properties(element, iterator, _READERS_FOR_LANG_STRING_TEXT_TYPE) the_language: Optional[str] = values.get("language") the_text: Optional[str] = values.get("text") if the_language is None: raise DeserializationException("The required property 'language' is missing") if the_text is None: raise DeserializationException("The required property 'text' is missing") return our_types.LangStringTextType(the_language, the_text) def _read_lang_string_text_type_as_element( element: Element, iterator: Iterator[Tuple[str, Element]] ) -> our_types.LangStringTextType: """ Read an instance of :py:class:`.types.LangStringTextType` from :paramref:`iterator`, including the end element. :param element: start element :param iterator: Input stream of ``(event, element)`` coming from :py:func:`xml.etree.ElementTree.iterparse` with the argument ``events=["start", "end"]`` :raise: :py:class:`DeserializationException` if unexpected input :return: parsed instance """ return _read_named_element( element, iterator, "langStringTextType", _read_lang_string_text_type_as_sequence ) def _read_environment_as_sequence( element: Element, iterator: Iterator[Tuple[str, Element]] ) -> our_types.Environment: """ Read an instance of :py:class:`.types.Environment` as a sequence of XML-encoded properties. The end element corresponding to the :paramref:`element` will be read as well. :param element: start element, parent of the sequence :param iterator: Input stream of ``(event, element)`` coming from :py:func:`xml.etree.ElementTree.iterparse` with the argument ``events=["start", "end"]`` :raise: :py:class:`DeserializationException` if unexpected input :return: parsed instance """ values = _read_properties(element, iterator, _READERS_FOR_ENVIRONMENT) the_asset_administration_shells: Optional[ List[our_types.AssetAdministrationShell] ] = values.get("assetAdministrationShells") the_submodels: Optional[List[our_types.Submodel]] = values.get("submodels") the_concept_descriptions: Optional[List[our_types.ConceptDescription]] = values.get( "conceptDescriptions" ) return our_types.Environment( the_asset_administration_shells, the_submodels, the_concept_descriptions ) def _read_environment_as_element( element: Element, iterator: Iterator[Tuple[str, Element]] ) -> our_types.Environment: """ Read an instance of :py:class:`.types.Environment` from :paramref:`iterator`, including the end element. :param element: start element :param iterator: Input stream of ``(event, element)`` coming from :py:func:`xml.etree.ElementTree.iterparse` with the argument ``events=["start", "end"]`` :raise: :py:class:`DeserializationException` if unexpected input :return: parsed instance """ return _read_named_element( element, iterator, "environment", _read_environment_as_sequence ) def _read_data_specification_content_as_element( element: Element, iterator: Iterator[Tuple[str, Element]] ) -> our_types.DataSpecificationContent: """ Read an instance of :py:class:`.types.DataSpecificationContent` from :paramref:`iterator`, including the end element. :param element: start element :param iterator: Input stream of ``(event, element)`` coming from :py:func:`xml.etree.ElementTree.iterparse` with the argument ``events=["start", "end"]`` :raise: :py:class:`DeserializationException` if unexpected input :return: parsed instance """ return _read_dispatched( element, iterator, _DISPATCH_FOR_DATA_SPECIFICATION_CONTENT, "a concrete instance of 'DataSpecificationContent'", ) def _read_embedded_data_specification_as_sequence( element: Element, iterator: Iterator[Tuple[str, Element]] ) -> our_types.EmbeddedDataSpecification: """ Read an instance of :py:class:`.types.EmbeddedDataSpecification` as a sequence of XML-encoded properties. The end element corresponding to the :paramref:`element` will be read as well. :param element: start element, parent of the sequence :param iterator: Input stream of ``(event, element)`` coming from :py:func:`xml.etree.ElementTree.iterparse` with the argument ``events=["start", "end"]`` :raise: :py:class:`DeserializationException` if unexpected input :return: parsed instance """ values = _read_properties( element, iterator, _READERS_FOR_EMBEDDED_DATA_SPECIFICATION ) the_data_specification: Optional[our_types.Reference] = values.get( "dataSpecification" ) the_data_specification_content: Optional[our_types.DataSpecificationContent] = ( values.get("dataSpecificationContent") ) if the_data_specification is None: raise DeserializationException( "The required property 'dataSpecification' is missing" ) if the_data_specification_content is None: raise DeserializationException( "The required property 'dataSpecificationContent' is missing" ) return our_types.EmbeddedDataSpecification( the_data_specification, the_data_specification_content ) def _read_embedded_data_specification_as_element( element: Element, iterator: Iterator[Tuple[str, Element]] ) -> our_types.EmbeddedDataSpecification: """ Read an instance of :py:class:`.types.EmbeddedDataSpecification` from :paramref:`iterator`, including the end element. :param element: start element :param iterator: Input stream of ``(event, element)`` coming from :py:func:`xml.etree.ElementTree.iterparse` with the argument ``events=["start", "end"]`` :raise: :py:class:`DeserializationException` if unexpected input :return: parsed instance """ return _read_named_element( element, iterator, "embeddedDataSpecification", _read_embedded_data_specification_as_sequence, ) def _read_data_type_iec_61360_from_element_text( element: Element, iterator: Iterator[Tuple[str, Element]] ) -> our_types.DataTypeIEC61360: """ Parse the text of :paramref:`element` as a literal of :py:class:`.types.DataTypeIEC61360`, and read the corresponding end element from :paramref:`iterator`. :param element: start element :param iterator: Input stream of ``(event, element)`` coming from :py:func:`xml.etree.ElementTree.iterparse` with the argument ``events=["start", "end"]`` :raise: :py:class:`DeserializationException` if unexpected input :return: parsed value """ return _read_enum_from_element_text( element, iterator, our_stringification.data_type_iec_61360_from_str, "DataTypeIEC61360", ) def _read_level_type_as_sequence( element: Element, iterator: Iterator[Tuple[str, Element]] ) -> our_types.LevelType: """ Read an instance of :py:class:`.types.LevelType` as a sequence of XML-encoded properties. The end element corresponding to the :paramref:`element` will be read as well. :param element: start element, parent of the sequence :param iterator: Input stream of ``(event, element)`` coming from :py:func:`xml.etree.ElementTree.iterparse` with the argument ``events=["start", "end"]`` :raise: :py:class:`DeserializationException` if unexpected input :return: parsed instance """ values = _read_properties(element, iterator, _READERS_FOR_LEVEL_TYPE) the_min: Optional[bool] = values.get("min") the_nom: Optional[bool] = values.get("nom") the_typ: Optional[bool] = values.get("typ") the_max: Optional[bool] = values.get("max") if the_min is None: raise DeserializationException("The required property 'min' is missing") if the_nom is None: raise DeserializationException("The required property 'nom' is missing") if the_typ is None: raise DeserializationException("The required property 'typ' is missing") if the_max is None: raise DeserializationException("The required property 'max' is missing") return our_types.LevelType(the_min, the_nom, the_typ, the_max) def _read_level_type_as_element( element: Element, iterator: Iterator[Tuple[str, Element]] ) -> our_types.LevelType: """ Read an instance of :py:class:`.types.LevelType` from :paramref:`iterator`, including the end element. :param element: start element :param iterator: Input stream of ``(event, element)`` coming from :py:func:`xml.etree.ElementTree.iterparse` with the argument ``events=["start", "end"]`` :raise: :py:class:`DeserializationException` if unexpected input :return: parsed instance """ return _read_named_element( element, iterator, "levelType", _read_level_type_as_sequence ) def _read_value_reference_pair_as_sequence( element: Element, iterator: Iterator[Tuple[str, Element]] ) -> our_types.ValueReferencePair: """ Read an instance of :py:class:`.types.ValueReferencePair` as a sequence of XML-encoded properties. The end element corresponding to the :paramref:`element` will be read as well. :param element: start element, parent of the sequence :param iterator: Input stream of ``(event, element)`` coming from :py:func:`xml.etree.ElementTree.iterparse` with the argument ``events=["start", "end"]`` :raise: :py:class:`DeserializationException` if unexpected input :return: parsed instance """ values = _read_properties(element, iterator, _READERS_FOR_VALUE_REFERENCE_PAIR) the_value: Optional[str] = values.get("value") the_value_id: Optional[our_types.Reference] = values.get("valueId") if the_value is None: raise DeserializationException("The required property 'value' is missing") return our_types.ValueReferencePair(the_value, the_value_id) def _read_value_reference_pair_as_element( element: Element, iterator: Iterator[Tuple[str, Element]] ) -> our_types.ValueReferencePair: """ Read an instance of :py:class:`.types.ValueReferencePair` from :paramref:`iterator`, including the end element. :param element: start element :param iterator: Input stream of ``(event, element)`` coming from :py:func:`xml.etree.ElementTree.iterparse` with the argument ``events=["start", "end"]`` :raise: :py:class:`DeserializationException` if unexpected input :return: parsed instance """ return _read_named_element( element, iterator, "valueReferencePair", _read_value_reference_pair_as_sequence ) def _read_value_list_as_sequence( element: Element, iterator: Iterator[Tuple[str, Element]] ) -> our_types.ValueList: """ Read an instance of :py:class:`.types.ValueList` as a sequence of XML-encoded properties. The end element corresponding to the :paramref:`element` will be read as well. :param element: start element, parent of the sequence :param iterator: Input stream of ``(event, element)`` coming from :py:func:`xml.etree.ElementTree.iterparse` with the argument ``events=["start", "end"]`` :raise: :py:class:`DeserializationException` if unexpected input :return: parsed instance """ values = _read_properties(element, iterator, _READERS_FOR_VALUE_LIST) the_value_reference_pairs: Optional[List[our_types.ValueReferencePair]] = ( values.get("valueReferencePairs") ) if the_value_reference_pairs is None: raise DeserializationException( "The required property 'valueReferencePairs' is missing" ) return our_types.ValueList(the_value_reference_pairs) def _read_value_list_as_element( element: Element, iterator: Iterator[Tuple[str, Element]] ) -> our_types.ValueList: """ Read an instance of :py:class:`.types.ValueList` from :paramref:`iterator`, including the end element. :param element: start element :param iterator: Input stream of ``(event, element)`` coming from :py:func:`xml.etree.ElementTree.iterparse` with the argument ``events=["start", "end"]`` :raise: :py:class:`DeserializationException` if unexpected input :return: parsed instance """ return _read_named_element( element, iterator, "valueList", _read_value_list_as_sequence ) def _read_lang_string_preferred_name_type_iec_61360_as_sequence( element: Element, iterator: Iterator[Tuple[str, Element]] ) -> our_types.LangStringPreferredNameTypeIEC61360: """ Read an instance of :py:class:`.types.LangStringPreferredNameTypeIEC61360` as a sequence of XML-encoded properties. The end element corresponding to the :paramref:`element` will be read as well. :param element: start element, parent of the sequence :param iterator: Input stream of ``(event, element)`` coming from :py:func:`xml.etree.ElementTree.iterparse` with the argument ``events=["start", "end"]`` :raise: :py:class:`DeserializationException` if unexpected input :return: parsed instance """ values = _read_properties( element, iterator, _READERS_FOR_LANG_STRING_PREFERRED_NAME_TYPE_IEC_61360 ) the_language: Optional[str] = values.get("language") the_text: Optional[str] = values.get("text") if the_language is None: raise DeserializationException("The required property 'language' is missing") if the_text is None: raise DeserializationException("The required property 'text' is missing") return our_types.LangStringPreferredNameTypeIEC61360(the_language, the_text) def _read_lang_string_preferred_name_type_iec_61360_as_element( element: Element, iterator: Iterator[Tuple[str, Element]] ) -> our_types.LangStringPreferredNameTypeIEC61360: """ Read an instance of :py:class:`.types.LangStringPreferredNameTypeIEC61360` from :paramref:`iterator`, including the end element. :param element: start element :param iterator: Input stream of ``(event, element)`` coming from :py:func:`xml.etree.ElementTree.iterparse` with the argument ``events=["start", "end"]`` :raise: :py:class:`DeserializationException` if unexpected input :return: parsed instance """ return _read_named_element( element, iterator, "langStringPreferredNameTypeIec61360", _read_lang_string_preferred_name_type_iec_61360_as_sequence, ) def _read_lang_string_short_name_type_iec_61360_as_sequence( element: Element, iterator: Iterator[Tuple[str, Element]] ) -> our_types.LangStringShortNameTypeIEC61360: """ Read an instance of :py:class:`.types.LangStringShortNameTypeIEC61360` as a sequence of XML-encoded properties. The end element corresponding to the :paramref:`element` will be read as well. :param element: start element, parent of the sequence :param iterator: Input stream of ``(event, element)`` coming from :py:func:`xml.etree.ElementTree.iterparse` with the argument ``events=["start", "end"]`` :raise: :py:class:`DeserializationException` if unexpected input :return: parsed instance """ values = _read_properties( element, iterator, _READERS_FOR_LANG_STRING_SHORT_NAME_TYPE_IEC_61360 ) the_language: Optional[str] = values.get("language") the_text: Optional[str] = values.get("text") if the_language is None: raise DeserializationException("The required property 'language' is missing") if the_text is None: raise DeserializationException("The required property 'text' is missing") return our_types.LangStringShortNameTypeIEC61360(the_language, the_text) def _read_lang_string_short_name_type_iec_61360_as_element( element: Element, iterator: Iterator[Tuple[str, Element]] ) -> our_types.LangStringShortNameTypeIEC61360: """ Read an instance of :py:class:`.types.LangStringShortNameTypeIEC61360` from :paramref:`iterator`, including the end element. :param element: start element :param iterator: Input stream of ``(event, element)`` coming from :py:func:`xml.etree.ElementTree.iterparse` with the argument ``events=["start", "end"]`` :raise: :py:class:`DeserializationException` if unexpected input :return: parsed instance """ return _read_named_element( element, iterator, "langStringShortNameTypeIec61360", _read_lang_string_short_name_type_iec_61360_as_sequence, ) def _read_lang_string_definition_type_iec_61360_as_sequence( element: Element, iterator: Iterator[Tuple[str, Element]] ) -> our_types.LangStringDefinitionTypeIEC61360: """ Read an instance of :py:class:`.types.LangStringDefinitionTypeIEC61360` as a sequence of XML-encoded properties. The end element corresponding to the :paramref:`element` will be read as well. :param element: start element, parent of the sequence :param iterator: Input stream of ``(event, element)`` coming from :py:func:`xml.etree.ElementTree.iterparse` with the argument ``events=["start", "end"]`` :raise: :py:class:`DeserializationException` if unexpected input :return: parsed instance """ values = _read_properties( element, iterator, _READERS_FOR_LANG_STRING_DEFINITION_TYPE_IEC_61360 ) the_language: Optional[str] = values.get("language") the_text: Optional[str] = values.get("text") if the_language is None: raise DeserializationException("The required property 'language' is missing") if the_text is None: raise DeserializationException("The required property 'text' is missing") return our_types.LangStringDefinitionTypeIEC61360(the_language, the_text) def _read_lang_string_definition_type_iec_61360_as_element( element: Element, iterator: Iterator[Tuple[str, Element]] ) -> our_types.LangStringDefinitionTypeIEC61360: """ Read an instance of :py:class:`.types.LangStringDefinitionTypeIEC61360` from :paramref:`iterator`, including the end element. :param element: start element :param iterator: Input stream of ``(event, element)`` coming from :py:func:`xml.etree.ElementTree.iterparse` with the argument ``events=["start", "end"]`` :raise: :py:class:`DeserializationException` if unexpected input :return: parsed instance """ return _read_named_element( element, iterator, "langStringDefinitionTypeIec61360", _read_lang_string_definition_type_iec_61360_as_sequence, ) def _read_lang_string_uom_as_sequence( element: Element, iterator: Iterator[Tuple[str, Element]] ) -> our_types.LangStringUom: """ Read an instance of :py:class:`.types.LangStringUom` as a sequence of XML-encoded properties. The end element corresponding to the :paramref:`element` will be read as well. :param element: start element, parent of the sequence :param iterator: Input stream of ``(event, element)`` coming from :py:func:`xml.etree.ElementTree.iterparse` with the argument ``events=["start", "end"]`` :raise: :py:class:`DeserializationException` if unexpected input :return: parsed instance """ values = _read_properties(element, iterator, _READERS_FOR_LANG_STRING_UOM) the_language: Optional[str] = values.get("language") the_text: Optional[str] = values.get("text") if the_language is None: raise DeserializationException("The required property 'language' is missing") if the_text is None: raise DeserializationException("The required property 'text' is missing") return our_types.LangStringUom(the_language, the_text) def _read_lang_string_uom_as_element( element: Element, iterator: Iterator[Tuple[str, Element]] ) -> our_types.LangStringUom: """ Read an instance of :py:class:`.types.LangStringUom` from :paramref:`iterator`, including the end element. :param element: start element :param iterator: Input stream of ``(event, element)`` coming from :py:func:`xml.etree.ElementTree.iterparse` with the argument ``events=["start", "end"]`` :raise: :py:class:`DeserializationException` if unexpected input :return: parsed instance """ return _read_named_element( element, iterator, "langStringUom", _read_lang_string_uom_as_sequence ) def _read_definition_type_uom_as_sequence( element: Element, iterator: Iterator[Tuple[str, Element]] ) -> our_types.DefinitionTypeUom: """ Read an instance of :py:class:`.types.DefinitionTypeUom` as a sequence of XML-encoded properties. The end element corresponding to the :paramref:`element` will be read as well. :param element: start element, parent of the sequence :param iterator: Input stream of ``(event, element)`` coming from :py:func:`xml.etree.ElementTree.iterparse` with the argument ``events=["start", "end"]`` :raise: :py:class:`DeserializationException` if unexpected input :return: parsed instance """ values = _read_properties(element, iterator, _READERS_FOR_DEFINITION_TYPE_UOM) the_language: Optional[str] = values.get("language") the_text: Optional[str] = values.get("text") if the_language is None: raise DeserializationException("The required property 'language' is missing") if the_text is None: raise DeserializationException("The required property 'text' is missing") return our_types.DefinitionTypeUom(the_language, the_text) def _read_definition_type_uom_as_element( element: Element, iterator: Iterator[Tuple[str, Element]] ) -> our_types.DefinitionTypeUom: """ Read an instance of :py:class:`.types.DefinitionTypeUom` from :paramref:`iterator`, including the end element. :param element: start element :param iterator: Input stream of ``(event, element)`` coming from :py:func:`xml.etree.ElementTree.iterparse` with the argument ``events=["start", "end"]`` :raise: :py:class:`DeserializationException` if unexpected input :return: parsed instance """ return _read_named_element( element, iterator, "definitionTypeUom", _read_definition_type_uom_as_sequence ) def _read_data_specification_uom_as_sequence( element: Element, iterator: Iterator[Tuple[str, Element]] ) -> our_types.DataSpecificationUom: """ Read an instance of :py:class:`.types.DataSpecificationUom` as a sequence of XML-encoded properties. The end element corresponding to the :paramref:`element` will be read as well. :param element: start element, parent of the sequence :param iterator: Input stream of ``(event, element)`` coming from :py:func:`xml.etree.ElementTree.iterparse` with the argument ``events=["start", "end"]`` :raise: :py:class:`DeserializationException` if unexpected input :return: parsed instance """ values = _read_properties(element, iterator, _READERS_FOR_DATA_SPECIFICATION_UOM) the_preferred_name: Optional[List[our_types.LangStringUom]] = values.get( "preferredName" ) the_symbol: Optional[str] = values.get("symbol") the_specific_unit_id: Optional[str] = values.get("specificUnitId") the_definition: Optional[List[our_types.DefinitionTypeUom]] = values.get( "definition" ) the_preferred_name_quantity: Optional[List[our_types.LangStringUom]] = values.get( "preferredNameQuantity" ) the_quantity_id: Optional[str] = values.get("quantityId") the_classification_system: Optional[str] = values.get("classificationSystem") the_classification_system_version: Optional[str] = values.get( "classificationSystemVersion" ) if the_preferred_name is None: raise DeserializationException( "The required property 'preferredName' is missing" ) if the_symbol is None: raise DeserializationException("The required property 'symbol' is missing") return our_types.DataSpecificationUom( the_preferred_name, the_symbol, the_specific_unit_id, the_definition, the_preferred_name_quantity, the_quantity_id, the_classification_system, the_classification_system_version, ) def _read_data_specification_uom_as_element( element: Element, iterator: Iterator[Tuple[str, Element]] ) -> our_types.DataSpecificationUom: """ Read an instance of :py:class:`.types.DataSpecificationUom` from :paramref:`iterator`, including the end element. :param element: start element :param iterator: Input stream of ``(event, element)`` coming from :py:func:`xml.etree.ElementTree.iterparse` with the argument ``events=["start", "end"]`` :raise: :py:class:`DeserializationException` if unexpected input :return: parsed instance """ return _read_named_element( element, iterator, "dataSpecificationUom", _read_data_specification_uom_as_sequence, ) def _read_data_specification_iec_61360_as_sequence( element: Element, iterator: Iterator[Tuple[str, Element]] ) -> our_types.DataSpecificationIEC61360: """ Read an instance of :py:class:`.types.DataSpecificationIEC61360` as a sequence of XML-encoded properties. The end element corresponding to the :paramref:`element` will be read as well. :param element: start element, parent of the sequence :param iterator: Input stream of ``(event, element)`` coming from :py:func:`xml.etree.ElementTree.iterparse` with the argument ``events=["start", "end"]`` :raise: :py:class:`DeserializationException` if unexpected input :return: parsed instance """ values = _read_properties( element, iterator, _READERS_FOR_DATA_SPECIFICATION_IEC_61360 ) the_preferred_name: Optional[ List[our_types.LangStringPreferredNameTypeIEC61360] ] = values.get("preferredName") the_short_name: Optional[List[our_types.LangStringShortNameTypeIEC61360]] = ( values.get("shortName") ) the_unit: Optional[str] = values.get("unit") the_unit_id: Optional[our_types.Reference] = values.get("unitId") the_source_of_definition: Optional[str] = values.get("sourceOfDefinition") the_symbol: Optional[str] = values.get("symbol") the_data_type: Optional[our_types.DataTypeIEC61360] = values.get("dataType") the_definition: Optional[List[our_types.LangStringDefinitionTypeIEC61360]] = ( values.get("definition") ) the_value_format: Optional[str] = values.get("valueFormat") the_value_list: Optional[our_types.ValueList] = values.get("valueList") the_value: Optional[str] = values.get("value") the_level_type: Optional[our_types.LevelType] = values.get("levelType") if the_preferred_name is None: raise DeserializationException( "The required property 'preferredName' is missing" ) return our_types.DataSpecificationIEC61360( the_preferred_name, the_short_name, the_unit, the_unit_id, the_source_of_definition, the_symbol, the_data_type, the_definition, the_value_format, the_value_list, the_value, the_level_type, ) def _read_data_specification_iec_61360_as_element( element: Element, iterator: Iterator[Tuple[str, Element]] ) -> our_types.DataSpecificationIEC61360: """ Read an instance of :py:class:`.types.DataSpecificationIEC61360` from :paramref:`iterator`, including the end element. :param element: start element :param iterator: Input stream of ``(event, element)`` coming from :py:func:`xml.etree.ElementTree.iterparse` with the argument ``events=["start", "end"]`` :raise: :py:class:`DeserializationException` if unexpected input :return: parsed instance """ return _read_named_element( element, iterator, "dataSpecificationIec61360", _read_data_specification_iec_61360_as_sequence, ) def _read_descriptor_as_element( element: Element, iterator: Iterator[Tuple[str, Element]] ) -> our_types.Descriptor: """ Read an instance of :py:class:`.types.Descriptor` from :paramref:`iterator`, including the end element. :param element: start element :param iterator: Input stream of ``(event, element)`` coming from :py:func:`xml.etree.ElementTree.iterparse` with the argument ``events=["start", "end"]`` :raise: :py:class:`DeserializationException` if unexpected input :return: parsed instance """ return _read_dispatched( element, iterator, _DISPATCH_FOR_DESCRIPTOR, "a concrete instance of 'Descriptor'", ) def _read_asset_administration_shell_descriptor_as_sequence( element: Element, iterator: Iterator[Tuple[str, Element]] ) -> our_types.AssetAdministrationShellDescriptor: """ Read an instance of :py:class:`.types.AssetAdministrationShellDescriptor` as a sequence of XML-encoded properties. The end element corresponding to the :paramref:`element` will be read as well. :param element: start element, parent of the sequence :param iterator: Input stream of ``(event, element)`` coming from :py:func:`xml.etree.ElementTree.iterparse` with the argument ``events=["start", "end"]`` :raise: :py:class:`DeserializationException` if unexpected input :return: parsed instance """ values = _read_properties( element, iterator, _READERS_FOR_ASSET_ADMINISTRATION_SHELL_DESCRIPTOR ) the_description: Optional[List[our_types.LangStringTextType]] = values.get( "description" ) the_display_name: Optional[List[our_types.LangStringNameType]] = values.get( "displayName" ) the_extensions: Optional[List[our_types.Extension]] = values.get("extensions") the_id: Optional[str] = values.get("id") the_administration: Optional[our_types.AdministrativeInformation] = values.get( "administration" ) the_asset_kind: Optional[our_types.AssetKind] = values.get("assetKind") the_asset_type: Optional[str] = values.get("assetType") the_endpoints: Optional[List[our_types.Endpoint]] = values.get("endpoints") the_global_asset_id: Optional[str] = values.get("globalAssetId") the_id_short: Optional[str] = values.get("idShort") the_specific_asset_ids: Optional[List[our_types.SpecificAssetID]] = values.get( "specificAssetIds" ) the_submodel_descriptors: Optional[List[our_types.SubmodelDescriptor]] = values.get( "submodelDescriptors" ) if the_id is None: raise DeserializationException("The required property 'id' is missing") return our_types.AssetAdministrationShellDescriptor( the_id, the_description, the_display_name, the_extensions, the_administration, the_asset_kind, the_asset_type, the_endpoints, the_global_asset_id, the_id_short, the_specific_asset_ids, the_submodel_descriptors, ) def _read_asset_administration_shell_descriptor_as_element( element: Element, iterator: Iterator[Tuple[str, Element]] ) -> our_types.AssetAdministrationShellDescriptor: """ Read an instance of :py:class:`.types.AssetAdministrationShellDescriptor` from :paramref:`iterator`, including the end element. :param element: start element :param iterator: Input stream of ``(event, element)`` coming from :py:func:`xml.etree.ElementTree.iterparse` with the argument ``events=["start", "end"]`` :raise: :py:class:`DeserializationException` if unexpected input :return: parsed instance """ return _read_named_element( element, iterator, "assetAdministrationShellDescriptor", _read_asset_administration_shell_descriptor_as_sequence, ) def _read_submodel_descriptor_as_sequence( element: Element, iterator: Iterator[Tuple[str, Element]] ) -> our_types.SubmodelDescriptor: """ Read an instance of :py:class:`.types.SubmodelDescriptor` as a sequence of XML-encoded properties. The end element corresponding to the :paramref:`element` will be read as well. :param element: start element, parent of the sequence :param iterator: Input stream of ``(event, element)`` coming from :py:func:`xml.etree.ElementTree.iterparse` with the argument ``events=["start", "end"]`` :raise: :py:class:`DeserializationException` if unexpected input :return: parsed instance """ values = _read_properties(element, iterator, _READERS_FOR_SUBMODEL_DESCRIPTOR) the_description: Optional[List[our_types.LangStringTextType]] = values.get( "description" ) the_display_name: Optional[List[our_types.LangStringNameType]] = values.get( "displayName" ) the_extensions: Optional[List[our_types.Extension]] = values.get("extensions") the_endpoints: Optional[List[our_types.Endpoint]] = values.get("endpoints") the_id: Optional[str] = values.get("id") the_administration: Optional[our_types.AdministrativeInformation] = values.get( "administration" ) the_id_short: Optional[str] = values.get("idShort") the_semantic_id: Optional[our_types.Reference] = values.get("semanticId") the_supplemental_semantic_ids: Optional[List[our_types.Reference]] = values.get( "supplementalSemanticIds" ) if the_endpoints is None: raise DeserializationException("The required property 'endpoints' is missing") if the_id is None: raise DeserializationException("The required property 'id' is missing") return our_types.SubmodelDescriptor( the_endpoints, the_id, the_description, the_display_name, the_extensions, the_administration, the_id_short, the_semantic_id, the_supplemental_semantic_ids, ) def _read_submodel_descriptor_as_element( element: Element, iterator: Iterator[Tuple[str, Element]] ) -> our_types.SubmodelDescriptor: """ Read an instance of :py:class:`.types.SubmodelDescriptor` from :paramref:`iterator`, including the end element. :param element: start element :param iterator: Input stream of ``(event, element)`` coming from :py:func:`xml.etree.ElementTree.iterparse` with the argument ``events=["start", "end"]`` :raise: :py:class:`DeserializationException` if unexpected input :return: parsed instance """ return _read_named_element( element, iterator, "submodelDescriptor", _read_submodel_descriptor_as_sequence ) def _read_endpoint_as_sequence( element: Element, iterator: Iterator[Tuple[str, Element]] ) -> our_types.Endpoint: """ Read an instance of :py:class:`.types.Endpoint` as a sequence of XML-encoded properties. The end element corresponding to the :paramref:`element` will be read as well. :param element: start element, parent of the sequence :param iterator: Input stream of ``(event, element)`` coming from :py:func:`xml.etree.ElementTree.iterparse` with the argument ``events=["start", "end"]`` :raise: :py:class:`DeserializationException` if unexpected input :return: parsed instance """ values = _read_properties(element, iterator, _READERS_FOR_ENDPOINT) the_protocol_information: Optional[our_types.ProtocolInformation] = values.get( "protocolInformation" ) the_interface: Optional[str] = values.get("interface") if the_protocol_information is None: raise DeserializationException( "The required property 'protocolInformation' is missing" ) if the_interface is None: raise DeserializationException("The required property 'interface' is missing") return our_types.Endpoint(the_protocol_information, the_interface) def _read_endpoint_as_element( element: Element, iterator: Iterator[Tuple[str, Element]] ) -> our_types.Endpoint: """ Read an instance of :py:class:`.types.Endpoint` from :paramref:`iterator`, including the end element. :param element: start element :param iterator: Input stream of ``(event, element)`` coming from :py:func:`xml.etree.ElementTree.iterparse` with the argument ``events=["start", "end"]`` :raise: :py:class:`DeserializationException` if unexpected input :return: parsed instance """ return _read_named_element( element, iterator, "endpoint", _read_endpoint_as_sequence ) def _read_protocol_information_as_sequence( element: Element, iterator: Iterator[Tuple[str, Element]] ) -> our_types.ProtocolInformation: """ Read an instance of :py:class:`.types.ProtocolInformation` as a sequence of XML-encoded properties. The end element corresponding to the :paramref:`element` will be read as well. :param element: start element, parent of the sequence :param iterator: Input stream of ``(event, element)`` coming from :py:func:`xml.etree.ElementTree.iterparse` with the argument ``events=["start", "end"]`` :raise: :py:class:`DeserializationException` if unexpected input :return: parsed instance """ values = _read_properties(element, iterator, _READERS_FOR_PROTOCOL_INFORMATION) the_href: Optional[str] = values.get("href") the_endpoint_protocol: Optional[str] = values.get("endpointProtocol") the_endpoint_protocol_version: Optional[List[str]] = values.get( "endpointProtocolVersion" ) the_subprotocol: Optional[str] = values.get("subprotocol") the_subprotocol_body: Optional[str] = values.get("subprotocolBody") the_subprotocol_body_encoding: Optional[str] = values.get("subprotocolBodyEncoding") the_security_attributes: Optional[List[our_types.SecurityAttributeObject]] = ( values.get("securityAttributes") ) if the_href is None: raise DeserializationException("The required property 'href' is missing") return our_types.ProtocolInformation( the_href, the_endpoint_protocol, the_endpoint_protocol_version, the_subprotocol, the_subprotocol_body, the_subprotocol_body_encoding, the_security_attributes, ) def _read_protocol_information_as_element( element: Element, iterator: Iterator[Tuple[str, Element]] ) -> our_types.ProtocolInformation: """ Read an instance of :py:class:`.types.ProtocolInformation` from :paramref:`iterator`, including the end element. :param element: start element :param iterator: Input stream of ``(event, element)`` coming from :py:func:`xml.etree.ElementTree.iterparse` with the argument ``events=["start", "end"]`` :raise: :py:class:`DeserializationException` if unexpected input :return: parsed instance """ return _read_named_element( element, iterator, "protocolInformation", _read_protocol_information_as_sequence ) def _read_security_attribute_object_as_sequence( element: Element, iterator: Iterator[Tuple[str, Element]] ) -> our_types.SecurityAttributeObject: """ Read an instance of :py:class:`.types.SecurityAttributeObject` as a sequence of XML-encoded properties. The end element corresponding to the :paramref:`element` will be read as well. :param element: start element, parent of the sequence :param iterator: Input stream of ``(event, element)`` coming from :py:func:`xml.etree.ElementTree.iterparse` with the argument ``events=["start", "end"]`` :raise: :py:class:`DeserializationException` if unexpected input :return: parsed instance """ values = _read_properties(element, iterator, _READERS_FOR_SECURITY_ATTRIBUTE_OBJECT) the_type: Optional[our_types.SecurityTypeEnum] = values.get("type") the_key: Optional[str] = values.get("key") the_value: Optional[str] = values.get("value") if the_type is None: raise DeserializationException("The required property 'type' is missing") if the_key is None: raise DeserializationException("The required property 'key' is missing") if the_value is None: raise DeserializationException("The required property 'value' is missing") return our_types.SecurityAttributeObject(the_type, the_key, the_value) def _read_security_attribute_object_as_element( element: Element, iterator: Iterator[Tuple[str, Element]] ) -> our_types.SecurityAttributeObject: """ Read an instance of :py:class:`.types.SecurityAttributeObject` from :paramref:`iterator`, including the end element. :param element: start element :param iterator: Input stream of ``(event, element)`` coming from :py:func:`xml.etree.ElementTree.iterparse` with the argument ``events=["start", "end"]`` :raise: :py:class:`DeserializationException` if unexpected input :return: parsed instance """ return _read_named_element( element, iterator, "securityAttributeObject", _read_security_attribute_object_as_sequence, ) def _read_security_type_enum_from_element_text( element: Element, iterator: Iterator[Tuple[str, Element]] ) -> our_types.SecurityTypeEnum: """ Parse the text of :paramref:`element` as a literal of :py:class:`.types.SecurityTypeEnum`, and read the corresponding end element from :paramref:`iterator`. :param element: start element :param iterator: Input stream of ``(event, element)`` coming from :py:func:`xml.etree.ElementTree.iterparse` with the argument ``events=["start", "end"]`` :raise: :py:class:`DeserializationException` if unexpected input :return: parsed value """ return _read_enum_from_element_text( element, iterator, our_stringification.security_type_enum_from_str, "SecurityTypeEnum", ) def _read_asset_link_as_sequence( element: Element, iterator: Iterator[Tuple[str, Element]] ) -> our_types.AssetLink: """ Read an instance of :py:class:`.types.AssetLink` as a sequence of XML-encoded properties. The end element corresponding to the :paramref:`element` will be read as well. :param element: start element, parent of the sequence :param iterator: Input stream of ``(event, element)`` coming from :py:func:`xml.etree.ElementTree.iterparse` with the argument ``events=["start", "end"]`` :raise: :py:class:`DeserializationException` if unexpected input :return: parsed instance """ values = _read_properties(element, iterator, _READERS_FOR_ASSET_LINK) the_name: Optional[str] = values.get("name") the_value: Optional[str] = values.get("value") if the_name is None: raise DeserializationException("The required property 'name' is missing") if the_value is None: raise DeserializationException("The required property 'value' is missing") return our_types.AssetLink(the_name, the_value) def _read_asset_link_as_element( element: Element, iterator: Iterator[Tuple[str, Element]] ) -> our_types.AssetLink: """ Read an instance of :py:class:`.types.AssetLink` from :paramref:`iterator`, including the end element. :param element: start element :param iterator: Input stream of ``(event, element)`` coming from :py:func:`xml.etree.ElementTree.iterparse` with the argument ``events=["start", "end"]`` :raise: :py:class:`DeserializationException` if unexpected input :return: parsed instance """ return _read_named_element( element, iterator, "assetLink", _read_asset_link_as_sequence ) def _read_service_description_as_sequence( element: Element, iterator: Iterator[Tuple[str, Element]] ) -> our_types.ServiceDescription: """ Read an instance of :py:class:`.types.ServiceDescription` as a sequence of XML-encoded properties. The end element corresponding to the :paramref:`element` will be read as well. :param element: start element, parent of the sequence :param iterator: Input stream of ``(event, element)`` coming from :py:func:`xml.etree.ElementTree.iterparse` with the argument ``events=["start", "end"]`` :raise: :py:class:`DeserializationException` if unexpected input :return: parsed instance """ values = _read_properties(element, iterator, _READERS_FOR_SERVICE_DESCRIPTION) the_profiles: Optional[List[our_types.ServiceSpecificationProfileEnum]] = ( values.get("profiles") ) if the_profiles is None: raise DeserializationException("The required property 'profiles' is missing") return our_types.ServiceDescription(the_profiles) def _read_service_description_as_element( element: Element, iterator: Iterator[Tuple[str, Element]] ) -> our_types.ServiceDescription: """ Read an instance of :py:class:`.types.ServiceDescription` from :paramref:`iterator`, including the end element. :param element: start element :param iterator: Input stream of ``(event, element)`` coming from :py:func:`xml.etree.ElementTree.iterparse` with the argument ``events=["start", "end"]`` :raise: :py:class:`DeserializationException` if unexpected input :return: parsed instance """ return _read_named_element( element, iterator, "serviceDescription", _read_service_description_as_sequence ) def _read_service_specification_profile_enum_from_element_text( element: Element, iterator: Iterator[Tuple[str, Element]] ) -> our_types.ServiceSpecificationProfileEnum: """ Parse the text of :paramref:`element` as a literal of :py:class:`.types.ServiceSpecificationProfileEnum`, and read the corresponding end element from :paramref:`iterator`. :param element: start element :param iterator: Input stream of ``(event, element)`` coming from :py:func:`xml.etree.ElementTree.iterparse` with the argument ``events=["start", "end"]`` :raise: :py:class:`DeserializationException` if unexpected input :return: parsed value """ return _read_enum_from_element_text( element, iterator, our_stringification.service_specification_profile_enum_from_str, "ServiceSpecificationProfileEnum", ) def _read_recent_change_as_element( element: Element, iterator: Iterator[Tuple[str, Element]] ) -> our_types.RecentChange: """ Read an instance of :py:class:`.types.RecentChange` from :paramref:`iterator`, including the end element. :param element: start element :param iterator: Input stream of ``(event, element)`` coming from :py:func:`xml.etree.ElementTree.iterparse` with the argument ``events=["start", "end"]`` :raise: :py:class:`DeserializationException` if unexpected input :return: parsed instance """ return _read_dispatched( element, iterator, _DISPATCH_FOR_RECENT_CHANGE, "a concrete instance of 'RecentChange'", ) def _read_asset_administration_shell_recent_change_as_sequence( element: Element, iterator: Iterator[Tuple[str, Element]] ) -> our_types.AssetAdministrationShellRecentChange: """ Read an instance of :py:class:`.types.AssetAdministrationShellRecentChange` as a sequence of XML-encoded properties. The end element corresponding to the :paramref:`element` will be read as well. :param element: start element, parent of the sequence :param iterator: Input stream of ``(event, element)`` coming from :py:func:`xml.etree.ElementTree.iterparse` with the argument ``events=["start", "end"]`` :raise: :py:class:`DeserializationException` if unexpected input :return: parsed instance """ values = _read_properties( element, iterator, _READERS_FOR_ASSET_ADMINISTRATION_SHELL_RECENT_CHANGE ) the_created_at: Optional[str] = values.get("createdAt") the_updated_at: Optional[str] = values.get("updatedAt") the_id: Optional[str] = values.get("id") the_global_asset_id: Optional[str] = values.get("globalAssetId") the_specific_asset_ids: Optional[List[our_types.SpecificAssetID]] = values.get( "specificAssetIds" ) if the_created_at is None: raise DeserializationException("The required property 'createdAt' is missing") if the_updated_at is None: raise DeserializationException("The required property 'updatedAt' is missing") if the_id is None: raise DeserializationException("The required property 'id' is missing") return our_types.AssetAdministrationShellRecentChange( the_created_at, the_updated_at, the_id, the_global_asset_id, the_specific_asset_ids, ) def _read_asset_administration_shell_recent_change_as_element( element: Element, iterator: Iterator[Tuple[str, Element]] ) -> our_types.AssetAdministrationShellRecentChange: """ Read an instance of :py:class:`.types.AssetAdministrationShellRecentChange` from :paramref:`iterator`, including the end element. :param element: start element :param iterator: Input stream of ``(event, element)`` coming from :py:func:`xml.etree.ElementTree.iterparse` with the argument ``events=["start", "end"]`` :raise: :py:class:`DeserializationException` if unexpected input :return: parsed instance """ return _read_named_element( element, iterator, "assetAdministrationShellRecentChange", _read_asset_administration_shell_recent_change_as_sequence, ) def _read_concept_description_recent_change_as_sequence( element: Element, iterator: Iterator[Tuple[str, Element]] ) -> our_types.ConceptDescriptionRecentChange: """ Read an instance of :py:class:`.types.ConceptDescriptionRecentChange` as a sequence of XML-encoded properties. The end element corresponding to the :paramref:`element` will be read as well. :param element: start element, parent of the sequence :param iterator: Input stream of ``(event, element)`` coming from :py:func:`xml.etree.ElementTree.iterparse` with the argument ``events=["start", "end"]`` :raise: :py:class:`DeserializationException` if unexpected input :return: parsed instance """ values = _read_properties( element, iterator, _READERS_FOR_CONCEPT_DESCRIPTION_RECENT_CHANGE ) the_created_at: Optional[str] = values.get("createdAt") the_updated_at: Optional[str] = values.get("updatedAt") the_id: Optional[str] = values.get("id") if the_created_at is None: raise DeserializationException("The required property 'createdAt' is missing") if the_updated_at is None: raise DeserializationException("The required property 'updatedAt' is missing") if the_id is None: raise DeserializationException("The required property 'id' is missing") return our_types.ConceptDescriptionRecentChange( the_created_at, the_updated_at, the_id ) def _read_concept_description_recent_change_as_element( element: Element, iterator: Iterator[Tuple[str, Element]] ) -> our_types.ConceptDescriptionRecentChange: """ Read an instance of :py:class:`.types.ConceptDescriptionRecentChange` from :paramref:`iterator`, including the end element. :param element: start element :param iterator: Input stream of ``(event, element)`` coming from :py:func:`xml.etree.ElementTree.iterparse` with the argument ``events=["start", "end"]`` :raise: :py:class:`DeserializationException` if unexpected input :return: parsed instance """ return _read_named_element( element, iterator, "conceptDescriptionRecentChange", _read_concept_description_recent_change_as_sequence, ) def _read_submodel_recent_change_as_sequence( element: Element, iterator: Iterator[Tuple[str, Element]] ) -> our_types.SubmodelRecentChange: """ Read an instance of :py:class:`.types.SubmodelRecentChange` as a sequence of XML-encoded properties. The end element corresponding to the :paramref:`element` will be read as well. :param element: start element, parent of the sequence :param iterator: Input stream of ``(event, element)`` coming from :py:func:`xml.etree.ElementTree.iterparse` with the argument ``events=["start", "end"]`` :raise: :py:class:`DeserializationException` if unexpected input :return: parsed instance """ values = _read_properties(element, iterator, _READERS_FOR_SUBMODEL_RECENT_CHANGE) the_created_at: Optional[str] = values.get("createdAt") the_updated_at: Optional[str] = values.get("updatedAt") the_id: Optional[str] = values.get("id") the_semantic_id: Optional[our_types.Reference] = values.get("semanticId") the_supplemental_semantic_ids: Optional[List[our_types.Reference]] = values.get( "supplementalSemanticIds" ) if the_created_at is None: raise DeserializationException("The required property 'createdAt' is missing") if the_updated_at is None: raise DeserializationException("The required property 'updatedAt' is missing") if the_id is None: raise DeserializationException("The required property 'id' is missing") return our_types.SubmodelRecentChange( the_created_at, the_updated_at, the_id, the_semantic_id, the_supplemental_semantic_ids, ) def _read_submodel_recent_change_as_element( element: Element, iterator: Iterator[Tuple[str, Element]] ) -> our_types.SubmodelRecentChange: """ Read an instance of :py:class:`.types.SubmodelRecentChange` from :paramref:`iterator`, including the end element. :param element: start element :param iterator: Input stream of ``(event, element)`` coming from :py:func:`xml.etree.ElementTree.iterparse` with the argument ``events=["start", "end"]`` :raise: :py:class:`DeserializationException` if unexpected input :return: parsed instance """ return _read_named_element( element, iterator, "submodelRecentChange", _read_submodel_recent_change_as_sequence, ) def _read_result_as_sequence( element: Element, iterator: Iterator[Tuple[str, Element]] ) -> our_types.Result: """ Read an instance of :py:class:`.types.Result` as a sequence of XML-encoded properties. The end element corresponding to the :paramref:`element` will be read as well. :param element: start element, parent of the sequence :param iterator: Input stream of ``(event, element)`` coming from :py:func:`xml.etree.ElementTree.iterparse` with the argument ``events=["start", "end"]`` :raise: :py:class:`DeserializationException` if unexpected input :return: parsed instance """ values = _read_properties(element, iterator, _READERS_FOR_RESULT) the_messages: Optional[List[our_types.Message]] = values.get("messages") return our_types.Result(the_messages) def _read_result_as_element( element: Element, iterator: Iterator[Tuple[str, Element]] ) -> our_types.Result: """ Read an instance of :py:class:`.types.Result` from :paramref:`iterator`, including the end element. :param element: start element :param iterator: Input stream of ``(event, element)`` coming from :py:func:`xml.etree.ElementTree.iterparse` with the argument ``events=["start", "end"]`` :raise: :py:class:`DeserializationException` if unexpected input :return: parsed instance """ return _read_named_element(element, iterator, "result", _read_result_as_sequence) def _read_message_as_sequence( element: Element, iterator: Iterator[Tuple[str, Element]] ) -> our_types.Message: """ Read an instance of :py:class:`.types.Message` as a sequence of XML-encoded properties. The end element corresponding to the :paramref:`element` will be read as well. :param element: start element, parent of the sequence :param iterator: Input stream of ``(event, element)`` coming from :py:func:`xml.etree.ElementTree.iterparse` with the argument ``events=["start", "end"]`` :raise: :py:class:`DeserializationException` if unexpected input :return: parsed instance """ values = _read_properties(element, iterator, _READERS_FOR_MESSAGE) the_message_type: Optional[our_types.MessageTypeEnum] = values.get("messageType") the_text: Optional[str] = values.get("text") the_code: Optional[str] = values.get("code") the_correlation_id: Optional[str] = values.get("correlationId") the_timestamp: Optional[str] = values.get("timestamp") if the_message_type is None: raise DeserializationException("The required property 'messageType' is missing") if the_text is None: raise DeserializationException("The required property 'text' is missing") return our_types.Message( the_message_type, the_text, the_code, the_correlation_id, the_timestamp ) def _read_message_as_element( element: Element, iterator: Iterator[Tuple[str, Element]] ) -> our_types.Message: """ Read an instance of :py:class:`.types.Message` from :paramref:`iterator`, including the end element. :param element: start element :param iterator: Input stream of ``(event, element)`` coming from :py:func:`xml.etree.ElementTree.iterparse` with the argument ``events=["start", "end"]`` :raise: :py:class:`DeserializationException` if unexpected input :return: parsed instance """ return _read_named_element(element, iterator, "message", _read_message_as_sequence) def _read_message_type_enum_from_element_text( element: Element, iterator: Iterator[Tuple[str, Element]] ) -> our_types.MessageTypeEnum: """ Parse the text of :paramref:`element` as a literal of :py:class:`.types.MessageTypeEnum`, and read the corresponding end element from :paramref:`iterator`. :param element: start element :param iterator: Input stream of ``(event, element)`` coming from :py:func:`xml.etree.ElementTree.iterparse` with the argument ``events=["start", "end"]`` :raise: :py:class:`DeserializationException` if unexpected input :return: parsed value """ return _read_enum_from_element_text( element, iterator, our_stringification.message_type_enum_from_str, "MessageTypeEnum", ) def _read_operation_request_as_sequence( element: Element, iterator: Iterator[Tuple[str, Element]] ) -> our_types.OperationRequest: """ Read an instance of :py:class:`.types.OperationRequest` as a sequence of XML-encoded properties. The end element corresponding to the :paramref:`element` will be read as well. :param element: start element, parent of the sequence :param iterator: Input stream of ``(event, element)`` coming from :py:func:`xml.etree.ElementTree.iterparse` with the argument ``events=["start", "end"]`` :raise: :py:class:`DeserializationException` if unexpected input :return: parsed instance """ values = _read_properties(element, iterator, _READERS_FOR_OPERATION_REQUEST) the_input_arguments: Optional[List[our_types.OperationVariable]] = values.get( "inputArguments" ) the_inoutput_arguments: Optional[List[our_types.OperationVariable]] = values.get( "inoutputArguments" ) the_client_timeout_duration: Optional[str] = values.get("clientTimeoutDuration") return our_types.OperationRequest( the_input_arguments, the_inoutput_arguments, the_client_timeout_duration ) def _read_operation_request_as_element( element: Element, iterator: Iterator[Tuple[str, Element]] ) -> our_types.OperationRequest: """ Read an instance of :py:class:`.types.OperationRequest` from :paramref:`iterator`, including the end element. :param element: start element :param iterator: Input stream of ``(event, element)`` coming from :py:func:`xml.etree.ElementTree.iterparse` with the argument ``events=["start", "end"]`` :raise: :py:class:`DeserializationException` if unexpected input :return: parsed instance """ return _read_named_element( element, iterator, "operationRequest", _read_operation_request_as_sequence ) def _read_operation_request_async_as_sequence( element: Element, iterator: Iterator[Tuple[str, Element]] ) -> our_types.OperationRequestAsync: """ Read an instance of :py:class:`.types.OperationRequestAsync` as a sequence of XML-encoded properties. The end element corresponding to the :paramref:`element` will be read as well. :param element: start element, parent of the sequence :param iterator: Input stream of ``(event, element)`` coming from :py:func:`xml.etree.ElementTree.iterparse` with the argument ``events=["start", "end"]`` :raise: :py:class:`DeserializationException` if unexpected input :return: parsed instance """ values = _read_properties(element, iterator, _READERS_FOR_OPERATION_REQUEST_ASYNC) the_input_arguments: Optional[List[our_types.OperationVariable]] = values.get( "inputArguments" ) the_inoutput_arguments: Optional[List[our_types.OperationVariable]] = values.get( "inoutputArguments" ) the_client_timeout_duration: Optional[str] = values.get("clientTimeoutDuration") if the_client_timeout_duration is None: raise DeserializationException( "The required property 'clientTimeoutDuration' is missing" ) return our_types.OperationRequestAsync( the_client_timeout_duration, the_input_arguments, the_inoutput_arguments ) def _read_operation_request_async_as_element( element: Element, iterator: Iterator[Tuple[str, Element]] ) -> our_types.OperationRequestAsync: """ Read an instance of :py:class:`.types.OperationRequestAsync` from :paramref:`iterator`, including the end element. :param element: start element :param iterator: Input stream of ``(event, element)`` coming from :py:func:`xml.etree.ElementTree.iterparse` with the argument ``events=["start", "end"]`` :raise: :py:class:`DeserializationException` if unexpected input :return: parsed instance """ return _read_named_element( element, iterator, "operationRequestAsync", _read_operation_request_async_as_sequence, ) def _read_operation_request_value_only_as_sequence( element: Element, iterator: Iterator[Tuple[str, Element]] ) -> our_types.OperationRequestValueOnly: """ Read an instance of :py:class:`.types.OperationRequestValueOnly` as a sequence of XML-encoded properties. The end element corresponding to the :paramref:`element` will be read as well. :param element: start element, parent of the sequence :param iterator: Input stream of ``(event, element)`` coming from :py:func:`xml.etree.ElementTree.iterparse` with the argument ``events=["start", "end"]`` :raise: :py:class:`DeserializationException` if unexpected input :return: parsed instance """ values = _read_properties( element, iterator, _READERS_FOR_OPERATION_REQUEST_VALUE_ONLY ) the_input_arguments: Optional[our_types.JsonObject] = values.get("inputArguments") the_inoutput_arguments: Optional[our_types.JsonObject] = values.get( "inoutputArguments" ) the_client_timeout_duration: Optional[str] = values.get("clientTimeoutDuration") return our_types.OperationRequestValueOnly( the_input_arguments, the_inoutput_arguments, the_client_timeout_duration ) def _read_operation_request_value_only_as_element( element: Element, iterator: Iterator[Tuple[str, Element]] ) -> our_types.OperationRequestValueOnly: """ Read an instance of :py:class:`.types.OperationRequestValueOnly` from :paramref:`iterator`, including the end element. :param element: start element :param iterator: Input stream of ``(event, element)`` coming from :py:func:`xml.etree.ElementTree.iterparse` with the argument ``events=["start", "end"]`` :raise: :py:class:`DeserializationException` if unexpected input :return: parsed instance """ return _read_named_element( element, iterator, "operationRequestValueOnly", _read_operation_request_value_only_as_sequence, ) def _read_operation_request_async_value_only_as_sequence( element: Element, iterator: Iterator[Tuple[str, Element]] ) -> our_types.OperationRequestAsyncValueOnly: """ Read an instance of :py:class:`.types.OperationRequestAsyncValueOnly` as a sequence of XML-encoded properties. The end element corresponding to the :paramref:`element` will be read as well. :param element: start element, parent of the sequence :param iterator: Input stream of ``(event, element)`` coming from :py:func:`xml.etree.ElementTree.iterparse` with the argument ``events=["start", "end"]`` :raise: :py:class:`DeserializationException` if unexpected input :return: parsed instance """ values = _read_properties( element, iterator, _READERS_FOR_OPERATION_REQUEST_ASYNC_VALUE_ONLY ) the_input_arguments: Optional[our_types.JsonObject] = values.get("inputArguments") the_inoutput_arguments: Optional[our_types.JsonObject] = values.get( "inoutputArguments" ) the_client_timeout_duration: Optional[str] = values.get("clientTimeoutDuration") if the_client_timeout_duration is None: raise DeserializationException( "The required property 'clientTimeoutDuration' is missing" ) return our_types.OperationRequestAsyncValueOnly( the_client_timeout_duration, the_input_arguments, the_inoutput_arguments ) def _read_operation_request_async_value_only_as_element( element: Element, iterator: Iterator[Tuple[str, Element]] ) -> our_types.OperationRequestAsyncValueOnly: """ Read an instance of :py:class:`.types.OperationRequestAsyncValueOnly` from :paramref:`iterator`, including the end element. :param element: start element :param iterator: Input stream of ``(event, element)`` coming from :py:func:`xml.etree.ElementTree.iterparse` with the argument ``events=["start", "end"]`` :raise: :py:class:`DeserializationException` if unexpected input :return: parsed instance """ return _read_named_element( element, iterator, "operationRequestAsyncValueOnly", _read_operation_request_async_value_only_as_sequence, ) def _read_base_operation_result_as_sequence( element: Element, iterator: Iterator[Tuple[str, Element]] ) -> our_types.BaseOperationResult: """ Read an instance of :py:class:`.types.BaseOperationResult` as a sequence of XML-encoded properties. The end element corresponding to the :paramref:`element` will be read as well. :param element: start element, parent of the sequence :param iterator: Input stream of ``(event, element)`` coming from :py:func:`xml.etree.ElementTree.iterparse` with the argument ``events=["start", "end"]`` :raise: :py:class:`DeserializationException` if unexpected input :return: parsed instance """ values = _read_properties(element, iterator, _READERS_FOR_BASE_OPERATION_RESULT) the_execution_state: Optional[our_types.ExecutionState] = values.get( "executionState" ) the_messages: Optional[List[our_types.Message]] = values.get("messages") the_success: Optional[bool] = values.get("success") if the_execution_state is None: raise DeserializationException( "The required property 'executionState' is missing" ) return our_types.BaseOperationResult(the_execution_state, the_messages, the_success) def _read_base_operation_result_as_element( element: Element, iterator: Iterator[Tuple[str, Element]] ) -> our_types.BaseOperationResult: """ Read an instance of :py:class:`.types.BaseOperationResult` from :paramref:`iterator`, including the end element. :param element: start element :param iterator: Input stream of ``(event, element)`` coming from :py:func:`xml.etree.ElementTree.iterparse` with the argument ``events=["start", "end"]`` :raise: :py:class:`DeserializationException` if unexpected input :return: parsed instance """ return _read_named_element( element, iterator, "baseOperationResult", _read_base_operation_result_as_sequence, ) def _read_operation_result_as_sequence( element: Element, iterator: Iterator[Tuple[str, Element]] ) -> our_types.OperationResult: """ Read an instance of :py:class:`.types.OperationResult` as a sequence of XML-encoded properties. The end element corresponding to the :paramref:`element` will be read as well. :param element: start element, parent of the sequence :param iterator: Input stream of ``(event, element)`` coming from :py:func:`xml.etree.ElementTree.iterparse` with the argument ``events=["start", "end"]`` :raise: :py:class:`DeserializationException` if unexpected input :return: parsed instance """ values = _read_properties(element, iterator, _READERS_FOR_OPERATION_RESULT) the_execution_state: Optional[our_types.ExecutionState] = values.get( "executionState" ) the_messages: Optional[List[our_types.Message]] = values.get("messages") the_success: Optional[bool] = values.get("success") the_output_arguments: Optional[List[our_types.OperationVariable]] = values.get( "outputArguments" ) the_inoutput_arguments: Optional[List[our_types.OperationVariable]] = values.get( "inoutputArguments" ) if the_execution_state is None: raise DeserializationException( "The required property 'executionState' is missing" ) return our_types.OperationResult( the_execution_state, the_messages, the_success, the_output_arguments, the_inoutput_arguments, ) def _read_operation_result_as_element( element: Element, iterator: Iterator[Tuple[str, Element]] ) -> our_types.OperationResult: """ Read an instance of :py:class:`.types.OperationResult` from :paramref:`iterator`, including the end element. :param element: start element :param iterator: Input stream of ``(event, element)`` coming from :py:func:`xml.etree.ElementTree.iterparse` with the argument ``events=["start", "end"]`` :raise: :py:class:`DeserializationException` if unexpected input :return: parsed instance """ return _read_named_element( element, iterator, "operationResult", _read_operation_result_as_sequence ) def _read_operation_result_value_only_as_sequence( element: Element, iterator: Iterator[Tuple[str, Element]] ) -> our_types.OperationResultValueOnly: """ Read an instance of :py:class:`.types.OperationResultValueOnly` as a sequence of XML-encoded properties. The end element corresponding to the :paramref:`element` will be read as well. :param element: start element, parent of the sequence :param iterator: Input stream of ``(event, element)`` coming from :py:func:`xml.etree.ElementTree.iterparse` with the argument ``events=["start", "end"]`` :raise: :py:class:`DeserializationException` if unexpected input :return: parsed instance """ values = _read_properties( element, iterator, _READERS_FOR_OPERATION_RESULT_VALUE_ONLY ) the_execution_state: Optional[our_types.ExecutionState] = values.get( "executionState" ) the_messages: Optional[List[our_types.Message]] = values.get("messages") the_success: Optional[bool] = values.get("success") the_output_arguments: Optional[our_types.JsonObject] = values.get("outputArguments") the_inoutput_arguments: Optional[our_types.JsonObject] = values.get( "inoutputArguments" ) if the_execution_state is None: raise DeserializationException( "The required property 'executionState' is missing" ) return our_types.OperationResultValueOnly( the_execution_state, the_messages, the_success, the_output_arguments, the_inoutput_arguments, ) def _read_operation_result_value_only_as_element( element: Element, iterator: Iterator[Tuple[str, Element]] ) -> our_types.OperationResultValueOnly: """ Read an instance of :py:class:`.types.OperationResultValueOnly` from :paramref:`iterator`, including the end element. :param element: start element :param iterator: Input stream of ``(event, element)`` coming from :py:func:`xml.etree.ElementTree.iterparse` with the argument ``events=["start", "end"]`` :raise: :py:class:`DeserializationException` if unexpected input :return: parsed instance """ return _read_named_element( element, iterator, "operationResultValueOnly", _read_operation_result_value_only_as_sequence, ) def _read_execution_state_from_element_text( element: Element, iterator: Iterator[Tuple[str, Element]] ) -> our_types.ExecutionState: """ Parse the text of :paramref:`element` as a literal of :py:class:`.types.ExecutionState`, and read the corresponding end element from :paramref:`iterator`. :param element: start element :param iterator: Input stream of ``(event, element)`` coming from :py:func:`xml.etree.ElementTree.iterparse` with the argument ``events=["start", "end"]`` :raise: :py:class:`DeserializationException` if unexpected input :return: parsed value """ return _read_enum_from_element_text( element, iterator, our_stringification.execution_state_from_str, "ExecutionState", ) def _read_operation_handle_as_sequence( element: Element, iterator: Iterator[Tuple[str, Element]] ) -> our_types.OperationHandle: """ Read an instance of :py:class:`.types.OperationHandle` as a sequence of XML-encoded properties. The end element corresponding to the :paramref:`element` will be read as well. :param element: start element, parent of the sequence :param iterator: Input stream of ``(event, element)`` coming from :py:func:`xml.etree.ElementTree.iterparse` with the argument ``events=["start", "end"]`` :raise: :py:class:`DeserializationException` if unexpected input :return: parsed instance """ values = _read_properties(element, iterator, _READERS_FOR_OPERATION_HANDLE) the_handle_id: Optional[str] = values.get("handleId") if the_handle_id is None: raise DeserializationException("The required property 'handleId' is missing") return our_types.OperationHandle(the_handle_id) def _read_operation_handle_as_element( element: Element, iterator: Iterator[Tuple[str, Element]] ) -> our_types.OperationHandle: """ Read an instance of :py:class:`.types.OperationHandle` from :paramref:`iterator`, including the end element. :param element: start element :param iterator: Input stream of ``(event, element)`` coming from :py:func:`xml.etree.ElementTree.iterparse` with the argument ``events=["start", "end"]`` :raise: :py:class:`DeserializationException` if unexpected input :return: parsed instance """ return _read_named_element( element, iterator, "operationHandle", _read_operation_handle_as_sequence ) def _read_paged_result_as_sequence( element: Element, iterator: Iterator[Tuple[str, Element]] ) -> our_types.PagedResult: """ Read an instance of :py:class:`.types.PagedResult` as a sequence of XML-encoded properties. The end element corresponding to the :paramref:`element` will be read as well. :param element: start element, parent of the sequence :param iterator: Input stream of ``(event, element)`` coming from :py:func:`xml.etree.ElementTree.iterparse` with the argument ``events=["start", "end"]`` :raise: :py:class:`DeserializationException` if unexpected input :return: parsed instance """ values = _read_properties(element, iterator, _READERS_FOR_PAGED_RESULT) the_result: Optional[List[our_types.Referable]] = values.get("result") the_paging_metadata: Optional[our_types.PagingMetadata] = values.get( "pagingMetadata" ) if the_paging_metadata is None: raise DeserializationException( "The required property 'pagingMetadata' is missing" ) return our_types.PagedResult(the_paging_metadata, the_result) def _read_paged_result_as_element( element: Element, iterator: Iterator[Tuple[str, Element]] ) -> our_types.PagedResult: """ Read an instance of :py:class:`.types.PagedResult` from :paramref:`iterator`, including the end element. :param element: start element :param iterator: Input stream of ``(event, element)`` coming from :py:func:`xml.etree.ElementTree.iterparse` with the argument ``events=["start", "end"]`` :raise: :py:class:`DeserializationException` if unexpected input :return: parsed instance """ return _read_named_element( element, iterator, "pagedResult", _read_paged_result_as_sequence ) def _read_paging_metadata_as_sequence( element: Element, iterator: Iterator[Tuple[str, Element]] ) -> our_types.PagingMetadata: """ Read an instance of :py:class:`.types.PagingMetadata` as a sequence of XML-encoded properties. The end element corresponding to the :paramref:`element` will be read as well. :param element: start element, parent of the sequence :param iterator: Input stream of ``(event, element)`` coming from :py:func:`xml.etree.ElementTree.iterparse` with the argument ``events=["start", "end"]`` :raise: :py:class:`DeserializationException` if unexpected input :return: parsed instance """ values = _read_properties(element, iterator, _READERS_FOR_PAGING_METADATA) the_cursor: Optional[str] = values.get("cursor") return our_types.PagingMetadata(the_cursor) def _read_paging_metadata_as_element( element: Element, iterator: Iterator[Tuple[str, Element]] ) -> our_types.PagingMetadata: """ Read an instance of :py:class:`.types.PagingMetadata` from :paramref:`iterator`, including the end element. :param element: start element :param iterator: Input stream of ``(event, element)`` coming from :py:func:`xml.etree.ElementTree.iterparse` with the argument ``events=["start", "end"]`` :raise: :py:class:`DeserializationException` if unexpected input :return: parsed instance """ return _read_named_element( element, iterator, "pagingMetadata", _read_paging_metadata_as_sequence ) def _read_package_description_as_sequence( element: Element, iterator: Iterator[Tuple[str, Element]] ) -> our_types.PackageDescription: """ Read an instance of :py:class:`.types.PackageDescription` as a sequence of XML-encoded properties. The end element corresponding to the :paramref:`element` will be read as well. :param element: start element, parent of the sequence :param iterator: Input stream of ``(event, element)`` coming from :py:func:`xml.etree.ElementTree.iterparse` with the argument ``events=["start", "end"]`` :raise: :py:class:`DeserializationException` if unexpected input :return: parsed instance """ values = _read_properties(element, iterator, _READERS_FOR_PACKAGE_DESCRIPTION) the_package_id: Optional[str] = values.get("packageId") the_aas_ids: Optional[List[str]] = values.get("aasIds") if the_package_id is None: raise DeserializationException("The required property 'packageId' is missing") return our_types.PackageDescription(the_package_id, the_aas_ids) def _read_package_description_as_element( element: Element, iterator: Iterator[Tuple[str, Element]] ) -> our_types.PackageDescription: """ Read an instance of :py:class:`.types.PackageDescription` from :paramref:`iterator`, including the end element. :param element: start element :param iterator: Input stream of ``(event, element)`` coming from :py:func:`xml.etree.ElementTree.iterparse` with the argument ``events=["start", "end"]`` :raise: :py:class:`DeserializationException` if unexpected input :return: parsed instance """ return _read_named_element( element, iterator, "packageDescription", _read_package_description_as_sequence ) def _read_submodel_element_attributes_as_element( element: Element, iterator: Iterator[Tuple[str, Element]] ) -> our_types.SubmodelElementAttributes: """ Read an instance of :py:class:`.types.SubmodelElementAttributes` from :paramref:`iterator`, including the end element. :param element: start element :param iterator: Input stream of ``(event, element)`` coming from :py:func:`xml.etree.ElementTree.iterparse` with the argument ``events=["start", "end"]`` :raise: :py:class:`DeserializationException` if unexpected input :return: parsed instance """ return _read_dispatched( element, iterator, _DISPATCH_FOR_SUBMODEL_ELEMENT_ATTRIBUTES, "a concrete instance of 'SubmodelElementAttributes'", ) def _read_submodel_element_metadata_as_element( element: Element, iterator: Iterator[Tuple[str, Element]] ) -> our_types.SubmodelElementMetadata: """ Read an instance of :py:class:`.types.SubmodelElementMetadata` from :paramref:`iterator`, including the end element. :param element: start element :param iterator: Input stream of ``(event, element)`` coming from :py:func:`xml.etree.ElementTree.iterparse` with the argument ``events=["start", "end"]`` :raise: :py:class:`DeserializationException` if unexpected input :return: parsed instance """ return _read_dispatched( element, iterator, _DISPATCH_FOR_SUBMODEL_ELEMENT_METADATA, "a concrete instance of 'SubmodelElementMetadata'", ) def _read_property_metadata_as_sequence( element: Element, iterator: Iterator[Tuple[str, Element]] ) -> our_types.PropertyMetadata: """ Read an instance of :py:class:`.types.PropertyMetadata` as a sequence of XML-encoded properties. The end element corresponding to the :paramref:`element` will be read as well. :param element: start element, parent of the sequence :param iterator: Input stream of ``(event, element)`` coming from :py:func:`xml.etree.ElementTree.iterparse` with the argument ``events=["start", "end"]`` :raise: :py:class:`DeserializationException` if unexpected input :return: parsed instance """ values = _read_properties(element, iterator, _READERS_FOR_PROPERTY_METADATA) the_extensions: Optional[List[our_types.Extension]] = values.get("extensions") the_category: Optional[str] = values.get("category") the_id_short: Optional[str] = values.get("idShort") the_display_name: Optional[List[our_types.LangStringNameType]] = values.get( "displayName" ) the_description: Optional[List[our_types.LangStringTextType]] = values.get( "description" ) the_semantic_id: Optional[our_types.Reference] = values.get("semanticId") the_supplemental_semantic_ids: Optional[List[our_types.Reference]] = values.get( "supplementalSemanticIds" ) the_qualifiers: Optional[List[our_types.Qualifier]] = values.get("qualifiers") the_embedded_data_specifications: Optional[ List[our_types.EmbeddedDataSpecification] ] = values.get("embeddedDataSpecifications") the_value_type: Optional[our_types.DataTypeDefXSD] = values.get("valueType") if the_value_type is None: raise DeserializationException("The required property 'valueType' is missing") return our_types.PropertyMetadata( the_value_type, the_extensions, the_category, the_id_short, the_display_name, the_description, the_semantic_id, the_supplemental_semantic_ids, the_qualifiers, the_embedded_data_specifications, ) def _read_property_metadata_as_element( element: Element, iterator: Iterator[Tuple[str, Element]] ) -> our_types.PropertyMetadata: """ Read an instance of :py:class:`.types.PropertyMetadata` from :paramref:`iterator`, including the end element. :param element: start element :param iterator: Input stream of ``(event, element)`` coming from :py:func:`xml.etree.ElementTree.iterparse` with the argument ``events=["start", "end"]`` :raise: :py:class:`DeserializationException` if unexpected input :return: parsed instance """ return _read_named_element( element, iterator, "propertyMetadata", _read_property_metadata_as_sequence ) def _read_range_metadata_as_sequence( element: Element, iterator: Iterator[Tuple[str, Element]] ) -> our_types.RangeMetadata: """ Read an instance of :py:class:`.types.RangeMetadata` as a sequence of XML-encoded properties. The end element corresponding to the :paramref:`element` will be read as well. :param element: start element, parent of the sequence :param iterator: Input stream of ``(event, element)`` coming from :py:func:`xml.etree.ElementTree.iterparse` with the argument ``events=["start", "end"]`` :raise: :py:class:`DeserializationException` if unexpected input :return: parsed instance """ values = _read_properties(element, iterator, _READERS_FOR_RANGE_METADATA) the_extensions: Optional[List[our_types.Extension]] = values.get("extensions") the_category: Optional[str] = values.get("category") the_id_short: Optional[str] = values.get("idShort") the_display_name: Optional[List[our_types.LangStringNameType]] = values.get( "displayName" ) the_description: Optional[List[our_types.LangStringTextType]] = values.get( "description" ) the_semantic_id: Optional[our_types.Reference] = values.get("semanticId") the_supplemental_semantic_ids: Optional[List[our_types.Reference]] = values.get( "supplementalSemanticIds" ) the_qualifiers: Optional[List[our_types.Qualifier]] = values.get("qualifiers") the_embedded_data_specifications: Optional[ List[our_types.EmbeddedDataSpecification] ] = values.get("embeddedDataSpecifications") the_value_type: Optional[our_types.DataTypeDefXSD] = values.get("valueType") if the_value_type is None: raise DeserializationException("The required property 'valueType' is missing") return our_types.RangeMetadata( the_value_type, the_extensions, the_category, the_id_short, the_display_name, the_description, the_semantic_id, the_supplemental_semantic_ids, the_qualifiers, the_embedded_data_specifications, ) def _read_range_metadata_as_element( element: Element, iterator: Iterator[Tuple[str, Element]] ) -> our_types.RangeMetadata: """ Read an instance of :py:class:`.types.RangeMetadata` from :paramref:`iterator`, including the end element. :param element: start element :param iterator: Input stream of ``(event, element)`` coming from :py:func:`xml.etree.ElementTree.iterparse` with the argument ``events=["start", "end"]`` :raise: :py:class:`DeserializationException` if unexpected input :return: parsed instance """ return _read_named_element( element, iterator, "rangeMetadata", _read_range_metadata_as_sequence ) def _read_blob_metadata_as_sequence( element: Element, iterator: Iterator[Tuple[str, Element]] ) -> our_types.BlobMetadata: """ Read an instance of :py:class:`.types.BlobMetadata` as a sequence of XML-encoded properties. The end element corresponding to the :paramref:`element` will be read as well. :param element: start element, parent of the sequence :param iterator: Input stream of ``(event, element)`` coming from :py:func:`xml.etree.ElementTree.iterparse` with the argument ``events=["start", "end"]`` :raise: :py:class:`DeserializationException` if unexpected input :return: parsed instance """ values = _read_properties(element, iterator, _READERS_FOR_BLOB_METADATA) the_extensions: Optional[List[our_types.Extension]] = values.get("extensions") the_category: Optional[str] = values.get("category") the_id_short: Optional[str] = values.get("idShort") the_display_name: Optional[List[our_types.LangStringNameType]] = values.get( "displayName" ) the_description: Optional[List[our_types.LangStringTextType]] = values.get( "description" ) the_semantic_id: Optional[our_types.Reference] = values.get("semanticId") the_supplemental_semantic_ids: Optional[List[our_types.Reference]] = values.get( "supplementalSemanticIds" ) the_qualifiers: Optional[List[our_types.Qualifier]] = values.get("qualifiers") the_embedded_data_specifications: Optional[ List[our_types.EmbeddedDataSpecification] ] = values.get("embeddedDataSpecifications") return our_types.BlobMetadata( the_extensions, the_category, the_id_short, the_display_name, the_description, the_semantic_id, the_supplemental_semantic_ids, the_qualifiers, the_embedded_data_specifications, ) def _read_blob_metadata_as_element( element: Element, iterator: Iterator[Tuple[str, Element]] ) -> our_types.BlobMetadata: """ Read an instance of :py:class:`.types.BlobMetadata` from :paramref:`iterator`, including the end element. :param element: start element :param iterator: Input stream of ``(event, element)`` coming from :py:func:`xml.etree.ElementTree.iterparse` with the argument ``events=["start", "end"]`` :raise: :py:class:`DeserializationException` if unexpected input :return: parsed instance """ return _read_named_element( element, iterator, "blobMetadata", _read_blob_metadata_as_sequence ) def _read_file_metadata_as_sequence( element: Element, iterator: Iterator[Tuple[str, Element]] ) -> our_types.FileMetadata: """ Read an instance of :py:class:`.types.FileMetadata` as a sequence of XML-encoded properties. The end element corresponding to the :paramref:`element` will be read as well. :param element: start element, parent of the sequence :param iterator: Input stream of ``(event, element)`` coming from :py:func:`xml.etree.ElementTree.iterparse` with the argument ``events=["start", "end"]`` :raise: :py:class:`DeserializationException` if unexpected input :return: parsed instance """ values = _read_properties(element, iterator, _READERS_FOR_FILE_METADATA) the_extensions: Optional[List[our_types.Extension]] = values.get("extensions") the_category: Optional[str] = values.get("category") the_id_short: Optional[str] = values.get("idShort") the_display_name: Optional[List[our_types.LangStringNameType]] = values.get( "displayName" ) the_description: Optional[List[our_types.LangStringTextType]] = values.get( "description" ) the_semantic_id: Optional[our_types.Reference] = values.get("semanticId") the_supplemental_semantic_ids: Optional[List[our_types.Reference]] = values.get( "supplementalSemanticIds" ) the_qualifiers: Optional[List[our_types.Qualifier]] = values.get("qualifiers") the_embedded_data_specifications: Optional[ List[our_types.EmbeddedDataSpecification] ] = values.get("embeddedDataSpecifications") return our_types.FileMetadata( the_extensions, the_category, the_id_short, the_display_name, the_description, the_semantic_id, the_supplemental_semantic_ids, the_qualifiers, the_embedded_data_specifications, ) def _read_file_metadata_as_element( element: Element, iterator: Iterator[Tuple[str, Element]] ) -> our_types.FileMetadata: """ Read an instance of :py:class:`.types.FileMetadata` from :paramref:`iterator`, including the end element. :param element: start element :param iterator: Input stream of ``(event, element)`` coming from :py:func:`xml.etree.ElementTree.iterparse` with the argument ``events=["start", "end"]`` :raise: :py:class:`DeserializationException` if unexpected input :return: parsed instance """ return _read_named_element( element, iterator, "fileMetadata", _read_file_metadata_as_sequence ) def _read_multi_language_property_metadata_as_sequence( element: Element, iterator: Iterator[Tuple[str, Element]] ) -> our_types.MultiLanguagePropertyMetadata: """ Read an instance of :py:class:`.types.MultiLanguagePropertyMetadata` as a sequence of XML-encoded properties. The end element corresponding to the :paramref:`element` will be read as well. :param element: start element, parent of the sequence :param iterator: Input stream of ``(event, element)`` coming from :py:func:`xml.etree.ElementTree.iterparse` with the argument ``events=["start", "end"]`` :raise: :py:class:`DeserializationException` if unexpected input :return: parsed instance """ values = _read_properties( element, iterator, _READERS_FOR_MULTI_LANGUAGE_PROPERTY_METADATA ) the_extensions: Optional[List[our_types.Extension]] = values.get("extensions") the_category: Optional[str] = values.get("category") the_id_short: Optional[str] = values.get("idShort") the_display_name: Optional[List[our_types.LangStringNameType]] = values.get( "displayName" ) the_description: Optional[List[our_types.LangStringTextType]] = values.get( "description" ) the_semantic_id: Optional[our_types.Reference] = values.get("semanticId") the_supplemental_semantic_ids: Optional[List[our_types.Reference]] = values.get( "supplementalSemanticIds" ) the_qualifiers: Optional[List[our_types.Qualifier]] = values.get("qualifiers") the_embedded_data_specifications: Optional[ List[our_types.EmbeddedDataSpecification] ] = values.get("embeddedDataSpecifications") return our_types.MultiLanguagePropertyMetadata( the_extensions, the_category, the_id_short, the_display_name, the_description, the_semantic_id, the_supplemental_semantic_ids, the_qualifiers, the_embedded_data_specifications, ) def _read_multi_language_property_metadata_as_element( element: Element, iterator: Iterator[Tuple[str, Element]] ) -> our_types.MultiLanguagePropertyMetadata: """ Read an instance of :py:class:`.types.MultiLanguagePropertyMetadata` from :paramref:`iterator`, including the end element. :param element: start element :param iterator: Input stream of ``(event, element)`` coming from :py:func:`xml.etree.ElementTree.iterparse` with the argument ``events=["start", "end"]`` :raise: :py:class:`DeserializationException` if unexpected input :return: parsed instance """ return _read_named_element( element, iterator, "multiLanguagePropertyMetadata", _read_multi_language_property_metadata_as_sequence, ) def _read_reference_element_metadata_as_sequence( element: Element, iterator: Iterator[Tuple[str, Element]] ) -> our_types.ReferenceElementMetadata: """ Read an instance of :py:class:`.types.ReferenceElementMetadata` as a sequence of XML-encoded properties. The end element corresponding to the :paramref:`element` will be read as well. :param element: start element, parent of the sequence :param iterator: Input stream of ``(event, element)`` coming from :py:func:`xml.etree.ElementTree.iterparse` with the argument ``events=["start", "end"]`` :raise: :py:class:`DeserializationException` if unexpected input :return: parsed instance """ values = _read_properties( element, iterator, _READERS_FOR_REFERENCE_ELEMENT_METADATA ) the_extensions: Optional[List[our_types.Extension]] = values.get("extensions") the_category: Optional[str] = values.get("category") the_id_short: Optional[str] = values.get("idShort") the_display_name: Optional[List[our_types.LangStringNameType]] = values.get( "displayName" ) the_description: Optional[List[our_types.LangStringTextType]] = values.get( "description" ) the_semantic_id: Optional[our_types.Reference] = values.get("semanticId") the_supplemental_semantic_ids: Optional[List[our_types.Reference]] = values.get( "supplementalSemanticIds" ) the_qualifiers: Optional[List[our_types.Qualifier]] = values.get("qualifiers") the_embedded_data_specifications: Optional[ List[our_types.EmbeddedDataSpecification] ] = values.get("embeddedDataSpecifications") return our_types.ReferenceElementMetadata( the_extensions, the_category, the_id_short, the_display_name, the_description, the_semantic_id, the_supplemental_semantic_ids, the_qualifiers, the_embedded_data_specifications, ) def _read_reference_element_metadata_as_element( element: Element, iterator: Iterator[Tuple[str, Element]] ) -> our_types.ReferenceElementMetadata: """ Read an instance of :py:class:`.types.ReferenceElementMetadata` from :paramref:`iterator`, including the end element. :param element: start element :param iterator: Input stream of ``(event, element)`` coming from :py:func:`xml.etree.ElementTree.iterparse` with the argument ``events=["start", "end"]`` :raise: :py:class:`DeserializationException` if unexpected input :return: parsed instance """ return _read_named_element( element, iterator, "referenceElementMetadata", _read_reference_element_metadata_as_sequence, ) def _read_relationship_element_metadata_as_sequence( element: Element, iterator: Iterator[Tuple[str, Element]] ) -> our_types.RelationshipElementMetadata: """ Read an instance of :py:class:`.types.RelationshipElementMetadata` as a sequence of XML-encoded properties. The end element corresponding to the :paramref:`element` will be read as well. :param element: start element, parent of the sequence :param iterator: Input stream of ``(event, element)`` coming from :py:func:`xml.etree.ElementTree.iterparse` with the argument ``events=["start", "end"]`` :raise: :py:class:`DeserializationException` if unexpected input :return: parsed instance """ values = _read_properties( element, iterator, _READERS_FOR_RELATIONSHIP_ELEMENT_METADATA ) the_extensions: Optional[List[our_types.Extension]] = values.get("extensions") the_category: Optional[str] = values.get("category") the_id_short: Optional[str] = values.get("idShort") the_display_name: Optional[List[our_types.LangStringNameType]] = values.get( "displayName" ) the_description: Optional[List[our_types.LangStringTextType]] = values.get( "description" ) the_semantic_id: Optional[our_types.Reference] = values.get("semanticId") the_supplemental_semantic_ids: Optional[List[our_types.Reference]] = values.get( "supplementalSemanticIds" ) the_qualifiers: Optional[List[our_types.Qualifier]] = values.get("qualifiers") the_embedded_data_specifications: Optional[ List[our_types.EmbeddedDataSpecification] ] = values.get("embeddedDataSpecifications") return our_types.RelationshipElementMetadata( the_extensions, the_category, the_id_short, the_display_name, the_description, the_semantic_id, the_supplemental_semantic_ids, the_qualifiers, the_embedded_data_specifications, ) def _read_relationship_element_metadata_as_element( element: Element, iterator: Iterator[Tuple[str, Element]] ) -> our_types.RelationshipElementMetadata: """ Read an instance of :py:class:`.types.RelationshipElementMetadata` from :paramref:`iterator`, including the end element. :param element: start element :param iterator: Input stream of ``(event, element)`` coming from :py:func:`xml.etree.ElementTree.iterparse` with the argument ``events=["start", "end"]`` :raise: :py:class:`DeserializationException` if unexpected input :return: parsed instance """ return _read_named_element( element, iterator, "relationshipElementMetadata", _read_relationship_element_metadata_as_sequence, ) def _read_annotated_relationship_element_metadata_as_sequence( element: Element, iterator: Iterator[Tuple[str, Element]] ) -> our_types.AnnotatedRelationshipElementMetadata: """ Read an instance of :py:class:`.types.AnnotatedRelationshipElementMetadata` as a sequence of XML-encoded properties. The end element corresponding to the :paramref:`element` will be read as well. :param element: start element, parent of the sequence :param iterator: Input stream of ``(event, element)`` coming from :py:func:`xml.etree.ElementTree.iterparse` with the argument ``events=["start", "end"]`` :raise: :py:class:`DeserializationException` if unexpected input :return: parsed instance """ values = _read_properties( element, iterator, _READERS_FOR_ANNOTATED_RELATIONSHIP_ELEMENT_METADATA ) the_extensions: Optional[List[our_types.Extension]] = values.get("extensions") the_category: Optional[str] = values.get("category") the_id_short: Optional[str] = values.get("idShort") the_display_name: Optional[List[our_types.LangStringNameType]] = values.get( "displayName" ) the_description: Optional[List[our_types.LangStringTextType]] = values.get( "description" ) the_semantic_id: Optional[our_types.Reference] = values.get("semanticId") the_supplemental_semantic_ids: Optional[List[our_types.Reference]] = values.get( "supplementalSemanticIds" ) the_qualifiers: Optional[List[our_types.Qualifier]] = values.get("qualifiers") the_embedded_data_specifications: Optional[ List[our_types.EmbeddedDataSpecification] ] = values.get("embeddedDataSpecifications") return our_types.AnnotatedRelationshipElementMetadata( the_extensions, the_category, the_id_short, the_display_name, the_description, the_semantic_id, the_supplemental_semantic_ids, the_qualifiers, the_embedded_data_specifications, ) def _read_annotated_relationship_element_metadata_as_element( element: Element, iterator: Iterator[Tuple[str, Element]] ) -> our_types.AnnotatedRelationshipElementMetadata: """ Read an instance of :py:class:`.types.AnnotatedRelationshipElementMetadata` from :paramref:`iterator`, including the end element. :param element: start element :param iterator: Input stream of ``(event, element)`` coming from :py:func:`xml.etree.ElementTree.iterparse` with the argument ``events=["start", "end"]`` :raise: :py:class:`DeserializationException` if unexpected input :return: parsed instance """ return _read_named_element( element, iterator, "annotatedRelationshipElementMetadata", _read_annotated_relationship_element_metadata_as_sequence, ) def _read_entity_metadata_as_sequence( element: Element, iterator: Iterator[Tuple[str, Element]] ) -> our_types.EntityMetadata: """ Read an instance of :py:class:`.types.EntityMetadata` as a sequence of XML-encoded properties. The end element corresponding to the :paramref:`element` will be read as well. :param element: start element, parent of the sequence :param iterator: Input stream of ``(event, element)`` coming from :py:func:`xml.etree.ElementTree.iterparse` with the argument ``events=["start", "end"]`` :raise: :py:class:`DeserializationException` if unexpected input :return: parsed instance """ values = _read_properties(element, iterator, _READERS_FOR_ENTITY_METADATA) the_extensions: Optional[List[our_types.Extension]] = values.get("extensions") the_category: Optional[str] = values.get("category") the_id_short: Optional[str] = values.get("idShort") the_display_name: Optional[List[our_types.LangStringNameType]] = values.get( "displayName" ) the_description: Optional[List[our_types.LangStringTextType]] = values.get( "description" ) the_semantic_id: Optional[our_types.Reference] = values.get("semanticId") the_supplemental_semantic_ids: Optional[List[our_types.Reference]] = values.get( "supplementalSemanticIds" ) the_qualifiers: Optional[List[our_types.Qualifier]] = values.get("qualifiers") the_embedded_data_specifications: Optional[ List[our_types.EmbeddedDataSpecification] ] = values.get("embeddedDataSpecifications") return our_types.EntityMetadata( the_extensions, the_category, the_id_short, the_display_name, the_description, the_semantic_id, the_supplemental_semantic_ids, the_qualifiers, the_embedded_data_specifications, ) def _read_entity_metadata_as_element( element: Element, iterator: Iterator[Tuple[str, Element]] ) -> our_types.EntityMetadata: """ Read an instance of :py:class:`.types.EntityMetadata` from :paramref:`iterator`, including the end element. :param element: start element :param iterator: Input stream of ``(event, element)`` coming from :py:func:`xml.etree.ElementTree.iterparse` with the argument ``events=["start", "end"]`` :raise: :py:class:`DeserializationException` if unexpected input :return: parsed instance """ return _read_named_element( element, iterator, "entityMetadata", _read_entity_metadata_as_sequence ) def _read_capability_metadata_as_sequence( element: Element, iterator: Iterator[Tuple[str, Element]] ) -> our_types.CapabilityMetadata: """ Read an instance of :py:class:`.types.CapabilityMetadata` as a sequence of XML-encoded properties. The end element corresponding to the :paramref:`element` will be read as well. :param element: start element, parent of the sequence :param iterator: Input stream of ``(event, element)`` coming from :py:func:`xml.etree.ElementTree.iterparse` with the argument ``events=["start", "end"]`` :raise: :py:class:`DeserializationException` if unexpected input :return: parsed instance """ values = _read_properties(element, iterator, _READERS_FOR_CAPABILITY_METADATA) the_extensions: Optional[List[our_types.Extension]] = values.get("extensions") the_category: Optional[str] = values.get("category") the_id_short: Optional[str] = values.get("idShort") the_display_name: Optional[List[our_types.LangStringNameType]] = values.get( "displayName" ) the_description: Optional[List[our_types.LangStringTextType]] = values.get( "description" ) the_semantic_id: Optional[our_types.Reference] = values.get("semanticId") the_supplemental_semantic_ids: Optional[List[our_types.Reference]] = values.get( "supplementalSemanticIds" ) the_qualifiers: Optional[List[our_types.Qualifier]] = values.get("qualifiers") the_embedded_data_specifications: Optional[ List[our_types.EmbeddedDataSpecification] ] = values.get("embeddedDataSpecifications") return our_types.CapabilityMetadata( the_extensions, the_category, the_id_short, the_display_name, the_description, the_semantic_id, the_supplemental_semantic_ids, the_qualifiers, the_embedded_data_specifications, ) def _read_capability_metadata_as_element( element: Element, iterator: Iterator[Tuple[str, Element]] ) -> our_types.CapabilityMetadata: """ Read an instance of :py:class:`.types.CapabilityMetadata` from :paramref:`iterator`, including the end element. :param element: start element :param iterator: Input stream of ``(event, element)`` coming from :py:func:`xml.etree.ElementTree.iterparse` with the argument ``events=["start", "end"]`` :raise: :py:class:`DeserializationException` if unexpected input :return: parsed instance """ return _read_named_element( element, iterator, "capabilityMetadata", _read_capability_metadata_as_sequence ) def _read_operation_metadata_as_sequence( element: Element, iterator: Iterator[Tuple[str, Element]] ) -> our_types.OperationMetadata: """ Read an instance of :py:class:`.types.OperationMetadata` as a sequence of XML-encoded properties. The end element corresponding to the :paramref:`element` will be read as well. :param element: start element, parent of the sequence :param iterator: Input stream of ``(event, element)`` coming from :py:func:`xml.etree.ElementTree.iterparse` with the argument ``events=["start", "end"]`` :raise: :py:class:`DeserializationException` if unexpected input :return: parsed instance """ values = _read_properties(element, iterator, _READERS_FOR_OPERATION_METADATA) the_extensions: Optional[List[our_types.Extension]] = values.get("extensions") the_category: Optional[str] = values.get("category") the_id_short: Optional[str] = values.get("idShort") the_display_name: Optional[List[our_types.LangStringNameType]] = values.get( "displayName" ) the_description: Optional[List[our_types.LangStringTextType]] = values.get( "description" ) the_semantic_id: Optional[our_types.Reference] = values.get("semanticId") the_supplemental_semantic_ids: Optional[List[our_types.Reference]] = values.get( "supplementalSemanticIds" ) the_qualifiers: Optional[List[our_types.Qualifier]] = values.get("qualifiers") the_embedded_data_specifications: Optional[ List[our_types.EmbeddedDataSpecification] ] = values.get("embeddedDataSpecifications") return our_types.OperationMetadata( the_extensions, the_category, the_id_short, the_display_name, the_description, the_semantic_id, the_supplemental_semantic_ids, the_qualifiers, the_embedded_data_specifications, ) def _read_operation_metadata_as_element( element: Element, iterator: Iterator[Tuple[str, Element]] ) -> our_types.OperationMetadata: """ Read an instance of :py:class:`.types.OperationMetadata` from :paramref:`iterator`, including the end element. :param element: start element :param iterator: Input stream of ``(event, element)`` coming from :py:func:`xml.etree.ElementTree.iterparse` with the argument ``events=["start", "end"]`` :raise: :py:class:`DeserializationException` if unexpected input :return: parsed instance """ return _read_named_element( element, iterator, "operationMetadata", _read_operation_metadata_as_sequence ) def _read_submodel_element_collection_metadata_as_sequence( element: Element, iterator: Iterator[Tuple[str, Element]] ) -> our_types.SubmodelElementCollectionMetadata: """ Read an instance of :py:class:`.types.SubmodelElementCollectionMetadata` as a sequence of XML-encoded properties. The end element corresponding to the :paramref:`element` will be read as well. :param element: start element, parent of the sequence :param iterator: Input stream of ``(event, element)`` coming from :py:func:`xml.etree.ElementTree.iterparse` with the argument ``events=["start", "end"]`` :raise: :py:class:`DeserializationException` if unexpected input :return: parsed instance """ values = _read_properties( element, iterator, _READERS_FOR_SUBMODEL_ELEMENT_COLLECTION_METADATA ) the_extensions: Optional[List[our_types.Extension]] = values.get("extensions") the_category: Optional[str] = values.get("category") the_id_short: Optional[str] = values.get("idShort") the_display_name: Optional[List[our_types.LangStringNameType]] = values.get( "displayName" ) the_description: Optional[List[our_types.LangStringTextType]] = values.get( "description" ) the_semantic_id: Optional[our_types.Reference] = values.get("semanticId") the_supplemental_semantic_ids: Optional[List[our_types.Reference]] = values.get( "supplementalSemanticIds" ) the_qualifiers: Optional[List[our_types.Qualifier]] = values.get("qualifiers") the_embedded_data_specifications: Optional[ List[our_types.EmbeddedDataSpecification] ] = values.get("embeddedDataSpecifications") return our_types.SubmodelElementCollectionMetadata( the_extensions, the_category, the_id_short, the_display_name, the_description, the_semantic_id, the_supplemental_semantic_ids, the_qualifiers, the_embedded_data_specifications, ) def _read_submodel_element_collection_metadata_as_element( element: Element, iterator: Iterator[Tuple[str, Element]] ) -> our_types.SubmodelElementCollectionMetadata: """ Read an instance of :py:class:`.types.SubmodelElementCollectionMetadata` from :paramref:`iterator`, including the end element. :param element: start element :param iterator: Input stream of ``(event, element)`` coming from :py:func:`xml.etree.ElementTree.iterparse` with the argument ``events=["start", "end"]`` :raise: :py:class:`DeserializationException` if unexpected input :return: parsed instance """ return _read_named_element( element, iterator, "submodelElementCollectionMetadata", _read_submodel_element_collection_metadata_as_sequence, ) def _read_basic_event_element_metadata_as_sequence( element: Element, iterator: Iterator[Tuple[str, Element]] ) -> our_types.BasicEventElementMetadata: """ Read an instance of :py:class:`.types.BasicEventElementMetadata` as a sequence of XML-encoded properties. The end element corresponding to the :paramref:`element` will be read as well. :param element: start element, parent of the sequence :param iterator: Input stream of ``(event, element)`` coming from :py:func:`xml.etree.ElementTree.iterparse` with the argument ``events=["start", "end"]`` :raise: :py:class:`DeserializationException` if unexpected input :return: parsed instance """ values = _read_properties( element, iterator, _READERS_FOR_BASIC_EVENT_ELEMENT_METADATA ) the_extensions: Optional[List[our_types.Extension]] = values.get("extensions") the_category: Optional[str] = values.get("category") the_id_short: Optional[str] = values.get("idShort") the_display_name: Optional[List[our_types.LangStringNameType]] = values.get( "displayName" ) the_description: Optional[List[our_types.LangStringTextType]] = values.get( "description" ) the_semantic_id: Optional[our_types.Reference] = values.get("semanticId") the_supplemental_semantic_ids: Optional[List[our_types.Reference]] = values.get( "supplementalSemanticIds" ) the_qualifiers: Optional[List[our_types.Qualifier]] = values.get("qualifiers") the_embedded_data_specifications: Optional[ List[our_types.EmbeddedDataSpecification] ] = values.get("embeddedDataSpecifications") the_direction: Optional[our_types.Direction] = values.get("direction") the_state: Optional[our_types.StateOfEvent] = values.get("state") the_message_topic: Optional[str] = values.get("messageTopic") the_message_broker: Optional[our_types.Reference] = values.get("messageBroker") the_last_update: Optional[str] = values.get("lastUpdate") the_min_interval: Optional[str] = values.get("minInterval") the_max_interval: Optional[str] = values.get("maxInterval") if the_direction is None: raise DeserializationException("The required property 'direction' is missing") if the_state is None: raise DeserializationException("The required property 'state' is missing") return our_types.BasicEventElementMetadata( the_direction, the_state, the_extensions, the_category, the_id_short, the_display_name, the_description, the_semantic_id, the_supplemental_semantic_ids, the_qualifiers, the_embedded_data_specifications, the_message_topic, the_message_broker, the_last_update, the_min_interval, the_max_interval, ) def _read_basic_event_element_metadata_as_element( element: Element, iterator: Iterator[Tuple[str, Element]] ) -> our_types.BasicEventElementMetadata: """ Read an instance of :py:class:`.types.BasicEventElementMetadata` from :paramref:`iterator`, including the end element. :param element: start element :param iterator: Input stream of ``(event, element)`` coming from :py:func:`xml.etree.ElementTree.iterparse` with the argument ``events=["start", "end"]`` :raise: :py:class:`DeserializationException` if unexpected input :return: parsed instance """ return _read_named_element( element, iterator, "basicEventElementMetadata", _read_basic_event_element_metadata_as_sequence, ) def _read_submodel_element_list_metadata_as_sequence( element: Element, iterator: Iterator[Tuple[str, Element]] ) -> our_types.SubmodelElementListMetadata: """ Read an instance of :py:class:`.types.SubmodelElementListMetadata` as a sequence of XML-encoded properties. The end element corresponding to the :paramref:`element` will be read as well. :param element: start element, parent of the sequence :param iterator: Input stream of ``(event, element)`` coming from :py:func:`xml.etree.ElementTree.iterparse` with the argument ``events=["start", "end"]`` :raise: :py:class:`DeserializationException` if unexpected input :return: parsed instance """ values = _read_properties( element, iterator, _READERS_FOR_SUBMODEL_ELEMENT_LIST_METADATA ) the_extensions: Optional[List[our_types.Extension]] = values.get("extensions") the_category: Optional[str] = values.get("category") the_id_short: Optional[str] = values.get("idShort") the_display_name: Optional[List[our_types.LangStringNameType]] = values.get( "displayName" ) the_description: Optional[List[our_types.LangStringTextType]] = values.get( "description" ) the_semantic_id: Optional[our_types.Reference] = values.get("semanticId") the_supplemental_semantic_ids: Optional[List[our_types.Reference]] = values.get( "supplementalSemanticIds" ) the_qualifiers: Optional[List[our_types.Qualifier]] = values.get("qualifiers") the_embedded_data_specifications: Optional[ List[our_types.EmbeddedDataSpecification] ] = values.get("embeddedDataSpecifications") the_order_relevant: Optional[bool] = values.get("orderRelevant") the_semantic_id_list_element: Optional[our_types.Reference] = values.get( "semanticIdListElement" ) the_type_value_list_element: Optional[our_types.AASSubmodelElements] = values.get( "typeValueListElement" ) the_value_type_list_element: Optional[our_types.DataTypeDefXSD] = values.get( "valueTypeListElement" ) if the_type_value_list_element is None: raise DeserializationException( "The required property 'typeValueListElement' is missing" ) return our_types.SubmodelElementListMetadata( the_type_value_list_element, the_extensions, the_category, the_id_short, the_display_name, the_description, the_semantic_id, the_supplemental_semantic_ids, the_qualifiers, the_embedded_data_specifications, the_order_relevant, the_semantic_id_list_element, the_value_type_list_element, ) def _read_submodel_element_list_metadata_as_element( element: Element, iterator: Iterator[Tuple[str, Element]] ) -> our_types.SubmodelElementListMetadata: """ Read an instance of :py:class:`.types.SubmodelElementListMetadata` from :paramref:`iterator`, including the end element. :param element: start element :param iterator: Input stream of ``(event, element)`` coming from :py:func:`xml.etree.ElementTree.iterparse` with the argument ``events=["start", "end"]`` :raise: :py:class:`DeserializationException` if unexpected input :return: parsed instance """ return _read_named_element( element, iterator, "submodelElementListMetadata", _read_submodel_element_list_metadata_as_sequence, ) def _read_submodel_metadata_as_sequence( element: Element, iterator: Iterator[Tuple[str, Element]] ) -> our_types.SubmodelMetadata: """ Read an instance of :py:class:`.types.SubmodelMetadata` as a sequence of XML-encoded properties. The end element corresponding to the :paramref:`element` will be read as well. :param element: start element, parent of the sequence :param iterator: Input stream of ``(event, element)`` coming from :py:func:`xml.etree.ElementTree.iterparse` with the argument ``events=["start", "end"]`` :raise: :py:class:`DeserializationException` if unexpected input :return: parsed instance """ values = _read_properties(element, iterator, _READERS_FOR_SUBMODEL_METADATA) the_extensions: Optional[List[our_types.Extension]] = values.get("extensions") the_category: Optional[str] = values.get("category") the_id_short: Optional[str] = values.get("idShort") the_display_name: Optional[List[our_types.LangStringNameType]] = values.get( "displayName" ) the_description: Optional[List[our_types.LangStringTextType]] = values.get( "description" ) the_administration: Optional[our_types.AdministrativeInformation] = values.get( "administration" ) the_id: Optional[str] = values.get("id") the_kind: Optional[our_types.ModellingKind] = values.get("kind") the_semantic_id: Optional[our_types.Reference] = values.get("semanticId") the_supplemental_semantic_ids: Optional[List[our_types.Reference]] = values.get( "supplementalSemanticIds" ) the_qualifiers: Optional[List[our_types.Qualifier]] = values.get("qualifiers") the_embedded_data_specifications: Optional[ List[our_types.EmbeddedDataSpecification] ] = values.get("embeddedDataSpecifications") if the_id is None: raise DeserializationException("The required property 'id' is missing") return our_types.SubmodelMetadata( the_id, the_extensions, the_category, the_id_short, the_display_name, the_description, the_administration, the_kind, the_semantic_id, the_supplemental_semantic_ids, the_qualifiers, the_embedded_data_specifications, ) def _read_submodel_metadata_as_element( element: Element, iterator: Iterator[Tuple[str, Element]] ) -> our_types.SubmodelMetadata: """ Read an instance of :py:class:`.types.SubmodelMetadata` from :paramref:`iterator`, including the end element. :param element: start element :param iterator: Input stream of ``(event, element)`` coming from :py:func:`xml.etree.ElementTree.iterparse` with the argument ``events=["start", "end"]`` :raise: :py:class:`DeserializationException` if unexpected input :return: parsed instance """ return _read_named_element( element, iterator, "submodelMetadata", _read_submodel_metadata_as_sequence ) def _read_asset_administration_shell_metadata_as_sequence( element: Element, iterator: Iterator[Tuple[str, Element]] ) -> our_types.AssetAdministrationShellMetadata: """ Read an instance of :py:class:`.types.AssetAdministrationShellMetadata` as a sequence of XML-encoded properties. The end element corresponding to the :paramref:`element` will be read as well. :param element: start element, parent of the sequence :param iterator: Input stream of ``(event, element)`` coming from :py:func:`xml.etree.ElementTree.iterparse` with the argument ``events=["start", "end"]`` :raise: :py:class:`DeserializationException` if unexpected input :return: parsed instance """ values = _read_properties( element, iterator, _READERS_FOR_ASSET_ADMINISTRATION_SHELL_METADATA ) the_extensions: Optional[List[our_types.Extension]] = values.get("extensions") the_category: Optional[str] = values.get("category") the_id_short: Optional[str] = values.get("idShort") the_display_name: Optional[List[our_types.LangStringNameType]] = values.get( "displayName" ) the_description: Optional[List[our_types.LangStringTextType]] = values.get( "description" ) the_administration: Optional[our_types.AdministrativeInformation] = values.get( "administration" ) the_id: Optional[str] = values.get("id") the_embedded_data_specifications: Optional[ List[our_types.EmbeddedDataSpecification] ] = values.get("embeddedDataSpecifications") the_derived_from: Optional[our_types.Reference] = values.get("derivedFrom") if the_id is None: raise DeserializationException("The required property 'id' is missing") return our_types.AssetAdministrationShellMetadata( the_id, the_extensions, the_category, the_id_short, the_display_name, the_description, the_administration, the_embedded_data_specifications, the_derived_from, ) def _read_asset_administration_shell_metadata_as_element( element: Element, iterator: Iterator[Tuple[str, Element]] ) -> our_types.AssetAdministrationShellMetadata: """ Read an instance of :py:class:`.types.AssetAdministrationShellMetadata` from :paramref:`iterator`, including the end element. :param element: start element :param iterator: Input stream of ``(event, element)`` coming from :py:func:`xml.etree.ElementTree.iterparse` with the argument ``events=["start", "end"]`` :raise: :py:class:`DeserializationException` if unexpected input :return: parsed instance """ return _read_named_element( element, iterator, "assetAdministrationShellMetadata", _read_asset_administration_shell_metadata_as_sequence, ) def _read_reference_element_value_as_sequence( element: Element, iterator: Iterator[Tuple[str, Element]] ) -> our_types.ReferenceElementValue: """ Read an instance of :py:class:`.types.ReferenceElementValue` as a sequence of XML-encoded properties. The end element corresponding to the :paramref:`element` will be read as well. :param element: start element, parent of the sequence :param iterator: Input stream of ``(event, element)`` coming from :py:func:`xml.etree.ElementTree.iterparse` with the argument ``events=["start", "end"]`` :raise: :py:class:`DeserializationException` if unexpected input :return: parsed instance """ values = _read_properties(element, iterator, _READERS_FOR_REFERENCE_ELEMENT_VALUE) the_type: Optional[our_types.ReferenceTypes] = values.get("type") the_keys: Optional[List[our_types.Key]] = values.get("keys") the_referred_semantic_id: Optional[our_types.Reference] = values.get( "referredSemanticId" ) if the_type is None: raise DeserializationException("The required property 'type' is missing") if the_keys is None: raise DeserializationException("The required property 'keys' is missing") return our_types.ReferenceElementValue(the_type, the_keys, the_referred_semantic_id) def _read_reference_element_value_as_element( element: Element, iterator: Iterator[Tuple[str, Element]] ) -> our_types.ReferenceElementValue: """ Read an instance of :py:class:`.types.ReferenceElementValue` from :paramref:`iterator`, including the end element. :param element: start element :param iterator: Input stream of ``(event, element)`` coming from :py:func:`xml.etree.ElementTree.iterparse` with the argument ``events=["start", "end"]`` :raise: :py:class:`DeserializationException` if unexpected input :return: parsed instance """ return _read_named_element( element, iterator, "referenceElementValue", _read_reference_element_value_as_sequence, ) def _read_blob_value_as_sequence( element: Element, iterator: Iterator[Tuple[str, Element]] ) -> our_types.BlobValue: """ Read an instance of :py:class:`.types.BlobValue` as a sequence of XML-encoded properties. The end element corresponding to the :paramref:`element` will be read as well. :param element: start element, parent of the sequence :param iterator: Input stream of ``(event, element)`` coming from :py:func:`xml.etree.ElementTree.iterparse` with the argument ``events=["start", "end"]`` :raise: :py:class:`DeserializationException` if unexpected input :return: parsed instance """ values = _read_properties(element, iterator, _READERS_FOR_BLOB_VALUE) the_content_type: Optional[str] = values.get("contentType") the_value: Optional[bytes] = values.get("value") return our_types.BlobValue(the_content_type, the_value) def _read_blob_value_as_element( element: Element, iterator: Iterator[Tuple[str, Element]] ) -> our_types.BlobValue: """ Read an instance of :py:class:`.types.BlobValue` from :paramref:`iterator`, including the end element. :param element: start element :param iterator: Input stream of ``(event, element)`` coming from :py:func:`xml.etree.ElementTree.iterparse` with the argument ``events=["start", "end"]`` :raise: :py:class:`DeserializationException` if unexpected input :return: parsed instance """ return _read_named_element( element, iterator, "blobValue", _read_blob_value_as_sequence ) def _read_file_value_as_sequence( element: Element, iterator: Iterator[Tuple[str, Element]] ) -> our_types.FileValue: """ Read an instance of :py:class:`.types.FileValue` as a sequence of XML-encoded properties. The end element corresponding to the :paramref:`element` will be read as well. :param element: start element, parent of the sequence :param iterator: Input stream of ``(event, element)`` coming from :py:func:`xml.etree.ElementTree.iterparse` with the argument ``events=["start", "end"]`` :raise: :py:class:`DeserializationException` if unexpected input :return: parsed instance """ values = _read_properties(element, iterator, _READERS_FOR_FILE_VALUE) the_content_type: Optional[str] = values.get("contentType") the_value: Optional[str] = values.get("value") return our_types.FileValue(the_content_type, the_value) def _read_file_value_as_element( element: Element, iterator: Iterator[Tuple[str, Element]] ) -> our_types.FileValue: """ Read an instance of :py:class:`.types.FileValue` from :paramref:`iterator`, including the end element. :param element: start element :param iterator: Input stream of ``(event, element)`` coming from :py:func:`xml.etree.ElementTree.iterparse` with the argument ``events=["start", "end"]`` :raise: :py:class:`DeserializationException` if unexpected input :return: parsed instance """ return _read_named_element( element, iterator, "fileValue", _read_file_value_as_sequence ) def _read_range_value_as_sequence( element: Element, iterator: Iterator[Tuple[str, Element]] ) -> our_types.RangeValue: """ Read an instance of :py:class:`.types.RangeValue` as a sequence of XML-encoded properties. The end element corresponding to the :paramref:`element` will be read as well. :param element: start element, parent of the sequence :param iterator: Input stream of ``(event, element)`` coming from :py:func:`xml.etree.ElementTree.iterparse` with the argument ``events=["start", "end"]`` :raise: :py:class:`DeserializationException` if unexpected input :return: parsed instance """ values = _read_properties(element, iterator, _READERS_FOR_RANGE_VALUE) the_min: Optional[float] = values.get("min") the_max: Optional[float] = values.get("max") if the_min is None: raise DeserializationException("The required property 'min' is missing") if the_max is None: raise DeserializationException("The required property 'max' is missing") return our_types.RangeValue(the_min, the_max) def _read_range_value_as_element( element: Element, iterator: Iterator[Tuple[str, Element]] ) -> our_types.RangeValue: """ Read an instance of :py:class:`.types.RangeValue` from :paramref:`iterator`, including the end element. :param element: start element :param iterator: Input stream of ``(event, element)`` coming from :py:func:`xml.etree.ElementTree.iterparse` with the argument ``events=["start", "end"]`` :raise: :py:class:`DeserializationException` if unexpected input :return: parsed instance """ return _read_named_element( element, iterator, "rangeValue", _read_range_value_as_sequence ) def _read_relationship_element_value_as_sequence( element: Element, iterator: Iterator[Tuple[str, Element]] ) -> our_types.RelationshipElementValue: """ Read an instance of :py:class:`.types.RelationshipElementValue` as a sequence of XML-encoded properties. The end element corresponding to the :paramref:`element` will be read as well. :param element: start element, parent of the sequence :param iterator: Input stream of ``(event, element)`` coming from :py:func:`xml.etree.ElementTree.iterparse` with the argument ``events=["start", "end"]`` :raise: :py:class:`DeserializationException` if unexpected input :return: parsed instance """ values = _read_properties( element, iterator, _READERS_FOR_RELATIONSHIP_ELEMENT_VALUE ) the_first: Optional[our_types.Reference] = values.get("first") the_second: Optional[our_types.Reference] = values.get("second") return our_types.RelationshipElementValue(the_first, the_second) def _read_relationship_element_value_as_element( element: Element, iterator: Iterator[Tuple[str, Element]] ) -> our_types.RelationshipElementValue: """ Read an instance of :py:class:`.types.RelationshipElementValue` from :paramref:`iterator`, including the end element. :param element: start element :param iterator: Input stream of ``(event, element)`` coming from :py:func:`xml.etree.ElementTree.iterparse` with the argument ``events=["start", "end"]`` :raise: :py:class:`DeserializationException` if unexpected input :return: parsed instance """ return _read_named_element( element, iterator, "relationshipElementValue", _read_relationship_element_value_as_sequence, ) def _read_basic_event_element_value_as_sequence( element: Element, iterator: Iterator[Tuple[str, Element]] ) -> our_types.BasicEventElementValue: """ Read an instance of :py:class:`.types.BasicEventElementValue` as a sequence of XML-encoded properties. The end element corresponding to the :paramref:`element` will be read as well. :param element: start element, parent of the sequence :param iterator: Input stream of ``(event, element)`` coming from :py:func:`xml.etree.ElementTree.iterparse` with the argument ``events=["start", "end"]`` :raise: :py:class:`DeserializationException` if unexpected input :return: parsed instance """ values = _read_properties(element, iterator, _READERS_FOR_BASIC_EVENT_ELEMENT_VALUE) the_observed: Optional[our_types.Reference] = values.get("observed") if the_observed is None: raise DeserializationException("The required property 'observed' is missing") return our_types.BasicEventElementValue(the_observed) def _read_basic_event_element_value_as_element( element: Element, iterator: Iterator[Tuple[str, Element]] ) -> our_types.BasicEventElementValue: """ Read an instance of :py:class:`.types.BasicEventElementValue` from :paramref:`iterator`, including the end element. :param element: start element :param iterator: Input stream of ``(event, element)`` coming from :py:func:`xml.etree.ElementTree.iterparse` with the argument ``events=["start", "end"]`` :raise: :py:class:`DeserializationException` if unexpected input :return: parsed instance """ return _read_named_element( element, iterator, "basicEventElementValue", _read_basic_event_element_value_as_sequence, ) def _read_annotated_relationship_element_value_as_sequence( element: Element, iterator: Iterator[Tuple[str, Element]] ) -> our_types.AnnotatedRelationshipElementValue: """ Read an instance of :py:class:`.types.AnnotatedRelationshipElementValue` as a sequence of XML-encoded properties. The end element corresponding to the :paramref:`element` will be read as well. :param element: start element, parent of the sequence :param iterator: Input stream of ``(event, element)`` coming from :py:func:`xml.etree.ElementTree.iterparse` with the argument ``events=["start", "end"]`` :raise: :py:class:`DeserializationException` if unexpected input :return: parsed instance """ values = _read_properties( element, iterator, _READERS_FOR_ANNOTATED_RELATIONSHIP_ELEMENT_VALUE ) the_first: Optional[our_types.Reference] = values.get("first") the_second: Optional[our_types.Reference] = values.get("second") the_annotations: Optional[our_types.JsonObject] = values.get("annotations") return our_types.AnnotatedRelationshipElementValue( the_first, the_second, the_annotations ) def _read_annotated_relationship_element_value_as_element( element: Element, iterator: Iterator[Tuple[str, Element]] ) -> our_types.AnnotatedRelationshipElementValue: """ Read an instance of :py:class:`.types.AnnotatedRelationshipElementValue` from :paramref:`iterator`, including the end element. :param element: start element :param iterator: Input stream of ``(event, element)`` coming from :py:func:`xml.etree.ElementTree.iterparse` with the argument ``events=["start", "end"]`` :raise: :py:class:`DeserializationException` if unexpected input :return: parsed instance """ return _read_named_element( element, iterator, "annotatedRelationshipElementValue", _read_annotated_relationship_element_value_as_sequence, ) def _read_entity_value_as_sequence( element: Element, iterator: Iterator[Tuple[str, Element]] ) -> our_types.EntityValue: """ Read an instance of :py:class:`.types.EntityValue` as a sequence of XML-encoded properties. The end element corresponding to the :paramref:`element` will be read as well. :param element: start element, parent of the sequence :param iterator: Input stream of ``(event, element)`` coming from :py:func:`xml.etree.ElementTree.iterparse` with the argument ``events=["start", "end"]`` :raise: :py:class:`DeserializationException` if unexpected input :return: parsed instance """ values = _read_properties(element, iterator, _READERS_FOR_ENTITY_VALUE) the_entity_type: Optional[our_types.EntityType] = values.get("entityType") the_global_asset_id: Optional[str] = values.get("globalAssetId") the_specific_asset_ids: Optional[List[our_types.JsonObject]] = values.get( "specificAssetIds" ) the_statements: Optional[our_types.JsonObject] = values.get("statements") return our_types.EntityValue( the_entity_type, the_global_asset_id, the_specific_asset_ids, the_statements ) def _read_entity_value_as_element( element: Element, iterator: Iterator[Tuple[str, Element]] ) -> our_types.EntityValue: """ Read an instance of :py:class:`.types.EntityValue` from :paramref:`iterator`, including the end element. :param element: start element :param iterator: Input stream of ``(event, element)`` coming from :py:func:`xml.etree.ElementTree.iterparse` with the argument ``events=["start", "end"]`` :raise: :py:class:`DeserializationException` if unexpected input :return: parsed instance """ return _read_named_element( element, iterator, "entityValue", _read_entity_value_as_sequence ) def _read_get_asset_administration_shells_result_as_sequence( element: Element, iterator: Iterator[Tuple[str, Element]] ) -> our_types.GetAssetAdministrationShellsResult: """ Read an instance of :py:class:`.types.GetAssetAdministrationShellsResult` as a sequence of XML-encoded properties. The end element corresponding to the :paramref:`element` will be read as well. :param element: start element, parent of the sequence :param iterator: Input stream of ``(event, element)`` coming from :py:func:`xml.etree.ElementTree.iterparse` with the argument ``events=["start", "end"]`` :raise: :py:class:`DeserializationException` if unexpected input :return: parsed instance """ values = _read_properties( element, iterator, _READERS_FOR_GET_ASSET_ADMINISTRATION_SHELLS_RESULT ) the_paging_metadata: Optional[our_types.PagingMetadata] = values.get( "pagingMetadata" ) the_result: Optional[List[our_types.AssetAdministrationShell]] = values.get( "result" ) if the_paging_metadata is None: raise DeserializationException( "The required property 'pagingMetadata' is missing" ) return our_types.GetAssetAdministrationShellsResult(the_paging_metadata, the_result) def _read_get_asset_administration_shells_result_as_element( element: Element, iterator: Iterator[Tuple[str, Element]] ) -> our_types.GetAssetAdministrationShellsResult: """ Read an instance of :py:class:`.types.GetAssetAdministrationShellsResult` from :paramref:`iterator`, including the end element. :param element: start element :param iterator: Input stream of ``(event, element)`` coming from :py:func:`xml.etree.ElementTree.iterparse` with the argument ``events=["start", "end"]`` :raise: :py:class:`DeserializationException` if unexpected input :return: parsed instance """ return _read_named_element( element, iterator, "getAssetAdministrationShellsResult", _read_get_asset_administration_shells_result_as_sequence, ) def _read_get_asset_administration_shells_metadata_result_as_sequence( element: Element, iterator: Iterator[Tuple[str, Element]] ) -> our_types.GetAssetAdministrationShellsMetadataResult: """ Read an instance of :py:class:`.types.GetAssetAdministrationShellsMetadataResult` as a sequence of XML-encoded properties. The end element corresponding to the :paramref:`element` will be read as well. :param element: start element, parent of the sequence :param iterator: Input stream of ``(event, element)`` coming from :py:func:`xml.etree.ElementTree.iterparse` with the argument ``events=["start", "end"]`` :raise: :py:class:`DeserializationException` if unexpected input :return: parsed instance """ values = _read_properties( element, iterator, _READERS_FOR_GET_ASSET_ADMINISTRATION_SHELLS_METADATA_RESULT ) the_paging_metadata: Optional[our_types.PagingMetadata] = values.get( "pagingMetadata" ) the_result: Optional[List[our_types.AssetAdministrationShellMetadata]] = values.get( "result" ) if the_paging_metadata is None: raise DeserializationException( "The required property 'pagingMetadata' is missing" ) return our_types.GetAssetAdministrationShellsMetadataResult( the_paging_metadata, the_result ) def _read_get_asset_administration_shells_metadata_result_as_element( element: Element, iterator: Iterator[Tuple[str, Element]] ) -> our_types.GetAssetAdministrationShellsMetadataResult: """ Read an instance of :py:class:`.types.GetAssetAdministrationShellsMetadataResult` from :paramref:`iterator`, including the end element. :param element: start element :param iterator: Input stream of ``(event, element)`` coming from :py:func:`xml.etree.ElementTree.iterparse` with the argument ``events=["start", "end"]`` :raise: :py:class:`DeserializationException` if unexpected input :return: parsed instance """ return _read_named_element( element, iterator, "getAssetAdministrationShellsMetadataResult", _read_get_asset_administration_shells_metadata_result_as_sequence, ) def _read_get_all_asset_administration_shells_recent_changes_result_as_sequence( element: Element, iterator: Iterator[Tuple[str, Element]] ) -> our_types.GetAllAssetAdministrationShellsRecentChangesResult: """ Read an instance of :py:class:`.types.GetAllAssetAdministrationShellsRecentChangesResult` as a sequence of XML-encoded properties. The end element corresponding to the :paramref:`element` will be read as well. :param element: start element, parent of the sequence :param iterator: Input stream of ``(event, element)`` coming from :py:func:`xml.etree.ElementTree.iterparse` with the argument ``events=["start", "end"]`` :raise: :py:class:`DeserializationException` if unexpected input :return: parsed instance """ values = _read_properties( element, iterator, _READERS_FOR_GET_ALL_ASSET_ADMINISTRATION_SHELLS_RECENT_CHANGES_RESULT, ) the_paging_metadata: Optional[our_types.PagingMetadata] = values.get( "pagingMetadata" ) the_result: Optional[List[our_types.AssetAdministrationShellRecentChange]] = ( values.get("result") ) if the_paging_metadata is None: raise DeserializationException( "The required property 'pagingMetadata' is missing" ) return our_types.GetAllAssetAdministrationShellsRecentChangesResult( the_paging_metadata, the_result ) def _read_get_all_asset_administration_shells_recent_changes_result_as_element( element: Element, iterator: Iterator[Tuple[str, Element]] ) -> our_types.GetAllAssetAdministrationShellsRecentChangesResult: """ Read an instance of :py:class:`.types.GetAllAssetAdministrationShellsRecentChangesResult` from :paramref:`iterator`, including the end element. :param element: start element :param iterator: Input stream of ``(event, element)`` coming from :py:func:`xml.etree.ElementTree.iterparse` with the argument ``events=["start", "end"]`` :raise: :py:class:`DeserializationException` if unexpected input :return: parsed instance """ return _read_named_element( element, iterator, "getAllAssetAdministrationShellsRecentChangesResult", _read_get_all_asset_administration_shells_recent_changes_result_as_sequence, ) def _read_get_asset_administration_shell_descriptors_result_as_sequence( element: Element, iterator: Iterator[Tuple[str, Element]] ) -> our_types.GetAssetAdministrationShellDescriptorsResult: """ Read an instance of :py:class:`.types.GetAssetAdministrationShellDescriptorsResult` as a sequence of XML-encoded properties. The end element corresponding to the :paramref:`element` will be read as well. :param element: start element, parent of the sequence :param iterator: Input stream of ``(event, element)`` coming from :py:func:`xml.etree.ElementTree.iterparse` with the argument ``events=["start", "end"]`` :raise: :py:class:`DeserializationException` if unexpected input :return: parsed instance """ values = _read_properties( element, iterator, _READERS_FOR_GET_ASSET_ADMINISTRATION_SHELL_DESCRIPTORS_RESULT, ) the_paging_metadata: Optional[our_types.PagingMetadata] = values.get( "pagingMetadata" ) the_result: Optional[List[our_types.AssetAdministrationShellDescriptor]] = ( values.get("result") ) if the_paging_metadata is None: raise DeserializationException( "The required property 'pagingMetadata' is missing" ) return our_types.GetAssetAdministrationShellDescriptorsResult( the_paging_metadata, the_result ) def _read_get_asset_administration_shell_descriptors_result_as_element( element: Element, iterator: Iterator[Tuple[str, Element]] ) -> our_types.GetAssetAdministrationShellDescriptorsResult: """ Read an instance of :py:class:`.types.GetAssetAdministrationShellDescriptorsResult` from :paramref:`iterator`, including the end element. :param element: start element :param iterator: Input stream of ``(event, element)`` coming from :py:func:`xml.etree.ElementTree.iterparse` with the argument ``events=["start", "end"]`` :raise: :py:class:`DeserializationException` if unexpected input :return: parsed instance """ return _read_named_element( element, iterator, "getAssetAdministrationShellDescriptorsResult", _read_get_asset_administration_shell_descriptors_result_as_sequence, ) def _read_get_concept_descriptions_result_as_sequence( element: Element, iterator: Iterator[Tuple[str, Element]] ) -> our_types.GetConceptDescriptionsResult: """ Read an instance of :py:class:`.types.GetConceptDescriptionsResult` as a sequence of XML-encoded properties. The end element corresponding to the :paramref:`element` will be read as well. :param element: start element, parent of the sequence :param iterator: Input stream of ``(event, element)`` coming from :py:func:`xml.etree.ElementTree.iterparse` with the argument ``events=["start", "end"]`` :raise: :py:class:`DeserializationException` if unexpected input :return: parsed instance """ values = _read_properties( element, iterator, _READERS_FOR_GET_CONCEPT_DESCRIPTIONS_RESULT ) the_paging_metadata: Optional[our_types.PagingMetadata] = values.get( "pagingMetadata" ) the_result: Optional[List[our_types.ConceptDescription]] = values.get("result") if the_paging_metadata is None: raise DeserializationException( "The required property 'pagingMetadata' is missing" ) return our_types.GetConceptDescriptionsResult(the_paging_metadata, the_result) def _read_get_concept_descriptions_result_as_element( element: Element, iterator: Iterator[Tuple[str, Element]] ) -> our_types.GetConceptDescriptionsResult: """ Read an instance of :py:class:`.types.GetConceptDescriptionsResult` from :paramref:`iterator`, including the end element. :param element: start element :param iterator: Input stream of ``(event, element)`` coming from :py:func:`xml.etree.ElementTree.iterparse` with the argument ``events=["start", "end"]`` :raise: :py:class:`DeserializationException` if unexpected input :return: parsed instance """ return _read_named_element( element, iterator, "getConceptDescriptionsResult", _read_get_concept_descriptions_result_as_sequence, ) def _read_get_all_concept_descriptions_recent_changes_result_as_sequence( element: Element, iterator: Iterator[Tuple[str, Element]] ) -> our_types.GetAllConceptDescriptionsRecentChangesResult: """ Read an instance of :py:class:`.types.GetAllConceptDescriptionsRecentChangesResult` as a sequence of XML-encoded properties. The end element corresponding to the :paramref:`element` will be read as well. :param element: start element, parent of the sequence :param iterator: Input stream of ``(event, element)`` coming from :py:func:`xml.etree.ElementTree.iterparse` with the argument ``events=["start", "end"]`` :raise: :py:class:`DeserializationException` if unexpected input :return: parsed instance """ values = _read_properties( element, iterator, _READERS_FOR_GET_ALL_CONCEPT_DESCRIPTIONS_RECENT_CHANGES_RESULT, ) the_paging_metadata: Optional[our_types.PagingMetadata] = values.get( "pagingMetadata" ) the_result: Optional[List[our_types.ConceptDescriptionRecentChange]] = values.get( "result" ) if the_paging_metadata is None: raise DeserializationException( "The required property 'pagingMetadata' is missing" ) return our_types.GetAllConceptDescriptionsRecentChangesResult( the_paging_metadata, the_result ) def _read_get_all_concept_descriptions_recent_changes_result_as_element( element: Element, iterator: Iterator[Tuple[str, Element]] ) -> our_types.GetAllConceptDescriptionsRecentChangesResult: """ Read an instance of :py:class:`.types.GetAllConceptDescriptionsRecentChangesResult` from :paramref:`iterator`, including the end element. :param element: start element :param iterator: Input stream of ``(event, element)`` coming from :py:func:`xml.etree.ElementTree.iterparse` with the argument ``events=["start", "end"]`` :raise: :py:class:`DeserializationException` if unexpected input :return: parsed instance """ return _read_named_element( element, iterator, "getAllConceptDescriptionsRecentChangesResult", _read_get_all_concept_descriptions_recent_changes_result_as_sequence, ) def _read_get_package_descriptions_result_as_sequence( element: Element, iterator: Iterator[Tuple[str, Element]] ) -> our_types.GetPackageDescriptionsResult: """ Read an instance of :py:class:`.types.GetPackageDescriptionsResult` as a sequence of XML-encoded properties. The end element corresponding to the :paramref:`element` will be read as well. :param element: start element, parent of the sequence :param iterator: Input stream of ``(event, element)`` coming from :py:func:`xml.etree.ElementTree.iterparse` with the argument ``events=["start", "end"]`` :raise: :py:class:`DeserializationException` if unexpected input :return: parsed instance """ values = _read_properties( element, iterator, _READERS_FOR_GET_PACKAGE_DESCRIPTIONS_RESULT ) the_paging_metadata: Optional[our_types.PagingMetadata] = values.get( "pagingMetadata" ) the_result: Optional[List[our_types.PackageDescription]] = values.get("result") if the_paging_metadata is None: raise DeserializationException( "The required property 'pagingMetadata' is missing" ) return our_types.GetPackageDescriptionsResult(the_paging_metadata, the_result) def _read_get_package_descriptions_result_as_element( element: Element, iterator: Iterator[Tuple[str, Element]] ) -> our_types.GetPackageDescriptionsResult: """ Read an instance of :py:class:`.types.GetPackageDescriptionsResult` from :paramref:`iterator`, including the end element. :param element: start element :param iterator: Input stream of ``(event, element)`` coming from :py:func:`xml.etree.ElementTree.iterparse` with the argument ``events=["start", "end"]`` :raise: :py:class:`DeserializationException` if unexpected input :return: parsed instance """ return _read_named_element( element, iterator, "getPackageDescriptionsResult", _read_get_package_descriptions_result_as_sequence, ) def _read_get_path_items_result_as_sequence( element: Element, iterator: Iterator[Tuple[str, Element]] ) -> our_types.GetPathItemsResult: """ Read an instance of :py:class:`.types.GetPathItemsResult` as a sequence of XML-encoded properties. The end element corresponding to the :paramref:`element` will be read as well. :param element: start element, parent of the sequence :param iterator: Input stream of ``(event, element)`` coming from :py:func:`xml.etree.ElementTree.iterparse` with the argument ``events=["start", "end"]`` :raise: :py:class:`DeserializationException` if unexpected input :return: parsed instance """ values = _read_properties(element, iterator, _READERS_FOR_GET_PATH_ITEMS_RESULT) the_paging_metadata: Optional[our_types.PagingMetadata] = values.get( "pagingMetadata" ) the_result: Optional[List[str]] = values.get("result") if the_paging_metadata is None: raise DeserializationException( "The required property 'pagingMetadata' is missing" ) return our_types.GetPathItemsResult(the_paging_metadata, the_result) def _read_get_path_items_result_as_element( element: Element, iterator: Iterator[Tuple[str, Element]] ) -> our_types.GetPathItemsResult: """ Read an instance of :py:class:`.types.GetPathItemsResult` from :paramref:`iterator`, including the end element. :param element: start element :param iterator: Input stream of ``(event, element)`` coming from :py:func:`xml.etree.ElementTree.iterparse` with the argument ``events=["start", "end"]`` :raise: :py:class:`DeserializationException` if unexpected input :return: parsed instance """ return _read_named_element( element, iterator, "getPathItemsResult", _read_get_path_items_result_as_sequence ) def _read_get_references_result_as_sequence( element: Element, iterator: Iterator[Tuple[str, Element]] ) -> our_types.GetReferencesResult: """ Read an instance of :py:class:`.types.GetReferencesResult` as a sequence of XML-encoded properties. The end element corresponding to the :paramref:`element` will be read as well. :param element: start element, parent of the sequence :param iterator: Input stream of ``(event, element)`` coming from :py:func:`xml.etree.ElementTree.iterparse` with the argument ``events=["start", "end"]`` :raise: :py:class:`DeserializationException` if unexpected input :return: parsed instance """ values = _read_properties(element, iterator, _READERS_FOR_GET_REFERENCES_RESULT) the_paging_metadata: Optional[our_types.PagingMetadata] = values.get( "pagingMetadata" ) the_result: Optional[List[our_types.Reference]] = values.get("result") if the_paging_metadata is None: raise DeserializationException( "The required property 'pagingMetadata' is missing" ) return our_types.GetReferencesResult(the_paging_metadata, the_result) def _read_get_references_result_as_element( element: Element, iterator: Iterator[Tuple[str, Element]] ) -> our_types.GetReferencesResult: """ Read an instance of :py:class:`.types.GetReferencesResult` from :paramref:`iterator`, including the end element. :param element: start element :param iterator: Input stream of ``(event, element)`` coming from :py:func:`xml.etree.ElementTree.iterparse` with the argument ``events=["start", "end"]`` :raise: :py:class:`DeserializationException` if unexpected input :return: parsed instance """ return _read_named_element( element, iterator, "getReferencesResult", _read_get_references_result_as_sequence, ) def _read_get_submodel_descriptors_result_as_sequence( element: Element, iterator: Iterator[Tuple[str, Element]] ) -> our_types.GetSubmodelDescriptorsResult: """ Read an instance of :py:class:`.types.GetSubmodelDescriptorsResult` as a sequence of XML-encoded properties. The end element corresponding to the :paramref:`element` will be read as well. :param element: start element, parent of the sequence :param iterator: Input stream of ``(event, element)`` coming from :py:func:`xml.etree.ElementTree.iterparse` with the argument ``events=["start", "end"]`` :raise: :py:class:`DeserializationException` if unexpected input :return: parsed instance """ values = _read_properties( element, iterator, _READERS_FOR_GET_SUBMODEL_DESCRIPTORS_RESULT ) the_paging_metadata: Optional[our_types.PagingMetadata] = values.get( "pagingMetadata" ) the_result: Optional[List[our_types.SubmodelDescriptor]] = values.get("result") if the_paging_metadata is None: raise DeserializationException( "The required property 'pagingMetadata' is missing" ) return our_types.GetSubmodelDescriptorsResult(the_paging_metadata, the_result) def _read_get_submodel_descriptors_result_as_element( element: Element, iterator: Iterator[Tuple[str, Element]] ) -> our_types.GetSubmodelDescriptorsResult: """ Read an instance of :py:class:`.types.GetSubmodelDescriptorsResult` from :paramref:`iterator`, including the end element. :param element: start element :param iterator: Input stream of ``(event, element)`` coming from :py:func:`xml.etree.ElementTree.iterparse` with the argument ``events=["start", "end"]`` :raise: :py:class:`DeserializationException` if unexpected input :return: parsed instance """ return _read_named_element( element, iterator, "getSubmodelDescriptorsResult", _read_get_submodel_descriptors_result_as_sequence, ) def _read_get_submodel_elements_metadata_result_as_sequence( element: Element, iterator: Iterator[Tuple[str, Element]] ) -> our_types.GetSubmodelElementsMetadataResult: """ Read an instance of :py:class:`.types.GetSubmodelElementsMetadataResult` as a sequence of XML-encoded properties. The end element corresponding to the :paramref:`element` will be read as well. :param element: start element, parent of the sequence :param iterator: Input stream of ``(event, element)`` coming from :py:func:`xml.etree.ElementTree.iterparse` with the argument ``events=["start", "end"]`` :raise: :py:class:`DeserializationException` if unexpected input :return: parsed instance """ values = _read_properties( element, iterator, _READERS_FOR_GET_SUBMODEL_ELEMENTS_METADATA_RESULT ) the_paging_metadata: Optional[our_types.PagingMetadata] = values.get( "pagingMetadata" ) the_result: Optional[List[our_types.SubmodelElementMetadata]] = values.get("result") if the_paging_metadata is None: raise DeserializationException( "The required property 'pagingMetadata' is missing" ) return our_types.GetSubmodelElementsMetadataResult(the_paging_metadata, the_result) def _read_get_submodel_elements_metadata_result_as_element( element: Element, iterator: Iterator[Tuple[str, Element]] ) -> our_types.GetSubmodelElementsMetadataResult: """ Read an instance of :py:class:`.types.GetSubmodelElementsMetadataResult` from :paramref:`iterator`, including the end element. :param element: start element :param iterator: Input stream of ``(event, element)`` coming from :py:func:`xml.etree.ElementTree.iterparse` with the argument ``events=["start", "end"]`` :raise: :py:class:`DeserializationException` if unexpected input :return: parsed instance """ return _read_named_element( element, iterator, "getSubmodelElementsMetadataResult", _read_get_submodel_elements_metadata_result_as_sequence, ) def _read_get_submodel_elements_result_as_sequence( element: Element, iterator: Iterator[Tuple[str, Element]] ) -> our_types.GetSubmodelElementsResult: """ Read an instance of :py:class:`.types.GetSubmodelElementsResult` as a sequence of XML-encoded properties. The end element corresponding to the :paramref:`element` will be read as well. :param element: start element, parent of the sequence :param iterator: Input stream of ``(event, element)`` coming from :py:func:`xml.etree.ElementTree.iterparse` with the argument ``events=["start", "end"]`` :raise: :py:class:`DeserializationException` if unexpected input :return: parsed instance """ values = _read_properties( element, iterator, _READERS_FOR_GET_SUBMODEL_ELEMENTS_RESULT ) the_paging_metadata: Optional[our_types.PagingMetadata] = values.get( "pagingMetadata" ) the_result: Optional[List[our_types.SubmodelElement]] = values.get("result") if the_paging_metadata is None: raise DeserializationException( "The required property 'pagingMetadata' is missing" ) return our_types.GetSubmodelElementsResult(the_paging_metadata, the_result) def _read_get_submodel_elements_result_as_element( element: Element, iterator: Iterator[Tuple[str, Element]] ) -> our_types.GetSubmodelElementsResult: """ Read an instance of :py:class:`.types.GetSubmodelElementsResult` from :paramref:`iterator`, including the end element. :param element: start element :param iterator: Input stream of ``(event, element)`` coming from :py:func:`xml.etree.ElementTree.iterparse` with the argument ``events=["start", "end"]`` :raise: :py:class:`DeserializationException` if unexpected input :return: parsed instance """ return _read_named_element( element, iterator, "getSubmodelElementsResult", _read_get_submodel_elements_result_as_sequence, ) def _read_get_submodel_elements_value_result_as_sequence( element: Element, iterator: Iterator[Tuple[str, Element]] ) -> our_types.GetSubmodelElementsValueResult: """ Read an instance of :py:class:`.types.GetSubmodelElementsValueResult` as a sequence of XML-encoded properties. The end element corresponding to the :paramref:`element` will be read as well. :param element: start element, parent of the sequence :param iterator: Input stream of ``(event, element)`` coming from :py:func:`xml.etree.ElementTree.iterparse` with the argument ``events=["start", "end"]`` :raise: :py:class:`DeserializationException` if unexpected input :return: parsed instance """ values = _read_properties( element, iterator, _READERS_FOR_GET_SUBMODEL_ELEMENTS_VALUE_RESULT ) the_paging_metadata: Optional[our_types.PagingMetadata] = values.get( "pagingMetadata" ) the_result: Optional[List[our_types.JsonObject]] = values.get("result") if the_paging_metadata is None: raise DeserializationException( "The required property 'pagingMetadata' is missing" ) return our_types.GetSubmodelElementsValueResult(the_paging_metadata, the_result) def _read_get_submodel_elements_value_result_as_element( element: Element, iterator: Iterator[Tuple[str, Element]] ) -> our_types.GetSubmodelElementsValueResult: """ Read an instance of :py:class:`.types.GetSubmodelElementsValueResult` from :paramref:`iterator`, including the end element. :param element: start element :param iterator: Input stream of ``(event, element)`` coming from :py:func:`xml.etree.ElementTree.iterparse` with the argument ``events=["start", "end"]`` :raise: :py:class:`DeserializationException` if unexpected input :return: parsed instance """ return _read_named_element( element, iterator, "getSubmodelElementsValueResult", _read_get_submodel_elements_value_result_as_sequence, ) def _read_get_all_submodels_recent_changes_result_as_sequence( element: Element, iterator: Iterator[Tuple[str, Element]] ) -> our_types.GetAllSubmodelsRecentChangesResult: """ Read an instance of :py:class:`.types.GetAllSubmodelsRecentChangesResult` as a sequence of XML-encoded properties. The end element corresponding to the :paramref:`element` will be read as well. :param element: start element, parent of the sequence :param iterator: Input stream of ``(event, element)`` coming from :py:func:`xml.etree.ElementTree.iterparse` with the argument ``events=["start", "end"]`` :raise: :py:class:`DeserializationException` if unexpected input :return: parsed instance """ values = _read_properties( element, iterator, _READERS_FOR_GET_ALL_SUBMODELS_RECENT_CHANGES_RESULT ) the_paging_metadata: Optional[our_types.PagingMetadata] = values.get( "pagingMetadata" ) the_result: Optional[List[our_types.SubmodelRecentChange]] = values.get("result") if the_paging_metadata is None: raise DeserializationException( "The required property 'pagingMetadata' is missing" ) return our_types.GetAllSubmodelsRecentChangesResult(the_paging_metadata, the_result) def _read_get_all_submodels_recent_changes_result_as_element( element: Element, iterator: Iterator[Tuple[str, Element]] ) -> our_types.GetAllSubmodelsRecentChangesResult: """ Read an instance of :py:class:`.types.GetAllSubmodelsRecentChangesResult` from :paramref:`iterator`, including the end element. :param element: start element :param iterator: Input stream of ``(event, element)`` coming from :py:func:`xml.etree.ElementTree.iterparse` with the argument ``events=["start", "end"]`` :raise: :py:class:`DeserializationException` if unexpected input :return: parsed instance """ return _read_named_element( element, iterator, "getAllSubmodelsRecentChangesResult", _read_get_all_submodels_recent_changes_result_as_sequence, ) def _read_get_submodels_metadata_result_as_sequence( element: Element, iterator: Iterator[Tuple[str, Element]] ) -> our_types.GetSubmodelsMetadataResult: """ Read an instance of :py:class:`.types.GetSubmodelsMetadataResult` as a sequence of XML-encoded properties. The end element corresponding to the :paramref:`element` will be read as well. :param element: start element, parent of the sequence :param iterator: Input stream of ``(event, element)`` coming from :py:func:`xml.etree.ElementTree.iterparse` with the argument ``events=["start", "end"]`` :raise: :py:class:`DeserializationException` if unexpected input :return: parsed instance """ values = _read_properties( element, iterator, _READERS_FOR_GET_SUBMODELS_METADATA_RESULT ) the_paging_metadata: Optional[our_types.PagingMetadata] = values.get( "pagingMetadata" ) the_result: Optional[List[our_types.SubmodelMetadata]] = values.get("result") if the_paging_metadata is None: raise DeserializationException( "The required property 'pagingMetadata' is missing" ) return our_types.GetSubmodelsMetadataResult(the_paging_metadata, the_result) def _read_get_submodels_metadata_result_as_element( element: Element, iterator: Iterator[Tuple[str, Element]] ) -> our_types.GetSubmodelsMetadataResult: """ Read an instance of :py:class:`.types.GetSubmodelsMetadataResult` from :paramref:`iterator`, including the end element. :param element: start element :param iterator: Input stream of ``(event, element)`` coming from :py:func:`xml.etree.ElementTree.iterparse` with the argument ``events=["start", "end"]`` :raise: :py:class:`DeserializationException` if unexpected input :return: parsed instance """ return _read_named_element( element, iterator, "getSubmodelsMetadataResult", _read_get_submodels_metadata_result_as_sequence, ) def _read_get_submodels_result_as_sequence( element: Element, iterator: Iterator[Tuple[str, Element]] ) -> our_types.GetSubmodelsResult: """ Read an instance of :py:class:`.types.GetSubmodelsResult` as a sequence of XML-encoded properties. The end element corresponding to the :paramref:`element` will be read as well. :param element: start element, parent of the sequence :param iterator: Input stream of ``(event, element)`` coming from :py:func:`xml.etree.ElementTree.iterparse` with the argument ``events=["start", "end"]`` :raise: :py:class:`DeserializationException` if unexpected input :return: parsed instance """ values = _read_properties(element, iterator, _READERS_FOR_GET_SUBMODELS_RESULT) the_paging_metadata: Optional[our_types.PagingMetadata] = values.get( "pagingMetadata" ) the_result: Optional[List[our_types.Submodel]] = values.get("result") if the_paging_metadata is None: raise DeserializationException( "The required property 'pagingMetadata' is missing" ) return our_types.GetSubmodelsResult(the_paging_metadata, the_result) def _read_get_submodels_result_as_element( element: Element, iterator: Iterator[Tuple[str, Element]] ) -> our_types.GetSubmodelsResult: """ Read an instance of :py:class:`.types.GetSubmodelsResult` from :paramref:`iterator`, including the end element. :param element: start element :param iterator: Input stream of ``(event, element)`` coming from :py:func:`xml.etree.ElementTree.iterparse` with the argument ``events=["start", "end"]`` :raise: :py:class:`DeserializationException` if unexpected input :return: parsed instance """ return _read_named_element( element, iterator, "getSubmodelsResult", _read_get_submodels_result_as_sequence ) def _read_get_submodels_value_result_as_sequence( element: Element, iterator: Iterator[Tuple[str, Element]] ) -> our_types.GetSubmodelsValueResult: """ Read an instance of :py:class:`.types.GetSubmodelsValueResult` as a sequence of XML-encoded properties. The end element corresponding to the :paramref:`element` will be read as well. :param element: start element, parent of the sequence :param iterator: Input stream of ``(event, element)`` coming from :py:func:`xml.etree.ElementTree.iterparse` with the argument ``events=["start", "end"]`` :raise: :py:class:`DeserializationException` if unexpected input :return: parsed instance """ values = _read_properties( element, iterator, _READERS_FOR_GET_SUBMODELS_VALUE_RESULT ) the_paging_metadata: Optional[our_types.PagingMetadata] = values.get( "pagingMetadata" ) the_result: Optional[List[our_types.JsonObject]] = values.get("result") if the_paging_metadata is None: raise DeserializationException( "The required property 'pagingMetadata' is missing" ) return our_types.GetSubmodelsValueResult(the_paging_metadata, the_result) def _read_get_submodels_value_result_as_element( element: Element, iterator: Iterator[Tuple[str, Element]] ) -> our_types.GetSubmodelsValueResult: """ Read an instance of :py:class:`.types.GetSubmodelsValueResult` from :paramref:`iterator`, including the end element. :param element: start element :param iterator: Input stream of ``(event, element)`` coming from :py:func:`xml.etree.ElementTree.iterparse` with the argument ``events=["start", "end"]`` :raise: :py:class:`DeserializationException` if unexpected input :return: parsed instance """ return _read_named_element( element, iterator, "getSubmodelsValueResult", _read_get_submodels_value_result_as_sequence, ) def _read_global_attribute_kind_from_element_text( element: Element, iterator: Iterator[Tuple[str, Element]] ) -> our_types.GlobalAttributeKind: """ Parse the text of :paramref:`element` as a literal of :py:class:`.types.GlobalAttributeKind`, and read the corresponding end element from :paramref:`iterator`. :param element: start element :param iterator: Input stream of ``(event, element)`` coming from :py:func:`xml.etree.ElementTree.iterparse` with the argument ``events=["start", "end"]`` :raise: :py:class:`DeserializationException` if unexpected input :return: parsed value """ return _read_enum_from_element_text( element, iterator, our_stringification.global_attribute_kind_from_str, "GlobalAttributeKind", ) def _read_date_time_global_attribute_kind_from_element_text( element: Element, iterator: Iterator[Tuple[str, Element]] ) -> our_types.DateTimeGlobalAttributeKind: """ Parse the text of :paramref:`element` as a literal of :py:class:`.types.DateTimeGlobalAttributeKind`, and read the corresponding end element from :paramref:`iterator`. :param element: start element :param iterator: Input stream of ``(event, element)`` coming from :py:func:`xml.etree.ElementTree.iterparse` with the argument ``events=["start", "end"]`` :raise: :py:class:`DeserializationException` if unexpected input :return: parsed value """ return _read_enum_from_element_text( element, iterator, our_stringification.date_time_global_attribute_kind_from_str, "DateTimeGlobalAttributeKind", ) def _read_claim_attribute_as_sequence( element: Element, iterator: Iterator[Tuple[str, Element]] ) -> our_types.ClaimAttribute: """ Read an instance of :py:class:`.types.ClaimAttribute` as a sequence of XML-encoded properties. The end element corresponding to the :paramref:`element` will be read as well. :param element: start element, parent of the sequence :param iterator: Input stream of ``(event, element)`` coming from :py:func:`xml.etree.ElementTree.iterparse` with the argument ``events=["start", "end"]`` :raise: :py:class:`DeserializationException` if unexpected input :return: parsed instance """ values = _read_properties(element, iterator, _READERS_FOR_CLAIM_ATTRIBUTE) the_claim: Optional[str] = values.get("claim") if the_claim is None: raise DeserializationException("The required property 'claim' is missing") return our_types.ClaimAttribute(the_claim) def _read_claim_attribute_as_element( element: Element, iterator: Iterator[Tuple[str, Element]] ) -> our_types.ClaimAttribute: """ Read an instance of :py:class:`.types.ClaimAttribute` from :paramref:`iterator`, including the end element. :param element: start element :param iterator: Input stream of ``(event, element)`` coming from :py:func:`xml.etree.ElementTree.iterparse` with the argument ``events=["start", "end"]`` :raise: :py:class:`DeserializationException` if unexpected input :return: parsed instance """ return _read_named_element( element, iterator, "claimAttribute", _read_claim_attribute_as_sequence ) def _read_global_attribute_as_sequence( element: Element, iterator: Iterator[Tuple[str, Element]] ) -> our_types.GlobalAttribute: """ Read an instance of :py:class:`.types.GlobalAttribute` as a sequence of XML-encoded properties. The end element corresponding to the :paramref:`element` will be read as well. :param element: start element, parent of the sequence :param iterator: Input stream of ``(event, element)`` coming from :py:func:`xml.etree.ElementTree.iterparse` with the argument ``events=["start", "end"]`` :raise: :py:class:`DeserializationException` if unexpected input :return: parsed instance """ values = _read_properties(element, iterator, _READERS_FOR_GLOBAL_ATTRIBUTE) the_kind: Optional[our_types.GlobalAttributeKind] = values.get("kind") if the_kind is None: raise DeserializationException("The required property 'kind' is missing") return our_types.GlobalAttribute(the_kind) def _read_global_attribute_as_element( element: Element, iterator: Iterator[Tuple[str, Element]] ) -> our_types.GlobalAttribute: """ Read an instance of :py:class:`.types.GlobalAttribute` from :paramref:`iterator`, including the end element. :param element: start element :param iterator: Input stream of ``(event, element)`` coming from :py:func:`xml.etree.ElementTree.iterparse` with the argument ``events=["start", "end"]`` :raise: :py:class:`DeserializationException` if unexpected input :return: parsed instance """ return _read_named_element( element, iterator, "globalAttribute", _read_global_attribute_as_sequence ) def _read_reference_attribute_as_sequence( element: Element, iterator: Iterator[Tuple[str, Element]] ) -> our_types.ReferenceAttribute: """ Read an instance of :py:class:`.types.ReferenceAttribute` as a sequence of XML-encoded properties. The end element corresponding to the :paramref:`element` will be read as well. :param element: start element, parent of the sequence :param iterator: Input stream of ``(event, element)`` coming from :py:func:`xml.etree.ElementTree.iterparse` with the argument ``events=["start", "end"]`` :raise: :py:class:`DeserializationException` if unexpected input :return: parsed instance """ values = _read_properties(element, iterator, _READERS_FOR_REFERENCE_ATTRIBUTE) the_reference: Optional[str] = values.get("reference") if the_reference is None: raise DeserializationException("The required property 'reference' is missing") return our_types.ReferenceAttribute(the_reference) def _read_reference_attribute_as_element( element: Element, iterator: Iterator[Tuple[str, Element]] ) -> our_types.ReferenceAttribute: """ Read an instance of :py:class:`.types.ReferenceAttribute` from :paramref:`iterator`, including the end element. :param element: start element :param iterator: Input stream of ``(event, element)`` coming from :py:func:`xml.etree.ElementTree.iterparse` with the argument ``events=["start", "end"]`` :raise: :py:class:`DeserializationException` if unexpected input :return: parsed instance """ return _read_named_element( element, iterator, "referenceAttribute", _read_reference_attribute_as_sequence ) def _read_date_time_attribute_item_as_sequence( element: Element, iterator: Iterator[Tuple[str, Element]] ) -> our_types.DateTimeAttributeItem: """ Read an instance of :py:class:`.types.DateTimeAttributeItem` as a sequence of XML-encoded properties. The end element corresponding to the :paramref:`element` will be read as well. :param element: start element, parent of the sequence :param iterator: Input stream of ``(event, element)`` coming from :py:func:`xml.etree.ElementTree.iterparse` with the argument ``events=["start", "end"]`` :raise: :py:class:`DeserializationException` if unexpected input :return: parsed instance """ values = _read_properties(element, iterator, _READERS_FOR_DATE_TIME_ATTRIBUTE_ITEM) the_kind: Optional[our_types.DateTimeGlobalAttributeKind] = values.get("kind") if the_kind is None: raise DeserializationException("The required property 'kind' is missing") return our_types.DateTimeAttributeItem(the_kind) def _read_date_time_attribute_item_as_element( element: Element, iterator: Iterator[Tuple[str, Element]] ) -> our_types.DateTimeAttributeItem: """ Read an instance of :py:class:`.types.DateTimeAttributeItem` from :paramref:`iterator`, including the end element. :param element: start element :param iterator: Input stream of ``(event, element)`` coming from :py:func:`xml.etree.ElementTree.iterparse` with the argument ``events=["start", "end"]`` :raise: :py:class:`DeserializationException` if unexpected input :return: parsed instance """ return _read_named_element( element, iterator, "dateTimeAttributeItem", _read_date_time_attribute_item_as_sequence, ) def _read_field_operand_as_sequence( element: Element, iterator: Iterator[Tuple[str, Element]] ) -> our_types.FieldOperand: """ Read an instance of :py:class:`.types.FieldOperand` as a sequence of XML-encoded properties. The end element corresponding to the :paramref:`element` will be read as well. :param element: start element, parent of the sequence :param iterator: Input stream of ``(event, element)`` coming from :py:func:`xml.etree.ElementTree.iterparse` with the argument ``events=["start", "end"]`` :raise: :py:class:`DeserializationException` if unexpected input :return: parsed instance """ values = _read_properties(element, iterator, _READERS_FOR_FIELD_OPERAND) the_field: Optional[str] = values.get("field") if the_field is None: raise DeserializationException("The required property 'field' is missing") return our_types.FieldOperand(the_field) def _read_field_operand_as_element( element: Element, iterator: Iterator[Tuple[str, Element]] ) -> our_types.FieldOperand: """ Read an instance of :py:class:`.types.FieldOperand` from :paramref:`iterator`, including the end element. :param element: start element :param iterator: Input stream of ``(event, element)`` coming from :py:func:`xml.etree.ElementTree.iterparse` with the argument ``events=["start", "end"]`` :raise: :py:class:`DeserializationException` if unexpected input :return: parsed instance """ return _read_named_element( element, iterator, "fieldOperand", _read_field_operand_as_sequence ) def _read_string_literal_as_sequence( element: Element, iterator: Iterator[Tuple[str, Element]] ) -> our_types.StringLiteral: """ Read an instance of :py:class:`.types.StringLiteral` as a sequence of XML-encoded properties. The end element corresponding to the :paramref:`element` will be read as well. :param element: start element, parent of the sequence :param iterator: Input stream of ``(event, element)`` coming from :py:func:`xml.etree.ElementTree.iterparse` with the argument ``events=["start", "end"]`` :raise: :py:class:`DeserializationException` if unexpected input :return: parsed instance """ values = _read_properties(element, iterator, _READERS_FOR_STRING_LITERAL) the_str_val: Optional[str] = values.get("strVal") if the_str_val is None: raise DeserializationException("The required property 'strVal' is missing") return our_types.StringLiteral(the_str_val) def _read_string_literal_as_element( element: Element, iterator: Iterator[Tuple[str, Element]] ) -> our_types.StringLiteral: """ Read an instance of :py:class:`.types.StringLiteral` from :paramref:`iterator`, including the end element. :param element: start element :param iterator: Input stream of ``(event, element)`` coming from :py:func:`xml.etree.ElementTree.iterparse` with the argument ``events=["start", "end"]`` :raise: :py:class:`DeserializationException` if unexpected input :return: parsed instance """ return _read_named_element( element, iterator, "stringLiteral", _read_string_literal_as_sequence ) def _read_attribute_operand_as_sequence( element: Element, iterator: Iterator[Tuple[str, Element]] ) -> our_types.AttributeOperand: """ Read an instance of :py:class:`.types.AttributeOperand` as a sequence of XML-encoded properties. The end element corresponding to the :paramref:`element` will be read as well. :param element: start element, parent of the sequence :param iterator: Input stream of ``(event, element)`` coming from :py:func:`xml.etree.ElementTree.iterparse` with the argument ``events=["start", "end"]`` :raise: :py:class:`DeserializationException` if unexpected input :return: parsed instance """ values = _read_properties(element, iterator, _READERS_FOR_ATTRIBUTE_OPERAND) the_attribute: Optional[our_types.AttributeItem] = values.get("attribute") if the_attribute is None: raise DeserializationException("The required property 'attribute' is missing") return our_types.AttributeOperand(the_attribute) def _read_attribute_operand_as_element( element: Element, iterator: Iterator[Tuple[str, Element]] ) -> our_types.AttributeOperand: """ Read an instance of :py:class:`.types.AttributeOperand` from :paramref:`iterator`, including the end element. :param element: start element :param iterator: Input stream of ``(event, element)`` coming from :py:func:`xml.etree.ElementTree.iterparse` with the argument ``events=["start", "end"]`` :raise: :py:class:`DeserializationException` if unexpected input :return: parsed instance """ return _read_named_element( element, iterator, "attributeOperand", _read_attribute_operand_as_sequence ) def _read_number_literal_as_sequence( element: Element, iterator: Iterator[Tuple[str, Element]] ) -> our_types.NumberLiteral: """ Read an instance of :py:class:`.types.NumberLiteral` as a sequence of XML-encoded properties. The end element corresponding to the :paramref:`element` will be read as well. :param element: start element, parent of the sequence :param iterator: Input stream of ``(event, element)`` coming from :py:func:`xml.etree.ElementTree.iterparse` with the argument ``events=["start", "end"]`` :raise: :py:class:`DeserializationException` if unexpected input :return: parsed instance """ values = _read_properties(element, iterator, _READERS_FOR_NUMBER_LITERAL) the_num_val: Optional[float] = values.get("numVal") if the_num_val is None: raise DeserializationException("The required property 'numVal' is missing") return our_types.NumberLiteral(the_num_val) def _read_number_literal_as_element( element: Element, iterator: Iterator[Tuple[str, Element]] ) -> our_types.NumberLiteral: """ Read an instance of :py:class:`.types.NumberLiteral` from :paramref:`iterator`, including the end element. :param element: start element :param iterator: Input stream of ``(event, element)`` coming from :py:func:`xml.etree.ElementTree.iterparse` with the argument ``events=["start", "end"]`` :raise: :py:class:`DeserializationException` if unexpected input :return: parsed instance """ return _read_named_element( element, iterator, "numberLiteral", _read_number_literal_as_sequence ) def _read_hex_literal_as_sequence( element: Element, iterator: Iterator[Tuple[str, Element]] ) -> our_types.HexLiteral: """ Read an instance of :py:class:`.types.HexLiteral` as a sequence of XML-encoded properties. The end element corresponding to the :paramref:`element` will be read as well. :param element: start element, parent of the sequence :param iterator: Input stream of ``(event, element)`` coming from :py:func:`xml.etree.ElementTree.iterparse` with the argument ``events=["start", "end"]`` :raise: :py:class:`DeserializationException` if unexpected input :return: parsed instance """ values = _read_properties(element, iterator, _READERS_FOR_HEX_LITERAL) the_hex_val: Optional[str] = values.get("hexVal") if the_hex_val is None: raise DeserializationException("The required property 'hexVal' is missing") return our_types.HexLiteral(the_hex_val) def _read_hex_literal_as_element( element: Element, iterator: Iterator[Tuple[str, Element]] ) -> our_types.HexLiteral: """ Read an instance of :py:class:`.types.HexLiteral` from :paramref:`iterator`, including the end element. :param element: start element :param iterator: Input stream of ``(event, element)`` coming from :py:func:`xml.etree.ElementTree.iterparse` with the argument ``events=["start", "end"]`` :raise: :py:class:`DeserializationException` if unexpected input :return: parsed instance """ return _read_named_element( element, iterator, "hexLiteral", _read_hex_literal_as_sequence ) def _read_date_time_literal_as_sequence( element: Element, iterator: Iterator[Tuple[str, Element]] ) -> our_types.DateTimeLiteral: """ Read an instance of :py:class:`.types.DateTimeLiteral` as a sequence of XML-encoded properties. The end element corresponding to the :paramref:`element` will be read as well. :param element: start element, parent of the sequence :param iterator: Input stream of ``(event, element)`` coming from :py:func:`xml.etree.ElementTree.iterparse` with the argument ``events=["start", "end"]`` :raise: :py:class:`DeserializationException` if unexpected input :return: parsed instance """ values = _read_properties(element, iterator, _READERS_FOR_DATE_TIME_LITERAL) the_date_time_val: Optional[str] = values.get("dateTimeVal") if the_date_time_val is None: raise DeserializationException("The required property 'dateTimeVal' is missing") return our_types.DateTimeLiteral(the_date_time_val) def _read_date_time_literal_as_element( element: Element, iterator: Iterator[Tuple[str, Element]] ) -> our_types.DateTimeLiteral: """ Read an instance of :py:class:`.types.DateTimeLiteral` from :paramref:`iterator`, including the end element. :param element: start element :param iterator: Input stream of ``(event, element)`` coming from :py:func:`xml.etree.ElementTree.iterparse` with the argument ``events=["start", "end"]`` :raise: :py:class:`DeserializationException` if unexpected input :return: parsed instance """ return _read_named_element( element, iterator, "dateTimeLiteral", _read_date_time_literal_as_sequence ) def _read_time_literal_as_sequence( element: Element, iterator: Iterator[Tuple[str, Element]] ) -> our_types.TimeLiteral: """ Read an instance of :py:class:`.types.TimeLiteral` as a sequence of XML-encoded properties. The end element corresponding to the :paramref:`element` will be read as well. :param element: start element, parent of the sequence :param iterator: Input stream of ``(event, element)`` coming from :py:func:`xml.etree.ElementTree.iterparse` with the argument ``events=["start", "end"]`` :raise: :py:class:`DeserializationException` if unexpected input :return: parsed instance """ values = _read_properties(element, iterator, _READERS_FOR_TIME_LITERAL) the_time_val: Optional[str] = values.get("timeVal") if the_time_val is None: raise DeserializationException("The required property 'timeVal' is missing") return our_types.TimeLiteral(the_time_val) def _read_time_literal_as_element( element: Element, iterator: Iterator[Tuple[str, Element]] ) -> our_types.TimeLiteral: """ Read an instance of :py:class:`.types.TimeLiteral` from :paramref:`iterator`, including the end element. :param element: start element :param iterator: Input stream of ``(event, element)`` coming from :py:func:`xml.etree.ElementTree.iterparse` with the argument ``events=["start", "end"]`` :raise: :py:class:`DeserializationException` if unexpected input :return: parsed instance """ return _read_named_element( element, iterator, "timeLiteral", _read_time_literal_as_sequence ) def _read_boolean_literal_as_sequence( element: Element, iterator: Iterator[Tuple[str, Element]] ) -> our_types.BooleanLiteral: """ Read an instance of :py:class:`.types.BooleanLiteral` as a sequence of XML-encoded properties. The end element corresponding to the :paramref:`element` will be read as well. :param element: start element, parent of the sequence :param iterator: Input stream of ``(event, element)`` coming from :py:func:`xml.etree.ElementTree.iterparse` with the argument ``events=["start", "end"]`` :raise: :py:class:`DeserializationException` if unexpected input :return: parsed instance """ values = _read_properties(element, iterator, _READERS_FOR_BOOLEAN_LITERAL) the_boolean: Optional[bool] = values.get("boolean") if the_boolean is None: raise DeserializationException("The required property 'boolean' is missing") return our_types.BooleanLiteral(the_boolean) def _read_boolean_literal_as_element( element: Element, iterator: Iterator[Tuple[str, Element]] ) -> our_types.BooleanLiteral: """ Read an instance of :py:class:`.types.BooleanLiteral` from :paramref:`iterator`, including the end element. :param element: start element :param iterator: Input stream of ``(event, element)`` coming from :py:func:`xml.etree.ElementTree.iterparse` with the argument ``events=["start", "end"]`` :raise: :py:class:`DeserializationException` if unexpected input :return: parsed instance """ return _read_named_element( element, iterator, "booleanLiteral", _read_boolean_literal_as_sequence ) def _read_string_cast_as_sequence( element: Element, iterator: Iterator[Tuple[str, Element]] ) -> our_types.StringCast: """ Read an instance of :py:class:`.types.StringCast` as a sequence of XML-encoded properties. The end element corresponding to the :paramref:`element` will be read as well. :param element: start element, parent of the sequence :param iterator: Input stream of ``(event, element)`` coming from :py:func:`xml.etree.ElementTree.iterparse` with the argument ``events=["start", "end"]`` :raise: :py:class:`DeserializationException` if unexpected input :return: parsed instance """ values = _read_properties(element, iterator, _READERS_FOR_STRING_CAST) the_str_cast: Optional[our_types.Value] = values.get("strCast") if the_str_cast is None: raise DeserializationException("The required property 'strCast' is missing") return our_types.StringCast(the_str_cast) def _read_string_cast_as_element( element: Element, iterator: Iterator[Tuple[str, Element]] ) -> our_types.StringCast: """ Read an instance of :py:class:`.types.StringCast` from :paramref:`iterator`, including the end element. :param element: start element :param iterator: Input stream of ``(event, element)`` coming from :py:func:`xml.etree.ElementTree.iterparse` with the argument ``events=["start", "end"]`` :raise: :py:class:`DeserializationException` if unexpected input :return: parsed instance """ return _read_named_element( element, iterator, "stringCast", _read_string_cast_as_sequence ) def _read_number_cast_as_sequence( element: Element, iterator: Iterator[Tuple[str, Element]] ) -> our_types.NumberCast: """ Read an instance of :py:class:`.types.NumberCast` as a sequence of XML-encoded properties. The end element corresponding to the :paramref:`element` will be read as well. :param element: start element, parent of the sequence :param iterator: Input stream of ``(event, element)`` coming from :py:func:`xml.etree.ElementTree.iterparse` with the argument ``events=["start", "end"]`` :raise: :py:class:`DeserializationException` if unexpected input :return: parsed instance """ values = _read_properties(element, iterator, _READERS_FOR_NUMBER_CAST) the_num_cast: Optional[our_types.Value] = values.get("numCast") if the_num_cast is None: raise DeserializationException("The required property 'numCast' is missing") return our_types.NumberCast(the_num_cast) def _read_number_cast_as_element( element: Element, iterator: Iterator[Tuple[str, Element]] ) -> our_types.NumberCast: """ Read an instance of :py:class:`.types.NumberCast` from :paramref:`iterator`, including the end element. :param element: start element :param iterator: Input stream of ``(event, element)`` coming from :py:func:`xml.etree.ElementTree.iterparse` with the argument ``events=["start", "end"]`` :raise: :py:class:`DeserializationException` if unexpected input :return: parsed instance """ return _read_named_element( element, iterator, "numberCast", _read_number_cast_as_sequence ) def _read_hex_cast_as_sequence( element: Element, iterator: Iterator[Tuple[str, Element]] ) -> our_types.HexCast: """ Read an instance of :py:class:`.types.HexCast` as a sequence of XML-encoded properties. The end element corresponding to the :paramref:`element` will be read as well. :param element: start element, parent of the sequence :param iterator: Input stream of ``(event, element)`` coming from :py:func:`xml.etree.ElementTree.iterparse` with the argument ``events=["start", "end"]`` :raise: :py:class:`DeserializationException` if unexpected input :return: parsed instance """ values = _read_properties(element, iterator, _READERS_FOR_HEX_CAST) the_hex_cast: Optional[our_types.Value] = values.get("hexCast") if the_hex_cast is None: raise DeserializationException("The required property 'hexCast' is missing") return our_types.HexCast(the_hex_cast) def _read_hex_cast_as_element( element: Element, iterator: Iterator[Tuple[str, Element]] ) -> our_types.HexCast: """ Read an instance of :py:class:`.types.HexCast` from :paramref:`iterator`, including the end element. :param element: start element :param iterator: Input stream of ``(event, element)`` coming from :py:func:`xml.etree.ElementTree.iterparse` with the argument ``events=["start", "end"]`` :raise: :py:class:`DeserializationException` if unexpected input :return: parsed instance """ return _read_named_element(element, iterator, "hexCast", _read_hex_cast_as_sequence) def _read_boolean_cast_as_sequence( element: Element, iterator: Iterator[Tuple[str, Element]] ) -> our_types.BooleanCast: """ Read an instance of :py:class:`.types.BooleanCast` as a sequence of XML-encoded properties. The end element corresponding to the :paramref:`element` will be read as well. :param element: start element, parent of the sequence :param iterator: Input stream of ``(event, element)`` coming from :py:func:`xml.etree.ElementTree.iterparse` with the argument ``events=["start", "end"]`` :raise: :py:class:`DeserializationException` if unexpected input :return: parsed instance """ values = _read_properties(element, iterator, _READERS_FOR_BOOLEAN_CAST) the_bool_cast: Optional[our_types.Value] = values.get("boolCast") if the_bool_cast is None: raise DeserializationException("The required property 'boolCast' is missing") return our_types.BooleanCast(the_bool_cast) def _read_boolean_cast_as_element( element: Element, iterator: Iterator[Tuple[str, Element]] ) -> our_types.BooleanCast: """ Read an instance of :py:class:`.types.BooleanCast` from :paramref:`iterator`, including the end element. :param element: start element :param iterator: Input stream of ``(event, element)`` coming from :py:func:`xml.etree.ElementTree.iterparse` with the argument ``events=["start", "end"]`` :raise: :py:class:`DeserializationException` if unexpected input :return: parsed instance """ return _read_named_element( element, iterator, "booleanCast", _read_boolean_cast_as_sequence ) def _read_date_time_cast_as_sequence( element: Element, iterator: Iterator[Tuple[str, Element]] ) -> our_types.DateTimeCast: """ Read an instance of :py:class:`.types.DateTimeCast` as a sequence of XML-encoded properties. The end element corresponding to the :paramref:`element` will be read as well. :param element: start element, parent of the sequence :param iterator: Input stream of ``(event, element)`` coming from :py:func:`xml.etree.ElementTree.iterparse` with the argument ``events=["start", "end"]`` :raise: :py:class:`DeserializationException` if unexpected input :return: parsed instance """ values = _read_properties(element, iterator, _READERS_FOR_DATE_TIME_CAST) the_date_time_cast: Optional[our_types.StringValue] = values.get("dateTimeCast") if the_date_time_cast is None: raise DeserializationException( "The required property 'dateTimeCast' is missing" ) return our_types.DateTimeCast(the_date_time_cast) def _read_date_time_cast_as_element( element: Element, iterator: Iterator[Tuple[str, Element]] ) -> our_types.DateTimeCast: """ Read an instance of :py:class:`.types.DateTimeCast` from :paramref:`iterator`, including the end element. :param element: start element :param iterator: Input stream of ``(event, element)`` coming from :py:func:`xml.etree.ElementTree.iterparse` with the argument ``events=["start", "end"]`` :raise: :py:class:`DeserializationException` if unexpected input :return: parsed instance """ return _read_named_element( element, iterator, "dateTimeCast", _read_date_time_cast_as_sequence ) def _read_time_cast_as_sequence( element: Element, iterator: Iterator[Tuple[str, Element]] ) -> our_types.TimeCast: """ Read an instance of :py:class:`.types.TimeCast` as a sequence of XML-encoded properties. The end element corresponding to the :paramref:`element` will be read as well. :param element: start element, parent of the sequence :param iterator: Input stream of ``(event, element)`` coming from :py:func:`xml.etree.ElementTree.iterparse` with the argument ``events=["start", "end"]`` :raise: :py:class:`DeserializationException` if unexpected input :return: parsed instance """ values = _read_properties(element, iterator, _READERS_FOR_TIME_CAST) the_time_cast: Optional[our_types.TimeCastOperand] = values.get("timeCast") if the_time_cast is None: raise DeserializationException("The required property 'timeCast' is missing") return our_types.TimeCast(the_time_cast) def _read_time_cast_as_element( element: Element, iterator: Iterator[Tuple[str, Element]] ) -> our_types.TimeCast: """ Read an instance of :py:class:`.types.TimeCast` from :paramref:`iterator`, including the end element. :param element: start element :param iterator: Input stream of ``(event, element)`` coming from :py:func:`xml.etree.ElementTree.iterparse` with the argument ``events=["start", "end"]`` :raise: :py:class:`DeserializationException` if unexpected input :return: parsed instance """ return _read_named_element( element, iterator, "timeCast", _read_time_cast_as_sequence ) def _read_day_of_week_as_sequence( element: Element, iterator: Iterator[Tuple[str, Element]] ) -> our_types.DayOfWeek: """ Read an instance of :py:class:`.types.DayOfWeek` as a sequence of XML-encoded properties. The end element corresponding to the :paramref:`element` will be read as well. :param element: start element, parent of the sequence :param iterator: Input stream of ``(event, element)`` coming from :py:func:`xml.etree.ElementTree.iterparse` with the argument ``events=["start", "end"]`` :raise: :py:class:`DeserializationException` if unexpected input :return: parsed instance """ values = _read_properties(element, iterator, _READERS_FOR_DAY_OF_WEEK) the_day_of_week: Optional[our_types.DateTimeOperand] = values.get("dayOfWeek") if the_day_of_week is None: raise DeserializationException("The required property 'dayOfWeek' is missing") return our_types.DayOfWeek(the_day_of_week) def _read_day_of_week_as_element( element: Element, iterator: Iterator[Tuple[str, Element]] ) -> our_types.DayOfWeek: """ Read an instance of :py:class:`.types.DayOfWeek` from :paramref:`iterator`, including the end element. :param element: start element :param iterator: Input stream of ``(event, element)`` coming from :py:func:`xml.etree.ElementTree.iterparse` with the argument ``events=["start", "end"]`` :raise: :py:class:`DeserializationException` if unexpected input :return: parsed instance """ return _read_named_element( element, iterator, "dayOfWeek", _read_day_of_week_as_sequence ) def _read_day_of_month_as_sequence( element: Element, iterator: Iterator[Tuple[str, Element]] ) -> our_types.DayOfMonth: """ Read an instance of :py:class:`.types.DayOfMonth` as a sequence of XML-encoded properties. The end element corresponding to the :paramref:`element` will be read as well. :param element: start element, parent of the sequence :param iterator: Input stream of ``(event, element)`` coming from :py:func:`xml.etree.ElementTree.iterparse` with the argument ``events=["start", "end"]`` :raise: :py:class:`DeserializationException` if unexpected input :return: parsed instance """ values = _read_properties(element, iterator, _READERS_FOR_DAY_OF_MONTH) the_day_of_month: Optional[our_types.DateTimeOperand] = values.get("dayOfMonth") if the_day_of_month is None: raise DeserializationException("The required property 'dayOfMonth' is missing") return our_types.DayOfMonth(the_day_of_month) def _read_day_of_month_as_element( element: Element, iterator: Iterator[Tuple[str, Element]] ) -> our_types.DayOfMonth: """ Read an instance of :py:class:`.types.DayOfMonth` from :paramref:`iterator`, including the end element. :param element: start element :param iterator: Input stream of ``(event, element)`` coming from :py:func:`xml.etree.ElementTree.iterparse` with the argument ``events=["start", "end"]`` :raise: :py:class:`DeserializationException` if unexpected input :return: parsed instance """ return _read_named_element( element, iterator, "dayOfMonth", _read_day_of_month_as_sequence ) def _read_month_as_sequence( element: Element, iterator: Iterator[Tuple[str, Element]] ) -> our_types.Month: """ Read an instance of :py:class:`.types.Month` as a sequence of XML-encoded properties. The end element corresponding to the :paramref:`element` will be read as well. :param element: start element, parent of the sequence :param iterator: Input stream of ``(event, element)`` coming from :py:func:`xml.etree.ElementTree.iterparse` with the argument ``events=["start", "end"]`` :raise: :py:class:`DeserializationException` if unexpected input :return: parsed instance """ values = _read_properties(element, iterator, _READERS_FOR_MONTH) the_month: Optional[our_types.DateTimeOperand] = values.get("month") if the_month is None: raise DeserializationException("The required property 'month' is missing") return our_types.Month(the_month) def _read_month_as_element( element: Element, iterator: Iterator[Tuple[str, Element]] ) -> our_types.Month: """ Read an instance of :py:class:`.types.Month` from :paramref:`iterator`, including the end element. :param element: start element :param iterator: Input stream of ``(event, element)`` coming from :py:func:`xml.etree.ElementTree.iterparse` with the argument ``events=["start", "end"]`` :raise: :py:class:`DeserializationException` if unexpected input :return: parsed instance """ return _read_named_element(element, iterator, "month", _read_month_as_sequence) def _read_year_as_sequence( element: Element, iterator: Iterator[Tuple[str, Element]] ) -> our_types.Year: """ Read an instance of :py:class:`.types.Year` as a sequence of XML-encoded properties. The end element corresponding to the :paramref:`element` will be read as well. :param element: start element, parent of the sequence :param iterator: Input stream of ``(event, element)`` coming from :py:func:`xml.etree.ElementTree.iterparse` with the argument ``events=["start", "end"]`` :raise: :py:class:`DeserializationException` if unexpected input :return: parsed instance """ values = _read_properties(element, iterator, _READERS_FOR_YEAR) the_year: Optional[our_types.DateTimeOperand] = values.get("year") if the_year is None: raise DeserializationException("The required property 'year' is missing") return our_types.Year(the_year) def _read_year_as_element( element: Element, iterator: Iterator[Tuple[str, Element]] ) -> our_types.Year: """ Read an instance of :py:class:`.types.Year` from :paramref:`iterator`, including the end element. :param element: start element :param iterator: Input stream of ``(event, element)`` coming from :py:func:`xml.etree.ElementTree.iterparse` with the argument ``events=["start", "end"]`` :raise: :py:class:`DeserializationException` if unexpected input :return: parsed instance """ return _read_named_element(element, iterator, "year", _read_year_as_sequence) def _read_date_time_attribute_operand_as_sequence( element: Element, iterator: Iterator[Tuple[str, Element]] ) -> our_types.DateTimeAttributeOperand: """ Read an instance of :py:class:`.types.DateTimeAttributeOperand` as a sequence of XML-encoded properties. The end element corresponding to the :paramref:`element` will be read as well. :param element: start element, parent of the sequence :param iterator: Input stream of ``(event, element)`` coming from :py:func:`xml.etree.ElementTree.iterparse` with the argument ``events=["start", "end"]`` :raise: :py:class:`DeserializationException` if unexpected input :return: parsed instance """ values = _read_properties( element, iterator, _READERS_FOR_DATE_TIME_ATTRIBUTE_OPERAND ) the_attribute: Optional[our_types.DateTimeAttributeItem] = values.get("attribute") if the_attribute is None: raise DeserializationException("The required property 'attribute' is missing") return our_types.DateTimeAttributeOperand(the_attribute) def _read_date_time_attribute_operand_as_element( element: Element, iterator: Iterator[Tuple[str, Element]] ) -> our_types.DateTimeAttributeOperand: """ Read an instance of :py:class:`.types.DateTimeAttributeOperand` from :paramref:`iterator`, including the end element. :param element: start element :param iterator: Input stream of ``(event, element)`` coming from :py:func:`xml.etree.ElementTree.iterparse` with the argument ``events=["start", "end"]`` :raise: :py:class:`DeserializationException` if unexpected input :return: parsed instance """ return _read_named_element( element, iterator, "dateTimeAttributeOperand", _read_date_time_attribute_operand_as_sequence, ) def _read_equal_comparison_as_sequence( element: Element, iterator: Iterator[Tuple[str, Element]] ) -> our_types.EqualComparison: """ Read an instance of :py:class:`.types.EqualComparison` as a sequence of XML-encoded properties. The end element corresponding to the :paramref:`element` will be read as well. :param element: start element, parent of the sequence :param iterator: Input stream of ``(event, element)`` coming from :py:func:`xml.etree.ElementTree.iterparse` with the argument ``events=["start", "end"]`` :raise: :py:class:`DeserializationException` if unexpected input :return: parsed instance """ values = _read_properties(element, iterator, _READERS_FOR_EQUAL_COMPARISON) the_eq: Optional[Tuple[our_types.Value, our_types.Value]] = values.get("eq") if the_eq is None: raise DeserializationException("The required property 'eq' is missing") return our_types.EqualComparison(the_eq) def _read_equal_comparison_as_element( element: Element, iterator: Iterator[Tuple[str, Element]] ) -> our_types.EqualComparison: """ Read an instance of :py:class:`.types.EqualComparison` from :paramref:`iterator`, including the end element. :param element: start element :param iterator: Input stream of ``(event, element)`` coming from :py:func:`xml.etree.ElementTree.iterparse` with the argument ``events=["start", "end"]`` :raise: :py:class:`DeserializationException` if unexpected input :return: parsed instance """ return _read_named_element( element, iterator, "equalComparison", _read_equal_comparison_as_sequence ) def _read_not_equal_comparison_as_sequence( element: Element, iterator: Iterator[Tuple[str, Element]] ) -> our_types.NotEqualComparison: """ Read an instance of :py:class:`.types.NotEqualComparison` as a sequence of XML-encoded properties. The end element corresponding to the :paramref:`element` will be read as well. :param element: start element, parent of the sequence :param iterator: Input stream of ``(event, element)`` coming from :py:func:`xml.etree.ElementTree.iterparse` with the argument ``events=["start", "end"]`` :raise: :py:class:`DeserializationException` if unexpected input :return: parsed instance """ values = _read_properties(element, iterator, _READERS_FOR_NOT_EQUAL_COMPARISON) the_ne: Optional[Tuple[our_types.Value, our_types.Value]] = values.get("ne") if the_ne is None: raise DeserializationException("The required property 'ne' is missing") return our_types.NotEqualComparison(the_ne) def _read_not_equal_comparison_as_element( element: Element, iterator: Iterator[Tuple[str, Element]] ) -> our_types.NotEqualComparison: """ Read an instance of :py:class:`.types.NotEqualComparison` from :paramref:`iterator`, including the end element. :param element: start element :param iterator: Input stream of ``(event, element)`` coming from :py:func:`xml.etree.ElementTree.iterparse` with the argument ``events=["start", "end"]`` :raise: :py:class:`DeserializationException` if unexpected input :return: parsed instance """ return _read_named_element( element, iterator, "notEqualComparison", _read_not_equal_comparison_as_sequence ) def _read_greater_than_comparison_as_sequence( element: Element, iterator: Iterator[Tuple[str, Element]] ) -> our_types.GreaterThanComparison: """ Read an instance of :py:class:`.types.GreaterThanComparison` as a sequence of XML-encoded properties. The end element corresponding to the :paramref:`element` will be read as well. :param element: start element, parent of the sequence :param iterator: Input stream of ``(event, element)`` coming from :py:func:`xml.etree.ElementTree.iterparse` with the argument ``events=["start", "end"]`` :raise: :py:class:`DeserializationException` if unexpected input :return: parsed instance """ values = _read_properties(element, iterator, _READERS_FOR_GREATER_THAN_COMPARISON) the_gt: Optional[Tuple[our_types.Value, our_types.Value]] = values.get("gt") if the_gt is None: raise DeserializationException("The required property 'gt' is missing") return our_types.GreaterThanComparison(the_gt) def _read_greater_than_comparison_as_element( element: Element, iterator: Iterator[Tuple[str, Element]] ) -> our_types.GreaterThanComparison: """ Read an instance of :py:class:`.types.GreaterThanComparison` from :paramref:`iterator`, including the end element. :param element: start element :param iterator: Input stream of ``(event, element)`` coming from :py:func:`xml.etree.ElementTree.iterparse` with the argument ``events=["start", "end"]`` :raise: :py:class:`DeserializationException` if unexpected input :return: parsed instance """ return _read_named_element( element, iterator, "greaterThanComparison", _read_greater_than_comparison_as_sequence, ) def _read_greater_than_or_equal_comparison_as_sequence( element: Element, iterator: Iterator[Tuple[str, Element]] ) -> our_types.GreaterThanOrEqualComparison: """ Read an instance of :py:class:`.types.GreaterThanOrEqualComparison` as a sequence of XML-encoded properties. The end element corresponding to the :paramref:`element` will be read as well. :param element: start element, parent of the sequence :param iterator: Input stream of ``(event, element)`` coming from :py:func:`xml.etree.ElementTree.iterparse` with the argument ``events=["start", "end"]`` :raise: :py:class:`DeserializationException` if unexpected input :return: parsed instance """ values = _read_properties( element, iterator, _READERS_FOR_GREATER_THAN_OR_EQUAL_COMPARISON ) the_ge: Optional[Tuple[our_types.Value, our_types.Value]] = values.get("ge") if the_ge is None: raise DeserializationException("The required property 'ge' is missing") return our_types.GreaterThanOrEqualComparison(the_ge) def _read_greater_than_or_equal_comparison_as_element( element: Element, iterator: Iterator[Tuple[str, Element]] ) -> our_types.GreaterThanOrEqualComparison: """ Read an instance of :py:class:`.types.GreaterThanOrEqualComparison` from :paramref:`iterator`, including the end element. :param element: start element :param iterator: Input stream of ``(event, element)`` coming from :py:func:`xml.etree.ElementTree.iterparse` with the argument ``events=["start", "end"]`` :raise: :py:class:`DeserializationException` if unexpected input :return: parsed instance """ return _read_named_element( element, iterator, "greaterThanOrEqualComparison", _read_greater_than_or_equal_comparison_as_sequence, ) def _read_less_than_comparison_as_sequence( element: Element, iterator: Iterator[Tuple[str, Element]] ) -> our_types.LessThanComparison: """ Read an instance of :py:class:`.types.LessThanComparison` as a sequence of XML-encoded properties. The end element corresponding to the :paramref:`element` will be read as well. :param element: start element, parent of the sequence :param iterator: Input stream of ``(event, element)`` coming from :py:func:`xml.etree.ElementTree.iterparse` with the argument ``events=["start", "end"]`` :raise: :py:class:`DeserializationException` if unexpected input :return: parsed instance """ values = _read_properties(element, iterator, _READERS_FOR_LESS_THAN_COMPARISON) the_lt: Optional[Tuple[our_types.Value, our_types.Value]] = values.get("lt") if the_lt is None: raise DeserializationException("The required property 'lt' is missing") return our_types.LessThanComparison(the_lt) def _read_less_than_comparison_as_element( element: Element, iterator: Iterator[Tuple[str, Element]] ) -> our_types.LessThanComparison: """ Read an instance of :py:class:`.types.LessThanComparison` from :paramref:`iterator`, including the end element. :param element: start element :param iterator: Input stream of ``(event, element)`` coming from :py:func:`xml.etree.ElementTree.iterparse` with the argument ``events=["start", "end"]`` :raise: :py:class:`DeserializationException` if unexpected input :return: parsed instance """ return _read_named_element( element, iterator, "lessThanComparison", _read_less_than_comparison_as_sequence ) def _read_less_than_or_equal_comparison_as_sequence( element: Element, iterator: Iterator[Tuple[str, Element]] ) -> our_types.LessThanOrEqualComparison: """ Read an instance of :py:class:`.types.LessThanOrEqualComparison` as a sequence of XML-encoded properties. The end element corresponding to the :paramref:`element` will be read as well. :param element: start element, parent of the sequence :param iterator: Input stream of ``(event, element)`` coming from :py:func:`xml.etree.ElementTree.iterparse` with the argument ``events=["start", "end"]`` :raise: :py:class:`DeserializationException` if unexpected input :return: parsed instance """ values = _read_properties( element, iterator, _READERS_FOR_LESS_THAN_OR_EQUAL_COMPARISON ) the_le: Optional[Tuple[our_types.Value, our_types.Value]] = values.get("le") if the_le is None: raise DeserializationException("The required property 'le' is missing") return our_types.LessThanOrEqualComparison(the_le) def _read_less_than_or_equal_comparison_as_element( element: Element, iterator: Iterator[Tuple[str, Element]] ) -> our_types.LessThanOrEqualComparison: """ Read an instance of :py:class:`.types.LessThanOrEqualComparison` from :paramref:`iterator`, including the end element. :param element: start element :param iterator: Input stream of ``(event, element)`` coming from :py:func:`xml.etree.ElementTree.iterparse` with the argument ``events=["start", "end"]`` :raise: :py:class:`DeserializationException` if unexpected input :return: parsed instance """ return _read_named_element( element, iterator, "lessThanOrEqualComparison", _read_less_than_or_equal_comparison_as_sequence, ) def _read_contains_comparison_as_sequence( element: Element, iterator: Iterator[Tuple[str, Element]] ) -> our_types.ContainsComparison: """ Read an instance of :py:class:`.types.ContainsComparison` as a sequence of XML-encoded properties. The end element corresponding to the :paramref:`element` will be read as well. :param element: start element, parent of the sequence :param iterator: Input stream of ``(event, element)`` coming from :py:func:`xml.etree.ElementTree.iterparse` with the argument ``events=["start", "end"]`` :raise: :py:class:`DeserializationException` if unexpected input :return: parsed instance """ values = _read_properties(element, iterator, _READERS_FOR_CONTAINS_COMPARISON) the_contains: Optional[Tuple[our_types.StringValue, our_types.StringValue]] = ( values.get("contains") ) if the_contains is None: raise DeserializationException("The required property 'contains' is missing") return our_types.ContainsComparison(the_contains) def _read_contains_comparison_as_element( element: Element, iterator: Iterator[Tuple[str, Element]] ) -> our_types.ContainsComparison: """ Read an instance of :py:class:`.types.ContainsComparison` from :paramref:`iterator`, including the end element. :param element: start element :param iterator: Input stream of ``(event, element)`` coming from :py:func:`xml.etree.ElementTree.iterparse` with the argument ``events=["start", "end"]`` :raise: :py:class:`DeserializationException` if unexpected input :return: parsed instance """ return _read_named_element( element, iterator, "containsComparison", _read_contains_comparison_as_sequence ) def _read_starts_with_comparison_as_sequence( element: Element, iterator: Iterator[Tuple[str, Element]] ) -> our_types.StartsWithComparison: """ Read an instance of :py:class:`.types.StartsWithComparison` as a sequence of XML-encoded properties. The end element corresponding to the :paramref:`element` will be read as well. :param element: start element, parent of the sequence :param iterator: Input stream of ``(event, element)`` coming from :py:func:`xml.etree.ElementTree.iterparse` with the argument ``events=["start", "end"]`` :raise: :py:class:`DeserializationException` if unexpected input :return: parsed instance """ values = _read_properties(element, iterator, _READERS_FOR_STARTS_WITH_COMPARISON) the_starts_with: Optional[Tuple[our_types.StringValue, our_types.StringValue]] = ( values.get("startsWith") ) if the_starts_with is None: raise DeserializationException("The required property 'startsWith' is missing") return our_types.StartsWithComparison(the_starts_with) def _read_starts_with_comparison_as_element( element: Element, iterator: Iterator[Tuple[str, Element]] ) -> our_types.StartsWithComparison: """ Read an instance of :py:class:`.types.StartsWithComparison` from :paramref:`iterator`, including the end element. :param element: start element :param iterator: Input stream of ``(event, element)`` coming from :py:func:`xml.etree.ElementTree.iterparse` with the argument ``events=["start", "end"]`` :raise: :py:class:`DeserializationException` if unexpected input :return: parsed instance """ return _read_named_element( element, iterator, "startsWithComparison", _read_starts_with_comparison_as_sequence, ) def _read_ends_with_comparison_as_sequence( element: Element, iterator: Iterator[Tuple[str, Element]] ) -> our_types.EndsWithComparison: """ Read an instance of :py:class:`.types.EndsWithComparison` as a sequence of XML-encoded properties. The end element corresponding to the :paramref:`element` will be read as well. :param element: start element, parent of the sequence :param iterator: Input stream of ``(event, element)`` coming from :py:func:`xml.etree.ElementTree.iterparse` with the argument ``events=["start", "end"]`` :raise: :py:class:`DeserializationException` if unexpected input :return: parsed instance """ values = _read_properties(element, iterator, _READERS_FOR_ENDS_WITH_COMPARISON) the_ends_with: Optional[Tuple[our_types.StringValue, our_types.StringValue]] = ( values.get("endsWith") ) if the_ends_with is None: raise DeserializationException("The required property 'endsWith' is missing") return our_types.EndsWithComparison(the_ends_with) def _read_ends_with_comparison_as_element( element: Element, iterator: Iterator[Tuple[str, Element]] ) -> our_types.EndsWithComparison: """ Read an instance of :py:class:`.types.EndsWithComparison` from :paramref:`iterator`, including the end element. :param element: start element :param iterator: Input stream of ``(event, element)`` coming from :py:func:`xml.etree.ElementTree.iterparse` with the argument ``events=["start", "end"]`` :raise: :py:class:`DeserializationException` if unexpected input :return: parsed instance """ return _read_named_element( element, iterator, "endsWithComparison", _read_ends_with_comparison_as_sequence ) def _read_regex_comparison_as_sequence( element: Element, iterator: Iterator[Tuple[str, Element]] ) -> our_types.RegexComparison: """ Read an instance of :py:class:`.types.RegexComparison` as a sequence of XML-encoded properties. The end element corresponding to the :paramref:`element` will be read as well. :param element: start element, parent of the sequence :param iterator: Input stream of ``(event, element)`` coming from :py:func:`xml.etree.ElementTree.iterparse` with the argument ``events=["start", "end"]`` :raise: :py:class:`DeserializationException` if unexpected input :return: parsed instance """ values = _read_properties(element, iterator, _READERS_FOR_REGEX_COMPARISON) the_regex: Optional[Tuple[our_types.StringValue, our_types.StringValue]] = ( values.get("regex") ) if the_regex is None: raise DeserializationException("The required property 'regex' is missing") return our_types.RegexComparison(the_regex) def _read_regex_comparison_as_element( element: Element, iterator: Iterator[Tuple[str, Element]] ) -> our_types.RegexComparison: """ Read an instance of :py:class:`.types.RegexComparison` from :paramref:`iterator`, including the end element. :param element: start element :param iterator: Input stream of ``(event, element)`` coming from :py:func:`xml.etree.ElementTree.iterparse` with the argument ``events=["start", "end"]`` :raise: :py:class:`DeserializationException` if unexpected input :return: parsed instance """ return _read_named_element( element, iterator, "regexComparison", _read_regex_comparison_as_sequence ) def _read_match_clause_as_sequence( element: Element, iterator: Iterator[Tuple[str, Element]] ) -> our_types.MatchClause: """ Read an instance of :py:class:`.types.MatchClause` as a sequence of XML-encoded properties. The end element corresponding to the :paramref:`element` will be read as well. :param element: start element, parent of the sequence :param iterator: Input stream of ``(event, element)`` coming from :py:func:`xml.etree.ElementTree.iterparse` with the argument ``events=["start", "end"]`` :raise: :py:class:`DeserializationException` if unexpected input :return: parsed instance """ values = _read_properties(element, iterator, _READERS_FOR_MATCH_CLAUSE) the_match_operands: Optional[List[our_types.MatchExpression]] = values.get( "matchOperands" ) if the_match_operands is None: raise DeserializationException( "The required property 'matchOperands' is missing" ) return our_types.MatchClause(the_match_operands) def _read_match_clause_as_element( element: Element, iterator: Iterator[Tuple[str, Element]] ) -> our_types.MatchClause: """ Read an instance of :py:class:`.types.MatchClause` from :paramref:`iterator`, including the end element. :param element: start element :param iterator: Input stream of ``(event, element)`` coming from :py:func:`xml.etree.ElementTree.iterparse` with the argument ``events=["start", "end"]`` :raise: :py:class:`DeserializationException` if unexpected input :return: parsed instance """ return _read_named_element( element, iterator, "matchClause", _read_match_clause_as_sequence ) def _read_and_expression_as_sequence( element: Element, iterator: Iterator[Tuple[str, Element]] ) -> our_types.AndExpression: """ Read an instance of :py:class:`.types.AndExpression` as a sequence of XML-encoded properties. The end element corresponding to the :paramref:`element` will be read as well. :param element: start element, parent of the sequence :param iterator: Input stream of ``(event, element)`` coming from :py:func:`xml.etree.ElementTree.iterparse` with the argument ``events=["start", "end"]`` :raise: :py:class:`DeserializationException` if unexpected input :return: parsed instance """ values = _read_properties(element, iterator, _READERS_FOR_AND_EXPRESSION) the_and_operands: Optional[List[our_types.LogicalExpression]] = values.get( "andOperands" ) if the_and_operands is None: raise DeserializationException("The required property 'andOperands' is missing") return our_types.AndExpression(the_and_operands) def _read_and_expression_as_element( element: Element, iterator: Iterator[Tuple[str, Element]] ) -> our_types.AndExpression: """ Read an instance of :py:class:`.types.AndExpression` from :paramref:`iterator`, including the end element. :param element: start element :param iterator: Input stream of ``(event, element)`` coming from :py:func:`xml.etree.ElementTree.iterparse` with the argument ``events=["start", "end"]`` :raise: :py:class:`DeserializationException` if unexpected input :return: parsed instance """ return _read_named_element( element, iterator, "andExpression", _read_and_expression_as_sequence ) def _read_or_expression_as_sequence( element: Element, iterator: Iterator[Tuple[str, Element]] ) -> our_types.OrExpression: """ Read an instance of :py:class:`.types.OrExpression` as a sequence of XML-encoded properties. The end element corresponding to the :paramref:`element` will be read as well. :param element: start element, parent of the sequence :param iterator: Input stream of ``(event, element)`` coming from :py:func:`xml.etree.ElementTree.iterparse` with the argument ``events=["start", "end"]`` :raise: :py:class:`DeserializationException` if unexpected input :return: parsed instance """ values = _read_properties(element, iterator, _READERS_FOR_OR_EXPRESSION) the_or_operands: Optional[List[our_types.LogicalExpression]] = values.get( "orOperands" ) if the_or_operands is None: raise DeserializationException("The required property 'orOperands' is missing") return our_types.OrExpression(the_or_operands) def _read_or_expression_as_element( element: Element, iterator: Iterator[Tuple[str, Element]] ) -> our_types.OrExpression: """ Read an instance of :py:class:`.types.OrExpression` from :paramref:`iterator`, including the end element. :param element: start element :param iterator: Input stream of ``(event, element)`` coming from :py:func:`xml.etree.ElementTree.iterparse` with the argument ``events=["start", "end"]`` :raise: :py:class:`DeserializationException` if unexpected input :return: parsed instance """ return _read_named_element( element, iterator, "orExpression", _read_or_expression_as_sequence ) def _read_not_expression_as_sequence( element: Element, iterator: Iterator[Tuple[str, Element]] ) -> our_types.NotExpression: """ Read an instance of :py:class:`.types.NotExpression` as a sequence of XML-encoded properties. The end element corresponding to the :paramref:`element` will be read as well. :param element: start element, parent of the sequence :param iterator: Input stream of ``(event, element)`` coming from :py:func:`xml.etree.ElementTree.iterparse` with the argument ``events=["start", "end"]`` :raise: :py:class:`DeserializationException` if unexpected input :return: parsed instance """ values = _read_properties(element, iterator, _READERS_FOR_NOT_EXPRESSION) the_not_operand: Optional[our_types.LogicalExpression] = values.get("notOperand") if the_not_operand is None: raise DeserializationException("The required property 'notOperand' is missing") return our_types.NotExpression(the_not_operand) def _read_not_expression_as_element( element: Element, iterator: Iterator[Tuple[str, Element]] ) -> our_types.NotExpression: """ Read an instance of :py:class:`.types.NotExpression` from :paramref:`iterator`, including the end element. :param element: start element :param iterator: Input stream of ``(event, element)`` coming from :py:func:`xml.etree.ElementTree.iterparse` with the argument ``events=["start", "end"]`` :raise: :py:class:`DeserializationException` if unexpected input :return: parsed instance """ return _read_named_element( element, iterator, "notExpression", _read_not_expression_as_sequence ) def _read_query_select_from_element_text( element: Element, iterator: Iterator[Tuple[str, Element]] ) -> our_types.QuerySelect: """ Parse the text of :paramref:`element` as a literal of :py:class:`.types.QuerySelect`, and read the corresponding end element from :paramref:`iterator`. :param element: start element :param iterator: Input stream of ``(event, element)`` coming from :py:func:`xml.etree.ElementTree.iterparse` with the argument ``events=["start", "end"]`` :raise: :py:class:`DeserializationException` if unexpected input :return: parsed value """ return _read_enum_from_element_text( element, iterator, our_stringification.query_select_from_str, "QuerySelect" ) def _read_query_filter_as_sequence( element: Element, iterator: Iterator[Tuple[str, Element]] ) -> our_types.QueryFilter: """ Read an instance of :py:class:`.types.QueryFilter` as a sequence of XML-encoded properties. The end element corresponding to the :paramref:`element` will be read as well. :param element: start element, parent of the sequence :param iterator: Input stream of ``(event, element)`` coming from :py:func:`xml.etree.ElementTree.iterparse` with the argument ``events=["start", "end"]`` :raise: :py:class:`DeserializationException` if unexpected input :return: parsed instance """ values = _read_properties(element, iterator, _READERS_FOR_QUERY_FILTER) the_fragment: Optional[str] = values.get("fragment") the_condition: Optional[our_types.LogicalExpression] = values.get("condition") if the_fragment is None: raise DeserializationException("The required property 'fragment' is missing") if the_condition is None: raise DeserializationException("The required property 'condition' is missing") return our_types.QueryFilter(the_fragment, the_condition) def _read_query_filter_as_element( element: Element, iterator: Iterator[Tuple[str, Element]] ) -> our_types.QueryFilter: """ Read an instance of :py:class:`.types.QueryFilter` from :paramref:`iterator`, including the end element. :param element: start element :param iterator: Input stream of ``(event, element)`` coming from :py:func:`xml.etree.ElementTree.iterparse` with the argument ``events=["start", "end"]`` :raise: :py:class:`DeserializationException` if unexpected input :return: parsed instance """ return _read_named_element( element, iterator, "queryFilter", _read_query_filter_as_sequence ) def _read_query_as_sequence( element: Element, iterator: Iterator[Tuple[str, Element]] ) -> our_types.Query: """ Read an instance of :py:class:`.types.Query` as a sequence of XML-encoded properties. The end element corresponding to the :paramref:`element` will be read as well. :param element: start element, parent of the sequence :param iterator: Input stream of ``(event, element)`` coming from :py:func:`xml.etree.ElementTree.iterparse` with the argument ``events=["start", "end"]`` :raise: :py:class:`DeserializationException` if unexpected input :return: parsed instance """ values = _read_properties(element, iterator, _READERS_FOR_QUERY) the_select: Optional[our_types.QuerySelect] = values.get("select") the_condition: Optional[our_types.LogicalExpression] = values.get("condition") the_filters: Optional[List[our_types.QueryFilter]] = values.get("filters") if the_condition is None: raise DeserializationException("The required property 'condition' is missing") return our_types.Query(the_condition, the_select, the_filters) def _read_query_as_element( element: Element, iterator: Iterator[Tuple[str, Element]] ) -> our_types.Query: """ Read an instance of :py:class:`.types.Query` from :paramref:`iterator`, including the end element. :param element: start element :param iterator: Input stream of ``(event, element)`` coming from :py:func:`xml.etree.ElementTree.iterparse` with the argument ``events=["start", "end"]`` :raise: :py:class:`DeserializationException` if unexpected input :return: parsed instance """ return _read_named_element(element, iterator, "query", _read_query_as_sequence) def _read_attribute_item_as_element( element: Element, iterator: Iterator[Tuple[str, Element]] ) -> our_types.AttributeItem: """ Read an instance of :py:class:`.types.AttributeItem` from :paramref:`iterator`, including the end element. :param element: start element :param iterator: Input stream of ``(event, element)`` coming from :py:func:`xml.etree.ElementTree.iterparse` with the argument ``events=["start", "end"]`` :raise: :py:class:`DeserializationException` if unexpected input :return: parsed instance """ return _read_dispatched( element, iterator, _DISPATCH_FOR_ATTRIBUTE_ITEM, "a concrete instance of 'AttributeItem'", ) def _read_string_value_as_element( element: Element, iterator: Iterator[Tuple[str, Element]] ) -> our_types.StringValue: """ Read an instance of :py:class:`.types.StringValue` from :paramref:`iterator`, including the end element. :param element: start element :param iterator: Input stream of ``(event, element)`` coming from :py:func:`xml.etree.ElementTree.iterparse` with the argument ``events=["start", "end"]`` :raise: :py:class:`DeserializationException` if unexpected input :return: parsed instance """ return _read_dispatched( element, iterator, _DISPATCH_FOR_STRING_VALUE, "a concrete instance of 'StringValue'", ) def _read_date_time_operand_as_element( element: Element, iterator: Iterator[Tuple[str, Element]] ) -> our_types.DateTimeOperand: """ Read an instance of :py:class:`.types.DateTimeOperand` from :paramref:`iterator`, including the end element. :param element: start element :param iterator: Input stream of ``(event, element)`` coming from :py:func:`xml.etree.ElementTree.iterparse` with the argument ``events=["start", "end"]`` :raise: :py:class:`DeserializationException` if unexpected input :return: parsed instance """ return _read_dispatched( element, iterator, _DISPATCH_FOR_DATE_TIME_OPERAND, "a concrete instance of 'DateTimeOperand'", ) def _read_time_cast_operand_as_element( element: Element, iterator: Iterator[Tuple[str, Element]] ) -> our_types.TimeCastOperand: """ Read an instance of :py:class:`.types.TimeCastOperand` from :paramref:`iterator`, including the end element. :param element: start element :param iterator: Input stream of ``(event, element)`` coming from :py:func:`xml.etree.ElementTree.iterparse` with the argument ``events=["start", "end"]`` :raise: :py:class:`DeserializationException` if unexpected input :return: parsed instance """ return _read_dispatched( element, iterator, _DISPATCH_FOR_TIME_CAST_OPERAND, "a concrete instance of 'TimeCastOperand'", ) def _read_numerical_operand_as_element( element: Element, iterator: Iterator[Tuple[str, Element]] ) -> our_types.NumericalOperand: """ Read an instance of :py:class:`.types.NumericalOperand` from :paramref:`iterator`, including the end element. :param element: start element :param iterator: Input stream of ``(event, element)`` coming from :py:func:`xml.etree.ElementTree.iterparse` with the argument ``events=["start", "end"]`` :raise: :py:class:`DeserializationException` if unexpected input :return: parsed instance """ return _read_dispatched( element, iterator, _DISPATCH_FOR_NUMERICAL_OPERAND, "a concrete instance of 'NumericalOperand'", ) def _read_hex_operand_as_element( element: Element, iterator: Iterator[Tuple[str, Element]] ) -> our_types.HexOperand: """ Read an instance of :py:class:`.types.HexOperand` from :paramref:`iterator`, including the end element. :param element: start element :param iterator: Input stream of ``(event, element)`` coming from :py:func:`xml.etree.ElementTree.iterparse` with the argument ``events=["start", "end"]`` :raise: :py:class:`DeserializationException` if unexpected input :return: parsed instance """ return _read_dispatched( element, iterator, _DISPATCH_FOR_HEX_OPERAND, "a concrete instance of 'HexOperand'", ) def _read_bool_operand_as_element( element: Element, iterator: Iterator[Tuple[str, Element]] ) -> our_types.BoolOperand: """ Read an instance of :py:class:`.types.BoolOperand` from :paramref:`iterator`, including the end element. :param element: start element :param iterator: Input stream of ``(event, element)`` coming from :py:func:`xml.etree.ElementTree.iterparse` with the argument ``events=["start", "end"]`` :raise: :py:class:`DeserializationException` if unexpected input :return: parsed instance """ return _read_dispatched( element, iterator, _DISPATCH_FOR_BOOL_OPERAND, "a concrete instance of 'BoolOperand'", ) def _read_time_operand_as_element( element: Element, iterator: Iterator[Tuple[str, Element]] ) -> our_types.TimeOperand: """ Read an instance of :py:class:`.types.TimeOperand` from :paramref:`iterator`, including the end element. :param element: start element :param iterator: Input stream of ``(event, element)`` coming from :py:func:`xml.etree.ElementTree.iterparse` with the argument ``events=["start", "end"]`` :raise: :py:class:`DeserializationException` if unexpected input :return: parsed instance """ return _read_dispatched( element, iterator, _DISPATCH_FOR_TIME_OPERAND, "a concrete instance of 'TimeOperand'", ) def _read_value_as_element( element: Element, iterator: Iterator[Tuple[str, Element]] ) -> our_types.Value: """ Read an instance of :py:class:`.types.Value` from :paramref:`iterator`, including the end element. :param element: start element :param iterator: Input stream of ``(event, element)`` coming from :py:func:`xml.etree.ElementTree.iterparse` with the argument ``events=["start", "end"]`` :raise: :py:class:`DeserializationException` if unexpected input :return: parsed instance """ return _read_dispatched( element, iterator, _DISPATCH_FOR_VALUE, "a concrete instance of 'Value'" ) def _read_match_expression_as_element( element: Element, iterator: Iterator[Tuple[str, Element]] ) -> our_types.MatchExpression: """ Read an instance of :py:class:`.types.MatchExpression` from :paramref:`iterator`, including the end element. :param element: start element :param iterator: Input stream of ``(event, element)`` coming from :py:func:`xml.etree.ElementTree.iterparse` with the argument ``events=["start", "end"]`` :raise: :py:class:`DeserializationException` if unexpected input :return: parsed instance """ return _read_dispatched( element, iterator, _DISPATCH_FOR_MATCH_EXPRESSION, "a concrete instance of 'MatchExpression'", ) def _read_logical_expression_as_element( element: Element, iterator: Iterator[Tuple[str, Element]] ) -> our_types.LogicalExpression: """ Read an instance of :py:class:`.types.LogicalExpression` from :paramref:`iterator`, including the end element. :param element: start element :param iterator: Input stream of ``(event, element)`` coming from :py:func:`xml.etree.ElementTree.iterparse` with the argument ``events=["start", "end"]`` :raise: :py:class:`DeserializationException` if unexpected input :return: parsed instance """ return _read_dispatched( element, iterator, _DISPATCH_FOR_LOGICAL_EXPRESSION, "a concrete instance of 'LogicalExpression'", ) def _read_as_element( element: Element, iterator: Iterator[Tuple[str, Element]] ) -> our_types.Class: """ Read an instance from :paramref:`iterator`, including the end element. :param element: start element :param iterator: Input stream of ``(event, element)`` coming from :py:func:`xml.etree.ElementTree.iterparse` with the argument ``events=["start", "end"]`` :raise: :py:class:`DeserializationException` if unexpected input :return: parsed instance """ return _read_dispatched(element, iterator, _GENERAL_DISPATCH, "a concrete instance") #: Dispatch XML class names to read-as-sequence functions #: corresponding to concrete descendants of HasSemantics _DISPATCH_FOR_HAS_SEMANTICS: Mapping[ str, Callable[[Element, Iterator[Tuple[str, Element]]], our_types.HasSemantics] ] = { "relationshipElement": _read_relationship_element_as_sequence, "annotatedRelationshipElement": _read_annotated_relationship_element_as_sequence, "annotatedRelationshipElementMetadata": _read_annotated_relationship_element_metadata_as_sequence, "basicEventElement": _read_basic_event_element_as_sequence, "basicEventElementMetadata": _read_basic_event_element_metadata_as_sequence, "blob": _read_blob_as_sequence, "blobMetadata": _read_blob_metadata_as_sequence, "capability": _read_capability_as_sequence, "capabilityMetadata": _read_capability_metadata_as_sequence, "entity": _read_entity_as_sequence, "entityMetadata": _read_entity_metadata_as_sequence, "extension": _read_extension_as_sequence, "file": _read_file_as_sequence, "fileMetadata": _read_file_metadata_as_sequence, "multiLanguageProperty": _read_multi_language_property_as_sequence, "multiLanguagePropertyMetadata": _read_multi_language_property_metadata_as_sequence, "operation": _read_operation_as_sequence, "operationMetadata": _read_operation_metadata_as_sequence, "property": _read_property_as_sequence, "propertyMetadata": _read_property_metadata_as_sequence, "qualifier": _read_qualifier_as_sequence, "range": _read_range_as_sequence, "rangeMetadata": _read_range_metadata_as_sequence, "referenceElement": _read_reference_element_as_sequence, "referenceElementMetadata": _read_reference_element_metadata_as_sequence, "relationshipElementMetadata": _read_relationship_element_metadata_as_sequence, "specificAssetId": _read_specific_asset_id_as_sequence, "submodel": _read_submodel_as_sequence, "submodelElementCollection": _read_submodel_element_collection_as_sequence, "submodelElementCollectionMetadata": _read_submodel_element_collection_metadata_as_sequence, "submodelElementList": _read_submodel_element_list_as_sequence, "submodelElementListMetadata": _read_submodel_element_list_metadata_as_sequence, "submodelMetadata": _read_submodel_metadata_as_sequence, } #: Dispatch XML class names to read-as-sequence functions #: corresponding to concrete descendants of HasExtensions _DISPATCH_FOR_HAS_EXTENSIONS: Mapping[ str, Callable[[Element, Iterator[Tuple[str, Element]]], our_types.HasExtensions] ] = { "relationshipElement": _read_relationship_element_as_sequence, "annotatedRelationshipElement": _read_annotated_relationship_element_as_sequence, "annotatedRelationshipElementMetadata": _read_annotated_relationship_element_metadata_as_sequence, "assetAdministrationShell": _read_asset_administration_shell_as_sequence, "assetAdministrationShellMetadata": _read_asset_administration_shell_metadata_as_sequence, "basicEventElement": _read_basic_event_element_as_sequence, "basicEventElementMetadata": _read_basic_event_element_metadata_as_sequence, "blob": _read_blob_as_sequence, "blobMetadata": _read_blob_metadata_as_sequence, "capability": _read_capability_as_sequence, "capabilityMetadata": _read_capability_metadata_as_sequence, "conceptDescription": _read_concept_description_as_sequence, "entity": _read_entity_as_sequence, "entityMetadata": _read_entity_metadata_as_sequence, "file": _read_file_as_sequence, "fileMetadata": _read_file_metadata_as_sequence, "multiLanguageProperty": _read_multi_language_property_as_sequence, "multiLanguagePropertyMetadata": _read_multi_language_property_metadata_as_sequence, "operation": _read_operation_as_sequence, "operationMetadata": _read_operation_metadata_as_sequence, "property": _read_property_as_sequence, "propertyMetadata": _read_property_metadata_as_sequence, "range": _read_range_as_sequence, "rangeMetadata": _read_range_metadata_as_sequence, "referenceElement": _read_reference_element_as_sequence, "referenceElementMetadata": _read_reference_element_metadata_as_sequence, "relationshipElementMetadata": _read_relationship_element_metadata_as_sequence, "submodel": _read_submodel_as_sequence, "submodelElementCollection": _read_submodel_element_collection_as_sequence, "submodelElementCollectionMetadata": _read_submodel_element_collection_metadata_as_sequence, "submodelElementList": _read_submodel_element_list_as_sequence, "submodelElementListMetadata": _read_submodel_element_list_metadata_as_sequence, "submodelMetadata": _read_submodel_metadata_as_sequence, } #: Dispatch XML class names to read-as-sequence functions #: corresponding to concrete descendants of Referable _DISPATCH_FOR_REFERABLE: Mapping[ str, Callable[[Element, Iterator[Tuple[str, Element]]], our_types.Referable] ] = { "relationshipElement": _read_relationship_element_as_sequence, "annotatedRelationshipElement": _read_annotated_relationship_element_as_sequence, "annotatedRelationshipElementMetadata": _read_annotated_relationship_element_metadata_as_sequence, "assetAdministrationShell": _read_asset_administration_shell_as_sequence, "assetAdministrationShellMetadata": _read_asset_administration_shell_metadata_as_sequence, "basicEventElement": _read_basic_event_element_as_sequence, "basicEventElementMetadata": _read_basic_event_element_metadata_as_sequence, "blob": _read_blob_as_sequence, "blobMetadata": _read_blob_metadata_as_sequence, "capability": _read_capability_as_sequence, "capabilityMetadata": _read_capability_metadata_as_sequence, "conceptDescription": _read_concept_description_as_sequence, "entity": _read_entity_as_sequence, "entityMetadata": _read_entity_metadata_as_sequence, "file": _read_file_as_sequence, "fileMetadata": _read_file_metadata_as_sequence, "multiLanguageProperty": _read_multi_language_property_as_sequence, "multiLanguagePropertyMetadata": _read_multi_language_property_metadata_as_sequence, "operation": _read_operation_as_sequence, "operationMetadata": _read_operation_metadata_as_sequence, "property": _read_property_as_sequence, "propertyMetadata": _read_property_metadata_as_sequence, "range": _read_range_as_sequence, "rangeMetadata": _read_range_metadata_as_sequence, "referenceElement": _read_reference_element_as_sequence, "referenceElementMetadata": _read_reference_element_metadata_as_sequence, "relationshipElementMetadata": _read_relationship_element_metadata_as_sequence, "submodel": _read_submodel_as_sequence, "submodelElementCollection": _read_submodel_element_collection_as_sequence, "submodelElementCollectionMetadata": _read_submodel_element_collection_metadata_as_sequence, "submodelElementList": _read_submodel_element_list_as_sequence, "submodelElementListMetadata": _read_submodel_element_list_metadata_as_sequence, "submodelMetadata": _read_submodel_metadata_as_sequence, } #: Dispatch XML class names to read-as-sequence functions #: corresponding to concrete descendants of Identifiable _DISPATCH_FOR_IDENTIFIABLE: Mapping[ str, Callable[[Element, Iterator[Tuple[str, Element]]], our_types.Identifiable] ] = { "assetAdministrationShell": _read_asset_administration_shell_as_sequence, "assetAdministrationShellMetadata": _read_asset_administration_shell_metadata_as_sequence, "conceptDescription": _read_concept_description_as_sequence, "submodel": _read_submodel_as_sequence, "submodelMetadata": _read_submodel_metadata_as_sequence, } #: Dispatch XML class names to read-as-sequence functions #: corresponding to concrete descendants of HasKind _DISPATCH_FOR_HAS_KIND: Mapping[ str, Callable[[Element, Iterator[Tuple[str, Element]]], our_types.HasKind] ] = { "submodel": _read_submodel_as_sequence, "submodelMetadata": _read_submodel_metadata_as_sequence, } #: Dispatch XML class names to read-as-sequence functions #: corresponding to concrete descendants of HasDataSpecification _DISPATCH_FOR_HAS_DATA_SPECIFICATION: Mapping[ str, Callable[[Element, Iterator[Tuple[str, Element]]], our_types.HasDataSpecification], ] = { "administrativeInformation": _read_administrative_information_as_sequence, "relationshipElement": _read_relationship_element_as_sequence, "annotatedRelationshipElement": _read_annotated_relationship_element_as_sequence, "annotatedRelationshipElementMetadata": _read_annotated_relationship_element_metadata_as_sequence, "assetAdministrationShell": _read_asset_administration_shell_as_sequence, "assetAdministrationShellMetadata": _read_asset_administration_shell_metadata_as_sequence, "basicEventElement": _read_basic_event_element_as_sequence, "basicEventElementMetadata": _read_basic_event_element_metadata_as_sequence, "blob": _read_blob_as_sequence, "blobMetadata": _read_blob_metadata_as_sequence, "capability": _read_capability_as_sequence, "capabilityMetadata": _read_capability_metadata_as_sequence, "conceptDescription": _read_concept_description_as_sequence, "entity": _read_entity_as_sequence, "entityMetadata": _read_entity_metadata_as_sequence, "file": _read_file_as_sequence, "fileMetadata": _read_file_metadata_as_sequence, "multiLanguageProperty": _read_multi_language_property_as_sequence, "multiLanguagePropertyMetadata": _read_multi_language_property_metadata_as_sequence, "operation": _read_operation_as_sequence, "operationMetadata": _read_operation_metadata_as_sequence, "property": _read_property_as_sequence, "propertyMetadata": _read_property_metadata_as_sequence, "range": _read_range_as_sequence, "rangeMetadata": _read_range_metadata_as_sequence, "referenceElement": _read_reference_element_as_sequence, "referenceElementMetadata": _read_reference_element_metadata_as_sequence, "relationshipElementMetadata": _read_relationship_element_metadata_as_sequence, "submodel": _read_submodel_as_sequence, "submodelElementCollection": _read_submodel_element_collection_as_sequence, "submodelElementCollectionMetadata": _read_submodel_element_collection_metadata_as_sequence, "submodelElementList": _read_submodel_element_list_as_sequence, "submodelElementListMetadata": _read_submodel_element_list_metadata_as_sequence, "submodelMetadata": _read_submodel_metadata_as_sequence, } #: Dispatch XML class names to read-as-sequence functions #: corresponding to concrete descendants of Qualifiable _DISPATCH_FOR_QUALIFIABLE: Mapping[ str, Callable[[Element, Iterator[Tuple[str, Element]]], our_types.Qualifiable] ] = { "relationshipElement": _read_relationship_element_as_sequence, "annotatedRelationshipElement": _read_annotated_relationship_element_as_sequence, "annotatedRelationshipElementMetadata": _read_annotated_relationship_element_metadata_as_sequence, "basicEventElement": _read_basic_event_element_as_sequence, "basicEventElementMetadata": _read_basic_event_element_metadata_as_sequence, "blob": _read_blob_as_sequence, "blobMetadata": _read_blob_metadata_as_sequence, "capability": _read_capability_as_sequence, "capabilityMetadata": _read_capability_metadata_as_sequence, "entity": _read_entity_as_sequence, "entityMetadata": _read_entity_metadata_as_sequence, "file": _read_file_as_sequence, "fileMetadata": _read_file_metadata_as_sequence, "multiLanguageProperty": _read_multi_language_property_as_sequence, "multiLanguagePropertyMetadata": _read_multi_language_property_metadata_as_sequence, "operation": _read_operation_as_sequence, "operationMetadata": _read_operation_metadata_as_sequence, "property": _read_property_as_sequence, "propertyMetadata": _read_property_metadata_as_sequence, "range": _read_range_as_sequence, "rangeMetadata": _read_range_metadata_as_sequence, "referenceElement": _read_reference_element_as_sequence, "referenceElementMetadata": _read_reference_element_metadata_as_sequence, "relationshipElementMetadata": _read_relationship_element_metadata_as_sequence, "submodel": _read_submodel_as_sequence, "submodelElementCollection": _read_submodel_element_collection_as_sequence, "submodelElementCollectionMetadata": _read_submodel_element_collection_metadata_as_sequence, "submodelElementList": _read_submodel_element_list_as_sequence, "submodelElementListMetadata": _read_submodel_element_list_metadata_as_sequence, "submodelMetadata": _read_submodel_metadata_as_sequence, } #: Dispatch XML class names to read-as-sequence functions #: corresponding to concrete descendants of SubmodelElement _DISPATCH_FOR_SUBMODEL_ELEMENT: Mapping[ str, Callable[[Element, Iterator[Tuple[str, Element]]], our_types.SubmodelElement] ] = { "relationshipElement": _read_relationship_element_as_sequence, "annotatedRelationshipElement": _read_annotated_relationship_element_as_sequence, "basicEventElement": _read_basic_event_element_as_sequence, "blob": _read_blob_as_sequence, "capability": _read_capability_as_sequence, "entity": _read_entity_as_sequence, "file": _read_file_as_sequence, "multiLanguageProperty": _read_multi_language_property_as_sequence, "operation": _read_operation_as_sequence, "property": _read_property_as_sequence, "range": _read_range_as_sequence, "referenceElement": _read_reference_element_as_sequence, "submodelElementCollection": _read_submodel_element_collection_as_sequence, "submodelElementList": _read_submodel_element_list_as_sequence, } #: Dispatch XML class names to read-as-sequence functions #: corresponding to RelationshipElement and its concrete descendants _DISPATCH_FOR_RELATIONSHIP_ELEMENT: Mapping[ str, Callable[[Element, Iterator[Tuple[str, Element]]], our_types.RelationshipElement], ] = { "relationshipElement": _read_relationship_element_as_sequence, "annotatedRelationshipElement": _read_annotated_relationship_element_as_sequence, } #: Dispatch XML class names to read-as-sequence functions #: corresponding to concrete descendants of DataElement _DISPATCH_FOR_DATA_ELEMENT: Mapping[ str, Callable[[Element, Iterator[Tuple[str, Element]]], our_types.DataElement] ] = { "blob": _read_blob_as_sequence, "file": _read_file_as_sequence, "multiLanguageProperty": _read_multi_language_property_as_sequence, "property": _read_property_as_sequence, "range": _read_range_as_sequence, "referenceElement": _read_reference_element_as_sequence, } #: Dispatch XML class names to read-as-sequence functions #: corresponding to concrete descendants of EventElement _DISPATCH_FOR_EVENT_ELEMENT: Mapping[ str, Callable[[Element, Iterator[Tuple[str, Element]]], our_types.EventElement] ] = { "basicEventElement": _read_basic_event_element_as_sequence, } #: Dispatch XML class names to read-as-sequence functions #: corresponding to concrete descendants of AbstractLangString _DISPATCH_FOR_ABSTRACT_LANG_STRING: Mapping[ str, Callable[[Element, Iterator[Tuple[str, Element]]], our_types.AbstractLangString], ] = { "definitionTypeUom": _read_definition_type_uom_as_sequence, "langStringDefinitionTypeIec61360": _read_lang_string_definition_type_iec_61360_as_sequence, "langStringNameType": _read_lang_string_name_type_as_sequence, "langStringPreferredNameTypeIec61360": _read_lang_string_preferred_name_type_iec_61360_as_sequence, "langStringShortNameTypeIec61360": _read_lang_string_short_name_type_iec_61360_as_sequence, "langStringTextType": _read_lang_string_text_type_as_sequence, "langStringUom": _read_lang_string_uom_as_sequence, } #: Dispatch XML class names to read-as-sequence functions #: corresponding to concrete descendants of DataSpecificationContent _DISPATCH_FOR_DATA_SPECIFICATION_CONTENT: Mapping[ str, Callable[ [Element, Iterator[Tuple[str, Element]]], our_types.DataSpecificationContent ], ] = { "dataSpecificationIec61360": _read_data_specification_iec_61360_as_sequence, "dataSpecificationUom": _read_data_specification_uom_as_sequence, } #: Dispatch XML class names to read-as-sequence functions #: corresponding to concrete descendants of Descriptor _DISPATCH_FOR_DESCRIPTOR: Mapping[ str, Callable[[Element, Iterator[Tuple[str, Element]]], our_types.Descriptor] ] = { "assetAdministrationShellDescriptor": _read_asset_administration_shell_descriptor_as_sequence, "submodelDescriptor": _read_submodel_descriptor_as_sequence, } #: Dispatch XML class names to read-as-sequence functions #: corresponding to concrete descendants of RecentChange _DISPATCH_FOR_RECENT_CHANGE: Mapping[ str, Callable[[Element, Iterator[Tuple[str, Element]]], our_types.RecentChange] ] = { "assetAdministrationShellRecentChange": _read_asset_administration_shell_recent_change_as_sequence, "conceptDescriptionRecentChange": _read_concept_description_recent_change_as_sequence, "submodelRecentChange": _read_submodel_recent_change_as_sequence, } #: Dispatch XML class names to read-as-sequence functions #: corresponding to concrete descendants of SubmodelElementAttributes _DISPATCH_FOR_SUBMODEL_ELEMENT_ATTRIBUTES: Mapping[ str, Callable[ [Element, Iterator[Tuple[str, Element]]], our_types.SubmodelElementAttributes ], ] = { "annotatedRelationshipElementMetadata": _read_annotated_relationship_element_metadata_as_sequence, "basicEventElementMetadata": _read_basic_event_element_metadata_as_sequence, "blobMetadata": _read_blob_metadata_as_sequence, "capabilityMetadata": _read_capability_metadata_as_sequence, "entityMetadata": _read_entity_metadata_as_sequence, "fileMetadata": _read_file_metadata_as_sequence, "multiLanguagePropertyMetadata": _read_multi_language_property_metadata_as_sequence, "operationMetadata": _read_operation_metadata_as_sequence, "propertyMetadata": _read_property_metadata_as_sequence, "rangeMetadata": _read_range_metadata_as_sequence, "referenceElementMetadata": _read_reference_element_metadata_as_sequence, "relationshipElementMetadata": _read_relationship_element_metadata_as_sequence, "submodelElementCollectionMetadata": _read_submodel_element_collection_metadata_as_sequence, "submodelElementListMetadata": _read_submodel_element_list_metadata_as_sequence, } #: Dispatch XML class names to read-as-sequence functions #: corresponding to concrete descendants of SubmodelElementMetadata _DISPATCH_FOR_SUBMODEL_ELEMENT_METADATA: Mapping[ str, Callable[ [Element, Iterator[Tuple[str, Element]]], our_types.SubmodelElementMetadata ], ] = { "annotatedRelationshipElementMetadata": _read_annotated_relationship_element_metadata_as_sequence, "basicEventElementMetadata": _read_basic_event_element_metadata_as_sequence, "blobMetadata": _read_blob_metadata_as_sequence, "capabilityMetadata": _read_capability_metadata_as_sequence, "entityMetadata": _read_entity_metadata_as_sequence, "fileMetadata": _read_file_metadata_as_sequence, "multiLanguagePropertyMetadata": _read_multi_language_property_metadata_as_sequence, "operationMetadata": _read_operation_metadata_as_sequence, "propertyMetadata": _read_property_metadata_as_sequence, "rangeMetadata": _read_range_metadata_as_sequence, "referenceElementMetadata": _read_reference_element_metadata_as_sequence, "relationshipElementMetadata": _read_relationship_element_metadata_as_sequence, "submodelElementCollectionMetadata": _read_submodel_element_collection_metadata_as_sequence, "submodelElementListMetadata": _read_submodel_element_list_metadata_as_sequence, } #: Dispatch XML class names to read-as-sequence functions #: corresponding to the implementers of AttributeItem _DISPATCH_FOR_ATTRIBUTE_ITEM: Mapping[ str, Callable[[Element, Iterator[Tuple[str, Element]]], our_types.AttributeItem] ] = { "claimAttribute": _read_claim_attribute_as_sequence, "globalAttribute": _read_global_attribute_as_sequence, "referenceAttribute": _read_reference_attribute_as_sequence, } #: Dispatch XML class names to read-as-sequence functions #: corresponding to the implementers of StringValue _DISPATCH_FOR_STRING_VALUE: Mapping[ str, Callable[[Element, Iterator[Tuple[str, Element]]], our_types.StringValue] ] = { "fieldOperand": _read_field_operand_as_sequence, "stringLiteral": _read_string_literal_as_sequence, "stringCast": _read_string_cast_as_sequence, "attributeOperand": _read_attribute_operand_as_sequence, } #: Dispatch XML class names to read-as-sequence functions #: corresponding to the implementers of DateTimeOperand _DISPATCH_FOR_DATE_TIME_OPERAND: Mapping[ str, Callable[[Element, Iterator[Tuple[str, Element]]], our_types.DateTimeOperand] ] = { "dateTimeLiteral": _read_date_time_literal_as_sequence, "dateTimeCast": _read_date_time_cast_as_sequence, "dateTimeAttributeOperand": _read_date_time_attribute_operand_as_sequence, } #: Dispatch XML class names to read-as-sequence functions #: corresponding to the implementers of TimeCastOperand _DISPATCH_FOR_TIME_CAST_OPERAND: Mapping[ str, Callable[[Element, Iterator[Tuple[str, Element]]], our_types.TimeCastOperand] ] = { "fieldOperand": _read_field_operand_as_sequence, "stringLiteral": _read_string_literal_as_sequence, "stringCast": _read_string_cast_as_sequence, "attributeOperand": _read_attribute_operand_as_sequence, "dateTimeLiteral": _read_date_time_literal_as_sequence, "dateTimeCast": _read_date_time_cast_as_sequence, } #: Dispatch XML class names to read-as-sequence functions #: corresponding to the implementers of NumericalOperand _DISPATCH_FOR_NUMERICAL_OPERAND: Mapping[ str, Callable[[Element, Iterator[Tuple[str, Element]]], our_types.NumericalOperand] ] = { "numberLiteral": _read_number_literal_as_sequence, "numberCast": _read_number_cast_as_sequence, "dayOfWeek": _read_day_of_week_as_sequence, "dayOfMonth": _read_day_of_month_as_sequence, "month": _read_month_as_sequence, "year": _read_year_as_sequence, } #: Dispatch XML class names to read-as-sequence functions #: corresponding to the implementers of HexOperand _DISPATCH_FOR_HEX_OPERAND: Mapping[ str, Callable[[Element, Iterator[Tuple[str, Element]]], our_types.HexOperand] ] = { "hexLiteral": _read_hex_literal_as_sequence, "hexCast": _read_hex_cast_as_sequence, } #: Dispatch XML class names to read-as-sequence functions #: corresponding to the implementers of BoolOperand _DISPATCH_FOR_BOOL_OPERAND: Mapping[ str, Callable[[Element, Iterator[Tuple[str, Element]]], our_types.BoolOperand] ] = { "booleanLiteral": _read_boolean_literal_as_sequence, "booleanCast": _read_boolean_cast_as_sequence, } #: Dispatch XML class names to read-as-sequence functions #: corresponding to the implementers of TimeOperand _DISPATCH_FOR_TIME_OPERAND: Mapping[ str, Callable[[Element, Iterator[Tuple[str, Element]]], our_types.TimeOperand] ] = { "timeLiteral": _read_time_literal_as_sequence, "timeCast": _read_time_cast_as_sequence, } #: Dispatch XML class names to read-as-sequence functions #: corresponding to the implementers of Value _DISPATCH_FOR_VALUE: Mapping[ str, Callable[[Element, Iterator[Tuple[str, Element]]], our_types.Value] ] = { "fieldOperand": _read_field_operand_as_sequence, "stringLiteral": _read_string_literal_as_sequence, "stringCast": _read_string_cast_as_sequence, "attributeOperand": _read_attribute_operand_as_sequence, "numberLiteral": _read_number_literal_as_sequence, "numberCast": _read_number_cast_as_sequence, "dayOfWeek": _read_day_of_week_as_sequence, "dayOfMonth": _read_day_of_month_as_sequence, "month": _read_month_as_sequence, "year": _read_year_as_sequence, "hexLiteral": _read_hex_literal_as_sequence, "hexCast": _read_hex_cast_as_sequence, "booleanLiteral": _read_boolean_literal_as_sequence, "booleanCast": _read_boolean_cast_as_sequence, "dateTimeLiteral": _read_date_time_literal_as_sequence, "dateTimeCast": _read_date_time_cast_as_sequence, "timeLiteral": _read_time_literal_as_sequence, "timeCast": _read_time_cast_as_sequence, } #: Dispatch XML class names to read-as-sequence functions #: corresponding to the implementers of MatchExpression _DISPATCH_FOR_MATCH_EXPRESSION: Mapping[ str, Callable[[Element, Iterator[Tuple[str, Element]]], our_types.MatchExpression] ] = { "matchClause": _read_match_clause_as_sequence, "equalComparison": _read_equal_comparison_as_sequence, "notEqualComparison": _read_not_equal_comparison_as_sequence, "greaterThanComparison": _read_greater_than_comparison_as_sequence, "greaterThanOrEqualComparison": _read_greater_than_or_equal_comparison_as_sequence, "lessThanComparison": _read_less_than_comparison_as_sequence, "lessThanOrEqualComparison": _read_less_than_or_equal_comparison_as_sequence, "containsComparison": _read_contains_comparison_as_sequence, "startsWithComparison": _read_starts_with_comparison_as_sequence, "endsWithComparison": _read_ends_with_comparison_as_sequence, "regexComparison": _read_regex_comparison_as_sequence, } #: Dispatch XML class names to read-as-sequence functions #: corresponding to the implementers of LogicalExpression _DISPATCH_FOR_LOGICAL_EXPRESSION: Mapping[ str, Callable[[Element, Iterator[Tuple[str, Element]]], our_types.LogicalExpression] ] = { "andExpression": _read_and_expression_as_sequence, "orExpression": _read_or_expression_as_sequence, "notExpression": _read_not_expression_as_sequence, "booleanLiteral": _read_boolean_literal_as_sequence, "matchClause": _read_match_clause_as_sequence, "equalComparison": _read_equal_comparison_as_sequence, "notEqualComparison": _read_not_equal_comparison_as_sequence, "greaterThanComparison": _read_greater_than_comparison_as_sequence, "greaterThanOrEqualComparison": _read_greater_than_or_equal_comparison_as_sequence, "lessThanComparison": _read_less_than_comparison_as_sequence, "lessThanOrEqualComparison": _read_less_than_or_equal_comparison_as_sequence, "containsComparison": _read_contains_comparison_as_sequence, "startsWithComparison": _read_starts_with_comparison_as_sequence, "endsWithComparison": _read_ends_with_comparison_as_sequence, "regexComparison": _read_regex_comparison_as_sequence, } #: Dispatch XML class names to read-as-sequence functions #: corresponding to the concrete classes _GENERAL_DISPATCH: Mapping[ str, Callable[[Element, Iterator[Tuple[str, Element]]], our_types.Class] ] = { "extension": _read_extension_as_sequence, "administrativeInformation": _read_administrative_information_as_sequence, "qualifier": _read_qualifier_as_sequence, "assetAdministrationShell": _read_asset_administration_shell_as_sequence, "assetInformation": _read_asset_information_as_sequence, "resource": _read_resource_as_sequence, "specificAssetId": _read_specific_asset_id_as_sequence, "submodel": _read_submodel_as_sequence, "relationshipElement": _read_relationship_element_as_sequence, "submodelElementList": _read_submodel_element_list_as_sequence, "submodelElementCollection": _read_submodel_element_collection_as_sequence, "property": _read_property_as_sequence, "multiLanguageProperty": _read_multi_language_property_as_sequence, "range": _read_range_as_sequence, "referenceElement": _read_reference_element_as_sequence, "blob": _read_blob_as_sequence, "file": _read_file_as_sequence, "annotatedRelationshipElement": _read_annotated_relationship_element_as_sequence, "entity": _read_entity_as_sequence, "eventPayload": _read_event_payload_as_sequence, "basicEventElement": _read_basic_event_element_as_sequence, "operation": _read_operation_as_sequence, "operationVariable": _read_operation_variable_as_sequence, "capability": _read_capability_as_sequence, "conceptDescription": _read_concept_description_as_sequence, "reference": _read_reference_as_sequence, "key": _read_key_as_sequence, "langStringNameType": _read_lang_string_name_type_as_sequence, "langStringTextType": _read_lang_string_text_type_as_sequence, "environment": _read_environment_as_sequence, "embeddedDataSpecification": _read_embedded_data_specification_as_sequence, "levelType": _read_level_type_as_sequence, "valueReferencePair": _read_value_reference_pair_as_sequence, "valueList": _read_value_list_as_sequence, "langStringPreferredNameTypeIec61360": _read_lang_string_preferred_name_type_iec_61360_as_sequence, "langStringShortNameTypeIec61360": _read_lang_string_short_name_type_iec_61360_as_sequence, "langStringDefinitionTypeIec61360": _read_lang_string_definition_type_iec_61360_as_sequence, "langStringUom": _read_lang_string_uom_as_sequence, "definitionTypeUom": _read_definition_type_uom_as_sequence, "dataSpecificationUom": _read_data_specification_uom_as_sequence, "dataSpecificationIec61360": _read_data_specification_iec_61360_as_sequence, "assetAdministrationShellDescriptor": _read_asset_administration_shell_descriptor_as_sequence, "submodelDescriptor": _read_submodel_descriptor_as_sequence, "endpoint": _read_endpoint_as_sequence, "protocolInformation": _read_protocol_information_as_sequence, "securityAttributeObject": _read_security_attribute_object_as_sequence, "assetLink": _read_asset_link_as_sequence, "serviceDescription": _read_service_description_as_sequence, "assetAdministrationShellRecentChange": _read_asset_administration_shell_recent_change_as_sequence, "conceptDescriptionRecentChange": _read_concept_description_recent_change_as_sequence, "submodelRecentChange": _read_submodel_recent_change_as_sequence, "result": _read_result_as_sequence, "message": _read_message_as_sequence, "operationRequest": _read_operation_request_as_sequence, "operationRequestAsync": _read_operation_request_async_as_sequence, "operationRequestValueOnly": _read_operation_request_value_only_as_sequence, "operationRequestAsyncValueOnly": _read_operation_request_async_value_only_as_sequence, "baseOperationResult": _read_base_operation_result_as_sequence, "operationResult": _read_operation_result_as_sequence, "operationResultValueOnly": _read_operation_result_value_only_as_sequence, "operationHandle": _read_operation_handle_as_sequence, "pagedResult": _read_paged_result_as_sequence, "pagingMetadata": _read_paging_metadata_as_sequence, "packageDescription": _read_package_description_as_sequence, "propertyMetadata": _read_property_metadata_as_sequence, "rangeMetadata": _read_range_metadata_as_sequence, "blobMetadata": _read_blob_metadata_as_sequence, "fileMetadata": _read_file_metadata_as_sequence, "multiLanguagePropertyMetadata": _read_multi_language_property_metadata_as_sequence, "referenceElementMetadata": _read_reference_element_metadata_as_sequence, "relationshipElementMetadata": _read_relationship_element_metadata_as_sequence, "annotatedRelationshipElementMetadata": _read_annotated_relationship_element_metadata_as_sequence, "entityMetadata": _read_entity_metadata_as_sequence, "capabilityMetadata": _read_capability_metadata_as_sequence, "operationMetadata": _read_operation_metadata_as_sequence, "submodelElementCollectionMetadata": _read_submodel_element_collection_metadata_as_sequence, "basicEventElementMetadata": _read_basic_event_element_metadata_as_sequence, "submodelElementListMetadata": _read_submodel_element_list_metadata_as_sequence, "submodelMetadata": _read_submodel_metadata_as_sequence, "assetAdministrationShellMetadata": _read_asset_administration_shell_metadata_as_sequence, "referenceElementValue": _read_reference_element_value_as_sequence, "blobValue": _read_blob_value_as_sequence, "fileValue": _read_file_value_as_sequence, "rangeValue": _read_range_value_as_sequence, "relationshipElementValue": _read_relationship_element_value_as_sequence, "basicEventElementValue": _read_basic_event_element_value_as_sequence, "annotatedRelationshipElementValue": _read_annotated_relationship_element_value_as_sequence, "entityValue": _read_entity_value_as_sequence, "getAssetAdministrationShellsResult": _read_get_asset_administration_shells_result_as_sequence, "getAssetAdministrationShellsMetadataResult": _read_get_asset_administration_shells_metadata_result_as_sequence, "getAllAssetAdministrationShellsRecentChangesResult": _read_get_all_asset_administration_shells_recent_changes_result_as_sequence, "getAssetAdministrationShellDescriptorsResult": _read_get_asset_administration_shell_descriptors_result_as_sequence, "getConceptDescriptionsResult": _read_get_concept_descriptions_result_as_sequence, "getAllConceptDescriptionsRecentChangesResult": _read_get_all_concept_descriptions_recent_changes_result_as_sequence, "getPackageDescriptionsResult": _read_get_package_descriptions_result_as_sequence, "getPathItemsResult": _read_get_path_items_result_as_sequence, "getReferencesResult": _read_get_references_result_as_sequence, "getSubmodelDescriptorsResult": _read_get_submodel_descriptors_result_as_sequence, "getSubmodelElementsMetadataResult": _read_get_submodel_elements_metadata_result_as_sequence, "getSubmodelElementsResult": _read_get_submodel_elements_result_as_sequence, "getSubmodelElementsValueResult": _read_get_submodel_elements_value_result_as_sequence, "getAllSubmodelsRecentChangesResult": _read_get_all_submodels_recent_changes_result_as_sequence, "getSubmodelsMetadataResult": _read_get_submodels_metadata_result_as_sequence, "getSubmodelsResult": _read_get_submodels_result_as_sequence, "getSubmodelsValueResult": _read_get_submodels_value_result_as_sequence, "claimAttribute": _read_claim_attribute_as_sequence, "globalAttribute": _read_global_attribute_as_sequence, "referenceAttribute": _read_reference_attribute_as_sequence, "dateTimeAttributeItem": _read_date_time_attribute_item_as_sequence, "fieldOperand": _read_field_operand_as_sequence, "stringLiteral": _read_string_literal_as_sequence, "attributeOperand": _read_attribute_operand_as_sequence, "numberLiteral": _read_number_literal_as_sequence, "hexLiteral": _read_hex_literal_as_sequence, "dateTimeLiteral": _read_date_time_literal_as_sequence, "timeLiteral": _read_time_literal_as_sequence, "booleanLiteral": _read_boolean_literal_as_sequence, "stringCast": _read_string_cast_as_sequence, "numberCast": _read_number_cast_as_sequence, "hexCast": _read_hex_cast_as_sequence, "booleanCast": _read_boolean_cast_as_sequence, "dateTimeCast": _read_date_time_cast_as_sequence, "timeCast": _read_time_cast_as_sequence, "dayOfWeek": _read_day_of_week_as_sequence, "dayOfMonth": _read_day_of_month_as_sequence, "month": _read_month_as_sequence, "year": _read_year_as_sequence, "dateTimeAttributeOperand": _read_date_time_attribute_operand_as_sequence, "equalComparison": _read_equal_comparison_as_sequence, "notEqualComparison": _read_not_equal_comparison_as_sequence, "greaterThanComparison": _read_greater_than_comparison_as_sequence, "greaterThanOrEqualComparison": _read_greater_than_or_equal_comparison_as_sequence, "lessThanComparison": _read_less_than_comparison_as_sequence, "lessThanOrEqualComparison": _read_less_than_or_equal_comparison_as_sequence, "containsComparison": _read_contains_comparison_as_sequence, "startsWithComparison": _read_starts_with_comparison_as_sequence, "endsWithComparison": _read_ends_with_comparison_as_sequence, "regexComparison": _read_regex_comparison_as_sequence, "matchClause": _read_match_clause_as_sequence, "andExpression": _read_and_expression_as_sequence, "orExpression": _read_or_expression_as_sequence, "notExpression": _read_not_expression_as_sequence, "queryFilter": _read_query_filter_as_sequence, "query": _read_query_as_sequence, } #: Read the content of a property of #: :py:class:`.types.Extension`, by the XML name of the property _READERS_FOR_EXTENSION: Mapping[str, _ContentReader[Any]] = { "semanticId": _read_reference_as_sequence, "supplementalSemanticIds": _read_list_of__reference, "name": read_str_from_element_text, "valueType": _read_data_type_def_xsd_from_element_text, "value": read_str_from_element_text, "refersTo": _read_list_of__reference, } #: Read the content of a property of #: :py:class:`.types.AdministrativeInformation`, by the XML name of the property _READERS_FOR_ADMINISTRATIVE_INFORMATION: Mapping[str, _ContentReader[Any]] = { "embeddedDataSpecifications": _read_list_of__embedded_data_specification, "version": read_str_from_element_text, "revision": read_str_from_element_text, "creator": _read_reference_as_sequence, "createdAt": read_str_from_element_text, "updatedAt": read_str_from_element_text, "templateId": read_str_from_element_text, } #: Read the content of a property of #: :py:class:`.types.Qualifier`, by the XML name of the property _READERS_FOR_QUALIFIER: Mapping[str, _ContentReader[Any]] = { "semanticId": _read_reference_as_sequence, "supplementalSemanticIds": _read_list_of__reference, "kind": _read_qualifier_kind_from_element_text, "type": read_str_from_element_text, "valueType": _read_data_type_def_xsd_from_element_text, "value": read_str_from_element_text, "valueId": _read_reference_as_sequence, } #: Read the content of a property of #: :py:class:`.types.AssetAdministrationShell`, by the XML name of the property _READERS_FOR_ASSET_ADMINISTRATION_SHELL: Mapping[str, _ContentReader[Any]] = { "extensions": _read_list_of__extension, "category": read_str_from_element_text, "idShort": read_str_from_element_text, "displayName": _read_list_of__lang_string_name_type, "description": _read_list_of__lang_string_text_type, "administration": _read_administrative_information_as_sequence, "id": read_str_from_element_text, "embeddedDataSpecifications": _read_list_of__embedded_data_specification, "derivedFrom": _read_reference_as_sequence, "assetInformation": _read_asset_information_as_sequence, "submodels": _read_list_of__reference, } #: Read the content of a property of #: :py:class:`.types.AssetInformation`, by the XML name of the property _READERS_FOR_ASSET_INFORMATION: Mapping[str, _ContentReader[Any]] = { "assetKind": _read_asset_kind_from_element_text, "globalAssetId": read_str_from_element_text, "specificAssetIds": _read_list_of__specific_asset_id, "assetType": read_str_from_element_text, "defaultThumbnail": _read_resource_as_sequence, } #: Read the content of a property of #: :py:class:`.types.Resource`, by the XML name of the property _READERS_FOR_RESOURCE: Mapping[str, _ContentReader[Any]] = { "path": read_str_from_element_text, "contentType": read_str_from_element_text, } #: Read the content of a property of #: :py:class:`.types.SpecificAssetID`, by the XML name of the property _READERS_FOR_SPECIFIC_ASSET_ID: Mapping[str, _ContentReader[Any]] = { "semanticId": _read_reference_as_sequence, "supplementalSemanticIds": _read_list_of__reference, "name": read_str_from_element_text, "value": read_str_from_element_text, "externalSubjectId": _read_reference_as_sequence, } #: Read the content of a property of #: :py:class:`.types.Submodel`, by the XML name of the property _READERS_FOR_SUBMODEL: Mapping[str, _ContentReader[Any]] = { "extensions": _read_list_of__extension, "category": read_str_from_element_text, "idShort": read_str_from_element_text, "displayName": _read_list_of__lang_string_name_type, "description": _read_list_of__lang_string_text_type, "administration": _read_administrative_information_as_sequence, "id": read_str_from_element_text, "kind": _read_modelling_kind_from_element_text, "semanticId": _read_reference_as_sequence, "supplementalSemanticIds": _read_list_of__reference, "qualifiers": _read_list_of__qualifier, "embeddedDataSpecifications": _read_list_of__embedded_data_specification, "submodelElements": _read_list_of__submodel_element, } #: Read the content of a property of #: :py:class:`.types.RelationshipElement`, by the XML name of the property _READERS_FOR_RELATIONSHIP_ELEMENT: Mapping[str, _ContentReader[Any]] = { "extensions": _read_list_of__extension, "category": read_str_from_element_text, "idShort": read_str_from_element_text, "displayName": _read_list_of__lang_string_name_type, "description": _read_list_of__lang_string_text_type, "semanticId": _read_reference_as_sequence, "supplementalSemanticIds": _read_list_of__reference, "qualifiers": _read_list_of__qualifier, "embeddedDataSpecifications": _read_list_of__embedded_data_specification, "first": _read_reference_as_sequence, "second": _read_reference_as_sequence, } #: Read the content of a property of #: :py:class:`.types.SubmodelElementList`, by the XML name of the property _READERS_FOR_SUBMODEL_ELEMENT_LIST: Mapping[str, _ContentReader[Any]] = { "extensions": _read_list_of__extension, "category": read_str_from_element_text, "idShort": read_str_from_element_text, "displayName": _read_list_of__lang_string_name_type, "description": _read_list_of__lang_string_text_type, "semanticId": _read_reference_as_sequence, "supplementalSemanticIds": _read_list_of__reference, "qualifiers": _read_list_of__qualifier, "embeddedDataSpecifications": _read_list_of__embedded_data_specification, "orderRelevant": _read_bool_from_element_text, "semanticIdListElement": _read_reference_as_sequence, "typeValueListElement": _read_aas_submodel_elements_from_element_text, "valueTypeListElement": _read_data_type_def_xsd_from_element_text, "value": _read_list_of__submodel_element, } #: Read the content of a property of #: :py:class:`.types.SubmodelElementCollection`, by the XML name of the property _READERS_FOR_SUBMODEL_ELEMENT_COLLECTION: Mapping[str, _ContentReader[Any]] = { "extensions": _read_list_of__extension, "category": read_str_from_element_text, "idShort": read_str_from_element_text, "displayName": _read_list_of__lang_string_name_type, "description": _read_list_of__lang_string_text_type, "semanticId": _read_reference_as_sequence, "supplementalSemanticIds": _read_list_of__reference, "qualifiers": _read_list_of__qualifier, "embeddedDataSpecifications": _read_list_of__embedded_data_specification, "value": _read_list_of__submodel_element, } #: Read the content of a property of #: :py:class:`.types.Property`, by the XML name of the property _READERS_FOR_PROPERTY: Mapping[str, _ContentReader[Any]] = { "extensions": _read_list_of__extension, "category": read_str_from_element_text, "idShort": read_str_from_element_text, "displayName": _read_list_of__lang_string_name_type, "description": _read_list_of__lang_string_text_type, "semanticId": _read_reference_as_sequence, "supplementalSemanticIds": _read_list_of__reference, "qualifiers": _read_list_of__qualifier, "embeddedDataSpecifications": _read_list_of__embedded_data_specification, "valueType": _read_data_type_def_xsd_from_element_text, "value": read_str_from_element_text, "valueId": _read_reference_as_sequence, } #: Read the content of a property of #: :py:class:`.types.MultiLanguageProperty`, by the XML name of the property _READERS_FOR_MULTI_LANGUAGE_PROPERTY: Mapping[str, _ContentReader[Any]] = { "extensions": _read_list_of__extension, "category": read_str_from_element_text, "idShort": read_str_from_element_text, "displayName": _read_list_of__lang_string_name_type, "description": _read_list_of__lang_string_text_type, "semanticId": _read_reference_as_sequence, "supplementalSemanticIds": _read_list_of__reference, "qualifiers": _read_list_of__qualifier, "embeddedDataSpecifications": _read_list_of__embedded_data_specification, "value": _read_list_of__lang_string_text_type, "valueId": _read_reference_as_sequence, } #: Read the content of a property of #: :py:class:`.types.Range`, by the XML name of the property _READERS_FOR_RANGE: Mapping[str, _ContentReader[Any]] = { "extensions": _read_list_of__extension, "category": read_str_from_element_text, "idShort": read_str_from_element_text, "displayName": _read_list_of__lang_string_name_type, "description": _read_list_of__lang_string_text_type, "semanticId": _read_reference_as_sequence, "supplementalSemanticIds": _read_list_of__reference, "qualifiers": _read_list_of__qualifier, "embeddedDataSpecifications": _read_list_of__embedded_data_specification, "valueType": _read_data_type_def_xsd_from_element_text, "min": read_str_from_element_text, "max": read_str_from_element_text, } #: Read the content of a property of #: :py:class:`.types.ReferenceElement`, by the XML name of the property _READERS_FOR_REFERENCE_ELEMENT: Mapping[str, _ContentReader[Any]] = { "extensions": _read_list_of__extension, "category": read_str_from_element_text, "idShort": read_str_from_element_text, "displayName": _read_list_of__lang_string_name_type, "description": _read_list_of__lang_string_text_type, "semanticId": _read_reference_as_sequence, "supplementalSemanticIds": _read_list_of__reference, "qualifiers": _read_list_of__qualifier, "embeddedDataSpecifications": _read_list_of__embedded_data_specification, "value": _read_reference_as_sequence, } #: Read the content of a property of #: :py:class:`.types.Blob`, by the XML name of the property _READERS_FOR_BLOB: Mapping[str, _ContentReader[Any]] = { "extensions": _read_list_of__extension, "category": read_str_from_element_text, "idShort": read_str_from_element_text, "displayName": _read_list_of__lang_string_name_type, "description": _read_list_of__lang_string_text_type, "semanticId": _read_reference_as_sequence, "supplementalSemanticIds": _read_list_of__reference, "qualifiers": _read_list_of__qualifier, "embeddedDataSpecifications": _read_list_of__embedded_data_specification, "value": _read_bytes_from_element_text, "contentType": read_str_from_element_text, } #: Read the content of a property of #: :py:class:`.types.File`, by the XML name of the property _READERS_FOR_FILE: Mapping[str, _ContentReader[Any]] = { "extensions": _read_list_of__extension, "category": read_str_from_element_text, "idShort": read_str_from_element_text, "displayName": _read_list_of__lang_string_name_type, "description": _read_list_of__lang_string_text_type, "semanticId": _read_reference_as_sequence, "supplementalSemanticIds": _read_list_of__reference, "qualifiers": _read_list_of__qualifier, "embeddedDataSpecifications": _read_list_of__embedded_data_specification, "value": read_str_from_element_text, "contentType": read_str_from_element_text, } #: Read the content of a property of #: :py:class:`.types.AnnotatedRelationshipElement`, by the XML name of the property _READERS_FOR_ANNOTATED_RELATIONSHIP_ELEMENT: Mapping[str, _ContentReader[Any]] = { "extensions": _read_list_of__extension, "category": read_str_from_element_text, "idShort": read_str_from_element_text, "displayName": _read_list_of__lang_string_name_type, "description": _read_list_of__lang_string_text_type, "semanticId": _read_reference_as_sequence, "supplementalSemanticIds": _read_list_of__reference, "qualifiers": _read_list_of__qualifier, "embeddedDataSpecifications": _read_list_of__embedded_data_specification, "first": _read_reference_as_sequence, "second": _read_reference_as_sequence, "annotations": _read_list_of__data_element, } #: Read the content of a property of #: :py:class:`.types.Entity`, by the XML name of the property _READERS_FOR_ENTITY: Mapping[str, _ContentReader[Any]] = { "extensions": _read_list_of__extension, "category": read_str_from_element_text, "idShort": read_str_from_element_text, "displayName": _read_list_of__lang_string_name_type, "description": _read_list_of__lang_string_text_type, "semanticId": _read_reference_as_sequence, "supplementalSemanticIds": _read_list_of__reference, "qualifiers": _read_list_of__qualifier, "embeddedDataSpecifications": _read_list_of__embedded_data_specification, "statements": _read_list_of__submodel_element, "entityType": _read_entity_type_from_element_text, "globalAssetId": read_str_from_element_text, "specificAssetIds": _read_list_of__specific_asset_id, } #: Read the content of a property of #: :py:class:`.types.EventPayload`, by the XML name of the property _READERS_FOR_EVENT_PAYLOAD: Mapping[str, _ContentReader[Any]] = { "source": _read_reference_as_sequence, "sourceSemanticId": _read_reference_as_sequence, "observableReference": _read_reference_as_sequence, "observableSemanticId": _read_reference_as_sequence, "topic": read_str_from_element_text, "subjectId": _read_reference_as_sequence, "timeStamp": read_str_from_element_text, "payload": _read_bytes_from_element_text, } #: Read the content of a property of #: :py:class:`.types.BasicEventElement`, by the XML name of the property _READERS_FOR_BASIC_EVENT_ELEMENT: Mapping[str, _ContentReader[Any]] = { "extensions": _read_list_of__extension, "category": read_str_from_element_text, "idShort": read_str_from_element_text, "displayName": _read_list_of__lang_string_name_type, "description": _read_list_of__lang_string_text_type, "semanticId": _read_reference_as_sequence, "supplementalSemanticIds": _read_list_of__reference, "qualifiers": _read_list_of__qualifier, "embeddedDataSpecifications": _read_list_of__embedded_data_specification, "observed": _read_reference_as_sequence, "direction": _read_direction_from_element_text, "state": _read_state_of_event_from_element_text, "messageTopic": read_str_from_element_text, "messageBroker": _read_reference_as_sequence, "lastUpdate": read_str_from_element_text, "minInterval": read_str_from_element_text, "maxInterval": read_str_from_element_text, } #: Read the content of a property of #: :py:class:`.types.Operation`, by the XML name of the property _READERS_FOR_OPERATION: Mapping[str, _ContentReader[Any]] = { "extensions": _read_list_of__extension, "category": read_str_from_element_text, "idShort": read_str_from_element_text, "displayName": _read_list_of__lang_string_name_type, "description": _read_list_of__lang_string_text_type, "semanticId": _read_reference_as_sequence, "supplementalSemanticIds": _read_list_of__reference, "qualifiers": _read_list_of__qualifier, "embeddedDataSpecifications": _read_list_of__embedded_data_specification, "inputVariables": _read_list_of__operation_variable, "outputVariables": _read_list_of__operation_variable, "inoutputVariables": _read_list_of__operation_variable, } #: Read the content of a property of #: :py:class:`.types.OperationVariable`, by the XML name of the property _READERS_FOR_OPERATION_VARIABLE: Mapping[str, _ContentReader[Any]] = { "value": _read_nested__submodel_element, } #: Read the content of a property of #: :py:class:`.types.Capability`, by the XML name of the property _READERS_FOR_CAPABILITY: Mapping[str, _ContentReader[Any]] = { "extensions": _read_list_of__extension, "category": read_str_from_element_text, "idShort": read_str_from_element_text, "displayName": _read_list_of__lang_string_name_type, "description": _read_list_of__lang_string_text_type, "semanticId": _read_reference_as_sequence, "supplementalSemanticIds": _read_list_of__reference, "qualifiers": _read_list_of__qualifier, "embeddedDataSpecifications": _read_list_of__embedded_data_specification, } #: Read the content of a property of #: :py:class:`.types.ConceptDescription`, by the XML name of the property _READERS_FOR_CONCEPT_DESCRIPTION: Mapping[str, _ContentReader[Any]] = { "extensions": _read_list_of__extension, "category": read_str_from_element_text, "idShort": read_str_from_element_text, "displayName": _read_list_of__lang_string_name_type, "description": _read_list_of__lang_string_text_type, "administration": _read_administrative_information_as_sequence, "id": read_str_from_element_text, "embeddedDataSpecifications": _read_list_of__embedded_data_specification, "isCaseOf": _read_list_of__reference, } #: Read the content of a property of #: :py:class:`.types.Reference`, by the XML name of the property _READERS_FOR_REFERENCE: Mapping[str, _ContentReader[Any]] = { "type": _read_reference_types_from_element_text, "referredSemanticId": _read_reference_as_sequence, "keys": _read_list_of__key, } #: Read the content of a property of #: :py:class:`.types.Key`, by the XML name of the property _READERS_FOR_KEY: Mapping[str, _ContentReader[Any]] = { "type": _read_key_types_from_element_text, "value": read_str_from_element_text, } #: Read the content of a property of #: :py:class:`.types.LangStringNameType`, by the XML name of the property _READERS_FOR_LANG_STRING_NAME_TYPE: Mapping[str, _ContentReader[Any]] = { "language": read_str_from_element_text, "text": read_str_from_element_text, } #: Read the content of a property of #: :py:class:`.types.LangStringTextType`, by the XML name of the property _READERS_FOR_LANG_STRING_TEXT_TYPE: Mapping[str, _ContentReader[Any]] = { "language": read_str_from_element_text, "text": read_str_from_element_text, } #: Read the content of a property of #: :py:class:`.types.Environment`, by the XML name of the property _READERS_FOR_ENVIRONMENT: Mapping[str, _ContentReader[Any]] = { "assetAdministrationShells": _read_list_of__asset_administration_shell, "submodels": _read_list_of__submodel, "conceptDescriptions": _read_list_of__concept_description, } #: Read the content of a property of #: :py:class:`.types.EmbeddedDataSpecification`, by the XML name of the property _READERS_FOR_EMBEDDED_DATA_SPECIFICATION: Mapping[str, _ContentReader[Any]] = { "dataSpecification": _read_reference_as_sequence, "dataSpecificationContent": _read_nested__data_specification_content, } #: Read the content of a property of #: :py:class:`.types.LevelType`, by the XML name of the property _READERS_FOR_LEVEL_TYPE: Mapping[str, _ContentReader[Any]] = { "min": _read_bool_from_element_text, "nom": _read_bool_from_element_text, "typ": _read_bool_from_element_text, "max": _read_bool_from_element_text, } #: Read the content of a property of #: :py:class:`.types.ValueReferencePair`, by the XML name of the property _READERS_FOR_VALUE_REFERENCE_PAIR: Mapping[str, _ContentReader[Any]] = { "value": read_str_from_element_text, "valueId": _read_reference_as_sequence, } #: Read the content of a property of #: :py:class:`.types.ValueList`, by the XML name of the property _READERS_FOR_VALUE_LIST: Mapping[str, _ContentReader[Any]] = { "valueReferencePairs": _read_list_of__value_reference_pair, } #: Read the content of a property of #: :py:class:`.types.LangStringPreferredNameTypeIEC61360`, by the XML name of the property _READERS_FOR_LANG_STRING_PREFERRED_NAME_TYPE_IEC_61360: Mapping[ str, _ContentReader[Any] ] = { "language": read_str_from_element_text, "text": read_str_from_element_text, } #: Read the content of a property of #: :py:class:`.types.LangStringShortNameTypeIEC61360`, by the XML name of the property _READERS_FOR_LANG_STRING_SHORT_NAME_TYPE_IEC_61360: Mapping[ str, _ContentReader[Any] ] = { "language": read_str_from_element_text, "text": read_str_from_element_text, } #: Read the content of a property of #: :py:class:`.types.LangStringDefinitionTypeIEC61360`, by the XML name of the property _READERS_FOR_LANG_STRING_DEFINITION_TYPE_IEC_61360: Mapping[ str, _ContentReader[Any] ] = { "language": read_str_from_element_text, "text": read_str_from_element_text, } #: Read the content of a property of #: :py:class:`.types.LangStringUom`, by the XML name of the property _READERS_FOR_LANG_STRING_UOM: Mapping[str, _ContentReader[Any]] = { "language": read_str_from_element_text, "text": read_str_from_element_text, } #: Read the content of a property of #: :py:class:`.types.DefinitionTypeUom`, by the XML name of the property _READERS_FOR_DEFINITION_TYPE_UOM: Mapping[str, _ContentReader[Any]] = { "language": read_str_from_element_text, "text": read_str_from_element_text, } #: Read the content of a property of #: :py:class:`.types.DataSpecificationUom`, by the XML name of the property _READERS_FOR_DATA_SPECIFICATION_UOM: Mapping[str, _ContentReader[Any]] = { "preferredName": _read_list_of__lang_string_uom, "symbol": read_str_from_element_text, "specificUnitId": read_str_from_element_text, "definition": _read_list_of__definition_type_uom, "preferredNameQuantity": _read_list_of__lang_string_uom, "quantityId": read_str_from_element_text, "classificationSystem": read_str_from_element_text, "classificationSystemVersion": read_str_from_element_text, } #: Read the content of a property of #: :py:class:`.types.DataSpecificationIEC61360`, by the XML name of the property _READERS_FOR_DATA_SPECIFICATION_IEC_61360: Mapping[str, _ContentReader[Any]] = { "preferredName": _read_list_of__lang_string_preferred_name_type_iec_61360, "shortName": _read_list_of__lang_string_short_name_type_iec_61360, "unit": read_str_from_element_text, "unitId": _read_reference_as_sequence, "sourceOfDefinition": read_str_from_element_text, "symbol": read_str_from_element_text, "dataType": _read_data_type_iec_61360_from_element_text, "definition": _read_list_of__lang_string_definition_type_iec_61360, "valueFormat": read_str_from_element_text, "valueList": _read_value_list_as_sequence, "value": read_str_from_element_text, "levelType": _read_level_type_as_sequence, } #: Read the content of a property of #: :py:class:`.types.AssetAdministrationShellDescriptor`, by the XML name of the property _READERS_FOR_ASSET_ADMINISTRATION_SHELL_DESCRIPTOR: Mapping[ str, _ContentReader[Any] ] = { "description": _read_list_of__lang_string_text_type, "displayName": _read_list_of__lang_string_name_type, "extensions": _read_list_of__extension, "id": read_str_from_element_text, "administration": _read_administrative_information_as_sequence, "assetKind": _read_asset_kind_from_element_text, "assetType": read_str_from_element_text, "endpoints": _read_list_of__endpoint, "globalAssetId": read_str_from_element_text, "idShort": read_str_from_element_text, "specificAssetIds": _read_list_of__specific_asset_id, "submodelDescriptors": _read_list_of__submodel_descriptor, } #: Read the content of a property of #: :py:class:`.types.SubmodelDescriptor`, by the XML name of the property _READERS_FOR_SUBMODEL_DESCRIPTOR: Mapping[str, _ContentReader[Any]] = { "description": _read_list_of__lang_string_text_type, "displayName": _read_list_of__lang_string_name_type, "extensions": _read_list_of__extension, "endpoints": _read_list_of__endpoint, "id": read_str_from_element_text, "administration": _read_administrative_information_as_sequence, "idShort": read_str_from_element_text, "semanticId": _read_reference_as_sequence, "supplementalSemanticIds": _read_list_of__reference, } #: Read the content of a property of #: :py:class:`.types.Endpoint`, by the XML name of the property _READERS_FOR_ENDPOINT: Mapping[str, _ContentReader[Any]] = { "protocolInformation": _read_protocol_information_as_sequence, "interface": read_str_from_element_text, } #: Read the content of a property of #: :py:class:`.types.ProtocolInformation`, by the XML name of the property _READERS_FOR_PROTOCOL_INFORMATION: Mapping[str, _ContentReader[Any]] = { "href": read_str_from_element_text, "endpointProtocol": read_str_from_element_text, "endpointProtocolVersion": _read_list_of__str, "subprotocol": read_str_from_element_text, "subprotocolBody": read_str_from_element_text, "subprotocolBodyEncoding": read_str_from_element_text, "securityAttributes": _read_list_of__security_attribute_object, } #: Read the content of a property of #: :py:class:`.types.SecurityAttributeObject`, by the XML name of the property _READERS_FOR_SECURITY_ATTRIBUTE_OBJECT: Mapping[str, _ContentReader[Any]] = { "type": _read_security_type_enum_from_element_text, "key": read_str_from_element_text, "value": read_str_from_element_text, } #: Read the content of a property of #: :py:class:`.types.AssetLink`, by the XML name of the property _READERS_FOR_ASSET_LINK: Mapping[str, _ContentReader[Any]] = { "name": read_str_from_element_text, "value": read_str_from_element_text, } #: Read the content of a property of #: :py:class:`.types.ServiceDescription`, by the XML name of the property _READERS_FOR_SERVICE_DESCRIPTION: Mapping[str, _ContentReader[Any]] = { "profiles": _read_list_of__service_specification_profile_enum, } #: Read the content of a property of #: :py:class:`.types.AssetAdministrationShellRecentChange`, by the XML name of the property _READERS_FOR_ASSET_ADMINISTRATION_SHELL_RECENT_CHANGE: Mapping[ str, _ContentReader[Any] ] = { "createdAt": read_str_from_element_text, "updatedAt": read_str_from_element_text, "id": read_str_from_element_text, "globalAssetId": read_str_from_element_text, "specificAssetIds": _read_list_of__specific_asset_id, } #: Read the content of a property of #: :py:class:`.types.ConceptDescriptionRecentChange`, by the XML name of the property _READERS_FOR_CONCEPT_DESCRIPTION_RECENT_CHANGE: Mapping[str, _ContentReader[Any]] = { "createdAt": read_str_from_element_text, "updatedAt": read_str_from_element_text, "id": read_str_from_element_text, } #: Read the content of a property of #: :py:class:`.types.SubmodelRecentChange`, by the XML name of the property _READERS_FOR_SUBMODEL_RECENT_CHANGE: Mapping[str, _ContentReader[Any]] = { "createdAt": read_str_from_element_text, "updatedAt": read_str_from_element_text, "id": read_str_from_element_text, "semanticId": _read_reference_as_sequence, "supplementalSemanticIds": _read_list_of__reference, } #: Read the content of a property of #: :py:class:`.types.Result`, by the XML name of the property _READERS_FOR_RESULT: Mapping[str, _ContentReader[Any]] = { "messages": _read_list_of__message, } #: Read the content of a property of #: :py:class:`.types.Message`, by the XML name of the property _READERS_FOR_MESSAGE: Mapping[str, _ContentReader[Any]] = { "messageType": _read_message_type_enum_from_element_text, "text": read_str_from_element_text, "code": read_str_from_element_text, "correlationId": read_str_from_element_text, "timestamp": read_str_from_element_text, } #: Read the content of a property of #: :py:class:`.types.OperationRequest`, by the XML name of the property _READERS_FOR_OPERATION_REQUEST: Mapping[str, _ContentReader[Any]] = { "inputArguments": _read_list_of__operation_variable, "inoutputArguments": _read_list_of__operation_variable, "clientTimeoutDuration": read_str_from_element_text, } #: Read the content of a property of #: :py:class:`.types.OperationRequestAsync`, by the XML name of the property _READERS_FOR_OPERATION_REQUEST_ASYNC: Mapping[str, _ContentReader[Any]] = { "inputArguments": _read_list_of__operation_variable, "inoutputArguments": _read_list_of__operation_variable, "clientTimeoutDuration": read_str_from_element_text, } #: Read the content of a property of #: :py:class:`.types.OperationRequestValueOnly`, by the XML name of the property _READERS_FOR_OPERATION_REQUEST_VALUE_ONLY: Mapping[str, _ContentReader[Any]] = { "inputArguments": _read_json_object_body, "inoutputArguments": _read_json_object_body, "clientTimeoutDuration": read_str_from_element_text, } #: Read the content of a property of #: :py:class:`.types.OperationRequestAsyncValueOnly`, by the XML name of the property _READERS_FOR_OPERATION_REQUEST_ASYNC_VALUE_ONLY: Mapping[str, _ContentReader[Any]] = { "inputArguments": _read_json_object_body, "inoutputArguments": _read_json_object_body, "clientTimeoutDuration": read_str_from_element_text, } #: Read the content of a property of #: :py:class:`.types.BaseOperationResult`, by the XML name of the property _READERS_FOR_BASE_OPERATION_RESULT: Mapping[str, _ContentReader[Any]] = { "executionState": _read_execution_state_from_element_text, "messages": _read_list_of__message, "success": _read_bool_from_element_text, } #: Read the content of a property of #: :py:class:`.types.OperationResult`, by the XML name of the property _READERS_FOR_OPERATION_RESULT: Mapping[str, _ContentReader[Any]] = { "executionState": _read_execution_state_from_element_text, "messages": _read_list_of__message, "success": _read_bool_from_element_text, "outputArguments": _read_list_of__operation_variable, "inoutputArguments": _read_list_of__operation_variable, } #: Read the content of a property of #: :py:class:`.types.OperationResultValueOnly`, by the XML name of the property _READERS_FOR_OPERATION_RESULT_VALUE_ONLY: Mapping[str, _ContentReader[Any]] = { "executionState": _read_execution_state_from_element_text, "messages": _read_list_of__message, "success": _read_bool_from_element_text, "outputArguments": _read_json_object_body, "inoutputArguments": _read_json_object_body, } #: Read the content of a property of #: :py:class:`.types.OperationHandle`, by the XML name of the property _READERS_FOR_OPERATION_HANDLE: Mapping[str, _ContentReader[Any]] = { "handleId": read_str_from_element_text, } #: Read the content of a property of #: :py:class:`.types.PagedResult`, by the XML name of the property _READERS_FOR_PAGED_RESULT: Mapping[str, _ContentReader[Any]] = { "result": _read_list_of__referable, "pagingMetadata": _read_paging_metadata_as_sequence, } #: Read the content of a property of #: :py:class:`.types.PagingMetadata`, by the XML name of the property _READERS_FOR_PAGING_METADATA: Mapping[str, _ContentReader[Any]] = { "cursor": read_str_from_element_text, } #: Read the content of a property of #: :py:class:`.types.PackageDescription`, by the XML name of the property _READERS_FOR_PACKAGE_DESCRIPTION: Mapping[str, _ContentReader[Any]] = { "packageId": read_str_from_element_text, "aasIds": _read_list_of__str, } #: Read the content of a property of #: :py:class:`.types.PropertyMetadata`, by the XML name of the property _READERS_FOR_PROPERTY_METADATA: Mapping[str, _ContentReader[Any]] = { "extensions": _read_list_of__extension, "category": read_str_from_element_text, "idShort": read_str_from_element_text, "displayName": _read_list_of__lang_string_name_type, "description": _read_list_of__lang_string_text_type, "semanticId": _read_reference_as_sequence, "supplementalSemanticIds": _read_list_of__reference, "qualifiers": _read_list_of__qualifier, "embeddedDataSpecifications": _read_list_of__embedded_data_specification, "valueType": _read_data_type_def_xsd_from_element_text, } #: Read the content of a property of #: :py:class:`.types.RangeMetadata`, by the XML name of the property _READERS_FOR_RANGE_METADATA: Mapping[str, _ContentReader[Any]] = { "extensions": _read_list_of__extension, "category": read_str_from_element_text, "idShort": read_str_from_element_text, "displayName": _read_list_of__lang_string_name_type, "description": _read_list_of__lang_string_text_type, "semanticId": _read_reference_as_sequence, "supplementalSemanticIds": _read_list_of__reference, "qualifiers": _read_list_of__qualifier, "embeddedDataSpecifications": _read_list_of__embedded_data_specification, "valueType": _read_data_type_def_xsd_from_element_text, } #: Read the content of a property of #: :py:class:`.types.BlobMetadata`, by the XML name of the property _READERS_FOR_BLOB_METADATA: Mapping[str, _ContentReader[Any]] = { "extensions": _read_list_of__extension, "category": read_str_from_element_text, "idShort": read_str_from_element_text, "displayName": _read_list_of__lang_string_name_type, "description": _read_list_of__lang_string_text_type, "semanticId": _read_reference_as_sequence, "supplementalSemanticIds": _read_list_of__reference, "qualifiers": _read_list_of__qualifier, "embeddedDataSpecifications": _read_list_of__embedded_data_specification, } #: Read the content of a property of #: :py:class:`.types.FileMetadata`, by the XML name of the property _READERS_FOR_FILE_METADATA: Mapping[str, _ContentReader[Any]] = { "extensions": _read_list_of__extension, "category": read_str_from_element_text, "idShort": read_str_from_element_text, "displayName": _read_list_of__lang_string_name_type, "description": _read_list_of__lang_string_text_type, "semanticId": _read_reference_as_sequence, "supplementalSemanticIds": _read_list_of__reference, "qualifiers": _read_list_of__qualifier, "embeddedDataSpecifications": _read_list_of__embedded_data_specification, } #: Read the content of a property of #: :py:class:`.types.MultiLanguagePropertyMetadata`, by the XML name of the property _READERS_FOR_MULTI_LANGUAGE_PROPERTY_METADATA: Mapping[str, _ContentReader[Any]] = { "extensions": _read_list_of__extension, "category": read_str_from_element_text, "idShort": read_str_from_element_text, "displayName": _read_list_of__lang_string_name_type, "description": _read_list_of__lang_string_text_type, "semanticId": _read_reference_as_sequence, "supplementalSemanticIds": _read_list_of__reference, "qualifiers": _read_list_of__qualifier, "embeddedDataSpecifications": _read_list_of__embedded_data_specification, } #: Read the content of a property of #: :py:class:`.types.ReferenceElementMetadata`, by the XML name of the property _READERS_FOR_REFERENCE_ELEMENT_METADATA: Mapping[str, _ContentReader[Any]] = { "extensions": _read_list_of__extension, "category": read_str_from_element_text, "idShort": read_str_from_element_text, "displayName": _read_list_of__lang_string_name_type, "description": _read_list_of__lang_string_text_type, "semanticId": _read_reference_as_sequence, "supplementalSemanticIds": _read_list_of__reference, "qualifiers": _read_list_of__qualifier, "embeddedDataSpecifications": _read_list_of__embedded_data_specification, } #: Read the content of a property of #: :py:class:`.types.RelationshipElementMetadata`, by the XML name of the property _READERS_FOR_RELATIONSHIP_ELEMENT_METADATA: Mapping[str, _ContentReader[Any]] = { "extensions": _read_list_of__extension, "category": read_str_from_element_text, "idShort": read_str_from_element_text, "displayName": _read_list_of__lang_string_name_type, "description": _read_list_of__lang_string_text_type, "semanticId": _read_reference_as_sequence, "supplementalSemanticIds": _read_list_of__reference, "qualifiers": _read_list_of__qualifier, "embeddedDataSpecifications": _read_list_of__embedded_data_specification, } #: Read the content of a property of #: :py:class:`.types.AnnotatedRelationshipElementMetadata`, by the XML name of the property _READERS_FOR_ANNOTATED_RELATIONSHIP_ELEMENT_METADATA: Mapping[ str, _ContentReader[Any] ] = { "extensions": _read_list_of__extension, "category": read_str_from_element_text, "idShort": read_str_from_element_text, "displayName": _read_list_of__lang_string_name_type, "description": _read_list_of__lang_string_text_type, "semanticId": _read_reference_as_sequence, "supplementalSemanticIds": _read_list_of__reference, "qualifiers": _read_list_of__qualifier, "embeddedDataSpecifications": _read_list_of__embedded_data_specification, } #: Read the content of a property of #: :py:class:`.types.EntityMetadata`, by the XML name of the property _READERS_FOR_ENTITY_METADATA: Mapping[str, _ContentReader[Any]] = { "extensions": _read_list_of__extension, "category": read_str_from_element_text, "idShort": read_str_from_element_text, "displayName": _read_list_of__lang_string_name_type, "description": _read_list_of__lang_string_text_type, "semanticId": _read_reference_as_sequence, "supplementalSemanticIds": _read_list_of__reference, "qualifiers": _read_list_of__qualifier, "embeddedDataSpecifications": _read_list_of__embedded_data_specification, } #: Read the content of a property of #: :py:class:`.types.CapabilityMetadata`, by the XML name of the property _READERS_FOR_CAPABILITY_METADATA: Mapping[str, _ContentReader[Any]] = { "extensions": _read_list_of__extension, "category": read_str_from_element_text, "idShort": read_str_from_element_text, "displayName": _read_list_of__lang_string_name_type, "description": _read_list_of__lang_string_text_type, "semanticId": _read_reference_as_sequence, "supplementalSemanticIds": _read_list_of__reference, "qualifiers": _read_list_of__qualifier, "embeddedDataSpecifications": _read_list_of__embedded_data_specification, } #: Read the content of a property of #: :py:class:`.types.OperationMetadata`, by the XML name of the property _READERS_FOR_OPERATION_METADATA: Mapping[str, _ContentReader[Any]] = { "extensions": _read_list_of__extension, "category": read_str_from_element_text, "idShort": read_str_from_element_text, "displayName": _read_list_of__lang_string_name_type, "description": _read_list_of__lang_string_text_type, "semanticId": _read_reference_as_sequence, "supplementalSemanticIds": _read_list_of__reference, "qualifiers": _read_list_of__qualifier, "embeddedDataSpecifications": _read_list_of__embedded_data_specification, } #: Read the content of a property of #: :py:class:`.types.SubmodelElementCollectionMetadata`, by the XML name of the property _READERS_FOR_SUBMODEL_ELEMENT_COLLECTION_METADATA: Mapping[str, _ContentReader[Any]] = { "extensions": _read_list_of__extension, "category": read_str_from_element_text, "idShort": read_str_from_element_text, "displayName": _read_list_of__lang_string_name_type, "description": _read_list_of__lang_string_text_type, "semanticId": _read_reference_as_sequence, "supplementalSemanticIds": _read_list_of__reference, "qualifiers": _read_list_of__qualifier, "embeddedDataSpecifications": _read_list_of__embedded_data_specification, } #: Read the content of a property of #: :py:class:`.types.BasicEventElementMetadata`, by the XML name of the property _READERS_FOR_BASIC_EVENT_ELEMENT_METADATA: Mapping[str, _ContentReader[Any]] = { "extensions": _read_list_of__extension, "category": read_str_from_element_text, "idShort": read_str_from_element_text, "displayName": _read_list_of__lang_string_name_type, "description": _read_list_of__lang_string_text_type, "semanticId": _read_reference_as_sequence, "supplementalSemanticIds": _read_list_of__reference, "qualifiers": _read_list_of__qualifier, "embeddedDataSpecifications": _read_list_of__embedded_data_specification, "direction": _read_direction_from_element_text, "state": _read_state_of_event_from_element_text, "messageTopic": read_str_from_element_text, "messageBroker": _read_reference_as_sequence, "lastUpdate": read_str_from_element_text, "minInterval": read_str_from_element_text, "maxInterval": read_str_from_element_text, } #: Read the content of a property of #: :py:class:`.types.SubmodelElementListMetadata`, by the XML name of the property _READERS_FOR_SUBMODEL_ELEMENT_LIST_METADATA: Mapping[str, _ContentReader[Any]] = { "extensions": _read_list_of__extension, "category": read_str_from_element_text, "idShort": read_str_from_element_text, "displayName": _read_list_of__lang_string_name_type, "description": _read_list_of__lang_string_text_type, "semanticId": _read_reference_as_sequence, "supplementalSemanticIds": _read_list_of__reference, "qualifiers": _read_list_of__qualifier, "embeddedDataSpecifications": _read_list_of__embedded_data_specification, "orderRelevant": _read_bool_from_element_text, "semanticIdListElement": _read_reference_as_sequence, "typeValueListElement": _read_aas_submodel_elements_from_element_text, "valueTypeListElement": _read_data_type_def_xsd_from_element_text, } #: Read the content of a property of #: :py:class:`.types.SubmodelMetadata`, by the XML name of the property _READERS_FOR_SUBMODEL_METADATA: Mapping[str, _ContentReader[Any]] = { "extensions": _read_list_of__extension, "category": read_str_from_element_text, "idShort": read_str_from_element_text, "displayName": _read_list_of__lang_string_name_type, "description": _read_list_of__lang_string_text_type, "administration": _read_administrative_information_as_sequence, "id": read_str_from_element_text, "kind": _read_modelling_kind_from_element_text, "semanticId": _read_reference_as_sequence, "supplementalSemanticIds": _read_list_of__reference, "qualifiers": _read_list_of__qualifier, "embeddedDataSpecifications": _read_list_of__embedded_data_specification, } #: Read the content of a property of #: :py:class:`.types.AssetAdministrationShellMetadata`, by the XML name of the property _READERS_FOR_ASSET_ADMINISTRATION_SHELL_METADATA: Mapping[str, _ContentReader[Any]] = { "extensions": _read_list_of__extension, "category": read_str_from_element_text, "idShort": read_str_from_element_text, "displayName": _read_list_of__lang_string_name_type, "description": _read_list_of__lang_string_text_type, "administration": _read_administrative_information_as_sequence, "id": read_str_from_element_text, "embeddedDataSpecifications": _read_list_of__embedded_data_specification, "derivedFrom": _read_reference_as_sequence, } #: Read the content of a property of #: :py:class:`.types.ReferenceElementValue`, by the XML name of the property _READERS_FOR_REFERENCE_ELEMENT_VALUE: Mapping[str, _ContentReader[Any]] = { "type": _read_reference_types_from_element_text, "keys": _read_list_of__key, "referredSemanticId": _read_reference_as_sequence, } #: Read the content of a property of #: :py:class:`.types.BlobValue`, by the XML name of the property _READERS_FOR_BLOB_VALUE: Mapping[str, _ContentReader[Any]] = { "contentType": read_str_from_element_text, "value": _read_bytes_from_element_text, } #: Read the content of a property of #: :py:class:`.types.FileValue`, by the XML name of the property _READERS_FOR_FILE_VALUE: Mapping[str, _ContentReader[Any]] = { "contentType": read_str_from_element_text, "value": read_str_from_element_text, } #: Read the content of a property of #: :py:class:`.types.RangeValue`, by the XML name of the property _READERS_FOR_RANGE_VALUE: Mapping[str, _ContentReader[Any]] = { "min": _read_float_from_element_text, "max": _read_float_from_element_text, } #: Read the content of a property of #: :py:class:`.types.RelationshipElementValue`, by the XML name of the property _READERS_FOR_RELATIONSHIP_ELEMENT_VALUE: Mapping[str, _ContentReader[Any]] = { "first": _read_reference_as_sequence, "second": _read_reference_as_sequence, } #: Read the content of a property of #: :py:class:`.types.BasicEventElementValue`, by the XML name of the property _READERS_FOR_BASIC_EVENT_ELEMENT_VALUE: Mapping[str, _ContentReader[Any]] = { "observed": _read_reference_as_sequence, } #: Read the content of a property of #: :py:class:`.types.AnnotatedRelationshipElementValue`, by the XML name of the property _READERS_FOR_ANNOTATED_RELATIONSHIP_ELEMENT_VALUE: Mapping[str, _ContentReader[Any]] = { "first": _read_reference_as_sequence, "second": _read_reference_as_sequence, "annotations": _read_json_object_body, } #: Read the content of a property of #: :py:class:`.types.EntityValue`, by the XML name of the property _READERS_FOR_ENTITY_VALUE: Mapping[str, _ContentReader[Any]] = { "entityType": _read_entity_type_from_element_text, "globalAssetId": read_str_from_element_text, "specificAssetIds": _read_list_of__json_object, "statements": _read_json_object_body, } #: Read the content of a property of #: :py:class:`.types.GetAssetAdministrationShellsResult`, by the XML name of the property _READERS_FOR_GET_ASSET_ADMINISTRATION_SHELLS_RESULT: Mapping[ str, _ContentReader[Any] ] = { "pagingMetadata": _read_paging_metadata_as_sequence, "result": _read_list_of__asset_administration_shell, } #: Read the content of a property of #: :py:class:`.types.GetAssetAdministrationShellsMetadataResult`, by the XML name of the property _READERS_FOR_GET_ASSET_ADMINISTRATION_SHELLS_METADATA_RESULT: Mapping[ str, _ContentReader[Any] ] = { "pagingMetadata": _read_paging_metadata_as_sequence, "result": _read_list_of__asset_administration_shell_metadata, } #: Read the content of a property of #: :py:class:`.types.GetAllAssetAdministrationShellsRecentChangesResult`, by the XML name of the property _READERS_FOR_GET_ALL_ASSET_ADMINISTRATION_SHELLS_RECENT_CHANGES_RESULT: Mapping[ str, _ContentReader[Any] ] = { "pagingMetadata": _read_paging_metadata_as_sequence, "result": _read_list_of__asset_administration_shell_recent_change, } #: Read the content of a property of #: :py:class:`.types.GetAssetAdministrationShellDescriptorsResult`, by the XML name of the property _READERS_FOR_GET_ASSET_ADMINISTRATION_SHELL_DESCRIPTORS_RESULT: Mapping[ str, _ContentReader[Any] ] = { "pagingMetadata": _read_paging_metadata_as_sequence, "result": _read_list_of__asset_administration_shell_descriptor, } #: Read the content of a property of #: :py:class:`.types.GetConceptDescriptionsResult`, by the XML name of the property _READERS_FOR_GET_CONCEPT_DESCRIPTIONS_RESULT: Mapping[str, _ContentReader[Any]] = { "pagingMetadata": _read_paging_metadata_as_sequence, "result": _read_list_of__concept_description, } #: Read the content of a property of #: :py:class:`.types.GetAllConceptDescriptionsRecentChangesResult`, by the XML name of the property _READERS_FOR_GET_ALL_CONCEPT_DESCRIPTIONS_RECENT_CHANGES_RESULT: Mapping[ str, _ContentReader[Any] ] = { "pagingMetadata": _read_paging_metadata_as_sequence, "result": _read_list_of__concept_description_recent_change, } #: Read the content of a property of #: :py:class:`.types.GetPackageDescriptionsResult`, by the XML name of the property _READERS_FOR_GET_PACKAGE_DESCRIPTIONS_RESULT: Mapping[str, _ContentReader[Any]] = { "pagingMetadata": _read_paging_metadata_as_sequence, "result": _read_list_of__package_description, } #: Read the content of a property of #: :py:class:`.types.GetPathItemsResult`, by the XML name of the property _READERS_FOR_GET_PATH_ITEMS_RESULT: Mapping[str, _ContentReader[Any]] = { "pagingMetadata": _read_paging_metadata_as_sequence, "result": _read_list_of__str, } #: Read the content of a property of #: :py:class:`.types.GetReferencesResult`, by the XML name of the property _READERS_FOR_GET_REFERENCES_RESULT: Mapping[str, _ContentReader[Any]] = { "pagingMetadata": _read_paging_metadata_as_sequence, "result": _read_list_of__reference, } #: Read the content of a property of #: :py:class:`.types.GetSubmodelDescriptorsResult`, by the XML name of the property _READERS_FOR_GET_SUBMODEL_DESCRIPTORS_RESULT: Mapping[str, _ContentReader[Any]] = { "pagingMetadata": _read_paging_metadata_as_sequence, "result": _read_list_of__submodel_descriptor, } #: Read the content of a property of #: :py:class:`.types.GetSubmodelElementsMetadataResult`, by the XML name of the property _READERS_FOR_GET_SUBMODEL_ELEMENTS_METADATA_RESULT: Mapping[ str, _ContentReader[Any] ] = { "pagingMetadata": _read_paging_metadata_as_sequence, "result": _read_list_of__submodel_element_metadata, } #: Read the content of a property of #: :py:class:`.types.GetSubmodelElementsResult`, by the XML name of the property _READERS_FOR_GET_SUBMODEL_ELEMENTS_RESULT: Mapping[str, _ContentReader[Any]] = { "pagingMetadata": _read_paging_metadata_as_sequence, "result": _read_list_of__submodel_element, } #: Read the content of a property of #: :py:class:`.types.GetSubmodelElementsValueResult`, by the XML name of the property _READERS_FOR_GET_SUBMODEL_ELEMENTS_VALUE_RESULT: Mapping[str, _ContentReader[Any]] = { "pagingMetadata": _read_paging_metadata_as_sequence, "result": _read_list_of__json_object, } #: Read the content of a property of #: :py:class:`.types.GetAllSubmodelsRecentChangesResult`, by the XML name of the property _READERS_FOR_GET_ALL_SUBMODELS_RECENT_CHANGES_RESULT: Mapping[ str, _ContentReader[Any] ] = { "pagingMetadata": _read_paging_metadata_as_sequence, "result": _read_list_of__submodel_recent_change, } #: Read the content of a property of #: :py:class:`.types.GetSubmodelsMetadataResult`, by the XML name of the property _READERS_FOR_GET_SUBMODELS_METADATA_RESULT: Mapping[str, _ContentReader[Any]] = { "pagingMetadata": _read_paging_metadata_as_sequence, "result": _read_list_of__submodel_metadata, } #: Read the content of a property of #: :py:class:`.types.GetSubmodelsResult`, by the XML name of the property _READERS_FOR_GET_SUBMODELS_RESULT: Mapping[str, _ContentReader[Any]] = { "pagingMetadata": _read_paging_metadata_as_sequence, "result": _read_list_of__submodel, } #: Read the content of a property of #: :py:class:`.types.GetSubmodelsValueResult`, by the XML name of the property _READERS_FOR_GET_SUBMODELS_VALUE_RESULT: Mapping[str, _ContentReader[Any]] = { "pagingMetadata": _read_paging_metadata_as_sequence, "result": _read_list_of__json_object, } #: Read the content of a property of #: :py:class:`.types.ClaimAttribute`, by the XML name of the property _READERS_FOR_CLAIM_ATTRIBUTE: Mapping[str, _ContentReader[Any]] = { "claim": read_str_from_element_text, } #: Read the content of a property of #: :py:class:`.types.GlobalAttribute`, by the XML name of the property _READERS_FOR_GLOBAL_ATTRIBUTE: Mapping[str, _ContentReader[Any]] = { "kind": _read_global_attribute_kind_from_element_text, } #: Read the content of a property of #: :py:class:`.types.ReferenceAttribute`, by the XML name of the property _READERS_FOR_REFERENCE_ATTRIBUTE: Mapping[str, _ContentReader[Any]] = { "reference": read_str_from_element_text, } #: Read the content of a property of #: :py:class:`.types.DateTimeAttributeItem`, by the XML name of the property _READERS_FOR_DATE_TIME_ATTRIBUTE_ITEM: Mapping[str, _ContentReader[Any]] = { "kind": _read_date_time_global_attribute_kind_from_element_text, } #: Read the content of a property of #: :py:class:`.types.FieldOperand`, by the XML name of the property _READERS_FOR_FIELD_OPERAND: Mapping[str, _ContentReader[Any]] = { "field": read_str_from_element_text, } #: Read the content of a property of #: :py:class:`.types.StringLiteral`, by the XML name of the property _READERS_FOR_STRING_LITERAL: Mapping[str, _ContentReader[Any]] = { "strVal": read_str_from_element_text, } #: Read the content of a property of #: :py:class:`.types.AttributeOperand`, by the XML name of the property _READERS_FOR_ATTRIBUTE_OPERAND: Mapping[str, _ContentReader[Any]] = { "attribute": _read_nested__attribute_item, } #: Read the content of a property of #: :py:class:`.types.NumberLiteral`, by the XML name of the property _READERS_FOR_NUMBER_LITERAL: Mapping[str, _ContentReader[Any]] = { "numVal": _read_float_from_element_text, } #: Read the content of a property of #: :py:class:`.types.HexLiteral`, by the XML name of the property _READERS_FOR_HEX_LITERAL: Mapping[str, _ContentReader[Any]] = { "hexVal": read_str_from_element_text, } #: Read the content of a property of #: :py:class:`.types.DateTimeLiteral`, by the XML name of the property _READERS_FOR_DATE_TIME_LITERAL: Mapping[str, _ContentReader[Any]] = { "dateTimeVal": read_str_from_element_text, } #: Read the content of a property of #: :py:class:`.types.TimeLiteral`, by the XML name of the property _READERS_FOR_TIME_LITERAL: Mapping[str, _ContentReader[Any]] = { "timeVal": read_str_from_element_text, } #: Read the content of a property of #: :py:class:`.types.BooleanLiteral`, by the XML name of the property _READERS_FOR_BOOLEAN_LITERAL: Mapping[str, _ContentReader[Any]] = { "boolean": _read_bool_from_element_text, } #: Read the content of a property of #: :py:class:`.types.StringCast`, by the XML name of the property _READERS_FOR_STRING_CAST: Mapping[str, _ContentReader[Any]] = { "strCast": _read_nested__value, } #: Read the content of a property of #: :py:class:`.types.NumberCast`, by the XML name of the property _READERS_FOR_NUMBER_CAST: Mapping[str, _ContentReader[Any]] = { "numCast": _read_nested__value, } #: Read the content of a property of #: :py:class:`.types.HexCast`, by the XML name of the property _READERS_FOR_HEX_CAST: Mapping[str, _ContentReader[Any]] = { "hexCast": _read_nested__value, } #: Read the content of a property of #: :py:class:`.types.BooleanCast`, by the XML name of the property _READERS_FOR_BOOLEAN_CAST: Mapping[str, _ContentReader[Any]] = { "boolCast": _read_nested__value, } #: Read the content of a property of #: :py:class:`.types.DateTimeCast`, by the XML name of the property _READERS_FOR_DATE_TIME_CAST: Mapping[str, _ContentReader[Any]] = { "dateTimeCast": _read_nested__string_value, } #: Read the content of a property of #: :py:class:`.types.TimeCast`, by the XML name of the property _READERS_FOR_TIME_CAST: Mapping[str, _ContentReader[Any]] = { "timeCast": _read_nested__time_cast_operand, } #: Read the content of a property of #: :py:class:`.types.DayOfWeek`, by the XML name of the property _READERS_FOR_DAY_OF_WEEK: Mapping[str, _ContentReader[Any]] = { "dayOfWeek": _read_nested__date_time_operand, } #: Read the content of a property of #: :py:class:`.types.DayOfMonth`, by the XML name of the property _READERS_FOR_DAY_OF_MONTH: Mapping[str, _ContentReader[Any]] = { "dayOfMonth": _read_nested__date_time_operand, } #: Read the content of a property of #: :py:class:`.types.Month`, by the XML name of the property _READERS_FOR_MONTH: Mapping[str, _ContentReader[Any]] = { "month": _read_nested__date_time_operand, } #: Read the content of a property of #: :py:class:`.types.Year`, by the XML name of the property _READERS_FOR_YEAR: Mapping[str, _ContentReader[Any]] = { "year": _read_nested__date_time_operand, } #: Read the content of a property of #: :py:class:`.types.DateTimeAttributeOperand`, by the XML name of the property _READERS_FOR_DATE_TIME_ATTRIBUTE_OPERAND: Mapping[str, _ContentReader[Any]] = { "attribute": _read_date_time_attribute_item_as_sequence, } #: Read the content of a property of #: :py:class:`.types.EqualComparison`, by the XML name of the property _READERS_FOR_EQUAL_COMPARISON: Mapping[str, _ContentReader[Any]] = { "eq": _read_tuple2_of__value__value, } #: Read the content of a property of #: :py:class:`.types.NotEqualComparison`, by the XML name of the property _READERS_FOR_NOT_EQUAL_COMPARISON: Mapping[str, _ContentReader[Any]] = { "ne": _read_tuple2_of__value__value, } #: Read the content of a property of #: :py:class:`.types.GreaterThanComparison`, by the XML name of the property _READERS_FOR_GREATER_THAN_COMPARISON: Mapping[str, _ContentReader[Any]] = { "gt": _read_tuple2_of__value__value, } #: Read the content of a property of #: :py:class:`.types.GreaterThanOrEqualComparison`, by the XML name of the property _READERS_FOR_GREATER_THAN_OR_EQUAL_COMPARISON: Mapping[str, _ContentReader[Any]] = { "ge": _read_tuple2_of__value__value, } #: Read the content of a property of #: :py:class:`.types.LessThanComparison`, by the XML name of the property _READERS_FOR_LESS_THAN_COMPARISON: Mapping[str, _ContentReader[Any]] = { "lt": _read_tuple2_of__value__value, } #: Read the content of a property of #: :py:class:`.types.LessThanOrEqualComparison`, by the XML name of the property _READERS_FOR_LESS_THAN_OR_EQUAL_COMPARISON: Mapping[str, _ContentReader[Any]] = { "le": _read_tuple2_of__value__value, } #: Read the content of a property of #: :py:class:`.types.ContainsComparison`, by the XML name of the property _READERS_FOR_CONTAINS_COMPARISON: Mapping[str, _ContentReader[Any]] = { "contains": _read_tuple2_of__string_value__string_value, } #: Read the content of a property of #: :py:class:`.types.StartsWithComparison`, by the XML name of the property _READERS_FOR_STARTS_WITH_COMPARISON: Mapping[str, _ContentReader[Any]] = { "startsWith": _read_tuple2_of__string_value__string_value, } #: Read the content of a property of #: :py:class:`.types.EndsWithComparison`, by the XML name of the property _READERS_FOR_ENDS_WITH_COMPARISON: Mapping[str, _ContentReader[Any]] = { "endsWith": _read_tuple2_of__string_value__string_value, } #: Read the content of a property of #: :py:class:`.types.RegexComparison`, by the XML name of the property _READERS_FOR_REGEX_COMPARISON: Mapping[str, _ContentReader[Any]] = { "regex": _read_tuple2_of__string_value__string_value, } #: Read the content of a property of #: :py:class:`.types.MatchClause`, by the XML name of the property _READERS_FOR_MATCH_CLAUSE: Mapping[str, _ContentReader[Any]] = { "matchOperands": _read_list_of__match_expression, } #: Read the content of a property of #: :py:class:`.types.AndExpression`, by the XML name of the property _READERS_FOR_AND_EXPRESSION: Mapping[str, _ContentReader[Any]] = { "andOperands": _read_list_of__logical_expression, } #: Read the content of a property of #: :py:class:`.types.OrExpression`, by the XML name of the property _READERS_FOR_OR_EXPRESSION: Mapping[str, _ContentReader[Any]] = { "orOperands": _read_list_of__logical_expression, } #: Read the content of a property of #: :py:class:`.types.NotExpression`, by the XML name of the property _READERS_FOR_NOT_EXPRESSION: Mapping[str, _ContentReader[Any]] = { "notOperand": _read_nested__logical_expression, } #: Read the content of a property of #: :py:class:`.types.QueryFilter`, by the XML name of the property _READERS_FOR_QUERY_FILTER: Mapping[str, _ContentReader[Any]] = { "fragment": read_str_from_element_text, "condition": _read_nested__logical_expression, } #: Read the content of a property of #: :py:class:`.types.Query`, by the XML name of the property _READERS_FOR_QUERY: Mapping[str, _ContentReader[Any]] = { "select": _read_query_select_from_element_text, "condition": _read_nested__logical_expression, "filters": _read_list_of__query_filter, } # endregion # region Serialization def _attribute_to_property(exception: Exception, prop_name: Optional[str]) -> NoReturn: """ Re-raise the :paramref:`exception` as a failure of the property :paramref:`prop_name`. Every writer funnels its failures through this function, so that the path to the culprit is built up as the stack unwinds: a writer knows the property whose value it writes, and nothing below it does. A :paramref:`prop_name` of ``None`` prepends nothing to the path. It does *not* mean that no property is involved. It means that the access which leads to the value is recorded by a writer further up the stack, so recording it here as well would spell one step of the path twice. For example, the writer of an item of a list is given no property name. The list writer records its own property and the loop over the items records the index, so that ``.submodel_elements[3]`` is assembled from ``submodel_elements`` above and ``3`` around the item. Were the item to contribute ``submodel_elements`` as well, the path would read ``.submodel_elements[3].submodel_elements``. Likewise, an instance nested in the element of a property is written by a dispatch on its run-time type, and a dispatch knows nothing about where the instance came from. It is :py:func:`_write_nested_element` above it which knows that the instance sits in ``.value``, so the writer which the dispatch selects contributes no segment of its own. The path therefore stays empty only when the value which broke *is* the one you handed over, which is the failure :py:func:`write` funnels here: there is no access leading to it to report. We deliberately catch *any* exception, and not only the failures of the underlying stream. The type annotations are not enforced at run-time, so a property can hold a value which we can not serialize, and telling you where that value sits is much more helpful than the bare exception. The original exception is kept as the cause of the raised one. :param exception: to be re-raised :param prop_name: name of the property, as spelled in Python, whose value is written, or ``None`` if the access to the value is recorded by an enclosing writer :raise: :py:class:`SerializationException` always """ if isinstance(exception, SerializationException): if prop_name is not None: exception._prepend_property(prop_name) raise exception failure = SerializationException(str(exception)) if prop_name is not None: failure._prepend_property(prop_name) raise failure from exception def _attribute_to_item(exception: Exception, index: int) -> NoReturn: """ Re-raise the :paramref:`exception` as a failure of the item at :paramref:`index`. This is the counterpart of :py:func:`_attribute_to_property` for the items of a list and of a tuple. The item's own element contributes no segment to the path: an item is selected by its position, and not by its element tag. :param exception: to be re-raised :param index: of the item which was being written :raise: :py:class:`SerializationException` always """ if isinstance(exception, SerializationException): exception._prepend_index(index) raise exception failure = SerializationException(str(exception)) failure._prepend_index(index) raise failure from exception _ItemT = TypeVar("_ItemT") #: Write a value as a whole XML element, the element tag included _ElementWriter = Callable[[str, Optional[str], _ValueT, "_Serializer"], None] def _write_bool_as_element( name: str, prop_name: Optional[str], value: bool, serializer: "_Serializer" ) -> None: """ Write the :paramref:`value` of a boolean enclosed in the :paramref:`name` element. :param name: of the corresponding element tag :param prop_name: name of the property, as spelled in Python, whose value is written, or ``None`` if the access to the value is recorded by an enclosing writer :param value: to be serialized :param serializer: to write to :raise: :py:class:`SerializationException` if the value could not be written """ try: serializer.writer.write_start_element(name) serializer.writer.stream.write("true" if value else "false") serializer.writer.write_end_element(name) except Exception as exception: _attribute_to_property(exception, prop_name) def _write_float_as_element( name: str, prop_name: Optional[str], value: float, serializer: "_Serializer" ) -> None: """ Write the :paramref:`value` of a floating-point number enclosed in the :paramref:`name` element. :param name: of the corresponding element tag :param prop_name: name of the property, as spelled in Python, whose value is written, or ``None`` if the access to the value is recorded by an enclosing writer :param value: to be serialized :param serializer: to write to :raise: :py:class:`SerializationException` if the value could not be written """ try: serializer.writer.write_start_element(name) if value == math.inf: serializer.writer.stream.write("INF") elif value == -math.inf: serializer.writer.stream.write("-INF") elif math.isnan(value): serializer.writer.stream.write("NaN") elif value == 0: if math.copysign(1.0, value) < 0.0: serializer.writer.stream.write("-0.0") else: serializer.writer.stream.write("0.0") else: serializer.writer.stream.write(str(value)) serializer.writer.write_end_element(name) except Exception as exception: _attribute_to_property(exception, prop_name) def _write_str_as_element( name: str, prop_name: Optional[str], value: str, serializer: "_Serializer" ) -> None: """ Write the :paramref:`value` of a string enclosed in the :paramref:`name` element. :param name: of the corresponding element tag :param prop_name: name of the property, as spelled in Python, whose value is written, or ``None`` if the access to the value is recorded by an enclosing writer :param value: to be serialized :param serializer: to write to :raise: :py:class:`SerializationException` if the value could not be written """ try: serializer.writer.write_start_element(name) # NOTE (mristin): # We ran ``timeit`` on manual code which escaped XML special characters with # a dictionary, and on another snippet which called three ``.replace()``. # The code with ``.replace()`` was an order of magnitude faster on our # computers. # # The escaping is written out here, and not put in a function of its own, # since a string is the commonest value in a meta-model and a call is not free. serializer.writer.stream.write( value.replace("&", "&amp;").replace("<", "&lt;").replace(">", "&gt;") ) serializer.writer.write_end_element(name) except Exception as exception: _attribute_to_property(exception, prop_name) def _write_bytes_as_element( name: str, prop_name: Optional[str], value: bytes, serializer: "_Serializer" ) -> None: """ Write the :paramref:`value` of a binary content enclosed in the :paramref:`name` element. :param name: of the corresponding element tag :param prop_name: name of the property, as spelled in Python, whose value is written, or ``None`` if the access to the value is recorded by an enclosing writer :param value: to be serialized :param serializer: to write to :raise: :py:class:`SerializationException` if the value could not be written """ try: serializer.writer.write_start_element(name) # NOTE (mristin): # We need to decode the result of the base64-encoding to ASCII since we are # writing to an XML *text* stream. ``base64.b64encode(.)`` gives us bytes, # not a string. encoded = base64.b64encode(value).decode("ascii") # NOTE (mristin): # Base64 alphabet excludes ``<``, ``>`` and ``&``, so we can directly # write the ``encoded`` content to the stream as XML text. # # See: https://datatracker.ietf.org/doc/html/rfc4648#section-4 serializer.writer.stream.write(encoded) serializer.writer.write_end_element(name) except Exception as exception: _attribute_to_property(exception, prop_name) def _write_enum_as_element( name: str, prop_name: Optional[str], value: enum.Enum, serializer: "_Serializer" ) -> None: """ Write the literal :paramref:`value` enclosed in the :paramref:`name` element. A literal is written as the text of the element, so this one writer serves every enumeration of the meta-model. The access to the literal's value is deliberately *not* spelled out at the call site: a :paramref:`value` which is not a literal of the enumeration would then break *before* this function is entered, and the failure could no longer be attributed to :paramref:`prop_name`. :param name: of the corresponding element tag :param prop_name: name of the property, as spelled in Python, whose value is written, or ``None`` if the access to the value is recorded by an enclosing writer :param value: to be serialized :param serializer: to write to :raise: :py:class:`SerializationException` if the value could not be written """ try: _write_str_as_element(name, None, value.value, serializer) except Exception as exception: _attribute_to_property(exception, prop_name) def _write_nested_element( name: str, prop_name: Optional[str], value: our_types.Class, serializer: "_Serializer", ) -> None: """ Write :paramref:`value` nested in the :paramref:`name` element. The instance writes the element which designates its model type, so it has to be nested in an element of its own when it is the value of a property. Mind that an *item* of a list is not nested that way -- see :py:func:`_write_list_of_instances` -- as it is the item's own element which already sits in the list's element. The element which designates the model type contributes no segment to the path of a :py:class:`SerializationException`. The path points into the instance which was handed over for the serialization, and there that element is no level of its own: ``.value.id_short`` is exactly what you would write in Python. :param name: of the enclosing element :param prop_name: name of the property, as spelled in Python, whose value is written, or ``None`` if the access to the value is recorded by an enclosing writer :param value: to be serialized :param serializer: to write to :raise: :py:class:`SerializationException` if the value could not be written """ try: serializer.writer.write_start_element(name) serializer.visit(value) serializer.writer.write_end_element(name) except Exception as exception: _attribute_to_property(exception, prop_name) def _write_list_of_instances( name: str, prop_name: Optional[str], items: Sequence[our_types.Class], serializer: "_Serializer", ) -> None: """ Write :paramref:`items` enclosed in the :paramref:`name` element. Every item writes the element which designates its model type, so no positional tag is necessary. If there are no items, the enclosing element is collapsed to an empty one. :param name: of the enclosing element :param prop_name: name of the property, as spelled in Python, whose value is written, or ``None`` if the access to the value is recorded by an enclosing writer :param items: to be serialized :param serializer: to write to :raise: :py:class:`SerializationException` if the value could not be written """ try: if len(items) == 0: serializer.writer.write_empty_element(name) else: serializer.writer.write_start_element(name) for index, item in enumerate(items): try: serializer.visit(item) except Exception as exception: _attribute_to_item(exception, index) serializer.writer.write_end_element(name) except Exception as exception: _attribute_to_property(exception, prop_name) def _write_list_of_items( name: str, prop_name: Optional[str], items: Sequence[_ItemT], write_item: "_ElementWriter[_ItemT]", serializer: "_Serializer", ) -> None: """ Write :paramref:`items` enclosed in the :paramref:`name` element. An item is encoded as the text of an element, so it is not self-describing, and every item is written in an element tagged ``v``. If there are no items, the enclosing element is collapsed to an empty one. :param name: of the enclosing element :param prop_name: name of the property, as spelled in Python, whose value is written, or ``None`` if the access to the value is recorded by an enclosing writer :param items: to be serialized :param write_item: to write a single item of :paramref:`items` :param serializer: to write to :raise: :py:class:`SerializationException` if the value could not be written """ try: if len(items) == 0: serializer.writer.write_empty_element(name) else: serializer.writer.write_start_element(name) for index, item in enumerate(items): try: write_item("v", None, item, serializer) except Exception as exception: _attribute_to_item(exception, index) serializer.writer.write_end_element(name) except Exception as exception: _attribute_to_property(exception, prop_name) def _write_json_object_as_element( name: str, prop_name: Optional[str], value: our_types.JsonObject, serializer: "_Serializer", ) -> None: """ Write the :paramref:`value` of a JSON-able object enclosed in the :paramref:`name` element. The ``<struct>`` discriminator is the :paramref:`name` element itself, so only its ``<member>``'s are written here. :param name: of the corresponding element tag :param prop_name: name of the property, as spelled in Python, whose value is written, or ``None`` if the access to the value is recorded by an enclosing writer :param value: to be serialized :param serializer: to write to :raise: :py:class:`SerializationException` if the value could not be written """ try: serializer.writer.write_start_element(name) our_xmlrpc.write_struct_body(value, serializer.writer) serializer.writer.write_end_element(name) except Exception as exception: _attribute_to_property(exception, prop_name) def _write_tuple2_of__string_value__string_value( name: str, prop_name: Optional[str], value: Tuple[our_types.StringValue, our_types.StringValue], serializer: "_Serializer", ) -> None: """ Write the 2 item(s) of :paramref:`value` enclosed in the :paramref:`name` element. :param name: of the enclosing element :param prop_name: name of the property, as spelled in Python, whose value is written, or ``None`` if the access to the value is recorded by an enclosing writer :param value: to be serialized :param serializer: to write to :raise: :py:class:`SerializationException` if the value could not be written """ try: serializer.writer.write_start_element(name) try: serializer.visit(value[0]) except Exception as exception: _attribute_to_item(exception, 0) try: serializer.visit(value[1]) except Exception as exception: _attribute_to_item(exception, 1) serializer.writer.write_end_element(name) except Exception as exception: _attribute_to_property(exception, prop_name) def _write_tuple2_of__value__value( name: str, prop_name: Optional[str], value: Tuple[our_types.Value, our_types.Value], serializer: "_Serializer", ) -> None: """ Write the 2 item(s) of :paramref:`value` enclosed in the :paramref:`name` element. :param name: of the enclosing element :param prop_name: name of the property, as spelled in Python, whose value is written, or ``None`` if the access to the value is recorded by an enclosing writer :param value: to be serialized :param serializer: to write to :raise: :py:class:`SerializationException` if the value could not be written """ try: serializer.writer.write_start_element(name) try: serializer.visit(value[0]) except Exception as exception: _attribute_to_item(exception, 0) try: serializer.visit(value[1]) except Exception as exception: _attribute_to_item(exception, 1) serializer.writer.write_end_element(name) except Exception as exception: _attribute_to_property(exception, prop_name) def _write_extension_as_element( name: str, prop_name: Optional[str], that: our_types.Extension, serializer: "_Serializer", ) -> None: """ Write :paramref:`that` enclosed in the :paramref:`name` element. :param name: of the element tag. Expected to contain no XML special characters. :param prop_name: name of the property, as spelled in Python, whose value is written, or ``None`` if the access to the value is recorded by an enclosing writer :param that: instance to be serialized :param serializer: to write to :raise: :py:class:`SerializationException` if the value could not be written """ try: serializer.writer.write_start_element(name) if that.semantic_id is not None: _write_reference_as_element( "semanticId", "semantic_id", that.semantic_id, serializer ) if that.supplemental_semantic_ids is not None: _write_list_of_instances( "supplementalSemanticIds", "supplemental_semantic_ids", that.supplemental_semantic_ids, serializer, ) _write_str_as_element("name", "name", that.name, serializer) if that.value_type is not None: _write_enum_as_element( "valueType", "value_type", that.value_type, serializer ) if that.value is not None: _write_str_as_element("value", "value", that.value, serializer) if that.refers_to is not None: _write_list_of_instances( "refersTo", "refers_to", that.refers_to, serializer ) serializer.writer.write_end_element(name) except Exception as exception: _attribute_to_property(exception, prop_name) def _write_administrative_information_as_element( name: str, prop_name: Optional[str], that: our_types.AdministrativeInformation, serializer: "_Serializer", ) -> None: """ Write :paramref:`that` enclosed in the :paramref:`name` element. All the properties are optional, so the element is collapsed to an empty one if none of them is set. :param name: of the element tag. Expected to contain no XML special characters. :param prop_name: name of the property, as spelled in Python, whose value is written, or ``None`` if the access to the value is recorded by an enclosing writer :param that: instance to be serialized :param serializer: to write to :raise: :py:class:`SerializationException` if the value could not be written """ try: # We optimize for the case where all the optional properties are not set, # so that we can simply output an empty element. if ( that.embedded_data_specifications is None and that.version is None and that.revision is None and that.creator is None and that.created_at is None and that.updated_at is None and that.template_id is None ): serializer.writer.write_empty_element(name) return serializer.writer.write_start_element(name) if that.embedded_data_specifications is not None: _write_list_of_instances( "embeddedDataSpecifications", "embedded_data_specifications", that.embedded_data_specifications, serializer, ) if that.version is not None: _write_str_as_element("version", "version", that.version, serializer) if that.revision is not None: _write_str_as_element("revision", "revision", that.revision, serializer) if that.creator is not None: _write_reference_as_element("creator", "creator", that.creator, serializer) if that.created_at is not None: _write_str_as_element( "createdAt", "created_at", that.created_at, serializer ) if that.updated_at is not None: _write_str_as_element( "updatedAt", "updated_at", that.updated_at, serializer ) if that.template_id is not None: _write_str_as_element( "templateId", "template_id", that.template_id, serializer ) serializer.writer.write_end_element(name) except Exception as exception: _attribute_to_property(exception, prop_name) def _write_qualifier_as_element( name: str, prop_name: Optional[str], that: our_types.Qualifier, serializer: "_Serializer", ) -> None: """ Write :paramref:`that` enclosed in the :paramref:`name` element. :param name: of the element tag. Expected to contain no XML special characters. :param prop_name: name of the property, as spelled in Python, whose value is written, or ``None`` if the access to the value is recorded by an enclosing writer :param that: instance to be serialized :param serializer: to write to :raise: :py:class:`SerializationException` if the value could not be written """ try: serializer.writer.write_start_element(name) if that.semantic_id is not None: _write_reference_as_element( "semanticId", "semantic_id", that.semantic_id, serializer ) if that.supplemental_semantic_ids is not None: _write_list_of_instances( "supplementalSemanticIds", "supplemental_semantic_ids", that.supplemental_semantic_ids, serializer, ) if that.kind is not None: _write_enum_as_element("kind", "kind", that.kind, serializer) _write_str_as_element("type", "type", that.type, serializer) _write_enum_as_element("valueType", "value_type", that.value_type, serializer) if that.value is not None: _write_str_as_element("value", "value", that.value, serializer) if that.value_id is not None: _write_reference_as_element( "valueId", "value_id", that.value_id, serializer ) serializer.writer.write_end_element(name) except Exception as exception: _attribute_to_property(exception, prop_name) def _write_asset_administration_shell_as_element( name: str, prop_name: Optional[str], that: our_types.AssetAdministrationShell, serializer: "_Serializer", ) -> None: """ Write :paramref:`that` enclosed in the :paramref:`name` element. :param name: of the element tag. Expected to contain no XML special characters. :param prop_name: name of the property, as spelled in Python, whose value is written, or ``None`` if the access to the value is recorded by an enclosing writer :param that: instance to be serialized :param serializer: to write to :raise: :py:class:`SerializationException` if the value could not be written """ try: serializer.writer.write_start_element(name) if that.extensions is not None: _write_list_of_instances( "extensions", "extensions", that.extensions, serializer ) if that.category is not None: _write_str_as_element("category", "category", that.category, serializer) if that.id_short is not None: _write_str_as_element("idShort", "id_short", that.id_short, serializer) if that.display_name is not None: _write_list_of_instances( "displayName", "display_name", that.display_name, serializer ) if that.description is not None: _write_list_of_instances( "description", "description", that.description, serializer ) if that.administration is not None: _write_administrative_information_as_element( "administration", "administration", that.administration, serializer ) _write_str_as_element("id", "id", that.id, serializer) if that.embedded_data_specifications is not None: _write_list_of_instances( "embeddedDataSpecifications", "embedded_data_specifications", that.embedded_data_specifications, serializer, ) if that.derived_from is not None: _write_reference_as_element( "derivedFrom", "derived_from", that.derived_from, serializer ) _write_asset_information_as_element( "assetInformation", "asset_information", that.asset_information, serializer ) if that.submodels is not None: _write_list_of_instances( "submodels", "submodels", that.submodels, serializer ) serializer.writer.write_end_element(name) except Exception as exception: _attribute_to_property(exception, prop_name) def _write_asset_information_as_element( name: str, prop_name: Optional[str], that: our_types.AssetInformation, serializer: "_Serializer", ) -> None: """ Write :paramref:`that` enclosed in the :paramref:`name` element. :param name: of the element tag. Expected to contain no XML special characters. :param prop_name: name of the property, as spelled in Python, whose value is written, or ``None`` if the access to the value is recorded by an enclosing writer :param that: instance to be serialized :param serializer: to write to :raise: :py:class:`SerializationException` if the value could not be written """ try: serializer.writer.write_start_element(name) _write_enum_as_element("assetKind", "asset_kind", that.asset_kind, serializer) if that.global_asset_id is not None: _write_str_as_element( "globalAssetId", "global_asset_id", that.global_asset_id, serializer ) if that.specific_asset_ids is not None: _write_list_of_instances( "specificAssetIds", "specific_asset_ids", that.specific_asset_ids, serializer, ) if that.asset_type is not None: _write_str_as_element( "assetType", "asset_type", that.asset_type, serializer ) if that.default_thumbnail is not None: _write_resource_as_element( "defaultThumbnail", "default_thumbnail", that.default_thumbnail, serializer, ) serializer.writer.write_end_element(name) except Exception as exception: _attribute_to_property(exception, prop_name) def _write_resource_as_element( name: str, prop_name: Optional[str], that: our_types.Resource, serializer: "_Serializer", ) -> None: """ Write :paramref:`that` enclosed in the :paramref:`name` element. :param name: of the element tag. Expected to contain no XML special characters. :param prop_name: name of the property, as spelled in Python, whose value is written, or ``None`` if the access to the value is recorded by an enclosing writer :param that: instance to be serialized :param serializer: to write to :raise: :py:class:`SerializationException` if the value could not be written """ try: serializer.writer.write_start_element(name) _write_str_as_element("path", "path", that.path, serializer) if that.content_type is not None: _write_str_as_element( "contentType", "content_type", that.content_type, serializer ) serializer.writer.write_end_element(name) except Exception as exception: _attribute_to_property(exception, prop_name) def _write_specific_asset_id_as_element( name: str, prop_name: Optional[str], that: our_types.SpecificAssetID, serializer: "_Serializer", ) -> None: """ Write :paramref:`that` enclosed in the :paramref:`name` element. :param name: of the element tag. Expected to contain no XML special characters. :param prop_name: name of the property, as spelled in Python, whose value is written, or ``None`` if the access to the value is recorded by an enclosing writer :param that: instance to be serialized :param serializer: to write to :raise: :py:class:`SerializationException` if the value could not be written """ try: serializer.writer.write_start_element(name) if that.semantic_id is not None: _write_reference_as_element( "semanticId", "semantic_id", that.semantic_id, serializer ) if that.supplemental_semantic_ids is not None: _write_list_of_instances( "supplementalSemanticIds", "supplemental_semantic_ids", that.supplemental_semantic_ids, serializer, ) _write_str_as_element("name", "name", that.name, serializer) _write_str_as_element("value", "value", that.value, serializer) if that.external_subject_id is not None: _write_reference_as_element( "externalSubjectId", "external_subject_id", that.external_subject_id, serializer, ) serializer.writer.write_end_element(name) except Exception as exception: _attribute_to_property(exception, prop_name) def _write_submodel_as_element( name: str, prop_name: Optional[str], that: our_types.Submodel, serializer: "_Serializer", ) -> None: """ Write :paramref:`that` enclosed in the :paramref:`name` element. :param name: of the element tag. Expected to contain no XML special characters. :param prop_name: name of the property, as spelled in Python, whose value is written, or ``None`` if the access to the value is recorded by an enclosing writer :param that: instance to be serialized :param serializer: to write to :raise: :py:class:`SerializationException` if the value could not be written """ try: serializer.writer.write_start_element(name) if that.extensions is not None: _write_list_of_instances( "extensions", "extensions", that.extensions, serializer ) if that.category is not None: _write_str_as_element("category", "category", that.category, serializer) if that.id_short is not None: _write_str_as_element("idShort", "id_short", that.id_short, serializer) if that.display_name is not None: _write_list_of_instances( "displayName", "display_name", that.display_name, serializer ) if that.description is not None: _write_list_of_instances( "description", "description", that.description, serializer ) if that.administration is not None: _write_administrative_information_as_element( "administration", "administration", that.administration, serializer ) _write_str_as_element("id", "id", that.id, serializer) if that.kind is not None: _write_enum_as_element("kind", "kind", that.kind, serializer) if that.semantic_id is not None: _write_reference_as_element( "semanticId", "semantic_id", that.semantic_id, serializer ) if that.supplemental_semantic_ids is not None: _write_list_of_instances( "supplementalSemanticIds", "supplemental_semantic_ids", that.supplemental_semantic_ids, serializer, ) if that.qualifiers is not None: _write_list_of_instances( "qualifiers", "qualifiers", that.qualifiers, serializer ) if that.embedded_data_specifications is not None: _write_list_of_instances( "embeddedDataSpecifications", "embedded_data_specifications", that.embedded_data_specifications, serializer, ) if that.submodel_elements is not None: _write_list_of_instances( "submodelElements", "submodel_elements", that.submodel_elements, serializer, ) serializer.writer.write_end_element(name) except Exception as exception: _attribute_to_property(exception, prop_name) def _write_relationship_element_as_element( name: str, prop_name: Optional[str], that: our_types.RelationshipElement, serializer: "_Serializer", ) -> None: """ Write :paramref:`that` enclosed in the :paramref:`name` element. All the properties are optional, so the element is collapsed to an empty one if none of them is set. :param name: of the element tag. Expected to contain no XML special characters. :param prop_name: name of the property, as spelled in Python, whose value is written, or ``None`` if the access to the value is recorded by an enclosing writer :param that: instance to be serialized :param serializer: to write to :raise: :py:class:`SerializationException` if the value could not be written """ try: # We optimize for the case where all the optional properties are not set, # so that we can simply output an empty element. if ( that.extensions is None and that.category is None and that.id_short is None and that.display_name is None and that.description is None and that.semantic_id is None and that.supplemental_semantic_ids is None and that.qualifiers is None and that.embedded_data_specifications is None and that.first is None and that.second is None ): serializer.writer.write_empty_element(name) return serializer.writer.write_start_element(name) if that.extensions is not None: _write_list_of_instances( "extensions", "extensions", that.extensions, serializer ) if that.category is not None: _write_str_as_element("category", "category", that.category, serializer) if that.id_short is not None: _write_str_as_element("idShort", "id_short", that.id_short, serializer) if that.display_name is not None: _write_list_of_instances( "displayName", "display_name", that.display_name, serializer ) if that.description is not None: _write_list_of_instances( "description", "description", that.description, serializer ) if that.semantic_id is not None: _write_reference_as_element( "semanticId", "semantic_id", that.semantic_id, serializer ) if that.supplemental_semantic_ids is not None: _write_list_of_instances( "supplementalSemanticIds", "supplemental_semantic_ids", that.supplemental_semantic_ids, serializer, ) if that.qualifiers is not None: _write_list_of_instances( "qualifiers", "qualifiers", that.qualifiers, serializer ) if that.embedded_data_specifications is not None: _write_list_of_instances( "embeddedDataSpecifications", "embedded_data_specifications", that.embedded_data_specifications, serializer, ) if that.first is not None: _write_reference_as_element("first", "first", that.first, serializer) if that.second is not None: _write_reference_as_element("second", "second", that.second, serializer) serializer.writer.write_end_element(name) except Exception as exception: _attribute_to_property(exception, prop_name) def _write_submodel_element_list_as_element( name: str, prop_name: Optional[str], that: our_types.SubmodelElementList, serializer: "_Serializer", ) -> None: """ Write :paramref:`that` enclosed in the :paramref:`name` element. :param name: of the element tag. Expected to contain no XML special characters. :param prop_name: name of the property, as spelled in Python, whose value is written, or ``None`` if the access to the value is recorded by an enclosing writer :param that: instance to be serialized :param serializer: to write to :raise: :py:class:`SerializationException` if the value could not be written """ try: serializer.writer.write_start_element(name) if that.extensions is not None: _write_list_of_instances( "extensions", "extensions", that.extensions, serializer ) if that.category is not None: _write_str_as_element("category", "category", that.category, serializer) if that.id_short is not None: _write_str_as_element("idShort", "id_short", that.id_short, serializer) if that.display_name is not None: _write_list_of_instances( "displayName", "display_name", that.display_name, serializer ) if that.description is not None: _write_list_of_instances( "description", "description", that.description, serializer ) if that.semantic_id is not None: _write_reference_as_element( "semanticId", "semantic_id", that.semantic_id, serializer ) if that.supplemental_semantic_ids is not None: _write_list_of_instances( "supplementalSemanticIds", "supplemental_semantic_ids", that.supplemental_semantic_ids, serializer, ) if that.qualifiers is not None: _write_list_of_instances( "qualifiers", "qualifiers", that.qualifiers, serializer ) if that.embedded_data_specifications is not None: _write_list_of_instances( "embeddedDataSpecifications", "embedded_data_specifications", that.embedded_data_specifications, serializer, ) if that.order_relevant is not None: _write_bool_as_element( "orderRelevant", "order_relevant", that.order_relevant, serializer ) if that.semantic_id_list_element is not None: _write_reference_as_element( "semanticIdListElement", "semantic_id_list_element", that.semantic_id_list_element, serializer, ) _write_enum_as_element( "typeValueListElement", "type_value_list_element", that.type_value_list_element, serializer, ) if that.value_type_list_element is not None: _write_enum_as_element( "valueTypeListElement", "value_type_list_element", that.value_type_list_element, serializer, ) if that.value is not None: _write_list_of_instances("value", "value", that.value, serializer) serializer.writer.write_end_element(name) except Exception as exception: _attribute_to_property(exception, prop_name) def _write_submodel_element_collection_as_element( name: str, prop_name: Optional[str], that: our_types.SubmodelElementCollection, serializer: "_Serializer", ) -> None: """ Write :paramref:`that` enclosed in the :paramref:`name` element. All the properties are optional, so the element is collapsed to an empty one if none of them is set. :param name: of the element tag. Expected to contain no XML special characters. :param prop_name: name of the property, as spelled in Python, whose value is written, or ``None`` if the access to the value is recorded by an enclosing writer :param that: instance to be serialized :param serializer: to write to :raise: :py:class:`SerializationException` if the value could not be written """ try: # We optimize for the case where all the optional properties are not set, # so that we can simply output an empty element. if ( that.extensions is None and that.category is None and that.id_short is None and that.display_name is None and that.description is None and that.semantic_id is None and that.supplemental_semantic_ids is None and that.qualifiers is None and that.embedded_data_specifications is None and that.value is None ): serializer.writer.write_empty_element(name) return serializer.writer.write_start_element(name) if that.extensions is not None: _write_list_of_instances( "extensions", "extensions", that.extensions, serializer ) if that.category is not None: _write_str_as_element("category", "category", that.category, serializer) if that.id_short is not None: _write_str_as_element("idShort", "id_short", that.id_short, serializer) if that.display_name is not None: _write_list_of_instances( "displayName", "display_name", that.display_name, serializer ) if that.description is not None: _write_list_of_instances( "description", "description", that.description, serializer ) if that.semantic_id is not None: _write_reference_as_element( "semanticId", "semantic_id", that.semantic_id, serializer ) if that.supplemental_semantic_ids is not None: _write_list_of_instances( "supplementalSemanticIds", "supplemental_semantic_ids", that.supplemental_semantic_ids, serializer, ) if that.qualifiers is not None: _write_list_of_instances( "qualifiers", "qualifiers", that.qualifiers, serializer ) if that.embedded_data_specifications is not None: _write_list_of_instances( "embeddedDataSpecifications", "embedded_data_specifications", that.embedded_data_specifications, serializer, ) if that.value is not None: _write_list_of_instances("value", "value", that.value, serializer) serializer.writer.write_end_element(name) except Exception as exception: _attribute_to_property(exception, prop_name) def _write_property_as_element( name: str, prop_name: Optional[str], that: our_types.Property, serializer: "_Serializer", ) -> None: """ Write :paramref:`that` enclosed in the :paramref:`name` element. :param name: of the element tag. Expected to contain no XML special characters. :param prop_name: name of the property, as spelled in Python, whose value is written, or ``None`` if the access to the value is recorded by an enclosing writer :param that: instance to be serialized :param serializer: to write to :raise: :py:class:`SerializationException` if the value could not be written """ try: serializer.writer.write_start_element(name) if that.extensions is not None: _write_list_of_instances( "extensions", "extensions", that.extensions, serializer ) if that.category is not None: _write_str_as_element("category", "category", that.category, serializer) if that.id_short is not None: _write_str_as_element("idShort", "id_short", that.id_short, serializer) if that.display_name is not None: _write_list_of_instances( "displayName", "display_name", that.display_name, serializer ) if that.description is not None: _write_list_of_instances( "description", "description", that.description, serializer ) if that.semantic_id is not None: _write_reference_as_element( "semanticId", "semantic_id", that.semantic_id, serializer ) if that.supplemental_semantic_ids is not None: _write_list_of_instances( "supplementalSemanticIds", "supplemental_semantic_ids", that.supplemental_semantic_ids, serializer, ) if that.qualifiers is not None: _write_list_of_instances( "qualifiers", "qualifiers", that.qualifiers, serializer ) if that.embedded_data_specifications is not None: _write_list_of_instances( "embeddedDataSpecifications", "embedded_data_specifications", that.embedded_data_specifications, serializer, ) _write_enum_as_element("valueType", "value_type", that.value_type, serializer) if that.value is not None: _write_str_as_element("value", "value", that.value, serializer) if that.value_id is not None: _write_reference_as_element( "valueId", "value_id", that.value_id, serializer ) serializer.writer.write_end_element(name) except Exception as exception: _attribute_to_property(exception, prop_name) def _write_multi_language_property_as_element( name: str, prop_name: Optional[str], that: our_types.MultiLanguageProperty, serializer: "_Serializer", ) -> None: """ Write :paramref:`that` enclosed in the :paramref:`name` element. All the properties are optional, so the element is collapsed to an empty one if none of them is set. :param name: of the element tag. Expected to contain no XML special characters. :param prop_name: name of the property, as spelled in Python, whose value is written, or ``None`` if the access to the value is recorded by an enclosing writer :param that: instance to be serialized :param serializer: to write to :raise: :py:class:`SerializationException` if the value could not be written """ try: # We optimize for the case where all the optional properties are not set, # so that we can simply output an empty element. if ( that.extensions is None and that.category is None and that.id_short is None and that.display_name is None and that.description is None and that.semantic_id is None and that.supplemental_semantic_ids is None and that.qualifiers is None and that.embedded_data_specifications is None and that.value is None and that.value_id is None ): serializer.writer.write_empty_element(name) return serializer.writer.write_start_element(name) if that.extensions is not None: _write_list_of_instances( "extensions", "extensions", that.extensions, serializer ) if that.category is not None: _write_str_as_element("category", "category", that.category, serializer) if that.id_short is not None: _write_str_as_element("idShort", "id_short", that.id_short, serializer) if that.display_name is not None: _write_list_of_instances( "displayName", "display_name", that.display_name, serializer ) if that.description is not None: _write_list_of_instances( "description", "description", that.description, serializer ) if that.semantic_id is not None: _write_reference_as_element( "semanticId", "semantic_id", that.semantic_id, serializer ) if that.supplemental_semantic_ids is not None: _write_list_of_instances( "supplementalSemanticIds", "supplemental_semantic_ids", that.supplemental_semantic_ids, serializer, ) if that.qualifiers is not None: _write_list_of_instances( "qualifiers", "qualifiers", that.qualifiers, serializer ) if that.embedded_data_specifications is not None: _write_list_of_instances( "embeddedDataSpecifications", "embedded_data_specifications", that.embedded_data_specifications, serializer, ) if that.value is not None: _write_list_of_instances("value", "value", that.value, serializer) if that.value_id is not None: _write_reference_as_element( "valueId", "value_id", that.value_id, serializer ) serializer.writer.write_end_element(name) except Exception as exception: _attribute_to_property(exception, prop_name) def _write_range_as_element( name: str, prop_name: Optional[str], that: our_types.Range, serializer: "_Serializer", ) -> None: """ Write :paramref:`that` enclosed in the :paramref:`name` element. :param name: of the element tag. Expected to contain no XML special characters. :param prop_name: name of the property, as spelled in Python, whose value is written, or ``None`` if the access to the value is recorded by an enclosing writer :param that: instance to be serialized :param serializer: to write to :raise: :py:class:`SerializationException` if the value could not be written """ try: serializer.writer.write_start_element(name) if that.extensions is not None: _write_list_of_instances( "extensions", "extensions", that.extensions, serializer ) if that.category is not None: _write_str_as_element("category", "category", that.category, serializer) if that.id_short is not None: _write_str_as_element("idShort", "id_short", that.id_short, serializer) if that.display_name is not None: _write_list_of_instances( "displayName", "display_name", that.display_name, serializer ) if that.description is not None: _write_list_of_instances( "description", "description", that.description, serializer ) if that.semantic_id is not None: _write_reference_as_element( "semanticId", "semantic_id", that.semantic_id, serializer ) if that.supplemental_semantic_ids is not None: _write_list_of_instances( "supplementalSemanticIds", "supplemental_semantic_ids", that.supplemental_semantic_ids, serializer, ) if that.qualifiers is not None: _write_list_of_instances( "qualifiers", "qualifiers", that.qualifiers, serializer ) if that.embedded_data_specifications is not None: _write_list_of_instances( "embeddedDataSpecifications", "embedded_data_specifications", that.embedded_data_specifications, serializer, ) _write_enum_as_element("valueType", "value_type", that.value_type, serializer) if that.min is not None: _write_str_as_element("min", "min", that.min, serializer) if that.max is not None: _write_str_as_element("max", "max", that.max, serializer) serializer.writer.write_end_element(name) except Exception as exception: _attribute_to_property(exception, prop_name) def _write_reference_element_as_element( name: str, prop_name: Optional[str], that: our_types.ReferenceElement, serializer: "_Serializer", ) -> None: """ Write :paramref:`that` enclosed in the :paramref:`name` element. All the properties are optional, so the element is collapsed to an empty one if none of them is set. :param name: of the element tag. Expected to contain no XML special characters. :param prop_name: name of the property, as spelled in Python, whose value is written, or ``None`` if the access to the value is recorded by an enclosing writer :param that: instance to be serialized :param serializer: to write to :raise: :py:class:`SerializationException` if the value could not be written """ try: # We optimize for the case where all the optional properties are not set, # so that we can simply output an empty element. if ( that.extensions is None and that.category is None and that.id_short is None and that.display_name is None and that.description is None and that.semantic_id is None and that.supplemental_semantic_ids is None and that.qualifiers is None and that.embedded_data_specifications is None and that.value is None ): serializer.writer.write_empty_element(name) return serializer.writer.write_start_element(name) if that.extensions is not None: _write_list_of_instances( "extensions", "extensions", that.extensions, serializer ) if that.category is not None: _write_str_as_element("category", "category", that.category, serializer) if that.id_short is not None: _write_str_as_element("idShort", "id_short", that.id_short, serializer) if that.display_name is not None: _write_list_of_instances( "displayName", "display_name", that.display_name, serializer ) if that.description is not None: _write_list_of_instances( "description", "description", that.description, serializer ) if that.semantic_id is not None: _write_reference_as_element( "semanticId", "semantic_id", that.semantic_id, serializer ) if that.supplemental_semantic_ids is not None: _write_list_of_instances( "supplementalSemanticIds", "supplemental_semantic_ids", that.supplemental_semantic_ids, serializer, ) if that.qualifiers is not None: _write_list_of_instances( "qualifiers", "qualifiers", that.qualifiers, serializer ) if that.embedded_data_specifications is not None: _write_list_of_instances( "embeddedDataSpecifications", "embedded_data_specifications", that.embedded_data_specifications, serializer, ) if that.value is not None: _write_reference_as_element("value", "value", that.value, serializer) serializer.writer.write_end_element(name) except Exception as exception: _attribute_to_property(exception, prop_name) def _write_blob_as_element( name: str, prop_name: Optional[str], that: our_types.Blob, serializer: "_Serializer" ) -> None: """ Write :paramref:`that` enclosed in the :paramref:`name` element. All the properties are optional, so the element is collapsed to an empty one if none of them is set. :param name: of the element tag. Expected to contain no XML special characters. :param prop_name: name of the property, as spelled in Python, whose value is written, or ``None`` if the access to the value is recorded by an enclosing writer :param that: instance to be serialized :param serializer: to write to :raise: :py:class:`SerializationException` if the value could not be written """ try: # We optimize for the case where all the optional properties are not set, # so that we can simply output an empty element. if ( that.extensions is None and that.category is None and that.id_short is None and that.display_name is None and that.description is None and that.semantic_id is None and that.supplemental_semantic_ids is None and that.qualifiers is None and that.embedded_data_specifications is None and that.value is None and that.content_type is None ): serializer.writer.write_empty_element(name) return serializer.writer.write_start_element(name) if that.extensions is not None: _write_list_of_instances( "extensions", "extensions", that.extensions, serializer ) if that.category is not None: _write_str_as_element("category", "category", that.category, serializer) if that.id_short is not None: _write_str_as_element("idShort", "id_short", that.id_short, serializer) if that.display_name is not None: _write_list_of_instances( "displayName", "display_name", that.display_name, serializer ) if that.description is not None: _write_list_of_instances( "description", "description", that.description, serializer ) if that.semantic_id is not None: _write_reference_as_element( "semanticId", "semantic_id", that.semantic_id, serializer ) if that.supplemental_semantic_ids is not None: _write_list_of_instances( "supplementalSemanticIds", "supplemental_semantic_ids", that.supplemental_semantic_ids, serializer, ) if that.qualifiers is not None: _write_list_of_instances( "qualifiers", "qualifiers", that.qualifiers, serializer ) if that.embedded_data_specifications is not None: _write_list_of_instances( "embeddedDataSpecifications", "embedded_data_specifications", that.embedded_data_specifications, serializer, ) if that.value is not None: _write_bytes_as_element("value", "value", that.value, serializer) if that.content_type is not None: _write_str_as_element( "contentType", "content_type", that.content_type, serializer ) serializer.writer.write_end_element(name) except Exception as exception: _attribute_to_property(exception, prop_name) def _write_file_as_element( name: str, prop_name: Optional[str], that: our_types.File, serializer: "_Serializer" ) -> None: """ Write :paramref:`that` enclosed in the :paramref:`name` element. All the properties are optional, so the element is collapsed to an empty one if none of them is set. :param name: of the element tag. Expected to contain no XML special characters. :param prop_name: name of the property, as spelled in Python, whose value is written, or ``None`` if the access to the value is recorded by an enclosing writer :param that: instance to be serialized :param serializer: to write to :raise: :py:class:`SerializationException` if the value could not be written """ try: # We optimize for the case where all the optional properties are not set, # so that we can simply output an empty element. if ( that.extensions is None and that.category is None and that.id_short is None and that.display_name is None and that.description is None and that.semantic_id is None and that.supplemental_semantic_ids is None and that.qualifiers is None and that.embedded_data_specifications is None and that.value is None and that.content_type is None ): serializer.writer.write_empty_element(name) return serializer.writer.write_start_element(name) if that.extensions is not None: _write_list_of_instances( "extensions", "extensions", that.extensions, serializer ) if that.category is not None: _write_str_as_element("category", "category", that.category, serializer) if that.id_short is not None: _write_str_as_element("idShort", "id_short", that.id_short, serializer) if that.display_name is not None: _write_list_of_instances( "displayName", "display_name", that.display_name, serializer ) if that.description is not None: _write_list_of_instances( "description", "description", that.description, serializer ) if that.semantic_id is not None: _write_reference_as_element( "semanticId", "semantic_id", that.semantic_id, serializer ) if that.supplemental_semantic_ids is not None: _write_list_of_instances( "supplementalSemanticIds", "supplemental_semantic_ids", that.supplemental_semantic_ids, serializer, ) if that.qualifiers is not None: _write_list_of_instances( "qualifiers", "qualifiers", that.qualifiers, serializer ) if that.embedded_data_specifications is not None: _write_list_of_instances( "embeddedDataSpecifications", "embedded_data_specifications", that.embedded_data_specifications, serializer, ) if that.value is not None: _write_str_as_element("value", "value", that.value, serializer) if that.content_type is not None: _write_str_as_element( "contentType", "content_type", that.content_type, serializer ) serializer.writer.write_end_element(name) except Exception as exception: _attribute_to_property(exception, prop_name) def _write_annotated_relationship_element_as_element( name: str, prop_name: Optional[str], that: our_types.AnnotatedRelationshipElement, serializer: "_Serializer", ) -> None: """ Write :paramref:`that` enclosed in the :paramref:`name` element. All the properties are optional, so the element is collapsed to an empty one if none of them is set. :param name: of the element tag. Expected to contain no XML special characters. :param prop_name: name of the property, as spelled in Python, whose value is written, or ``None`` if the access to the value is recorded by an enclosing writer :param that: instance to be serialized :param serializer: to write to :raise: :py:class:`SerializationException` if the value could not be written """ try: # We optimize for the case where all the optional properties are not set, # so that we can simply output an empty element. if ( that.extensions is None and that.category is None and that.id_short is None and that.display_name is None and that.description is None and that.semantic_id is None and that.supplemental_semantic_ids is None and that.qualifiers is None and that.embedded_data_specifications is None and that.first is None and that.second is None and that.annotations is None ): serializer.writer.write_empty_element(name) return serializer.writer.write_start_element(name) if that.extensions is not None: _write_list_of_instances( "extensions", "extensions", that.extensions, serializer ) if that.category is not None: _write_str_as_element("category", "category", that.category, serializer) if that.id_short is not None: _write_str_as_element("idShort", "id_short", that.id_short, serializer) if that.display_name is not None: _write_list_of_instances( "displayName", "display_name", that.display_name, serializer ) if that.description is not None: _write_list_of_instances( "description", "description", that.description, serializer ) if that.semantic_id is not None: _write_reference_as_element( "semanticId", "semantic_id", that.semantic_id, serializer ) if that.supplemental_semantic_ids is not None: _write_list_of_instances( "supplementalSemanticIds", "supplemental_semantic_ids", that.supplemental_semantic_ids, serializer, ) if that.qualifiers is not None: _write_list_of_instances( "qualifiers", "qualifiers", that.qualifiers, serializer ) if that.embedded_data_specifications is not None: _write_list_of_instances( "embeddedDataSpecifications", "embedded_data_specifications", that.embedded_data_specifications, serializer, ) if that.first is not None: _write_reference_as_element("first", "first", that.first, serializer) if that.second is not None: _write_reference_as_element("second", "second", that.second, serializer) if that.annotations is not None: _write_list_of_instances( "annotations", "annotations", that.annotations, serializer ) serializer.writer.write_end_element(name) except Exception as exception: _attribute_to_property(exception, prop_name) def _write_entity_as_element( name: str, prop_name: Optional[str], that: our_types.Entity, serializer: "_Serializer", ) -> None: """ Write :paramref:`that` enclosed in the :paramref:`name` element. All the properties are optional, so the element is collapsed to an empty one if none of them is set. :param name: of the element tag. Expected to contain no XML special characters. :param prop_name: name of the property, as spelled in Python, whose value is written, or ``None`` if the access to the value is recorded by an enclosing writer :param that: instance to be serialized :param serializer: to write to :raise: :py:class:`SerializationException` if the value could not be written """ try: # We optimize for the case where all the optional properties are not set, # so that we can simply output an empty element. if ( that.extensions is None and that.category is None and that.id_short is None and that.display_name is None and that.description is None and that.semantic_id is None and that.supplemental_semantic_ids is None and that.qualifiers is None and that.embedded_data_specifications is None and that.statements is None and that.entity_type is None and that.global_asset_id is None and that.specific_asset_ids is None ): serializer.writer.write_empty_element(name) return serializer.writer.write_start_element(name) if that.extensions is not None: _write_list_of_instances( "extensions", "extensions", that.extensions, serializer ) if that.category is not None: _write_str_as_element("category", "category", that.category, serializer) if that.id_short is not None: _write_str_as_element("idShort", "id_short", that.id_short, serializer) if that.display_name is not None: _write_list_of_instances( "displayName", "display_name", that.display_name, serializer ) if that.description is not None: _write_list_of_instances( "description", "description", that.description, serializer ) if that.semantic_id is not None: _write_reference_as_element( "semanticId", "semantic_id", that.semantic_id, serializer ) if that.supplemental_semantic_ids is not None: _write_list_of_instances( "supplementalSemanticIds", "supplemental_semantic_ids", that.supplemental_semantic_ids, serializer, ) if that.qualifiers is not None: _write_list_of_instances( "qualifiers", "qualifiers", that.qualifiers, serializer ) if that.embedded_data_specifications is not None: _write_list_of_instances( "embeddedDataSpecifications", "embedded_data_specifications", that.embedded_data_specifications, serializer, ) if that.statements is not None: _write_list_of_instances( "statements", "statements", that.statements, serializer ) if that.entity_type is not None: _write_enum_as_element( "entityType", "entity_type", that.entity_type, serializer ) if that.global_asset_id is not None: _write_str_as_element( "globalAssetId", "global_asset_id", that.global_asset_id, serializer ) if that.specific_asset_ids is not None: _write_list_of_instances( "specificAssetIds", "specific_asset_ids", that.specific_asset_ids, serializer, ) serializer.writer.write_end_element(name) except Exception as exception: _attribute_to_property(exception, prop_name) def _write_event_payload_as_element( name: str, prop_name: Optional[str], that: our_types.EventPayload, serializer: "_Serializer", ) -> None: """ Write :paramref:`that` enclosed in the :paramref:`name` element. :param name: of the element tag. Expected to contain no XML special characters. :param prop_name: name of the property, as spelled in Python, whose value is written, or ``None`` if the access to the value is recorded by an enclosing writer :param that: instance to be serialized :param serializer: to write to :raise: :py:class:`SerializationException` if the value could not be written """ try: serializer.writer.write_start_element(name) _write_reference_as_element("source", "source", that.source, serializer) if that.source_semantic_id is not None: _write_reference_as_element( "sourceSemanticId", "source_semantic_id", that.source_semantic_id, serializer, ) _write_reference_as_element( "observableReference", "observable_reference", that.observable_reference, serializer, ) if that.observable_semantic_id is not None: _write_reference_as_element( "observableSemanticId", "observable_semantic_id", that.observable_semantic_id, serializer, ) if that.topic is not None: _write_str_as_element("topic", "topic", that.topic, serializer) if that.subject_id is not None: _write_reference_as_element( "subjectId", "subject_id", that.subject_id, serializer ) _write_str_as_element("timeStamp", "time_stamp", that.time_stamp, serializer) if that.payload is not None: _write_bytes_as_element("payload", "payload", that.payload, serializer) serializer.writer.write_end_element(name) except Exception as exception: _attribute_to_property(exception, prop_name) def _write_basic_event_element_as_element( name: str, prop_name: Optional[str], that: our_types.BasicEventElement, serializer: "_Serializer", ) -> None: """ Write :paramref:`that` enclosed in the :paramref:`name` element. :param name: of the element tag. Expected to contain no XML special characters. :param prop_name: name of the property, as spelled in Python, whose value is written, or ``None`` if the access to the value is recorded by an enclosing writer :param that: instance to be serialized :param serializer: to write to :raise: :py:class:`SerializationException` if the value could not be written """ try: serializer.writer.write_start_element(name) if that.extensions is not None: _write_list_of_instances( "extensions", "extensions", that.extensions, serializer ) if that.category is not None: _write_str_as_element("category", "category", that.category, serializer) if that.id_short is not None: _write_str_as_element("idShort", "id_short", that.id_short, serializer) if that.display_name is not None: _write_list_of_instances( "displayName", "display_name", that.display_name, serializer ) if that.description is not None: _write_list_of_instances( "description", "description", that.description, serializer ) if that.semantic_id is not None: _write_reference_as_element( "semanticId", "semantic_id", that.semantic_id, serializer ) if that.supplemental_semantic_ids is not None: _write_list_of_instances( "supplementalSemanticIds", "supplemental_semantic_ids", that.supplemental_semantic_ids, serializer, ) if that.qualifiers is not None: _write_list_of_instances( "qualifiers", "qualifiers", that.qualifiers, serializer ) if that.embedded_data_specifications is not None: _write_list_of_instances( "embeddedDataSpecifications", "embedded_data_specifications", that.embedded_data_specifications, serializer, ) _write_reference_as_element("observed", "observed", that.observed, serializer) _write_enum_as_element("direction", "direction", that.direction, serializer) _write_enum_as_element("state", "state", that.state, serializer) if that.message_topic is not None: _write_str_as_element( "messageTopic", "message_topic", that.message_topic, serializer ) if that.message_broker is not None: _write_reference_as_element( "messageBroker", "message_broker", that.message_broker, serializer ) if that.last_update is not None: _write_str_as_element( "lastUpdate", "last_update", that.last_update, serializer ) if that.min_interval is not None: _write_str_as_element( "minInterval", "min_interval", that.min_interval, serializer ) if that.max_interval is not None: _write_str_as_element( "maxInterval", "max_interval", that.max_interval, serializer ) serializer.writer.write_end_element(name) except Exception as exception: _attribute_to_property(exception, prop_name) def _write_operation_as_element( name: str, prop_name: Optional[str], that: our_types.Operation, serializer: "_Serializer", ) -> None: """ Write :paramref:`that` enclosed in the :paramref:`name` element. All the properties are optional, so the element is collapsed to an empty one if none of them is set. :param name: of the element tag. Expected to contain no XML special characters. :param prop_name: name of the property, as spelled in Python, whose value is written, or ``None`` if the access to the value is recorded by an enclosing writer :param that: instance to be serialized :param serializer: to write to :raise: :py:class:`SerializationException` if the value could not be written """ try: # We optimize for the case where all the optional properties are not set, # so that we can simply output an empty element. if ( that.extensions is None and that.category is None and that.id_short is None and that.display_name is None and that.description is None and that.semantic_id is None and that.supplemental_semantic_ids is None and that.qualifiers is None and that.embedded_data_specifications is None and that.input_variables is None and that.output_variables is None and that.inoutput_variables is None ): serializer.writer.write_empty_element(name) return serializer.writer.write_start_element(name) if that.extensions is not None: _write_list_of_instances( "extensions", "extensions", that.extensions, serializer ) if that.category is not None: _write_str_as_element("category", "category", that.category, serializer) if that.id_short is not None: _write_str_as_element("idShort", "id_short", that.id_short, serializer) if that.display_name is not None: _write_list_of_instances( "displayName", "display_name", that.display_name, serializer ) if that.description is not None: _write_list_of_instances( "description", "description", that.description, serializer ) if that.semantic_id is not None: _write_reference_as_element( "semanticId", "semantic_id", that.semantic_id, serializer ) if that.supplemental_semantic_ids is not None: _write_list_of_instances( "supplementalSemanticIds", "supplemental_semantic_ids", that.supplemental_semantic_ids, serializer, ) if that.qualifiers is not None: _write_list_of_instances( "qualifiers", "qualifiers", that.qualifiers, serializer ) if that.embedded_data_specifications is not None: _write_list_of_instances( "embeddedDataSpecifications", "embedded_data_specifications", that.embedded_data_specifications, serializer, ) if that.input_variables is not None: _write_list_of_instances( "inputVariables", "input_variables", that.input_variables, serializer ) if that.output_variables is not None: _write_list_of_instances( "outputVariables", "output_variables", that.output_variables, serializer ) if that.inoutput_variables is not None: _write_list_of_instances( "inoutputVariables", "inoutput_variables", that.inoutput_variables, serializer, ) serializer.writer.write_end_element(name) except Exception as exception: _attribute_to_property(exception, prop_name) def _write_operation_variable_as_element( name: str, prop_name: Optional[str], that: our_types.OperationVariable, serializer: "_Serializer", ) -> None: """ Write :paramref:`that` enclosed in the :paramref:`name` element. :param name: of the element tag. Expected to contain no XML special characters. :param prop_name: name of the property, as spelled in Python, whose value is written, or ``None`` if the access to the value is recorded by an enclosing writer :param that: instance to be serialized :param serializer: to write to :raise: :py:class:`SerializationException` if the value could not be written """ try: serializer.writer.write_start_element(name) _write_nested_element("value", "value", that.value, serializer) serializer.writer.write_end_element(name) except Exception as exception: _attribute_to_property(exception, prop_name) def _write_capability_as_element( name: str, prop_name: Optional[str], that: our_types.Capability, serializer: "_Serializer", ) -> None: """ Write :paramref:`that` enclosed in the :paramref:`name` element. All the properties are optional, so the element is collapsed to an empty one if none of them is set. :param name: of the element tag. Expected to contain no XML special characters. :param prop_name: name of the property, as spelled in Python, whose value is written, or ``None`` if the access to the value is recorded by an enclosing writer :param that: instance to be serialized :param serializer: to write to :raise: :py:class:`SerializationException` if the value could not be written """ try: # We optimize for the case where all the optional properties are not set, # so that we can simply output an empty element. if ( that.extensions is None and that.category is None and that.id_short is None and that.display_name is None and that.description is None and that.semantic_id is None and that.supplemental_semantic_ids is None and that.qualifiers is None and that.embedded_data_specifications is None ): serializer.writer.write_empty_element(name) return serializer.writer.write_start_element(name) if that.extensions is not None: _write_list_of_instances( "extensions", "extensions", that.extensions, serializer ) if that.category is not None: _write_str_as_element("category", "category", that.category, serializer) if that.id_short is not None: _write_str_as_element("idShort", "id_short", that.id_short, serializer) if that.display_name is not None: _write_list_of_instances( "displayName", "display_name", that.display_name, serializer ) if that.description is not None: _write_list_of_instances( "description", "description", that.description, serializer ) if that.semantic_id is not None: _write_reference_as_element( "semanticId", "semantic_id", that.semantic_id, serializer ) if that.supplemental_semantic_ids is not None: _write_list_of_instances( "supplementalSemanticIds", "supplemental_semantic_ids", that.supplemental_semantic_ids, serializer, ) if that.qualifiers is not None: _write_list_of_instances( "qualifiers", "qualifiers", that.qualifiers, serializer ) if that.embedded_data_specifications is not None: _write_list_of_instances( "embeddedDataSpecifications", "embedded_data_specifications", that.embedded_data_specifications, serializer, ) serializer.writer.write_end_element(name) except Exception as exception: _attribute_to_property(exception, prop_name) def _write_concept_description_as_element( name: str, prop_name: Optional[str], that: our_types.ConceptDescription, serializer: "_Serializer", ) -> None: """ Write :paramref:`that` enclosed in the :paramref:`name` element. :param name: of the element tag. Expected to contain no XML special characters. :param prop_name: name of the property, as spelled in Python, whose value is written, or ``None`` if the access to the value is recorded by an enclosing writer :param that: instance to be serialized :param serializer: to write to :raise: :py:class:`SerializationException` if the value could not be written """ try: serializer.writer.write_start_element(name) if that.extensions is not None: _write_list_of_instances( "extensions", "extensions", that.extensions, serializer ) if that.category is not None: _write_str_as_element("category", "category", that.category, serializer) if that.id_short is not None: _write_str_as_element("idShort", "id_short", that.id_short, serializer) if that.display_name is not None: _write_list_of_instances( "displayName", "display_name", that.display_name, serializer ) if that.description is not None: _write_list_of_instances( "description", "description", that.description, serializer ) if that.administration is not None: _write_administrative_information_as_element( "administration", "administration", that.administration, serializer ) _write_str_as_element("id", "id", that.id, serializer) if that.embedded_data_specifications is not None: _write_list_of_instances( "embeddedDataSpecifications", "embedded_data_specifications", that.embedded_data_specifications, serializer, ) if that.is_case_of is not None: _write_list_of_instances( "isCaseOf", "is_case_of", that.is_case_of, serializer ) serializer.writer.write_end_element(name) except Exception as exception: _attribute_to_property(exception, prop_name) def _write_reference_as_element( name: str, prop_name: Optional[str], that: our_types.Reference, serializer: "_Serializer", ) -> None: """ Write :paramref:`that` enclosed in the :paramref:`name` element. :param name: of the element tag. Expected to contain no XML special characters. :param prop_name: name of the property, as spelled in Python, whose value is written, or ``None`` if the access to the value is recorded by an enclosing writer :param that: instance to be serialized :param serializer: to write to :raise: :py:class:`SerializationException` if the value could not be written """ try: serializer.writer.write_start_element(name) _write_enum_as_element("type", "type", that.type, serializer) if that.referred_semantic_id is not None: _write_reference_as_element( "referredSemanticId", "referred_semantic_id", that.referred_semantic_id, serializer, ) _write_list_of_instances("keys", "keys", that.keys, serializer) serializer.writer.write_end_element(name) except Exception as exception: _attribute_to_property(exception, prop_name) def _write_key_as_element( name: str, prop_name: Optional[str], that: our_types.Key, serializer: "_Serializer" ) -> None: """ Write :paramref:`that` enclosed in the :paramref:`name` element. :param name: of the element tag. Expected to contain no XML special characters. :param prop_name: name of the property, as spelled in Python, whose value is written, or ``None`` if the access to the value is recorded by an enclosing writer :param that: instance to be serialized :param serializer: to write to :raise: :py:class:`SerializationException` if the value could not be written """ try: serializer.writer.write_start_element(name) _write_enum_as_element("type", "type", that.type, serializer) _write_str_as_element("value", "value", that.value, serializer) serializer.writer.write_end_element(name) except Exception as exception: _attribute_to_property(exception, prop_name) def _write_lang_string_name_type_as_element( name: str, prop_name: Optional[str], that: our_types.LangStringNameType, serializer: "_Serializer", ) -> None: """ Write :paramref:`that` enclosed in the :paramref:`name` element. :param name: of the element tag. Expected to contain no XML special characters. :param prop_name: name of the property, as spelled in Python, whose value is written, or ``None`` if the access to the value is recorded by an enclosing writer :param that: instance to be serialized :param serializer: to write to :raise: :py:class:`SerializationException` if the value could not be written """ try: serializer.writer.write_start_element(name) _write_str_as_element("language", "language", that.language, serializer) _write_str_as_element("text", "text", that.text, serializer) serializer.writer.write_end_element(name) except Exception as exception: _attribute_to_property(exception, prop_name) def _write_lang_string_text_type_as_element( name: str, prop_name: Optional[str], that: our_types.LangStringTextType, serializer: "_Serializer", ) -> None: """ Write :paramref:`that` enclosed in the :paramref:`name` element. :param name: of the element tag. Expected to contain no XML special characters. :param prop_name: name of the property, as spelled in Python, whose value is written, or ``None`` if the access to the value is recorded by an enclosing writer :param that: instance to be serialized :param serializer: to write to :raise: :py:class:`SerializationException` if the value could not be written """ try: serializer.writer.write_start_element(name) _write_str_as_element("language", "language", that.language, serializer) _write_str_as_element("text", "text", that.text, serializer) serializer.writer.write_end_element(name) except Exception as exception: _attribute_to_property(exception, prop_name) def _write_environment_as_element( name: str, prop_name: Optional[str], that: our_types.Environment, serializer: "_Serializer", ) -> None: """ Write :paramref:`that` enclosed in the :paramref:`name` element. All the properties are optional, so the element is collapsed to an empty one if none of them is set. :param name: of the element tag. Expected to contain no XML special characters. :param prop_name: name of the property, as spelled in Python, whose value is written, or ``None`` if the access to the value is recorded by an enclosing writer :param that: instance to be serialized :param serializer: to write to :raise: :py:class:`SerializationException` if the value could not be written """ try: # We optimize for the case where all the optional properties are not set, # so that we can simply output an empty element. if ( that.asset_administration_shells is None and that.submodels is None and that.concept_descriptions is None ): serializer.writer.write_empty_element(name) return serializer.writer.write_start_element(name) if that.asset_administration_shells is not None: _write_list_of_instances( "assetAdministrationShells", "asset_administration_shells", that.asset_administration_shells, serializer, ) if that.submodels is not None: _write_list_of_instances( "submodels", "submodels", that.submodels, serializer ) if that.concept_descriptions is not None: _write_list_of_instances( "conceptDescriptions", "concept_descriptions", that.concept_descriptions, serializer, ) serializer.writer.write_end_element(name) except Exception as exception: _attribute_to_property(exception, prop_name) def _write_embedded_data_specification_as_element( name: str, prop_name: Optional[str], that: our_types.EmbeddedDataSpecification, serializer: "_Serializer", ) -> None: """ Write :paramref:`that` enclosed in the :paramref:`name` element. :param name: of the element tag. Expected to contain no XML special characters. :param prop_name: name of the property, as spelled in Python, whose value is written, or ``None`` if the access to the value is recorded by an enclosing writer :param that: instance to be serialized :param serializer: to write to :raise: :py:class:`SerializationException` if the value could not be written """ try: serializer.writer.write_start_element(name) _write_reference_as_element( "dataSpecification", "data_specification", that.data_specification, serializer, ) _write_nested_element( "dataSpecificationContent", "data_specification_content", that.data_specification_content, serializer, ) serializer.writer.write_end_element(name) except Exception as exception: _attribute_to_property(exception, prop_name) def _write_level_type_as_element( name: str, prop_name: Optional[str], that: our_types.LevelType, serializer: "_Serializer", ) -> None: """ Write :paramref:`that` enclosed in the :paramref:`name` element. :param name: of the element tag. Expected to contain no XML special characters. :param prop_name: name of the property, as spelled in Python, whose value is written, or ``None`` if the access to the value is recorded by an enclosing writer :param that: instance to be serialized :param serializer: to write to :raise: :py:class:`SerializationException` if the value could not be written """ try: serializer.writer.write_start_element(name) _write_bool_as_element("min", "min", that.min, serializer) _write_bool_as_element("nom", "nom", that.nom, serializer) _write_bool_as_element("typ", "typ", that.typ, serializer) _write_bool_as_element("max", "max", that.max, serializer) serializer.writer.write_end_element(name) except Exception as exception: _attribute_to_property(exception, prop_name) def _write_value_reference_pair_as_element( name: str, prop_name: Optional[str], that: our_types.ValueReferencePair, serializer: "_Serializer", ) -> None: """ Write :paramref:`that` enclosed in the :paramref:`name` element. :param name: of the element tag. Expected to contain no XML special characters. :param prop_name: name of the property, as spelled in Python, whose value is written, or ``None`` if the access to the value is recorded by an enclosing writer :param that: instance to be serialized :param serializer: to write to :raise: :py:class:`SerializationException` if the value could not be written """ try: serializer.writer.write_start_element(name) _write_str_as_element("value", "value", that.value, serializer) if that.value_id is not None: _write_reference_as_element( "valueId", "value_id", that.value_id, serializer ) serializer.writer.write_end_element(name) except Exception as exception: _attribute_to_property(exception, prop_name) def _write_value_list_as_element( name: str, prop_name: Optional[str], that: our_types.ValueList, serializer: "_Serializer", ) -> None: """ Write :paramref:`that` enclosed in the :paramref:`name` element. :param name: of the element tag. Expected to contain no XML special characters. :param prop_name: name of the property, as spelled in Python, whose value is written, or ``None`` if the access to the value is recorded by an enclosing writer :param that: instance to be serialized :param serializer: to write to :raise: :py:class:`SerializationException` if the value could not be written """ try: serializer.writer.write_start_element(name) _write_list_of_instances( "valueReferencePairs", "value_reference_pairs", that.value_reference_pairs, serializer, ) serializer.writer.write_end_element(name) except Exception as exception: _attribute_to_property(exception, prop_name) def _write_lang_string_preferred_name_type_iec_61360_as_element( name: str, prop_name: Optional[str], that: our_types.LangStringPreferredNameTypeIEC61360, serializer: "_Serializer", ) -> None: """ Write :paramref:`that` enclosed in the :paramref:`name` element. :param name: of the element tag. Expected to contain no XML special characters. :param prop_name: name of the property, as spelled in Python, whose value is written, or ``None`` if the access to the value is recorded by an enclosing writer :param that: instance to be serialized :param serializer: to write to :raise: :py:class:`SerializationException` if the value could not be written """ try: serializer.writer.write_start_element(name) _write_str_as_element("language", "language", that.language, serializer) _write_str_as_element("text", "text", that.text, serializer) serializer.writer.write_end_element(name) except Exception as exception: _attribute_to_property(exception, prop_name) def _write_lang_string_short_name_type_iec_61360_as_element( name: str, prop_name: Optional[str], that: our_types.LangStringShortNameTypeIEC61360, serializer: "_Serializer", ) -> None: """ Write :paramref:`that` enclosed in the :paramref:`name` element. :param name: of the element tag. Expected to contain no XML special characters. :param prop_name: name of the property, as spelled in Python, whose value is written, or ``None`` if the access to the value is recorded by an enclosing writer :param that: instance to be serialized :param serializer: to write to :raise: :py:class:`SerializationException` if the value could not be written """ try: serializer.writer.write_start_element(name) _write_str_as_element("language", "language", that.language, serializer) _write_str_as_element("text", "text", that.text, serializer) serializer.writer.write_end_element(name) except Exception as exception: _attribute_to_property(exception, prop_name) def _write_lang_string_definition_type_iec_61360_as_element( name: str, prop_name: Optional[str], that: our_types.LangStringDefinitionTypeIEC61360, serializer: "_Serializer", ) -> None: """ Write :paramref:`that` enclosed in the :paramref:`name` element. :param name: of the element tag. Expected to contain no XML special characters. :param prop_name: name of the property, as spelled in Python, whose value is written, or ``None`` if the access to the value is recorded by an enclosing writer :param that: instance to be serialized :param serializer: to write to :raise: :py:class:`SerializationException` if the value could not be written """ try: serializer.writer.write_start_element(name) _write_str_as_element("language", "language", that.language, serializer) _write_str_as_element("text", "text", that.text, serializer) serializer.writer.write_end_element(name) except Exception as exception: _attribute_to_property(exception, prop_name) def _write_lang_string_uom_as_element( name: str, prop_name: Optional[str], that: our_types.LangStringUom, serializer: "_Serializer", ) -> None: """ Write :paramref:`that` enclosed in the :paramref:`name` element. :param name: of the element tag. Expected to contain no XML special characters. :param prop_name: name of the property, as spelled in Python, whose value is written, or ``None`` if the access to the value is recorded by an enclosing writer :param that: instance to be serialized :param serializer: to write to :raise: :py:class:`SerializationException` if the value could not be written """ try: serializer.writer.write_start_element(name) _write_str_as_element("language", "language", that.language, serializer) _write_str_as_element("text", "text", that.text, serializer) serializer.writer.write_end_element(name) except Exception as exception: _attribute_to_property(exception, prop_name) def _write_definition_type_uom_as_element( name: str, prop_name: Optional[str], that: our_types.DefinitionTypeUom, serializer: "_Serializer", ) -> None: """ Write :paramref:`that` enclosed in the :paramref:`name` element. :param name: of the element tag. Expected to contain no XML special characters. :param prop_name: name of the property, as spelled in Python, whose value is written, or ``None`` if the access to the value is recorded by an enclosing writer :param that: instance to be serialized :param serializer: to write to :raise: :py:class:`SerializationException` if the value could not be written """ try: serializer.writer.write_start_element(name) _write_str_as_element("language", "language", that.language, serializer) _write_str_as_element("text", "text", that.text, serializer) serializer.writer.write_end_element(name) except Exception as exception: _attribute_to_property(exception, prop_name) def _write_data_specification_uom_as_element( name: str, prop_name: Optional[str], that: our_types.DataSpecificationUom, serializer: "_Serializer", ) -> None: """ Write :paramref:`that` enclosed in the :paramref:`name` element. :param name: of the element tag. Expected to contain no XML special characters. :param prop_name: name of the property, as spelled in Python, whose value is written, or ``None`` if the access to the value is recorded by an enclosing writer :param that: instance to be serialized :param serializer: to write to :raise: :py:class:`SerializationException` if the value could not be written """ try: serializer.writer.write_start_element(name) _write_list_of_instances( "preferredName", "preferred_name", that.preferred_name, serializer ) _write_str_as_element("symbol", "symbol", that.symbol, serializer) if that.specific_unit_id is not None: _write_str_as_element( "specificUnitId", "specific_unit_id", that.specific_unit_id, serializer ) if that.definition is not None: _write_list_of_instances( "definition", "definition", that.definition, serializer ) if that.preferred_name_quantity is not None: _write_list_of_instances( "preferredNameQuantity", "preferred_name_quantity", that.preferred_name_quantity, serializer, ) if that.quantity_id is not None: _write_str_as_element( "quantityId", "quantity_id", that.quantity_id, serializer ) if that.classification_system is not None: _write_str_as_element( "classificationSystem", "classification_system", that.classification_system, serializer, ) if that.classification_system_version is not None: _write_str_as_element( "classificationSystemVersion", "classification_system_version", that.classification_system_version, serializer, ) serializer.writer.write_end_element(name) except Exception as exception: _attribute_to_property(exception, prop_name) def _write_data_specification_iec_61360_as_element( name: str, prop_name: Optional[str], that: our_types.DataSpecificationIEC61360, serializer: "_Serializer", ) -> None: """ Write :paramref:`that` enclosed in the :paramref:`name` element. :param name: of the element tag. Expected to contain no XML special characters. :param prop_name: name of the property, as spelled in Python, whose value is written, or ``None`` if the access to the value is recorded by an enclosing writer :param that: instance to be serialized :param serializer: to write to :raise: :py:class:`SerializationException` if the value could not be written """ try: serializer.writer.write_start_element(name) _write_list_of_instances( "preferredName", "preferred_name", that.preferred_name, serializer ) if that.short_name is not None: _write_list_of_instances( "shortName", "short_name", that.short_name, serializer ) if that.unit is not None: _write_str_as_element("unit", "unit", that.unit, serializer) if that.unit_id is not None: _write_reference_as_element("unitId", "unit_id", that.unit_id, serializer) if that.source_of_definition is not None: _write_str_as_element( "sourceOfDefinition", "source_of_definition", that.source_of_definition, serializer, ) if that.symbol is not None: _write_str_as_element("symbol", "symbol", that.symbol, serializer) if that.data_type is not None: _write_enum_as_element("dataType", "data_type", that.data_type, serializer) if that.definition is not None: _write_list_of_instances( "definition", "definition", that.definition, serializer ) if that.value_format is not None: _write_str_as_element( "valueFormat", "value_format", that.value_format, serializer ) if that.value_list is not None: _write_value_list_as_element( "valueList", "value_list", that.value_list, serializer ) if that.value is not None: _write_str_as_element("value", "value", that.value, serializer) if that.level_type is not None: _write_level_type_as_element( "levelType", "level_type", that.level_type, serializer ) serializer.writer.write_end_element(name) except Exception as exception: _attribute_to_property(exception, prop_name) def _write_asset_administration_shell_descriptor_as_element( name: str, prop_name: Optional[str], that: our_types.AssetAdministrationShellDescriptor, serializer: "_Serializer", ) -> None: """ Write :paramref:`that` enclosed in the :paramref:`name` element. :param name: of the element tag. Expected to contain no XML special characters. :param prop_name: name of the property, as spelled in Python, whose value is written, or ``None`` if the access to the value is recorded by an enclosing writer :param that: instance to be serialized :param serializer: to write to :raise: :py:class:`SerializationException` if the value could not be written """ try: serializer.writer.write_start_element(name) if that.description is not None: _write_list_of_instances( "description", "description", that.description, serializer ) if that.display_name is not None: _write_list_of_instances( "displayName", "display_name", that.display_name, serializer ) if that.extensions is not None: _write_list_of_instances( "extensions", "extensions", that.extensions, serializer ) _write_str_as_element("id", "id", that.id, serializer) if that.administration is not None: _write_administrative_information_as_element( "administration", "administration", that.administration, serializer ) if that.asset_kind is not None: _write_enum_as_element( "assetKind", "asset_kind", that.asset_kind, serializer ) if that.asset_type is not None: _write_str_as_element( "assetType", "asset_type", that.asset_type, serializer ) if that.endpoints is not None: _write_list_of_instances( "endpoints", "endpoints", that.endpoints, serializer ) if that.global_asset_id is not None: _write_str_as_element( "globalAssetId", "global_asset_id", that.global_asset_id, serializer ) if that.id_short is not None: _write_str_as_element("idShort", "id_short", that.id_short, serializer) if that.specific_asset_ids is not None: _write_list_of_instances( "specificAssetIds", "specific_asset_ids", that.specific_asset_ids, serializer, ) if that.submodel_descriptors is not None: _write_list_of_instances( "submodelDescriptors", "submodel_descriptors", that.submodel_descriptors, serializer, ) serializer.writer.write_end_element(name) except Exception as exception: _attribute_to_property(exception, prop_name) def _write_submodel_descriptor_as_element( name: str, prop_name: Optional[str], that: our_types.SubmodelDescriptor, serializer: "_Serializer", ) -> None: """ Write :paramref:`that` enclosed in the :paramref:`name` element. :param name: of the element tag. Expected to contain no XML special characters. :param prop_name: name of the property, as spelled in Python, whose value is written, or ``None`` if the access to the value is recorded by an enclosing writer :param that: instance to be serialized :param serializer: to write to :raise: :py:class:`SerializationException` if the value could not be written """ try: serializer.writer.write_start_element(name) if that.description is not None: _write_list_of_instances( "description", "description", that.description, serializer ) if that.display_name is not None: _write_list_of_instances( "displayName", "display_name", that.display_name, serializer ) if that.extensions is not None: _write_list_of_instances( "extensions", "extensions", that.extensions, serializer ) _write_list_of_instances("endpoints", "endpoints", that.endpoints, serializer) _write_str_as_element("id", "id", that.id, serializer) if that.administration is not None: _write_administrative_information_as_element( "administration", "administration", that.administration, serializer ) if that.id_short is not None: _write_str_as_element("idShort", "id_short", that.id_short, serializer) if that.semantic_id is not None: _write_reference_as_element( "semanticId", "semantic_id", that.semantic_id, serializer ) if that.supplemental_semantic_ids is not None: _write_list_of_instances( "supplementalSemanticIds", "supplemental_semantic_ids", that.supplemental_semantic_ids, serializer, ) serializer.writer.write_end_element(name) except Exception as exception: _attribute_to_property(exception, prop_name) def _write_endpoint_as_element( name: str, prop_name: Optional[str], that: our_types.Endpoint, serializer: "_Serializer", ) -> None: """ Write :paramref:`that` enclosed in the :paramref:`name` element. :param name: of the element tag. Expected to contain no XML special characters. :param prop_name: name of the property, as spelled in Python, whose value is written, or ``None`` if the access to the value is recorded by an enclosing writer :param that: instance to be serialized :param serializer: to write to :raise: :py:class:`SerializationException` if the value could not be written """ try: serializer.writer.write_start_element(name) _write_protocol_information_as_element( "protocolInformation", "protocol_information", that.protocol_information, serializer, ) _write_str_as_element("interface", "interface", that.interface, serializer) serializer.writer.write_end_element(name) except Exception as exception: _attribute_to_property(exception, prop_name) def _write_protocol_information_as_element( name: str, prop_name: Optional[str], that: our_types.ProtocolInformation, serializer: "_Serializer", ) -> None: """ Write :paramref:`that` enclosed in the :paramref:`name` element. :param name: of the element tag. Expected to contain no XML special characters. :param prop_name: name of the property, as spelled in Python, whose value is written, or ``None`` if the access to the value is recorded by an enclosing writer :param that: instance to be serialized :param serializer: to write to :raise: :py:class:`SerializationException` if the value could not be written """ try: serializer.writer.write_start_element(name) _write_str_as_element("href", "href", that.href, serializer) if that.endpoint_protocol is not None: _write_str_as_element( "endpointProtocol", "endpoint_protocol", that.endpoint_protocol, serializer, ) if that.endpoint_protocol_version is not None: _write_list_of_items( "endpointProtocolVersion", "endpoint_protocol_version", that.endpoint_protocol_version, _write_str_as_element, serializer, ) if that.subprotocol is not None: _write_str_as_element( "subprotocol", "subprotocol", that.subprotocol, serializer ) if that.subprotocol_body is not None: _write_str_as_element( "subprotocolBody", "subprotocol_body", that.subprotocol_body, serializer ) if that.subprotocol_body_encoding is not None: _write_str_as_element( "subprotocolBodyEncoding", "subprotocol_body_encoding", that.subprotocol_body_encoding, serializer, ) if that.security_attributes is not None: _write_list_of_instances( "securityAttributes", "security_attributes", that.security_attributes, serializer, ) serializer.writer.write_end_element(name) except Exception as exception: _attribute_to_property(exception, prop_name) def _write_security_attribute_object_as_element( name: str, prop_name: Optional[str], that: our_types.SecurityAttributeObject, serializer: "_Serializer", ) -> None: """ Write :paramref:`that` enclosed in the :paramref:`name` element. :param name: of the element tag. Expected to contain no XML special characters. :param prop_name: name of the property, as spelled in Python, whose value is written, or ``None`` if the access to the value is recorded by an enclosing writer :param that: instance to be serialized :param serializer: to write to :raise: :py:class:`SerializationException` if the value could not be written """ try: serializer.writer.write_start_element(name) _write_enum_as_element("type", "type", that.type, serializer) _write_str_as_element("key", "key", that.key, serializer) _write_str_as_element("value", "value", that.value, serializer) serializer.writer.write_end_element(name) except Exception as exception: _attribute_to_property(exception, prop_name) def _write_asset_link_as_element( name: str, prop_name: Optional[str], that: our_types.AssetLink, serializer: "_Serializer", ) -> None: """ Write :paramref:`that` enclosed in the :paramref:`name` element. :param name: of the element tag. Expected to contain no XML special characters. :param prop_name: name of the property, as spelled in Python, whose value is written, or ``None`` if the access to the value is recorded by an enclosing writer :param that: instance to be serialized :param serializer: to write to :raise: :py:class:`SerializationException` if the value could not be written """ try: serializer.writer.write_start_element(name) _write_str_as_element("name", "name", that.name, serializer) _write_str_as_element("value", "value", that.value, serializer) serializer.writer.write_end_element(name) except Exception as exception: _attribute_to_property(exception, prop_name) def _write_service_description_as_element( name: str, prop_name: Optional[str], that: our_types.ServiceDescription, serializer: "_Serializer", ) -> None: """ Write :paramref:`that` enclosed in the :paramref:`name` element. :param name: of the element tag. Expected to contain no XML special characters. :param prop_name: name of the property, as spelled in Python, whose value is written, or ``None`` if the access to the value is recorded by an enclosing writer :param that: instance to be serialized :param serializer: to write to :raise: :py:class:`SerializationException` if the value could not be written """ try: serializer.writer.write_start_element(name) _write_list_of_items( "profiles", "profiles", that.profiles, _write_enum_as_element, serializer ) serializer.writer.write_end_element(name) except Exception as exception: _attribute_to_property(exception, prop_name) def _write_asset_administration_shell_recent_change_as_element( name: str, prop_name: Optional[str], that: our_types.AssetAdministrationShellRecentChange, serializer: "_Serializer", ) -> None: """ Write :paramref:`that` enclosed in the :paramref:`name` element. :param name: of the element tag. Expected to contain no XML special characters. :param prop_name: name of the property, as spelled in Python, whose value is written, or ``None`` if the access to the value is recorded by an enclosing writer :param that: instance to be serialized :param serializer: to write to :raise: :py:class:`SerializationException` if the value could not be written """ try: serializer.writer.write_start_element(name) _write_str_as_element("createdAt", "created_at", that.created_at, serializer) _write_str_as_element("updatedAt", "updated_at", that.updated_at, serializer) _write_str_as_element("id", "id", that.id, serializer) if that.global_asset_id is not None: _write_str_as_element( "globalAssetId", "global_asset_id", that.global_asset_id, serializer ) if that.specific_asset_ids is not None: _write_list_of_instances( "specificAssetIds", "specific_asset_ids", that.specific_asset_ids, serializer, ) serializer.writer.write_end_element(name) except Exception as exception: _attribute_to_property(exception, prop_name) def _write_concept_description_recent_change_as_element( name: str, prop_name: Optional[str], that: our_types.ConceptDescriptionRecentChange, serializer: "_Serializer", ) -> None: """ Write :paramref:`that` enclosed in the :paramref:`name` element. :param name: of the element tag. Expected to contain no XML special characters. :param prop_name: name of the property, as spelled in Python, whose value is written, or ``None`` if the access to the value is recorded by an enclosing writer :param that: instance to be serialized :param serializer: to write to :raise: :py:class:`SerializationException` if the value could not be written """ try: serializer.writer.write_start_element(name) _write_str_as_element("createdAt", "created_at", that.created_at, serializer) _write_str_as_element("updatedAt", "updated_at", that.updated_at, serializer) _write_str_as_element("id", "id", that.id, serializer) serializer.writer.write_end_element(name) except Exception as exception: _attribute_to_property(exception, prop_name) def _write_submodel_recent_change_as_element( name: str, prop_name: Optional[str], that: our_types.SubmodelRecentChange, serializer: "_Serializer", ) -> None: """ Write :paramref:`that` enclosed in the :paramref:`name` element. :param name: of the element tag. Expected to contain no XML special characters. :param prop_name: name of the property, as spelled in Python, whose value is written, or ``None`` if the access to the value is recorded by an enclosing writer :param that: instance to be serialized :param serializer: to write to :raise: :py:class:`SerializationException` if the value could not be written """ try: serializer.writer.write_start_element(name) _write_str_as_element("createdAt", "created_at", that.created_at, serializer) _write_str_as_element("updatedAt", "updated_at", that.updated_at, serializer) _write_str_as_element("id", "id", that.id, serializer) if that.semantic_id is not None: _write_reference_as_element( "semanticId", "semantic_id", that.semantic_id, serializer ) if that.supplemental_semantic_ids is not None: _write_list_of_instances( "supplementalSemanticIds", "supplemental_semantic_ids", that.supplemental_semantic_ids, serializer, ) serializer.writer.write_end_element(name) except Exception as exception: _attribute_to_property(exception, prop_name) def _write_result_as_element( name: str, prop_name: Optional[str], that: our_types.Result, serializer: "_Serializer", ) -> None: """ Write :paramref:`that` enclosed in the :paramref:`name` element. All the properties are optional, so the element is collapsed to an empty one if none of them is set. :param name: of the element tag. Expected to contain no XML special characters. :param prop_name: name of the property, as spelled in Python, whose value is written, or ``None`` if the access to the value is recorded by an enclosing writer :param that: instance to be serialized :param serializer: to write to :raise: :py:class:`SerializationException` if the value could not be written """ try: # We optimize for the case where all the optional properties are not set, # so that we can simply output an empty element. if that.messages is None: serializer.writer.write_empty_element(name) return serializer.writer.write_start_element(name) if that.messages is not None: _write_list_of_instances("messages", "messages", that.messages, serializer) serializer.writer.write_end_element(name) except Exception as exception: _attribute_to_property(exception, prop_name) def _write_message_as_element( name: str, prop_name: Optional[str], that: our_types.Message, serializer: "_Serializer", ) -> None: """ Write :paramref:`that` enclosed in the :paramref:`name` element. :param name: of the element tag. Expected to contain no XML special characters. :param prop_name: name of the property, as spelled in Python, whose value is written, or ``None`` if the access to the value is recorded by an enclosing writer :param that: instance to be serialized :param serializer: to write to :raise: :py:class:`SerializationException` if the value could not be written """ try: serializer.writer.write_start_element(name) _write_enum_as_element( "messageType", "message_type", that.message_type, serializer ) _write_str_as_element("text", "text", that.text, serializer) if that.code is not None: _write_str_as_element("code", "code", that.code, serializer) if that.correlation_id is not None: _write_str_as_element( "correlationId", "correlation_id", that.correlation_id, serializer ) if that.timestamp is not None: _write_str_as_element("timestamp", "timestamp", that.timestamp, serializer) serializer.writer.write_end_element(name) except Exception as exception: _attribute_to_property(exception, prop_name) def _write_operation_request_as_element( name: str, prop_name: Optional[str], that: our_types.OperationRequest, serializer: "_Serializer", ) -> None: """ Write :paramref:`that` enclosed in the :paramref:`name` element. All the properties are optional, so the element is collapsed to an empty one if none of them is set. :param name: of the element tag. Expected to contain no XML special characters. :param prop_name: name of the property, as spelled in Python, whose value is written, or ``None`` if the access to the value is recorded by an enclosing writer :param that: instance to be serialized :param serializer: to write to :raise: :py:class:`SerializationException` if the value could not be written """ try: # We optimize for the case where all the optional properties are not set, # so that we can simply output an empty element. if ( that.input_arguments is None and that.inoutput_arguments is None and that.client_timeout_duration is None ): serializer.writer.write_empty_element(name) return serializer.writer.write_start_element(name) if that.input_arguments is not None: _write_list_of_instances( "inputArguments", "input_arguments", that.input_arguments, serializer ) if that.inoutput_arguments is not None: _write_list_of_instances( "inoutputArguments", "inoutput_arguments", that.inoutput_arguments, serializer, ) if that.client_timeout_duration is not None: _write_str_as_element( "clientTimeoutDuration", "client_timeout_duration", that.client_timeout_duration, serializer, ) serializer.writer.write_end_element(name) except Exception as exception: _attribute_to_property(exception, prop_name) def _write_operation_request_async_as_element( name: str, prop_name: Optional[str], that: our_types.OperationRequestAsync, serializer: "_Serializer", ) -> None: """ Write :paramref:`that` enclosed in the :paramref:`name` element. :param name: of the element tag. Expected to contain no XML special characters. :param prop_name: name of the property, as spelled in Python, whose value is written, or ``None`` if the access to the value is recorded by an enclosing writer :param that: instance to be serialized :param serializer: to write to :raise: :py:class:`SerializationException` if the value could not be written """ try: serializer.writer.write_start_element(name) if that.input_arguments is not None: _write_list_of_instances( "inputArguments", "input_arguments", that.input_arguments, serializer ) if that.inoutput_arguments is not None: _write_list_of_instances( "inoutputArguments", "inoutput_arguments", that.inoutput_arguments, serializer, ) _write_str_as_element( "clientTimeoutDuration", "client_timeout_duration", that.client_timeout_duration, serializer, ) serializer.writer.write_end_element(name) except Exception as exception: _attribute_to_property(exception, prop_name) def _write_operation_request_value_only_as_element( name: str, prop_name: Optional[str], that: our_types.OperationRequestValueOnly, serializer: "_Serializer", ) -> None: """ Write :paramref:`that` enclosed in the :paramref:`name` element. All the properties are optional, so the element is collapsed to an empty one if none of them is set. :param name: of the element tag. Expected to contain no XML special characters. :param prop_name: name of the property, as spelled in Python, whose value is written, or ``None`` if the access to the value is recorded by an enclosing writer :param that: instance to be serialized :param serializer: to write to :raise: :py:class:`SerializationException` if the value could not be written """ try: # We optimize for the case where all the optional properties are not set, # so that we can simply output an empty element. if ( that.input_arguments is None and that.inoutput_arguments is None and that.client_timeout_duration is None ): serializer.writer.write_empty_element(name) return serializer.writer.write_start_element(name) if that.input_arguments is not None: _write_json_object_as_element( "inputArguments", "input_arguments", that.input_arguments, serializer ) if that.inoutput_arguments is not None: _write_json_object_as_element( "inoutputArguments", "inoutput_arguments", that.inoutput_arguments, serializer, ) if that.client_timeout_duration is not None: _write_str_as_element( "clientTimeoutDuration", "client_timeout_duration", that.client_timeout_duration, serializer, ) serializer.writer.write_end_element(name) except Exception as exception: _attribute_to_property(exception, prop_name) def _write_operation_request_async_value_only_as_element( name: str, prop_name: Optional[str], that: our_types.OperationRequestAsyncValueOnly, serializer: "_Serializer", ) -> None: """ Write :paramref:`that` enclosed in the :paramref:`name` element. :param name: of the element tag. Expected to contain no XML special characters. :param prop_name: name of the property, as spelled in Python, whose value is written, or ``None`` if the access to the value is recorded by an enclosing writer :param that: instance to be serialized :param serializer: to write to :raise: :py:class:`SerializationException` if the value could not be written """ try: serializer.writer.write_start_element(name) if that.input_arguments is not None: _write_json_object_as_element( "inputArguments", "input_arguments", that.input_arguments, serializer ) if that.inoutput_arguments is not None: _write_json_object_as_element( "inoutputArguments", "inoutput_arguments", that.inoutput_arguments, serializer, ) _write_str_as_element( "clientTimeoutDuration", "client_timeout_duration", that.client_timeout_duration, serializer, ) serializer.writer.write_end_element(name) except Exception as exception: _attribute_to_property(exception, prop_name) def _write_base_operation_result_as_element( name: str, prop_name: Optional[str], that: our_types.BaseOperationResult, serializer: "_Serializer", ) -> None: """ Write :paramref:`that` enclosed in the :paramref:`name` element. :param name: of the element tag. Expected to contain no XML special characters. :param prop_name: name of the property, as spelled in Python, whose value is written, or ``None`` if the access to the value is recorded by an enclosing writer :param that: instance to be serialized :param serializer: to write to :raise: :py:class:`SerializationException` if the value could not be written """ try: serializer.writer.write_start_element(name) _write_enum_as_element( "executionState", "execution_state", that.execution_state, serializer ) if that.messages is not None: _write_list_of_instances("messages", "messages", that.messages, serializer) if that.success is not None: _write_bool_as_element("success", "success", that.success, serializer) serializer.writer.write_end_element(name) except Exception as exception: _attribute_to_property(exception, prop_name) def _write_operation_result_as_element( name: str, prop_name: Optional[str], that: our_types.OperationResult, serializer: "_Serializer", ) -> None: """ Write :paramref:`that` enclosed in the :paramref:`name` element. :param name: of the element tag. Expected to contain no XML special characters. :param prop_name: name of the property, as spelled in Python, whose value is written, or ``None`` if the access to the value is recorded by an enclosing writer :param that: instance to be serialized :param serializer: to write to :raise: :py:class:`SerializationException` if the value could not be written """ try: serializer.writer.write_start_element(name) _write_enum_as_element( "executionState", "execution_state", that.execution_state, serializer ) if that.messages is not None: _write_list_of_instances("messages", "messages", that.messages, serializer) if that.success is not None: _write_bool_as_element("success", "success", that.success, serializer) if that.output_arguments is not None: _write_list_of_instances( "outputArguments", "output_arguments", that.output_arguments, serializer ) if that.inoutput_arguments is not None: _write_list_of_instances( "inoutputArguments", "inoutput_arguments", that.inoutput_arguments, serializer, ) serializer.writer.write_end_element(name) except Exception as exception: _attribute_to_property(exception, prop_name) def _write_operation_result_value_only_as_element( name: str, prop_name: Optional[str], that: our_types.OperationResultValueOnly, serializer: "_Serializer", ) -> None: """ Write :paramref:`that` enclosed in the :paramref:`name` element. :param name: of the element tag. Expected to contain no XML special characters. :param prop_name: name of the property, as spelled in Python, whose value is written, or ``None`` if the access to the value is recorded by an enclosing writer :param that: instance to be serialized :param serializer: to write to :raise: :py:class:`SerializationException` if the value could not be written """ try: serializer.writer.write_start_element(name) _write_enum_as_element( "executionState", "execution_state", that.execution_state, serializer ) if that.messages is not None: _write_list_of_instances("messages", "messages", that.messages, serializer) if that.success is not None: _write_bool_as_element("success", "success", that.success, serializer) if that.output_arguments is not None: _write_json_object_as_element( "outputArguments", "output_arguments", that.output_arguments, serializer ) if that.inoutput_arguments is not None: _write_json_object_as_element( "inoutputArguments", "inoutput_arguments", that.inoutput_arguments, serializer, ) serializer.writer.write_end_element(name) except Exception as exception: _attribute_to_property(exception, prop_name) def _write_operation_handle_as_element( name: str, prop_name: Optional[str], that: our_types.OperationHandle, serializer: "_Serializer", ) -> None: """ Write :paramref:`that` enclosed in the :paramref:`name` element. :param name: of the element tag. Expected to contain no XML special characters. :param prop_name: name of the property, as spelled in Python, whose value is written, or ``None`` if the access to the value is recorded by an enclosing writer :param that: instance to be serialized :param serializer: to write to :raise: :py:class:`SerializationException` if the value could not be written """ try: serializer.writer.write_start_element(name) _write_str_as_element("handleId", "handle_id", that.handle_id, serializer) serializer.writer.write_end_element(name) except Exception as exception: _attribute_to_property(exception, prop_name) def _write_paged_result_as_element( name: str, prop_name: Optional[str], that: our_types.PagedResult, serializer: "_Serializer", ) -> None: """ Write :paramref:`that` enclosed in the :paramref:`name` element. :param name: of the element tag. Expected to contain no XML special characters. :param prop_name: name of the property, as spelled in Python, whose value is written, or ``None`` if the access to the value is recorded by an enclosing writer :param that: instance to be serialized :param serializer: to write to :raise: :py:class:`SerializationException` if the value could not be written """ try: serializer.writer.write_start_element(name) if that.result is not None: _write_list_of_instances("result", "result", that.result, serializer) _write_paging_metadata_as_element( "pagingMetadata", "paging_metadata", that.paging_metadata, serializer ) serializer.writer.write_end_element(name) except Exception as exception: _attribute_to_property(exception, prop_name) def _write_paging_metadata_as_element( name: str, prop_name: Optional[str], that: our_types.PagingMetadata, serializer: "_Serializer", ) -> None: """ Write :paramref:`that` enclosed in the :paramref:`name` element. All the properties are optional, so the element is collapsed to an empty one if none of them is set. :param name: of the element tag. Expected to contain no XML special characters. :param prop_name: name of the property, as spelled in Python, whose value is written, or ``None`` if the access to the value is recorded by an enclosing writer :param that: instance to be serialized :param serializer: to write to :raise: :py:class:`SerializationException` if the value could not be written """ try: # We optimize for the case where all the optional properties are not set, # so that we can simply output an empty element. if that.cursor is None: serializer.writer.write_empty_element(name) return serializer.writer.write_start_element(name) if that.cursor is not None: _write_str_as_element("cursor", "cursor", that.cursor, serializer) serializer.writer.write_end_element(name) except Exception as exception: _attribute_to_property(exception, prop_name) def _write_package_description_as_element( name: str, prop_name: Optional[str], that: our_types.PackageDescription, serializer: "_Serializer", ) -> None: """ Write :paramref:`that` enclosed in the :paramref:`name` element. :param name: of the element tag. Expected to contain no XML special characters. :param prop_name: name of the property, as spelled in Python, whose value is written, or ``None`` if the access to the value is recorded by an enclosing writer :param that: instance to be serialized :param serializer: to write to :raise: :py:class:`SerializationException` if the value could not be written """ try: serializer.writer.write_start_element(name) _write_str_as_element("packageId", "package_id", that.package_id, serializer) if that.aas_ids is not None: _write_list_of_items( "aasIds", "aas_ids", that.aas_ids, _write_str_as_element, serializer ) serializer.writer.write_end_element(name) except Exception as exception: _attribute_to_property(exception, prop_name) def _write_property_metadata_as_element( name: str, prop_name: Optional[str], that: our_types.PropertyMetadata, serializer: "_Serializer", ) -> None: """ Write :paramref:`that` enclosed in the :paramref:`name` element. :param name: of the element tag. Expected to contain no XML special characters. :param prop_name: name of the property, as spelled in Python, whose value is written, or ``None`` if the access to the value is recorded by an enclosing writer :param that: instance to be serialized :param serializer: to write to :raise: :py:class:`SerializationException` if the value could not be written """ try: serializer.writer.write_start_element(name) if that.extensions is not None: _write_list_of_instances( "extensions", "extensions", that.extensions, serializer ) if that.category is not None: _write_str_as_element("category", "category", that.category, serializer) if that.id_short is not None: _write_str_as_element("idShort", "id_short", that.id_short, serializer) if that.display_name is not None: _write_list_of_instances( "displayName", "display_name", that.display_name, serializer ) if that.description is not None: _write_list_of_instances( "description", "description", that.description, serializer ) if that.semantic_id is not None: _write_reference_as_element( "semanticId", "semantic_id", that.semantic_id, serializer ) if that.supplemental_semantic_ids is not None: _write_list_of_instances( "supplementalSemanticIds", "supplemental_semantic_ids", that.supplemental_semantic_ids, serializer, ) if that.qualifiers is not None: _write_list_of_instances( "qualifiers", "qualifiers", that.qualifiers, serializer ) if that.embedded_data_specifications is not None: _write_list_of_instances( "embeddedDataSpecifications", "embedded_data_specifications", that.embedded_data_specifications, serializer, ) _write_enum_as_element("valueType", "value_type", that.value_type, serializer) serializer.writer.write_end_element(name) except Exception as exception: _attribute_to_property(exception, prop_name) def _write_range_metadata_as_element( name: str, prop_name: Optional[str], that: our_types.RangeMetadata, serializer: "_Serializer", ) -> None: """ Write :paramref:`that` enclosed in the :paramref:`name` element. :param name: of the element tag. Expected to contain no XML special characters. :param prop_name: name of the property, as spelled in Python, whose value is written, or ``None`` if the access to the value is recorded by an enclosing writer :param that: instance to be serialized :param serializer: to write to :raise: :py:class:`SerializationException` if the value could not be written """ try: serializer.writer.write_start_element(name) if that.extensions is not None: _write_list_of_instances( "extensions", "extensions", that.extensions, serializer ) if that.category is not None: _write_str_as_element("category", "category", that.category, serializer) if that.id_short is not None: _write_str_as_element("idShort", "id_short", that.id_short, serializer) if that.display_name is not None: _write_list_of_instances( "displayName", "display_name", that.display_name, serializer ) if that.description is not None: _write_list_of_instances( "description", "description", that.description, serializer ) if that.semantic_id is not None: _write_reference_as_element( "semanticId", "semantic_id", that.semantic_id, serializer ) if that.supplemental_semantic_ids is not None: _write_list_of_instances( "supplementalSemanticIds", "supplemental_semantic_ids", that.supplemental_semantic_ids, serializer, ) if that.qualifiers is not None: _write_list_of_instances( "qualifiers", "qualifiers", that.qualifiers, serializer ) if that.embedded_data_specifications is not None: _write_list_of_instances( "embeddedDataSpecifications", "embedded_data_specifications", that.embedded_data_specifications, serializer, ) _write_enum_as_element("valueType", "value_type", that.value_type, serializer) serializer.writer.write_end_element(name) except Exception as exception: _attribute_to_property(exception, prop_name) def _write_blob_metadata_as_element( name: str, prop_name: Optional[str], that: our_types.BlobMetadata, serializer: "_Serializer", ) -> None: """ Write :paramref:`that` enclosed in the :paramref:`name` element. All the properties are optional, so the element is collapsed to an empty one if none of them is set. :param name: of the element tag. Expected to contain no XML special characters. :param prop_name: name of the property, as spelled in Python, whose value is written, or ``None`` if the access to the value is recorded by an enclosing writer :param that: instance to be serialized :param serializer: to write to :raise: :py:class:`SerializationException` if the value could not be written """ try: # We optimize for the case where all the optional properties are not set, # so that we can simply output an empty element. if ( that.extensions is None and that.category is None and that.id_short is None and that.display_name is None and that.description is None and that.semantic_id is None and that.supplemental_semantic_ids is None and that.qualifiers is None and that.embedded_data_specifications is None ): serializer.writer.write_empty_element(name) return serializer.writer.write_start_element(name) if that.extensions is not None: _write_list_of_instances( "extensions", "extensions", that.extensions, serializer ) if that.category is not None: _write_str_as_element("category", "category", that.category, serializer) if that.id_short is not None: _write_str_as_element("idShort", "id_short", that.id_short, serializer) if that.display_name is not None: _write_list_of_instances( "displayName", "display_name", that.display_name, serializer ) if that.description is not None: _write_list_of_instances( "description", "description", that.description, serializer ) if that.semantic_id is not None: _write_reference_as_element( "semanticId", "semantic_id", that.semantic_id, serializer ) if that.supplemental_semantic_ids is not None: _write_list_of_instances( "supplementalSemanticIds", "supplemental_semantic_ids", that.supplemental_semantic_ids, serializer, ) if that.qualifiers is not None: _write_list_of_instances( "qualifiers", "qualifiers", that.qualifiers, serializer ) if that.embedded_data_specifications is not None: _write_list_of_instances( "embeddedDataSpecifications", "embedded_data_specifications", that.embedded_data_specifications, serializer, ) serializer.writer.write_end_element(name) except Exception as exception: _attribute_to_property(exception, prop_name) def _write_file_metadata_as_element( name: str, prop_name: Optional[str], that: our_types.FileMetadata, serializer: "_Serializer", ) -> None: """ Write :paramref:`that` enclosed in the :paramref:`name` element. All the properties are optional, so the element is collapsed to an empty one if none of them is set. :param name: of the element tag. Expected to contain no XML special characters. :param prop_name: name of the property, as spelled in Python, whose value is written, or ``None`` if the access to the value is recorded by an enclosing writer :param that: instance to be serialized :param serializer: to write to :raise: :py:class:`SerializationException` if the value could not be written """ try: # We optimize for the case where all the optional properties are not set, # so that we can simply output an empty element. if ( that.extensions is None and that.category is None and that.id_short is None and that.display_name is None and that.description is None and that.semantic_id is None and that.supplemental_semantic_ids is None and that.qualifiers is None and that.embedded_data_specifications is None ): serializer.writer.write_empty_element(name) return serializer.writer.write_start_element(name) if that.extensions is not None: _write_list_of_instances( "extensions", "extensions", that.extensions, serializer ) if that.category is not None: _write_str_as_element("category", "category", that.category, serializer) if that.id_short is not None: _write_str_as_element("idShort", "id_short", that.id_short, serializer) if that.display_name is not None: _write_list_of_instances( "displayName", "display_name", that.display_name, serializer ) if that.description is not None: _write_list_of_instances( "description", "description", that.description, serializer ) if that.semantic_id is not None: _write_reference_as_element( "semanticId", "semantic_id", that.semantic_id, serializer ) if that.supplemental_semantic_ids is not None: _write_list_of_instances( "supplementalSemanticIds", "supplemental_semantic_ids", that.supplemental_semantic_ids, serializer, ) if that.qualifiers is not None: _write_list_of_instances( "qualifiers", "qualifiers", that.qualifiers, serializer ) if that.embedded_data_specifications is not None: _write_list_of_instances( "embeddedDataSpecifications", "embedded_data_specifications", that.embedded_data_specifications, serializer, ) serializer.writer.write_end_element(name) except Exception as exception: _attribute_to_property(exception, prop_name) def _write_multi_language_property_metadata_as_element( name: str, prop_name: Optional[str], that: our_types.MultiLanguagePropertyMetadata, serializer: "_Serializer", ) -> None: """ Write :paramref:`that` enclosed in the :paramref:`name` element. All the properties are optional, so the element is collapsed to an empty one if none of them is set. :param name: of the element tag. Expected to contain no XML special characters. :param prop_name: name of the property, as spelled in Python, whose value is written, or ``None`` if the access to the value is recorded by an enclosing writer :param that: instance to be serialized :param serializer: to write to :raise: :py:class:`SerializationException` if the value could not be written """ try: # We optimize for the case where all the optional properties are not set, # so that we can simply output an empty element. if ( that.extensions is None and that.category is None and that.id_short is None and that.display_name is None and that.description is None and that.semantic_id is None and that.supplemental_semantic_ids is None and that.qualifiers is None and that.embedded_data_specifications is None ): serializer.writer.write_empty_element(name) return serializer.writer.write_start_element(name) if that.extensions is not None: _write_list_of_instances( "extensions", "extensions", that.extensions, serializer ) if that.category is not None: _write_str_as_element("category", "category", that.category, serializer) if that.id_short is not None: _write_str_as_element("idShort", "id_short", that.id_short, serializer) if that.display_name is not None: _write_list_of_instances( "displayName", "display_name", that.display_name, serializer ) if that.description is not None: _write_list_of_instances( "description", "description", that.description, serializer ) if that.semantic_id is not None: _write_reference_as_element( "semanticId", "semantic_id", that.semantic_id, serializer ) if that.supplemental_semantic_ids is not None: _write_list_of_instances( "supplementalSemanticIds", "supplemental_semantic_ids", that.supplemental_semantic_ids, serializer, ) if that.qualifiers is not None: _write_list_of_instances( "qualifiers", "qualifiers", that.qualifiers, serializer ) if that.embedded_data_specifications is not None: _write_list_of_instances( "embeddedDataSpecifications", "embedded_data_specifications", that.embedded_data_specifications, serializer, ) serializer.writer.write_end_element(name) except Exception as exception: _attribute_to_property(exception, prop_name) def _write_reference_element_metadata_as_element( name: str, prop_name: Optional[str], that: our_types.ReferenceElementMetadata, serializer: "_Serializer", ) -> None: """ Write :paramref:`that` enclosed in the :paramref:`name` element. All the properties are optional, so the element is collapsed to an empty one if none of them is set. :param name: of the element tag. Expected to contain no XML special characters. :param prop_name: name of the property, as spelled in Python, whose value is written, or ``None`` if the access to the value is recorded by an enclosing writer :param that: instance to be serialized :param serializer: to write to :raise: :py:class:`SerializationException` if the value could not be written """ try: # We optimize for the case where all the optional properties are not set, # so that we can simply output an empty element. if ( that.extensions is None and that.category is None and that.id_short is None and that.display_name is None and that.description is None and that.semantic_id is None and that.supplemental_semantic_ids is None and that.qualifiers is None and that.embedded_data_specifications is None ): serializer.writer.write_empty_element(name) return serializer.writer.write_start_element(name) if that.extensions is not None: _write_list_of_instances( "extensions", "extensions", that.extensions, serializer ) if that.category is not None: _write_str_as_element("category", "category", that.category, serializer) if that.id_short is not None: _write_str_as_element("idShort", "id_short", that.id_short, serializer) if that.display_name is not None: _write_list_of_instances( "displayName", "display_name", that.display_name, serializer ) if that.description is not None: _write_list_of_instances( "description", "description", that.description, serializer ) if that.semantic_id is not None: _write_reference_as_element( "semanticId", "semantic_id", that.semantic_id, serializer ) if that.supplemental_semantic_ids is not None: _write_list_of_instances( "supplementalSemanticIds", "supplemental_semantic_ids", that.supplemental_semantic_ids, serializer, ) if that.qualifiers is not None: _write_list_of_instances( "qualifiers", "qualifiers", that.qualifiers, serializer ) if that.embedded_data_specifications is not None: _write_list_of_instances( "embeddedDataSpecifications", "embedded_data_specifications", that.embedded_data_specifications, serializer, ) serializer.writer.write_end_element(name) except Exception as exception: _attribute_to_property(exception, prop_name) def _write_relationship_element_metadata_as_element( name: str, prop_name: Optional[str], that: our_types.RelationshipElementMetadata, serializer: "_Serializer", ) -> None: """ Write :paramref:`that` enclosed in the :paramref:`name` element. All the properties are optional, so the element is collapsed to an empty one if none of them is set. :param name: of the element tag. Expected to contain no XML special characters. :param prop_name: name of the property, as spelled in Python, whose value is written, or ``None`` if the access to the value is recorded by an enclosing writer :param that: instance to be serialized :param serializer: to write to :raise: :py:class:`SerializationException` if the value could not be written """ try: # We optimize for the case where all the optional properties are not set, # so that we can simply output an empty element. if ( that.extensions is None and that.category is None and that.id_short is None and that.display_name is None and that.description is None and that.semantic_id is None and that.supplemental_semantic_ids is None and that.qualifiers is None and that.embedded_data_specifications is None ): serializer.writer.write_empty_element(name) return serializer.writer.write_start_element(name) if that.extensions is not None: _write_list_of_instances( "extensions", "extensions", that.extensions, serializer ) if that.category is not None: _write_str_as_element("category", "category", that.category, serializer) if that.id_short is not None: _write_str_as_element("idShort", "id_short", that.id_short, serializer) if that.display_name is not None: _write_list_of_instances( "displayName", "display_name", that.display_name, serializer ) if that.description is not None: _write_list_of_instances( "description", "description", that.description, serializer ) if that.semantic_id is not None: _write_reference_as_element( "semanticId", "semantic_id", that.semantic_id, serializer ) if that.supplemental_semantic_ids is not None: _write_list_of_instances( "supplementalSemanticIds", "supplemental_semantic_ids", that.supplemental_semantic_ids, serializer, ) if that.qualifiers is not None: _write_list_of_instances( "qualifiers", "qualifiers", that.qualifiers, serializer ) if that.embedded_data_specifications is not None: _write_list_of_instances( "embeddedDataSpecifications", "embedded_data_specifications", that.embedded_data_specifications, serializer, ) serializer.writer.write_end_element(name) except Exception as exception: _attribute_to_property(exception, prop_name) def _write_annotated_relationship_element_metadata_as_element( name: str, prop_name: Optional[str], that: our_types.AnnotatedRelationshipElementMetadata, serializer: "_Serializer", ) -> None: """ Write :paramref:`that` enclosed in the :paramref:`name` element. All the properties are optional, so the element is collapsed to an empty one if none of them is set. :param name: of the element tag. Expected to contain no XML special characters. :param prop_name: name of the property, as spelled in Python, whose value is written, or ``None`` if the access to the value is recorded by an enclosing writer :param that: instance to be serialized :param serializer: to write to :raise: :py:class:`SerializationException` if the value could not be written """ try: # We optimize for the case where all the optional properties are not set, # so that we can simply output an empty element. if ( that.extensions is None and that.category is None and that.id_short is None and that.display_name is None and that.description is None and that.semantic_id is None and that.supplemental_semantic_ids is None and that.qualifiers is None and that.embedded_data_specifications is None ): serializer.writer.write_empty_element(name) return serializer.writer.write_start_element(name) if that.extensions is not None: _write_list_of_instances( "extensions", "extensions", that.extensions, serializer ) if that.category is not None: _write_str_as_element("category", "category", that.category, serializer) if that.id_short is not None: _write_str_as_element("idShort", "id_short", that.id_short, serializer) if that.display_name is not None: _write_list_of_instances( "displayName", "display_name", that.display_name, serializer ) if that.description is not None: _write_list_of_instances( "description", "description", that.description, serializer ) if that.semantic_id is not None: _write_reference_as_element( "semanticId", "semantic_id", that.semantic_id, serializer ) if that.supplemental_semantic_ids is not None: _write_list_of_instances( "supplementalSemanticIds", "supplemental_semantic_ids", that.supplemental_semantic_ids, serializer, ) if that.qualifiers is not None: _write_list_of_instances( "qualifiers", "qualifiers", that.qualifiers, serializer ) if that.embedded_data_specifications is not None: _write_list_of_instances( "embeddedDataSpecifications", "embedded_data_specifications", that.embedded_data_specifications, serializer, ) serializer.writer.write_end_element(name) except Exception as exception: _attribute_to_property(exception, prop_name) def _write_entity_metadata_as_element( name: str, prop_name: Optional[str], that: our_types.EntityMetadata, serializer: "_Serializer", ) -> None: """ Write :paramref:`that` enclosed in the :paramref:`name` element. All the properties are optional, so the element is collapsed to an empty one if none of them is set. :param name: of the element tag. Expected to contain no XML special characters. :param prop_name: name of the property, as spelled in Python, whose value is written, or ``None`` if the access to the value is recorded by an enclosing writer :param that: instance to be serialized :param serializer: to write to :raise: :py:class:`SerializationException` if the value could not be written """ try: # We optimize for the case where all the optional properties are not set, # so that we can simply output an empty element. if ( that.extensions is None and that.category is None and that.id_short is None and that.display_name is None and that.description is None and that.semantic_id is None and that.supplemental_semantic_ids is None and that.qualifiers is None and that.embedded_data_specifications is None ): serializer.writer.write_empty_element(name) return serializer.writer.write_start_element(name) if that.extensions is not None: _write_list_of_instances( "extensions", "extensions", that.extensions, serializer ) if that.category is not None: _write_str_as_element("category", "category", that.category, serializer) if that.id_short is not None: _write_str_as_element("idShort", "id_short", that.id_short, serializer) if that.display_name is not None: _write_list_of_instances( "displayName", "display_name", that.display_name, serializer ) if that.description is not None: _write_list_of_instances( "description", "description", that.description, serializer ) if that.semantic_id is not None: _write_reference_as_element( "semanticId", "semantic_id", that.semantic_id, serializer ) if that.supplemental_semantic_ids is not None: _write_list_of_instances( "supplementalSemanticIds", "supplemental_semantic_ids", that.supplemental_semantic_ids, serializer, ) if that.qualifiers is not None: _write_list_of_instances( "qualifiers", "qualifiers", that.qualifiers, serializer ) if that.embedded_data_specifications is not None: _write_list_of_instances( "embeddedDataSpecifications", "embedded_data_specifications", that.embedded_data_specifications, serializer, ) serializer.writer.write_end_element(name) except Exception as exception: _attribute_to_property(exception, prop_name) def _write_capability_metadata_as_element( name: str, prop_name: Optional[str], that: our_types.CapabilityMetadata, serializer: "_Serializer", ) -> None: """ Write :paramref:`that` enclosed in the :paramref:`name` element. All the properties are optional, so the element is collapsed to an empty one if none of them is set. :param name: of the element tag. Expected to contain no XML special characters. :param prop_name: name of the property, as spelled in Python, whose value is written, or ``None`` if the access to the value is recorded by an enclosing writer :param that: instance to be serialized :param serializer: to write to :raise: :py:class:`SerializationException` if the value could not be written """ try: # We optimize for the case where all the optional properties are not set, # so that we can simply output an empty element. if ( that.extensions is None and that.category is None and that.id_short is None and that.display_name is None and that.description is None and that.semantic_id is None and that.supplemental_semantic_ids is None and that.qualifiers is None and that.embedded_data_specifications is None ): serializer.writer.write_empty_element(name) return serializer.writer.write_start_element(name) if that.extensions is not None: _write_list_of_instances( "extensions", "extensions", that.extensions, serializer ) if that.category is not None: _write_str_as_element("category", "category", that.category, serializer) if that.id_short is not None: _write_str_as_element("idShort", "id_short", that.id_short, serializer) if that.display_name is not None: _write_list_of_instances( "displayName", "display_name", that.display_name, serializer ) if that.description is not None: _write_list_of_instances( "description", "description", that.description, serializer ) if that.semantic_id is not None: _write_reference_as_element( "semanticId", "semantic_id", that.semantic_id, serializer ) if that.supplemental_semantic_ids is not None: _write_list_of_instances( "supplementalSemanticIds", "supplemental_semantic_ids", that.supplemental_semantic_ids, serializer, ) if that.qualifiers is not None: _write_list_of_instances( "qualifiers", "qualifiers", that.qualifiers, serializer ) if that.embedded_data_specifications is not None: _write_list_of_instances( "embeddedDataSpecifications", "embedded_data_specifications", that.embedded_data_specifications, serializer, ) serializer.writer.write_end_element(name) except Exception as exception: _attribute_to_property(exception, prop_name) def _write_operation_metadata_as_element( name: str, prop_name: Optional[str], that: our_types.OperationMetadata, serializer: "_Serializer", ) -> None: """ Write :paramref:`that` enclosed in the :paramref:`name` element. All the properties are optional, so the element is collapsed to an empty one if none of them is set. :param name: of the element tag. Expected to contain no XML special characters. :param prop_name: name of the property, as spelled in Python, whose value is written, or ``None`` if the access to the value is recorded by an enclosing writer :param that: instance to be serialized :param serializer: to write to :raise: :py:class:`SerializationException` if the value could not be written """ try: # We optimize for the case where all the optional properties are not set, # so that we can simply output an empty element. if ( that.extensions is None and that.category is None and that.id_short is None and that.display_name is None and that.description is None and that.semantic_id is None and that.supplemental_semantic_ids is None and that.qualifiers is None and that.embedded_data_specifications is None ): serializer.writer.write_empty_element(name) return serializer.writer.write_start_element(name) if that.extensions is not None: _write_list_of_instances( "extensions", "extensions", that.extensions, serializer ) if that.category is not None: _write_str_as_element("category", "category", that.category, serializer) if that.id_short is not None: _write_str_as_element("idShort", "id_short", that.id_short, serializer) if that.display_name is not None: _write_list_of_instances( "displayName", "display_name", that.display_name, serializer ) if that.description is not None: _write_list_of_instances( "description", "description", that.description, serializer ) if that.semantic_id is not None: _write_reference_as_element( "semanticId", "semantic_id", that.semantic_id, serializer ) if that.supplemental_semantic_ids is not None: _write_list_of_instances( "supplementalSemanticIds", "supplemental_semantic_ids", that.supplemental_semantic_ids, serializer, ) if that.qualifiers is not None: _write_list_of_instances( "qualifiers", "qualifiers", that.qualifiers, serializer ) if that.embedded_data_specifications is not None: _write_list_of_instances( "embeddedDataSpecifications", "embedded_data_specifications", that.embedded_data_specifications, serializer, ) serializer.writer.write_end_element(name) except Exception as exception: _attribute_to_property(exception, prop_name) def _write_submodel_element_collection_metadata_as_element( name: str, prop_name: Optional[str], that: our_types.SubmodelElementCollectionMetadata, serializer: "_Serializer", ) -> None: """ Write :paramref:`that` enclosed in the :paramref:`name` element. All the properties are optional, so the element is collapsed to an empty one if none of them is set. :param name: of the element tag. Expected to contain no XML special characters. :param prop_name: name of the property, as spelled in Python, whose value is written, or ``None`` if the access to the value is recorded by an enclosing writer :param that: instance to be serialized :param serializer: to write to :raise: :py:class:`SerializationException` if the value could not be written """ try: # We optimize for the case where all the optional properties are not set, # so that we can simply output an empty element. if ( that.extensions is None and that.category is None and that.id_short is None and that.display_name is None and that.description is None and that.semantic_id is None and that.supplemental_semantic_ids is None and that.qualifiers is None and that.embedded_data_specifications is None ): serializer.writer.write_empty_element(name) return serializer.writer.write_start_element(name) if that.extensions is not None: _write_list_of_instances( "extensions", "extensions", that.extensions, serializer ) if that.category is not None: _write_str_as_element("category", "category", that.category, serializer) if that.id_short is not None: _write_str_as_element("idShort", "id_short", that.id_short, serializer) if that.display_name is not None: _write_list_of_instances( "displayName", "display_name", that.display_name, serializer ) if that.description is not None: _write_list_of_instances( "description", "description", that.description, serializer ) if that.semantic_id is not None: _write_reference_as_element( "semanticId", "semantic_id", that.semantic_id, serializer ) if that.supplemental_semantic_ids is not None: _write_list_of_instances( "supplementalSemanticIds", "supplemental_semantic_ids", that.supplemental_semantic_ids, serializer, ) if that.qualifiers is not None: _write_list_of_instances( "qualifiers", "qualifiers", that.qualifiers, serializer ) if that.embedded_data_specifications is not None: _write_list_of_instances( "embeddedDataSpecifications", "embedded_data_specifications", that.embedded_data_specifications, serializer, ) serializer.writer.write_end_element(name) except Exception as exception: _attribute_to_property(exception, prop_name) def _write_basic_event_element_metadata_as_element( name: str, prop_name: Optional[str], that: our_types.BasicEventElementMetadata, serializer: "_Serializer", ) -> None: """ Write :paramref:`that` enclosed in the :paramref:`name` element. :param name: of the element tag. Expected to contain no XML special characters. :param prop_name: name of the property, as spelled in Python, whose value is written, or ``None`` if the access to the value is recorded by an enclosing writer :param that: instance to be serialized :param serializer: to write to :raise: :py:class:`SerializationException` if the value could not be written """ try: serializer.writer.write_start_element(name) if that.extensions is not None: _write_list_of_instances( "extensions", "extensions", that.extensions, serializer ) if that.category is not None: _write_str_as_element("category", "category", that.category, serializer) if that.id_short is not None: _write_str_as_element("idShort", "id_short", that.id_short, serializer) if that.display_name is not None: _write_list_of_instances( "displayName", "display_name", that.display_name, serializer ) if that.description is not None: _write_list_of_instances( "description", "description", that.description, serializer ) if that.semantic_id is not None: _write_reference_as_element( "semanticId", "semantic_id", that.semantic_id, serializer ) if that.supplemental_semantic_ids is not None: _write_list_of_instances( "supplementalSemanticIds", "supplemental_semantic_ids", that.supplemental_semantic_ids, serializer, ) if that.qualifiers is not None: _write_list_of_instances( "qualifiers", "qualifiers", that.qualifiers, serializer ) if that.embedded_data_specifications is not None: _write_list_of_instances( "embeddedDataSpecifications", "embedded_data_specifications", that.embedded_data_specifications, serializer, ) _write_enum_as_element("direction", "direction", that.direction, serializer) _write_enum_as_element("state", "state", that.state, serializer) if that.message_topic is not None: _write_str_as_element( "messageTopic", "message_topic", that.message_topic, serializer ) if that.message_broker is not None: _write_reference_as_element( "messageBroker", "message_broker", that.message_broker, serializer ) if that.last_update is not None: _write_str_as_element( "lastUpdate", "last_update", that.last_update, serializer ) if that.min_interval is not None: _write_str_as_element( "minInterval", "min_interval", that.min_interval, serializer ) if that.max_interval is not None: _write_str_as_element( "maxInterval", "max_interval", that.max_interval, serializer ) serializer.writer.write_end_element(name) except Exception as exception: _attribute_to_property(exception, prop_name) def _write_submodel_element_list_metadata_as_element( name: str, prop_name: Optional[str], that: our_types.SubmodelElementListMetadata, serializer: "_Serializer", ) -> None: """ Write :paramref:`that` enclosed in the :paramref:`name` element. :param name: of the element tag. Expected to contain no XML special characters. :param prop_name: name of the property, as spelled in Python, whose value is written, or ``None`` if the access to the value is recorded by an enclosing writer :param that: instance to be serialized :param serializer: to write to :raise: :py:class:`SerializationException` if the value could not be written """ try: serializer.writer.write_start_element(name) if that.extensions is not None: _write_list_of_instances( "extensions", "extensions", that.extensions, serializer ) if that.category is not None: _write_str_as_element("category", "category", that.category, serializer) if that.id_short is not None: _write_str_as_element("idShort", "id_short", that.id_short, serializer) if that.display_name is not None: _write_list_of_instances( "displayName", "display_name", that.display_name, serializer ) if that.description is not None: _write_list_of_instances( "description", "description", that.description, serializer ) if that.semantic_id is not None: _write_reference_as_element( "semanticId", "semantic_id", that.semantic_id, serializer ) if that.supplemental_semantic_ids is not None: _write_list_of_instances( "supplementalSemanticIds", "supplemental_semantic_ids", that.supplemental_semantic_ids, serializer, ) if that.qualifiers is not None: _write_list_of_instances( "qualifiers", "qualifiers", that.qualifiers, serializer ) if that.embedded_data_specifications is not None: _write_list_of_instances( "embeddedDataSpecifications", "embedded_data_specifications", that.embedded_data_specifications, serializer, ) if that.order_relevant is not None: _write_bool_as_element( "orderRelevant", "order_relevant", that.order_relevant, serializer ) if that.semantic_id_list_element is not None: _write_reference_as_element( "semanticIdListElement", "semantic_id_list_element", that.semantic_id_list_element, serializer, ) _write_enum_as_element( "typeValueListElement", "type_value_list_element", that.type_value_list_element, serializer, ) if that.value_type_list_element is not None: _write_enum_as_element( "valueTypeListElement", "value_type_list_element", that.value_type_list_element, serializer, ) serializer.writer.write_end_element(name) except Exception as exception: _attribute_to_property(exception, prop_name) def _write_submodel_metadata_as_element( name: str, prop_name: Optional[str], that: our_types.SubmodelMetadata, serializer: "_Serializer", ) -> None: """ Write :paramref:`that` enclosed in the :paramref:`name` element. :param name: of the element tag. Expected to contain no XML special characters. :param prop_name: name of the property, as spelled in Python, whose value is written, or ``None`` if the access to the value is recorded by an enclosing writer :param that: instance to be serialized :param serializer: to write to :raise: :py:class:`SerializationException` if the value could not be written """ try: serializer.writer.write_start_element(name) if that.extensions is not None: _write_list_of_instances( "extensions", "extensions", that.extensions, serializer ) if that.category is not None: _write_str_as_element("category", "category", that.category, serializer) if that.id_short is not None: _write_str_as_element("idShort", "id_short", that.id_short, serializer) if that.display_name is not None: _write_list_of_instances( "displayName", "display_name", that.display_name, serializer ) if that.description is not None: _write_list_of_instances( "description", "description", that.description, serializer ) if that.administration is not None: _write_administrative_information_as_element( "administration", "administration", that.administration, serializer ) _write_str_as_element("id", "id", that.id, serializer) if that.kind is not None: _write_enum_as_element("kind", "kind", that.kind, serializer) if that.semantic_id is not None: _write_reference_as_element( "semanticId", "semantic_id", that.semantic_id, serializer ) if that.supplemental_semantic_ids is not None: _write_list_of_instances( "supplementalSemanticIds", "supplemental_semantic_ids", that.supplemental_semantic_ids, serializer, ) if that.qualifiers is not None: _write_list_of_instances( "qualifiers", "qualifiers", that.qualifiers, serializer ) if that.embedded_data_specifications is not None: _write_list_of_instances( "embeddedDataSpecifications", "embedded_data_specifications", that.embedded_data_specifications, serializer, ) serializer.writer.write_end_element(name) except Exception as exception: _attribute_to_property(exception, prop_name) def _write_asset_administration_shell_metadata_as_element( name: str, prop_name: Optional[str], that: our_types.AssetAdministrationShellMetadata, serializer: "_Serializer", ) -> None: """ Write :paramref:`that` enclosed in the :paramref:`name` element. :param name: of the element tag. Expected to contain no XML special characters. :param prop_name: name of the property, as spelled in Python, whose value is written, or ``None`` if the access to the value is recorded by an enclosing writer :param that: instance to be serialized :param serializer: to write to :raise: :py:class:`SerializationException` if the value could not be written """ try: serializer.writer.write_start_element(name) if that.extensions is not None: _write_list_of_instances( "extensions", "extensions", that.extensions, serializer ) if that.category is not None: _write_str_as_element("category", "category", that.category, serializer) if that.id_short is not None: _write_str_as_element("idShort", "id_short", that.id_short, serializer) if that.display_name is not None: _write_list_of_instances( "displayName", "display_name", that.display_name, serializer ) if that.description is not None: _write_list_of_instances( "description", "description", that.description, serializer ) if that.administration is not None: _write_administrative_information_as_element( "administration", "administration", that.administration, serializer ) _write_str_as_element("id", "id", that.id, serializer) if that.embedded_data_specifications is not None: _write_list_of_instances( "embeddedDataSpecifications", "embedded_data_specifications", that.embedded_data_specifications, serializer, ) if that.derived_from is not None: _write_reference_as_element( "derivedFrom", "derived_from", that.derived_from, serializer ) serializer.writer.write_end_element(name) except Exception as exception: _attribute_to_property(exception, prop_name) def _write_reference_element_value_as_element( name: str, prop_name: Optional[str], that: our_types.ReferenceElementValue, serializer: "_Serializer", ) -> None: """ Write :paramref:`that` enclosed in the :paramref:`name` element. :param name: of the element tag. Expected to contain no XML special characters. :param prop_name: name of the property, as spelled in Python, whose value is written, or ``None`` if the access to the value is recorded by an enclosing writer :param that: instance to be serialized :param serializer: to write to :raise: :py:class:`SerializationException` if the value could not be written """ try: serializer.writer.write_start_element(name) _write_enum_as_element("type", "type", that.type, serializer) _write_list_of_instances("keys", "keys", that.keys, serializer) if that.referred_semantic_id is not None: _write_reference_as_element( "referredSemanticId", "referred_semantic_id", that.referred_semantic_id, serializer, ) serializer.writer.write_end_element(name) except Exception as exception: _attribute_to_property(exception, prop_name) def _write_blob_value_as_element( name: str, prop_name: Optional[str], that: our_types.BlobValue, serializer: "_Serializer", ) -> None: """ Write :paramref:`that` enclosed in the :paramref:`name` element. All the properties are optional, so the element is collapsed to an empty one if none of them is set. :param name: of the element tag. Expected to contain no XML special characters. :param prop_name: name of the property, as spelled in Python, whose value is written, or ``None`` if the access to the value is recorded by an enclosing writer :param that: instance to be serialized :param serializer: to write to :raise: :py:class:`SerializationException` if the value could not be written """ try: # We optimize for the case where all the optional properties are not set, # so that we can simply output an empty element. if that.content_type is None and that.value is None: serializer.writer.write_empty_element(name) return serializer.writer.write_start_element(name) if that.content_type is not None: _write_str_as_element( "contentType", "content_type", that.content_type, serializer ) if that.value is not None: _write_bytes_as_element("value", "value", that.value, serializer) serializer.writer.write_end_element(name) except Exception as exception: _attribute_to_property(exception, prop_name) def _write_file_value_as_element( name: str, prop_name: Optional[str], that: our_types.FileValue, serializer: "_Serializer", ) -> None: """ Write :paramref:`that` enclosed in the :paramref:`name` element. All the properties are optional, so the element is collapsed to an empty one if none of them is set. :param name: of the element tag. Expected to contain no XML special characters. :param prop_name: name of the property, as spelled in Python, whose value is written, or ``None`` if the access to the value is recorded by an enclosing writer :param that: instance to be serialized :param serializer: to write to :raise: :py:class:`SerializationException` if the value could not be written """ try: # We optimize for the case where all the optional properties are not set, # so that we can simply output an empty element. if that.content_type is None and that.value is None: serializer.writer.write_empty_element(name) return serializer.writer.write_start_element(name) if that.content_type is not None: _write_str_as_element( "contentType", "content_type", that.content_type, serializer ) if that.value is not None: _write_str_as_element("value", "value", that.value, serializer) serializer.writer.write_end_element(name) except Exception as exception: _attribute_to_property(exception, prop_name) def _write_range_value_as_element( name: str, prop_name: Optional[str], that: our_types.RangeValue, serializer: "_Serializer", ) -> None: """ Write :paramref:`that` enclosed in the :paramref:`name` element. :param name: of the element tag. Expected to contain no XML special characters. :param prop_name: name of the property, as spelled in Python, whose value is written, or ``None`` if the access to the value is recorded by an enclosing writer :param that: instance to be serialized :param serializer: to write to :raise: :py:class:`SerializationException` if the value could not be written """ try: serializer.writer.write_start_element(name) _write_float_as_element("min", "min", that.min, serializer) _write_float_as_element("max", "max", that.max, serializer) serializer.writer.write_end_element(name) except Exception as exception: _attribute_to_property(exception, prop_name) def _write_relationship_element_value_as_element( name: str, prop_name: Optional[str], that: our_types.RelationshipElementValue, serializer: "_Serializer", ) -> None: """ Write :paramref:`that` enclosed in the :paramref:`name` element. All the properties are optional, so the element is collapsed to an empty one if none of them is set. :param name: of the element tag. Expected to contain no XML special characters. :param prop_name: name of the property, as spelled in Python, whose value is written, or ``None`` if the access to the value is recorded by an enclosing writer :param that: instance to be serialized :param serializer: to write to :raise: :py:class:`SerializationException` if the value could not be written """ try: # We optimize for the case where all the optional properties are not set, # so that we can simply output an empty element. if that.first is None and that.second is None: serializer.writer.write_empty_element(name) return serializer.writer.write_start_element(name) if that.first is not None: _write_reference_as_element("first", "first", that.first, serializer) if that.second is not None: _write_reference_as_element("second", "second", that.second, serializer) serializer.writer.write_end_element(name) except Exception as exception: _attribute_to_property(exception, prop_name) def _write_basic_event_element_value_as_element( name: str, prop_name: Optional[str], that: our_types.BasicEventElementValue, serializer: "_Serializer", ) -> None: """ Write :paramref:`that` enclosed in the :paramref:`name` element. :param name: of the element tag. Expected to contain no XML special characters. :param prop_name: name of the property, as spelled in Python, whose value is written, or ``None`` if the access to the value is recorded by an enclosing writer :param that: instance to be serialized :param serializer: to write to :raise: :py:class:`SerializationException` if the value could not be written """ try: serializer.writer.write_start_element(name) _write_reference_as_element("observed", "observed", that.observed, serializer) serializer.writer.write_end_element(name) except Exception as exception: _attribute_to_property(exception, prop_name) def _write_annotated_relationship_element_value_as_element( name: str, prop_name: Optional[str], that: our_types.AnnotatedRelationshipElementValue, serializer: "_Serializer", ) -> None: """ Write :paramref:`that` enclosed in the :paramref:`name` element. All the properties are optional, so the element is collapsed to an empty one if none of them is set. :param name: of the element tag. Expected to contain no XML special characters. :param prop_name: name of the property, as spelled in Python, whose value is written, or ``None`` if the access to the value is recorded by an enclosing writer :param that: instance to be serialized :param serializer: to write to :raise: :py:class:`SerializationException` if the value could not be written """ try: # We optimize for the case where all the optional properties are not set, # so that we can simply output an empty element. if that.first is None and that.second is None and that.annotations is None: serializer.writer.write_empty_element(name) return serializer.writer.write_start_element(name) if that.first is not None: _write_reference_as_element("first", "first", that.first, serializer) if that.second is not None: _write_reference_as_element("second", "second", that.second, serializer) if that.annotations is not None: _write_json_object_as_element( "annotations", "annotations", that.annotations, serializer ) serializer.writer.write_end_element(name) except Exception as exception: _attribute_to_property(exception, prop_name) def _write_entity_value_as_element( name: str, prop_name: Optional[str], that: our_types.EntityValue, serializer: "_Serializer", ) -> None: """ Write :paramref:`that` enclosed in the :paramref:`name` element. All the properties are optional, so the element is collapsed to an empty one if none of them is set. :param name: of the element tag. Expected to contain no XML special characters. :param prop_name: name of the property, as spelled in Python, whose value is written, or ``None`` if the access to the value is recorded by an enclosing writer :param that: instance to be serialized :param serializer: to write to :raise: :py:class:`SerializationException` if the value could not be written """ try: # We optimize for the case where all the optional properties are not set, # so that we can simply output an empty element. if ( that.entity_type is None and that.global_asset_id is None and that.specific_asset_ids is None and that.statements is None ): serializer.writer.write_empty_element(name) return serializer.writer.write_start_element(name) if that.entity_type is not None: _write_enum_as_element( "entityType", "entity_type", that.entity_type, serializer ) if that.global_asset_id is not None: _write_str_as_element( "globalAssetId", "global_asset_id", that.global_asset_id, serializer ) if that.specific_asset_ids is not None: _write_list_of_items( "specificAssetIds", "specific_asset_ids", that.specific_asset_ids, _write_json_object_as_element, serializer, ) if that.statements is not None: _write_json_object_as_element( "statements", "statements", that.statements, serializer ) serializer.writer.write_end_element(name) except Exception as exception: _attribute_to_property(exception, prop_name) def _write_get_asset_administration_shells_result_as_element( name: str, prop_name: Optional[str], that: our_types.GetAssetAdministrationShellsResult, serializer: "_Serializer", ) -> None: """ Write :paramref:`that` enclosed in the :paramref:`name` element. :param name: of the element tag. Expected to contain no XML special characters. :param prop_name: name of the property, as spelled in Python, whose value is written, or ``None`` if the access to the value is recorded by an enclosing writer :param that: instance to be serialized :param serializer: to write to :raise: :py:class:`SerializationException` if the value could not be written """ try: serializer.writer.write_start_element(name) _write_paging_metadata_as_element( "pagingMetadata", "paging_metadata", that.paging_metadata, serializer ) if that.result is not None: _write_list_of_instances("result", "result", that.result, serializer) serializer.writer.write_end_element(name) except Exception as exception: _attribute_to_property(exception, prop_name) def _write_get_asset_administration_shells_metadata_result_as_element( name: str, prop_name: Optional[str], that: our_types.GetAssetAdministrationShellsMetadataResult, serializer: "_Serializer", ) -> None: """ Write :paramref:`that` enclosed in the :paramref:`name` element. :param name: of the element tag. Expected to contain no XML special characters. :param prop_name: name of the property, as spelled in Python, whose value is written, or ``None`` if the access to the value is recorded by an enclosing writer :param that: instance to be serialized :param serializer: to write to :raise: :py:class:`SerializationException` if the value could not be written """ try: serializer.writer.write_start_element(name) _write_paging_metadata_as_element( "pagingMetadata", "paging_metadata", that.paging_metadata, serializer ) if that.result is not None: _write_list_of_instances("result", "result", that.result, serializer) serializer.writer.write_end_element(name) except Exception as exception: _attribute_to_property(exception, prop_name) def _write_get_all_asset_administration_shells_recent_changes_result_as_element( name: str, prop_name: Optional[str], that: our_types.GetAllAssetAdministrationShellsRecentChangesResult, serializer: "_Serializer", ) -> None: """ Write :paramref:`that` enclosed in the :paramref:`name` element. :param name: of the element tag. Expected to contain no XML special characters. :param prop_name: name of the property, as spelled in Python, whose value is written, or ``None`` if the access to the value is recorded by an enclosing writer :param that: instance to be serialized :param serializer: to write to :raise: :py:class:`SerializationException` if the value could not be written """ try: serializer.writer.write_start_element(name) _write_paging_metadata_as_element( "pagingMetadata", "paging_metadata", that.paging_metadata, serializer ) if that.result is not None: _write_list_of_instances("result", "result", that.result, serializer) serializer.writer.write_end_element(name) except Exception as exception: _attribute_to_property(exception, prop_name) def _write_get_asset_administration_shell_descriptors_result_as_element( name: str, prop_name: Optional[str], that: our_types.GetAssetAdministrationShellDescriptorsResult, serializer: "_Serializer", ) -> None: """ Write :paramref:`that` enclosed in the :paramref:`name` element. :param name: of the element tag. Expected to contain no XML special characters. :param prop_name: name of the property, as spelled in Python, whose value is written, or ``None`` if the access to the value is recorded by an enclosing writer :param that: instance to be serialized :param serializer: to write to :raise: :py:class:`SerializationException` if the value could not be written """ try: serializer.writer.write_start_element(name) _write_paging_metadata_as_element( "pagingMetadata", "paging_metadata", that.paging_metadata, serializer ) if that.result is not None: _write_list_of_instances("result", "result", that.result, serializer) serializer.writer.write_end_element(name) except Exception as exception: _attribute_to_property(exception, prop_name) def _write_get_concept_descriptions_result_as_element( name: str, prop_name: Optional[str], that: our_types.GetConceptDescriptionsResult, serializer: "_Serializer", ) -> None: """ Write :paramref:`that` enclosed in the :paramref:`name` element. :param name: of the element tag. Expected to contain no XML special characters. :param prop_name: name of the property, as spelled in Python, whose value is written, or ``None`` if the access to the value is recorded by an enclosing writer :param that: instance to be serialized :param serializer: to write to :raise: :py:class:`SerializationException` if the value could not be written """ try: serializer.writer.write_start_element(name) _write_paging_metadata_as_element( "pagingMetadata", "paging_metadata", that.paging_metadata, serializer ) if that.result is not None: _write_list_of_instances("result", "result", that.result, serializer) serializer.writer.write_end_element(name) except Exception as exception: _attribute_to_property(exception, prop_name) def _write_get_all_concept_descriptions_recent_changes_result_as_element( name: str, prop_name: Optional[str], that: our_types.GetAllConceptDescriptionsRecentChangesResult, serializer: "_Serializer", ) -> None: """ Write :paramref:`that` enclosed in the :paramref:`name` element. :param name: of the element tag. Expected to contain no XML special characters. :param prop_name: name of the property, as spelled in Python, whose value is written, or ``None`` if the access to the value is recorded by an enclosing writer :param that: instance to be serialized :param serializer: to write to :raise: :py:class:`SerializationException` if the value could not be written """ try: serializer.writer.write_start_element(name) _write_paging_metadata_as_element( "pagingMetadata", "paging_metadata", that.paging_metadata, serializer ) if that.result is not None: _write_list_of_instances("result", "result", that.result, serializer) serializer.writer.write_end_element(name) except Exception as exception: _attribute_to_property(exception, prop_name) def _write_get_package_descriptions_result_as_element( name: str, prop_name: Optional[str], that: our_types.GetPackageDescriptionsResult, serializer: "_Serializer", ) -> None: """ Write :paramref:`that` enclosed in the :paramref:`name` element. :param name: of the element tag. Expected to contain no XML special characters. :param prop_name: name of the property, as spelled in Python, whose value is written, or ``None`` if the access to the value is recorded by an enclosing writer :param that: instance to be serialized :param serializer: to write to :raise: :py:class:`SerializationException` if the value could not be written """ try: serializer.writer.write_start_element(name) _write_paging_metadata_as_element( "pagingMetadata", "paging_metadata", that.paging_metadata, serializer ) if that.result is not None: _write_list_of_instances("result", "result", that.result, serializer) serializer.writer.write_end_element(name) except Exception as exception: _attribute_to_property(exception, prop_name) def _write_get_path_items_result_as_element( name: str, prop_name: Optional[str], that: our_types.GetPathItemsResult, serializer: "_Serializer", ) -> None: """ Write :paramref:`that` enclosed in the :paramref:`name` element. :param name: of the element tag. Expected to contain no XML special characters. :param prop_name: name of the property, as spelled in Python, whose value is written, or ``None`` if the access to the value is recorded by an enclosing writer :param that: instance to be serialized :param serializer: to write to :raise: :py:class:`SerializationException` if the value could not be written """ try: serializer.writer.write_start_element(name) _write_paging_metadata_as_element( "pagingMetadata", "paging_metadata", that.paging_metadata, serializer ) if that.result is not None: _write_list_of_items( "result", "result", that.result, _write_str_as_element, serializer ) serializer.writer.write_end_element(name) except Exception as exception: _attribute_to_property(exception, prop_name) def _write_get_references_result_as_element( name: str, prop_name: Optional[str], that: our_types.GetReferencesResult, serializer: "_Serializer", ) -> None: """ Write :paramref:`that` enclosed in the :paramref:`name` element. :param name: of the element tag. Expected to contain no XML special characters. :param prop_name: name of the property, as spelled in Python, whose value is written, or ``None`` if the access to the value is recorded by an enclosing writer :param that: instance to be serialized :param serializer: to write to :raise: :py:class:`SerializationException` if the value could not be written """ try: serializer.writer.write_start_element(name) _write_paging_metadata_as_element( "pagingMetadata", "paging_metadata", that.paging_metadata, serializer ) if that.result is not None: _write_list_of_instances("result", "result", that.result, serializer) serializer.writer.write_end_element(name) except Exception as exception: _attribute_to_property(exception, prop_name) def _write_get_submodel_descriptors_result_as_element( name: str, prop_name: Optional[str], that: our_types.GetSubmodelDescriptorsResult, serializer: "_Serializer", ) -> None: """ Write :paramref:`that` enclosed in the :paramref:`name` element. :param name: of the element tag. Expected to contain no XML special characters. :param prop_name: name of the property, as spelled in Python, whose value is written, or ``None`` if the access to the value is recorded by an enclosing writer :param that: instance to be serialized :param serializer: to write to :raise: :py:class:`SerializationException` if the value could not be written """ try: serializer.writer.write_start_element(name) _write_paging_metadata_as_element( "pagingMetadata", "paging_metadata", that.paging_metadata, serializer ) if that.result is not None: _write_list_of_instances("result", "result", that.result, serializer) serializer.writer.write_end_element(name) except Exception as exception: _attribute_to_property(exception, prop_name) def _write_get_submodel_elements_metadata_result_as_element( name: str, prop_name: Optional[str], that: our_types.GetSubmodelElementsMetadataResult, serializer: "_Serializer", ) -> None: """ Write :paramref:`that` enclosed in the :paramref:`name` element. :param name: of the element tag. Expected to contain no XML special characters. :param prop_name: name of the property, as spelled in Python, whose value is written, or ``None`` if the access to the value is recorded by an enclosing writer :param that: instance to be serialized :param serializer: to write to :raise: :py:class:`SerializationException` if the value could not be written """ try: serializer.writer.write_start_element(name) _write_paging_metadata_as_element( "pagingMetadata", "paging_metadata", that.paging_metadata, serializer ) if that.result is not None: _write_list_of_instances("result", "result", that.result, serializer) serializer.writer.write_end_element(name) except Exception as exception: _attribute_to_property(exception, prop_name) def _write_get_submodel_elements_result_as_element( name: str, prop_name: Optional[str], that: our_types.GetSubmodelElementsResult, serializer: "_Serializer", ) -> None: """ Write :paramref:`that` enclosed in the :paramref:`name` element. :param name: of the element tag. Expected to contain no XML special characters. :param prop_name: name of the property, as spelled in Python, whose value is written, or ``None`` if the access to the value is recorded by an enclosing writer :param that: instance to be serialized :param serializer: to write to :raise: :py:class:`SerializationException` if the value could not be written """ try: serializer.writer.write_start_element(name) _write_paging_metadata_as_element( "pagingMetadata", "paging_metadata", that.paging_metadata, serializer ) if that.result is not None: _write_list_of_instances("result", "result", that.result, serializer) serializer.writer.write_end_element(name) except Exception as exception: _attribute_to_property(exception, prop_name) def _write_get_submodel_elements_value_result_as_element( name: str, prop_name: Optional[str], that: our_types.GetSubmodelElementsValueResult, serializer: "_Serializer", ) -> None: """ Write :paramref:`that` enclosed in the :paramref:`name` element. :param name: of the element tag. Expected to contain no XML special characters. :param prop_name: name of the property, as spelled in Python, whose value is written, or ``None`` if the access to the value is recorded by an enclosing writer :param that: instance to be serialized :param serializer: to write to :raise: :py:class:`SerializationException` if the value could not be written """ try: serializer.writer.write_start_element(name) _write_paging_metadata_as_element( "pagingMetadata", "paging_metadata", that.paging_metadata, serializer ) if that.result is not None: _write_list_of_items( "result", "result", that.result, _write_json_object_as_element, serializer, ) serializer.writer.write_end_element(name) except Exception as exception: _attribute_to_property(exception, prop_name) def _write_get_all_submodels_recent_changes_result_as_element( name: str, prop_name: Optional[str], that: our_types.GetAllSubmodelsRecentChangesResult, serializer: "_Serializer", ) -> None: """ Write :paramref:`that` enclosed in the :paramref:`name` element. :param name: of the element tag. Expected to contain no XML special characters. :param prop_name: name of the property, as spelled in Python, whose value is written, or ``None`` if the access to the value is recorded by an enclosing writer :param that: instance to be serialized :param serializer: to write to :raise: :py:class:`SerializationException` if the value could not be written """ try: serializer.writer.write_start_element(name) _write_paging_metadata_as_element( "pagingMetadata", "paging_metadata", that.paging_metadata, serializer ) if that.result is not None: _write_list_of_instances("result", "result", that.result, serializer) serializer.writer.write_end_element(name) except Exception as exception: _attribute_to_property(exception, prop_name) def _write_get_submodels_metadata_result_as_element( name: str, prop_name: Optional[str], that: our_types.GetSubmodelsMetadataResult, serializer: "_Serializer", ) -> None: """ Write :paramref:`that` enclosed in the :paramref:`name` element. :param name: of the element tag. Expected to contain no XML special characters. :param prop_name: name of the property, as spelled in Python, whose value is written, or ``None`` if the access to the value is recorded by an enclosing writer :param that: instance to be serialized :param serializer: to write to :raise: :py:class:`SerializationException` if the value could not be written """ try: serializer.writer.write_start_element(name) _write_paging_metadata_as_element( "pagingMetadata", "paging_metadata", that.paging_metadata, serializer ) if that.result is not None: _write_list_of_instances("result", "result", that.result, serializer) serializer.writer.write_end_element(name) except Exception as exception: _attribute_to_property(exception, prop_name) def _write_get_submodels_result_as_element( name: str, prop_name: Optional[str], that: our_types.GetSubmodelsResult, serializer: "_Serializer", ) -> None: """ Write :paramref:`that` enclosed in the :paramref:`name` element. :param name: of the element tag. Expected to contain no XML special characters. :param prop_name: name of the property, as spelled in Python, whose value is written, or ``None`` if the access to the value is recorded by an enclosing writer :param that: instance to be serialized :param serializer: to write to :raise: :py:class:`SerializationException` if the value could not be written """ try: serializer.writer.write_start_element(name) _write_paging_metadata_as_element( "pagingMetadata", "paging_metadata", that.paging_metadata, serializer ) if that.result is not None: _write_list_of_instances("result", "result", that.result, serializer) serializer.writer.write_end_element(name) except Exception as exception: _attribute_to_property(exception, prop_name) def _write_get_submodels_value_result_as_element( name: str, prop_name: Optional[str], that: our_types.GetSubmodelsValueResult, serializer: "_Serializer", ) -> None: """ Write :paramref:`that` enclosed in the :paramref:`name` element. :param name: of the element tag. Expected to contain no XML special characters. :param prop_name: name of the property, as spelled in Python, whose value is written, or ``None`` if the access to the value is recorded by an enclosing writer :param that: instance to be serialized :param serializer: to write to :raise: :py:class:`SerializationException` if the value could not be written """ try: serializer.writer.write_start_element(name) _write_paging_metadata_as_element( "pagingMetadata", "paging_metadata", that.paging_metadata, serializer ) if that.result is not None: _write_list_of_items( "result", "result", that.result, _write_json_object_as_element, serializer, ) serializer.writer.write_end_element(name) except Exception as exception: _attribute_to_property(exception, prop_name) def _write_claim_attribute_as_element( name: str, prop_name: Optional[str], that: our_types.ClaimAttribute, serializer: "_Serializer", ) -> None: """ Write :paramref:`that` enclosed in the :paramref:`name` element. :param name: of the element tag. Expected to contain no XML special characters. :param prop_name: name of the property, as spelled in Python, whose value is written, or ``None`` if the access to the value is recorded by an enclosing writer :param that: instance to be serialized :param serializer: to write to :raise: :py:class:`SerializationException` if the value could not be written """ try: serializer.writer.write_start_element(name) _write_str_as_element("claim", "claim", that.claim, serializer) serializer.writer.write_end_element(name) except Exception as exception: _attribute_to_property(exception, prop_name) def _write_global_attribute_as_element( name: str, prop_name: Optional[str], that: our_types.GlobalAttribute, serializer: "_Serializer", ) -> None: """ Write :paramref:`that` enclosed in the :paramref:`name` element. :param name: of the element tag. Expected to contain no XML special characters. :param prop_name: name of the property, as spelled in Python, whose value is written, or ``None`` if the access to the value is recorded by an enclosing writer :param that: instance to be serialized :param serializer: to write to :raise: :py:class:`SerializationException` if the value could not be written """ try: serializer.writer.write_start_element(name) _write_enum_as_element("kind", "kind", that.kind, serializer) serializer.writer.write_end_element(name) except Exception as exception: _attribute_to_property(exception, prop_name) def _write_reference_attribute_as_element( name: str, prop_name: Optional[str], that: our_types.ReferenceAttribute, serializer: "_Serializer", ) -> None: """ Write :paramref:`that` enclosed in the :paramref:`name` element. :param name: of the element tag. Expected to contain no XML special characters. :param prop_name: name of the property, as spelled in Python, whose value is written, or ``None`` if the access to the value is recorded by an enclosing writer :param that: instance to be serialized :param serializer: to write to :raise: :py:class:`SerializationException` if the value could not be written """ try: serializer.writer.write_start_element(name) _write_str_as_element("reference", "reference", that.reference, serializer) serializer.writer.write_end_element(name) except Exception as exception: _attribute_to_property(exception, prop_name) def _write_date_time_attribute_item_as_element( name: str, prop_name: Optional[str], that: our_types.DateTimeAttributeItem, serializer: "_Serializer", ) -> None: """ Write :paramref:`that` enclosed in the :paramref:`name` element. :param name: of the element tag. Expected to contain no XML special characters. :param prop_name: name of the property, as spelled in Python, whose value is written, or ``None`` if the access to the value is recorded by an enclosing writer :param that: instance to be serialized :param serializer: to write to :raise: :py:class:`SerializationException` if the value could not be written """ try: serializer.writer.write_start_element(name) _write_enum_as_element("kind", "kind", that.kind, serializer) serializer.writer.write_end_element(name) except Exception as exception: _attribute_to_property(exception, prop_name) def _write_field_operand_as_element( name: str, prop_name: Optional[str], that: our_types.FieldOperand, serializer: "_Serializer", ) -> None: """ Write :paramref:`that` enclosed in the :paramref:`name` element. :param name: of the element tag. Expected to contain no XML special characters. :param prop_name: name of the property, as spelled in Python, whose value is written, or ``None`` if the access to the value is recorded by an enclosing writer :param that: instance to be serialized :param serializer: to write to :raise: :py:class:`SerializationException` if the value could not be written """ try: serializer.writer.write_start_element(name) _write_str_as_element("field", "field", that.field, serializer) serializer.writer.write_end_element(name) except Exception as exception: _attribute_to_property(exception, prop_name) def _write_string_literal_as_element( name: str, prop_name: Optional[str], that: our_types.StringLiteral, serializer: "_Serializer", ) -> None: """ Write :paramref:`that` enclosed in the :paramref:`name` element. :param name: of the element tag. Expected to contain no XML special characters. :param prop_name: name of the property, as spelled in Python, whose value is written, or ``None`` if the access to the value is recorded by an enclosing writer :param that: instance to be serialized :param serializer: to write to :raise: :py:class:`SerializationException` if the value could not be written """ try: serializer.writer.write_start_element(name) _write_str_as_element("strVal", "str_val", that.str_val, serializer) serializer.writer.write_end_element(name) except Exception as exception: _attribute_to_property(exception, prop_name) def _write_attribute_operand_as_element( name: str, prop_name: Optional[str], that: our_types.AttributeOperand, serializer: "_Serializer", ) -> None: """ Write :paramref:`that` enclosed in the :paramref:`name` element. :param name: of the element tag. Expected to contain no XML special characters. :param prop_name: name of the property, as spelled in Python, whose value is written, or ``None`` if the access to the value is recorded by an enclosing writer :param that: instance to be serialized :param serializer: to write to :raise: :py:class:`SerializationException` if the value could not be written """ try: serializer.writer.write_start_element(name) _write_nested_element("attribute", "attribute", that.attribute, serializer) serializer.writer.write_end_element(name) except Exception as exception: _attribute_to_property(exception, prop_name) def _write_number_literal_as_element( name: str, prop_name: Optional[str], that: our_types.NumberLiteral, serializer: "_Serializer", ) -> None: """ Write :paramref:`that` enclosed in the :paramref:`name` element. :param name: of the element tag. Expected to contain no XML special characters. :param prop_name: name of the property, as spelled in Python, whose value is written, or ``None`` if the access to the value is recorded by an enclosing writer :param that: instance to be serialized :param serializer: to write to :raise: :py:class:`SerializationException` if the value could not be written """ try: serializer.writer.write_start_element(name) _write_float_as_element("numVal", "num_val", that.num_val, serializer) serializer.writer.write_end_element(name) except Exception as exception: _attribute_to_property(exception, prop_name) def _write_hex_literal_as_element( name: str, prop_name: Optional[str], that: our_types.HexLiteral, serializer: "_Serializer", ) -> None: """ Write :paramref:`that` enclosed in the :paramref:`name` element. :param name: of the element tag. Expected to contain no XML special characters. :param prop_name: name of the property, as spelled in Python, whose value is written, or ``None`` if the access to the value is recorded by an enclosing writer :param that: instance to be serialized :param serializer: to write to :raise: :py:class:`SerializationException` if the value could not be written """ try: serializer.writer.write_start_element(name) _write_str_as_element("hexVal", "hex_val", that.hex_val, serializer) serializer.writer.write_end_element(name) except Exception as exception: _attribute_to_property(exception, prop_name) def _write_date_time_literal_as_element( name: str, prop_name: Optional[str], that: our_types.DateTimeLiteral, serializer: "_Serializer", ) -> None: """ Write :paramref:`that` enclosed in the :paramref:`name` element. :param name: of the element tag. Expected to contain no XML special characters. :param prop_name: name of the property, as spelled in Python, whose value is written, or ``None`` if the access to the value is recorded by an enclosing writer :param that: instance to be serialized :param serializer: to write to :raise: :py:class:`SerializationException` if the value could not be written """ try: serializer.writer.write_start_element(name) _write_str_as_element( "dateTimeVal", "date_time_val", that.date_time_val, serializer ) serializer.writer.write_end_element(name) except Exception as exception: _attribute_to_property(exception, prop_name) def _write_time_literal_as_element( name: str, prop_name: Optional[str], that: our_types.TimeLiteral, serializer: "_Serializer", ) -> None: """ Write :paramref:`that` enclosed in the :paramref:`name` element. :param name: of the element tag. Expected to contain no XML special characters. :param prop_name: name of the property, as spelled in Python, whose value is written, or ``None`` if the access to the value is recorded by an enclosing writer :param that: instance to be serialized :param serializer: to write to :raise: :py:class:`SerializationException` if the value could not be written """ try: serializer.writer.write_start_element(name) _write_str_as_element("timeVal", "time_val", that.time_val, serializer) serializer.writer.write_end_element(name) except Exception as exception: _attribute_to_property(exception, prop_name) def _write_boolean_literal_as_element( name: str, prop_name: Optional[str], that: our_types.BooleanLiteral, serializer: "_Serializer", ) -> None: """ Write :paramref:`that` enclosed in the :paramref:`name` element. :param name: of the element tag. Expected to contain no XML special characters. :param prop_name: name of the property, as spelled in Python, whose value is written, or ``None`` if the access to the value is recorded by an enclosing writer :param that: instance to be serialized :param serializer: to write to :raise: :py:class:`SerializationException` if the value could not be written """ try: serializer.writer.write_start_element(name) _write_bool_as_element("boolean", "boolean", that.boolean, serializer) serializer.writer.write_end_element(name) except Exception as exception: _attribute_to_property(exception, prop_name) def _write_string_cast_as_element( name: str, prop_name: Optional[str], that: our_types.StringCast, serializer: "_Serializer", ) -> None: """ Write :paramref:`that` enclosed in the :paramref:`name` element. :param name: of the element tag. Expected to contain no XML special characters. :param prop_name: name of the property, as spelled in Python, whose value is written, or ``None`` if the access to the value is recorded by an enclosing writer :param that: instance to be serialized :param serializer: to write to :raise: :py:class:`SerializationException` if the value could not be written """ try: serializer.writer.write_start_element(name) _write_nested_element("strCast", "str_cast", that.str_cast, serializer) serializer.writer.write_end_element(name) except Exception as exception: _attribute_to_property(exception, prop_name) def _write_number_cast_as_element( name: str, prop_name: Optional[str], that: our_types.NumberCast, serializer: "_Serializer", ) -> None: """ Write :paramref:`that` enclosed in the :paramref:`name` element. :param name: of the element tag. Expected to contain no XML special characters. :param prop_name: name of the property, as spelled in Python, whose value is written, or ``None`` if the access to the value is recorded by an enclosing writer :param that: instance to be serialized :param serializer: to write to :raise: :py:class:`SerializationException` if the value could not be written """ try: serializer.writer.write_start_element(name) _write_nested_element("numCast", "num_cast", that.num_cast, serializer) serializer.writer.write_end_element(name) except Exception as exception: _attribute_to_property(exception, prop_name) def _write_hex_cast_as_element( name: str, prop_name: Optional[str], that: our_types.HexCast, serializer: "_Serializer", ) -> None: """ Write :paramref:`that` enclosed in the :paramref:`name` element. :param name: of the element tag. Expected to contain no XML special characters. :param prop_name: name of the property, as spelled in Python, whose value is written, or ``None`` if the access to the value is recorded by an enclosing writer :param that: instance to be serialized :param serializer: to write to :raise: :py:class:`SerializationException` if the value could not be written """ try: serializer.writer.write_start_element(name) _write_nested_element("hexCast", "hex_cast", that.hex_cast, serializer) serializer.writer.write_end_element(name) except Exception as exception: _attribute_to_property(exception, prop_name) def _write_boolean_cast_as_element( name: str, prop_name: Optional[str], that: our_types.BooleanCast, serializer: "_Serializer", ) -> None: """ Write :paramref:`that` enclosed in the :paramref:`name` element. :param name: of the element tag. Expected to contain no XML special characters. :param prop_name: name of the property, as spelled in Python, whose value is written, or ``None`` if the access to the value is recorded by an enclosing writer :param that: instance to be serialized :param serializer: to write to :raise: :py:class:`SerializationException` if the value could not be written """ try: serializer.writer.write_start_element(name) _write_nested_element("boolCast", "bool_cast", that.bool_cast, serializer) serializer.writer.write_end_element(name) except Exception as exception: _attribute_to_property(exception, prop_name) def _write_date_time_cast_as_element( name: str, prop_name: Optional[str], that: our_types.DateTimeCast, serializer: "_Serializer", ) -> None: """ Write :paramref:`that` enclosed in the :paramref:`name` element. :param name: of the element tag. Expected to contain no XML special characters. :param prop_name: name of the property, as spelled in Python, whose value is written, or ``None`` if the access to the value is recorded by an enclosing writer :param that: instance to be serialized :param serializer: to write to :raise: :py:class:`SerializationException` if the value could not be written """ try: serializer.writer.write_start_element(name) _write_nested_element( "dateTimeCast", "date_time_cast", that.date_time_cast, serializer ) serializer.writer.write_end_element(name) except Exception as exception: _attribute_to_property(exception, prop_name) def _write_time_cast_as_element( name: str, prop_name: Optional[str], that: our_types.TimeCast, serializer: "_Serializer", ) -> None: """ Write :paramref:`that` enclosed in the :paramref:`name` element. :param name: of the element tag. Expected to contain no XML special characters. :param prop_name: name of the property, as spelled in Python, whose value is written, or ``None`` if the access to the value is recorded by an enclosing writer :param that: instance to be serialized :param serializer: to write to :raise: :py:class:`SerializationException` if the value could not be written """ try: serializer.writer.write_start_element(name) _write_nested_element("timeCast", "time_cast", that.time_cast, serializer) serializer.writer.write_end_element(name) except Exception as exception: _attribute_to_property(exception, prop_name) def _write_day_of_week_as_element( name: str, prop_name: Optional[str], that: our_types.DayOfWeek, serializer: "_Serializer", ) -> None: """ Write :paramref:`that` enclosed in the :paramref:`name` element. :param name: of the element tag. Expected to contain no XML special characters. :param prop_name: name of the property, as spelled in Python, whose value is written, or ``None`` if the access to the value is recorded by an enclosing writer :param that: instance to be serialized :param serializer: to write to :raise: :py:class:`SerializationException` if the value could not be written """ try: serializer.writer.write_start_element(name) _write_nested_element("dayOfWeek", "day_of_week", that.day_of_week, serializer) serializer.writer.write_end_element(name) except Exception as exception: _attribute_to_property(exception, prop_name) def _write_day_of_month_as_element( name: str, prop_name: Optional[str], that: our_types.DayOfMonth, serializer: "_Serializer", ) -> None: """ Write :paramref:`that` enclosed in the :paramref:`name` element. :param name: of the element tag. Expected to contain no XML special characters. :param prop_name: name of the property, as spelled in Python, whose value is written, or ``None`` if the access to the value is recorded by an enclosing writer :param that: instance to be serialized :param serializer: to write to :raise: :py:class:`SerializationException` if the value could not be written """ try: serializer.writer.write_start_element(name) _write_nested_element( "dayOfMonth", "day_of_month", that.day_of_month, serializer ) serializer.writer.write_end_element(name) except Exception as exception: _attribute_to_property(exception, prop_name) def _write_month_as_element( name: str, prop_name: Optional[str], that: our_types.Month, serializer: "_Serializer", ) -> None: """ Write :paramref:`that` enclosed in the :paramref:`name` element. :param name: of the element tag. Expected to contain no XML special characters. :param prop_name: name of the property, as spelled in Python, whose value is written, or ``None`` if the access to the value is recorded by an enclosing writer :param that: instance to be serialized :param serializer: to write to :raise: :py:class:`SerializationException` if the value could not be written """ try: serializer.writer.write_start_element(name) _write_nested_element("month", "month", that.month, serializer) serializer.writer.write_end_element(name) except Exception as exception: _attribute_to_property(exception, prop_name) def _write_year_as_element( name: str, prop_name: Optional[str], that: our_types.Year, serializer: "_Serializer" ) -> None: """ Write :paramref:`that` enclosed in the :paramref:`name` element. :param name: of the element tag. Expected to contain no XML special characters. :param prop_name: name of the property, as spelled in Python, whose value is written, or ``None`` if the access to the value is recorded by an enclosing writer :param that: instance to be serialized :param serializer: to write to :raise: :py:class:`SerializationException` if the value could not be written """ try: serializer.writer.write_start_element(name) _write_nested_element("year", "year", that.year, serializer) serializer.writer.write_end_element(name) except Exception as exception: _attribute_to_property(exception, prop_name) def _write_date_time_attribute_operand_as_element( name: str, prop_name: Optional[str], that: our_types.DateTimeAttributeOperand, serializer: "_Serializer", ) -> None: """ Write :paramref:`that` enclosed in the :paramref:`name` element. :param name: of the element tag. Expected to contain no XML special characters. :param prop_name: name of the property, as spelled in Python, whose value is written, or ``None`` if the access to the value is recorded by an enclosing writer :param that: instance to be serialized :param serializer: to write to :raise: :py:class:`SerializationException` if the value could not be written """ try: serializer.writer.write_start_element(name) _write_date_time_attribute_item_as_element( "attribute", "attribute", that.attribute, serializer ) serializer.writer.write_end_element(name) except Exception as exception: _attribute_to_property(exception, prop_name) def _write_equal_comparison_as_element( name: str, prop_name: Optional[str], that: our_types.EqualComparison, serializer: "_Serializer", ) -> None: """ Write :paramref:`that` enclosed in the :paramref:`name` element. :param name: of the element tag. Expected to contain no XML special characters. :param prop_name: name of the property, as spelled in Python, whose value is written, or ``None`` if the access to the value is recorded by an enclosing writer :param that: instance to be serialized :param serializer: to write to :raise: :py:class:`SerializationException` if the value could not be written """ try: serializer.writer.write_start_element(name) _write_tuple2_of__value__value("eq", "eq", that.eq, serializer) serializer.writer.write_end_element(name) except Exception as exception: _attribute_to_property(exception, prop_name) def _write_not_equal_comparison_as_element( name: str, prop_name: Optional[str], that: our_types.NotEqualComparison, serializer: "_Serializer", ) -> None: """ Write :paramref:`that` enclosed in the :paramref:`name` element. :param name: of the element tag. Expected to contain no XML special characters. :param prop_name: name of the property, as spelled in Python, whose value is written, or ``None`` if the access to the value is recorded by an enclosing writer :param that: instance to be serialized :param serializer: to write to :raise: :py:class:`SerializationException` if the value could not be written """ try: serializer.writer.write_start_element(name) _write_tuple2_of__value__value("ne", "ne", that.ne, serializer) serializer.writer.write_end_element(name) except Exception as exception: _attribute_to_property(exception, prop_name) def _write_greater_than_comparison_as_element( name: str, prop_name: Optional[str], that: our_types.GreaterThanComparison, serializer: "_Serializer", ) -> None: """ Write :paramref:`that` enclosed in the :paramref:`name` element. :param name: of the element tag. Expected to contain no XML special characters. :param prop_name: name of the property, as spelled in Python, whose value is written, or ``None`` if the access to the value is recorded by an enclosing writer :param that: instance to be serialized :param serializer: to write to :raise: :py:class:`SerializationException` if the value could not be written """ try: serializer.writer.write_start_element(name) _write_tuple2_of__value__value("gt", "gt", that.gt, serializer) serializer.writer.write_end_element(name) except Exception as exception: _attribute_to_property(exception, prop_name) def _write_greater_than_or_equal_comparison_as_element( name: str, prop_name: Optional[str], that: our_types.GreaterThanOrEqualComparison, serializer: "_Serializer", ) -> None: """ Write :paramref:`that` enclosed in the :paramref:`name` element. :param name: of the element tag. Expected to contain no XML special characters. :param prop_name: name of the property, as spelled in Python, whose value is written, or ``None`` if the access to the value is recorded by an enclosing writer :param that: instance to be serialized :param serializer: to write to :raise: :py:class:`SerializationException` if the value could not be written """ try: serializer.writer.write_start_element(name) _write_tuple2_of__value__value("ge", "ge", that.ge, serializer) serializer.writer.write_end_element(name) except Exception as exception: _attribute_to_property(exception, prop_name) def _write_less_than_comparison_as_element( name: str, prop_name: Optional[str], that: our_types.LessThanComparison, serializer: "_Serializer", ) -> None: """ Write :paramref:`that` enclosed in the :paramref:`name` element. :param name: of the element tag. Expected to contain no XML special characters. :param prop_name: name of the property, as spelled in Python, whose value is written, or ``None`` if the access to the value is recorded by an enclosing writer :param that: instance to be serialized :param serializer: to write to :raise: :py:class:`SerializationException` if the value could not be written """ try: serializer.writer.write_start_element(name) _write_tuple2_of__value__value("lt", "lt", that.lt, serializer) serializer.writer.write_end_element(name) except Exception as exception: _attribute_to_property(exception, prop_name) def _write_less_than_or_equal_comparison_as_element( name: str, prop_name: Optional[str], that: our_types.LessThanOrEqualComparison, serializer: "_Serializer", ) -> None: """ Write :paramref:`that` enclosed in the :paramref:`name` element. :param name: of the element tag. Expected to contain no XML special characters. :param prop_name: name of the property, as spelled in Python, whose value is written, or ``None`` if the access to the value is recorded by an enclosing writer :param that: instance to be serialized :param serializer: to write to :raise: :py:class:`SerializationException` if the value could not be written """ try: serializer.writer.write_start_element(name) _write_tuple2_of__value__value("le", "le", that.le, serializer) serializer.writer.write_end_element(name) except Exception as exception: _attribute_to_property(exception, prop_name) def _write_contains_comparison_as_element( name: str, prop_name: Optional[str], that: our_types.ContainsComparison, serializer: "_Serializer", ) -> None: """ Write :paramref:`that` enclosed in the :paramref:`name` element. :param name: of the element tag. Expected to contain no XML special characters. :param prop_name: name of the property, as spelled in Python, whose value is written, or ``None`` if the access to the value is recorded by an enclosing writer :param that: instance to be serialized :param serializer: to write to :raise: :py:class:`SerializationException` if the value could not be written """ try: serializer.writer.write_start_element(name) _write_tuple2_of__string_value__string_value( "contains", "contains", that.contains, serializer ) serializer.writer.write_end_element(name) except Exception as exception: _attribute_to_property(exception, prop_name) def _write_starts_with_comparison_as_element( name: str, prop_name: Optional[str], that: our_types.StartsWithComparison, serializer: "_Serializer", ) -> None: """ Write :paramref:`that` enclosed in the :paramref:`name` element. :param name: of the element tag. Expected to contain no XML special characters. :param prop_name: name of the property, as spelled in Python, whose value is written, or ``None`` if the access to the value is recorded by an enclosing writer :param that: instance to be serialized :param serializer: to write to :raise: :py:class:`SerializationException` if the value could not be written """ try: serializer.writer.write_start_element(name) _write_tuple2_of__string_value__string_value( "startsWith", "starts_with", that.starts_with, serializer ) serializer.writer.write_end_element(name) except Exception as exception: _attribute_to_property(exception, prop_name) def _write_ends_with_comparison_as_element( name: str, prop_name: Optional[str], that: our_types.EndsWithComparison, serializer: "_Serializer", ) -> None: """ Write :paramref:`that` enclosed in the :paramref:`name` element. :param name: of the element tag. Expected to contain no XML special characters. :param prop_name: name of the property, as spelled in Python, whose value is written, or ``None`` if the access to the value is recorded by an enclosing writer :param that: instance to be serialized :param serializer: to write to :raise: :py:class:`SerializationException` if the value could not be written """ try: serializer.writer.write_start_element(name) _write_tuple2_of__string_value__string_value( "endsWith", "ends_with", that.ends_with, serializer ) serializer.writer.write_end_element(name) except Exception as exception: _attribute_to_property(exception, prop_name) def _write_regex_comparison_as_element( name: str, prop_name: Optional[str], that: our_types.RegexComparison, serializer: "_Serializer", ) -> None: """ Write :paramref:`that` enclosed in the :paramref:`name` element. :param name: of the element tag. Expected to contain no XML special characters. :param prop_name: name of the property, as spelled in Python, whose value is written, or ``None`` if the access to the value is recorded by an enclosing writer :param that: instance to be serialized :param serializer: to write to :raise: :py:class:`SerializationException` if the value could not be written """ try: serializer.writer.write_start_element(name) _write_tuple2_of__string_value__string_value( "regex", "regex", that.regex, serializer ) serializer.writer.write_end_element(name) except Exception as exception: _attribute_to_property(exception, prop_name) def _write_match_clause_as_element( name: str, prop_name: Optional[str], that: our_types.MatchClause, serializer: "_Serializer", ) -> None: """ Write :paramref:`that` enclosed in the :paramref:`name` element. :param name: of the element tag. Expected to contain no XML special characters. :param prop_name: name of the property, as spelled in Python, whose value is written, or ``None`` if the access to the value is recorded by an enclosing writer :param that: instance to be serialized :param serializer: to write to :raise: :py:class:`SerializationException` if the value could not be written """ try: serializer.writer.write_start_element(name) _write_list_of_instances( "matchOperands", "match_operands", that.match_operands, serializer ) serializer.writer.write_end_element(name) except Exception as exception: _attribute_to_property(exception, prop_name) def _write_and_expression_as_element( name: str, prop_name: Optional[str], that: our_types.AndExpression, serializer: "_Serializer", ) -> None: """ Write :paramref:`that` enclosed in the :paramref:`name` element. :param name: of the element tag. Expected to contain no XML special characters. :param prop_name: name of the property, as spelled in Python, whose value is written, or ``None`` if the access to the value is recorded by an enclosing writer :param that: instance to be serialized :param serializer: to write to :raise: :py:class:`SerializationException` if the value could not be written """ try: serializer.writer.write_start_element(name) _write_list_of_instances( "andOperands", "and_operands", that.and_operands, serializer ) serializer.writer.write_end_element(name) except Exception as exception: _attribute_to_property(exception, prop_name) def _write_or_expression_as_element( name: str, prop_name: Optional[str], that: our_types.OrExpression, serializer: "_Serializer", ) -> None: """ Write :paramref:`that` enclosed in the :paramref:`name` element. :param name: of the element tag. Expected to contain no XML special characters. :param prop_name: name of the property, as spelled in Python, whose value is written, or ``None`` if the access to the value is recorded by an enclosing writer :param that: instance to be serialized :param serializer: to write to :raise: :py:class:`SerializationException` if the value could not be written """ try: serializer.writer.write_start_element(name) _write_list_of_instances( "orOperands", "or_operands", that.or_operands, serializer ) serializer.writer.write_end_element(name) except Exception as exception: _attribute_to_property(exception, prop_name) def _write_not_expression_as_element( name: str, prop_name: Optional[str], that: our_types.NotExpression, serializer: "_Serializer", ) -> None: """ Write :paramref:`that` enclosed in the :paramref:`name` element. :param name: of the element tag. Expected to contain no XML special characters. :param prop_name: name of the property, as spelled in Python, whose value is written, or ``None`` if the access to the value is recorded by an enclosing writer :param that: instance to be serialized :param serializer: to write to :raise: :py:class:`SerializationException` if the value could not be written """ try: serializer.writer.write_start_element(name) _write_nested_element("notOperand", "not_operand", that.not_operand, serializer) serializer.writer.write_end_element(name) except Exception as exception: _attribute_to_property(exception, prop_name) def _write_query_filter_as_element( name: str, prop_name: Optional[str], that: our_types.QueryFilter, serializer: "_Serializer", ) -> None: """ Write :paramref:`that` enclosed in the :paramref:`name` element. :param name: of the element tag. Expected to contain no XML special characters. :param prop_name: name of the property, as spelled in Python, whose value is written, or ``None`` if the access to the value is recorded by an enclosing writer :param that: instance to be serialized :param serializer: to write to :raise: :py:class:`SerializationException` if the value could not be written """ try: serializer.writer.write_start_element(name) _write_str_as_element("fragment", "fragment", that.fragment, serializer) _write_nested_element("condition", "condition", that.condition, serializer) serializer.writer.write_end_element(name) except Exception as exception: _attribute_to_property(exception, prop_name) def _write_query_as_element( name: str, prop_name: Optional[str], that: our_types.Query, serializer: "_Serializer", ) -> None: """ Write :paramref:`that` enclosed in the :paramref:`name` element. :param name: of the element tag. Expected to contain no XML special characters. :param prop_name: name of the property, as spelled in Python, whose value is written, or ``None`` if the access to the value is recorded by an enclosing writer :param that: instance to be serialized :param serializer: to write to :raise: :py:class:`SerializationException` if the value could not be written """ try: serializer.writer.write_start_element(name) if that.select is not None: _write_enum_as_element("select", "select", that.select, serializer) _write_nested_element("condition", "condition", that.condition, serializer) if that.filters is not None: _write_list_of_instances("filters", "filters", that.filters, serializer) serializer.writer.write_end_element(name) except Exception as exception: _attribute_to_property(exception, prop_name) class _Serializer(our_types.AbstractVisitor): """Encode instances as XML and write them to :py:attr:`~writer`.""" #: Frame the XML elements of the document which we are writing writer: Final[our_xmlcommon.Writer] def __init__(self, stream: TextIO) -> None: """ Initialize the visitor to write to :paramref:`stream`. The first element will include the :py:attr:`~.NAMESPACE`. Every other element will not have the namespace specified. :param stream: where to write to """ self.writer = our_xmlcommon.Writer(stream) def visit_extension(self, that: our_types.Extension) -> None: """ Serialize :paramref:`that` to :py:attr:`~stream` as an XML element. The enclosing XML element designates the class of the instance, where its children correspond to the properties of the instance. :param that: instance to be serialized """ _write_extension_as_element("extension", None, that, self) def visit_administrative_information( self, that: our_types.AdministrativeInformation ) -> None: """ Serialize :paramref:`that` to :py:attr:`~stream` as an XML element. The enclosing XML element designates the class of the instance, where its children correspond to the properties of the instance. :param that: instance to be serialized """ _write_administrative_information_as_element( "administrativeInformation", None, that, self ) def visit_qualifier(self, that: our_types.Qualifier) -> None: """ Serialize :paramref:`that` to :py:attr:`~stream` as an XML element. The enclosing XML element designates the class of the instance, where its children correspond to the properties of the instance. :param that: instance to be serialized """ _write_qualifier_as_element("qualifier", None, that, self) def visit_asset_administration_shell( self, that: our_types.AssetAdministrationShell ) -> None: """ Serialize :paramref:`that` to :py:attr:`~stream` as an XML element. The enclosing XML element designates the class of the instance, where its children correspond to the properties of the instance. :param that: instance to be serialized """ _write_asset_administration_shell_as_element( "assetAdministrationShell", None, that, self ) def visit_asset_information(self, that: our_types.AssetInformation) -> None: """ Serialize :paramref:`that` to :py:attr:`~stream` as an XML element. The enclosing XML element designates the class of the instance, where its children correspond to the properties of the instance. :param that: instance to be serialized """ _write_asset_information_as_element("assetInformation", None, that, self) def visit_resource(self, that: our_types.Resource) -> None: """ Serialize :paramref:`that` to :py:attr:`~stream` as an XML element. The enclosing XML element designates the class of the instance, where its children correspond to the properties of the instance. :param that: instance to be serialized """ _write_resource_as_element("resource", None, that, self) def visit_specific_asset_id(self, that: our_types.SpecificAssetID) -> None: """ Serialize :paramref:`that` to :py:attr:`~stream` as an XML element. The enclosing XML element designates the class of the instance, where its children correspond to the properties of the instance. :param that: instance to be serialized """ _write_specific_asset_id_as_element("specificAssetId", None, that, self) def visit_submodel(self, that: our_types.Submodel) -> None: """ Serialize :paramref:`that` to :py:attr:`~stream` as an XML element. The enclosing XML element designates the class of the instance, where its children correspond to the properties of the instance. :param that: instance to be serialized """ _write_submodel_as_element("submodel", None, that, self) def visit_relationship_element(self, that: our_types.RelationshipElement) -> None: """ Serialize :paramref:`that` to :py:attr:`~stream` as an XML element. The enclosing XML element designates the class of the instance, where its children correspond to the properties of the instance. :param that: instance to be serialized """ _write_relationship_element_as_element("relationshipElement", None, that, self) def visit_submodel_element_list(self, that: our_types.SubmodelElementList) -> None: """ Serialize :paramref:`that` to :py:attr:`~stream` as an XML element. The enclosing XML element designates the class of the instance, where its children correspond to the properties of the instance. :param that: instance to be serialized """ _write_submodel_element_list_as_element("submodelElementList", None, that, self) def visit_submodel_element_collection( self, that: our_types.SubmodelElementCollection ) -> None: """ Serialize :paramref:`that` to :py:attr:`~stream` as an XML element. The enclosing XML element designates the class of the instance, where its children correspond to the properties of the instance. :param that: instance to be serialized """ _write_submodel_element_collection_as_element( "submodelElementCollection", None, that, self ) def visit_property(self, that: our_types.Property) -> None: """ Serialize :paramref:`that` to :py:attr:`~stream` as an XML element. The enclosing XML element designates the class of the instance, where its children correspond to the properties of the instance. :param that: instance to be serialized """ _write_property_as_element("property", None, that, self) def visit_multi_language_property( self, that: our_types.MultiLanguageProperty ) -> None: """ Serialize :paramref:`that` to :py:attr:`~stream` as an XML element. The enclosing XML element designates the class of the instance, where its children correspond to the properties of the instance. :param that: instance to be serialized """ _write_multi_language_property_as_element( "multiLanguageProperty", None, that, self ) def visit_range(self, that: our_types.Range) -> None: """ Serialize :paramref:`that` to :py:attr:`~stream` as an XML element. The enclosing XML element designates the class of the instance, where its children correspond to the properties of the instance. :param that: instance to be serialized """ _write_range_as_element("range", None, that, self) def visit_reference_element(self, that: our_types.ReferenceElement) -> None: """ Serialize :paramref:`that` to :py:attr:`~stream` as an XML element. The enclosing XML element designates the class of the instance, where its children correspond to the properties of the instance. :param that: instance to be serialized """ _write_reference_element_as_element("referenceElement", None, that, self) def visit_blob(self, that: our_types.Blob) -> None: """ Serialize :paramref:`that` to :py:attr:`~stream` as an XML element. The enclosing XML element designates the class of the instance, where its children correspond to the properties of the instance. :param that: instance to be serialized """ _write_blob_as_element("blob", None, that, self) def visit_file(self, that: our_types.File) -> None: """ Serialize :paramref:`that` to :py:attr:`~stream` as an XML element. The enclosing XML element designates the class of the instance, where its children correspond to the properties of the instance. :param that: instance to be serialized """ _write_file_as_element("file", None, that, self) def visit_annotated_relationship_element( self, that: our_types.AnnotatedRelationshipElement ) -> None: """ Serialize :paramref:`that` to :py:attr:`~stream` as an XML element. The enclosing XML element designates the class of the instance, where its children correspond to the properties of the instance. :param that: instance to be serialized """ _write_annotated_relationship_element_as_element( "annotatedRelationshipElement", None, that, self ) def visit_entity(self, that: our_types.Entity) -> None: """ Serialize :paramref:`that` to :py:attr:`~stream` as an XML element. The enclosing XML element designates the class of the instance, where its children correspond to the properties of the instance. :param that: instance to be serialized """ _write_entity_as_element("entity", None, that, self) def visit_event_payload(self, that: our_types.EventPayload) -> None: """ Serialize :paramref:`that` to :py:attr:`~stream` as an XML element. The enclosing XML element designates the class of the instance, where its children correspond to the properties of the instance. :param that: instance to be serialized """ _write_event_payload_as_element("eventPayload", None, that, self) def visit_basic_event_element(self, that: our_types.BasicEventElement) -> None: """ Serialize :paramref:`that` to :py:attr:`~stream` as an XML element. The enclosing XML element designates the class of the instance, where its children correspond to the properties of the instance. :param that: instance to be serialized """ _write_basic_event_element_as_element("basicEventElement", None, that, self) def visit_operation(self, that: our_types.Operation) -> None: """ Serialize :paramref:`that` to :py:attr:`~stream` as an XML element. The enclosing XML element designates the class of the instance, where its children correspond to the properties of the instance. :param that: instance to be serialized """ _write_operation_as_element("operation", None, that, self) def visit_operation_variable(self, that: our_types.OperationVariable) -> None: """ Serialize :paramref:`that` to :py:attr:`~stream` as an XML element. The enclosing XML element designates the class of the instance, where its children correspond to the properties of the instance. :param that: instance to be serialized """ _write_operation_variable_as_element("operationVariable", None, that, self) def visit_capability(self, that: our_types.Capability) -> None: """ Serialize :paramref:`that` to :py:attr:`~stream` as an XML element. The enclosing XML element designates the class of the instance, where its children correspond to the properties of the instance. :param that: instance to be serialized """ _write_capability_as_element("capability", None, that, self) def visit_concept_description(self, that: our_types.ConceptDescription) -> None: """ Serialize :paramref:`that` to :py:attr:`~stream` as an XML element. The enclosing XML element designates the class of the instance, where its children correspond to the properties of the instance. :param that: instance to be serialized """ _write_concept_description_as_element("conceptDescription", None, that, self) def visit_reference(self, that: our_types.Reference) -> None: """ Serialize :paramref:`that` to :py:attr:`~stream` as an XML element. The enclosing XML element designates the class of the instance, where its children correspond to the properties of the instance. :param that: instance to be serialized """ _write_reference_as_element("reference", None, that, self) def visit_key(self, that: our_types.Key) -> None: """ Serialize :paramref:`that` to :py:attr:`~stream` as an XML element. The enclosing XML element designates the class of the instance, where its children correspond to the properties of the instance. :param that: instance to be serialized """ _write_key_as_element("key", None, that, self) def visit_lang_string_name_type(self, that: our_types.LangStringNameType) -> None: """ Serialize :paramref:`that` to :py:attr:`~stream` as an XML element. The enclosing XML element designates the class of the instance, where its children correspond to the properties of the instance. :param that: instance to be serialized """ _write_lang_string_name_type_as_element("langStringNameType", None, that, self) def visit_lang_string_text_type(self, that: our_types.LangStringTextType) -> None: """ Serialize :paramref:`that` to :py:attr:`~stream` as an XML element. The enclosing XML element designates the class of the instance, where its children correspond to the properties of the instance. :param that: instance to be serialized """ _write_lang_string_text_type_as_element("langStringTextType", None, that, self) def visit_environment(self, that: our_types.Environment) -> None: """ Serialize :paramref:`that` to :py:attr:`~stream` as an XML element. The enclosing XML element designates the class of the instance, where its children correspond to the properties of the instance. :param that: instance to be serialized """ _write_environment_as_element("environment", None, that, self) def visit_embedded_data_specification( self, that: our_types.EmbeddedDataSpecification ) -> None: """ Serialize :paramref:`that` to :py:attr:`~stream` as an XML element. The enclosing XML element designates the class of the instance, where its children correspond to the properties of the instance. :param that: instance to be serialized """ _write_embedded_data_specification_as_element( "embeddedDataSpecification", None, that, self ) def visit_level_type(self, that: our_types.LevelType) -> None: """ Serialize :paramref:`that` to :py:attr:`~stream` as an XML element. The enclosing XML element designates the class of the instance, where its children correspond to the properties of the instance. :param that: instance to be serialized """ _write_level_type_as_element("levelType", None, that, self) def visit_value_reference_pair(self, that: our_types.ValueReferencePair) -> None: """ Serialize :paramref:`that` to :py:attr:`~stream` as an XML element. The enclosing XML element designates the class of the instance, where its children correspond to the properties of the instance. :param that: instance to be serialized """ _write_value_reference_pair_as_element("valueReferencePair", None, that, self) def visit_value_list(self, that: our_types.ValueList) -> None: """ Serialize :paramref:`that` to :py:attr:`~stream` as an XML element. The enclosing XML element designates the class of the instance, where its children correspond to the properties of the instance. :param that: instance to be serialized """ _write_value_list_as_element("valueList", None, that, self) def visit_lang_string_preferred_name_type_iec_61360( self, that: our_types.LangStringPreferredNameTypeIEC61360 ) -> None: """ Serialize :paramref:`that` to :py:attr:`~stream` as an XML element. The enclosing XML element designates the class of the instance, where its children correspond to the properties of the instance. :param that: instance to be serialized """ _write_lang_string_preferred_name_type_iec_61360_as_element( "langStringPreferredNameTypeIec61360", None, that, self ) def visit_lang_string_short_name_type_iec_61360( self, that: our_types.LangStringShortNameTypeIEC61360 ) -> None: """ Serialize :paramref:`that` to :py:attr:`~stream` as an XML element. The enclosing XML element designates the class of the instance, where its children correspond to the properties of the instance. :param that: instance to be serialized """ _write_lang_string_short_name_type_iec_61360_as_element( "langStringShortNameTypeIec61360", None, that, self ) def visit_lang_string_definition_type_iec_61360( self, that: our_types.LangStringDefinitionTypeIEC61360 ) -> None: """ Serialize :paramref:`that` to :py:attr:`~stream` as an XML element. The enclosing XML element designates the class of the instance, where its children correspond to the properties of the instance. :param that: instance to be serialized """ _write_lang_string_definition_type_iec_61360_as_element( "langStringDefinitionTypeIec61360", None, that, self ) def visit_lang_string_uom(self, that: our_types.LangStringUom) -> None: """ Serialize :paramref:`that` to :py:attr:`~stream` as an XML element. The enclosing XML element designates the class of the instance, where its children correspond to the properties of the instance. :param that: instance to be serialized """ _write_lang_string_uom_as_element("langStringUom", None, that, self) def visit_definition_type_uom(self, that: our_types.DefinitionTypeUom) -> None: """ Serialize :paramref:`that` to :py:attr:`~stream` as an XML element. The enclosing XML element designates the class of the instance, where its children correspond to the properties of the instance. :param that: instance to be serialized """ _write_definition_type_uom_as_element("definitionTypeUom", None, that, self) def visit_data_specification_uom( self, that: our_types.DataSpecificationUom ) -> None: """ Serialize :paramref:`that` to :py:attr:`~stream` as an XML element. The enclosing XML element designates the class of the instance, where its children correspond to the properties of the instance. :param that: instance to be serialized """ _write_data_specification_uom_as_element( "dataSpecificationUom", None, that, self ) def visit_data_specification_iec_61360( self, that: our_types.DataSpecificationIEC61360 ) -> None: """ Serialize :paramref:`that` to :py:attr:`~stream` as an XML element. The enclosing XML element designates the class of the instance, where its children correspond to the properties of the instance. :param that: instance to be serialized """ _write_data_specification_iec_61360_as_element( "dataSpecificationIec61360", None, that, self ) def visit_asset_administration_shell_descriptor( self, that: our_types.AssetAdministrationShellDescriptor ) -> None: """ Serialize :paramref:`that` to :py:attr:`~stream` as an XML element. The enclosing XML element designates the class of the instance, where its children correspond to the properties of the instance. :param that: instance to be serialized """ _write_asset_administration_shell_descriptor_as_element( "assetAdministrationShellDescriptor", None, that, self ) def visit_submodel_descriptor(self, that: our_types.SubmodelDescriptor) -> None: """ Serialize :paramref:`that` to :py:attr:`~stream` as an XML element. The enclosing XML element designates the class of the instance, where its children correspond to the properties of the instance. :param that: instance to be serialized """ _write_submodel_descriptor_as_element("submodelDescriptor", None, that, self) def visit_endpoint(self, that: our_types.Endpoint) -> None: """ Serialize :paramref:`that` to :py:attr:`~stream` as an XML element. The enclosing XML element designates the class of the instance, where its children correspond to the properties of the instance. :param that: instance to be serialized """ _write_endpoint_as_element("endpoint", None, that, self) def visit_protocol_information(self, that: our_types.ProtocolInformation) -> None: """ Serialize :paramref:`that` to :py:attr:`~stream` as an XML element. The enclosing XML element designates the class of the instance, where its children correspond to the properties of the instance. :param that: instance to be serialized """ _write_protocol_information_as_element("protocolInformation", None, that, self) def visit_security_attribute_object( self, that: our_types.SecurityAttributeObject ) -> None: """ Serialize :paramref:`that` to :py:attr:`~stream` as an XML element. The enclosing XML element designates the class of the instance, where its children correspond to the properties of the instance. :param that: instance to be serialized """ _write_security_attribute_object_as_element( "securityAttributeObject", None, that, self ) def visit_asset_link(self, that: our_types.AssetLink) -> None: """ Serialize :paramref:`that` to :py:attr:`~stream` as an XML element. The enclosing XML element designates the class of the instance, where its children correspond to the properties of the instance. :param that: instance to be serialized """ _write_asset_link_as_element("assetLink", None, that, self) def visit_service_description(self, that: our_types.ServiceDescription) -> None: """ Serialize :paramref:`that` to :py:attr:`~stream` as an XML element. The enclosing XML element designates the class of the instance, where its children correspond to the properties of the instance. :param that: instance to be serialized """ _write_service_description_as_element("serviceDescription", None, that, self) def visit_asset_administration_shell_recent_change( self, that: our_types.AssetAdministrationShellRecentChange ) -> None: """ Serialize :paramref:`that` to :py:attr:`~stream` as an XML element. The enclosing XML element designates the class of the instance, where its children correspond to the properties of the instance. :param that: instance to be serialized """ _write_asset_administration_shell_recent_change_as_element( "assetAdministrationShellRecentChange", None, that, self ) def visit_concept_description_recent_change( self, that: our_types.ConceptDescriptionRecentChange ) -> None: """ Serialize :paramref:`that` to :py:attr:`~stream` as an XML element. The enclosing XML element designates the class of the instance, where its children correspond to the properties of the instance. :param that: instance to be serialized """ _write_concept_description_recent_change_as_element( "conceptDescriptionRecentChange", None, that, self ) def visit_submodel_recent_change( self, that: our_types.SubmodelRecentChange ) -> None: """ Serialize :paramref:`that` to :py:attr:`~stream` as an XML element. The enclosing XML element designates the class of the instance, where its children correspond to the properties of the instance. :param that: instance to be serialized """ _write_submodel_recent_change_as_element( "submodelRecentChange", None, that, self ) def visit_result(self, that: our_types.Result) -> None: """ Serialize :paramref:`that` to :py:attr:`~stream` as an XML element. The enclosing XML element designates the class of the instance, where its children correspond to the properties of the instance. :param that: instance to be serialized """ _write_result_as_element("result", None, that, self) def visit_message(self, that: our_types.Message) -> None: """ Serialize :paramref:`that` to :py:attr:`~stream` as an XML element. The enclosing XML element designates the class of the instance, where its children correspond to the properties of the instance. :param that: instance to be serialized """ _write_message_as_element("message", None, that, self) def visit_operation_request(self, that: our_types.OperationRequest) -> None: """ Serialize :paramref:`that` to :py:attr:`~stream` as an XML element. The enclosing XML element designates the class of the instance, where its children correspond to the properties of the instance. :param that: instance to be serialized """ _write_operation_request_as_element("operationRequest", None, that, self) def visit_operation_request_async( self, that: our_types.OperationRequestAsync ) -> None: """ Serialize :paramref:`that` to :py:attr:`~stream` as an XML element. The enclosing XML element designates the class of the instance, where its children correspond to the properties of the instance. :param that: instance to be serialized """ _write_operation_request_async_as_element( "operationRequestAsync", None, that, self ) def visit_operation_request_value_only( self, that: our_types.OperationRequestValueOnly ) -> None: """ Serialize :paramref:`that` to :py:attr:`~stream` as an XML element. The enclosing XML element designates the class of the instance, where its children correspond to the properties of the instance. :param that: instance to be serialized """ _write_operation_request_value_only_as_element( "operationRequestValueOnly", None, that, self ) def visit_operation_request_async_value_only( self, that: our_types.OperationRequestAsyncValueOnly ) -> None: """ Serialize :paramref:`that` to :py:attr:`~stream` as an XML element. The enclosing XML element designates the class of the instance, where its children correspond to the properties of the instance. :param that: instance to be serialized """ _write_operation_request_async_value_only_as_element( "operationRequestAsyncValueOnly", None, that, self ) def visit_base_operation_result(self, that: our_types.BaseOperationResult) -> None: """ Serialize :paramref:`that` to :py:attr:`~stream` as an XML element. The enclosing XML element designates the class of the instance, where its children correspond to the properties of the instance. :param that: instance to be serialized """ _write_base_operation_result_as_element("baseOperationResult", None, that, self) def visit_operation_result(self, that: our_types.OperationResult) -> None: """ Serialize :paramref:`that` to :py:attr:`~stream` as an XML element. The enclosing XML element designates the class of the instance, where its children correspond to the properties of the instance. :param that: instance to be serialized """ _write_operation_result_as_element("operationResult", None, that, self) def visit_operation_result_value_only( self, that: our_types.OperationResultValueOnly ) -> None: """ Serialize :paramref:`that` to :py:attr:`~stream` as an XML element. The enclosing XML element designates the class of the instance, where its children correspond to the properties of the instance. :param that: instance to be serialized """ _write_operation_result_value_only_as_element( "operationResultValueOnly", None, that, self ) def visit_operation_handle(self, that: our_types.OperationHandle) -> None: """ Serialize :paramref:`that` to :py:attr:`~stream` as an XML element. The enclosing XML element designates the class of the instance, where its children correspond to the properties of the instance. :param that: instance to be serialized """ _write_operation_handle_as_element("operationHandle", None, that, self) def visit_paged_result(self, that: our_types.PagedResult) -> None: """ Serialize :paramref:`that` to :py:attr:`~stream` as an XML element. The enclosing XML element designates the class of the instance, where its children correspond to the properties of the instance. :param that: instance to be serialized """ _write_paged_result_as_element("pagedResult", None, that, self) def visit_paging_metadata(self, that: our_types.PagingMetadata) -> None: """ Serialize :paramref:`that` to :py:attr:`~stream` as an XML element. The enclosing XML element designates the class of the instance, where its children correspond to the properties of the instance. :param that: instance to be serialized """ _write_paging_metadata_as_element("pagingMetadata", None, that, self) def visit_package_description(self, that: our_types.PackageDescription) -> None: """ Serialize :paramref:`that` to :py:attr:`~stream` as an XML element. The enclosing XML element designates the class of the instance, where its children correspond to the properties of the instance. :param that: instance to be serialized """ _write_package_description_as_element("packageDescription", None, that, self) def visit_property_metadata(self, that: our_types.PropertyMetadata) -> None: """ Serialize :paramref:`that` to :py:attr:`~stream` as an XML element. The enclosing XML element designates the class of the instance, where its children correspond to the properties of the instance. :param that: instance to be serialized """ _write_property_metadata_as_element("propertyMetadata", None, that, self) def visit_range_metadata(self, that: our_types.RangeMetadata) -> None: """ Serialize :paramref:`that` to :py:attr:`~stream` as an XML element. The enclosing XML element designates the class of the instance, where its children correspond to the properties of the instance. :param that: instance to be serialized """ _write_range_metadata_as_element("rangeMetadata", None, that, self) def visit_blob_metadata(self, that: our_types.BlobMetadata) -> None: """ Serialize :paramref:`that` to :py:attr:`~stream` as an XML element. The enclosing XML element designates the class of the instance, where its children correspond to the properties of the instance. :param that: instance to be serialized """ _write_blob_metadata_as_element("blobMetadata", None, that, self) def visit_file_metadata(self, that: our_types.FileMetadata) -> None: """ Serialize :paramref:`that` to :py:attr:`~stream` as an XML element. The enclosing XML element designates the class of the instance, where its children correspond to the properties of the instance. :param that: instance to be serialized """ _write_file_metadata_as_element("fileMetadata", None, that, self) def visit_multi_language_property_metadata( self, that: our_types.MultiLanguagePropertyMetadata ) -> None: """ Serialize :paramref:`that` to :py:attr:`~stream` as an XML element. The enclosing XML element designates the class of the instance, where its children correspond to the properties of the instance. :param that: instance to be serialized """ _write_multi_language_property_metadata_as_element( "multiLanguagePropertyMetadata", None, that, self ) def visit_reference_element_metadata( self, that: our_types.ReferenceElementMetadata ) -> None: """ Serialize :paramref:`that` to :py:attr:`~stream` as an XML element. The enclosing XML element designates the class of the instance, where its children correspond to the properties of the instance. :param that: instance to be serialized """ _write_reference_element_metadata_as_element( "referenceElementMetadata", None, that, self ) def visit_relationship_element_metadata( self, that: our_types.RelationshipElementMetadata ) -> None: """ Serialize :paramref:`that` to :py:attr:`~stream` as an XML element. The enclosing XML element designates the class of the instance, where its children correspond to the properties of the instance. :param that: instance to be serialized """ _write_relationship_element_metadata_as_element( "relationshipElementMetadata", None, that, self ) def visit_annotated_relationship_element_metadata( self, that: our_types.AnnotatedRelationshipElementMetadata ) -> None: """ Serialize :paramref:`that` to :py:attr:`~stream` as an XML element. The enclosing XML element designates the class of the instance, where its children correspond to the properties of the instance. :param that: instance to be serialized """ _write_annotated_relationship_element_metadata_as_element( "annotatedRelationshipElementMetadata", None, that, self ) def visit_entity_metadata(self, that: our_types.EntityMetadata) -> None: """ Serialize :paramref:`that` to :py:attr:`~stream` as an XML element. The enclosing XML element designates the class of the instance, where its children correspond to the properties of the instance. :param that: instance to be serialized """ _write_entity_metadata_as_element("entityMetadata", None, that, self) def visit_capability_metadata(self, that: our_types.CapabilityMetadata) -> None: """ Serialize :paramref:`that` to :py:attr:`~stream` as an XML element. The enclosing XML element designates the class of the instance, where its children correspond to the properties of the instance. :param that: instance to be serialized """ _write_capability_metadata_as_element("capabilityMetadata", None, that, self) def visit_operation_metadata(self, that: our_types.OperationMetadata) -> None: """ Serialize :paramref:`that` to :py:attr:`~stream` as an XML element. The enclosing XML element designates the class of the instance, where its children correspond to the properties of the instance. :param that: instance to be serialized """ _write_operation_metadata_as_element("operationMetadata", None, that, self) def visit_submodel_element_collection_metadata( self, that: our_types.SubmodelElementCollectionMetadata ) -> None: """ Serialize :paramref:`that` to :py:attr:`~stream` as an XML element. The enclosing XML element designates the class of the instance, where its children correspond to the properties of the instance. :param that: instance to be serialized """ _write_submodel_element_collection_metadata_as_element( "submodelElementCollectionMetadata", None, that, self ) def visit_basic_event_element_metadata( self, that: our_types.BasicEventElementMetadata ) -> None: """ Serialize :paramref:`that` to :py:attr:`~stream` as an XML element. The enclosing XML element designates the class of the instance, where its children correspond to the properties of the instance. :param that: instance to be serialized """ _write_basic_event_element_metadata_as_element( "basicEventElementMetadata", None, that, self ) def visit_submodel_element_list_metadata( self, that: our_types.SubmodelElementListMetadata ) -> None: """ Serialize :paramref:`that` to :py:attr:`~stream` as an XML element. The enclosing XML element designates the class of the instance, where its children correspond to the properties of the instance. :param that: instance to be serialized """ _write_submodel_element_list_metadata_as_element( "submodelElementListMetadata", None, that, self ) def visit_submodel_metadata(self, that: our_types.SubmodelMetadata) -> None: """ Serialize :paramref:`that` to :py:attr:`~stream` as an XML element. The enclosing XML element designates the class of the instance, where its children correspond to the properties of the instance. :param that: instance to be serialized """ _write_submodel_metadata_as_element("submodelMetadata", None, that, self) def visit_asset_administration_shell_metadata( self, that: our_types.AssetAdministrationShellMetadata ) -> None: """ Serialize :paramref:`that` to :py:attr:`~stream` as an XML element. The enclosing XML element designates the class of the instance, where its children correspond to the properties of the instance. :param that: instance to be serialized """ _write_asset_administration_shell_metadata_as_element( "assetAdministrationShellMetadata", None, that, self ) def visit_reference_element_value( self, that: our_types.ReferenceElementValue ) -> None: """ Serialize :paramref:`that` to :py:attr:`~stream` as an XML element. The enclosing XML element designates the class of the instance, where its children correspond to the properties of the instance. :param that: instance to be serialized """ _write_reference_element_value_as_element( "referenceElementValue", None, that, self ) def visit_blob_value(self, that: our_types.BlobValue) -> None: """ Serialize :paramref:`that` to :py:attr:`~stream` as an XML element. The enclosing XML element designates the class of the instance, where its children correspond to the properties of the instance. :param that: instance to be serialized """ _write_blob_value_as_element("blobValue", None, that, self) def visit_file_value(self, that: our_types.FileValue) -> None: """ Serialize :paramref:`that` to :py:attr:`~stream` as an XML element. The enclosing XML element designates the class of the instance, where its children correspond to the properties of the instance. :param that: instance to be serialized """ _write_file_value_as_element("fileValue", None, that, self) def visit_range_value(self, that: our_types.RangeValue) -> None: """ Serialize :paramref:`that` to :py:attr:`~stream` as an XML element. The enclosing XML element designates the class of the instance, where its children correspond to the properties of the instance. :param that: instance to be serialized """ _write_range_value_as_element("rangeValue", None, that, self) def visit_relationship_element_value( self, that: our_types.RelationshipElementValue ) -> None: """ Serialize :paramref:`that` to :py:attr:`~stream` as an XML element. The enclosing XML element designates the class of the instance, where its children correspond to the properties of the instance. :param that: instance to be serialized """ _write_relationship_element_value_as_element( "relationshipElementValue", None, that, self ) def visit_basic_event_element_value( self, that: our_types.BasicEventElementValue ) -> None: """ Serialize :paramref:`that` to :py:attr:`~stream` as an XML element. The enclosing XML element designates the class of the instance, where its children correspond to the properties of the instance. :param that: instance to be serialized """ _write_basic_event_element_value_as_element( "basicEventElementValue", None, that, self ) def visit_annotated_relationship_element_value( self, that: our_types.AnnotatedRelationshipElementValue ) -> None: """ Serialize :paramref:`that` to :py:attr:`~stream` as an XML element. The enclosing XML element designates the class of the instance, where its children correspond to the properties of the instance. :param that: instance to be serialized """ _write_annotated_relationship_element_value_as_element( "annotatedRelationshipElementValue", None, that, self ) def visit_entity_value(self, that: our_types.EntityValue) -> None: """ Serialize :paramref:`that` to :py:attr:`~stream` as an XML element. The enclosing XML element designates the class of the instance, where its children correspond to the properties of the instance. :param that: instance to be serialized """ _write_entity_value_as_element("entityValue", None, that, self) def visit_get_asset_administration_shells_result( self, that: our_types.GetAssetAdministrationShellsResult ) -> None: """ Serialize :paramref:`that` to :py:attr:`~stream` as an XML element. The enclosing XML element designates the class of the instance, where its children correspond to the properties of the instance. :param that: instance to be serialized """ _write_get_asset_administration_shells_result_as_element( "getAssetAdministrationShellsResult", None, that, self ) def visit_get_asset_administration_shells_metadata_result( self, that: our_types.GetAssetAdministrationShellsMetadataResult ) -> None: """ Serialize :paramref:`that` to :py:attr:`~stream` as an XML element. The enclosing XML element designates the class of the instance, where its children correspond to the properties of the instance. :param that: instance to be serialized """ _write_get_asset_administration_shells_metadata_result_as_element( "getAssetAdministrationShellsMetadataResult", None, that, self ) def visit_get_all_asset_administration_shells_recent_changes_result( self, that: our_types.GetAllAssetAdministrationShellsRecentChangesResult ) -> None: """ Serialize :paramref:`that` to :py:attr:`~stream` as an XML element. The enclosing XML element designates the class of the instance, where its children correspond to the properties of the instance. :param that: instance to be serialized """ _write_get_all_asset_administration_shells_recent_changes_result_as_element( "getAllAssetAdministrationShellsRecentChangesResult", None, that, self ) def visit_get_asset_administration_shell_descriptors_result( self, that: our_types.GetAssetAdministrationShellDescriptorsResult ) -> None: """ Serialize :paramref:`that` to :py:attr:`~stream` as an XML element. The enclosing XML element designates the class of the instance, where its children correspond to the properties of the instance. :param that: instance to be serialized """ _write_get_asset_administration_shell_descriptors_result_as_element( "getAssetAdministrationShellDescriptorsResult", None, that, self ) def visit_get_concept_descriptions_result( self, that: our_types.GetConceptDescriptionsResult ) -> None: """ Serialize :paramref:`that` to :py:attr:`~stream` as an XML element. The enclosing XML element designates the class of the instance, where its children correspond to the properties of the instance. :param that: instance to be serialized """ _write_get_concept_descriptions_result_as_element( "getConceptDescriptionsResult", None, that, self ) def visit_get_all_concept_descriptions_recent_changes_result( self, that: our_types.GetAllConceptDescriptionsRecentChangesResult ) -> None: """ Serialize :paramref:`that` to :py:attr:`~stream` as an XML element. The enclosing XML element designates the class of the instance, where its children correspond to the properties of the instance. :param that: instance to be serialized """ _write_get_all_concept_descriptions_recent_changes_result_as_element( "getAllConceptDescriptionsRecentChangesResult", None, that, self ) def visit_get_package_descriptions_result( self, that: our_types.GetPackageDescriptionsResult ) -> None: """ Serialize :paramref:`that` to :py:attr:`~stream` as an XML element. The enclosing XML element designates the class of the instance, where its children correspond to the properties of the instance. :param that: instance to be serialized """ _write_get_package_descriptions_result_as_element( "getPackageDescriptionsResult", None, that, self ) def visit_get_path_items_result(self, that: our_types.GetPathItemsResult) -> None: """ Serialize :paramref:`that` to :py:attr:`~stream` as an XML element. The enclosing XML element designates the class of the instance, where its children correspond to the properties of the instance. :param that: instance to be serialized """ _write_get_path_items_result_as_element("getPathItemsResult", None, that, self) def visit_get_references_result(self, that: our_types.GetReferencesResult) -> None: """ Serialize :paramref:`that` to :py:attr:`~stream` as an XML element. The enclosing XML element designates the class of the instance, where its children correspond to the properties of the instance. :param that: instance to be serialized """ _write_get_references_result_as_element("getReferencesResult", None, that, self) def visit_get_submodel_descriptors_result( self, that: our_types.GetSubmodelDescriptorsResult ) -> None: """ Serialize :paramref:`that` to :py:attr:`~stream` as an XML element. The enclosing XML element designates the class of the instance, where its children correspond to the properties of the instance. :param that: instance to be serialized """ _write_get_submodel_descriptors_result_as_element( "getSubmodelDescriptorsResult", None, that, self ) def visit_get_submodel_elements_metadata_result( self, that: our_types.GetSubmodelElementsMetadataResult ) -> None: """ Serialize :paramref:`that` to :py:attr:`~stream` as an XML element. The enclosing XML element designates the class of the instance, where its children correspond to the properties of the instance. :param that: instance to be serialized """ _write_get_submodel_elements_metadata_result_as_element( "getSubmodelElementsMetadataResult", None, that, self ) def visit_get_submodel_elements_result( self, that: our_types.GetSubmodelElementsResult ) -> None: """ Serialize :paramref:`that` to :py:attr:`~stream` as an XML element. The enclosing XML element designates the class of the instance, where its children correspond to the properties of the instance. :param that: instance to be serialized """ _write_get_submodel_elements_result_as_element( "getSubmodelElementsResult", None, that, self ) def visit_get_submodel_elements_value_result( self, that: our_types.GetSubmodelElementsValueResult ) -> None: """ Serialize :paramref:`that` to :py:attr:`~stream` as an XML element. The enclosing XML element designates the class of the instance, where its children correspond to the properties of the instance. :param that: instance to be serialized """ _write_get_submodel_elements_value_result_as_element( "getSubmodelElementsValueResult", None, that, self ) def visit_get_all_submodels_recent_changes_result( self, that: our_types.GetAllSubmodelsRecentChangesResult ) -> None: """ Serialize :paramref:`that` to :py:attr:`~stream` as an XML element. The enclosing XML element designates the class of the instance, where its children correspond to the properties of the instance. :param that: instance to be serialized """ _write_get_all_submodels_recent_changes_result_as_element( "getAllSubmodelsRecentChangesResult", None, that, self ) def visit_get_submodels_metadata_result( self, that: our_types.GetSubmodelsMetadataResult ) -> None: """ Serialize :paramref:`that` to :py:attr:`~stream` as an XML element. The enclosing XML element designates the class of the instance, where its children correspond to the properties of the instance. :param that: instance to be serialized """ _write_get_submodels_metadata_result_as_element( "getSubmodelsMetadataResult", None, that, self ) def visit_get_submodels_result(self, that: our_types.GetSubmodelsResult) -> None: """ Serialize :paramref:`that` to :py:attr:`~stream` as an XML element. The enclosing XML element designates the class of the instance, where its children correspond to the properties of the instance. :param that: instance to be serialized """ _write_get_submodels_result_as_element("getSubmodelsResult", None, that, self) def visit_get_submodels_value_result( self, that: our_types.GetSubmodelsValueResult ) -> None: """ Serialize :paramref:`that` to :py:attr:`~stream` as an XML element. The enclosing XML element designates the class of the instance, where its children correspond to the properties of the instance. :param that: instance to be serialized """ _write_get_submodels_value_result_as_element( "getSubmodelsValueResult", None, that, self ) def visit_claim_attribute(self, that: our_types.ClaimAttribute) -> None: """ Serialize :paramref:`that` to :py:attr:`~stream` as an XML element. The enclosing XML element designates the class of the instance, where its children correspond to the properties of the instance. :param that: instance to be serialized """ _write_claim_attribute_as_element("claimAttribute", None, that, self) def visit_global_attribute(self, that: our_types.GlobalAttribute) -> None: """ Serialize :paramref:`that` to :py:attr:`~stream` as an XML element. The enclosing XML element designates the class of the instance, where its children correspond to the properties of the instance. :param that: instance to be serialized """ _write_global_attribute_as_element("globalAttribute", None, that, self) def visit_reference_attribute(self, that: our_types.ReferenceAttribute) -> None: """ Serialize :paramref:`that` to :py:attr:`~stream` as an XML element. The enclosing XML element designates the class of the instance, where its children correspond to the properties of the instance. :param that: instance to be serialized """ _write_reference_attribute_as_element("referenceAttribute", None, that, self) def visit_date_time_attribute_item( self, that: our_types.DateTimeAttributeItem ) -> None: """ Serialize :paramref:`that` to :py:attr:`~stream` as an XML element. The enclosing XML element designates the class of the instance, where its children correspond to the properties of the instance. :param that: instance to be serialized """ _write_date_time_attribute_item_as_element( "dateTimeAttributeItem", None, that, self ) def visit_field_operand(self, that: our_types.FieldOperand) -> None: """ Serialize :paramref:`that` to :py:attr:`~stream` as an XML element. The enclosing XML element designates the class of the instance, where its children correspond to the properties of the instance. :param that: instance to be serialized """ _write_field_operand_as_element("fieldOperand", None, that, self) def visit_string_literal(self, that: our_types.StringLiteral) -> None: """ Serialize :paramref:`that` to :py:attr:`~stream` as an XML element. The enclosing XML element designates the class of the instance, where its children correspond to the properties of the instance. :param that: instance to be serialized """ _write_string_literal_as_element("stringLiteral", None, that, self) def visit_attribute_operand(self, that: our_types.AttributeOperand) -> None: """ Serialize :paramref:`that` to :py:attr:`~stream` as an XML element. The enclosing XML element designates the class of the instance, where its children correspond to the properties of the instance. :param that: instance to be serialized """ _write_attribute_operand_as_element("attributeOperand", None, that, self) def visit_number_literal(self, that: our_types.NumberLiteral) -> None: """ Serialize :paramref:`that` to :py:attr:`~stream` as an XML element. The enclosing XML element designates the class of the instance, where its children correspond to the properties of the instance. :param that: instance to be serialized """ _write_number_literal_as_element("numberLiteral", None, that, self) def visit_hex_literal(self, that: our_types.HexLiteral) -> None: """ Serialize :paramref:`that` to :py:attr:`~stream` as an XML element. The enclosing XML element designates the class of the instance, where its children correspond to the properties of the instance. :param that: instance to be serialized """ _write_hex_literal_as_element("hexLiteral", None, that, self) def visit_date_time_literal(self, that: our_types.DateTimeLiteral) -> None: """ Serialize :paramref:`that` to :py:attr:`~stream` as an XML element. The enclosing XML element designates the class of the instance, where its children correspond to the properties of the instance. :param that: instance to be serialized """ _write_date_time_literal_as_element("dateTimeLiteral", None, that, self) def visit_time_literal(self, that: our_types.TimeLiteral) -> None: """ Serialize :paramref:`that` to :py:attr:`~stream` as an XML element. The enclosing XML element designates the class of the instance, where its children correspond to the properties of the instance. :param that: instance to be serialized """ _write_time_literal_as_element("timeLiteral", None, that, self) def visit_boolean_literal(self, that: our_types.BooleanLiteral) -> None: """ Serialize :paramref:`that` to :py:attr:`~stream` as an XML element. The enclosing XML element designates the class of the instance, where its children correspond to the properties of the instance. :param that: instance to be serialized """ _write_boolean_literal_as_element("booleanLiteral", None, that, self) def visit_string_cast(self, that: our_types.StringCast) -> None: """ Serialize :paramref:`that` to :py:attr:`~stream` as an XML element. The enclosing XML element designates the class of the instance, where its children correspond to the properties of the instance. :param that: instance to be serialized """ _write_string_cast_as_element("stringCast", None, that, self) def visit_number_cast(self, that: our_types.NumberCast) -> None: """ Serialize :paramref:`that` to :py:attr:`~stream` as an XML element. The enclosing XML element designates the class of the instance, where its children correspond to the properties of the instance. :param that: instance to be serialized """ _write_number_cast_as_element("numberCast", None, that, self) def visit_hex_cast(self, that: our_types.HexCast) -> None: """ Serialize :paramref:`that` to :py:attr:`~stream` as an XML element. The enclosing XML element designates the class of the instance, where its children correspond to the properties of the instance. :param that: instance to be serialized """ _write_hex_cast_as_element("hexCast", None, that, self) def visit_boolean_cast(self, that: our_types.BooleanCast) -> None: """ Serialize :paramref:`that` to :py:attr:`~stream` as an XML element. The enclosing XML element designates the class of the instance, where its children correspond to the properties of the instance. :param that: instance to be serialized """ _write_boolean_cast_as_element("booleanCast", None, that, self) def visit_date_time_cast(self, that: our_types.DateTimeCast) -> None: """ Serialize :paramref:`that` to :py:attr:`~stream` as an XML element. The enclosing XML element designates the class of the instance, where its children correspond to the properties of the instance. :param that: instance to be serialized """ _write_date_time_cast_as_element("dateTimeCast", None, that, self) def visit_time_cast(self, that: our_types.TimeCast) -> None: """ Serialize :paramref:`that` to :py:attr:`~stream` as an XML element. The enclosing XML element designates the class of the instance, where its children correspond to the properties of the instance. :param that: instance to be serialized """ _write_time_cast_as_element("timeCast", None, that, self) def visit_day_of_week(self, that: our_types.DayOfWeek) -> None: """ Serialize :paramref:`that` to :py:attr:`~stream` as an XML element. The enclosing XML element designates the class of the instance, where its children correspond to the properties of the instance. :param that: instance to be serialized """ _write_day_of_week_as_element("dayOfWeek", None, that, self) def visit_day_of_month(self, that: our_types.DayOfMonth) -> None: """ Serialize :paramref:`that` to :py:attr:`~stream` as an XML element. The enclosing XML element designates the class of the instance, where its children correspond to the properties of the instance. :param that: instance to be serialized """ _write_day_of_month_as_element("dayOfMonth", None, that, self) def visit_month(self, that: our_types.Month) -> None: """ Serialize :paramref:`that` to :py:attr:`~stream` as an XML element. The enclosing XML element designates the class of the instance, where its children correspond to the properties of the instance. :param that: instance to be serialized """ _write_month_as_element("month", None, that, self) def visit_year(self, that: our_types.Year) -> None: """ Serialize :paramref:`that` to :py:attr:`~stream` as an XML element. The enclosing XML element designates the class of the instance, where its children correspond to the properties of the instance. :param that: instance to be serialized """ _write_year_as_element("year", None, that, self) def visit_date_time_attribute_operand( self, that: our_types.DateTimeAttributeOperand ) -> None: """ Serialize :paramref:`that` to :py:attr:`~stream` as an XML element. The enclosing XML element designates the class of the instance, where its children correspond to the properties of the instance. :param that: instance to be serialized """ _write_date_time_attribute_operand_as_element( "dateTimeAttributeOperand", None, that, self ) def visit_equal_comparison(self, that: our_types.EqualComparison) -> None: """ Serialize :paramref:`that` to :py:attr:`~stream` as an XML element. The enclosing XML element designates the class of the instance, where its children correspond to the properties of the instance. :param that: instance to be serialized """ _write_equal_comparison_as_element("equalComparison", None, that, self) def visit_not_equal_comparison(self, that: our_types.NotEqualComparison) -> None: """ Serialize :paramref:`that` to :py:attr:`~stream` as an XML element. The enclosing XML element designates the class of the instance, where its children correspond to the properties of the instance. :param that: instance to be serialized """ _write_not_equal_comparison_as_element("notEqualComparison", None, that, self) def visit_greater_than_comparison( self, that: our_types.GreaterThanComparison ) -> None: """ Serialize :paramref:`that` to :py:attr:`~stream` as an XML element. The enclosing XML element designates the class of the instance, where its children correspond to the properties of the instance. :param that: instance to be serialized """ _write_greater_than_comparison_as_element( "greaterThanComparison", None, that, self ) def visit_greater_than_or_equal_comparison( self, that: our_types.GreaterThanOrEqualComparison ) -> None: """ Serialize :paramref:`that` to :py:attr:`~stream` as an XML element. The enclosing XML element designates the class of the instance, where its children correspond to the properties of the instance. :param that: instance to be serialized """ _write_greater_than_or_equal_comparison_as_element( "greaterThanOrEqualComparison", None, that, self ) def visit_less_than_comparison(self, that: our_types.LessThanComparison) -> None: """ Serialize :paramref:`that` to :py:attr:`~stream` as an XML element. The enclosing XML element designates the class of the instance, where its children correspond to the properties of the instance. :param that: instance to be serialized """ _write_less_than_comparison_as_element("lessThanComparison", None, that, self) def visit_less_than_or_equal_comparison( self, that: our_types.LessThanOrEqualComparison ) -> None: """ Serialize :paramref:`that` to :py:attr:`~stream` as an XML element. The enclosing XML element designates the class of the instance, where its children correspond to the properties of the instance. :param that: instance to be serialized """ _write_less_than_or_equal_comparison_as_element( "lessThanOrEqualComparison", None, that, self ) def visit_contains_comparison(self, that: our_types.ContainsComparison) -> None: """ Serialize :paramref:`that` to :py:attr:`~stream` as an XML element. The enclosing XML element designates the class of the instance, where its children correspond to the properties of the instance. :param that: instance to be serialized """ _write_contains_comparison_as_element("containsComparison", None, that, self) def visit_starts_with_comparison( self, that: our_types.StartsWithComparison ) -> None: """ Serialize :paramref:`that` to :py:attr:`~stream` as an XML element. The enclosing XML element designates the class of the instance, where its children correspond to the properties of the instance. :param that: instance to be serialized """ _write_starts_with_comparison_as_element( "startsWithComparison", None, that, self ) def visit_ends_with_comparison(self, that: our_types.EndsWithComparison) -> None: """ Serialize :paramref:`that` to :py:attr:`~stream` as an XML element. The enclosing XML element designates the class of the instance, where its children correspond to the properties of the instance. :param that: instance to be serialized """ _write_ends_with_comparison_as_element("endsWithComparison", None, that, self) def visit_regex_comparison(self, that: our_types.RegexComparison) -> None: """ Serialize :paramref:`that` to :py:attr:`~stream` as an XML element. The enclosing XML element designates the class of the instance, where its children correspond to the properties of the instance. :param that: instance to be serialized """ _write_regex_comparison_as_element("regexComparison", None, that, self) def visit_match_clause(self, that: our_types.MatchClause) -> None: """ Serialize :paramref:`that` to :py:attr:`~stream` as an XML element. The enclosing XML element designates the class of the instance, where its children correspond to the properties of the instance. :param that: instance to be serialized """ _write_match_clause_as_element("matchClause", None, that, self) def visit_and_expression(self, that: our_types.AndExpression) -> None: """ Serialize :paramref:`that` to :py:attr:`~stream` as an XML element. The enclosing XML element designates the class of the instance, where its children correspond to the properties of the instance. :param that: instance to be serialized """ _write_and_expression_as_element("andExpression", None, that, self) def visit_or_expression(self, that: our_types.OrExpression) -> None: """ Serialize :paramref:`that` to :py:attr:`~stream` as an XML element. The enclosing XML element designates the class of the instance, where its children correspond to the properties of the instance. :param that: instance to be serialized """ _write_or_expression_as_element("orExpression", None, that, self) def visit_not_expression(self, that: our_types.NotExpression) -> None: """ Serialize :paramref:`that` to :py:attr:`~stream` as an XML element. The enclosing XML element designates the class of the instance, where its children correspond to the properties of the instance. :param that: instance to be serialized """ _write_not_expression_as_element("notExpression", None, that, self) def visit_query_filter(self, that: our_types.QueryFilter) -> None: """ Serialize :paramref:`that` to :py:attr:`~stream` as an XML element. The enclosing XML element designates the class of the instance, where its children correspond to the properties of the instance. :param that: instance to be serialized """ _write_query_filter_as_element("queryFilter", None, that, self) def visit_query(self, that: our_types.Query) -> None: """ Serialize :paramref:`that` to :py:attr:`~stream` as an XML element. The enclosing XML element designates the class of the instance, where its children correspond to the properties of the instance. :param that: instance to be serialized """ _write_query_as_element("query", None, that, self)
[docs]def write(instance: our_types.Class, stream: TextIO) -> None: """ Write the XML representation of :paramref:`instance` to :paramref:`stream`. Example usage: .. code-block:: import pathlib import aas_core3_2.types as our_types import aas_core3_2.xmlization as our_xmlization instance = Extension( ... # some constructor arguments ) pth = pathlib.Path(...) with pth.open("wt") as fid: our_xmlization.write(instance, fid) :param instance: to be serialized :param stream: to write to :raise: :py:class:`SerializationException` if :paramref:`instance` could not be serialized """ serializer = _Serializer(stream) try: serializer.visit(instance) except Exception as exception: _attribute_to_property(exception, None)
[docs]def to_str(that: our_types.Class) -> str: """ Serialize :paramref:`that` to an XML-encoded text. :param that: instance to be serialized :raise: :py:class:`SerializationException` if :paramref:`that` could not be serialized :return: :paramref:`that` serialized to XML serialized to text """ writer = io.StringIO() write(that, writer) return writer.getvalue()
# endregion