bparzella/secsgem

View on GitHub
data/templates/data_items.py.j2

Summary

Maintainability
Test Coverage
#####################################################################
# {{ data.file_name }}
#
# (c) Copyright 2021, Benjamin Parzella. All rights reserved.
#
# This library is free software; you can redistribute it and/or
# modify it under the terms of the GNU Lesser General Public
# License as published by the Free Software Foundation; either
# version 2.1 of the License, or (at your option) any later version.
#
# This software is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
# GNU Lesser General Public License for more details.
#####################################################################
"""{{ data.name }} data item."""
from .. import variables
from .base import DataItemBase


class {{ data.name }}(DataItemBase):{{ data.linter_message }}
    """{{ data.description }}.

{% if data.help %}
    {{ data.help }}

{% endif %}
{% if data.single_type %}
    :Type: :class:`{{ data.type[0] }} <secsgem.secs.variables.{{ data.type[0] }}>`
{% else %}
    :Types:
  {% for type in data.type %}
       - :class:`{{ type }} <secsgem.secs.variables.{{ type }}>`
  {% endfor %}
{% endif %}
{% if data.length > 0 %}
    :Length: {{ data.length }}
{% endif %}

{{ data.values }}{% if used_by|length > 0 %}
    **Used In Function**
  {% for function in used_by %}
        - :class:`Secs{{ function.name }} <secsgem.secs.functions.Secs{{ function.name }}>`
  {% endfor %}

{% endif %}    """

  {% if data.single_type %}
    __type__ = variables.{{ data.type[0] }}
  {% else %}
    __type__ = variables.Dynamic
    __allowedtypes__ = [
      {% for type in data.type %}
        variables.{{ type }}{{ "," if not loop.last else "" }}
      {% endfor %}
    ]
  {% endif %}
  {% if data.length > 0 %}
    __count__ = {{ data.length }}
  {% endif %}{{ data.extra_variables }}