Fixes in interface/zone_controller.py

* Added "supported_directions" dict.
* Bug fix were ports of direction CLINET/SERVER was added as IN/OUT in
  the generated yaml file.
* Copy everything except for element from port definitions.
  (yaml2arxml is updated every now and then and this feels like a better
  approach)

Change-Id: I2351bdc4f5ea102f863528964e05e2affa6bc06f
This commit is contained in:
Henrik Wahlqvist 2024-11-26 11:15:50 +01:00
parent e06600dfe7
commit e2ffc662a9
2 changed files with 340 additions and 30 deletions
NOTICE
powertrain_build/interface

332
NOTICE

@ -12,7 +12,7 @@ Notices Report Content
Components:
Coverage 7.6.4: http://nedbatchelder.com/code/modules/coverage.html : Apache License 2.0
Coverage 7.6.8: http://nedbatchelder.com/code/modules/coverage.html : Apache License 2.0
exceptiongroup 1.2.2: https://github.com/python-trio/exceptiongroup : MIT License
flake8 7.1.1: https://gitlab.com/pycqa/flake8 : MIT License
gitdb 4.0.11: http://github.com/gitpython-developers/gitdb : BSD 3-clause "New" or "Revised" License
@ -20,8 +20,9 @@ GitPython 3.1.43: https://github.com/gitpython-developers/GitPython : BSD 3-clau
idna 3.10: https://github.com/kjd/idna : BSD 3-clause "New" or "Revised" License
mccabe 0.7.0: http://pypi.python.org/pypi/mccabe : Expat License
NumPy 1.24.4: https://numpy.org/ : BSD 3-clause "New" or "Revised" License
Packaging 24.2: https://github.com/pypa/packaging : (BSD 2-clause "Simplified" License OR Apache License 2.0)
pbr 6.1.0: http://openstack.org : Apache License 2.0
powertrain-build 1.0.0: https://opendev.org/volvocars/powertrain-build : Apache License 2.0
powertrain-build 1.0.5.dev3: https://opendev.org/volvocars/powertrain-build : Apache License 2.0
psf-requests 2.32.3: http://docs.python-requests.org : Apache License 2.0
pycodestyle 2.12.1: https://pypi.python.org/pypi/pycodestyle : MIT License
Pyflakes 3.2.0: https://github.com/pyflakes/pyflakes : MIT License
@ -34,13 +35,13 @@ ruamel-yaml 0.18.6: https://pypi.org/project/ruamel.yaml/ : MIT License
ruamel.yaml.clib 0.2.12: https://sourceforge.net/p/ruamel-yaml-clib/code/ci/default/tree/ : MIT License
SciPy 1.9.1: http://www.scipy.org : BSD 3-clause "New" or "Revised" License
smmap 5.0.1: https://github.com/gitpython-developers/smmap : BSD 3-clause "New" or "Revised" License
tomli 2.0.2: https://github.com/hukkin/tomli : MIT License
tomli 2.2.1: https://github.com/hukkin/tomli : (MIT License OR Unknown License)
urllib3 2.2.3 : MIT License
voluptuous 0.15.2: http://pypi.python.org/pypi/voluptuous : BSD 3-clause "New" or "Revised" License
Copyright Text:
Coverage 7.6.4 pypi:coverage/7.6.4: http://nedbatchelder.com/code/modules/coverage.html
Coverage 7.6.8 pypi:coverage/7.6.8: http://nedbatchelder.com/code/modules/coverage.html
No Copyrights found
exceptiongroup 1.2.2 pypi:exceptiongroup/1.2.2: https://github.com/python-trio/exceptiongroup
Copyright (c) 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010,
@ -117,7 +118,25 @@ from this software without specific prior written permission.
# and |release|, also used in various other places throughout the built documents.
idna 3.10 pypi:idna/3.10: https://github.com/kjd/idna
No Copyrights found
Copyright (c) 2013-2024, Kim Davies and contributors.
All rights reserved.
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions are
met:
1. Redistributions of source code must retain the above copyright
notice, this list of conditions and the following disclaimer.
2. Redistributions in binary form must reproduce the above copyright
notice, this list of conditions and the following disclaimer in the
documentation and/or other materials provided with the distribution.
3. Neither the name of the copyright holder nor the names of its
contributors may be used to endorse or promote products derived from
this software without specific prior written permission.
mccabe 0.7.0 pypi:mccabe/0.7.0: http://pypi.python.org/pypi/mccabe
Copyright © 2011-2013 Tarek Ziade <tarek@ziade.org>
@ -2559,6 +2578,28 @@ modification, are permitted provided that the following conditions are met:
$HEADER$
Packaging 24.2 pypi:packaging/24.2: https://github.com/pypa/packaging
Copyright (c) 2017-present Ofek Lev <oss@ofek.dev>
Copyright (c) Donald Stufft and individual contributors.
All rights reserved.
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions are met:
1. Redistributions of source code must retain the above copyright notice,
this list of conditions and the following disclaimer.
2. Redistributions in binary form must reproduce the above copyright
notice, this list of conditions and the following disclaimer in the
documentation and/or other materials provided with the distribution.
copyright = ABOUT
# -- Options for HTML output --------------------------------------------------
# https://www.sphinx-doc.org/en/master/usage/configuration.html#options-for-html-output
pbr 6.1.0 pypi:pbr/6.1.0: http://openstack.org
Copyright (c) 2011 OpenStack Foundation
@ -2615,7 +2656,7 @@ add_function_parentheses = True
# If true, '()' will be appended to :func: etc. cross-reference text.
add_function_parentheses = True
powertrain-build 1.0.0 pypi:powertrain-build/1.0.0: https://opendev.org/volvocars/powertrain-build
powertrain-build 1.0.5.dev3 pypi:powertrain-build/1.0.5.dev3: https://opendev.org/volvocars/powertrain-build
No Copyrights found
psf-requests 2.32.3 pypi:requests/2.32.3: http://docs.python-requests.org
(c)
@ -2645,16 +2686,85 @@ pycodestyle 2.12.1 pypi:pycodestyle/2.12.1: https://pypi.python.org/pypi/pycodes
Copyright © 2014-2020 Ian Lee <IanLee1521@gmail.com>
Pyflakes 3.2.0 pypi:pyflakes/3.2.0: https://github.com/pyflakes/pyflakes
No Copyrights found
Copyright 2005-2011 Divmod, Inc.
Copyright 2013 Florent Xicluna. See LICENSE file for details
import os.path
try:
Copyright 2013-2014 Florent Xicluna
pytest 8.3.3 pypi:pytest/8.3.3: http://pytest.org
No Copyrights found
(c)
# ASCII fast path.
if 0x20 <= o < 0x07F:
(c)
# Control characters.
if category == "Cc":
(C)
assert all_marks ==
assert get_unpacked_marks(C, consider_mro=False) == [xfail("c").mark]
(c)
if wc < 0:
return -1
width += wc
(c) in ("F", "W"):
return 2
return 1
Copyright (c) 2004 Holger Krekel and others
Copyright (c) 2014, Gregory Boissinot
Copyright Holger Krekel and others, 2004.
python-certifi 2024.7.4 pypi:certifi/2024.7.4: https://certifiio.readthedocs.io/en/latest/
No Copyrights found
python-pluggy 1.5.0 pypi:pluggy/1.5.0: https://pypi.python.org/pypi/pluggy
Copyright (c) 2015 holger krekel (rather uses bitbucket/hpk42)
python3-charset-normalizer 3.4.0 pypi:charset-normalizer/3.4.0: https://github.com/ousret/charset_normalizer
No Copyrights found
(c) https://stackoverflow.com/questions/3041986/apt-command-line-interface-like-yes-no-input
"""
valid = {"yes": True, "y": True, "ye": True, "no": False, "n": False}
if default is None:
(c) https://stackoverflow.com/questions/3041986/apt-command-line-interface-like-yes-no-input
"""
valid = {"yes": True, "y": True, "ye": True, "no": False, "n": False}
if default is None:
Copyright (c) 2019 TAHRI Ahmed R.
Copyright (c) 2019 TAHRI Ahmed R.
copyright = '2023, Ahmed TAHRI
author = 'Ahmed TAHRI'
# The version info for the project you're documenting, acts as replacement for
# |version| and |release|, also used in various other places throughout the
# built documents.
copyright: (c) 2021 by Ahmed TAHRI
copyright: (c) 2021 by Ahmed TAHRI
© 2012
## 💼 For Enterprise
© [Ahmed TAHRI @Ousret
RonnyPfannschmidt/iniconfig 2.0.0 pypi:iniconfig/2.0.0: https://github.com/RonnyPfannschmidt/iniconfig
(C) Ronny Pfannschmidt, Holger Krekel -- MIT licensed
"""
@ -2676,7 +2786,164 @@ from typing import (
ruamel-yaml 0.18.6 pypi:ruamel.yaml/0.18.6: https://pypi.org/project/ruamel.yaml/
No Copyrights found
ruamel.yaml.clib 0.2.12 pypi:ruamel.yaml.clib/0.2.12: https://sourceforge.net/p/ruamel-yaml-clib/code/ci/default/tree/
No Copyrights found
(c) ((unsigned char)c)
#define __Pyx_long_cast(x) ((long)x)
#define __Pyx_fits_Py_ssize_t(v, type, is_signed) (\
(sizeof(type) < sizeof(Py_ssize_t)) ||\
(sizeof(type) > sizeof(Py_ssize_t) &&\
likely(v < (type)PY_SSIZE_T_MAX ||\
v == (type)PY_SSIZE_T_MAX) &&\
(!is_signed || likely(v > (type)PY_SSIZE_T_MIN ||\
v == (type)PY_SSIZE_T_MIN))) ||\
(sizeof(type) == sizeof(Py_ssize_t) &&\
(is_signed || likely(v < (type)PY_SSIZE_T_MAX ||\
v == (type)PY_SSIZE_T_MAX))) )
static CYTHON_INLINE int __Pyx_is_valid_index(Py_ssize_t i, Py_ssize_t limit) {
return (size_t) i < (size_t) limit;
}
#if defined (__cplusplus) && __cplusplus >= 201103L
#include <cstdlib>
#define __Pyx_sst_abs(value) std::abs(value)
#elif SIZEOF_INT >= SIZEOF_SIZE_T
#define __Pyx_sst_abs(value) abs(value)
#elif SIZEOF_LONG >= SIZEOF_SIZE_T
#define __Pyx_sst_abs(value) labs(value)
#elif defined (_MSC_VER)
#define __Pyx_sst_abs(value) ((Py_ssize_t)_abs64(value))
#elif defined (__STDC_VERSION__) && __STDC_VERSION__ >= 199901L
#define __Pyx_sst_abs(value) llabs(value)
#elif defined (__GNUC__)
#define __Pyx_sst_abs(value) __builtin_llabs(value)
#else
#define __Pyx_sst_abs(value) ((value<0) ? -value : value)
#endif
static CYTHON_INLINE Py_ssize_t __Pyx_ssize_strlen(const char *s);
static CYTHON_INLINE const char* __Pyx_PyObject_AsString(PyObject*);
static CYTHON_INLINE const char* __Pyx_PyObject_AsStringAndSize(PyObject*, Py_ssize_t* length);
static CYTHON_INLINE PyObject* __Pyx_PyByteArray_FromString(const char*);
#define __Pyx_PyByteArray_FromStringAndSize(s, l) PyByteArray_FromStringAndSize((const char*)s, l)
#define __Pyx_PyBytes_FromString PyBytes_FromString
#define __Pyx_PyBytes_FromStringAndSize PyBytes_FromStringAndSize
static CYTHON_INLINE PyObject* __Pyx_PyUnicode_FromString(const char*);
#if PY_MAJOR_VERSION < 3
#define __Pyx_PyStr_FromString __Pyx_PyBytes_FromString
#define __Pyx_PyStr_FromStringAndSize __Pyx_PyBytes_FromStringAndSize
#else
#define __Pyx_PyStr_FromString __Pyx_PyUnicode_FromString
#define __Pyx_PyStr_FromStringAndSize __Pyx_PyUnicode_FromStringAndSize
#endif
#define __Pyx_PyBytes_AsWritableString(s) ((char*) PyBytes_AS_STRING(s))
#define __Pyx_PyBytes_AsWritableSString(s) ((signed char*) PyBytes_AS_STRING(s))
#define __Pyx_PyBytes_AsWritableUString(s) ((unsigned char*) PyBytes_AS_STRING(s))
#define __Pyx_PyBytes_AsString(s) ((const char*) PyBytes_AS_STRING(s))
#define __Pyx_PyBytes_AsSString(s) ((const signed char*) PyBytes_AS_STRING(s))
#define __Pyx_PyBytes_AsUString(s) ((const unsigned char*) PyBytes_AS_STRING(s))
#define __Pyx_PyObject_AsWritableString(s) ((char*)(__pyx_uintptr_t) __Pyx_PyObject_AsString(s))
#define __Pyx_PyObject_AsWritableSString(s) ((signed char*)(__pyx_uintptr_t) __Pyx_PyObject_AsString(s))
#define __Pyx_PyObject_AsWritableUString(s) ((unsigned char*)(__pyx_uintptr_t) __Pyx_PyObject_AsString(s))
#define __Pyx_PyObject_AsSString(s) ((const signed char*) __Pyx_PyObject_AsString(s))
#define __Pyx_PyObject_AsUString(s) ((const unsigned char*) __Pyx_PyObject_AsString(s))
#define __Pyx_PyObject_FromCString(s) __Pyx_PyObject_FromString((const char*)s)
#define __Pyx_PyBytes_FromCString(s) __Pyx_PyBytes_FromString((const char*)s)
#define __Pyx_PyByteArray_FromCString(s) __Pyx_PyByteArray_FromString((const char*)s)
#define __Pyx_PyStr_FromCString(s) __Pyx_PyStr_FromString((const char*)s)
#define __Pyx_PyUnicode_FromCString(s) __Pyx_PyUnicode_FromString((const char*)s)
#define __Pyx_PyUnicode_FromOrdinal(o) PyUnicode_FromOrdinal((int)o)
#define __Pyx_PyUnicode_AsUnicode PyUnicode_AsUnicode
#define __Pyx_NewRef(obj) (Py_INCREF(obj), obj)
#define __Pyx_Owned_Py_None(b) __Pyx_NewRef(Py_None)
static CYTHON_INLINE PyObject * __Pyx_PyBool_FromLong(long b);
static CYTHON_INLINE int __Pyx_PyObject_IsTrue(PyObject*);
static CYTHON_INLINE int __Pyx_PyObject_IsTrueAndDecref(PyObject*);
static CYTHON_INLINE PyObject* __Pyx_PyNumber_IntOrLong(PyObject* x);
#define __Pyx_PySequence_Tuple(obj)\
(likely(PyTuple_CheckExact(obj)) ? __Pyx_NewRef(obj) : PySequence_Tuple(obj))
static CYTHON_INLINE Py_ssize_t __Pyx_PyIndex_AsSsize_t(PyObject*);
static CYTHON_INLINE PyObject * __Pyx_PyInt_FromSize_t(size_t);
static CYTHON_INLINE Py_hash_t __Pyx_PyIndex_AsHash_t(PyObject*);
#if CYTHON_ASSUME_SAFE_MACROS
#define __pyx_PyFloat_AsDouble(x) (PyFloat_CheckExact(x) ? PyFloat_AS_DOUBLE(x) : PyFloat_AsDouble(x))
#else
#define __pyx_PyFloat_AsDouble(x) PyFloat_AsDouble(x)
#endif
#define __pyx_PyFloat_AsFloat(x) ((float) __pyx_PyFloat_AsDouble(x))
#if PY_MAJOR_VERSION >= 3
#define __Pyx_PyNumber_Int(x) (PyLong_CheckExact(x) ? __Pyx_NewRef(x) : PyNumber_Long(x))
#else
#define __Pyx_PyNumber_Int(x) (PyInt_CheckExact(x) ? __Pyx_NewRef(x) : PyNumber_Int(x))
#endif
#if CYTHON_USE_PYLONG_INTERNALS
#if PY_VERSION_HEX >= 0x030C00A7
#ifndef _PyLong_SIGN_MASK
#define _PyLong_SIGN_MASK 3
#endif
#ifndef _PyLong_NON_SIZE_BITS
#define _PyLong_NON_SIZE_BITS 3
#endif
#define __Pyx_PyLong_Sign(x) (((PyLongObject*)x)->long_value.lv_tag & _PyLong_SIGN_MASK)
#define __Pyx_PyLong_IsNeg(x) ((__Pyx_PyLong_Sign(x) & 2) != 0)
#define __Pyx_PyLong_IsNonNeg(x) (!__Pyx_PyLong_IsNeg(x))
#define __Pyx_PyLong_IsZero(x) (__Pyx_PyLong_Sign(x) & 1)
#define __Pyx_PyLong_IsPos(x) (__Pyx_PyLong_Sign(x) == 0)
#define __Pyx_PyLong_CompactValueUnsigned(x) (__Pyx_PyLong_Digits(x)[0])
#define __Pyx_PyLong_DigitCount(x) ((Py_ssize_t) (((PyLongObject*)x)->long_value.lv_tag >> _PyLong_NON_SIZE_BITS))
#define __Pyx_PyLong_SignedDigitCount(x)\
((1 - (Py_ssize_t) __Pyx_PyLong_Sign(x)) * __Pyx_PyLong_DigitCount(x))
#if defined(PyUnstable_Long_IsCompact) && defined(PyUnstable_Long_CompactValue)
#define __Pyx_PyLong_IsCompact(x) PyUnstable_Long_IsCompact((PyLongObject*) x)
#define __Pyx_PyLong_CompactValue(x) PyUnstable_Long_CompactValue((PyLongObject*) x)
#else
#define __Pyx_PyLong_IsCompact(x) (((PyLongObject*)x)->long_value.lv_tag < (2 << _PyLong_NON_SIZE_BITS))
#define __Pyx_PyLong_CompactValue(x) ((1 - (Py_ssize_t) __Pyx_PyLong_Sign(x)) * (Py_ssize_t) __Pyx_PyLong_Digits(x)[0])
#endif
typedef Py_ssize_t __Pyx_compact_pylong;
typedef size_t __Pyx_compact_upylong;
#else
#define __Pyx_PyLong_IsNeg(x) (Py_SIZE(x) < 0)
#define __Pyx_PyLong_IsNonNeg(x) (Py_SIZE(x) >= 0)
#define __Pyx_PyLong_IsZero(x) (Py_SIZE(x) == 0)
#define __Pyx_PyLong_IsPos(x) (Py_SIZE(x) > 0)
#define __Pyx_PyLong_CompactValueUnsigned(x) ((Py_SIZE(x) == 0) ? 0 : __Pyx_PyLong_Digits(x)[0])
#define __Pyx_PyLong_DigitCount(x) __Pyx_sst_abs(Py_SIZE(x))
#define __Pyx_PyLong_SignedDigitCount(x) Py_SIZE(x)
#define __Pyx_PyLong_IsCompact(x) (Py_SIZE(x) == 0 || Py_SIZE(x) == 1 || Py_SIZE(x) == -1)
#define __Pyx_PyLong_CompactValue(x)\
((Py_SIZE(x) == 0) ? (sdigit) 0 : ((Py_SIZE(x) < 0) ? -(sdigit)__Pyx_PyLong_Digits(x)[0] : (sdigit)__Pyx_PyLong_Digits(x)[0]))
typedef sdigit __Pyx_compact_pylong;
typedef digit __Pyx_compact_upylong;
#endif
#if PY_VERSION_HEX >= 0x030C00A5
#define __Pyx_PyLong_Digits(x) (((PyLongObject*)x)->long_value.ob_digit)
#else
#define __Pyx_PyLong_Digits(x) (((PyLongObject*)x)->ob_digit)
#endif
#endif
#if PY_MAJOR_VERSION < 3 && __PYX_DEFAULT_STRING_ENCODING_IS_ASCII
#include <string.h>
static int __Pyx_sys_getdefaultencoding_not_ascii;
static int __Pyx_init_sys_getdefaultencoding_params(void) {
PyObject* sys;
PyObject* default_encoding = NULL;
PyObject* ascii_chars_u = NULL;
PyObject* ascii_chars_b = NULL;
const char* default_encoding_c;
sys = PyImport_ImportModule("sys");
if (!sys) goto bad;
default_encoding = PyObject_CallMethod(sys, (char*) "getdefaultencoding", NULL);
Py_DECREF(sys);
if (!default_encoding) goto bad;
default_encoding_c = PyBytes_AsString(default_encoding);
if (!default_encoding_c) goto bad;
if (strcmp(default_encoding_c, "ascii") == 0) {
__Pyx_sys_getdefaultencoding_not_ascii = 0;
} else {
char ascii_chars[128];
int c;
for (c = 0; c < 128; c++) {
ascii_chars[c] = (char) c;
Copyright (c) 2019-2024 Anthon van der Neut, Ruamel bvba
SciPy 1.9.1 pypi:scipy/1.9.1: http://www.scipy.org
(c) (Col
@ -13325,10 +13592,18 @@ its contributors may be used to endorse or promote products derived
from this software without specific prior written permission.
tomli 2.0.2 pypi:tomli/2.0.2: https://github.com/hukkin/tomli
tomli 2.2.1 pypi:tomli/2.2.1: https://github.com/hukkin/tomli
No Copyrights found
urllib3 2.2.3 pypi:urllib3/2.2.3
No Copyrights found
Copyright (c) 2008-2020 Andrey Petrov and contributors.
copyright = f"
# The short X.Y version.
version = urllib3.__version__
# The full version, including alpha/beta/rc tags.
release = version
voluptuous 0.15.2 pypi:voluptuous/0.15.2: http://pypi.python.org/pypi/voluptuous
Copyright (c) 2010, Alec Thomas
All rights reserved.
@ -13350,7 +13625,7 @@ modification, are permitted provided that the following conditions are met:
Licenses:
Apache License 2.0
(Coverage 7.6.4, pbr 6.1.0, powertrain-build 1.0.0, psf-requests 2.32.3)
(Coverage 7.6.8, Packaging 24.2, pbr 6.1.0, powertrain-build 1.0.5.dev3, psf-requests 2.32.3)
Apache License
Version 2.0, January 2004
@ -13536,6 +13811,35 @@ third-party archives.
---
BSD 2-clause "Simplified" License
(Packaging 24.2)
BSD Two Clause License
======================
Redistribution and use in source and binary forms, with or without modification,
are permitted provided that the following conditions are met:
1. Redistributions of source code must retain the above copyright notice, this
list of conditions and the following disclaimer.
2. Redistributions in binary form must reproduce the above copyright notice,
this list of conditions and the following disclaimer in the documentation
and/or other materials provided with the distribution.
THIS SOFTWARE IS PROVIDED BY THE AUTHOR "AS IS" AND ANY EXPRESS OR IMPLIED
WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT
SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT
OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH
DAMAGE.
---
BSD 3-clause "New" or "Revised" License
(gitdb 4.0.11, GitPython 3.1.43, idna 3.10, NumPy 1.24.4, SciPy 1.9.1, smmap 5.0.1, voluptuous 0.15.2)
@ -13600,7 +13904,7 @@ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
---
MIT License
(exceptiongroup 1.2.2, flake8 7.1.1, pycodestyle 2.12.1, Pyflakes 3.2.0, pytest 8.3.3, python-pluggy 1.5.0, python3-charset-normalizer 3.4.0, RonnyPfannschmidt/iniconfig 2.0.0, ruamel-yaml 0.18.6, ruamel.yaml.clib 0.2.12, tomli 2.0.2, urllib3 2.2.3)
(exceptiongroup 1.2.2, flake8 7.1.1, pycodestyle 2.12.1, Pyflakes 3.2.0, pytest 8.3.3, python-pluggy 1.5.0, python3-charset-normalizer 3.4.0, RonnyPfannschmidt/iniconfig 2.0.0, ruamel-yaml 0.18.6, ruamel.yaml.clib 0.2.12, tomli 2.2.1, urllib3 2.2.3)
The MIT License
===============

@ -139,39 +139,46 @@ class ZCAL(BaseApplication):
Args:
definition (list(Path)): Definition files
"""
raw = self.read_translation_files(definition)
self.composition_spec = {
key: raw[key] for key in ("port_interfaces", "data_types", "calls", "diagnostics", "nv-needs") if key in raw
}
ports_info = {}
for port_name, port in raw.get("ports", {}).items():
ports_info[port_name] = {k: v for k, v in port.items() if k not in ["element"]}
signal_struct = port.get("element", {})
direction = port.get("direction", None)
if signal_struct:
for element_name, element_data in signal_struct.items():
self.populate_signal_translations(port_name, element_name, element_data)
# Loop inside function to make sure direction is consistent
ports_info[port_name] = {
**self.get_port_info(signal_struct),
"interface": port.get("interface")
}
else:
ports_info[port_name] = {"direction": port.get("direction"), "interface": port.get("interface")}
ports_info[port_name].update(self.get_port_info(port_name, direction, signal_struct))
self.composition_spec["ports"] = ports_info
@staticmethod
def get_port_info(signal_struct):
def get_port_info(port_name, direction, signal_struct):
"""Extract port information from signal elements in port. Raises exception
if signal elements are not exclusively sent in one direction.
Args:
signal_struct (dict): Signal dict containing list of signal elements
port_name (str): Name of the port.
direction (str): Direction of the port.
signal_struct (dict): Signal dict containing list of signal elements.
Returns:
port_info (dict): Dict containing port direction and if any elements
port_info (dict): Dict containing information if any elements
should have an update bit associated with them.
"""
if direction is None:
raise BadYamlFormat(f'Port {port_name} is missing required property "direction".')
supported_directions = {
"IN": "IN",
"OUT": "OUT",
"CLIENT": "IN",
"SERVER": "OUT",
}
direction = supported_directions[direction]
update_elements = set()
direction = None
for element_name, element_data in signal_struct.items():
for element in element_data:
if "insignal" in element:
@ -180,15 +187,14 @@ class ZCAL(BaseApplication):
temp_dir = "OUT"
else:
raise BadYamlFormat(f"in/out signal for element in { element_name } is missing.")
if direction is not None and direction != temp_dir:
if direction != temp_dir:
raise BadYamlFormat(f"Signal { element_name } has both in and out elements.")
direction = temp_dir
if element.get("updateBit", False):
update_elements.add(element_name)
port_info = {"direction": direction}
if update_elements:
port_info["enable_update"] = list(update_elements)
return port_info
return {"enable_update": list(update_elements)}
return {}
def populate_signal_translations(self, port_name, element_name, element_data):
"""Populate class translations data.