From 681b88be243c54713f93010d16093cdfb3a29464 Mon Sep 17 00:00:00 2001 From: thomas-bc Date: Tue, 30 Apr 2024 17:19:36 -0700 Subject: [PATCH] Remove "tag" terminology --- .../common/loaders/ch_json_loader.py | 1 - .../common/loaders/cmd_json_loader.py | 16 ++++++------- .../common/loaders/event_json_loader.py | 24 +++++++++---------- 3 files changed, 20 insertions(+), 21 deletions(-) diff --git a/src/fprime_gds/common/loaders/ch_json_loader.py b/src/fprime_gds/common/loaders/ch_json_loader.py index acbd3134..9dcb5966 100644 --- a/src/fprime_gds/common/loaders/ch_json_loader.py +++ b/src/fprime_gds/common/loaders/ch_json_loader.py @@ -8,7 +8,6 @@ from fprime_gds.common.templates.ch_template import ChTemplate from fprime_gds.common.loaders.json_loader import JsonLoader -from enum import Enum class ChJsonLoader(JsonLoader): diff --git a/src/fprime_gds/common/loaders/cmd_json_loader.py b/src/fprime_gds/common/loaders/cmd_json_loader.py index d8443ae3..adbe5c9a 100644 --- a/src/fprime_gds/common/loaders/cmd_json_loader.py +++ b/src/fprime_gds/common/loaders/cmd_json_loader.py @@ -13,10 +13,10 @@ class CmdJsonLoader(JsonLoader): """Class to load xml based command dictionaries""" - NAME_TAG = "name" - OPCODE_TAG = "opcode" - DESC_TAG = "annotation" - PARAMETERS_TAG = "formalParams" + NAME = "name" + OPCODE = "opcode" + DESC = "annotation" + PARAMETERS = "formalParams" def construct_dicts(self, _): """ @@ -45,14 +45,14 @@ def construct_dicts(self, _): ) def construct_template_from_dict(self, cmd_dict: dict) -> CmdTemplate: - cmd_name = cmd_dict.get(self.NAME_TAG) + cmd_name = cmd_dict.get(self.NAME) cmd_comp = cmd_name.split(".")[0] cmd_mnemonic = cmd_name.split(".")[1] - cmd_opcode = cmd_dict.get(self.OPCODE_TAG) - cmd_desc = cmd_dict.get(self.DESC_TAG) + cmd_opcode = cmd_dict.get(self.OPCODE) + cmd_desc = cmd_dict.get(self.DESC) # Parse Arguments cmd_args = [] - for param in cmd_dict.get(self.PARAMETERS_TAG, []): + for param in cmd_dict.get(self.PARAMETERS, []): cmd_args.append( ( param.get("name"), diff --git a/src/fprime_gds/common/loaders/event_json_loader.py b/src/fprime_gds/common/loaders/event_json_loader.py index be84a537..27a316ea 100644 --- a/src/fprime_gds/common/loaders/event_json_loader.py +++ b/src/fprime_gds/common/loaders/event_json_loader.py @@ -14,12 +14,12 @@ class EventJsonLoader(JsonLoader): """Class to load xml based event dictionaries""" - NAME_TAG = "name" - ID_TAG = "id" - SEVERITY_TAG = "severity" - FMT_STR_TAG = "format" - DESC_TAG = "annotation" - PARAMETERS_TAG = "formalParams" + NAME = "name" + ID = "id" + SEVERITY = "severity" + FMT_STR = "format" + DESC = "annotation" + PARAMETERS = "formalParams" def construct_dicts(self, _): """ @@ -52,22 +52,22 @@ def construct_dicts(self, _): ) def construct_template_from_dict(self, event_dict: dict): - event_mnemonic = event_dict.get(self.NAME_TAG) + event_mnemonic = event_dict.get(self.NAME) event_comp = event_mnemonic.split(".")[0] event_name = event_mnemonic.split(".")[1] - event_id = event_dict[self.ID_TAG] - event_severity = EventSeverity[event_dict[self.SEVERITY_TAG]] + event_id = event_dict[self.ID] + event_severity = EventSeverity[event_dict[self.SEVERITY]] event_fmt_str = JsonLoader.preprocess_format_str( - event_dict.get(self.FMT_STR_TAG, "") + event_dict.get(self.FMT_STR, "") ) - event_desc = event_dict.get(self.DESC_TAG) + event_desc = event_dict.get(self.DESC) # Parse arguments event_args = [] - for arg in event_dict.get(self.PARAMETERS_TAG, []): + for arg in event_dict.get(self.PARAMETERS, []): event_args.append( ( arg.get("name"),