eive-tmtc/eive_tmtc/config/retvals.py

24 lines
703 B
Python
Raw Normal View History

2022-03-04 14:27:19 +01:00
import os
2023-02-01 11:17:04 +01:00
import logging
2022-12-01 11:14:28 +01:00
2022-12-01 14:16:06 +01:00
from eive_tmtc import EIVE_TMTC_ROOT
from tmtccmd.fsfw import parse_fsfw_returnvalues_csv, RetvalDictT
2022-03-04 14:27:19 +01:00
2022-12-01 11:14:28 +01:00
DEFAULT_RETVAL_CSV_NAME = EIVE_TMTC_ROOT / "config/returnvalues.csv"
2022-03-04 14:27:19 +01:00
__RETVAL_DICT = None
def get_retval_dict() -> RetvalDictT:
global __RETVAL_DICT
if __RETVAL_DICT is None:
if os.path.exists(DEFAULT_RETVAL_CSV_NAME):
__RETVAL_DICT = parse_fsfw_returnvalues_csv(
csv_file=DEFAULT_RETVAL_CSV_NAME
)
else:
2023-02-01 11:17:04 +01:00
logging.getLogger(__name__).warning(
2022-03-04 14:27:19 +01:00
f"No Return Value CSV file found at {DEFAULT_RETVAL_CSV_NAME}"
)
__RETVAL_DICT = dict()
return __RETVAL_DICT