Skip to content

Commit

Permalink
Remove "tag" terminology
Browse files Browse the repository at this point in the history
  • Loading branch information
thomas-bc committed May 1, 2024
1 parent d8296fc commit 681b88b
Show file tree
Hide file tree
Showing 3 changed files with 20 additions and 21 deletions.
1 change: 0 additions & 1 deletion src/fprime_gds/common/loaders/ch_json_loader.py
Original file line number Diff line number Diff line change
Expand Up @@ -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):
Expand Down
16 changes: 8 additions & 8 deletions src/fprime_gds/common/loaders/cmd_json_loader.py
Original file line number Diff line number Diff line change
Expand Up @@ -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, _):
"""
Expand Down Expand Up @@ -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"),
Expand Down
24 changes: 12 additions & 12 deletions src/fprime_gds/common/loaders/event_json_loader.py
Original file line number Diff line number Diff line change
Expand Up @@ -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, _):
"""
Expand Down Expand Up @@ -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"),
Expand Down

0 comments on commit 681b88b

Please sign in to comment.