Skip to content

Commit

Permalink
Updated Duration type definition and Sphinx configuration
Browse files Browse the repository at this point in the history
  • Loading branch information
hadijannat committed Jul 19, 2024
1 parent b61e183 commit 50dfbce
Show file tree
Hide file tree
Showing 2 changed files with 27 additions and 5 deletions.
13 changes: 9 additions & 4 deletions basyx/aas/model/submodel.py
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down Expand Up @@ -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.
Expand Down
19 changes: 18 additions & 1 deletion docs/source/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -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'
Expand Down Expand Up @@ -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.
Expand All @@ -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
Expand All @@ -102,4 +119,4 @@ def setup(app):
'github_repo': 'basyx-python-sdk',
'github_version': release,
'conf_py_path': '/docs/source/'
}
}

0 comments on commit 50dfbce

Please sign in to comment.