diff --git a/basyx/aas/model/submodel.py b/basyx/aas/model/submodel.py index 6605228a..7052373f 100644 --- a/basyx/aas/model/submodel.py +++ b/basyx/aas/model/submodel.py @@ -6,18 +6,23 @@ # SPDX-License-Identifier: MIT """ This module contains everything needed to model Submodels and define Events according to the AAS metamodel. + +.. data:: Duration + + An alias for :class:`dateutil.relativedelta.relativedelta`, used to represent time durations. """ import abc import uuid -from typing import Optional, Set, Iterable, TYPE_CHECKING, List, Type, TypeVar, Generic, Union +from typing import Optional, Set, Iterable, TYPE_CHECKING, List, Type, TypeVar, Generic, Union, NewType from . import base, datatypes, _string_constraints if TYPE_CHECKING: from . import aas from dateutil.relativedelta import relativedelta -Duration = relativedelta +Duration = NewType('Duration', relativedelta) + class SubmodelElement(base.Referable, base.Qualifiable, base.HasSemantics, @@ -1258,11 +1263,11 @@ class BasicEventElement(EventElement): :ivar min_interval: For input direction, reports on the maximum frequency, the software entity behind the respective Referable can handle input events. For output events, specifies the maximum frequency of outputting this event to an outer infrastructure. - :type min_interval: Optional[dateutil.relativedelta.relativedelta] + :type min_interval: Optional[Duration] :ivar max_interval: For input direction: not applicable. For output direction: maximum interval in time, the respective Referable shall send an update of the status of the event, even if no other trigger condition for the event was not met. - :type max_interval: Optional[dateutil.relativedelta.relativedelta] + :type max_interval: Optional[Duration] :ivar display_name: Can be provided in several languages. (inherited from :class:`~basyx.aas.model.base.Referable`) :ivar category: The category is a value that gives further meta information w.r.t. to the class of the element. It affects the expected existence of attributes and the applicability of constraints. diff --git a/docs/source/conf.py b/docs/source/conf.py index 9c4bf9fd..a14afee7 100644 --- a/docs/source/conf.py +++ b/docs/source/conf.py @@ -13,10 +13,24 @@ import sys import datetime from typing import Dict, Any +from unittest.mock import MagicMock sys.path.insert(0, os.path.abspath('../..')) from basyx.aas import __version__ + +class Mock(MagicMock): + @classmethod + def __getattr__(cls, name): + return MagicMock() + + +MOCK_MODULES = ['dateutil', 'dateutil.relativedelta'] +sys.modules.update((mod_name, Mock()) for mod_name in MOCK_MODULES) + +autodoc_mock_imports = ['dateutil'] + + # -- Project information ----------------------------------------------------- project = 'Eclipse BaSyx Python SDK' @@ -68,6 +82,7 @@ 'Duration': 'dateutil.relativedelta.relativedelta', } + def on_missing_reference(app, env, node, contnode): path = node["reftarget"].split(".") # TODO: pyecma376_2 doesn't have a documentation we can link to, so suppress missing reference warnings. @@ -76,9 +91,11 @@ def on_missing_reference(app, env, node, contnode): return contnode return None + def setup(app): app.connect("missing-reference", on_missing_reference) + # -- Options for HTML output ------------------------------------------------- # The theme to use for HTML and HTML Help pages. See the documentation for @@ -102,4 +119,4 @@ def setup(app): 'github_repo': 'basyx-python-sdk', 'github_version': release, 'conf_py_path': '/docs/source/' -} \ No newline at end of file +}